blob: 9bf2f6423798160a122a96b70f64f68feaa1f54b [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 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700349 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700350 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
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700755 case POSITION_TASK_IN_STACK_TRANSACTION: {
756 data.enforceInterface(IActivityManager.descriptor);
757 int taskId = data.readInt();
758 int stackId = data.readInt();
759 int position = data.readInt();
760 positionTaskInStack(taskId, stackId, position);
761 reply.writeNoException();
762 return true;
763 }
764
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800765 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700766 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800767 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700768 reply.writeNoException();
769 reply.writeTypedList(list);
770 return true;
771 }
772
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800773 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700774 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800775 int stackId = data.readInt();
776 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700777 reply.writeNoException();
778 if (info != null) {
779 reply.writeInt(1);
780 info.writeToParcel(reply, 0);
781 } else {
782 reply.writeInt(0);
783 }
784 return true;
785 }
786
Winson Chung303e1ff2014-03-07 15:06:19 -0800787 case IS_IN_HOME_STACK_TRANSACTION: {
788 data.enforceInterface(IActivityManager.descriptor);
789 int taskId = data.readInt();
790 boolean isInHomeStack = isInHomeStack(taskId);
791 reply.writeNoException();
792 reply.writeInt(isInHomeStack ? 1 : 0);
793 return true;
794 }
795
Craig Mautnercf910b02013-04-23 11:23:27 -0700796 case SET_FOCUSED_STACK_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 int stackId = data.readInt();
799 setFocusedStack(stackId);
800 reply.writeNoException();
801 return true;
802 }
803
Winson Chungd16c5652015-01-26 16:11:07 -0800804 case GET_FOCUSED_STACK_ID_TRANSACTION: {
805 data.enforceInterface(IActivityManager.descriptor);
806 int focusedStackId = getFocusedStackId();
807 reply.writeNoException();
808 reply.writeInt(focusedStackId);
809 return true;
810 }
811
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700812 case SET_FOCUSED_TASK_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 int taskId = data.readInt();
815 setFocusedStack(taskId);
816 reply.writeNoException();
817 return true;
818 }
819
Winson Chung740c3ac2014-11-12 16:14:38 -0800820 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
821 data.enforceInterface(IActivityManager.descriptor);
822 IBinder token = data.readStrongBinder();
823 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
824 reply.writeNoException();
825 return true;
826 }
827
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800828 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
829 data.enforceInterface(IActivityManager.descriptor);
830 IBinder token = data.readStrongBinder();
831 boolean onlyRoot = data.readInt() != 0;
832 int res = token != null
833 ? getTaskForActivity(token, onlyRoot) : -1;
834 reply.writeNoException();
835 reply.writeInt(res);
836 return true;
837 }
838
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800839 case GET_CONTENT_PROVIDER_TRANSACTION: {
840 data.enforceInterface(IActivityManager.descriptor);
841 IBinder b = data.readStrongBinder();
842 IApplicationThread app = ApplicationThreadNative.asInterface(b);
843 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700844 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700845 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700846 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800847 reply.writeNoException();
848 if (cph != null) {
849 reply.writeInt(1);
850 cph.writeToParcel(reply, 0);
851 } else {
852 reply.writeInt(0);
853 }
854 return true;
855 }
856
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800857 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
858 data.enforceInterface(IActivityManager.descriptor);
859 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700860 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800861 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700862 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800863 reply.writeNoException();
864 if (cph != null) {
865 reply.writeInt(1);
866 cph.writeToParcel(reply, 0);
867 } else {
868 reply.writeInt(0);
869 }
870 return true;
871 }
872
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
874 data.enforceInterface(IActivityManager.descriptor);
875 IBinder b = data.readStrongBinder();
876 IApplicationThread app = ApplicationThreadNative.asInterface(b);
877 ArrayList<ContentProviderHolder> providers =
878 data.createTypedArrayList(ContentProviderHolder.CREATOR);
879 publishContentProviders(app, providers);
880 reply.writeNoException();
881 return true;
882 }
883
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700884 case REF_CONTENT_PROVIDER_TRANSACTION: {
885 data.enforceInterface(IActivityManager.descriptor);
886 IBinder b = data.readStrongBinder();
887 int stable = data.readInt();
888 int unstable = data.readInt();
889 boolean res = refContentProvider(b, stable, unstable);
890 reply.writeNoException();
891 reply.writeInt(res ? 1 : 0);
892 return true;
893 }
894
895 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
896 data.enforceInterface(IActivityManager.descriptor);
897 IBinder b = data.readStrongBinder();
898 unstableProviderDied(b);
899 reply.writeNoException();
900 return true;
901 }
902
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700903 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
904 data.enforceInterface(IActivityManager.descriptor);
905 IBinder b = data.readStrongBinder();
906 appNotRespondingViaProvider(b);
907 reply.writeNoException();
908 return true;
909 }
910
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800911 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
912 data.enforceInterface(IActivityManager.descriptor);
913 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700914 boolean stable = data.readInt() != 0;
915 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800916 reply.writeNoException();
917 return true;
918 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800919
920 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
921 data.enforceInterface(IActivityManager.descriptor);
922 String name = data.readString();
923 IBinder token = data.readStrongBinder();
924 removeContentProviderExternal(name, token);
925 reply.writeNoException();
926 return true;
927 }
928
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700929 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
932 PendingIntent pi = getRunningServiceControlPanel(comp);
933 reply.writeNoException();
934 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
935 return true;
936 }
937
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 case START_SERVICE_TRANSACTION: {
939 data.enforceInterface(IActivityManager.descriptor);
940 IBinder b = data.readStrongBinder();
941 IApplicationThread app = ApplicationThreadNative.asInterface(b);
942 Intent service = Intent.CREATOR.createFromParcel(data);
943 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700944 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700945 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700946 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 reply.writeNoException();
948 ComponentName.writeToParcel(cn, reply);
949 return true;
950 }
951
952 case STOP_SERVICE_TRANSACTION: {
953 data.enforceInterface(IActivityManager.descriptor);
954 IBinder b = data.readStrongBinder();
955 IApplicationThread app = ApplicationThreadNative.asInterface(b);
956 Intent service = Intent.CREATOR.createFromParcel(data);
957 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700958 int userId = data.readInt();
959 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800960 reply.writeNoException();
961 reply.writeInt(res);
962 return true;
963 }
964
965 case STOP_SERVICE_TOKEN_TRANSACTION: {
966 data.enforceInterface(IActivityManager.descriptor);
967 ComponentName className = ComponentName.readFromParcel(data);
968 IBinder token = data.readStrongBinder();
969 int startId = data.readInt();
970 boolean res = stopServiceToken(className, token, startId);
971 reply.writeNoException();
972 reply.writeInt(res ? 1 : 0);
973 return true;
974 }
975
976 case SET_SERVICE_FOREGROUND_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 ComponentName className = ComponentName.readFromParcel(data);
979 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700980 int id = data.readInt();
981 Notification notification = null;
982 if (data.readInt() != 0) {
983 notification = Notification.CREATOR.createFromParcel(data);
984 }
985 boolean removeNotification = data.readInt() != 0;
986 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 reply.writeNoException();
988 return true;
989 }
990
991 case BIND_SERVICE_TRANSACTION: {
992 data.enforceInterface(IActivityManager.descriptor);
993 IBinder b = data.readStrongBinder();
994 IApplicationThread app = ApplicationThreadNative.asInterface(b);
995 IBinder token = data.readStrongBinder();
996 Intent service = Intent.CREATOR.createFromParcel(data);
997 String resolvedType = data.readString();
998 b = data.readStrongBinder();
999 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001000 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001001 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001002 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001003 int res = bindService(app, token, service, resolvedType, conn, fl,
1004 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005 reply.writeNoException();
1006 reply.writeInt(res);
1007 return true;
1008 }
1009
1010 case UNBIND_SERVICE_TRANSACTION: {
1011 data.enforceInterface(IActivityManager.descriptor);
1012 IBinder b = data.readStrongBinder();
1013 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1014 boolean res = unbindService(conn);
1015 reply.writeNoException();
1016 reply.writeInt(res ? 1 : 0);
1017 return true;
1018 }
1019
1020 case PUBLISH_SERVICE_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 IBinder token = data.readStrongBinder();
1023 Intent intent = Intent.CREATOR.createFromParcel(data);
1024 IBinder service = data.readStrongBinder();
1025 publishService(token, intent, service);
1026 reply.writeNoException();
1027 return true;
1028 }
1029
1030 case UNBIND_FINISHED_TRANSACTION: {
1031 data.enforceInterface(IActivityManager.descriptor);
1032 IBinder token = data.readStrongBinder();
1033 Intent intent = Intent.CREATOR.createFromParcel(data);
1034 boolean doRebind = data.readInt() != 0;
1035 unbindFinished(token, intent, doRebind);
1036 reply.writeNoException();
1037 return true;
1038 }
1039
1040 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001043 int type = data.readInt();
1044 int startId = data.readInt();
1045 int res = data.readInt();
1046 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001047 reply.writeNoException();
1048 return true;
1049 }
1050
1051 case START_INSTRUMENTATION_TRANSACTION: {
1052 data.enforceInterface(IActivityManager.descriptor);
1053 ComponentName className = ComponentName.readFromParcel(data);
1054 String profileFile = data.readString();
1055 int fl = data.readInt();
1056 Bundle arguments = data.readBundle();
1057 IBinder b = data.readStrongBinder();
1058 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001059 b = data.readStrongBinder();
1060 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001061 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001062 String abiOverride = data.readString();
1063 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1064 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001065 reply.writeNoException();
1066 reply.writeInt(res ? 1 : 0);
1067 return true;
1068 }
1069
1070
1071 case FINISH_INSTRUMENTATION_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 IBinder b = data.readStrongBinder();
1074 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1075 int resultCode = data.readInt();
1076 Bundle results = data.readBundle();
1077 finishInstrumentation(app, resultCode, results);
1078 reply.writeNoException();
1079 return true;
1080 }
1081
1082 case GET_CONFIGURATION_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
1084 Configuration config = getConfiguration();
1085 reply.writeNoException();
1086 config.writeToParcel(reply, 0);
1087 return true;
1088 }
1089
1090 case UPDATE_CONFIGURATION_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 Configuration config = Configuration.CREATOR.createFromParcel(data);
1093 updateConfiguration(config);
1094 reply.writeNoException();
1095 return true;
1096 }
1097
1098 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 IBinder token = data.readStrongBinder();
1101 int requestedOrientation = data.readInt();
1102 setRequestedOrientation(token, requestedOrientation);
1103 reply.writeNoException();
1104 return true;
1105 }
1106
1107 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 IBinder token = data.readStrongBinder();
1110 int req = getRequestedOrientation(token);
1111 reply.writeNoException();
1112 reply.writeInt(req);
1113 return true;
1114 }
1115
1116 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 IBinder token = data.readStrongBinder();
1119 ComponentName cn = getActivityClassForToken(token);
1120 reply.writeNoException();
1121 ComponentName.writeToParcel(cn, reply);
1122 return true;
1123 }
1124
1125 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 IBinder token = data.readStrongBinder();
1128 reply.writeNoException();
1129 reply.writeString(getPackageForToken(token));
1130 return true;
1131 }
1132
1133 case GET_INTENT_SENDER_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 int type = data.readInt();
1136 String packageName = data.readString();
1137 IBinder token = data.readStrongBinder();
1138 String resultWho = data.readString();
1139 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001140 Intent[] requestIntents;
1141 String[] requestResolvedTypes;
1142 if (data.readInt() != 0) {
1143 requestIntents = data.createTypedArray(Intent.CREATOR);
1144 requestResolvedTypes = data.createStringArray();
1145 } else {
1146 requestIntents = null;
1147 requestResolvedTypes = null;
1148 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001149 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001150 Bundle options = data.readInt() != 0
1151 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001152 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001153 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001154 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001155 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001156 reply.writeNoException();
1157 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1158 return true;
1159 }
1160
1161 case CANCEL_INTENT_SENDER_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 IIntentSender r = IIntentSender.Stub.asInterface(
1164 data.readStrongBinder());
1165 cancelIntentSender(r);
1166 reply.writeNoException();
1167 return true;
1168 }
1169
1170 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1171 data.enforceInterface(IActivityManager.descriptor);
1172 IIntentSender r = IIntentSender.Stub.asInterface(
1173 data.readStrongBinder());
1174 String res = getPackageForIntentSender(r);
1175 reply.writeNoException();
1176 reply.writeString(res);
1177 return true;
1178 }
1179
Christopher Tatec4a07d12012-04-06 14:19:13 -07001180 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 IIntentSender r = IIntentSender.Stub.asInterface(
1183 data.readStrongBinder());
1184 int res = getUidForIntentSender(r);
1185 reply.writeNoException();
1186 reply.writeInt(res);
1187 return true;
1188 }
1189
Dianne Hackborn41203752012-08-31 14:05:51 -07001190 case HANDLE_INCOMING_USER_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 int callingPid = data.readInt();
1193 int callingUid = data.readInt();
1194 int userId = data.readInt();
1195 boolean allowAll = data.readInt() != 0 ;
1196 boolean requireFull = data.readInt() != 0;
1197 String name = data.readString();
1198 String callerPackage = data.readString();
1199 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1200 requireFull, name, callerPackage);
1201 reply.writeNoException();
1202 reply.writeInt(res);
1203 return true;
1204 }
1205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 case SET_PROCESS_LIMIT_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 int max = data.readInt();
1209 setProcessLimit(max);
1210 reply.writeNoException();
1211 return true;
1212 }
1213
1214 case GET_PROCESS_LIMIT_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 int limit = getProcessLimit();
1217 reply.writeNoException();
1218 reply.writeInt(limit);
1219 return true;
1220 }
1221
1222 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1223 data.enforceInterface(IActivityManager.descriptor);
1224 IBinder token = data.readStrongBinder();
1225 int pid = data.readInt();
1226 boolean isForeground = data.readInt() != 0;
1227 setProcessForeground(token, pid, isForeground);
1228 reply.writeNoException();
1229 return true;
1230 }
1231
1232 case CHECK_PERMISSION_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 String perm = data.readString();
1235 int pid = data.readInt();
1236 int uid = data.readInt();
1237 int res = checkPermission(perm, pid, uid);
1238 reply.writeNoException();
1239 reply.writeInt(res);
1240 return true;
1241 }
1242
Dianne Hackbornff170242014-11-19 10:59:01 -08001243 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1244 data.enforceInterface(IActivityManager.descriptor);
1245 String perm = data.readString();
1246 int pid = data.readInt();
1247 int uid = data.readInt();
1248 IBinder token = data.readStrongBinder();
1249 int res = checkPermissionWithToken(perm, pid, uid, token);
1250 reply.writeNoException();
1251 reply.writeInt(res);
1252 return true;
1253 }
1254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001255 case CHECK_URI_PERMISSION_TRANSACTION: {
1256 data.enforceInterface(IActivityManager.descriptor);
1257 Uri uri = Uri.CREATOR.createFromParcel(data);
1258 int pid = data.readInt();
1259 int uid = data.readInt();
1260 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001261 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001262 IBinder callerToken = data.readStrongBinder();
1263 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001264 reply.writeNoException();
1265 reply.writeInt(res);
1266 return true;
1267 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001268
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001270 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 String packageName = data.readString();
1272 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1273 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001274 int userId = data.readInt();
1275 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001276 reply.writeNoException();
1277 reply.writeInt(res ? 1 : 0);
1278 return true;
1279 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001280
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001281 case GRANT_URI_PERMISSION_TRANSACTION: {
1282 data.enforceInterface(IActivityManager.descriptor);
1283 IBinder b = data.readStrongBinder();
1284 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1285 String targetPkg = data.readString();
1286 Uri uri = Uri.CREATOR.createFromParcel(data);
1287 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001288 int userId = data.readInt();
1289 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001290 reply.writeNoException();
1291 return true;
1292 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001294 case REVOKE_URI_PERMISSION_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 IBinder b = data.readStrongBinder();
1297 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1298 Uri uri = Uri.CREATOR.createFromParcel(data);
1299 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001300 int userId = data.readInt();
1301 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001302 reply.writeNoException();
1303 return true;
1304 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001305
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001306 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 Uri uri = Uri.CREATOR.createFromParcel(data);
1309 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001310 int userId = data.readInt();
1311 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001312 reply.writeNoException();
1313 return true;
1314 }
1315
1316 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 Uri uri = Uri.CREATOR.createFromParcel(data);
1319 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001320 int userId = data.readInt();
1321 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001322 reply.writeNoException();
1323 return true;
1324 }
1325
1326 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001328 final String packageName = data.readString();
1329 final boolean incoming = data.readInt() != 0;
1330 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1331 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001332 reply.writeNoException();
1333 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1334 return true;
1335 }
1336
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1338 data.enforceInterface(IActivityManager.descriptor);
1339 IBinder b = data.readStrongBinder();
1340 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1341 boolean waiting = data.readInt() != 0;
1342 showWaitingForDebugger(app, waiting);
1343 reply.writeNoException();
1344 return true;
1345 }
1346
1347 case GET_MEMORY_INFO_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1350 getMemoryInfo(mi);
1351 reply.writeNoException();
1352 mi.writeToParcel(reply, 0);
1353 return true;
1354 }
1355
1356 case UNHANDLED_BACK_TRANSACTION: {
1357 data.enforceInterface(IActivityManager.descriptor);
1358 unhandledBack();
1359 reply.writeNoException();
1360 return true;
1361 }
1362
1363 case OPEN_CONTENT_URI_TRANSACTION: {
1364 data.enforceInterface(IActivityManager.descriptor);
1365 Uri uri = Uri.parse(data.readString());
1366 ParcelFileDescriptor pfd = openContentUri(uri);
1367 reply.writeNoException();
1368 if (pfd != null) {
1369 reply.writeInt(1);
1370 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1371 } else {
1372 reply.writeInt(0);
1373 }
1374 return true;
1375 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001376
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001377 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1378 data.enforceInterface(IActivityManager.descriptor);
1379 setLockScreenShown(data.readInt() != 0);
1380 reply.writeNoException();
1381 return true;
1382 }
1383
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 case SET_DEBUG_APP_TRANSACTION: {
1385 data.enforceInterface(IActivityManager.descriptor);
1386 String pn = data.readString();
1387 boolean wfd = data.readInt() != 0;
1388 boolean per = data.readInt() != 0;
1389 setDebugApp(pn, wfd, per);
1390 reply.writeNoException();
1391 return true;
1392 }
1393
1394 case SET_ALWAYS_FINISH_TRANSACTION: {
1395 data.enforceInterface(IActivityManager.descriptor);
1396 boolean enabled = data.readInt() != 0;
1397 setAlwaysFinish(enabled);
1398 reply.writeNoException();
1399 return true;
1400 }
1401
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001402 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001403 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001404 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001405 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001406 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001407 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001408 return true;
1409 }
1410
1411 case ENTER_SAFE_MODE_TRANSACTION: {
1412 data.enforceInterface(IActivityManager.descriptor);
1413 enterSafeMode();
1414 reply.writeNoException();
1415 return true;
1416 }
1417
1418 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 IIntentSender is = IIntentSender.Stub.asInterface(
1421 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001422 int sourceUid = data.readInt();
1423 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001424 String tag = data.readString();
1425 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1426 reply.writeNoException();
1427 return true;
1428 }
1429
1430 case NOTE_ALARM_START_TRANSACTION: {
1431 data.enforceInterface(IActivityManager.descriptor);
1432 IIntentSender is = IIntentSender.Stub.asInterface(
1433 data.readStrongBinder());
1434 int sourceUid = data.readInt();
1435 String tag = data.readString();
1436 noteAlarmStart(is, sourceUid, tag);
1437 reply.writeNoException();
1438 return true;
1439 }
1440
1441 case NOTE_ALARM_FINISH_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 IIntentSender is = IIntentSender.Stub.asInterface(
1444 data.readStrongBinder());
1445 int sourceUid = data.readInt();
1446 String tag = data.readString();
1447 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001448 reply.writeNoException();
1449 return true;
1450 }
1451
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001452 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001453 data.enforceInterface(IActivityManager.descriptor);
1454 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001455 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001456 boolean secure = data.readInt() != 0;
1457 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 reply.writeNoException();
1459 reply.writeInt(res ? 1 : 0);
1460 return true;
1461 }
1462
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001463 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1464 data.enforceInterface(IActivityManager.descriptor);
1465 String reason = data.readString();
1466 boolean res = killProcessesBelowForeground(reason);
1467 reply.writeNoException();
1468 reply.writeInt(res ? 1 : 0);
1469 return true;
1470 }
1471
Dan Egnor60d87622009-12-16 16:32:58 -08001472 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1473 data.enforceInterface(IActivityManager.descriptor);
1474 IBinder app = data.readStrongBinder();
1475 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1476 handleApplicationCrash(app, ci);
1477 reply.writeNoException();
1478 return true;
1479 }
1480
1481 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001482 data.enforceInterface(IActivityManager.descriptor);
1483 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001484 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001485 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001486 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001487 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001488 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001489 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001490 return true;
1491 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001492
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001493 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
1495 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001496 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001497 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1498 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001499 reply.writeNoException();
1500 return true;
1501 }
1502
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001503 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1504 data.enforceInterface(IActivityManager.descriptor);
1505 int sig = data.readInt();
1506 signalPersistentProcesses(sig);
1507 reply.writeNoException();
1508 return true;
1509 }
1510
Dianne Hackborn03abb812010-01-04 18:43:19 -08001511 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1512 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001513 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001514 int userId = data.readInt();
1515 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001516 reply.writeNoException();
1517 return true;
1518 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001519
1520 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1521 data.enforceInterface(IActivityManager.descriptor);
1522 killAllBackgroundProcesses();
1523 reply.writeNoException();
1524 return true;
1525 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001526
Dianne Hackborn03abb812010-01-04 18:43:19 -08001527 case FORCE_STOP_PACKAGE_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
1529 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001530 int userId = data.readInt();
1531 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001532 reply.writeNoException();
1533 return true;
1534 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001535
1536 case GET_MY_MEMORY_STATE_TRANSACTION: {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 ActivityManager.RunningAppProcessInfo info =
1539 new ActivityManager.RunningAppProcessInfo();
1540 getMyMemoryState(info);
1541 reply.writeNoException();
1542 info.writeToParcel(reply, 0);
1543 return true;
1544 }
1545
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001546 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 ConfigurationInfo config = getDeviceConfigurationInfo();
1549 reply.writeNoException();
1550 config.writeToParcel(reply, 0);
1551 return true;
1552 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001553
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001554 case PROFILE_CONTROL_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001557 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001558 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001559 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001560 ProfilerInfo profilerInfo = data.readInt() != 0
1561 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1562 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001563 reply.writeNoException();
1564 reply.writeInt(res ? 1 : 0);
1565 return true;
1566 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001567
Dianne Hackborn55280a92009-05-07 15:53:46 -07001568 case SHUTDOWN_TRANSACTION: {
1569 data.enforceInterface(IActivityManager.descriptor);
1570 boolean res = shutdown(data.readInt());
1571 reply.writeNoException();
1572 reply.writeInt(res ? 1 : 0);
1573 return true;
1574 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001575
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001576 case STOP_APP_SWITCHES_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 stopAppSwitches();
1579 reply.writeNoException();
1580 return true;
1581 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001582
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001583 case RESUME_APP_SWITCHES_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 resumeAppSwitches();
1586 reply.writeNoException();
1587 return true;
1588 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001590 case PEEK_SERVICE_TRANSACTION: {
1591 data.enforceInterface(IActivityManager.descriptor);
1592 Intent service = Intent.CREATOR.createFromParcel(data);
1593 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001594 String callingPackage = data.readString();
1595 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001596 reply.writeNoException();
1597 reply.writeStrongBinder(binder);
1598 return true;
1599 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001600
Christopher Tate181fafa2009-05-14 11:12:14 -07001601 case START_BACKUP_AGENT_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1604 int backupRestoreMode = data.readInt();
1605 boolean success = bindBackupAgent(info, backupRestoreMode);
1606 reply.writeNoException();
1607 reply.writeInt(success ? 1 : 0);
1608 return true;
1609 }
1610
1611 case BACKUP_AGENT_CREATED_TRANSACTION: {
1612 data.enforceInterface(IActivityManager.descriptor);
1613 String packageName = data.readString();
1614 IBinder agent = data.readStrongBinder();
1615 backupAgentCreated(packageName, agent);
1616 reply.writeNoException();
1617 return true;
1618 }
1619
1620 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1621 data.enforceInterface(IActivityManager.descriptor);
1622 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1623 unbindBackupAgent(info);
1624 reply.writeNoException();
1625 return true;
1626 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001627
1628 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 String packageName = data.readString();
1631 addPackageDependency(packageName);
1632 reply.writeNoException();
1633 return true;
1634 }
1635
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001636 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001637 data.enforceInterface(IActivityManager.descriptor);
1638 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001639 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001640 String reason = data.readString();
1641 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001642 reply.writeNoException();
1643 return true;
1644 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001645
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001646 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1647 data.enforceInterface(IActivityManager.descriptor);
1648 String reason = data.readString();
1649 closeSystemDialogs(reason);
1650 reply.writeNoException();
1651 return true;
1652 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001653
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001654 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001656 int[] pids = data.createIntArray();
1657 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001658 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001659 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001660 return true;
1661 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001662
1663 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 String processName = data.readString();
1666 int uid = data.readInt();
1667 killApplicationProcess(processName, uid);
1668 reply.writeNoException();
1669 return true;
1670 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001671
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001672 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 IBinder token = data.readStrongBinder();
1675 String packageName = data.readString();
1676 int enterAnim = data.readInt();
1677 int exitAnim = data.readInt();
1678 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001679 reply.writeNoException();
1680 return true;
1681 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001682
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001683 case IS_USER_A_MONKEY_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001685 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001686 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001687 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001688 return true;
1689 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001690
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001691 case SET_USER_IS_MONKEY_TRANSACTION: {
1692 data.enforceInterface(IActivityManager.descriptor);
1693 final boolean monkey = (data.readInt() == 1);
1694 setUserIsMonkey(monkey);
1695 reply.writeNoException();
1696 return true;
1697 }
1698
Dianne Hackborn860755f2010-06-03 18:47:52 -07001699 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1700 data.enforceInterface(IActivityManager.descriptor);
1701 finishHeavyWeightApp();
1702 reply.writeNoException();
1703 return true;
1704 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001705
1706 case IS_IMMERSIVE_TRANSACTION: {
1707 data.enforceInterface(IActivityManager.descriptor);
1708 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001709 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001710 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001711 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001712 return true;
1713 }
1714
Craig Mautnerd61dc202014-07-07 11:09:11 -07001715 case IS_TOP_OF_TASK_TRANSACTION: {
1716 data.enforceInterface(IActivityManager.descriptor);
1717 IBinder token = data.readStrongBinder();
1718 final boolean isTopOfTask = isTopOfTask(token);
1719 reply.writeNoException();
1720 reply.writeInt(isTopOfTask ? 1 : 0);
1721 return true;
1722 }
1723
Craig Mautner5eda9b32013-07-02 11:58:16 -07001724 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001725 data.enforceInterface(IActivityManager.descriptor);
1726 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001727 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001728 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001729 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001730 return true;
1731 }
1732
1733 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001736 final Bundle bundle;
1737 if (data.readInt() == 0) {
1738 bundle = null;
1739 } else {
1740 bundle = data.readBundle();
1741 }
1742 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1743 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001744 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001745 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001746 return true;
1747 }
1748
Craig Mautner233ceee2014-05-09 17:05:11 -07001749 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1750 data.enforceInterface(IActivityManager.descriptor);
1751 IBinder token = data.readStrongBinder();
1752 final ActivityOptions options = getActivityOptions(token);
1753 reply.writeNoException();
1754 reply.writeBundle(options == null ? null : options.toBundle());
1755 return true;
1756 }
1757
Daniel Sandler69a48172010-06-23 16:29:36 -04001758 case SET_IMMERSIVE_TRANSACTION: {
1759 data.enforceInterface(IActivityManager.descriptor);
1760 IBinder token = data.readStrongBinder();
1761 boolean imm = data.readInt() == 1;
1762 setImmersive(token, imm);
1763 reply.writeNoException();
1764 return true;
1765 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001766
Daniel Sandler69a48172010-06-23 16:29:36 -04001767 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1768 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001769 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001770 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001771 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001772 return true;
1773 }
1774
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001775 case CRASH_APPLICATION_TRANSACTION: {
1776 data.enforceInterface(IActivityManager.descriptor);
1777 int uid = data.readInt();
1778 int initialPid = data.readInt();
1779 String packageName = data.readString();
1780 String message = data.readString();
1781 crashApplication(uid, initialPid, packageName, message);
1782 reply.writeNoException();
1783 return true;
1784 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001785
1786 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1787 data.enforceInterface(IActivityManager.descriptor);
1788 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001789 int userId = data.readInt();
1790 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001791 reply.writeNoException();
1792 reply.writeString(type);
1793 return true;
1794 }
1795
Dianne Hackborn7e269642010-08-25 19:50:20 -07001796 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
1798 String name = data.readString();
1799 IBinder perm = newUriPermissionOwner(name);
1800 reply.writeNoException();
1801 reply.writeStrongBinder(perm);
1802 return true;
1803 }
1804
1805 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1806 data.enforceInterface(IActivityManager.descriptor);
1807 IBinder owner = data.readStrongBinder();
1808 int fromUid = data.readInt();
1809 String targetPkg = data.readString();
1810 Uri uri = Uri.CREATOR.createFromParcel(data);
1811 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001812 int sourceUserId = data.readInt();
1813 int targetUserId = data.readInt();
1814 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1815 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001816 reply.writeNoException();
1817 return true;
1818 }
1819
1820 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 IBinder owner = data.readStrongBinder();
1823 Uri uri = null;
1824 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001825 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001826 }
1827 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001828 int userId = data.readInt();
1829 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001830 reply.writeNoException();
1831 return true;
1832 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001833
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001834 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1835 data.enforceInterface(IActivityManager.descriptor);
1836 int callingUid = data.readInt();
1837 String targetPkg = data.readString();
1838 Uri uri = Uri.CREATOR.createFromParcel(data);
1839 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001840 int userId = data.readInt();
1841 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001842 reply.writeNoException();
1843 reply.writeInt(res);
1844 return true;
1845 }
1846
Andy McFadden824c5102010-07-09 16:26:57 -07001847 case DUMP_HEAP_TRANSACTION: {
1848 data.enforceInterface(IActivityManager.descriptor);
1849 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001850 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001851 boolean managed = data.readInt() != 0;
1852 String path = data.readString();
1853 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001854 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001855 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001856 reply.writeNoException();
1857 reply.writeInt(res ? 1 : 0);
1858 return true;
1859 }
1860
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001861 case START_ACTIVITIES_TRANSACTION:
1862 {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 IBinder b = data.readStrongBinder();
1865 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001866 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001867 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1868 String[] resolvedTypes = data.createStringArray();
1869 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001870 Bundle options = data.readInt() != 0
1871 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001872 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001873 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001874 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001875 reply.writeNoException();
1876 reply.writeInt(result);
1877 return true;
1878 }
1879
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001880 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1881 {
1882 data.enforceInterface(IActivityManager.descriptor);
1883 int mode = getFrontActivityScreenCompatMode();
1884 reply.writeNoException();
1885 reply.writeInt(mode);
1886 return true;
1887 }
1888
1889 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1890 {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 int mode = data.readInt();
1893 setFrontActivityScreenCompatMode(mode);
1894 reply.writeNoException();
1895 reply.writeInt(mode);
1896 return true;
1897 }
1898
1899 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1900 {
1901 data.enforceInterface(IActivityManager.descriptor);
1902 String pkg = data.readString();
1903 int mode = getPackageScreenCompatMode(pkg);
1904 reply.writeNoException();
1905 reply.writeInt(mode);
1906 return true;
1907 }
1908
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001909 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1910 {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001913 int mode = data.readInt();
1914 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001915 reply.writeNoException();
1916 return true;
1917 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001918
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001919 case SWITCH_USER_TRANSACTION: {
1920 data.enforceInterface(IActivityManager.descriptor);
1921 int userid = data.readInt();
1922 boolean result = switchUser(userid);
1923 reply.writeNoException();
1924 reply.writeInt(result ? 1 : 0);
1925 return true;
1926 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001927
Kenny Guy08488bf2014-02-21 17:40:37 +00001928 case START_USER_IN_BACKGROUND_TRANSACTION: {
1929 data.enforceInterface(IActivityManager.descriptor);
1930 int userid = data.readInt();
1931 boolean result = startUserInBackground(userid);
1932 reply.writeNoException();
1933 reply.writeInt(result ? 1 : 0);
1934 return true;
1935 }
1936
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001937 case STOP_USER_TRANSACTION: {
1938 data.enforceInterface(IActivityManager.descriptor);
1939 int userid = data.readInt();
1940 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1941 data.readStrongBinder());
1942 int result = stopUser(userid, callback);
1943 reply.writeNoException();
1944 reply.writeInt(result);
1945 return true;
1946 }
1947
Amith Yamasani52f1d752012-03-28 18:19:29 -07001948 case GET_CURRENT_USER_TRANSACTION: {
1949 data.enforceInterface(IActivityManager.descriptor);
1950 UserInfo userInfo = getCurrentUser();
1951 reply.writeNoException();
1952 userInfo.writeToParcel(reply, 0);
1953 return true;
1954 }
1955
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001956 case IS_USER_RUNNING_TRANSACTION: {
1957 data.enforceInterface(IActivityManager.descriptor);
1958 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001959 boolean orStopping = data.readInt() != 0;
1960 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001961 reply.writeNoException();
1962 reply.writeInt(result ? 1 : 0);
1963 return true;
1964 }
1965
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001966 case GET_RUNNING_USER_IDS_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 int[] result = getRunningUserIds();
1969 reply.writeNoException();
1970 reply.writeIntArray(result);
1971 return true;
1972 }
1973
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001974 case REMOVE_TASK_TRANSACTION:
1975 {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001978 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001979 reply.writeNoException();
1980 reply.writeInt(result ? 1 : 0);
1981 return true;
1982 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001983
Jeff Sharkeya4620792011-05-20 15:29:23 -07001984 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1987 data.readStrongBinder());
1988 registerProcessObserver(observer);
1989 return true;
1990 }
1991
1992 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1995 data.readStrongBinder());
1996 unregisterProcessObserver(observer);
1997 return true;
1998 }
1999
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002000 case REGISTER_UID_OBSERVER_TRANSACTION: {
2001 data.enforceInterface(IActivityManager.descriptor);
2002 IUidObserver observer = IUidObserver.Stub.asInterface(
2003 data.readStrongBinder());
2004 registerUidObserver(observer);
2005 return true;
2006 }
2007
2008 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2009 data.enforceInterface(IActivityManager.descriptor);
2010 IUidObserver observer = IUidObserver.Stub.asInterface(
2011 data.readStrongBinder());
2012 unregisterUidObserver(observer);
2013 return true;
2014 }
2015
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002016 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2017 {
2018 data.enforceInterface(IActivityManager.descriptor);
2019 String pkg = data.readString();
2020 boolean ask = getPackageAskScreenCompat(pkg);
2021 reply.writeNoException();
2022 reply.writeInt(ask ? 1 : 0);
2023 return true;
2024 }
2025
2026 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2027 {
2028 data.enforceInterface(IActivityManager.descriptor);
2029 String pkg = data.readString();
2030 boolean ask = data.readInt() != 0;
2031 setPackageAskScreenCompat(pkg, ask);
2032 reply.writeNoException();
2033 return true;
2034 }
2035
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002036 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2037 data.enforceInterface(IActivityManager.descriptor);
2038 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002039 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002040 boolean res = isIntentSenderTargetedToPackage(r);
2041 reply.writeNoException();
2042 reply.writeInt(res ? 1 : 0);
2043 return true;
2044 }
2045
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002046 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 IIntentSender r = IIntentSender.Stub.asInterface(
2049 data.readStrongBinder());
2050 boolean res = isIntentSenderAnActivity(r);
2051 reply.writeNoException();
2052 reply.writeInt(res ? 1 : 0);
2053 return true;
2054 }
2055
Dianne Hackborn81038902012-11-26 17:04:09 -08002056 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2057 data.enforceInterface(IActivityManager.descriptor);
2058 IIntentSender r = IIntentSender.Stub.asInterface(
2059 data.readStrongBinder());
2060 Intent intent = getIntentForIntentSender(r);
2061 reply.writeNoException();
2062 if (intent != null) {
2063 reply.writeInt(1);
2064 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2065 } else {
2066 reply.writeInt(0);
2067 }
2068 return true;
2069 }
2070
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002071 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2072 data.enforceInterface(IActivityManager.descriptor);
2073 IIntentSender r = IIntentSender.Stub.asInterface(
2074 data.readStrongBinder());
2075 String prefix = data.readString();
2076 String tag = getTagForIntentSender(r, prefix);
2077 reply.writeNoException();
2078 reply.writeString(tag);
2079 return true;
2080 }
2081
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002082 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2083 data.enforceInterface(IActivityManager.descriptor);
2084 Configuration config = Configuration.CREATOR.createFromParcel(data);
2085 updatePersistentConfiguration(config);
2086 reply.writeNoException();
2087 return true;
2088 }
2089
Dianne Hackbornb437e092011-08-05 17:50:29 -07002090 case GET_PROCESS_PSS_TRANSACTION: {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 int[] pids = data.createIntArray();
2093 long[] pss = getProcessPss(pids);
2094 reply.writeNoException();
2095 reply.writeLongArray(pss);
2096 return true;
2097 }
2098
Dianne Hackborn661cd522011-08-22 00:26:20 -07002099 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2100 data.enforceInterface(IActivityManager.descriptor);
2101 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2102 boolean always = data.readInt() != 0;
2103 showBootMessage(msg, always);
2104 reply.writeNoException();
2105 return true;
2106 }
2107
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002108 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002109 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002110 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002111 reply.writeNoException();
2112 return true;
2113 }
2114
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002115 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2118 reply.writeNoException();
2119 return true;
2120 }
2121
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002122 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002123 data.enforceInterface(IActivityManager.descriptor);
2124 IBinder token = data.readStrongBinder();
2125 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002126 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002127 reply.writeNoException();
2128 reply.writeInt(res ? 1 : 0);
2129 return true;
2130 }
2131
2132 case NAVIGATE_UP_TO_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 IBinder token = data.readStrongBinder();
2135 Intent target = Intent.CREATOR.createFromParcel(data);
2136 int resultCode = data.readInt();
2137 Intent resultData = null;
2138 if (data.readInt() != 0) {
2139 resultData = Intent.CREATOR.createFromParcel(data);
2140 }
2141 boolean res = navigateUpTo(token, target, resultCode, resultData);
2142 reply.writeNoException();
2143 reply.writeInt(res ? 1 : 0);
2144 return true;
2145 }
2146
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002147 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2148 data.enforceInterface(IActivityManager.descriptor);
2149 IBinder token = data.readStrongBinder();
2150 int res = getLaunchedFromUid(token);
2151 reply.writeNoException();
2152 reply.writeInt(res);
2153 return true;
2154 }
2155
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002156 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2157 data.enforceInterface(IActivityManager.descriptor);
2158 IBinder token = data.readStrongBinder();
2159 String res = getLaunchedFromPackage(token);
2160 reply.writeNoException();
2161 reply.writeString(res);
2162 return true;
2163 }
2164
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002165 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2168 data.readStrongBinder());
2169 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002170 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002171 return true;
2172 }
2173
2174 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2175 data.enforceInterface(IActivityManager.descriptor);
2176 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2177 data.readStrongBinder());
2178 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002179 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002180 return true;
2181 }
2182
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002183 case REQUEST_BUG_REPORT_TRANSACTION: {
2184 data.enforceInterface(IActivityManager.descriptor);
2185 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002186 reply.writeNoException();
2187 return true;
2188 }
2189
2190 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2191 data.enforceInterface(IActivityManager.descriptor);
2192 int pid = data.readInt();
2193 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002194 String reason = data.readString();
2195 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002196 reply.writeNoException();
2197 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002198 return true;
2199 }
2200
Adam Skorydfc7fd72013-08-05 19:23:41 -07002201 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002202 data.enforceInterface(IActivityManager.descriptor);
2203 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002204 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002205 reply.writeNoException();
2206 reply.writeBundle(res);
2207 return true;
2208 }
2209
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002210 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2211 data.enforceInterface(IActivityManager.descriptor);
2212 int requestType = data.readInt();
2213 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002214 IBinder activityToken = data.readStrongBinder();
2215 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002216 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002217 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002218 return true;
2219 }
2220
Adam Skorydfc7fd72013-08-05 19:23:41 -07002221 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002222 data.enforceInterface(IActivityManager.descriptor);
2223 IBinder token = data.readStrongBinder();
2224 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002225 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2226 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002227 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2228 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002229 reply.writeNoException();
2230 return true;
2231 }
2232
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002233 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2234 data.enforceInterface(IActivityManager.descriptor);
2235 Intent intent = Intent.CREATOR.createFromParcel(data);
2236 int requestType = data.readInt();
2237 String hint = data.readString();
2238 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002239 Bundle args = data.readBundle();
2240 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002241 reply.writeNoException();
2242 reply.writeInt(res ? 1 : 0);
2243 return true;
2244 }
2245
Benjamin Franzc200f442015-06-25 18:20:04 +01002246 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2247 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002248 boolean res = isAssistDataAllowedOnCurrentActivity();
2249 reply.writeNoException();
2250 reply.writeInt(res ? 1 : 0);
2251 return true;
2252 }
2253
2254 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2255 data.enforceInterface(IActivityManager.descriptor);
2256 IBinder token = data.readStrongBinder();
2257 Bundle args = data.readBundle();
2258 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002259 reply.writeNoException();
2260 reply.writeInt(res ? 1 : 0);
2261 return true;
2262 }
2263
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002264 case KILL_UID_TRANSACTION: {
2265 data.enforceInterface(IActivityManager.descriptor);
2266 int uid = data.readInt();
2267 String reason = data.readString();
2268 killUid(uid, reason);
2269 reply.writeNoException();
2270 return true;
2271 }
2272
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002273 case HANG_TRANSACTION: {
2274 data.enforceInterface(IActivityManager.descriptor);
2275 IBinder who = data.readStrongBinder();
2276 boolean allowRestart = data.readInt() != 0;
2277 hang(who, allowRestart);
2278 reply.writeNoException();
2279 return true;
2280 }
2281
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002282 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2283 data.enforceInterface(IActivityManager.descriptor);
2284 IBinder token = data.readStrongBinder();
2285 reportActivityFullyDrawn(token);
2286 reply.writeNoException();
2287 return true;
2288 }
2289
Craig Mautner5eda9b32013-07-02 11:58:16 -07002290 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2291 data.enforceInterface(IActivityManager.descriptor);
2292 IBinder token = data.readStrongBinder();
2293 notifyActivityDrawn(token);
2294 reply.writeNoException();
2295 return true;
2296 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002297
2298 case RESTART_TRANSACTION: {
2299 data.enforceInterface(IActivityManager.descriptor);
2300 restart();
2301 reply.writeNoException();
2302 return true;
2303 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002304
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002305 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2306 data.enforceInterface(IActivityManager.descriptor);
2307 performIdleMaintenance();
2308 reply.writeNoException();
2309 return true;
2310 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002311
Todd Kennedyca4d8422015-01-15 15:19:22 -08002312 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002313 data.enforceInterface(IActivityManager.descriptor);
2314 IBinder parentActivityToken = data.readStrongBinder();
2315 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002316 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002317 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002318 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002319 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002320 if (activityContainer != null) {
2321 reply.writeInt(1);
2322 reply.writeStrongBinder(activityContainer.asBinder());
2323 } else {
2324 reply.writeInt(0);
2325 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002326 return true;
2327 }
2328
Craig Mautner95da1082014-02-24 17:54:35 -08002329 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2330 data.enforceInterface(IActivityManager.descriptor);
2331 IActivityContainer activityContainer =
2332 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2333 deleteActivityContainer(activityContainer);
2334 reply.writeNoException();
2335 return true;
2336 }
2337
Todd Kennedy4900bf92015-01-16 16:05:14 -08002338 case CREATE_STACK_ON_DISPLAY: {
2339 data.enforceInterface(IActivityManager.descriptor);
2340 int displayId = data.readInt();
2341 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2342 reply.writeNoException();
2343 if (activityContainer != null) {
2344 reply.writeInt(1);
2345 reply.writeStrongBinder(activityContainer.asBinder());
2346 } else {
2347 reply.writeInt(0);
2348 }
2349 return true;
2350 }
2351
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002352 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002353 data.enforceInterface(IActivityManager.descriptor);
2354 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002355 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002356 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002357 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002358 return true;
2359 }
2360
Craig Mautneraea74a52014-03-08 14:23:10 -08002361 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2362 data.enforceInterface(IActivityManager.descriptor);
2363 final int taskId = data.readInt();
2364 startLockTaskMode(taskId);
2365 reply.writeNoException();
2366 return true;
2367 }
2368
2369 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2370 data.enforceInterface(IActivityManager.descriptor);
2371 IBinder token = data.readStrongBinder();
2372 startLockTaskMode(token);
2373 reply.writeNoException();
2374 return true;
2375 }
2376
Craig Mautnerd61dc202014-07-07 11:09:11 -07002377 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002378 data.enforceInterface(IActivityManager.descriptor);
2379 startLockTaskModeOnCurrent();
2380 reply.writeNoException();
2381 return true;
2382 }
2383
Craig Mautneraea74a52014-03-08 14:23:10 -08002384 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2385 data.enforceInterface(IActivityManager.descriptor);
2386 stopLockTaskMode();
2387 reply.writeNoException();
2388 return true;
2389 }
2390
Craig Mautnerd61dc202014-07-07 11:09:11 -07002391 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002392 data.enforceInterface(IActivityManager.descriptor);
2393 stopLockTaskModeOnCurrent();
2394 reply.writeNoException();
2395 return true;
2396 }
2397
Craig Mautneraea74a52014-03-08 14:23:10 -08002398 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2399 data.enforceInterface(IActivityManager.descriptor);
2400 final boolean isInLockTaskMode = isInLockTaskMode();
2401 reply.writeNoException();
2402 reply.writeInt(isInLockTaskMode ? 1 : 0);
2403 return true;
2404 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002405
Benjamin Franz43261142015-02-11 15:59:44 +00002406 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2407 data.enforceInterface(IActivityManager.descriptor);
2408 final int lockTaskModeState = getLockTaskModeState();
2409 reply.writeNoException();
2410 reply.writeInt(lockTaskModeState);
2411 return true;
2412 }
2413
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002414 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2415 data.enforceInterface(IActivityManager.descriptor);
2416 final IBinder token = data.readStrongBinder();
2417 showLockTaskEscapeMessage(token);
2418 reply.writeNoException();
2419 return true;
2420 }
2421
Winson Chunga449dc02014-05-16 11:15:04 -07002422 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002423 data.enforceInterface(IActivityManager.descriptor);
2424 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002425 ActivityManager.TaskDescription values =
2426 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2427 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002428 reply.writeNoException();
2429 return true;
2430 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002431
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002432 case SET_TASK_RESIZEABLE_TRANSACTION: {
2433 data.enforceInterface(IActivityManager.descriptor);
2434 int taskId = data.readInt();
2435 boolean resizeable = (data.readInt() == 1) ? true : false;
2436 setTaskResizeable(taskId, resizeable);
2437 reply.writeNoException();
2438 return true;
2439 }
2440
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002441 case RESIZE_TASK_TRANSACTION: {
2442 data.enforceInterface(IActivityManager.descriptor);
2443 int taskId = data.readInt();
2444 Rect r = Rect.CREATOR.createFromParcel(data);
2445 resizeTask(taskId, r);
2446 reply.writeNoException();
2447 return true;
2448 }
2449
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002450 case GET_TASK_BOUNDS_TRANSACTION: {
2451 data.enforceInterface(IActivityManager.descriptor);
2452 int taskId = data.readInt();
2453 Rect r = getTaskBounds(taskId);
2454 reply.writeNoException();
2455 r.writeToParcel(reply, 0);
2456 return true;
2457 }
2458
Craig Mautner648f69b2014-09-18 14:16:26 -07002459 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2460 data.enforceInterface(IActivityManager.descriptor);
2461 String filename = data.readString();
2462 Bitmap icon = getTaskDescriptionIcon(filename);
2463 reply.writeNoException();
2464 if (icon == null) {
2465 reply.writeInt(0);
2466 } else {
2467 reply.writeInt(1);
2468 icon.writeToParcel(reply, 0);
2469 }
2470 return true;
2471 }
2472
Winson Chung044d5292014-11-06 11:05:19 -08002473 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2474 data.enforceInterface(IActivityManager.descriptor);
2475 final Bundle bundle;
2476 if (data.readInt() == 0) {
2477 bundle = null;
2478 } else {
2479 bundle = data.readBundle();
2480 }
2481 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2482 startInPlaceAnimationOnFrontMostApplication(options);
2483 reply.writeNoException();
2484 return true;
2485 }
2486
Jose Lima4b6c6692014-08-12 17:41:12 -07002487 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002488 data.enforceInterface(IActivityManager.descriptor);
2489 IBinder token = data.readStrongBinder();
2490 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002491 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002492 reply.writeNoException();
2493 reply.writeInt(success ? 1 : 0);
2494 return true;
2495 }
2496
Jose Lima4b6c6692014-08-12 17:41:12 -07002497 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002498 data.enforceInterface(IActivityManager.descriptor);
2499 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002500 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002501 reply.writeNoException();
2502 reply.writeInt(enabled ? 1 : 0);
2503 return true;
2504 }
2505
Jose Lima4b6c6692014-08-12 17:41:12 -07002506 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002507 data.enforceInterface(IActivityManager.descriptor);
2508 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002509 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002510 reply.writeNoException();
2511 return true;
2512 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002513
2514 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2515 data.enforceInterface(IActivityManager.descriptor);
2516 IBinder token = data.readStrongBinder();
2517 notifyLaunchTaskBehindComplete(token);
2518 reply.writeNoException();
2519 return true;
2520 }
Craig Mautner8746a472014-07-24 15:12:54 -07002521
2522 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2523 data.enforceInterface(IActivityManager.descriptor);
2524 IBinder token = data.readStrongBinder();
2525 notifyEnterAnimationComplete(token);
2526 reply.writeNoException();
2527 return true;
2528 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002529
2530 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2531 data.enforceInterface(IActivityManager.descriptor);
2532 bootAnimationComplete();
2533 reply.writeNoException();
2534 return true;
2535 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002536
Jeff Sharkey605eb792014-11-04 13:34:06 -08002537 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2538 data.enforceInterface(IActivityManager.descriptor);
2539 final int uid = data.readInt();
2540 final byte[] firstPacket = data.createByteArray();
2541 notifyCleartextNetwork(uid, firstPacket);
2542 reply.writeNoException();
2543 return true;
2544 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002545
2546 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2547 data.enforceInterface(IActivityManager.descriptor);
2548 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002549 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002550 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002551 String reportPackage = data.readString();
2552 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002553 reply.writeNoException();
2554 return true;
2555 }
2556
2557 case DUMP_HEAP_FINISHED_TRANSACTION: {
2558 data.enforceInterface(IActivityManager.descriptor);
2559 String path = data.readString();
2560 dumpHeapFinished(path);
2561 reply.writeNoException();
2562 return true;
2563 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002564
2565 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2566 data.enforceInterface(IActivityManager.descriptor);
2567 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2568 data.readStrongBinder());
2569 boolean keepAwake = data.readInt() != 0;
2570 setVoiceKeepAwake(session, keepAwake);
2571 reply.writeNoException();
2572 return true;
2573 }
Craig Mautnere5600772015-04-03 21:36:37 -07002574
2575 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2576 data.enforceInterface(IActivityManager.descriptor);
2577 int userId = data.readInt();
2578 String[] packages = data.readStringArray();
2579 updateLockTaskPackages(userId, packages);
2580 reply.writeNoException();
2581 return true;
2582 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002583
Craig Mautner015c5e52015-04-23 10:39:39 -07002584 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2585 data.enforceInterface(IActivityManager.descriptor);
2586 String packageName = data.readString();
2587 updateDeviceOwner(packageName);
2588 reply.writeNoException();
2589 return true;
2590 }
2591
Dianne Hackborn1e383822015-04-10 14:02:33 -07002592 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2593 data.enforceInterface(IActivityManager.descriptor);
2594 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002595 String callingPackage = data.readString();
2596 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002597 reply.writeNoException();
2598 reply.writeInt(res);
2599 return true;
2600 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002601
2602 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2603 data.enforceInterface(IActivityManager.descriptor);
2604 String process = data.readString();
2605 int userId = data.readInt();
2606 int level = data.readInt();
2607 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2608 reply.writeNoException();
2609 reply.writeInt(res ? 1 : 0);
2610 return true;
2611 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002612
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002613 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2614 data.enforceInterface(IActivityManager.descriptor);
2615 IBinder token = data.readStrongBinder();
2616 boolean res = isRootVoiceInteraction(token);
2617 reply.writeNoException();
2618 reply.writeInt(res ? 1 : 0);
2619 return true;
2620 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002621
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002622 case START_BINDER_TRACKING_TRANSACTION: {
2623 data.enforceInterface(IActivityManager.descriptor);
2624 boolean res = startBinderTracking();
2625 reply.writeNoException();
2626 reply.writeInt(res ? 1 : 0);
2627 return true;
2628 }
2629
2630 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2631 data.enforceInterface(IActivityManager.descriptor);
2632 ParcelFileDescriptor fd = data.readInt() != 0
2633 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2634 boolean res = stopBinderTrackingAndDump(fd);
2635 reply.writeNoException();
2636 reply.writeInt(res ? 1 : 0);
2637 return true;
2638 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002639 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002640
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002641 return super.onTransact(code, data, reply, flags);
2642 }
2643
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002644 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002645 return this;
2646 }
2647
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002648 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2649 protected IActivityManager create() {
2650 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002651 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002652 Log.v("ActivityManager", "default service binder = " + b);
2653 }
2654 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002655 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002656 Log.v("ActivityManager", "default service = " + am);
2657 }
2658 return am;
2659 }
2660 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002661}
2662
2663class ActivityManagerProxy implements IActivityManager
2664{
2665 public ActivityManagerProxy(IBinder remote)
2666 {
2667 mRemote = remote;
2668 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002670 public IBinder asBinder()
2671 {
2672 return mRemote;
2673 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002674
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002675 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002676 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002677 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002678 Parcel data = Parcel.obtain();
2679 Parcel reply = Parcel.obtain();
2680 data.writeInterfaceToken(IActivityManager.descriptor);
2681 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002682 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002683 intent.writeToParcel(data, 0);
2684 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002685 data.writeStrongBinder(resultTo);
2686 data.writeString(resultWho);
2687 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002688 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002689 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002690 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002691 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002692 } else {
2693 data.writeInt(0);
2694 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002695 if (options != null) {
2696 data.writeInt(1);
2697 options.writeToParcel(data, 0);
2698 } else {
2699 data.writeInt(0);
2700 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002701 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2702 reply.readException();
2703 int result = reply.readInt();
2704 reply.recycle();
2705 data.recycle();
2706 return result;
2707 }
Amith Yamasani82644082012-08-03 13:09:11 -07002708
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002709 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002710 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002711 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2712 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002713 Parcel data = Parcel.obtain();
2714 Parcel reply = Parcel.obtain();
2715 data.writeInterfaceToken(IActivityManager.descriptor);
2716 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002717 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002718 intent.writeToParcel(data, 0);
2719 data.writeString(resolvedType);
2720 data.writeStrongBinder(resultTo);
2721 data.writeString(resultWho);
2722 data.writeInt(requestCode);
2723 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002724 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002725 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002726 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002727 } else {
2728 data.writeInt(0);
2729 }
2730 if (options != null) {
2731 data.writeInt(1);
2732 options.writeToParcel(data, 0);
2733 } else {
2734 data.writeInt(0);
2735 }
2736 data.writeInt(userId);
2737 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2738 reply.readException();
2739 int result = reply.readInt();
2740 reply.recycle();
2741 data.recycle();
2742 return result;
2743 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002744 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2745 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002746 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2747 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002748 Parcel data = Parcel.obtain();
2749 Parcel reply = Parcel.obtain();
2750 data.writeInterfaceToken(IActivityManager.descriptor);
2751 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2752 data.writeString(callingPackage);
2753 intent.writeToParcel(data, 0);
2754 data.writeString(resolvedType);
2755 data.writeStrongBinder(resultTo);
2756 data.writeString(resultWho);
2757 data.writeInt(requestCode);
2758 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002759 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002760 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002761 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002762 } else {
2763 data.writeInt(0);
2764 }
2765 if (options != null) {
2766 data.writeInt(1);
2767 options.writeToParcel(data, 0);
2768 } else {
2769 data.writeInt(0);
2770 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002771 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002772 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002773 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2774 reply.readException();
2775 int result = reply.readInt();
2776 reply.recycle();
2777 data.recycle();
2778 return result;
2779 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002780 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2781 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002782 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2783 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002784 Parcel data = Parcel.obtain();
2785 Parcel reply = Parcel.obtain();
2786 data.writeInterfaceToken(IActivityManager.descriptor);
2787 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002788 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002789 intent.writeToParcel(data, 0);
2790 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002791 data.writeStrongBinder(resultTo);
2792 data.writeString(resultWho);
2793 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002794 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002795 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002796 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002797 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002798 } else {
2799 data.writeInt(0);
2800 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002801 if (options != null) {
2802 data.writeInt(1);
2803 options.writeToParcel(data, 0);
2804 } else {
2805 data.writeInt(0);
2806 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002807 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002808 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2809 reply.readException();
2810 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2811 reply.recycle();
2812 data.recycle();
2813 return result;
2814 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002815 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2816 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002817 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002818 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002819 Parcel data = Parcel.obtain();
2820 Parcel reply = Parcel.obtain();
2821 data.writeInterfaceToken(IActivityManager.descriptor);
2822 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002823 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002824 intent.writeToParcel(data, 0);
2825 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002826 data.writeStrongBinder(resultTo);
2827 data.writeString(resultWho);
2828 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002829 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002830 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002831 if (options != null) {
2832 data.writeInt(1);
2833 options.writeToParcel(data, 0);
2834 } else {
2835 data.writeInt(0);
2836 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002837 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002838 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2839 reply.readException();
2840 int result = reply.readInt();
2841 reply.recycle();
2842 data.recycle();
2843 return result;
2844 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002845 public int startActivityIntentSender(IApplicationThread caller,
2846 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002847 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002848 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2853 intent.writeToParcel(data, 0);
2854 if (fillInIntent != null) {
2855 data.writeInt(1);
2856 fillInIntent.writeToParcel(data, 0);
2857 } else {
2858 data.writeInt(0);
2859 }
2860 data.writeString(resolvedType);
2861 data.writeStrongBinder(resultTo);
2862 data.writeString(resultWho);
2863 data.writeInt(requestCode);
2864 data.writeInt(flagsMask);
2865 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002866 if (options != null) {
2867 data.writeInt(1);
2868 options.writeToParcel(data, 0);
2869 } else {
2870 data.writeInt(0);
2871 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002872 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002873 reply.readException();
2874 int result = reply.readInt();
2875 reply.recycle();
2876 data.recycle();
2877 return result;
2878 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002879 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2880 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002881 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2882 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002883 Parcel data = Parcel.obtain();
2884 Parcel reply = Parcel.obtain();
2885 data.writeInterfaceToken(IActivityManager.descriptor);
2886 data.writeString(callingPackage);
2887 data.writeInt(callingPid);
2888 data.writeInt(callingUid);
2889 intent.writeToParcel(data, 0);
2890 data.writeString(resolvedType);
2891 data.writeStrongBinder(session.asBinder());
2892 data.writeStrongBinder(interactor.asBinder());
2893 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002894 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002895 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002896 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002897 } else {
2898 data.writeInt(0);
2899 }
2900 if (options != null) {
2901 data.writeInt(1);
2902 options.writeToParcel(data, 0);
2903 } else {
2904 data.writeInt(0);
2905 }
2906 data.writeInt(userId);
2907 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2908 reply.readException();
2909 int result = reply.readInt();
2910 reply.recycle();
2911 data.recycle();
2912 return result;
2913 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002914 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002915 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002916 Parcel data = Parcel.obtain();
2917 Parcel reply = Parcel.obtain();
2918 data.writeInterfaceToken(IActivityManager.descriptor);
2919 data.writeStrongBinder(callingActivity);
2920 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002921 if (options != null) {
2922 data.writeInt(1);
2923 options.writeToParcel(data, 0);
2924 } else {
2925 data.writeInt(0);
2926 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002927 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2928 reply.readException();
2929 int result = reply.readInt();
2930 reply.recycle();
2931 data.recycle();
2932 return result != 0;
2933 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002934 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2935 Parcel data = Parcel.obtain();
2936 Parcel reply = Parcel.obtain();
2937 data.writeInterfaceToken(IActivityManager.descriptor);
2938 data.writeInt(taskId);
2939 if (options == null) {
2940 data.writeInt(0);
2941 } else {
2942 data.writeInt(1);
2943 options.writeToParcel(data, 0);
2944 }
2945 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2946 reply.readException();
2947 int result = reply.readInt();
2948 reply.recycle();
2949 data.recycle();
2950 return result;
2951 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07002952 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002953 throws RemoteException {
2954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeStrongBinder(token);
2958 data.writeInt(resultCode);
2959 if (resultData != null) {
2960 data.writeInt(1);
2961 resultData.writeToParcel(data, 0);
2962 } else {
2963 data.writeInt(0);
2964 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07002965 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002966 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2967 reply.readException();
2968 boolean res = reply.readInt() != 0;
2969 data.recycle();
2970 reply.recycle();
2971 return res;
2972 }
2973 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2974 {
2975 Parcel data = Parcel.obtain();
2976 Parcel reply = Parcel.obtain();
2977 data.writeInterfaceToken(IActivityManager.descriptor);
2978 data.writeStrongBinder(token);
2979 data.writeString(resultWho);
2980 data.writeInt(requestCode);
2981 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2982 reply.readException();
2983 data.recycle();
2984 reply.recycle();
2985 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002986 public boolean finishActivityAffinity(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(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2992 reply.readException();
2993 boolean res = reply.readInt() != 0;
2994 data.recycle();
2995 reply.recycle();
2996 return res;
2997 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002998 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2999 Parcel data = Parcel.obtain();
3000 Parcel reply = Parcel.obtain();
3001 data.writeInterfaceToken(IActivityManager.descriptor);
3002 data.writeStrongBinder(session.asBinder());
3003 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3004 reply.readException();
3005 data.recycle();
3006 reply.recycle();
3007 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003008 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3009 Parcel data = Parcel.obtain();
3010 Parcel reply = Parcel.obtain();
3011 data.writeInterfaceToken(IActivityManager.descriptor);
3012 data.writeStrongBinder(token);
3013 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3014 reply.readException();
3015 boolean res = reply.readInt() != 0;
3016 data.recycle();
3017 reply.recycle();
3018 return res;
3019 }
3020 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 data.writeStrongBinder(app.asBinder());
3025 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3026 reply.readException();
3027 data.recycle();
3028 reply.recycle();
3029 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003030 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3031 Parcel data = Parcel.obtain();
3032 Parcel reply = Parcel.obtain();
3033 data.writeInterfaceToken(IActivityManager.descriptor);
3034 data.writeStrongBinder(token);
3035 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3036 reply.readException();
3037 boolean res = reply.readInt() != 0;
3038 data.recycle();
3039 reply.recycle();
3040 return res;
3041 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003042 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003043 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003044 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003045 {
3046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003050 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003051 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3052 filter.writeToParcel(data, 0);
3053 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003054 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003055 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 Intent intent = null;
3058 int haveIntent = reply.readInt();
3059 if (haveIntent != 0) {
3060 intent = Intent.CREATOR.createFromParcel(reply);
3061 }
3062 reply.recycle();
3063 data.recycle();
3064 return intent;
3065 }
3066 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3067 {
3068 Parcel data = Parcel.obtain();
3069 Parcel reply = Parcel.obtain();
3070 data.writeInterfaceToken(IActivityManager.descriptor);
3071 data.writeStrongBinder(receiver.asBinder());
3072 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 data.recycle();
3075 reply.recycle();
3076 }
3077 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003078 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003079 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003080 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003081 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003082 {
3083 Parcel data = Parcel.obtain();
3084 Parcel reply = Parcel.obtain();
3085 data.writeInterfaceToken(IActivityManager.descriptor);
3086 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3087 intent.writeToParcel(data, 0);
3088 data.writeString(resolvedType);
3089 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3090 data.writeInt(resultCode);
3091 data.writeString(resultData);
3092 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003093 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003094 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003095 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003096 data.writeInt(serialized ? 1 : 0);
3097 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003098 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003099 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3100 reply.readException();
3101 int res = reply.readInt();
3102 reply.recycle();
3103 data.recycle();
3104 return res;
3105 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003106 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3107 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003108 {
3109 Parcel data = Parcel.obtain();
3110 Parcel reply = Parcel.obtain();
3111 data.writeInterfaceToken(IActivityManager.descriptor);
3112 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3113 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003114 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003115 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3116 reply.readException();
3117 data.recycle();
3118 reply.recycle();
3119 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003120 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3121 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003122 {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 data.writeStrongBinder(who);
3127 data.writeInt(resultCode);
3128 data.writeString(resultData);
3129 data.writeBundle(map);
3130 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003131 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003132 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3133 reply.readException();
3134 data.recycle();
3135 reply.recycle();
3136 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003137 public void attachApplication(IApplicationThread app) throws RemoteException
3138 {
3139 Parcel data = Parcel.obtain();
3140 Parcel reply = Parcel.obtain();
3141 data.writeInterfaceToken(IActivityManager.descriptor);
3142 data.writeStrongBinder(app.asBinder());
3143 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3144 reply.readException();
3145 data.recycle();
3146 reply.recycle();
3147 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003148 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3149 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003150 {
3151 Parcel data = Parcel.obtain();
3152 Parcel reply = Parcel.obtain();
3153 data.writeInterfaceToken(IActivityManager.descriptor);
3154 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003155 if (config != null) {
3156 data.writeInt(1);
3157 config.writeToParcel(data, 0);
3158 } else {
3159 data.writeInt(0);
3160 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003161 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003162 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3163 reply.readException();
3164 data.recycle();
3165 reply.recycle();
3166 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003167 public void activityResumed(IBinder token) throws RemoteException
3168 {
3169 Parcel data = Parcel.obtain();
3170 Parcel reply = Parcel.obtain();
3171 data.writeInterfaceToken(IActivityManager.descriptor);
3172 data.writeStrongBinder(token);
3173 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3174 reply.readException();
3175 data.recycle();
3176 reply.recycle();
3177 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003178 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003179 {
3180 Parcel data = Parcel.obtain();
3181 Parcel reply = Parcel.obtain();
3182 data.writeInterfaceToken(IActivityManager.descriptor);
3183 data.writeStrongBinder(token);
3184 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3185 reply.readException();
3186 data.recycle();
3187 reply.recycle();
3188 }
3189 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003190 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003191 {
3192 Parcel data = Parcel.obtain();
3193 Parcel reply = Parcel.obtain();
3194 data.writeInterfaceToken(IActivityManager.descriptor);
3195 data.writeStrongBinder(token);
3196 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003197 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003198 TextUtils.writeToParcel(description, data, 0);
3199 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3200 reply.readException();
3201 data.recycle();
3202 reply.recycle();
3203 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003204 public void activitySlept(IBinder token) throws RemoteException
3205 {
3206 Parcel data = Parcel.obtain();
3207 Parcel reply = Parcel.obtain();
3208 data.writeInterfaceToken(IActivityManager.descriptor);
3209 data.writeStrongBinder(token);
3210 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3211 reply.readException();
3212 data.recycle();
3213 reply.recycle();
3214 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003215 public void activityDestroyed(IBinder token) throws RemoteException
3216 {
3217 Parcel data = Parcel.obtain();
3218 Parcel reply = Parcel.obtain();
3219 data.writeInterfaceToken(IActivityManager.descriptor);
3220 data.writeStrongBinder(token);
3221 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3222 reply.readException();
3223 data.recycle();
3224 reply.recycle();
3225 }
3226 public String getCallingPackage(IBinder token) throws RemoteException
3227 {
3228 Parcel data = Parcel.obtain();
3229 Parcel reply = Parcel.obtain();
3230 data.writeInterfaceToken(IActivityManager.descriptor);
3231 data.writeStrongBinder(token);
3232 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3233 reply.readException();
3234 String res = reply.readString();
3235 data.recycle();
3236 reply.recycle();
3237 return res;
3238 }
3239 public ComponentName getCallingActivity(IBinder token)
3240 throws RemoteException {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 data.writeStrongBinder(token);
3245 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 ComponentName res = ComponentName.readFromParcel(reply);
3248 data.recycle();
3249 reply.recycle();
3250 return res;
3251 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003252 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003256 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003257 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3258 reply.readException();
3259 ArrayList<IAppTask> list = null;
3260 int N = reply.readInt();
3261 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003262 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003263 while (N > 0) {
3264 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3265 list.add(task);
3266 N--;
3267 }
3268 }
3269 data.recycle();
3270 reply.recycle();
3271 return list;
3272 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003273 public int addAppTask(IBinder activityToken, Intent intent,
3274 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3275 Parcel data = Parcel.obtain();
3276 Parcel reply = Parcel.obtain();
3277 data.writeInterfaceToken(IActivityManager.descriptor);
3278 data.writeStrongBinder(activityToken);
3279 intent.writeToParcel(data, 0);
3280 description.writeToParcel(data, 0);
3281 thumbnail.writeToParcel(data, 0);
3282 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3283 reply.readException();
3284 int res = reply.readInt();
3285 data.recycle();
3286 reply.recycle();
3287 return res;
3288 }
3289 public Point getAppTaskThumbnailSize() throws RemoteException {
3290 Parcel data = Parcel.obtain();
3291 Parcel reply = Parcel.obtain();
3292 data.writeInterfaceToken(IActivityManager.descriptor);
3293 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3294 reply.readException();
3295 Point size = Point.CREATOR.createFromParcel(reply);
3296 data.recycle();
3297 reply.recycle();
3298 return size;
3299 }
Todd Kennedye635f662015-01-20 10:36:49 -08003300 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3301 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003302 Parcel data = Parcel.obtain();
3303 Parcel reply = Parcel.obtain();
3304 data.writeInterfaceToken(IActivityManager.descriptor);
3305 data.writeInt(maxNum);
3306 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003307 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3308 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003309 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003310 int N = reply.readInt();
3311 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003312 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003313 while (N > 0) {
3314 ActivityManager.RunningTaskInfo info =
3315 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003316 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003317 list.add(info);
3318 N--;
3319 }
3320 }
3321 data.recycle();
3322 reply.recycle();
3323 return list;
3324 }
3325 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003326 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
3330 data.writeInt(maxNum);
3331 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003332 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3334 reply.readException();
3335 ArrayList<ActivityManager.RecentTaskInfo> list
3336 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3337 data.recycle();
3338 reply.recycle();
3339 return list;
3340 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003341 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003342 Parcel data = Parcel.obtain();
3343 Parcel reply = Parcel.obtain();
3344 data.writeInterfaceToken(IActivityManager.descriptor);
3345 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003346 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003347 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003348 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003349 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003350 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003351 }
3352 data.recycle();
3353 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003354 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003355 }
Todd Kennedye635f662015-01-20 10:36:49 -08003356 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3357 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 data.writeInt(maxNum);
3362 data.writeInt(flags);
3363 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3364 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003365 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003366 int N = reply.readInt();
3367 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003368 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003369 while (N > 0) {
3370 ActivityManager.RunningServiceInfo info =
3371 ActivityManager.RunningServiceInfo.CREATOR
3372 .createFromParcel(reply);
3373 list.add(info);
3374 N--;
3375 }
3376 }
3377 data.recycle();
3378 reply.recycle();
3379 return list;
3380 }
3381 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3382 throws RemoteException {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
3386 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3389 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3390 data.recycle();
3391 reply.recycle();
3392 return list;
3393 }
3394 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3395 throws RemoteException {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3400 reply.readException();
3401 ArrayList<ActivityManager.RunningAppProcessInfo> list
3402 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3403 data.recycle();
3404 reply.recycle();
3405 return list;
3406 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003407 public List<ApplicationInfo> getRunningExternalApplications()
3408 throws RemoteException {
3409 Parcel data = Parcel.obtain();
3410 Parcel reply = Parcel.obtain();
3411 data.writeInterfaceToken(IActivityManager.descriptor);
3412 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3413 reply.readException();
3414 ArrayList<ApplicationInfo> list
3415 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3416 data.recycle();
3417 reply.recycle();
3418 return list;
3419 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003420 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003421 {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
3424 data.writeInterfaceToken(IActivityManager.descriptor);
3425 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003426 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003427 if (options != null) {
3428 data.writeInt(1);
3429 options.writeToParcel(data, 0);
3430 } else {
3431 data.writeInt(0);
3432 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003433 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3434 reply.readException();
3435 data.recycle();
3436 reply.recycle();
3437 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003438 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3439 throws RemoteException {
3440 Parcel data = Parcel.obtain();
3441 Parcel reply = Parcel.obtain();
3442 data.writeInterfaceToken(IActivityManager.descriptor);
3443 data.writeStrongBinder(token);
3444 data.writeInt(nonRoot ? 1 : 0);
3445 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3446 reply.readException();
3447 boolean res = reply.readInt() != 0;
3448 data.recycle();
3449 reply.recycle();
3450 return res;
3451 }
3452 public void moveTaskBackwards(int task) throws RemoteException
3453 {
3454 Parcel data = Parcel.obtain();
3455 Parcel reply = Parcel.obtain();
3456 data.writeInterfaceToken(IActivityManager.descriptor);
3457 data.writeInt(task);
3458 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3459 reply.readException();
3460 data.recycle();
3461 reply.recycle();
3462 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003463 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003464 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3465 {
3466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003468 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003469 data.writeInt(taskId);
3470 data.writeInt(stackId);
3471 data.writeInt(toTop ? 1 : 0);
3472 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3473 reply.readException();
3474 data.recycle();
3475 reply.recycle();
3476 }
3477 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003478 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003479 {
3480 Parcel data = Parcel.obtain();
3481 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003482 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003483 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003484 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003485 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003486 reply.readException();
3487 data.recycle();
3488 reply.recycle();
3489 }
Craig Mautner967212c2013-04-13 21:10:58 -07003490 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003491 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3492 {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 data.writeInt(taskId);
3497 data.writeInt(stackId);
3498 data.writeInt(position);
3499 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3500 reply.readException();
3501 data.recycle();
3502 reply.recycle();
3503 }
3504 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003505 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003506 {
3507 Parcel data = Parcel.obtain();
3508 Parcel reply = Parcel.obtain();
3509 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003510 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003511 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003512 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003513 data.recycle();
3514 reply.recycle();
3515 return list;
3516 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003517 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003518 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003519 {
3520 Parcel data = Parcel.obtain();
3521 Parcel reply = Parcel.obtain();
3522 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003523 data.writeInt(stackId);
3524 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003525 reply.readException();
3526 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003527 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003528 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003529 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003530 }
3531 data.recycle();
3532 reply.recycle();
3533 return info;
3534 }
3535 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003536 public boolean isInHomeStack(int taskId) throws RemoteException {
3537 Parcel data = Parcel.obtain();
3538 Parcel reply = Parcel.obtain();
3539 data.writeInterfaceToken(IActivityManager.descriptor);
3540 data.writeInt(taskId);
3541 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3542 reply.readException();
3543 boolean isInHomeStack = reply.readInt() > 0;
3544 data.recycle();
3545 reply.recycle();
3546 return isInHomeStack;
3547 }
3548 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003549 public void setFocusedStack(int stackId) throws RemoteException
3550 {
3551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003555 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003556 reply.readException();
3557 data.recycle();
3558 reply.recycle();
3559 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003560 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003561 public int getFocusedStackId() throws RemoteException {
3562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3566 reply.readException();
3567 int focusedStackId = reply.readInt();
3568 data.recycle();
3569 reply.recycle();
3570 return focusedStackId;
3571 }
3572 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003573 public void setFocusedTask(int taskId) throws RemoteException
3574 {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
3578 data.writeInt(taskId);
3579 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3580 reply.readException();
3581 data.recycle();
3582 reply.recycle();
3583 }
3584 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003585 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3586 {
3587 Parcel data = Parcel.obtain();
3588 Parcel reply = Parcel.obtain();
3589 data.writeInterfaceToken(IActivityManager.descriptor);
3590 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003591 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003592 reply.readException();
3593 data.recycle();
3594 reply.recycle();
3595 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003596 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3597 {
3598 Parcel data = Parcel.obtain();
3599 Parcel reply = Parcel.obtain();
3600 data.writeInterfaceToken(IActivityManager.descriptor);
3601 data.writeStrongBinder(token);
3602 data.writeInt(onlyRoot ? 1 : 0);
3603 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3604 reply.readException();
3605 int res = reply.readInt();
3606 data.recycle();
3607 reply.recycle();
3608 return res;
3609 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003610 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003611 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003612 Parcel data = Parcel.obtain();
3613 Parcel reply = Parcel.obtain();
3614 data.writeInterfaceToken(IActivityManager.descriptor);
3615 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3616 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003617 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003618 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003619 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3620 reply.readException();
3621 int res = reply.readInt();
3622 ContentProviderHolder cph = null;
3623 if (res != 0) {
3624 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3625 }
3626 data.recycle();
3627 reply.recycle();
3628 return cph;
3629 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003630 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3631 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003636 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003637 data.writeStrongBinder(token);
3638 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3639 reply.readException();
3640 int res = reply.readInt();
3641 ContentProviderHolder cph = null;
3642 if (res != 0) {
3643 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3644 }
3645 data.recycle();
3646 reply.recycle();
3647 return cph;
3648 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003649 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003650 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003651 {
3652 Parcel data = Parcel.obtain();
3653 Parcel reply = Parcel.obtain();
3654 data.writeInterfaceToken(IActivityManager.descriptor);
3655 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3656 data.writeTypedList(providers);
3657 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 data.recycle();
3660 reply.recycle();
3661 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003662 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3663 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003664 Parcel data = Parcel.obtain();
3665 Parcel reply = Parcel.obtain();
3666 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003667 data.writeStrongBinder(connection);
3668 data.writeInt(stable);
3669 data.writeInt(unstable);
3670 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3671 reply.readException();
3672 boolean res = reply.readInt() != 0;
3673 data.recycle();
3674 reply.recycle();
3675 return res;
3676 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003677
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003678 public void unstableProviderDied(IBinder connection) throws RemoteException {
3679 Parcel data = Parcel.obtain();
3680 Parcel reply = Parcel.obtain();
3681 data.writeInterfaceToken(IActivityManager.descriptor);
3682 data.writeStrongBinder(connection);
3683 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 data.recycle();
3686 reply.recycle();
3687 }
3688
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003689 @Override
3690 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3691 Parcel data = Parcel.obtain();
3692 Parcel reply = Parcel.obtain();
3693 data.writeInterfaceToken(IActivityManager.descriptor);
3694 data.writeStrongBinder(connection);
3695 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3696 reply.readException();
3697 data.recycle();
3698 reply.recycle();
3699 }
3700
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003701 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3702 Parcel data = Parcel.obtain();
3703 Parcel reply = Parcel.obtain();
3704 data.writeInterfaceToken(IActivityManager.descriptor);
3705 data.writeStrongBinder(connection);
3706 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003707 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3708 reply.readException();
3709 data.recycle();
3710 reply.recycle();
3711 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003712
3713 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 data.writeString(name);
3718 data.writeStrongBinder(token);
3719 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3720 reply.readException();
3721 data.recycle();
3722 reply.recycle();
3723 }
3724
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003725 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3726 throws RemoteException
3727 {
3728 Parcel data = Parcel.obtain();
3729 Parcel reply = Parcel.obtain();
3730 data.writeInterfaceToken(IActivityManager.descriptor);
3731 service.writeToParcel(data, 0);
3732 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3733 reply.readException();
3734 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3735 data.recycle();
3736 reply.recycle();
3737 return res;
3738 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003739
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003740 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003741 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003742 {
3743 Parcel data = Parcel.obtain();
3744 Parcel reply = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3747 service.writeToParcel(data, 0);
3748 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003749 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003750 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003751 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3752 reply.readException();
3753 ComponentName res = ComponentName.readFromParcel(reply);
3754 data.recycle();
3755 reply.recycle();
3756 return res;
3757 }
3758 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003759 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003760 {
3761 Parcel data = Parcel.obtain();
3762 Parcel reply = Parcel.obtain();
3763 data.writeInterfaceToken(IActivityManager.descriptor);
3764 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3765 service.writeToParcel(data, 0);
3766 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003767 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003768 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 int res = reply.readInt();
3771 reply.recycle();
3772 data.recycle();
3773 return res;
3774 }
3775 public boolean stopServiceToken(ComponentName className, IBinder token,
3776 int startId) throws RemoteException {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 ComponentName.writeToParcel(className, data);
3781 data.writeStrongBinder(token);
3782 data.writeInt(startId);
3783 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 boolean res = reply.readInt() != 0;
3786 data.recycle();
3787 reply.recycle();
3788 return res;
3789 }
3790 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003791 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003792 Parcel data = Parcel.obtain();
3793 Parcel reply = Parcel.obtain();
3794 data.writeInterfaceToken(IActivityManager.descriptor);
3795 ComponentName.writeToParcel(className, data);
3796 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003797 data.writeInt(id);
3798 if (notification != null) {
3799 data.writeInt(1);
3800 notification.writeToParcel(data, 0);
3801 } else {
3802 data.writeInt(0);
3803 }
3804 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003805 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3806 reply.readException();
3807 data.recycle();
3808 reply.recycle();
3809 }
3810 public int bindService(IApplicationThread caller, IBinder token,
3811 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003812 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003813 Parcel data = Parcel.obtain();
3814 Parcel reply = Parcel.obtain();
3815 data.writeInterfaceToken(IActivityManager.descriptor);
3816 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3817 data.writeStrongBinder(token);
3818 service.writeToParcel(data, 0);
3819 data.writeString(resolvedType);
3820 data.writeStrongBinder(connection.asBinder());
3821 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003822 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003823 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003824 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3825 reply.readException();
3826 int res = reply.readInt();
3827 data.recycle();
3828 reply.recycle();
3829 return res;
3830 }
3831 public boolean unbindService(IServiceConnection connection) throws RemoteException
3832 {
3833 Parcel data = Parcel.obtain();
3834 Parcel reply = Parcel.obtain();
3835 data.writeInterfaceToken(IActivityManager.descriptor);
3836 data.writeStrongBinder(connection.asBinder());
3837 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3838 reply.readException();
3839 boolean res = reply.readInt() != 0;
3840 data.recycle();
3841 reply.recycle();
3842 return res;
3843 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003844
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003845 public void publishService(IBinder token,
3846 Intent intent, IBinder service) throws RemoteException {
3847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 data.writeStrongBinder(token);
3851 intent.writeToParcel(data, 0);
3852 data.writeStrongBinder(service);
3853 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3854 reply.readException();
3855 data.recycle();
3856 reply.recycle();
3857 }
3858
3859 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3860 throws RemoteException {
3861 Parcel data = Parcel.obtain();
3862 Parcel reply = Parcel.obtain();
3863 data.writeInterfaceToken(IActivityManager.descriptor);
3864 data.writeStrongBinder(token);
3865 intent.writeToParcel(data, 0);
3866 data.writeInt(doRebind ? 1 : 0);
3867 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3868 reply.readException();
3869 data.recycle();
3870 reply.recycle();
3871 }
3872
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003873 public void serviceDoneExecuting(IBinder token, int type, int startId,
3874 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003875 Parcel data = Parcel.obtain();
3876 Parcel reply = Parcel.obtain();
3877 data.writeInterfaceToken(IActivityManager.descriptor);
3878 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003879 data.writeInt(type);
3880 data.writeInt(startId);
3881 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003882 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3883 reply.readException();
3884 data.recycle();
3885 reply.recycle();
3886 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003887
Svet Ganov99b60432015-06-27 13:15:22 -07003888 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
3889 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003890 Parcel data = Parcel.obtain();
3891 Parcel reply = Parcel.obtain();
3892 data.writeInterfaceToken(IActivityManager.descriptor);
3893 service.writeToParcel(data, 0);
3894 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003895 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003896 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3897 reply.readException();
3898 IBinder binder = reply.readStrongBinder();
3899 reply.recycle();
3900 data.recycle();
3901 return binder;
3902 }
3903
Christopher Tate181fafa2009-05-14 11:12:14 -07003904 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3905 throws RemoteException {
3906 Parcel data = Parcel.obtain();
3907 Parcel reply = Parcel.obtain();
3908 data.writeInterfaceToken(IActivityManager.descriptor);
3909 app.writeToParcel(data, 0);
3910 data.writeInt(backupRestoreMode);
3911 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 boolean success = reply.readInt() != 0;
3914 reply.recycle();
3915 data.recycle();
3916 return success;
3917 }
3918
Christopher Tate346acb12012-10-15 19:20:25 -07003919 public void clearPendingBackup() throws RemoteException {
3920 Parcel data = Parcel.obtain();
3921 Parcel reply = Parcel.obtain();
3922 data.writeInterfaceToken(IActivityManager.descriptor);
3923 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3924 reply.recycle();
3925 data.recycle();
3926 }
3927
Christopher Tate181fafa2009-05-14 11:12:14 -07003928 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3929 Parcel data = Parcel.obtain();
3930 Parcel reply = Parcel.obtain();
3931 data.writeInterfaceToken(IActivityManager.descriptor);
3932 data.writeString(packageName);
3933 data.writeStrongBinder(agent);
3934 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3935 reply.recycle();
3936 data.recycle();
3937 }
3938
3939 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3940 Parcel data = Parcel.obtain();
3941 Parcel reply = Parcel.obtain();
3942 data.writeInterfaceToken(IActivityManager.descriptor);
3943 app.writeToParcel(data, 0);
3944 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3945 reply.readException();
3946 reply.recycle();
3947 data.recycle();
3948 }
3949
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003950 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003951 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003952 IUiAutomationConnection connection, int userId, String instructionSet)
3953 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003954 Parcel data = Parcel.obtain();
3955 Parcel reply = Parcel.obtain();
3956 data.writeInterfaceToken(IActivityManager.descriptor);
3957 ComponentName.writeToParcel(className, data);
3958 data.writeString(profileFile);
3959 data.writeInt(flags);
3960 data.writeBundle(arguments);
3961 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003962 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003963 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003964 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003965 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 boolean res = reply.readInt() != 0;
3968 reply.recycle();
3969 data.recycle();
3970 return res;
3971 }
3972
3973 public void finishInstrumentation(IApplicationThread target,
3974 int resultCode, Bundle results) throws RemoteException {
3975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 data.writeStrongBinder(target != null ? target.asBinder() : null);
3979 data.writeInt(resultCode);
3980 data.writeBundle(results);
3981 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3982 reply.readException();
3983 data.recycle();
3984 reply.recycle();
3985 }
3986 public Configuration getConfiguration() throws RemoteException
3987 {
3988 Parcel data = Parcel.obtain();
3989 Parcel reply = Parcel.obtain();
3990 data.writeInterfaceToken(IActivityManager.descriptor);
3991 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3992 reply.readException();
3993 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3994 reply.recycle();
3995 data.recycle();
3996 return res;
3997 }
3998 public void updateConfiguration(Configuration values) throws RemoteException
3999 {
4000 Parcel data = Parcel.obtain();
4001 Parcel reply = Parcel.obtain();
4002 data.writeInterfaceToken(IActivityManager.descriptor);
4003 values.writeToParcel(data, 0);
4004 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4005 reply.readException();
4006 data.recycle();
4007 reply.recycle();
4008 }
4009 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4010 throws RemoteException {
4011 Parcel data = Parcel.obtain();
4012 Parcel reply = Parcel.obtain();
4013 data.writeInterfaceToken(IActivityManager.descriptor);
4014 data.writeStrongBinder(token);
4015 data.writeInt(requestedOrientation);
4016 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4017 reply.readException();
4018 data.recycle();
4019 reply.recycle();
4020 }
4021 public int getRequestedOrientation(IBinder token) throws RemoteException {
4022 Parcel data = Parcel.obtain();
4023 Parcel reply = Parcel.obtain();
4024 data.writeInterfaceToken(IActivityManager.descriptor);
4025 data.writeStrongBinder(token);
4026 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4027 reply.readException();
4028 int res = reply.readInt();
4029 data.recycle();
4030 reply.recycle();
4031 return res;
4032 }
4033 public ComponentName getActivityClassForToken(IBinder token)
4034 throws RemoteException {
4035 Parcel data = Parcel.obtain();
4036 Parcel reply = Parcel.obtain();
4037 data.writeInterfaceToken(IActivityManager.descriptor);
4038 data.writeStrongBinder(token);
4039 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4040 reply.readException();
4041 ComponentName res = ComponentName.readFromParcel(reply);
4042 data.recycle();
4043 reply.recycle();
4044 return res;
4045 }
4046 public String getPackageForToken(IBinder token) throws RemoteException
4047 {
4048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 data.writeStrongBinder(token);
4052 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4053 reply.readException();
4054 String res = reply.readString();
4055 data.recycle();
4056 reply.recycle();
4057 return res;
4058 }
4059 public IIntentSender getIntentSender(int type,
4060 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004061 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004062 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004063 Parcel data = Parcel.obtain();
4064 Parcel reply = Parcel.obtain();
4065 data.writeInterfaceToken(IActivityManager.descriptor);
4066 data.writeInt(type);
4067 data.writeString(packageName);
4068 data.writeStrongBinder(token);
4069 data.writeString(resultWho);
4070 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004071 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004072 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004073 data.writeTypedArray(intents, 0);
4074 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004075 } else {
4076 data.writeInt(0);
4077 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004078 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004079 if (options != null) {
4080 data.writeInt(1);
4081 options.writeToParcel(data, 0);
4082 } else {
4083 data.writeInt(0);
4084 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004085 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004086 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4087 reply.readException();
4088 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004089 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004090 data.recycle();
4091 reply.recycle();
4092 return res;
4093 }
4094 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeStrongBinder(sender.asBinder());
4099 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4100 reply.readException();
4101 data.recycle();
4102 reply.recycle();
4103 }
4104 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4105 Parcel data = Parcel.obtain();
4106 Parcel reply = Parcel.obtain();
4107 data.writeInterfaceToken(IActivityManager.descriptor);
4108 data.writeStrongBinder(sender.asBinder());
4109 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4110 reply.readException();
4111 String res = reply.readString();
4112 data.recycle();
4113 reply.recycle();
4114 return res;
4115 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004116 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
4120 data.writeStrongBinder(sender.asBinder());
4121 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4122 reply.readException();
4123 int res = reply.readInt();
4124 data.recycle();
4125 reply.recycle();
4126 return res;
4127 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004128 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4129 boolean requireFull, String name, String callerPackage) throws RemoteException {
4130 Parcel data = Parcel.obtain();
4131 Parcel reply = Parcel.obtain();
4132 data.writeInterfaceToken(IActivityManager.descriptor);
4133 data.writeInt(callingPid);
4134 data.writeInt(callingUid);
4135 data.writeInt(userId);
4136 data.writeInt(allowAll ? 1 : 0);
4137 data.writeInt(requireFull ? 1 : 0);
4138 data.writeString(name);
4139 data.writeString(callerPackage);
4140 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4141 reply.readException();
4142 int res = reply.readInt();
4143 data.recycle();
4144 reply.recycle();
4145 return res;
4146 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004147 public void setProcessLimit(int max) throws RemoteException
4148 {
4149 Parcel data = Parcel.obtain();
4150 Parcel reply = Parcel.obtain();
4151 data.writeInterfaceToken(IActivityManager.descriptor);
4152 data.writeInt(max);
4153 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4154 reply.readException();
4155 data.recycle();
4156 reply.recycle();
4157 }
4158 public int getProcessLimit() throws RemoteException
4159 {
4160 Parcel data = Parcel.obtain();
4161 Parcel reply = Parcel.obtain();
4162 data.writeInterfaceToken(IActivityManager.descriptor);
4163 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4164 reply.readException();
4165 int res = reply.readInt();
4166 data.recycle();
4167 reply.recycle();
4168 return res;
4169 }
4170 public void setProcessForeground(IBinder token, int pid,
4171 boolean isForeground) throws RemoteException {
4172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 data.writeStrongBinder(token);
4176 data.writeInt(pid);
4177 data.writeInt(isForeground ? 1 : 0);
4178 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4179 reply.readException();
4180 data.recycle();
4181 reply.recycle();
4182 }
4183 public int checkPermission(String permission, int pid, int uid)
4184 throws RemoteException {
4185 Parcel data = Parcel.obtain();
4186 Parcel reply = Parcel.obtain();
4187 data.writeInterfaceToken(IActivityManager.descriptor);
4188 data.writeString(permission);
4189 data.writeInt(pid);
4190 data.writeInt(uid);
4191 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4192 reply.readException();
4193 int res = reply.readInt();
4194 data.recycle();
4195 reply.recycle();
4196 return res;
4197 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004198 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4199 throws RemoteException {
4200 Parcel data = Parcel.obtain();
4201 Parcel reply = Parcel.obtain();
4202 data.writeInterfaceToken(IActivityManager.descriptor);
4203 data.writeString(permission);
4204 data.writeInt(pid);
4205 data.writeInt(uid);
4206 data.writeStrongBinder(callerToken);
4207 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4208 reply.readException();
4209 int res = reply.readInt();
4210 data.recycle();
4211 reply.recycle();
4212 return res;
4213 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004214 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004215 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004216 Parcel data = Parcel.obtain();
4217 Parcel reply = Parcel.obtain();
4218 data.writeInterfaceToken(IActivityManager.descriptor);
4219 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004220 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004221 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004222 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4223 reply.readException();
4224 boolean res = reply.readInt() != 0;
4225 data.recycle();
4226 reply.recycle();
4227 return res;
4228 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004229 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4230 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004231 Parcel data = Parcel.obtain();
4232 Parcel reply = Parcel.obtain();
4233 data.writeInterfaceToken(IActivityManager.descriptor);
4234 uri.writeToParcel(data, 0);
4235 data.writeInt(pid);
4236 data.writeInt(uid);
4237 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004238 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004239 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004240 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4241 reply.readException();
4242 int res = reply.readInt();
4243 data.recycle();
4244 reply.recycle();
4245 return res;
4246 }
4247 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004248 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004249 Parcel data = Parcel.obtain();
4250 Parcel reply = Parcel.obtain();
4251 data.writeInterfaceToken(IActivityManager.descriptor);
4252 data.writeStrongBinder(caller.asBinder());
4253 data.writeString(targetPkg);
4254 uri.writeToParcel(data, 0);
4255 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004256 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004257 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4258 reply.readException();
4259 data.recycle();
4260 reply.recycle();
4261 }
4262 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004263 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004264 Parcel data = Parcel.obtain();
4265 Parcel reply = Parcel.obtain();
4266 data.writeInterfaceToken(IActivityManager.descriptor);
4267 data.writeStrongBinder(caller.asBinder());
4268 uri.writeToParcel(data, 0);
4269 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004270 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004271 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4272 reply.readException();
4273 data.recycle();
4274 reply.recycle();
4275 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004276
4277 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004278 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4279 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004280 Parcel data = Parcel.obtain();
4281 Parcel reply = Parcel.obtain();
4282 data.writeInterfaceToken(IActivityManager.descriptor);
4283 uri.writeToParcel(data, 0);
4284 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004285 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004286 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4287 reply.readException();
4288 data.recycle();
4289 reply.recycle();
4290 }
4291
4292 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004293 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4294 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004295 Parcel data = Parcel.obtain();
4296 Parcel reply = Parcel.obtain();
4297 data.writeInterfaceToken(IActivityManager.descriptor);
4298 uri.writeToParcel(data, 0);
4299 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004300 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004301 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4302 reply.readException();
4303 data.recycle();
4304 reply.recycle();
4305 }
4306
4307 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004308 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4309 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004310 Parcel data = Parcel.obtain();
4311 Parcel reply = Parcel.obtain();
4312 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004313 data.writeString(packageName);
4314 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004315 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4316 reply.readException();
4317 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4318 reply);
4319 data.recycle();
4320 reply.recycle();
4321 return perms;
4322 }
4323
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004324 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4325 throws RemoteException {
4326 Parcel data = Parcel.obtain();
4327 Parcel reply = Parcel.obtain();
4328 data.writeInterfaceToken(IActivityManager.descriptor);
4329 data.writeStrongBinder(who.asBinder());
4330 data.writeInt(waiting ? 1 : 0);
4331 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4332 reply.readException();
4333 data.recycle();
4334 reply.recycle();
4335 }
4336 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4337 Parcel data = Parcel.obtain();
4338 Parcel reply = Parcel.obtain();
4339 data.writeInterfaceToken(IActivityManager.descriptor);
4340 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4341 reply.readException();
4342 outInfo.readFromParcel(reply);
4343 data.recycle();
4344 reply.recycle();
4345 }
4346 public void unhandledBack() throws RemoteException
4347 {
4348 Parcel data = Parcel.obtain();
4349 Parcel reply = Parcel.obtain();
4350 data.writeInterfaceToken(IActivityManager.descriptor);
4351 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4352 reply.readException();
4353 data.recycle();
4354 reply.recycle();
4355 }
4356 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4357 {
4358 Parcel data = Parcel.obtain();
4359 Parcel reply = Parcel.obtain();
4360 data.writeInterfaceToken(IActivityManager.descriptor);
4361 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4362 reply.readException();
4363 ParcelFileDescriptor pfd = null;
4364 if (reply.readInt() != 0) {
4365 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4366 }
4367 data.recycle();
4368 reply.recycle();
4369 return pfd;
4370 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004371 public void setLockScreenShown(boolean shown) throws RemoteException
4372 {
4373 Parcel data = Parcel.obtain();
4374 Parcel reply = Parcel.obtain();
4375 data.writeInterfaceToken(IActivityManager.descriptor);
4376 data.writeInt(shown ? 1 : 0);
4377 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4378 reply.readException();
4379 data.recycle();
4380 reply.recycle();
4381 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004382 public void setDebugApp(
4383 String packageName, boolean waitForDebugger, boolean persistent)
4384 throws RemoteException
4385 {
4386 Parcel data = Parcel.obtain();
4387 Parcel reply = Parcel.obtain();
4388 data.writeInterfaceToken(IActivityManager.descriptor);
4389 data.writeString(packageName);
4390 data.writeInt(waitForDebugger ? 1 : 0);
4391 data.writeInt(persistent ? 1 : 0);
4392 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4393 reply.readException();
4394 data.recycle();
4395 reply.recycle();
4396 }
4397 public void setAlwaysFinish(boolean enabled) throws RemoteException
4398 {
4399 Parcel data = Parcel.obtain();
4400 Parcel reply = Parcel.obtain();
4401 data.writeInterfaceToken(IActivityManager.descriptor);
4402 data.writeInt(enabled ? 1 : 0);
4403 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4404 reply.readException();
4405 data.recycle();
4406 reply.recycle();
4407 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004408 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004409 {
4410 Parcel data = Parcel.obtain();
4411 Parcel reply = Parcel.obtain();
4412 data.writeInterfaceToken(IActivityManager.descriptor);
4413 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004414 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004415 reply.readException();
4416 data.recycle();
4417 reply.recycle();
4418 }
4419 public void enterSafeMode() throws RemoteException {
4420 Parcel data = Parcel.obtain();
4421 data.writeInterfaceToken(IActivityManager.descriptor);
4422 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4423 data.recycle();
4424 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004425 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004426 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004427 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004428 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004429 data.writeStrongBinder(sender.asBinder());
4430 data.writeInt(sourceUid);
4431 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004432 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004433 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4434 data.recycle();
4435 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004436 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4437 throws RemoteException {
4438 Parcel data = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 data.writeStrongBinder(sender.asBinder());
4441 data.writeInt(sourceUid);
4442 data.writeString(tag);
4443 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4444 data.recycle();
4445 }
4446 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4447 throws RemoteException {
4448 Parcel data = Parcel.obtain();
4449 data.writeInterfaceToken(IActivityManager.descriptor);
4450 data.writeStrongBinder(sender.asBinder());
4451 data.writeInt(sourceUid);
4452 data.writeString(tag);
4453 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4454 data.recycle();
4455 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004456 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004457 Parcel data = Parcel.obtain();
4458 Parcel reply = Parcel.obtain();
4459 data.writeInterfaceToken(IActivityManager.descriptor);
4460 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004461 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004462 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004463 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004464 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004465 boolean res = reply.readInt() != 0;
4466 data.recycle();
4467 reply.recycle();
4468 return res;
4469 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004470 @Override
4471 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4472 Parcel data = Parcel.obtain();
4473 Parcel reply = Parcel.obtain();
4474 data.writeInterfaceToken(IActivityManager.descriptor);
4475 data.writeString(reason);
4476 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4477 boolean res = reply.readInt() != 0;
4478 data.recycle();
4479 reply.recycle();
4480 return res;
4481 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004482 public boolean testIsSystemReady()
4483 {
4484 /* this base class version is never called */
4485 return true;
4486 }
Dan Egnor60d87622009-12-16 16:32:58 -08004487 public void handleApplicationCrash(IBinder app,
4488 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4489 {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeStrongBinder(app);
4494 crashInfo.writeToParcel(data, 0);
4495 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4496 reply.readException();
4497 reply.recycle();
4498 data.recycle();
4499 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004500
Dianne Hackborn52322712014-08-26 22:47:26 -07004501 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004502 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004503 {
4504 Parcel data = Parcel.obtain();
4505 Parcel reply = Parcel.obtain();
4506 data.writeInterfaceToken(IActivityManager.descriptor);
4507 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004508 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004509 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004510 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004511 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004512 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004513 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004514 reply.recycle();
4515 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004516 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004517 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004518
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004519 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004520 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004521 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004522 {
4523 Parcel data = Parcel.obtain();
4524 Parcel reply = Parcel.obtain();
4525 data.writeInterfaceToken(IActivityManager.descriptor);
4526 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004527 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004528 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004529 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4530 reply.readException();
4531 reply.recycle();
4532 data.recycle();
4533 }
4534
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004535 public void signalPersistentProcesses(int sig) throws RemoteException {
4536 Parcel data = Parcel.obtain();
4537 Parcel reply = Parcel.obtain();
4538 data.writeInterfaceToken(IActivityManager.descriptor);
4539 data.writeInt(sig);
4540 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4541 reply.readException();
4542 data.recycle();
4543 reply.recycle();
4544 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004545
Dianne Hackborn1676c852012-09-10 14:52:30 -07004546 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004547 Parcel data = Parcel.obtain();
4548 Parcel reply = Parcel.obtain();
4549 data.writeInterfaceToken(IActivityManager.descriptor);
4550 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004551 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004552 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4553 reply.readException();
4554 data.recycle();
4555 reply.recycle();
4556 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004557
4558 public void killAllBackgroundProcesses() throws RemoteException {
4559 Parcel data = Parcel.obtain();
4560 Parcel reply = Parcel.obtain();
4561 data.writeInterfaceToken(IActivityManager.descriptor);
4562 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4563 reply.readException();
4564 data.recycle();
4565 reply.recycle();
4566 }
4567
Dianne Hackborn1676c852012-09-10 14:52:30 -07004568 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004569 Parcel data = Parcel.obtain();
4570 Parcel reply = Parcel.obtain();
4571 data.writeInterfaceToken(IActivityManager.descriptor);
4572 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004573 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004574 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004575 reply.readException();
4576 data.recycle();
4577 reply.recycle();
4578 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004579
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004580 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4581 throws RemoteException
4582 {
4583 Parcel data = Parcel.obtain();
4584 Parcel reply = Parcel.obtain();
4585 data.writeInterfaceToken(IActivityManager.descriptor);
4586 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4587 reply.readException();
4588 outInfo.readFromParcel(reply);
4589 reply.recycle();
4590 data.recycle();
4591 }
4592
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004593 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4594 {
4595 Parcel data = Parcel.obtain();
4596 Parcel reply = Parcel.obtain();
4597 data.writeInterfaceToken(IActivityManager.descriptor);
4598 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4599 reply.readException();
4600 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4601 reply.recycle();
4602 data.recycle();
4603 return res;
4604 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004605
Dianne Hackborn1676c852012-09-10 14:52:30 -07004606 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004607 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004608 {
4609 Parcel data = Parcel.obtain();
4610 Parcel reply = Parcel.obtain();
4611 data.writeInterfaceToken(IActivityManager.descriptor);
4612 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004613 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004614 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004615 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004616 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004617 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004618 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004619 } else {
4620 data.writeInt(0);
4621 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004622 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4623 reply.readException();
4624 boolean res = reply.readInt() != 0;
4625 reply.recycle();
4626 data.recycle();
4627 return res;
4628 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004629
Dianne Hackborn55280a92009-05-07 15:53:46 -07004630 public boolean shutdown(int timeout) throws RemoteException
4631 {
4632 Parcel data = Parcel.obtain();
4633 Parcel reply = Parcel.obtain();
4634 data.writeInterfaceToken(IActivityManager.descriptor);
4635 data.writeInt(timeout);
4636 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4637 reply.readException();
4638 boolean res = reply.readInt() != 0;
4639 reply.recycle();
4640 data.recycle();
4641 return res;
4642 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004643
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004644 public void stopAppSwitches() throws RemoteException {
4645 Parcel data = Parcel.obtain();
4646 Parcel reply = Parcel.obtain();
4647 data.writeInterfaceToken(IActivityManager.descriptor);
4648 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4649 reply.readException();
4650 reply.recycle();
4651 data.recycle();
4652 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004653
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004654 public void resumeAppSwitches() throws RemoteException {
4655 Parcel data = Parcel.obtain();
4656 Parcel reply = Parcel.obtain();
4657 data.writeInterfaceToken(IActivityManager.descriptor);
4658 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4659 reply.readException();
4660 reply.recycle();
4661 data.recycle();
4662 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004663
4664 public void addPackageDependency(String packageName) throws RemoteException {
4665 Parcel data = Parcel.obtain();
4666 Parcel reply = Parcel.obtain();
4667 data.writeInterfaceToken(IActivityManager.descriptor);
4668 data.writeString(packageName);
4669 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4670 reply.readException();
4671 data.recycle();
4672 reply.recycle();
4673 }
4674
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004675 public void killApplicationWithAppId(String pkg, int appid, String reason)
4676 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004677 Parcel data = Parcel.obtain();
4678 Parcel reply = Parcel.obtain();
4679 data.writeInterfaceToken(IActivityManager.descriptor);
4680 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004681 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004682 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004683 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004684 reply.readException();
4685 data.recycle();
4686 reply.recycle();
4687 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004688
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004689 public void closeSystemDialogs(String reason) throws RemoteException {
4690 Parcel data = Parcel.obtain();
4691 Parcel reply = Parcel.obtain();
4692 data.writeInterfaceToken(IActivityManager.descriptor);
4693 data.writeString(reason);
4694 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4695 reply.readException();
4696 data.recycle();
4697 reply.recycle();
4698 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004699
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004700 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004701 throws RemoteException {
4702 Parcel data = Parcel.obtain();
4703 Parcel reply = Parcel.obtain();
4704 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004705 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004706 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4707 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004708 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004709 data.recycle();
4710 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004711 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004712 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004713
4714 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4715 Parcel data = Parcel.obtain();
4716 Parcel reply = Parcel.obtain();
4717 data.writeInterfaceToken(IActivityManager.descriptor);
4718 data.writeString(processName);
4719 data.writeInt(uid);
4720 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4721 reply.readException();
4722 data.recycle();
4723 reply.recycle();
4724 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004725
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004726 public void overridePendingTransition(IBinder token, String packageName,
4727 int enterAnim, int exitAnim) throws RemoteException {
4728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
4731 data.writeStrongBinder(token);
4732 data.writeString(packageName);
4733 data.writeInt(enterAnim);
4734 data.writeInt(exitAnim);
4735 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4736 reply.readException();
4737 data.recycle();
4738 reply.recycle();
4739 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004740
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004741 public boolean isUserAMonkey() throws RemoteException {
4742 Parcel data = Parcel.obtain();
4743 Parcel reply = Parcel.obtain();
4744 data.writeInterfaceToken(IActivityManager.descriptor);
4745 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4746 reply.readException();
4747 boolean res = reply.readInt() != 0;
4748 data.recycle();
4749 reply.recycle();
4750 return res;
4751 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004752
4753 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4754 Parcel data = Parcel.obtain();
4755 Parcel reply = Parcel.obtain();
4756 data.writeInterfaceToken(IActivityManager.descriptor);
4757 data.writeInt(monkey ? 1 : 0);
4758 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4759 reply.readException();
4760 data.recycle();
4761 reply.recycle();
4762 }
4763
Dianne Hackborn860755f2010-06-03 18:47:52 -07004764 public void finishHeavyWeightApp() throws RemoteException {
4765 Parcel data = Parcel.obtain();
4766 Parcel reply = Parcel.obtain();
4767 data.writeInterfaceToken(IActivityManager.descriptor);
4768 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4769 reply.readException();
4770 data.recycle();
4771 reply.recycle();
4772 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004773
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004774 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004775 throws RemoteException {
4776 Parcel data = Parcel.obtain();
4777 Parcel reply = Parcel.obtain();
4778 data.writeInterfaceToken(IActivityManager.descriptor);
4779 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004780 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4781 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004782 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004783 data.recycle();
4784 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004785 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004786 }
4787
Craig Mautner233ceee2014-05-09 17:05:11 -07004788 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004789 throws RemoteException {
4790 Parcel data = Parcel.obtain();
4791 Parcel reply = Parcel.obtain();
4792 data.writeInterfaceToken(IActivityManager.descriptor);
4793 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004794 if (options == null) {
4795 data.writeInt(0);
4796 } else {
4797 data.writeInt(1);
4798 data.writeBundle(options.toBundle());
4799 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004800 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004801 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004802 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004803 data.recycle();
4804 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004805 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004806 }
4807
Craig Mautner233ceee2014-05-09 17:05:11 -07004808 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4809 Parcel data = Parcel.obtain();
4810 Parcel reply = Parcel.obtain();
4811 data.writeInterfaceToken(IActivityManager.descriptor);
4812 data.writeStrongBinder(token);
4813 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4814 reply.readException();
4815 Bundle bundle = reply.readBundle();
4816 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4817 data.recycle();
4818 reply.recycle();
4819 return options;
4820 }
4821
Daniel Sandler69a48172010-06-23 16:29:36 -04004822 public void setImmersive(IBinder token, boolean immersive)
4823 throws RemoteException {
4824 Parcel data = Parcel.obtain();
4825 Parcel reply = Parcel.obtain();
4826 data.writeInterfaceToken(IActivityManager.descriptor);
4827 data.writeStrongBinder(token);
4828 data.writeInt(immersive ? 1 : 0);
4829 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4830 reply.readException();
4831 data.recycle();
4832 reply.recycle();
4833 }
4834
4835 public boolean isImmersive(IBinder token)
4836 throws RemoteException {
4837 Parcel data = Parcel.obtain();
4838 Parcel reply = Parcel.obtain();
4839 data.writeInterfaceToken(IActivityManager.descriptor);
4840 data.writeStrongBinder(token);
4841 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004842 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004843 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004844 data.recycle();
4845 reply.recycle();
4846 return res;
4847 }
4848
Craig Mautnerd61dc202014-07-07 11:09:11 -07004849 public boolean isTopOfTask(IBinder token) throws RemoteException {
4850 Parcel data = Parcel.obtain();
4851 Parcel reply = Parcel.obtain();
4852 data.writeInterfaceToken(IActivityManager.descriptor);
4853 data.writeStrongBinder(token);
4854 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4855 reply.readException();
4856 boolean res = reply.readInt() == 1;
4857 data.recycle();
4858 reply.recycle();
4859 return res;
4860 }
4861
Daniel Sandler69a48172010-06-23 16:29:36 -04004862 public boolean isTopActivityImmersive()
4863 throws RemoteException {
4864 Parcel data = Parcel.obtain();
4865 Parcel reply = Parcel.obtain();
4866 data.writeInterfaceToken(IActivityManager.descriptor);
4867 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004868 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004869 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004870 data.recycle();
4871 reply.recycle();
4872 return res;
4873 }
4874
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004875 public void crashApplication(int uid, int initialPid, String packageName,
4876 String message) throws RemoteException {
4877 Parcel data = Parcel.obtain();
4878 Parcel reply = Parcel.obtain();
4879 data.writeInterfaceToken(IActivityManager.descriptor);
4880 data.writeInt(uid);
4881 data.writeInt(initialPid);
4882 data.writeString(packageName);
4883 data.writeString(message);
4884 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4885 reply.readException();
4886 data.recycle();
4887 reply.recycle();
4888 }
Andy McFadden824c5102010-07-09 16:26:57 -07004889
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004890 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004891 Parcel data = Parcel.obtain();
4892 Parcel reply = Parcel.obtain();
4893 data.writeInterfaceToken(IActivityManager.descriptor);
4894 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004895 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004896 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4897 reply.readException();
4898 String res = reply.readString();
4899 data.recycle();
4900 reply.recycle();
4901 return res;
4902 }
4903
Dianne Hackborn7e269642010-08-25 19:50:20 -07004904 public IBinder newUriPermissionOwner(String name)
4905 throws RemoteException {
4906 Parcel data = Parcel.obtain();
4907 Parcel reply = Parcel.obtain();
4908 data.writeInterfaceToken(IActivityManager.descriptor);
4909 data.writeString(name);
4910 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4911 reply.readException();
4912 IBinder res = reply.readStrongBinder();
4913 data.recycle();
4914 reply.recycle();
4915 return res;
4916 }
4917
4918 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004919 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004920 Parcel data = Parcel.obtain();
4921 Parcel reply = Parcel.obtain();
4922 data.writeInterfaceToken(IActivityManager.descriptor);
4923 data.writeStrongBinder(owner);
4924 data.writeInt(fromUid);
4925 data.writeString(targetPkg);
4926 uri.writeToParcel(data, 0);
4927 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004928 data.writeInt(sourceUserId);
4929 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004930 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4931 reply.readException();
4932 data.recycle();
4933 reply.recycle();
4934 }
4935
4936 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004937 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004938 Parcel data = Parcel.obtain();
4939 Parcel reply = Parcel.obtain();
4940 data.writeInterfaceToken(IActivityManager.descriptor);
4941 data.writeStrongBinder(owner);
4942 if (uri != null) {
4943 data.writeInt(1);
4944 uri.writeToParcel(data, 0);
4945 } else {
4946 data.writeInt(0);
4947 }
4948 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004949 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004950 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4951 reply.readException();
4952 data.recycle();
4953 reply.recycle();
4954 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004955
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004956 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004957 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004958 Parcel data = Parcel.obtain();
4959 Parcel reply = Parcel.obtain();
4960 data.writeInterfaceToken(IActivityManager.descriptor);
4961 data.writeInt(callingUid);
4962 data.writeString(targetPkg);
4963 uri.writeToParcel(data, 0);
4964 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004965 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004966 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4967 reply.readException();
4968 int res = reply.readInt();
4969 data.recycle();
4970 reply.recycle();
4971 return res;
4972 }
4973
Dianne Hackborn1676c852012-09-10 14:52:30 -07004974 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004975 String path, ParcelFileDescriptor fd) throws RemoteException {
4976 Parcel data = Parcel.obtain();
4977 Parcel reply = Parcel.obtain();
4978 data.writeInterfaceToken(IActivityManager.descriptor);
4979 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004980 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004981 data.writeInt(managed ? 1 : 0);
4982 data.writeString(path);
4983 if (fd != null) {
4984 data.writeInt(1);
4985 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4986 } else {
4987 data.writeInt(0);
4988 }
4989 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4990 reply.readException();
4991 boolean res = reply.readInt() != 0;
4992 reply.recycle();
4993 data.recycle();
4994 return res;
4995 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004996
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004997 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004998 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004999 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005000 Parcel data = Parcel.obtain();
5001 Parcel reply = Parcel.obtain();
5002 data.writeInterfaceToken(IActivityManager.descriptor);
5003 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005004 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005005 data.writeTypedArray(intents, 0);
5006 data.writeStringArray(resolvedTypes);
5007 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005008 if (options != null) {
5009 data.writeInt(1);
5010 options.writeToParcel(data, 0);
5011 } else {
5012 data.writeInt(0);
5013 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005014 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005015 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5016 reply.readException();
5017 int result = reply.readInt();
5018 reply.recycle();
5019 data.recycle();
5020 return result;
5021 }
5022
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005023 public int getFrontActivityScreenCompatMode() throws RemoteException {
5024 Parcel data = Parcel.obtain();
5025 Parcel reply = Parcel.obtain();
5026 data.writeInterfaceToken(IActivityManager.descriptor);
5027 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5028 reply.readException();
5029 int mode = reply.readInt();
5030 reply.recycle();
5031 data.recycle();
5032 return mode;
5033 }
5034
5035 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5036 Parcel data = Parcel.obtain();
5037 Parcel reply = Parcel.obtain();
5038 data.writeInterfaceToken(IActivityManager.descriptor);
5039 data.writeInt(mode);
5040 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5041 reply.readException();
5042 reply.recycle();
5043 data.recycle();
5044 }
5045
5046 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5047 Parcel data = Parcel.obtain();
5048 Parcel reply = Parcel.obtain();
5049 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005050 data.writeString(packageName);
5051 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005052 reply.readException();
5053 int mode = reply.readInt();
5054 reply.recycle();
5055 data.recycle();
5056 return mode;
5057 }
5058
5059 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005060 throws RemoteException {
5061 Parcel data = Parcel.obtain();
5062 Parcel reply = Parcel.obtain();
5063 data.writeInterfaceToken(IActivityManager.descriptor);
5064 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005065 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005066 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5067 reply.readException();
5068 reply.recycle();
5069 data.recycle();
5070 }
5071
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005072 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5073 Parcel data = Parcel.obtain();
5074 Parcel reply = Parcel.obtain();
5075 data.writeInterfaceToken(IActivityManager.descriptor);
5076 data.writeString(packageName);
5077 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5078 reply.readException();
5079 boolean ask = reply.readInt() != 0;
5080 reply.recycle();
5081 data.recycle();
5082 return ask;
5083 }
5084
5085 public void setPackageAskScreenCompat(String packageName, boolean ask)
5086 throws RemoteException {
5087 Parcel data = Parcel.obtain();
5088 Parcel reply = Parcel.obtain();
5089 data.writeInterfaceToken(IActivityManager.descriptor);
5090 data.writeString(packageName);
5091 data.writeInt(ask ? 1 : 0);
5092 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5093 reply.readException();
5094 reply.recycle();
5095 data.recycle();
5096 }
5097
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005098 public boolean switchUser(int userid) throws RemoteException {
5099 Parcel data = Parcel.obtain();
5100 Parcel reply = Parcel.obtain();
5101 data.writeInterfaceToken(IActivityManager.descriptor);
5102 data.writeInt(userid);
5103 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5104 reply.readException();
5105 boolean result = reply.readInt() != 0;
5106 reply.recycle();
5107 data.recycle();
5108 return result;
5109 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005110
Kenny Guy08488bf2014-02-21 17:40:37 +00005111 public boolean startUserInBackground(int userid) throws RemoteException {
5112 Parcel data = Parcel.obtain();
5113 Parcel reply = Parcel.obtain();
5114 data.writeInterfaceToken(IActivityManager.descriptor);
5115 data.writeInt(userid);
5116 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5117 reply.readException();
5118 boolean result = reply.readInt() != 0;
5119 reply.recycle();
5120 data.recycle();
5121 return result;
5122 }
5123
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005124 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5125 Parcel data = Parcel.obtain();
5126 Parcel reply = Parcel.obtain();
5127 data.writeInterfaceToken(IActivityManager.descriptor);
5128 data.writeInt(userid);
5129 data.writeStrongInterface(callback);
5130 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5131 reply.readException();
5132 int result = reply.readInt();
5133 reply.recycle();
5134 data.recycle();
5135 return result;
5136 }
5137
Amith Yamasani52f1d752012-03-28 18:19:29 -07005138 public UserInfo getCurrentUser() throws RemoteException {
5139 Parcel data = Parcel.obtain();
5140 Parcel reply = Parcel.obtain();
5141 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005142 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005143 reply.readException();
5144 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5145 reply.recycle();
5146 data.recycle();
5147 return userInfo;
5148 }
5149
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005150 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005151 Parcel data = Parcel.obtain();
5152 Parcel reply = Parcel.obtain();
5153 data.writeInterfaceToken(IActivityManager.descriptor);
5154 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005155 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005156 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5157 reply.readException();
5158 boolean result = reply.readInt() != 0;
5159 reply.recycle();
5160 data.recycle();
5161 return result;
5162 }
5163
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005164 public int[] getRunningUserIds() throws RemoteException {
5165 Parcel data = Parcel.obtain();
5166 Parcel reply = Parcel.obtain();
5167 data.writeInterfaceToken(IActivityManager.descriptor);
5168 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5169 reply.readException();
5170 int[] result = reply.createIntArray();
5171 reply.recycle();
5172 data.recycle();
5173 return result;
5174 }
5175
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005176 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005177 Parcel data = Parcel.obtain();
5178 Parcel reply = Parcel.obtain();
5179 data.writeInterfaceToken(IActivityManager.descriptor);
5180 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005181 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5182 reply.readException();
5183 boolean result = reply.readInt() != 0;
5184 reply.recycle();
5185 data.recycle();
5186 return result;
5187 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005188
Jeff Sharkeya4620792011-05-20 15:29:23 -07005189 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5190 Parcel data = Parcel.obtain();
5191 Parcel reply = Parcel.obtain();
5192 data.writeInterfaceToken(IActivityManager.descriptor);
5193 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5194 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5195 reply.readException();
5196 data.recycle();
5197 reply.recycle();
5198 }
5199
5200 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5201 Parcel data = Parcel.obtain();
5202 Parcel reply = Parcel.obtain();
5203 data.writeInterfaceToken(IActivityManager.descriptor);
5204 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5205 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5206 reply.readException();
5207 data.recycle();
5208 reply.recycle();
5209 }
5210
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005211 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5212 Parcel data = Parcel.obtain();
5213 Parcel reply = Parcel.obtain();
5214 data.writeInterfaceToken(IActivityManager.descriptor);
5215 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5216 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5217 reply.readException();
5218 data.recycle();
5219 reply.recycle();
5220 }
5221
5222 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5223 Parcel data = Parcel.obtain();
5224 Parcel reply = Parcel.obtain();
5225 data.writeInterfaceToken(IActivityManager.descriptor);
5226 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5227 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5228 reply.readException();
5229 data.recycle();
5230 reply.recycle();
5231 }
5232
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005233 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5234 Parcel data = Parcel.obtain();
5235 Parcel reply = Parcel.obtain();
5236 data.writeInterfaceToken(IActivityManager.descriptor);
5237 data.writeStrongBinder(sender.asBinder());
5238 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5239 reply.readException();
5240 boolean res = reply.readInt() != 0;
5241 data.recycle();
5242 reply.recycle();
5243 return res;
5244 }
5245
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005246 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5247 Parcel data = Parcel.obtain();
5248 Parcel reply = Parcel.obtain();
5249 data.writeInterfaceToken(IActivityManager.descriptor);
5250 data.writeStrongBinder(sender.asBinder());
5251 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5252 reply.readException();
5253 boolean res = reply.readInt() != 0;
5254 data.recycle();
5255 reply.recycle();
5256 return res;
5257 }
5258
Dianne Hackborn81038902012-11-26 17:04:09 -08005259 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5260 Parcel data = Parcel.obtain();
5261 Parcel reply = Parcel.obtain();
5262 data.writeInterfaceToken(IActivityManager.descriptor);
5263 data.writeStrongBinder(sender.asBinder());
5264 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5265 reply.readException();
5266 Intent res = reply.readInt() != 0
5267 ? Intent.CREATOR.createFromParcel(reply) : null;
5268 data.recycle();
5269 reply.recycle();
5270 return res;
5271 }
5272
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005273 public String getTagForIntentSender(IIntentSender sender, String prefix)
5274 throws RemoteException {
5275 Parcel data = Parcel.obtain();
5276 Parcel reply = Parcel.obtain();
5277 data.writeInterfaceToken(IActivityManager.descriptor);
5278 data.writeStrongBinder(sender.asBinder());
5279 data.writeString(prefix);
5280 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5281 reply.readException();
5282 String res = reply.readString();
5283 data.recycle();
5284 reply.recycle();
5285 return res;
5286 }
5287
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005288 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5289 {
5290 Parcel data = Parcel.obtain();
5291 Parcel reply = Parcel.obtain();
5292 data.writeInterfaceToken(IActivityManager.descriptor);
5293 values.writeToParcel(data, 0);
5294 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5295 reply.readException();
5296 data.recycle();
5297 reply.recycle();
5298 }
5299
Dianne Hackbornb437e092011-08-05 17:50:29 -07005300 public long[] getProcessPss(int[] pids) throws RemoteException {
5301 Parcel data = Parcel.obtain();
5302 Parcel reply = Parcel.obtain();
5303 data.writeInterfaceToken(IActivityManager.descriptor);
5304 data.writeIntArray(pids);
5305 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5306 reply.readException();
5307 long[] res = reply.createLongArray();
5308 data.recycle();
5309 reply.recycle();
5310 return res;
5311 }
5312
Dianne Hackborn661cd522011-08-22 00:26:20 -07005313 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5314 Parcel data = Parcel.obtain();
5315 Parcel reply = Parcel.obtain();
5316 data.writeInterfaceToken(IActivityManager.descriptor);
5317 TextUtils.writeToParcel(msg, data, 0);
5318 data.writeInt(always ? 1 : 0);
5319 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5320 reply.readException();
5321 data.recycle();
5322 reply.recycle();
5323 }
5324
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005325 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005326 Parcel data = Parcel.obtain();
5327 Parcel reply = Parcel.obtain();
5328 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005329 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005330 reply.readException();
5331 data.recycle();
5332 reply.recycle();
5333 }
5334
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005335 public void keyguardGoingAway(boolean disableWindowAnimations,
5336 boolean keyguardGoingToNotificationShade) throws RemoteException {
5337 Parcel data = Parcel.obtain();
5338 Parcel reply = Parcel.obtain();
5339 data.writeInterfaceToken(IActivityManager.descriptor);
5340 data.writeInt(disableWindowAnimations ? 1 : 0);
5341 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5342 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5343 reply.readException();
5344 data.recycle();
5345 reply.recycle();
5346 }
5347
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005348 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005349 throws RemoteException {
5350 Parcel data = Parcel.obtain();
5351 Parcel reply = Parcel.obtain();
5352 data.writeInterfaceToken(IActivityManager.descriptor);
5353 data.writeStrongBinder(token);
5354 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005355 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005356 reply.readException();
5357 boolean result = reply.readInt() != 0;
5358 data.recycle();
5359 reply.recycle();
5360 return result;
5361 }
5362
5363 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5364 throws RemoteException {
5365 Parcel data = Parcel.obtain();
5366 Parcel reply = Parcel.obtain();
5367 data.writeInterfaceToken(IActivityManager.descriptor);
5368 data.writeStrongBinder(token);
5369 target.writeToParcel(data, 0);
5370 data.writeInt(resultCode);
5371 if (resultData != null) {
5372 data.writeInt(1);
5373 resultData.writeToParcel(data, 0);
5374 } else {
5375 data.writeInt(0);
5376 }
5377 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5378 reply.readException();
5379 boolean result = reply.readInt() != 0;
5380 data.recycle();
5381 reply.recycle();
5382 return result;
5383 }
5384
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005385 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5386 Parcel data = Parcel.obtain();
5387 Parcel reply = Parcel.obtain();
5388 data.writeInterfaceToken(IActivityManager.descriptor);
5389 data.writeStrongBinder(activityToken);
5390 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5391 reply.readException();
5392 int result = reply.readInt();
5393 data.recycle();
5394 reply.recycle();
5395 return result;
5396 }
5397
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005398 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5399 Parcel data = Parcel.obtain();
5400 Parcel reply = Parcel.obtain();
5401 data.writeInterfaceToken(IActivityManager.descriptor);
5402 data.writeStrongBinder(activityToken);
5403 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5404 reply.readException();
5405 String result = reply.readString();
5406 data.recycle();
5407 reply.recycle();
5408 return result;
5409 }
5410
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005411 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5412 Parcel data = Parcel.obtain();
5413 Parcel reply = Parcel.obtain();
5414 data.writeInterfaceToken(IActivityManager.descriptor);
5415 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5416 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5417 reply.readException();
5418 data.recycle();
5419 reply.recycle();
5420 }
5421
5422 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5423 Parcel data = Parcel.obtain();
5424 Parcel reply = Parcel.obtain();
5425 data.writeInterfaceToken(IActivityManager.descriptor);
5426 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5427 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5428 reply.readException();
5429 data.recycle();
5430 reply.recycle();
5431 }
5432
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005433 public void requestBugReport() throws RemoteException {
5434 Parcel data = Parcel.obtain();
5435 Parcel reply = Parcel.obtain();
5436 data.writeInterfaceToken(IActivityManager.descriptor);
5437 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5438 reply.readException();
5439 data.recycle();
5440 reply.recycle();
5441 }
5442
Jeff Brownbd181bb2013-09-10 16:44:24 -07005443 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5444 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005445 Parcel data = Parcel.obtain();
5446 Parcel reply = Parcel.obtain();
5447 data.writeInterfaceToken(IActivityManager.descriptor);
5448 data.writeInt(pid);
5449 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005450 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005451 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5452 reply.readException();
5453 long res = reply.readInt();
5454 data.recycle();
5455 reply.recycle();
5456 return res;
5457 }
5458
Adam Skorydfc7fd72013-08-05 19:23:41 -07005459 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005460 Parcel data = Parcel.obtain();
5461 Parcel reply = Parcel.obtain();
5462 data.writeInterfaceToken(IActivityManager.descriptor);
5463 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005464 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005465 reply.readException();
5466 Bundle res = reply.readBundle();
5467 data.recycle();
5468 reply.recycle();
5469 return res;
5470 }
5471
Dianne Hackborn17f69352015-07-17 18:04:14 -07005472 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5473 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005474 Parcel data = Parcel.obtain();
5475 Parcel reply = Parcel.obtain();
5476 data.writeInterfaceToken(IActivityManager.descriptor);
5477 data.writeInt(requestType);
5478 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005479 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005480 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5481 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005482 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005483 data.recycle();
5484 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005485 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005486 }
5487
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005488 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005489 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005490 Parcel data = Parcel.obtain();
5491 Parcel reply = Parcel.obtain();
5492 data.writeInterfaceToken(IActivityManager.descriptor);
5493 data.writeStrongBinder(token);
5494 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005495 structure.writeToParcel(data, 0);
5496 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005497 if (referrer != null) {
5498 data.writeInt(1);
5499 referrer.writeToParcel(data, 0);
5500 } else {
5501 data.writeInt(0);
5502 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005503 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005504 reply.readException();
5505 data.recycle();
5506 reply.recycle();
5507 }
5508
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005509 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5510 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005511 Parcel data = Parcel.obtain();
5512 Parcel reply = Parcel.obtain();
5513 data.writeInterfaceToken(IActivityManager.descriptor);
5514 intent.writeToParcel(data, 0);
5515 data.writeInt(requestType);
5516 data.writeString(hint);
5517 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005518 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005519 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5520 reply.readException();
5521 boolean res = reply.readInt() != 0;
5522 data.recycle();
5523 reply.recycle();
5524 return res;
5525 }
5526
Dianne Hackborn17f69352015-07-17 18:04:14 -07005527 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005528 Parcel data = Parcel.obtain();
5529 Parcel reply = Parcel.obtain();
5530 data.writeInterfaceToken(IActivityManager.descriptor);
5531 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5532 reply.readException();
5533 boolean res = reply.readInt() != 0;
5534 data.recycle();
5535 reply.recycle();
5536 return res;
5537 }
5538
Dianne Hackborn17f69352015-07-17 18:04:14 -07005539 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5540 Parcel data = Parcel.obtain();
5541 Parcel reply = Parcel.obtain();
5542 data.writeInterfaceToken(IActivityManager.descriptor);
5543 data.writeStrongBinder(token);
5544 data.writeBundle(args);
5545 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5546 reply.readException();
5547 boolean res = reply.readInt() != 0;
5548 data.recycle();
5549 reply.recycle();
5550 return res;
5551 }
5552
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005553 public void killUid(int uid, String reason) throws RemoteException {
5554 Parcel data = Parcel.obtain();
5555 Parcel reply = Parcel.obtain();
5556 data.writeInterfaceToken(IActivityManager.descriptor);
5557 data.writeInt(uid);
5558 data.writeString(reason);
5559 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5560 reply.readException();
5561 data.recycle();
5562 reply.recycle();
5563 }
5564
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005565 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5566 Parcel data = Parcel.obtain();
5567 Parcel reply = Parcel.obtain();
5568 data.writeInterfaceToken(IActivityManager.descriptor);
5569 data.writeStrongBinder(who);
5570 data.writeInt(allowRestart ? 1 : 0);
5571 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5572 reply.readException();
5573 data.recycle();
5574 reply.recycle();
5575 }
5576
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005577 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5578 Parcel data = Parcel.obtain();
5579 Parcel reply = Parcel.obtain();
5580 data.writeInterfaceToken(IActivityManager.descriptor);
5581 data.writeStrongBinder(token);
5582 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5583 reply.readException();
5584 data.recycle();
5585 reply.recycle();
5586 }
5587
Craig Mautner5eda9b32013-07-02 11:58:16 -07005588 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5589 Parcel data = Parcel.obtain();
5590 Parcel reply = Parcel.obtain();
5591 data.writeInterfaceToken(IActivityManager.descriptor);
5592 data.writeStrongBinder(token);
5593 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5594 reply.readException();
5595 data.recycle();
5596 reply.recycle();
5597 }
5598
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005599 public void restart() throws RemoteException {
5600 Parcel data = Parcel.obtain();
5601 Parcel reply = Parcel.obtain();
5602 data.writeInterfaceToken(IActivityManager.descriptor);
5603 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5604 reply.readException();
5605 data.recycle();
5606 reply.recycle();
5607 }
5608
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005609 public void performIdleMaintenance() throws RemoteException {
5610 Parcel data = Parcel.obtain();
5611 Parcel reply = Parcel.obtain();
5612 data.writeInterfaceToken(IActivityManager.descriptor);
5613 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5614 reply.readException();
5615 data.recycle();
5616 reply.recycle();
5617 }
5618
Todd Kennedyca4d8422015-01-15 15:19:22 -08005619 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005620 IActivityContainerCallback callback) throws RemoteException {
5621 Parcel data = Parcel.obtain();
5622 Parcel reply = Parcel.obtain();
5623 data.writeInterfaceToken(IActivityManager.descriptor);
5624 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005625 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005626 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005627 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005628 final int result = reply.readInt();
5629 final IActivityContainer res;
5630 if (result == 1) {
5631 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5632 } else {
5633 res = null;
5634 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005635 data.recycle();
5636 reply.recycle();
5637 return res;
5638 }
5639
Craig Mautner95da1082014-02-24 17:54:35 -08005640 public void deleteActivityContainer(IActivityContainer activityContainer)
5641 throws RemoteException {
5642 Parcel data = Parcel.obtain();
5643 Parcel reply = Parcel.obtain();
5644 data.writeInterfaceToken(IActivityManager.descriptor);
5645 data.writeStrongBinder(activityContainer.asBinder());
5646 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5647 reply.readException();
5648 data.recycle();
5649 reply.recycle();
5650 }
5651
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005652 public boolean startBinderTracking() throws RemoteException {
5653 Parcel data = Parcel.obtain();
5654 Parcel reply = Parcel.obtain();
5655 data.writeInterfaceToken(IActivityManager.descriptor);
5656 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5657 reply.readException();
5658 boolean res = reply.readInt() != 0;
5659 reply.recycle();
5660 data.recycle();
5661 return res;
5662 }
5663
5664 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5665 Parcel data = Parcel.obtain();
5666 Parcel reply = Parcel.obtain();
5667 data.writeInterfaceToken(IActivityManager.descriptor);
5668 if (fd != null) {
5669 data.writeInt(1);
5670 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5671 } else {
5672 data.writeInt(0);
5673 }
5674 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5675 reply.readException();
5676 boolean res = reply.readInt() != 0;
5677 reply.recycle();
5678 data.recycle();
5679 return res;
5680 }
5681
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005682 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005683 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5684 Parcel data = Parcel.obtain();
5685 Parcel reply = Parcel.obtain();
5686 data.writeInterfaceToken(IActivityManager.descriptor);
5687 data.writeInt(displayId);
5688 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5689 reply.readException();
5690 final int result = reply.readInt();
5691 final IActivityContainer res;
5692 if (result == 1) {
5693 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5694 } else {
5695 res = null;
5696 }
5697 data.recycle();
5698 reply.recycle();
5699 return res;
5700 }
5701
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005702 @Override
5703 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005704 throws RemoteException {
5705 Parcel data = Parcel.obtain();
5706 Parcel reply = Parcel.obtain();
5707 data.writeInterfaceToken(IActivityManager.descriptor);
5708 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005709 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005710 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005711 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005712 data.recycle();
5713 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005714 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005715 }
5716
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005717 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005718 public void startLockTaskMode(int taskId) throws RemoteException {
5719 Parcel data = Parcel.obtain();
5720 Parcel reply = Parcel.obtain();
5721 data.writeInterfaceToken(IActivityManager.descriptor);
5722 data.writeInt(taskId);
5723 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5724 reply.readException();
5725 data.recycle();
5726 reply.recycle();
5727 }
5728
5729 @Override
5730 public void startLockTaskMode(IBinder token) throws RemoteException {
5731 Parcel data = Parcel.obtain();
5732 Parcel reply = Parcel.obtain();
5733 data.writeInterfaceToken(IActivityManager.descriptor);
5734 data.writeStrongBinder(token);
5735 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5736 reply.readException();
5737 data.recycle();
5738 reply.recycle();
5739 }
5740
5741 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005742 public void startLockTaskModeOnCurrent() throws RemoteException {
5743 Parcel data = Parcel.obtain();
5744 Parcel reply = Parcel.obtain();
5745 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005746 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005747 reply.readException();
5748 data.recycle();
5749 reply.recycle();
5750 }
5751
5752 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005753 public void stopLockTaskMode() throws RemoteException {
5754 Parcel data = Parcel.obtain();
5755 Parcel reply = Parcel.obtain();
5756 data.writeInterfaceToken(IActivityManager.descriptor);
5757 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5758 reply.readException();
5759 data.recycle();
5760 reply.recycle();
5761 }
5762
5763 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005764 public void stopLockTaskModeOnCurrent() throws RemoteException {
5765 Parcel data = Parcel.obtain();
5766 Parcel reply = Parcel.obtain();
5767 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005768 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005769 reply.readException();
5770 data.recycle();
5771 reply.recycle();
5772 }
5773
5774 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005775 public boolean isInLockTaskMode() throws RemoteException {
5776 Parcel data = Parcel.obtain();
5777 Parcel reply = Parcel.obtain();
5778 data.writeInterfaceToken(IActivityManager.descriptor);
5779 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5780 reply.readException();
5781 boolean isInLockTaskMode = reply.readInt() == 1;
5782 data.recycle();
5783 reply.recycle();
5784 return isInLockTaskMode;
5785 }
5786
Craig Mautner688b5102014-03-27 16:55:03 -07005787 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005788 public int getLockTaskModeState() throws RemoteException {
5789 Parcel data = Parcel.obtain();
5790 Parcel reply = Parcel.obtain();
5791 data.writeInterfaceToken(IActivityManager.descriptor);
5792 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5793 reply.readException();
5794 int lockTaskModeState = reply.readInt();
5795 data.recycle();
5796 reply.recycle();
5797 return lockTaskModeState;
5798 }
5799
5800 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005801 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5802 Parcel data = Parcel.obtain();
5803 Parcel reply = Parcel.obtain();
5804 data.writeInterfaceToken(IActivityManager.descriptor);
5805 data.writeStrongBinder(token);
5806 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5807 IBinder.FLAG_ONEWAY);
5808 reply.readException();
5809 data.recycle();
5810 reply.recycle();
5811 }
5812
5813 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005814 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005815 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005816 Parcel data = Parcel.obtain();
5817 Parcel reply = Parcel.obtain();
5818 data.writeInterfaceToken(IActivityManager.descriptor);
5819 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005820 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005821 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005822 reply.readException();
5823 data.recycle();
5824 reply.recycle();
5825 }
5826
Craig Mautneree2e45a2014-06-27 12:10:03 -07005827 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005828 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5829 Parcel data = Parcel.obtain();
5830 Parcel reply = Parcel.obtain();
5831 data.writeInterfaceToken(IActivityManager.descriptor);
5832 data.writeInt(taskId);
5833 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005834 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005835 reply.readException();
5836 data.recycle();
5837 reply.recycle();
5838 }
5839
5840 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005841 public void resizeTask(int taskId, Rect r) throws RemoteException
5842 {
5843 Parcel data = Parcel.obtain();
5844 Parcel reply = Parcel.obtain();
5845 data.writeInterfaceToken(IActivityManager.descriptor);
5846 data.writeInt(taskId);
5847 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005848 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005849 reply.readException();
5850 data.recycle();
5851 reply.recycle();
5852 }
5853
5854 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07005855 public Rect getTaskBounds(int taskId) throws RemoteException
5856 {
5857 Parcel data = Parcel.obtain();
5858 Parcel reply = Parcel.obtain();
5859 data.writeInterfaceToken(IActivityManager.descriptor);
5860 data.writeInt(taskId);
5861 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
5862 reply.readException();
5863 Rect rect = Rect.CREATOR.createFromParcel(reply);
5864 data.recycle();
5865 reply.recycle();
5866 return rect;
5867 }
5868
5869 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005870 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5871 Parcel data = Parcel.obtain();
5872 Parcel reply = Parcel.obtain();
5873 data.writeInterfaceToken(IActivityManager.descriptor);
5874 data.writeString(filename);
5875 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5876 reply.readException();
5877 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5878 data.recycle();
5879 reply.recycle();
5880 return icon;
5881 }
5882
5883 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005884 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5885 throws RemoteException {
5886 Parcel data = Parcel.obtain();
5887 Parcel reply = Parcel.obtain();
5888 data.writeInterfaceToken(IActivityManager.descriptor);
5889 if (options == null) {
5890 data.writeInt(0);
5891 } else {
5892 data.writeInt(1);
5893 data.writeBundle(options.toBundle());
5894 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005895 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005896 reply.readException();
5897 data.recycle();
5898 reply.recycle();
5899 }
5900
5901 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005902 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005903 Parcel data = Parcel.obtain();
5904 Parcel reply = Parcel.obtain();
5905 data.writeInterfaceToken(IActivityManager.descriptor);
5906 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005907 data.writeInt(visible ? 1 : 0);
5908 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005909 reply.readException();
5910 boolean success = reply.readInt() > 0;
5911 data.recycle();
5912 reply.recycle();
5913 return success;
5914 }
5915
5916 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005917 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005918 Parcel data = Parcel.obtain();
5919 Parcel reply = Parcel.obtain();
5920 data.writeInterfaceToken(IActivityManager.descriptor);
5921 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005922 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005923 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005924 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005925 data.recycle();
5926 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005927 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005928 }
5929
5930 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005931 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005932 Parcel data = Parcel.obtain();
5933 Parcel reply = Parcel.obtain();
5934 data.writeInterfaceToken(IActivityManager.descriptor);
5935 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005936 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005937 reply.readException();
5938 data.recycle();
5939 reply.recycle();
5940 }
5941
5942 @Override
5943 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5944 Parcel data = Parcel.obtain();
5945 Parcel reply = Parcel.obtain();
5946 data.writeInterfaceToken(IActivityManager.descriptor);
5947 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005948 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005949 reply.readException();
5950 data.recycle();
5951 reply.recycle();
5952 }
5953
Craig Mautner8746a472014-07-24 15:12:54 -07005954 @Override
5955 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5956 Parcel data = Parcel.obtain();
5957 Parcel reply = Parcel.obtain();
5958 data.writeInterfaceToken(IActivityManager.descriptor);
5959 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005960 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005961 reply.readException();
5962 data.recycle();
5963 reply.recycle();
5964 }
5965
Craig Mautner6e2f3952014-09-09 14:26:41 -07005966 @Override
5967 public void bootAnimationComplete() throws RemoteException {
5968 Parcel data = Parcel.obtain();
5969 Parcel reply = Parcel.obtain();
5970 data.writeInterfaceToken(IActivityManager.descriptor);
5971 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5972 reply.readException();
5973 data.recycle();
5974 reply.recycle();
5975 }
5976
Wale Ogunwale18795a22014-12-03 11:38:33 -08005977 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005978 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5979 Parcel data = Parcel.obtain();
5980 Parcel reply = Parcel.obtain();
5981 data.writeInterfaceToken(IActivityManager.descriptor);
5982 data.writeInt(uid);
5983 data.writeByteArray(firstPacket);
5984 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5985 reply.readException();
5986 data.recycle();
5987 reply.recycle();
5988 }
5989
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005990 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005991 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5992 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005993 Parcel data = Parcel.obtain();
5994 Parcel reply = Parcel.obtain();
5995 data.writeInterfaceToken(IActivityManager.descriptor);
5996 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005997 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005998 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005999 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006000 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6001 reply.readException();
6002 data.recycle();
6003 reply.recycle();
6004 }
6005
6006 @Override
6007 public void dumpHeapFinished(String path) throws RemoteException {
6008 Parcel data = Parcel.obtain();
6009 Parcel reply = Parcel.obtain();
6010 data.writeInterfaceToken(IActivityManager.descriptor);
6011 data.writeString(path);
6012 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6013 reply.readException();
6014 data.recycle();
6015 reply.recycle();
6016 }
6017
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006018 @Override
6019 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6020 throws RemoteException {
6021 Parcel data = Parcel.obtain();
6022 Parcel reply = Parcel.obtain();
6023 data.writeInterfaceToken(IActivityManager.descriptor);
6024 data.writeStrongBinder(session.asBinder());
6025 data.writeInt(keepAwake ? 1 : 0);
6026 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6027 reply.readException();
6028 data.recycle();
6029 reply.recycle();
6030 }
6031
Craig Mautnere5600772015-04-03 21:36:37 -07006032 @Override
6033 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6034 Parcel data = Parcel.obtain();
6035 Parcel reply = Parcel.obtain();
6036 data.writeInterfaceToken(IActivityManager.descriptor);
6037 data.writeInt(userId);
6038 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006039 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006040 reply.readException();
6041 data.recycle();
6042 reply.recycle();
6043 }
6044
Dianne Hackborn1e383822015-04-10 14:02:33 -07006045 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07006046 public void updateDeviceOwner(String packageName) throws RemoteException {
6047 Parcel data = Parcel.obtain();
6048 Parcel reply = Parcel.obtain();
6049 data.writeInterfaceToken(IActivityManager.descriptor);
6050 data.writeString(packageName);
6051 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6052 reply.readException();
6053 data.recycle();
6054 reply.recycle();
6055 }
6056
6057 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006058 public int getPackageProcessState(String packageName, String callingPackage)
6059 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006060 Parcel data = Parcel.obtain();
6061 Parcel reply = Parcel.obtain();
6062 data.writeInterfaceToken(IActivityManager.descriptor);
6063 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006064 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006065 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6066 reply.readException();
6067 int res = reply.readInt();
6068 data.recycle();
6069 reply.recycle();
6070 return res;
6071 }
6072
Stefan Kuhne16045c22015-06-05 07:18:06 -07006073 @Override
6074 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6075 throws RemoteException {
6076 Parcel data = Parcel.obtain();
6077 Parcel reply = Parcel.obtain();
6078 data.writeInterfaceToken(IActivityManager.descriptor);
6079 data.writeString(process);
6080 data.writeInt(userId);
6081 data.writeInt(level);
6082 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6083 reply.readException();
6084 int res = reply.readInt();
6085 data.recycle();
6086 reply.recycle();
6087 return res != 0;
6088 }
6089
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006090 @Override
6091 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6092 Parcel data = Parcel.obtain();
6093 Parcel reply = Parcel.obtain();
6094 data.writeInterfaceToken(IActivityManager.descriptor);
6095 data.writeStrongBinder(token);
6096 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6097 reply.readException();
6098 int res = reply.readInt();
6099 data.recycle();
6100 reply.recycle();
6101 return res != 0;
6102 }
6103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006104 private IBinder mRemote;
6105}