blob: 07b9ebe521842c1c2451c5028ea5a046cab2a5ee [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,
Svet Ganov16a16892015-04-16 10:32:04 -0700111 null /*permission*/, appOp, 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;
Jeff Sharkey97978802014-10-14 10:48:18 -0700209 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700210 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 reply.writeNoException();
213 reply.writeInt(result);
214 return true;
215 }
216
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800217 case START_ACTIVITY_AND_WAIT_TRANSACTION:
218 {
219 data.enforceInterface(IActivityManager.descriptor);
220 IBinder b = data.readStrongBinder();
221 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800222 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800223 Intent intent = Intent.CREATOR.createFromParcel(data);
224 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800225 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800226 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800227 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700228 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700229 ProfilerInfo profilerInfo = data.readInt() != 0
230 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 Bundle options = data.readInt() != 0
232 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700233 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800234 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700235 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800236 reply.writeNoException();
237 result.writeToParcel(reply, 0);
238 return true;
239 }
240
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700241 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
242 {
243 data.enforceInterface(IActivityManager.descriptor);
244 IBinder b = data.readStrongBinder();
245 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800246 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700247 Intent intent = Intent.CREATOR.createFromParcel(data);
248 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700249 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700250 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700251 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700252 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700253 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700254 Bundle options = data.readInt() != 0
255 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700256 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800257 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700258 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700259 reply.writeNoException();
260 reply.writeInt(result);
261 return true;
262 }
263
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700264 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700265 {
266 data.enforceInterface(IActivityManager.descriptor);
267 IBinder b = data.readStrongBinder();
268 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700269 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700270 Intent fillInIntent = null;
271 if (data.readInt() != 0) {
272 fillInIntent = Intent.CREATOR.createFromParcel(data);
273 }
274 String resolvedType = data.readString();
275 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700276 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700277 int requestCode = data.readInt();
278 int flagsMask = data.readInt();
279 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700280 Bundle options = data.readInt() != 0
281 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700282 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700283 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700284 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700285 reply.writeNoException();
286 reply.writeInt(result);
287 return true;
288 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700289
Dianne Hackborn91097de2014-04-04 18:02:06 -0700290 case START_VOICE_ACTIVITY_TRANSACTION:
291 {
292 data.enforceInterface(IActivityManager.descriptor);
293 String callingPackage = data.readString();
294 int callingPid = data.readInt();
295 int callingUid = data.readInt();
296 Intent intent = Intent.CREATOR.createFromParcel(data);
297 String resolvedType = data.readString();
298 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
299 data.readStrongBinder());
300 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
301 data.readStrongBinder());
302 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700303 ProfilerInfo profilerInfo = data.readInt() != 0
304 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700305 Bundle options = data.readInt() != 0
306 ? Bundle.CREATOR.createFromParcel(data) : null;
307 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700308 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
309 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700310 reply.writeNoException();
311 reply.writeInt(result);
312 return true;
313 }
314
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800315 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
316 {
317 data.enforceInterface(IActivityManager.descriptor);
318 IBinder callingActivity = data.readStrongBinder();
319 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700320 Bundle options = data.readInt() != 0
321 ? Bundle.CREATOR.createFromParcel(data) : null;
322 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800323 reply.writeNoException();
324 reply.writeInt(result ? 1 : 0);
325 return true;
326 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700327
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700328 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
329 {
330 data.enforceInterface(IActivityManager.descriptor);
331 int taskId = data.readInt();
332 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
333 int result = startActivityFromRecents(taskId, options);
334 reply.writeNoException();
335 reply.writeInt(result);
336 return true;
337 }
338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800339 case FINISH_ACTIVITY_TRANSACTION: {
340 data.enforceInterface(IActivityManager.descriptor);
341 IBinder token = data.readStrongBinder();
342 Intent resultData = null;
343 int resultCode = data.readInt();
344 if (data.readInt() != 0) {
345 resultData = Intent.CREATOR.createFromParcel(data);
346 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700347 boolean finishTask = (data.readInt() != 0);
348 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800349 reply.writeNoException();
350 reply.writeInt(res ? 1 : 0);
351 return true;
352 }
353
354 case FINISH_SUB_ACTIVITY_TRANSACTION: {
355 data.enforceInterface(IActivityManager.descriptor);
356 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700357 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 int requestCode = data.readInt();
359 finishSubActivity(token, resultWho, requestCode);
360 reply.writeNoException();
361 return true;
362 }
363
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700364 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
365 data.enforceInterface(IActivityManager.descriptor);
366 IBinder token = data.readStrongBinder();
367 boolean res = finishActivityAffinity(token);
368 reply.writeNoException();
369 reply.writeInt(res ? 1 : 0);
370 return true;
371 }
372
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700373 case FINISH_VOICE_TASK_TRANSACTION: {
374 data.enforceInterface(IActivityManager.descriptor);
375 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
376 data.readStrongBinder());
377 finishVoiceTask(session);
378 reply.writeNoException();
379 return true;
380 }
381
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700382 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
383 data.enforceInterface(IActivityManager.descriptor);
384 IBinder token = data.readStrongBinder();
385 boolean res = releaseActivityInstance(token);
386 reply.writeNoException();
387 reply.writeInt(res ? 1 : 0);
388 return true;
389 }
390
391 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
392 data.enforceInterface(IActivityManager.descriptor);
393 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
394 releaseSomeActivities(app);
395 reply.writeNoException();
396 return true;
397 }
398
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800399 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
400 data.enforceInterface(IActivityManager.descriptor);
401 IBinder token = data.readStrongBinder();
402 boolean res = willActivityBeVisible(token);
403 reply.writeNoException();
404 reply.writeInt(res ? 1 : 0);
405 return true;
406 }
407
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800408 case REGISTER_RECEIVER_TRANSACTION:
409 {
410 data.enforceInterface(IActivityManager.descriptor);
411 IBinder b = data.readStrongBinder();
412 IApplicationThread app =
413 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700414 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 b = data.readStrongBinder();
416 IIntentReceiver rec
417 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
418 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
419 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700420 int userId = data.readInt();
421 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800422 reply.writeNoException();
423 if (intent != null) {
424 reply.writeInt(1);
425 intent.writeToParcel(reply, 0);
426 } else {
427 reply.writeInt(0);
428 }
429 return true;
430 }
431
432 case UNREGISTER_RECEIVER_TRANSACTION:
433 {
434 data.enforceInterface(IActivityManager.descriptor);
435 IBinder b = data.readStrongBinder();
436 if (b == null) {
437 return true;
438 }
439 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
440 unregisterReceiver(rec);
441 reply.writeNoException();
442 return true;
443 }
444
445 case BROADCAST_INTENT_TRANSACTION:
446 {
447 data.enforceInterface(IActivityManager.descriptor);
448 IBinder b = data.readStrongBinder();
449 IApplicationThread app =
450 b != null ? ApplicationThreadNative.asInterface(b) : null;
451 Intent intent = Intent.CREATOR.createFromParcel(data);
452 String resolvedType = data.readString();
453 b = data.readStrongBinder();
454 IIntentReceiver resultTo =
455 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
456 int resultCode = data.readInt();
457 String resultData = data.readString();
458 Bundle resultExtras = data.readBundle();
459 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800460 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800461 boolean serialized = data.readInt() != 0;
462 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700463 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800464 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800465 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700466 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 reply.writeNoException();
468 reply.writeInt(res);
469 return true;
470 }
471
472 case UNBROADCAST_INTENT_TRANSACTION:
473 {
474 data.enforceInterface(IActivityManager.descriptor);
475 IBinder b = data.readStrongBinder();
476 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
477 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700478 int userId = data.readInt();
479 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800480 reply.writeNoException();
481 return true;
482 }
483
484 case FINISH_RECEIVER_TRANSACTION: {
485 data.enforceInterface(IActivityManager.descriptor);
486 IBinder who = data.readStrongBinder();
487 int resultCode = data.readInt();
488 String resultData = data.readString();
489 Bundle resultExtras = data.readBundle();
490 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800491 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800493 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 }
495 reply.writeNoException();
496 return true;
497 }
498
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 case ATTACH_APPLICATION_TRANSACTION: {
500 data.enforceInterface(IActivityManager.descriptor);
501 IApplicationThread app = ApplicationThreadNative.asInterface(
502 data.readStrongBinder());
503 if (app != null) {
504 attachApplication(app);
505 }
506 reply.writeNoException();
507 return true;
508 }
509
510 case ACTIVITY_IDLE_TRANSACTION: {
511 data.enforceInterface(IActivityManager.descriptor);
512 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700513 Configuration config = null;
514 if (data.readInt() != 0) {
515 config = Configuration.CREATOR.createFromParcel(data);
516 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700517 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800518 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700519 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800520 }
521 reply.writeNoException();
522 return true;
523 }
524
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700525 case ACTIVITY_RESUMED_TRANSACTION: {
526 data.enforceInterface(IActivityManager.descriptor);
527 IBinder token = data.readStrongBinder();
528 activityResumed(token);
529 reply.writeNoException();
530 return true;
531 }
532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800533 case ACTIVITY_PAUSED_TRANSACTION: {
534 data.enforceInterface(IActivityManager.descriptor);
535 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700536 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 reply.writeNoException();
538 return true;
539 }
540
541 case ACTIVITY_STOPPED_TRANSACTION: {
542 data.enforceInterface(IActivityManager.descriptor);
543 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800544 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700545 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700547 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800548 reply.writeNoException();
549 return true;
550 }
551
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800552 case ACTIVITY_SLEPT_TRANSACTION: {
553 data.enforceInterface(IActivityManager.descriptor);
554 IBinder token = data.readStrongBinder();
555 activitySlept(token);
556 reply.writeNoException();
557 return true;
558 }
559
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800560 case ACTIVITY_DESTROYED_TRANSACTION: {
561 data.enforceInterface(IActivityManager.descriptor);
562 IBinder token = data.readStrongBinder();
563 activityDestroyed(token);
564 reply.writeNoException();
565 return true;
566 }
567
568 case GET_CALLING_PACKAGE_TRANSACTION: {
569 data.enforceInterface(IActivityManager.descriptor);
570 IBinder token = data.readStrongBinder();
571 String res = token != null ? getCallingPackage(token) : null;
572 reply.writeNoException();
573 reply.writeString(res);
574 return true;
575 }
576
577 case GET_CALLING_ACTIVITY_TRANSACTION: {
578 data.enforceInterface(IActivityManager.descriptor);
579 IBinder token = data.readStrongBinder();
580 ComponentName cn = getCallingActivity(token);
581 reply.writeNoException();
582 ComponentName.writeToParcel(cn, reply);
583 return true;
584 }
585
Winson Chung1147c402014-05-14 11:05:00 -0700586 case GET_APP_TASKS_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700588 String callingPackage = data.readString();
589 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700590 reply.writeNoException();
591 int N = list != null ? list.size() : -1;
592 reply.writeInt(N);
593 int i;
594 for (i=0; i<N; i++) {
595 IAppTask task = list.get(i);
596 reply.writeStrongBinder(task.asBinder());
597 }
598 return true;
599 }
600
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700601 case ADD_APP_TASK_TRANSACTION: {
602 data.enforceInterface(IActivityManager.descriptor);
603 IBinder activityToken = data.readStrongBinder();
604 Intent intent = Intent.CREATOR.createFromParcel(data);
605 ActivityManager.TaskDescription descr
606 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
607 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
608 int res = addAppTask(activityToken, intent, descr, thumbnail);
609 reply.writeNoException();
610 reply.writeInt(res);
611 return true;
612 }
613
614 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 Point size = getAppTaskThumbnailSize();
617 reply.writeNoException();
618 size.writeToParcel(reply, 0);
619 return true;
620 }
621
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 case GET_TASKS_TRANSACTION: {
623 data.enforceInterface(IActivityManager.descriptor);
624 int maxNum = data.readInt();
625 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700626 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800627 reply.writeNoException();
628 int N = list != null ? list.size() : -1;
629 reply.writeInt(N);
630 int i;
631 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700632 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 info.writeToParcel(reply, 0);
634 }
635 return true;
636 }
637
638 case GET_RECENT_TASKS_TRANSACTION: {
639 data.enforceInterface(IActivityManager.descriptor);
640 int maxNum = data.readInt();
641 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700642 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700644 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800645 reply.writeNoException();
646 reply.writeTypedList(list);
647 return true;
648 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700649
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700650 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800651 data.enforceInterface(IActivityManager.descriptor);
652 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700653 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800654 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700655 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800656 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700657 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700658 } else {
659 reply.writeInt(0);
660 }
661 return true;
662 }
663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 case GET_SERVICES_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 int maxNum = data.readInt();
667 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700668 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800669 reply.writeNoException();
670 int N = list != null ? list.size() : -1;
671 reply.writeInt(N);
672 int i;
673 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700674 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 info.writeToParcel(reply, 0);
676 }
677 return true;
678 }
679
680 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
681 data.enforceInterface(IActivityManager.descriptor);
682 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
683 reply.writeNoException();
684 reply.writeTypedList(list);
685 return true;
686 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700687
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
689 data.enforceInterface(IActivityManager.descriptor);
690 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
691 reply.writeNoException();
692 reply.writeTypedList(list);
693 return true;
694 }
695
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700696 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
697 data.enforceInterface(IActivityManager.descriptor);
698 List<ApplicationInfo> list = getRunningExternalApplications();
699 reply.writeNoException();
700 reply.writeTypedList(list);
701 return true;
702 }
703
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 case MOVE_TASK_TO_FRONT_TRANSACTION: {
705 data.enforceInterface(IActivityManager.descriptor);
706 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800707 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700708 Bundle options = data.readInt() != 0
709 ? Bundle.CREATOR.createFromParcel(data) : null;
710 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 reply.writeNoException();
712 return true;
713 }
714
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
716 data.enforceInterface(IActivityManager.descriptor);
717 IBinder token = data.readStrongBinder();
718 boolean nonRoot = data.readInt() != 0;
719 boolean res = moveActivityTaskToBack(token, nonRoot);
720 reply.writeNoException();
721 reply.writeInt(res ? 1 : 0);
722 return true;
723 }
724
725 case MOVE_TASK_BACKWARDS_TRANSACTION: {
726 data.enforceInterface(IActivityManager.descriptor);
727 int task = data.readInt();
728 moveTaskBackwards(task);
729 reply.writeNoException();
730 return true;
731 }
732
Craig Mautnerc00204b2013-03-05 15:02:14 -0800733 case MOVE_TASK_TO_STACK_TRANSACTION: {
734 data.enforceInterface(IActivityManager.descriptor);
735 int taskId = data.readInt();
736 int stackId = data.readInt();
737 boolean toTop = data.readInt() != 0;
738 moveTaskToStack(taskId, stackId, toTop);
739 reply.writeNoException();
740 return true;
741 }
742
743 case RESIZE_STACK_TRANSACTION: {
744 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800745 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800746 Rect r = Rect.CREATOR.createFromParcel(data);
747 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800748 reply.writeNoException();
749 return true;
750 }
751
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800752 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700753 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800754 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700755 reply.writeNoException();
756 reply.writeTypedList(list);
757 return true;
758 }
759
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800760 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700761 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800762 int stackId = data.readInt();
763 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700764 reply.writeNoException();
765 if (info != null) {
766 reply.writeInt(1);
767 info.writeToParcel(reply, 0);
768 } else {
769 reply.writeInt(0);
770 }
771 return true;
772 }
773
Winson Chung303e1ff2014-03-07 15:06:19 -0800774 case IS_IN_HOME_STACK_TRANSACTION: {
775 data.enforceInterface(IActivityManager.descriptor);
776 int taskId = data.readInt();
777 boolean isInHomeStack = isInHomeStack(taskId);
778 reply.writeNoException();
779 reply.writeInt(isInHomeStack ? 1 : 0);
780 return true;
781 }
782
Craig Mautnercf910b02013-04-23 11:23:27 -0700783 case SET_FOCUSED_STACK_TRANSACTION: {
784 data.enforceInterface(IActivityManager.descriptor);
785 int stackId = data.readInt();
786 setFocusedStack(stackId);
787 reply.writeNoException();
788 return true;
789 }
790
Winson Chungd16c5652015-01-26 16:11:07 -0800791 case GET_FOCUSED_STACK_ID_TRANSACTION: {
792 data.enforceInterface(IActivityManager.descriptor);
793 int focusedStackId = getFocusedStackId();
794 reply.writeNoException();
795 reply.writeInt(focusedStackId);
796 return true;
797 }
798
Winson Chung740c3ac2014-11-12 16:14:38 -0800799 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
800 data.enforceInterface(IActivityManager.descriptor);
801 IBinder token = data.readStrongBinder();
802 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
803 reply.writeNoException();
804 return true;
805 }
806
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800807 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 IBinder token = data.readStrongBinder();
810 boolean onlyRoot = data.readInt() != 0;
811 int res = token != null
812 ? getTaskForActivity(token, onlyRoot) : -1;
813 reply.writeNoException();
814 reply.writeInt(res);
815 return true;
816 }
817
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800818 case GET_CONTENT_PROVIDER_TRANSACTION: {
819 data.enforceInterface(IActivityManager.descriptor);
820 IBinder b = data.readStrongBinder();
821 IApplicationThread app = ApplicationThreadNative.asInterface(b);
822 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700823 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700824 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700825 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800826 reply.writeNoException();
827 if (cph != null) {
828 reply.writeInt(1);
829 cph.writeToParcel(reply, 0);
830 } else {
831 reply.writeInt(0);
832 }
833 return true;
834 }
835
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800836 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
837 data.enforceInterface(IActivityManager.descriptor);
838 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700839 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800840 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700841 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800842 reply.writeNoException();
843 if (cph != null) {
844 reply.writeInt(1);
845 cph.writeToParcel(reply, 0);
846 } else {
847 reply.writeInt(0);
848 }
849 return true;
850 }
851
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800852 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder b = data.readStrongBinder();
855 IApplicationThread app = ApplicationThreadNative.asInterface(b);
856 ArrayList<ContentProviderHolder> providers =
857 data.createTypedArrayList(ContentProviderHolder.CREATOR);
858 publishContentProviders(app, providers);
859 reply.writeNoException();
860 return true;
861 }
862
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700863 case REF_CONTENT_PROVIDER_TRANSACTION: {
864 data.enforceInterface(IActivityManager.descriptor);
865 IBinder b = data.readStrongBinder();
866 int stable = data.readInt();
867 int unstable = data.readInt();
868 boolean res = refContentProvider(b, stable, unstable);
869 reply.writeNoException();
870 reply.writeInt(res ? 1 : 0);
871 return true;
872 }
873
874 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
875 data.enforceInterface(IActivityManager.descriptor);
876 IBinder b = data.readStrongBinder();
877 unstableProviderDied(b);
878 reply.writeNoException();
879 return true;
880 }
881
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700882 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
883 data.enforceInterface(IActivityManager.descriptor);
884 IBinder b = data.readStrongBinder();
885 appNotRespondingViaProvider(b);
886 reply.writeNoException();
887 return true;
888 }
889
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800890 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
891 data.enforceInterface(IActivityManager.descriptor);
892 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700893 boolean stable = data.readInt() != 0;
894 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800895 reply.writeNoException();
896 return true;
897 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800898
899 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 String name = data.readString();
902 IBinder token = data.readStrongBinder();
903 removeContentProviderExternal(name, token);
904 reply.writeNoException();
905 return true;
906 }
907
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700908 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
911 PendingIntent pi = getRunningServiceControlPanel(comp);
912 reply.writeNoException();
913 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
914 return true;
915 }
916
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 case START_SERVICE_TRANSACTION: {
918 data.enforceInterface(IActivityManager.descriptor);
919 IBinder b = data.readStrongBinder();
920 IApplicationThread app = ApplicationThreadNative.asInterface(b);
921 Intent service = Intent.CREATOR.createFromParcel(data);
922 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700923 int userId = data.readInt();
924 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 reply.writeNoException();
926 ComponentName.writeToParcel(cn, reply);
927 return true;
928 }
929
930 case STOP_SERVICE_TRANSACTION: {
931 data.enforceInterface(IActivityManager.descriptor);
932 IBinder b = data.readStrongBinder();
933 IApplicationThread app = ApplicationThreadNative.asInterface(b);
934 Intent service = Intent.CREATOR.createFromParcel(data);
935 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700936 int userId = data.readInt();
937 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 reply.writeNoException();
939 reply.writeInt(res);
940 return true;
941 }
942
943 case STOP_SERVICE_TOKEN_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 ComponentName className = ComponentName.readFromParcel(data);
946 IBinder token = data.readStrongBinder();
947 int startId = data.readInt();
948 boolean res = stopServiceToken(className, token, startId);
949 reply.writeNoException();
950 reply.writeInt(res ? 1 : 0);
951 return true;
952 }
953
954 case SET_SERVICE_FOREGROUND_TRANSACTION: {
955 data.enforceInterface(IActivityManager.descriptor);
956 ComponentName className = ComponentName.readFromParcel(data);
957 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700958 int id = data.readInt();
959 Notification notification = null;
960 if (data.readInt() != 0) {
961 notification = Notification.CREATOR.createFromParcel(data);
962 }
963 boolean removeNotification = data.readInt() != 0;
964 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800965 reply.writeNoException();
966 return true;
967 }
968
969 case BIND_SERVICE_TRANSACTION: {
970 data.enforceInterface(IActivityManager.descriptor);
971 IBinder b = data.readStrongBinder();
972 IApplicationThread app = ApplicationThreadNative.asInterface(b);
973 IBinder token = data.readStrongBinder();
974 Intent service = Intent.CREATOR.createFromParcel(data);
975 String resolvedType = data.readString();
976 b = data.readStrongBinder();
977 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800978 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800979 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800980 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800981 reply.writeNoException();
982 reply.writeInt(res);
983 return true;
984 }
985
986 case UNBIND_SERVICE_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder b = data.readStrongBinder();
989 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
990 boolean res = unbindService(conn);
991 reply.writeNoException();
992 reply.writeInt(res ? 1 : 0);
993 return true;
994 }
995
996 case PUBLISH_SERVICE_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 IBinder token = data.readStrongBinder();
999 Intent intent = Intent.CREATOR.createFromParcel(data);
1000 IBinder service = data.readStrongBinder();
1001 publishService(token, intent, service);
1002 reply.writeNoException();
1003 return true;
1004 }
1005
1006 case UNBIND_FINISHED_TRANSACTION: {
1007 data.enforceInterface(IActivityManager.descriptor);
1008 IBinder token = data.readStrongBinder();
1009 Intent intent = Intent.CREATOR.createFromParcel(data);
1010 boolean doRebind = data.readInt() != 0;
1011 unbindFinished(token, intent, doRebind);
1012 reply.writeNoException();
1013 return true;
1014 }
1015
1016 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1017 data.enforceInterface(IActivityManager.descriptor);
1018 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001019 int type = data.readInt();
1020 int startId = data.readInt();
1021 int res = data.readInt();
1022 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001023 reply.writeNoException();
1024 return true;
1025 }
1026
1027 case START_INSTRUMENTATION_TRANSACTION: {
1028 data.enforceInterface(IActivityManager.descriptor);
1029 ComponentName className = ComponentName.readFromParcel(data);
1030 String profileFile = data.readString();
1031 int fl = data.readInt();
1032 Bundle arguments = data.readBundle();
1033 IBinder b = data.readStrongBinder();
1034 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001035 b = data.readStrongBinder();
1036 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001037 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001038 String abiOverride = data.readString();
1039 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1040 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001041 reply.writeNoException();
1042 reply.writeInt(res ? 1 : 0);
1043 return true;
1044 }
1045
1046
1047 case FINISH_INSTRUMENTATION_TRANSACTION: {
1048 data.enforceInterface(IActivityManager.descriptor);
1049 IBinder b = data.readStrongBinder();
1050 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1051 int resultCode = data.readInt();
1052 Bundle results = data.readBundle();
1053 finishInstrumentation(app, resultCode, results);
1054 reply.writeNoException();
1055 return true;
1056 }
1057
1058 case GET_CONFIGURATION_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 Configuration config = getConfiguration();
1061 reply.writeNoException();
1062 config.writeToParcel(reply, 0);
1063 return true;
1064 }
1065
1066 case UPDATE_CONFIGURATION_TRANSACTION: {
1067 data.enforceInterface(IActivityManager.descriptor);
1068 Configuration config = Configuration.CREATOR.createFromParcel(data);
1069 updateConfiguration(config);
1070 reply.writeNoException();
1071 return true;
1072 }
1073
1074 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 IBinder token = data.readStrongBinder();
1077 int requestedOrientation = data.readInt();
1078 setRequestedOrientation(token, requestedOrientation);
1079 reply.writeNoException();
1080 return true;
1081 }
1082
1083 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1084 data.enforceInterface(IActivityManager.descriptor);
1085 IBinder token = data.readStrongBinder();
1086 int req = getRequestedOrientation(token);
1087 reply.writeNoException();
1088 reply.writeInt(req);
1089 return true;
1090 }
1091
1092 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1093 data.enforceInterface(IActivityManager.descriptor);
1094 IBinder token = data.readStrongBinder();
1095 ComponentName cn = getActivityClassForToken(token);
1096 reply.writeNoException();
1097 ComponentName.writeToParcel(cn, reply);
1098 return true;
1099 }
1100
1101 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1102 data.enforceInterface(IActivityManager.descriptor);
1103 IBinder token = data.readStrongBinder();
1104 reply.writeNoException();
1105 reply.writeString(getPackageForToken(token));
1106 return true;
1107 }
1108
1109 case GET_INTENT_SENDER_TRANSACTION: {
1110 data.enforceInterface(IActivityManager.descriptor);
1111 int type = data.readInt();
1112 String packageName = data.readString();
1113 IBinder token = data.readStrongBinder();
1114 String resultWho = data.readString();
1115 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001116 Intent[] requestIntents;
1117 String[] requestResolvedTypes;
1118 if (data.readInt() != 0) {
1119 requestIntents = data.createTypedArray(Intent.CREATOR);
1120 requestResolvedTypes = data.createStringArray();
1121 } else {
1122 requestIntents = null;
1123 requestResolvedTypes = null;
1124 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001126 Bundle options = data.readInt() != 0
1127 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001128 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001129 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001130 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001131 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001132 reply.writeNoException();
1133 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1134 return true;
1135 }
1136
1137 case CANCEL_INTENT_SENDER_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 IIntentSender r = IIntentSender.Stub.asInterface(
1140 data.readStrongBinder());
1141 cancelIntentSender(r);
1142 reply.writeNoException();
1143 return true;
1144 }
1145
1146 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1147 data.enforceInterface(IActivityManager.descriptor);
1148 IIntentSender r = IIntentSender.Stub.asInterface(
1149 data.readStrongBinder());
1150 String res = getPackageForIntentSender(r);
1151 reply.writeNoException();
1152 reply.writeString(res);
1153 return true;
1154 }
1155
Christopher Tatec4a07d12012-04-06 14:19:13 -07001156 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1157 data.enforceInterface(IActivityManager.descriptor);
1158 IIntentSender r = IIntentSender.Stub.asInterface(
1159 data.readStrongBinder());
1160 int res = getUidForIntentSender(r);
1161 reply.writeNoException();
1162 reply.writeInt(res);
1163 return true;
1164 }
1165
Dianne Hackborn41203752012-08-31 14:05:51 -07001166 case HANDLE_INCOMING_USER_TRANSACTION: {
1167 data.enforceInterface(IActivityManager.descriptor);
1168 int callingPid = data.readInt();
1169 int callingUid = data.readInt();
1170 int userId = data.readInt();
1171 boolean allowAll = data.readInt() != 0 ;
1172 boolean requireFull = data.readInt() != 0;
1173 String name = data.readString();
1174 String callerPackage = data.readString();
1175 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1176 requireFull, name, callerPackage);
1177 reply.writeNoException();
1178 reply.writeInt(res);
1179 return true;
1180 }
1181
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 case SET_PROCESS_LIMIT_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 int max = data.readInt();
1185 setProcessLimit(max);
1186 reply.writeNoException();
1187 return true;
1188 }
1189
1190 case GET_PROCESS_LIMIT_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 int limit = getProcessLimit();
1193 reply.writeNoException();
1194 reply.writeInt(limit);
1195 return true;
1196 }
1197
1198 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1199 data.enforceInterface(IActivityManager.descriptor);
1200 IBinder token = data.readStrongBinder();
1201 int pid = data.readInt();
1202 boolean isForeground = data.readInt() != 0;
1203 setProcessForeground(token, pid, isForeground);
1204 reply.writeNoException();
1205 return true;
1206 }
1207
1208 case CHECK_PERMISSION_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 String perm = data.readString();
1211 int pid = data.readInt();
1212 int uid = data.readInt();
1213 int res = checkPermission(perm, pid, uid);
1214 reply.writeNoException();
1215 reply.writeInt(res);
1216 return true;
1217 }
1218
Dianne Hackbornff170242014-11-19 10:59:01 -08001219 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1220 data.enforceInterface(IActivityManager.descriptor);
1221 String perm = data.readString();
1222 int pid = data.readInt();
1223 int uid = data.readInt();
1224 IBinder token = data.readStrongBinder();
1225 int res = checkPermissionWithToken(perm, pid, uid, token);
1226 reply.writeNoException();
1227 reply.writeInt(res);
1228 return true;
1229 }
1230
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 case CHECK_URI_PERMISSION_TRANSACTION: {
1232 data.enforceInterface(IActivityManager.descriptor);
1233 Uri uri = Uri.CREATOR.createFromParcel(data);
1234 int pid = data.readInt();
1235 int uid = data.readInt();
1236 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001237 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001238 IBinder callerToken = data.readStrongBinder();
1239 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 reply.writeNoException();
1241 reply.writeInt(res);
1242 return true;
1243 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001246 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 String packageName = data.readString();
1248 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1249 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001250 int userId = data.readInt();
1251 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001252 reply.writeNoException();
1253 reply.writeInt(res ? 1 : 0);
1254 return true;
1255 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001256
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 case GRANT_URI_PERMISSION_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 IBinder b = data.readStrongBinder();
1260 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1261 String targetPkg = data.readString();
1262 Uri uri = Uri.CREATOR.createFromParcel(data);
1263 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001264 int userId = data.readInt();
1265 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001266 reply.writeNoException();
1267 return true;
1268 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001269
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 case REVOKE_URI_PERMISSION_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 IBinder b = data.readStrongBinder();
1273 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1274 Uri uri = Uri.CREATOR.createFromParcel(data);
1275 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001276 int userId = data.readInt();
1277 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 reply.writeNoException();
1279 return true;
1280 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001281
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001282 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1283 data.enforceInterface(IActivityManager.descriptor);
1284 Uri uri = Uri.CREATOR.createFromParcel(data);
1285 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001286 int userId = data.readInt();
1287 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001288 reply.writeNoException();
1289 return true;
1290 }
1291
1292 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1293 data.enforceInterface(IActivityManager.descriptor);
1294 Uri uri = Uri.CREATOR.createFromParcel(data);
1295 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001296 int userId = data.readInt();
1297 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001298 reply.writeNoException();
1299 return true;
1300 }
1301
1302 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1303 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001304 final String packageName = data.readString();
1305 final boolean incoming = data.readInt() != 0;
1306 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1307 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001308 reply.writeNoException();
1309 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1310 return true;
1311 }
1312
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001313 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1314 data.enforceInterface(IActivityManager.descriptor);
1315 IBinder b = data.readStrongBinder();
1316 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1317 boolean waiting = data.readInt() != 0;
1318 showWaitingForDebugger(app, waiting);
1319 reply.writeNoException();
1320 return true;
1321 }
1322
1323 case GET_MEMORY_INFO_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1326 getMemoryInfo(mi);
1327 reply.writeNoException();
1328 mi.writeToParcel(reply, 0);
1329 return true;
1330 }
1331
1332 case UNHANDLED_BACK_TRANSACTION: {
1333 data.enforceInterface(IActivityManager.descriptor);
1334 unhandledBack();
1335 reply.writeNoException();
1336 return true;
1337 }
1338
1339 case OPEN_CONTENT_URI_TRANSACTION: {
1340 data.enforceInterface(IActivityManager.descriptor);
1341 Uri uri = Uri.parse(data.readString());
1342 ParcelFileDescriptor pfd = openContentUri(uri);
1343 reply.writeNoException();
1344 if (pfd != null) {
1345 reply.writeInt(1);
1346 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1347 } else {
1348 reply.writeInt(0);
1349 }
1350 return true;
1351 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001352
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001353 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
1355 setLockScreenShown(data.readInt() != 0);
1356 reply.writeNoException();
1357 return true;
1358 }
1359
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001360 case SET_DEBUG_APP_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
1362 String pn = data.readString();
1363 boolean wfd = data.readInt() != 0;
1364 boolean per = data.readInt() != 0;
1365 setDebugApp(pn, wfd, per);
1366 reply.writeNoException();
1367 return true;
1368 }
1369
1370 case SET_ALWAYS_FINISH_TRANSACTION: {
1371 data.enforceInterface(IActivityManager.descriptor);
1372 boolean enabled = data.readInt() != 0;
1373 setAlwaysFinish(enabled);
1374 reply.writeNoException();
1375 return true;
1376 }
1377
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001378 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001379 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001380 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001381 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001382 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001383 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 return true;
1385 }
1386
1387 case ENTER_SAFE_MODE_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 enterSafeMode();
1390 reply.writeNoException();
1391 return true;
1392 }
1393
1394 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1395 data.enforceInterface(IActivityManager.descriptor);
1396 IIntentSender is = IIntentSender.Stub.asInterface(
1397 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001398 int sourceUid = data.readInt();
1399 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001400 String tag = data.readString();
1401 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1402 reply.writeNoException();
1403 return true;
1404 }
1405
1406 case NOTE_ALARM_START_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
1408 IIntentSender is = IIntentSender.Stub.asInterface(
1409 data.readStrongBinder());
1410 int sourceUid = data.readInt();
1411 String tag = data.readString();
1412 noteAlarmStart(is, sourceUid, tag);
1413 reply.writeNoException();
1414 return true;
1415 }
1416
1417 case NOTE_ALARM_FINISH_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
1419 IIntentSender is = IIntentSender.Stub.asInterface(
1420 data.readStrongBinder());
1421 int sourceUid = data.readInt();
1422 String tag = data.readString();
1423 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001424 reply.writeNoException();
1425 return true;
1426 }
1427
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001428 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001429 data.enforceInterface(IActivityManager.descriptor);
1430 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001431 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001432 boolean secure = data.readInt() != 0;
1433 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001434 reply.writeNoException();
1435 reply.writeInt(res ? 1 : 0);
1436 return true;
1437 }
1438
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001439 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1440 data.enforceInterface(IActivityManager.descriptor);
1441 String reason = data.readString();
1442 boolean res = killProcessesBelowForeground(reason);
1443 reply.writeNoException();
1444 reply.writeInt(res ? 1 : 0);
1445 return true;
1446 }
1447
Dan Egnor60d87622009-12-16 16:32:58 -08001448 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1449 data.enforceInterface(IActivityManager.descriptor);
1450 IBinder app = data.readStrongBinder();
1451 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1452 handleApplicationCrash(app, ci);
1453 reply.writeNoException();
1454 return true;
1455 }
1456
1457 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 data.enforceInterface(IActivityManager.descriptor);
1459 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001460 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001461 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001462 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001463 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001464 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001465 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001466 return true;
1467 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001468
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001469 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001472 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001473 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1474 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001475 reply.writeNoException();
1476 return true;
1477 }
1478
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001479 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1480 data.enforceInterface(IActivityManager.descriptor);
1481 int sig = data.readInt();
1482 signalPersistentProcesses(sig);
1483 reply.writeNoException();
1484 return true;
1485 }
1486
Dianne Hackborn03abb812010-01-04 18:43:19 -08001487 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001489 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001490 int userId = data.readInt();
1491 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001492 reply.writeNoException();
1493 return true;
1494 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001495
1496 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1497 data.enforceInterface(IActivityManager.descriptor);
1498 killAllBackgroundProcesses();
1499 reply.writeNoException();
1500 return true;
1501 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001502
Dianne Hackborn03abb812010-01-04 18:43:19 -08001503 case FORCE_STOP_PACKAGE_TRANSACTION: {
1504 data.enforceInterface(IActivityManager.descriptor);
1505 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001506 int userId = data.readInt();
1507 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001508 reply.writeNoException();
1509 return true;
1510 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001511
1512 case GET_MY_MEMORY_STATE_TRANSACTION: {
1513 data.enforceInterface(IActivityManager.descriptor);
1514 ActivityManager.RunningAppProcessInfo info =
1515 new ActivityManager.RunningAppProcessInfo();
1516 getMyMemoryState(info);
1517 reply.writeNoException();
1518 info.writeToParcel(reply, 0);
1519 return true;
1520 }
1521
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001522 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1523 data.enforceInterface(IActivityManager.descriptor);
1524 ConfigurationInfo config = getDeviceConfigurationInfo();
1525 reply.writeNoException();
1526 config.writeToParcel(reply, 0);
1527 return true;
1528 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001529
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001530 case PROFILE_CONTROL_TRANSACTION: {
1531 data.enforceInterface(IActivityManager.descriptor);
1532 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001533 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001534 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001535 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001536 ProfilerInfo profilerInfo = data.readInt() != 0
1537 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1538 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001539 reply.writeNoException();
1540 reply.writeInt(res ? 1 : 0);
1541 return true;
1542 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001543
Dianne Hackborn55280a92009-05-07 15:53:46 -07001544 case SHUTDOWN_TRANSACTION: {
1545 data.enforceInterface(IActivityManager.descriptor);
1546 boolean res = shutdown(data.readInt());
1547 reply.writeNoException();
1548 reply.writeInt(res ? 1 : 0);
1549 return true;
1550 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001551
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001552 case STOP_APP_SWITCHES_TRANSACTION: {
1553 data.enforceInterface(IActivityManager.descriptor);
1554 stopAppSwitches();
1555 reply.writeNoException();
1556 return true;
1557 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001558
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001559 case RESUME_APP_SWITCHES_TRANSACTION: {
1560 data.enforceInterface(IActivityManager.descriptor);
1561 resumeAppSwitches();
1562 reply.writeNoException();
1563 return true;
1564 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001566 case PEEK_SERVICE_TRANSACTION: {
1567 data.enforceInterface(IActivityManager.descriptor);
1568 Intent service = Intent.CREATOR.createFromParcel(data);
1569 String resolvedType = data.readString();
1570 IBinder binder = peekService(service, resolvedType);
1571 reply.writeNoException();
1572 reply.writeStrongBinder(binder);
1573 return true;
1574 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001575
Christopher Tate181fafa2009-05-14 11:12:14 -07001576 case START_BACKUP_AGENT_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1579 int backupRestoreMode = data.readInt();
1580 boolean success = bindBackupAgent(info, backupRestoreMode);
1581 reply.writeNoException();
1582 reply.writeInt(success ? 1 : 0);
1583 return true;
1584 }
1585
1586 case BACKUP_AGENT_CREATED_TRANSACTION: {
1587 data.enforceInterface(IActivityManager.descriptor);
1588 String packageName = data.readString();
1589 IBinder agent = data.readStrongBinder();
1590 backupAgentCreated(packageName, agent);
1591 reply.writeNoException();
1592 return true;
1593 }
1594
1595 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1596 data.enforceInterface(IActivityManager.descriptor);
1597 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1598 unbindBackupAgent(info);
1599 reply.writeNoException();
1600 return true;
1601 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001602
1603 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1604 data.enforceInterface(IActivityManager.descriptor);
1605 String packageName = data.readString();
1606 addPackageDependency(packageName);
1607 reply.writeNoException();
1608 return true;
1609 }
1610
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001611 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001612 data.enforceInterface(IActivityManager.descriptor);
1613 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001614 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001615 String reason = data.readString();
1616 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001617 reply.writeNoException();
1618 return true;
1619 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001620
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001621 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1622 data.enforceInterface(IActivityManager.descriptor);
1623 String reason = data.readString();
1624 closeSystemDialogs(reason);
1625 reply.writeNoException();
1626 return true;
1627 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001628
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001629 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001631 int[] pids = data.createIntArray();
1632 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001633 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001634 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001635 return true;
1636 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001637
1638 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 String processName = data.readString();
1641 int uid = data.readInt();
1642 killApplicationProcess(processName, uid);
1643 reply.writeNoException();
1644 return true;
1645 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001646
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001647 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1648 data.enforceInterface(IActivityManager.descriptor);
1649 IBinder token = data.readStrongBinder();
1650 String packageName = data.readString();
1651 int enterAnim = data.readInt();
1652 int exitAnim = data.readInt();
1653 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001654 reply.writeNoException();
1655 return true;
1656 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001657
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001658 case IS_USER_A_MONKEY_TRANSACTION: {
1659 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001660 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001661 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001662 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001663 return true;
1664 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001665
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001666 case SET_USER_IS_MONKEY_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 final boolean monkey = (data.readInt() == 1);
1669 setUserIsMonkey(monkey);
1670 reply.writeNoException();
1671 return true;
1672 }
1673
Dianne Hackborn860755f2010-06-03 18:47:52 -07001674 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1675 data.enforceInterface(IActivityManager.descriptor);
1676 finishHeavyWeightApp();
1677 reply.writeNoException();
1678 return true;
1679 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001680
1681 case IS_IMMERSIVE_TRANSACTION: {
1682 data.enforceInterface(IActivityManager.descriptor);
1683 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001684 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001685 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001686 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001687 return true;
1688 }
1689
Craig Mautnerd61dc202014-07-07 11:09:11 -07001690 case IS_TOP_OF_TASK_TRANSACTION: {
1691 data.enforceInterface(IActivityManager.descriptor);
1692 IBinder token = data.readStrongBinder();
1693 final boolean isTopOfTask = isTopOfTask(token);
1694 reply.writeNoException();
1695 reply.writeInt(isTopOfTask ? 1 : 0);
1696 return true;
1697 }
1698
Craig Mautner5eda9b32013-07-02 11:58:16 -07001699 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001700 data.enforceInterface(IActivityManager.descriptor);
1701 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001702 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001703 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001704 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001705 return true;
1706 }
1707
1708 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1709 data.enforceInterface(IActivityManager.descriptor);
1710 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001711 final Bundle bundle;
1712 if (data.readInt() == 0) {
1713 bundle = null;
1714 } else {
1715 bundle = data.readBundle();
1716 }
1717 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1718 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001719 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001720 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001721 return true;
1722 }
1723
Craig Mautner233ceee2014-05-09 17:05:11 -07001724 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1725 data.enforceInterface(IActivityManager.descriptor);
1726 IBinder token = data.readStrongBinder();
1727 final ActivityOptions options = getActivityOptions(token);
1728 reply.writeNoException();
1729 reply.writeBundle(options == null ? null : options.toBundle());
1730 return true;
1731 }
1732
Daniel Sandler69a48172010-06-23 16:29:36 -04001733 case SET_IMMERSIVE_TRANSACTION: {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 IBinder token = data.readStrongBinder();
1736 boolean imm = data.readInt() == 1;
1737 setImmersive(token, imm);
1738 reply.writeNoException();
1739 return true;
1740 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001741
Daniel Sandler69a48172010-06-23 16:29:36 -04001742 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001744 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001745 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001746 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001747 return true;
1748 }
1749
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001750 case CRASH_APPLICATION_TRANSACTION: {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 int uid = data.readInt();
1753 int initialPid = data.readInt();
1754 String packageName = data.readString();
1755 String message = data.readString();
1756 crashApplication(uid, initialPid, packageName, message);
1757 reply.writeNoException();
1758 return true;
1759 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001760
1761 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001764 int userId = data.readInt();
1765 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001766 reply.writeNoException();
1767 reply.writeString(type);
1768 return true;
1769 }
1770
Dianne Hackborn7e269642010-08-25 19:50:20 -07001771 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1772 data.enforceInterface(IActivityManager.descriptor);
1773 String name = data.readString();
1774 IBinder perm = newUriPermissionOwner(name);
1775 reply.writeNoException();
1776 reply.writeStrongBinder(perm);
1777 return true;
1778 }
1779
1780 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 IBinder owner = data.readStrongBinder();
1783 int fromUid = data.readInt();
1784 String targetPkg = data.readString();
1785 Uri uri = Uri.CREATOR.createFromParcel(data);
1786 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001787 int sourceUserId = data.readInt();
1788 int targetUserId = data.readInt();
1789 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1790 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001791 reply.writeNoException();
1792 return true;
1793 }
1794
1795 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1796 data.enforceInterface(IActivityManager.descriptor);
1797 IBinder owner = data.readStrongBinder();
1798 Uri uri = null;
1799 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001800 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001801 }
1802 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001803 int userId = data.readInt();
1804 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001805 reply.writeNoException();
1806 return true;
1807 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001808
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001809 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1810 data.enforceInterface(IActivityManager.descriptor);
1811 int callingUid = data.readInt();
1812 String targetPkg = data.readString();
1813 Uri uri = Uri.CREATOR.createFromParcel(data);
1814 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001815 int userId = data.readInt();
1816 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001817 reply.writeNoException();
1818 reply.writeInt(res);
1819 return true;
1820 }
1821
Andy McFadden824c5102010-07-09 16:26:57 -07001822 case DUMP_HEAP_TRANSACTION: {
1823 data.enforceInterface(IActivityManager.descriptor);
1824 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001825 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001826 boolean managed = data.readInt() != 0;
1827 String path = data.readString();
1828 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001829 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001830 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001831 reply.writeNoException();
1832 reply.writeInt(res ? 1 : 0);
1833 return true;
1834 }
1835
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001836 case START_ACTIVITIES_TRANSACTION:
1837 {
1838 data.enforceInterface(IActivityManager.descriptor);
1839 IBinder b = data.readStrongBinder();
1840 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001841 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001842 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1843 String[] resolvedTypes = data.createStringArray();
1844 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001845 Bundle options = data.readInt() != 0
1846 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001847 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001848 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001849 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001850 reply.writeNoException();
1851 reply.writeInt(result);
1852 return true;
1853 }
1854
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001855 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1856 {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 int mode = getFrontActivityScreenCompatMode();
1859 reply.writeNoException();
1860 reply.writeInt(mode);
1861 return true;
1862 }
1863
1864 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1865 {
1866 data.enforceInterface(IActivityManager.descriptor);
1867 int mode = data.readInt();
1868 setFrontActivityScreenCompatMode(mode);
1869 reply.writeNoException();
1870 reply.writeInt(mode);
1871 return true;
1872 }
1873
1874 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1875 {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 String pkg = data.readString();
1878 int mode = getPackageScreenCompatMode(pkg);
1879 reply.writeNoException();
1880 reply.writeInt(mode);
1881 return true;
1882 }
1883
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001884 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1885 {
1886 data.enforceInterface(IActivityManager.descriptor);
1887 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001888 int mode = data.readInt();
1889 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001890 reply.writeNoException();
1891 return true;
1892 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001893
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001894 case SWITCH_USER_TRANSACTION: {
1895 data.enforceInterface(IActivityManager.descriptor);
1896 int userid = data.readInt();
1897 boolean result = switchUser(userid);
1898 reply.writeNoException();
1899 reply.writeInt(result ? 1 : 0);
1900 return true;
1901 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001902
Kenny Guy08488bf2014-02-21 17:40:37 +00001903 case START_USER_IN_BACKGROUND_TRANSACTION: {
1904 data.enforceInterface(IActivityManager.descriptor);
1905 int userid = data.readInt();
1906 boolean result = startUserInBackground(userid);
1907 reply.writeNoException();
1908 reply.writeInt(result ? 1 : 0);
1909 return true;
1910 }
1911
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001912 case STOP_USER_TRANSACTION: {
1913 data.enforceInterface(IActivityManager.descriptor);
1914 int userid = data.readInt();
1915 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1916 data.readStrongBinder());
1917 int result = stopUser(userid, callback);
1918 reply.writeNoException();
1919 reply.writeInt(result);
1920 return true;
1921 }
1922
Amith Yamasani52f1d752012-03-28 18:19:29 -07001923 case GET_CURRENT_USER_TRANSACTION: {
1924 data.enforceInterface(IActivityManager.descriptor);
1925 UserInfo userInfo = getCurrentUser();
1926 reply.writeNoException();
1927 userInfo.writeToParcel(reply, 0);
1928 return true;
1929 }
1930
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001931 case IS_USER_RUNNING_TRANSACTION: {
1932 data.enforceInterface(IActivityManager.descriptor);
1933 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001934 boolean orStopping = data.readInt() != 0;
1935 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001936 reply.writeNoException();
1937 reply.writeInt(result ? 1 : 0);
1938 return true;
1939 }
1940
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001941 case GET_RUNNING_USER_IDS_TRANSACTION: {
1942 data.enforceInterface(IActivityManager.descriptor);
1943 int[] result = getRunningUserIds();
1944 reply.writeNoException();
1945 reply.writeIntArray(result);
1946 return true;
1947 }
1948
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001949 case REMOVE_TASK_TRANSACTION:
1950 {
1951 data.enforceInterface(IActivityManager.descriptor);
1952 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001953 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001954 reply.writeNoException();
1955 reply.writeInt(result ? 1 : 0);
1956 return true;
1957 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001958
Jeff Sharkeya4620792011-05-20 15:29:23 -07001959 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1960 data.enforceInterface(IActivityManager.descriptor);
1961 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1962 data.readStrongBinder());
1963 registerProcessObserver(observer);
1964 return true;
1965 }
1966
1967 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1968 data.enforceInterface(IActivityManager.descriptor);
1969 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1970 data.readStrongBinder());
1971 unregisterProcessObserver(observer);
1972 return true;
1973 }
1974
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07001975 case REGISTER_UID_OBSERVER_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 IUidObserver observer = IUidObserver.Stub.asInterface(
1978 data.readStrongBinder());
1979 registerUidObserver(observer);
1980 return true;
1981 }
1982
1983 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
1984 data.enforceInterface(IActivityManager.descriptor);
1985 IUidObserver observer = IUidObserver.Stub.asInterface(
1986 data.readStrongBinder());
1987 unregisterUidObserver(observer);
1988 return true;
1989 }
1990
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001991 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1992 {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 String pkg = data.readString();
1995 boolean ask = getPackageAskScreenCompat(pkg);
1996 reply.writeNoException();
1997 reply.writeInt(ask ? 1 : 0);
1998 return true;
1999 }
2000
2001 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2002 {
2003 data.enforceInterface(IActivityManager.descriptor);
2004 String pkg = data.readString();
2005 boolean ask = data.readInt() != 0;
2006 setPackageAskScreenCompat(pkg, ask);
2007 reply.writeNoException();
2008 return true;
2009 }
2010
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002011 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2012 data.enforceInterface(IActivityManager.descriptor);
2013 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002014 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002015 boolean res = isIntentSenderTargetedToPackage(r);
2016 reply.writeNoException();
2017 reply.writeInt(res ? 1 : 0);
2018 return true;
2019 }
2020
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002021 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2022 data.enforceInterface(IActivityManager.descriptor);
2023 IIntentSender r = IIntentSender.Stub.asInterface(
2024 data.readStrongBinder());
2025 boolean res = isIntentSenderAnActivity(r);
2026 reply.writeNoException();
2027 reply.writeInt(res ? 1 : 0);
2028 return true;
2029 }
2030
Dianne Hackborn81038902012-11-26 17:04:09 -08002031 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2032 data.enforceInterface(IActivityManager.descriptor);
2033 IIntentSender r = IIntentSender.Stub.asInterface(
2034 data.readStrongBinder());
2035 Intent intent = getIntentForIntentSender(r);
2036 reply.writeNoException();
2037 if (intent != null) {
2038 reply.writeInt(1);
2039 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2040 } else {
2041 reply.writeInt(0);
2042 }
2043 return true;
2044 }
2045
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002046 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 IIntentSender r = IIntentSender.Stub.asInterface(
2049 data.readStrongBinder());
2050 String prefix = data.readString();
2051 String tag = getTagForIntentSender(r, prefix);
2052 reply.writeNoException();
2053 reply.writeString(tag);
2054 return true;
2055 }
2056
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002057 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2058 data.enforceInterface(IActivityManager.descriptor);
2059 Configuration config = Configuration.CREATOR.createFromParcel(data);
2060 updatePersistentConfiguration(config);
2061 reply.writeNoException();
2062 return true;
2063 }
2064
Dianne Hackbornb437e092011-08-05 17:50:29 -07002065 case GET_PROCESS_PSS_TRANSACTION: {
2066 data.enforceInterface(IActivityManager.descriptor);
2067 int[] pids = data.createIntArray();
2068 long[] pss = getProcessPss(pids);
2069 reply.writeNoException();
2070 reply.writeLongArray(pss);
2071 return true;
2072 }
2073
Dianne Hackborn661cd522011-08-22 00:26:20 -07002074 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2075 data.enforceInterface(IActivityManager.descriptor);
2076 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2077 boolean always = data.readInt() != 0;
2078 showBootMessage(msg, always);
2079 reply.writeNoException();
2080 return true;
2081 }
2082
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002083 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002084 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002085 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002086 reply.writeNoException();
2087 return true;
2088 }
2089
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002090 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2093 reply.writeNoException();
2094 return true;
2095 }
2096
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002097 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002098 data.enforceInterface(IActivityManager.descriptor);
2099 IBinder token = data.readStrongBinder();
2100 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002101 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002102 reply.writeNoException();
2103 reply.writeInt(res ? 1 : 0);
2104 return true;
2105 }
2106
2107 case NAVIGATE_UP_TO_TRANSACTION: {
2108 data.enforceInterface(IActivityManager.descriptor);
2109 IBinder token = data.readStrongBinder();
2110 Intent target = Intent.CREATOR.createFromParcel(data);
2111 int resultCode = data.readInt();
2112 Intent resultData = null;
2113 if (data.readInt() != 0) {
2114 resultData = Intent.CREATOR.createFromParcel(data);
2115 }
2116 boolean res = navigateUpTo(token, target, resultCode, resultData);
2117 reply.writeNoException();
2118 reply.writeInt(res ? 1 : 0);
2119 return true;
2120 }
2121
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002122 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2123 data.enforceInterface(IActivityManager.descriptor);
2124 IBinder token = data.readStrongBinder();
2125 int res = getLaunchedFromUid(token);
2126 reply.writeNoException();
2127 reply.writeInt(res);
2128 return true;
2129 }
2130
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002131 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 IBinder token = data.readStrongBinder();
2134 String res = getLaunchedFromPackage(token);
2135 reply.writeNoException();
2136 reply.writeString(res);
2137 return true;
2138 }
2139
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002140 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2141 data.enforceInterface(IActivityManager.descriptor);
2142 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2143 data.readStrongBinder());
2144 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002145 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002146 return true;
2147 }
2148
2149 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2150 data.enforceInterface(IActivityManager.descriptor);
2151 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2152 data.readStrongBinder());
2153 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002154 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002155 return true;
2156 }
2157
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002158 case REQUEST_BUG_REPORT_TRANSACTION: {
2159 data.enforceInterface(IActivityManager.descriptor);
2160 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002161 reply.writeNoException();
2162 return true;
2163 }
2164
2165 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 int pid = data.readInt();
2168 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002169 String reason = data.readString();
2170 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002171 reply.writeNoException();
2172 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002173 return true;
2174 }
2175
Adam Skorydfc7fd72013-08-05 19:23:41 -07002176 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002177 data.enforceInterface(IActivityManager.descriptor);
2178 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002179 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002180 reply.writeNoException();
2181 reply.writeBundle(res);
2182 return true;
2183 }
2184
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002185 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2186 data.enforceInterface(IActivityManager.descriptor);
2187 int requestType = data.readInt();
2188 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
2189 requestAssistContextExtras(requestType, receiver);
2190 reply.writeNoException();
2191 return true;
2192 }
2193
Adam Skorydfc7fd72013-08-05 19:23:41 -07002194 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002195 data.enforceInterface(IActivityManager.descriptor);
2196 IBinder token = data.readStrongBinder();
2197 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002198 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2199 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002200 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2201 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002202 reply.writeNoException();
2203 return true;
2204 }
2205
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002206 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2207 data.enforceInterface(IActivityManager.descriptor);
2208 Intent intent = Intent.CREATOR.createFromParcel(data);
2209 int requestType = data.readInt();
2210 String hint = data.readString();
2211 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002212 Bundle args = data.readBundle();
2213 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002214 reply.writeNoException();
2215 reply.writeInt(res ? 1 : 0);
2216 return true;
2217 }
2218
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002219 case KILL_UID_TRANSACTION: {
2220 data.enforceInterface(IActivityManager.descriptor);
2221 int uid = data.readInt();
2222 String reason = data.readString();
2223 killUid(uid, reason);
2224 reply.writeNoException();
2225 return true;
2226 }
2227
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002228 case HANG_TRANSACTION: {
2229 data.enforceInterface(IActivityManager.descriptor);
2230 IBinder who = data.readStrongBinder();
2231 boolean allowRestart = data.readInt() != 0;
2232 hang(who, allowRestart);
2233 reply.writeNoException();
2234 return true;
2235 }
2236
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002237 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2238 data.enforceInterface(IActivityManager.descriptor);
2239 IBinder token = data.readStrongBinder();
2240 reportActivityFullyDrawn(token);
2241 reply.writeNoException();
2242 return true;
2243 }
2244
Craig Mautner5eda9b32013-07-02 11:58:16 -07002245 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2246 data.enforceInterface(IActivityManager.descriptor);
2247 IBinder token = data.readStrongBinder();
2248 notifyActivityDrawn(token);
2249 reply.writeNoException();
2250 return true;
2251 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002252
2253 case RESTART_TRANSACTION: {
2254 data.enforceInterface(IActivityManager.descriptor);
2255 restart();
2256 reply.writeNoException();
2257 return true;
2258 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002259
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002260 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2261 data.enforceInterface(IActivityManager.descriptor);
2262 performIdleMaintenance();
2263 reply.writeNoException();
2264 return true;
2265 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002266
Todd Kennedyca4d8422015-01-15 15:19:22 -08002267 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002268 data.enforceInterface(IActivityManager.descriptor);
2269 IBinder parentActivityToken = data.readStrongBinder();
2270 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002271 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002272 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002273 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002274 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002275 if (activityContainer != null) {
2276 reply.writeInt(1);
2277 reply.writeStrongBinder(activityContainer.asBinder());
2278 } else {
2279 reply.writeInt(0);
2280 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002281 return true;
2282 }
2283
Craig Mautner95da1082014-02-24 17:54:35 -08002284 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2285 data.enforceInterface(IActivityManager.descriptor);
2286 IActivityContainer activityContainer =
2287 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2288 deleteActivityContainer(activityContainer);
2289 reply.writeNoException();
2290 return true;
2291 }
2292
Todd Kennedy4900bf92015-01-16 16:05:14 -08002293 case CREATE_STACK_ON_DISPLAY: {
2294 data.enforceInterface(IActivityManager.descriptor);
2295 int displayId = data.readInt();
2296 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2297 reply.writeNoException();
2298 if (activityContainer != null) {
2299 reply.writeInt(1);
2300 reply.writeStrongBinder(activityContainer.asBinder());
2301 } else {
2302 reply.writeInt(0);
2303 }
2304 return true;
2305 }
2306
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002307 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002308 data.enforceInterface(IActivityManager.descriptor);
2309 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002310 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002311 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002312 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002313 return true;
2314 }
2315
Craig Mautneraea74a52014-03-08 14:23:10 -08002316 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2317 data.enforceInterface(IActivityManager.descriptor);
2318 final int taskId = data.readInt();
2319 startLockTaskMode(taskId);
2320 reply.writeNoException();
2321 return true;
2322 }
2323
2324 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2325 data.enforceInterface(IActivityManager.descriptor);
2326 IBinder token = data.readStrongBinder();
2327 startLockTaskMode(token);
2328 reply.writeNoException();
2329 return true;
2330 }
2331
Craig Mautnerd61dc202014-07-07 11:09:11 -07002332 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002333 data.enforceInterface(IActivityManager.descriptor);
2334 startLockTaskModeOnCurrent();
2335 reply.writeNoException();
2336 return true;
2337 }
2338
Craig Mautneraea74a52014-03-08 14:23:10 -08002339 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2340 data.enforceInterface(IActivityManager.descriptor);
2341 stopLockTaskMode();
2342 reply.writeNoException();
2343 return true;
2344 }
2345
Craig Mautnerd61dc202014-07-07 11:09:11 -07002346 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002347 data.enforceInterface(IActivityManager.descriptor);
2348 stopLockTaskModeOnCurrent();
2349 reply.writeNoException();
2350 return true;
2351 }
2352
Craig Mautneraea74a52014-03-08 14:23:10 -08002353 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2354 data.enforceInterface(IActivityManager.descriptor);
2355 final boolean isInLockTaskMode = isInLockTaskMode();
2356 reply.writeNoException();
2357 reply.writeInt(isInLockTaskMode ? 1 : 0);
2358 return true;
2359 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002360
Benjamin Franz43261142015-02-11 15:59:44 +00002361 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2362 data.enforceInterface(IActivityManager.descriptor);
2363 final int lockTaskModeState = getLockTaskModeState();
2364 reply.writeNoException();
2365 reply.writeInt(lockTaskModeState);
2366 return true;
2367 }
2368
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002369 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2370 data.enforceInterface(IActivityManager.descriptor);
2371 final IBinder token = data.readStrongBinder();
2372 showLockTaskEscapeMessage(token);
2373 reply.writeNoException();
2374 return true;
2375 }
2376
Winson Chunga449dc02014-05-16 11:15:04 -07002377 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002378 data.enforceInterface(IActivityManager.descriptor);
2379 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002380 ActivityManager.TaskDescription values =
2381 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2382 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002383 reply.writeNoException();
2384 return true;
2385 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002386
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002387 case SET_TASK_RESIZEABLE_TRANSACTION: {
2388 data.enforceInterface(IActivityManager.descriptor);
2389 int taskId = data.readInt();
2390 boolean resizeable = (data.readInt() == 1) ? true : false;
2391 setTaskResizeable(taskId, resizeable);
2392 reply.writeNoException();
2393 return true;
2394 }
2395
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002396 case RESIZE_TASK_TRANSACTION: {
2397 data.enforceInterface(IActivityManager.descriptor);
2398 int taskId = data.readInt();
2399 Rect r = Rect.CREATOR.createFromParcel(data);
2400 resizeTask(taskId, r);
2401 reply.writeNoException();
2402 return true;
2403 }
2404
Craig Mautner648f69b2014-09-18 14:16:26 -07002405 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2406 data.enforceInterface(IActivityManager.descriptor);
2407 String filename = data.readString();
2408 Bitmap icon = getTaskDescriptionIcon(filename);
2409 reply.writeNoException();
2410 if (icon == null) {
2411 reply.writeInt(0);
2412 } else {
2413 reply.writeInt(1);
2414 icon.writeToParcel(reply, 0);
2415 }
2416 return true;
2417 }
2418
Winson Chung044d5292014-11-06 11:05:19 -08002419 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2420 data.enforceInterface(IActivityManager.descriptor);
2421 final Bundle bundle;
2422 if (data.readInt() == 0) {
2423 bundle = null;
2424 } else {
2425 bundle = data.readBundle();
2426 }
2427 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2428 startInPlaceAnimationOnFrontMostApplication(options);
2429 reply.writeNoException();
2430 return true;
2431 }
2432
Jose Lima4b6c6692014-08-12 17:41:12 -07002433 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002434 data.enforceInterface(IActivityManager.descriptor);
2435 IBinder token = data.readStrongBinder();
2436 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002437 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002438 reply.writeNoException();
2439 reply.writeInt(success ? 1 : 0);
2440 return true;
2441 }
2442
Jose Lima4b6c6692014-08-12 17:41:12 -07002443 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002444 data.enforceInterface(IActivityManager.descriptor);
2445 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002446 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002447 reply.writeNoException();
2448 reply.writeInt(enabled ? 1 : 0);
2449 return true;
2450 }
2451
Jose Lima4b6c6692014-08-12 17:41:12 -07002452 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002453 data.enforceInterface(IActivityManager.descriptor);
2454 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002455 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002456 reply.writeNoException();
2457 return true;
2458 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002459
2460 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2461 data.enforceInterface(IActivityManager.descriptor);
2462 IBinder token = data.readStrongBinder();
2463 notifyLaunchTaskBehindComplete(token);
2464 reply.writeNoException();
2465 return true;
2466 }
Craig Mautner8746a472014-07-24 15:12:54 -07002467
2468 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2469 data.enforceInterface(IActivityManager.descriptor);
2470 IBinder token = data.readStrongBinder();
2471 notifyEnterAnimationComplete(token);
2472 reply.writeNoException();
2473 return true;
2474 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002475
2476 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2477 data.enforceInterface(IActivityManager.descriptor);
2478 bootAnimationComplete();
2479 reply.writeNoException();
2480 return true;
2481 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002482
Jeff Sharkey605eb792014-11-04 13:34:06 -08002483 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2484 data.enforceInterface(IActivityManager.descriptor);
2485 final int uid = data.readInt();
2486 final byte[] firstPacket = data.createByteArray();
2487 notifyCleartextNetwork(uid, firstPacket);
2488 reply.writeNoException();
2489 return true;
2490 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002491
2492 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2493 data.enforceInterface(IActivityManager.descriptor);
2494 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002495 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002496 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002497 String reportPackage = data.readString();
2498 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002499 reply.writeNoException();
2500 return true;
2501 }
2502
2503 case DUMP_HEAP_FINISHED_TRANSACTION: {
2504 data.enforceInterface(IActivityManager.descriptor);
2505 String path = data.readString();
2506 dumpHeapFinished(path);
2507 reply.writeNoException();
2508 return true;
2509 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002510
2511 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2512 data.enforceInterface(IActivityManager.descriptor);
2513 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2514 data.readStrongBinder());
2515 boolean keepAwake = data.readInt() != 0;
2516 setVoiceKeepAwake(session, keepAwake);
2517 reply.writeNoException();
2518 return true;
2519 }
Craig Mautnere5600772015-04-03 21:36:37 -07002520
2521 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2522 data.enforceInterface(IActivityManager.descriptor);
2523 int userId = data.readInt();
2524 String[] packages = data.readStringArray();
2525 updateLockTaskPackages(userId, packages);
2526 reply.writeNoException();
2527 return true;
2528 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002529
Craig Mautner015c5e52015-04-23 10:39:39 -07002530 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2531 data.enforceInterface(IActivityManager.descriptor);
2532 String packageName = data.readString();
2533 updateDeviceOwner(packageName);
2534 reply.writeNoException();
2535 return true;
2536 }
2537
Dianne Hackborn1e383822015-04-10 14:02:33 -07002538 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2539 data.enforceInterface(IActivityManager.descriptor);
2540 String pkg = data.readString();
2541 int res = getPackageProcessState(pkg);
2542 reply.writeNoException();
2543 reply.writeInt(res);
2544 return true;
2545 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002546
2547 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2548 data.enforceInterface(IActivityManager.descriptor);
2549 String process = data.readString();
2550 int userId = data.readInt();
2551 int level = data.readInt();
2552 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2553 reply.writeNoException();
2554 reply.writeInt(res ? 1 : 0);
2555 return true;
2556 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002557
2558 case START_BINDER_TRACKING_TRANSACTION: {
2559 data.enforceInterface(IActivityManager.descriptor);
2560 boolean res = startBinderTracking();
2561 reply.writeNoException();
2562 reply.writeInt(res ? 1 : 0);
2563 return true;
2564 }
2565
2566 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2567 data.enforceInterface(IActivityManager.descriptor);
2568 ParcelFileDescriptor fd = data.readInt() != 0
2569 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2570 boolean res = stopBinderTrackingAndDump(fd);
2571 reply.writeNoException();
2572 reply.writeInt(res ? 1 : 0);
2573 return true;
2574 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002575 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002576
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002577 return super.onTransact(code, data, reply, flags);
2578 }
2579
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002580 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002581 return this;
2582 }
2583
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002584 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2585 protected IActivityManager create() {
2586 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002587 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002588 Log.v("ActivityManager", "default service binder = " + b);
2589 }
2590 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002591 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002592 Log.v("ActivityManager", "default service = " + am);
2593 }
2594 return am;
2595 }
2596 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002597}
2598
2599class ActivityManagerProxy implements IActivityManager
2600{
2601 public ActivityManagerProxy(IBinder remote)
2602 {
2603 mRemote = remote;
2604 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002605
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002606 public IBinder asBinder()
2607 {
2608 return mRemote;
2609 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002610
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002611 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002612 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002613 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002614 Parcel data = Parcel.obtain();
2615 Parcel reply = Parcel.obtain();
2616 data.writeInterfaceToken(IActivityManager.descriptor);
2617 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002618 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002619 intent.writeToParcel(data, 0);
2620 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002621 data.writeStrongBinder(resultTo);
2622 data.writeString(resultWho);
2623 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002624 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002625 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002626 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002627 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002628 } else {
2629 data.writeInt(0);
2630 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002631 if (options != null) {
2632 data.writeInt(1);
2633 options.writeToParcel(data, 0);
2634 } else {
2635 data.writeInt(0);
2636 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002637 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2638 reply.readException();
2639 int result = reply.readInt();
2640 reply.recycle();
2641 data.recycle();
2642 return result;
2643 }
Amith Yamasani82644082012-08-03 13:09:11 -07002644
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002645 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002646 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002647 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2648 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002649 Parcel data = Parcel.obtain();
2650 Parcel reply = Parcel.obtain();
2651 data.writeInterfaceToken(IActivityManager.descriptor);
2652 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002653 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002654 intent.writeToParcel(data, 0);
2655 data.writeString(resolvedType);
2656 data.writeStrongBinder(resultTo);
2657 data.writeString(resultWho);
2658 data.writeInt(requestCode);
2659 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002660 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002661 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002662 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002663 } else {
2664 data.writeInt(0);
2665 }
2666 if (options != null) {
2667 data.writeInt(1);
2668 options.writeToParcel(data, 0);
2669 } else {
2670 data.writeInt(0);
2671 }
2672 data.writeInt(userId);
2673 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2674 reply.readException();
2675 int result = reply.readInt();
2676 reply.recycle();
2677 data.recycle();
2678 return result;
2679 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002680 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2681 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002682 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002683 Parcel data = Parcel.obtain();
2684 Parcel reply = Parcel.obtain();
2685 data.writeInterfaceToken(IActivityManager.descriptor);
2686 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2687 data.writeString(callingPackage);
2688 intent.writeToParcel(data, 0);
2689 data.writeString(resolvedType);
2690 data.writeStrongBinder(resultTo);
2691 data.writeString(resultWho);
2692 data.writeInt(requestCode);
2693 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002694 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002695 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002696 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002697 } else {
2698 data.writeInt(0);
2699 }
2700 if (options != null) {
2701 data.writeInt(1);
2702 options.writeToParcel(data, 0);
2703 } else {
2704 data.writeInt(0);
2705 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002706 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002707 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2708 reply.readException();
2709 int result = reply.readInt();
2710 reply.recycle();
2711 data.recycle();
2712 return result;
2713 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002714 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2715 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002716 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2717 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002718 Parcel data = Parcel.obtain();
2719 Parcel reply = Parcel.obtain();
2720 data.writeInterfaceToken(IActivityManager.descriptor);
2721 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002722 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002723 intent.writeToParcel(data, 0);
2724 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002725 data.writeStrongBinder(resultTo);
2726 data.writeString(resultWho);
2727 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002728 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002729 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002730 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002731 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002732 } else {
2733 data.writeInt(0);
2734 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002735 if (options != null) {
2736 data.writeInt(1);
2737 options.writeToParcel(data, 0);
2738 } else {
2739 data.writeInt(0);
2740 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002741 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002742 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2743 reply.readException();
2744 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2745 reply.recycle();
2746 data.recycle();
2747 return result;
2748 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002749 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2750 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002751 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002752 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002753 Parcel data = Parcel.obtain();
2754 Parcel reply = Parcel.obtain();
2755 data.writeInterfaceToken(IActivityManager.descriptor);
2756 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002757 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002758 intent.writeToParcel(data, 0);
2759 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002760 data.writeStrongBinder(resultTo);
2761 data.writeString(resultWho);
2762 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002763 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002764 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002765 if (options != null) {
2766 data.writeInt(1);
2767 options.writeToParcel(data, 0);
2768 } else {
2769 data.writeInt(0);
2770 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002771 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002772 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2773 reply.readException();
2774 int result = reply.readInt();
2775 reply.recycle();
2776 data.recycle();
2777 return result;
2778 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002779 public int startActivityIntentSender(IApplicationThread caller,
2780 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002781 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002782 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002783 Parcel data = Parcel.obtain();
2784 Parcel reply = Parcel.obtain();
2785 data.writeInterfaceToken(IActivityManager.descriptor);
2786 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2787 intent.writeToParcel(data, 0);
2788 if (fillInIntent != null) {
2789 data.writeInt(1);
2790 fillInIntent.writeToParcel(data, 0);
2791 } else {
2792 data.writeInt(0);
2793 }
2794 data.writeString(resolvedType);
2795 data.writeStrongBinder(resultTo);
2796 data.writeString(resultWho);
2797 data.writeInt(requestCode);
2798 data.writeInt(flagsMask);
2799 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002800 if (options != null) {
2801 data.writeInt(1);
2802 options.writeToParcel(data, 0);
2803 } else {
2804 data.writeInt(0);
2805 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002806 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002807 reply.readException();
2808 int result = reply.readInt();
2809 reply.recycle();
2810 data.recycle();
2811 return result;
2812 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002813 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2814 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002815 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2816 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002817 Parcel data = Parcel.obtain();
2818 Parcel reply = Parcel.obtain();
2819 data.writeInterfaceToken(IActivityManager.descriptor);
2820 data.writeString(callingPackage);
2821 data.writeInt(callingPid);
2822 data.writeInt(callingUid);
2823 intent.writeToParcel(data, 0);
2824 data.writeString(resolvedType);
2825 data.writeStrongBinder(session.asBinder());
2826 data.writeStrongBinder(interactor.asBinder());
2827 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002828 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002829 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002830 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002831 } else {
2832 data.writeInt(0);
2833 }
2834 if (options != null) {
2835 data.writeInt(1);
2836 options.writeToParcel(data, 0);
2837 } else {
2838 data.writeInt(0);
2839 }
2840 data.writeInt(userId);
2841 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2842 reply.readException();
2843 int result = reply.readInt();
2844 reply.recycle();
2845 data.recycle();
2846 return result;
2847 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002848 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002849 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002850 Parcel data = Parcel.obtain();
2851 Parcel reply = Parcel.obtain();
2852 data.writeInterfaceToken(IActivityManager.descriptor);
2853 data.writeStrongBinder(callingActivity);
2854 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002855 if (options != null) {
2856 data.writeInt(1);
2857 options.writeToParcel(data, 0);
2858 } else {
2859 data.writeInt(0);
2860 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002861 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2862 reply.readException();
2863 int result = reply.readInt();
2864 reply.recycle();
2865 data.recycle();
2866 return result != 0;
2867 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002868 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2869 Parcel data = Parcel.obtain();
2870 Parcel reply = Parcel.obtain();
2871 data.writeInterfaceToken(IActivityManager.descriptor);
2872 data.writeInt(taskId);
2873 if (options == null) {
2874 data.writeInt(0);
2875 } else {
2876 data.writeInt(1);
2877 options.writeToParcel(data, 0);
2878 }
2879 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2880 reply.readException();
2881 int result = reply.readInt();
2882 reply.recycle();
2883 data.recycle();
2884 return result;
2885 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002886 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002887 throws RemoteException {
2888 Parcel data = Parcel.obtain();
2889 Parcel reply = Parcel.obtain();
2890 data.writeInterfaceToken(IActivityManager.descriptor);
2891 data.writeStrongBinder(token);
2892 data.writeInt(resultCode);
2893 if (resultData != null) {
2894 data.writeInt(1);
2895 resultData.writeToParcel(data, 0);
2896 } else {
2897 data.writeInt(0);
2898 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002899 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002900 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 boolean res = reply.readInt() != 0;
2903 data.recycle();
2904 reply.recycle();
2905 return res;
2906 }
2907 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2908 {
2909 Parcel data = Parcel.obtain();
2910 Parcel reply = Parcel.obtain();
2911 data.writeInterfaceToken(IActivityManager.descriptor);
2912 data.writeStrongBinder(token);
2913 data.writeString(resultWho);
2914 data.writeInt(requestCode);
2915 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2916 reply.readException();
2917 data.recycle();
2918 reply.recycle();
2919 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002920 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2921 Parcel data = Parcel.obtain();
2922 Parcel reply = Parcel.obtain();
2923 data.writeInterfaceToken(IActivityManager.descriptor);
2924 data.writeStrongBinder(token);
2925 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2926 reply.readException();
2927 boolean res = reply.readInt() != 0;
2928 data.recycle();
2929 reply.recycle();
2930 return res;
2931 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002932 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2933 Parcel data = Parcel.obtain();
2934 Parcel reply = Parcel.obtain();
2935 data.writeInterfaceToken(IActivityManager.descriptor);
2936 data.writeStrongBinder(session.asBinder());
2937 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2938 reply.readException();
2939 data.recycle();
2940 reply.recycle();
2941 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002942 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 data.writeStrongBinder(token);
2947 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 boolean res = reply.readInt() != 0;
2950 data.recycle();
2951 reply.recycle();
2952 return res;
2953 }
2954 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2955 Parcel data = Parcel.obtain();
2956 Parcel reply = Parcel.obtain();
2957 data.writeInterfaceToken(IActivityManager.descriptor);
2958 data.writeStrongBinder(app.asBinder());
2959 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2960 reply.readException();
2961 data.recycle();
2962 reply.recycle();
2963 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002964 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2965 Parcel data = Parcel.obtain();
2966 Parcel reply = Parcel.obtain();
2967 data.writeInterfaceToken(IActivityManager.descriptor);
2968 data.writeStrongBinder(token);
2969 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2970 reply.readException();
2971 boolean res = reply.readInt() != 0;
2972 data.recycle();
2973 reply.recycle();
2974 return res;
2975 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002976 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002977 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002978 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002979 {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002984 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002985 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2986 filter.writeToParcel(data, 0);
2987 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002988 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002989 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 Intent intent = null;
2992 int haveIntent = reply.readInt();
2993 if (haveIntent != 0) {
2994 intent = Intent.CREATOR.createFromParcel(reply);
2995 }
2996 reply.recycle();
2997 data.recycle();
2998 return intent;
2999 }
3000 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3001 {
3002 Parcel data = Parcel.obtain();
3003 Parcel reply = Parcel.obtain();
3004 data.writeInterfaceToken(IActivityManager.descriptor);
3005 data.writeStrongBinder(receiver.asBinder());
3006 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 data.recycle();
3009 reply.recycle();
3010 }
3011 public int broadcastIntent(IApplicationThread caller,
3012 Intent intent, String resolvedType, IIntentReceiver resultTo,
3013 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003014 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003015 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 {
3017 Parcel data = Parcel.obtain();
3018 Parcel reply = Parcel.obtain();
3019 data.writeInterfaceToken(IActivityManager.descriptor);
3020 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3021 intent.writeToParcel(data, 0);
3022 data.writeString(resolvedType);
3023 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3024 data.writeInt(resultCode);
3025 data.writeString(resultData);
3026 data.writeBundle(map);
3027 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003028 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003029 data.writeInt(serialized ? 1 : 0);
3030 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003031 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003032 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3033 reply.readException();
3034 int res = reply.readInt();
3035 reply.recycle();
3036 data.recycle();
3037 return res;
3038 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003039 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3040 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003041 {
3042 Parcel data = Parcel.obtain();
3043 Parcel reply = Parcel.obtain();
3044 data.writeInterfaceToken(IActivityManager.descriptor);
3045 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3046 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003047 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003048 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3049 reply.readException();
3050 data.recycle();
3051 reply.recycle();
3052 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003053 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3054 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003055 {
3056 Parcel data = Parcel.obtain();
3057 Parcel reply = Parcel.obtain();
3058 data.writeInterfaceToken(IActivityManager.descriptor);
3059 data.writeStrongBinder(who);
3060 data.writeInt(resultCode);
3061 data.writeString(resultData);
3062 data.writeBundle(map);
3063 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003064 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003065 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3066 reply.readException();
3067 data.recycle();
3068 reply.recycle();
3069 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003070 public void attachApplication(IApplicationThread app) throws RemoteException
3071 {
3072 Parcel data = Parcel.obtain();
3073 Parcel reply = Parcel.obtain();
3074 data.writeInterfaceToken(IActivityManager.descriptor);
3075 data.writeStrongBinder(app.asBinder());
3076 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3077 reply.readException();
3078 data.recycle();
3079 reply.recycle();
3080 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003081 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3082 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003083 {
3084 Parcel data = Parcel.obtain();
3085 Parcel reply = Parcel.obtain();
3086 data.writeInterfaceToken(IActivityManager.descriptor);
3087 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003088 if (config != null) {
3089 data.writeInt(1);
3090 config.writeToParcel(data, 0);
3091 } else {
3092 data.writeInt(0);
3093 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003094 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003095 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3096 reply.readException();
3097 data.recycle();
3098 reply.recycle();
3099 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003100 public void activityResumed(IBinder token) throws RemoteException
3101 {
3102 Parcel data = Parcel.obtain();
3103 Parcel reply = Parcel.obtain();
3104 data.writeInterfaceToken(IActivityManager.descriptor);
3105 data.writeStrongBinder(token);
3106 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3107 reply.readException();
3108 data.recycle();
3109 reply.recycle();
3110 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003111 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003112 {
3113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeStrongBinder(token);
3117 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3118 reply.readException();
3119 data.recycle();
3120 reply.recycle();
3121 }
3122 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003123 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003124 {
3125 Parcel data = Parcel.obtain();
3126 Parcel reply = Parcel.obtain();
3127 data.writeInterfaceToken(IActivityManager.descriptor);
3128 data.writeStrongBinder(token);
3129 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003130 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003131 TextUtils.writeToParcel(description, data, 0);
3132 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3133 reply.readException();
3134 data.recycle();
3135 reply.recycle();
3136 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003137 public void activitySlept(IBinder token) throws RemoteException
3138 {
3139 Parcel data = Parcel.obtain();
3140 Parcel reply = Parcel.obtain();
3141 data.writeInterfaceToken(IActivityManager.descriptor);
3142 data.writeStrongBinder(token);
3143 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3144 reply.readException();
3145 data.recycle();
3146 reply.recycle();
3147 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003148 public void activityDestroyed(IBinder token) throws RemoteException
3149 {
3150 Parcel data = Parcel.obtain();
3151 Parcel reply = Parcel.obtain();
3152 data.writeInterfaceToken(IActivityManager.descriptor);
3153 data.writeStrongBinder(token);
3154 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3155 reply.readException();
3156 data.recycle();
3157 reply.recycle();
3158 }
3159 public String getCallingPackage(IBinder token) throws RemoteException
3160 {
3161 Parcel data = Parcel.obtain();
3162 Parcel reply = Parcel.obtain();
3163 data.writeInterfaceToken(IActivityManager.descriptor);
3164 data.writeStrongBinder(token);
3165 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3166 reply.readException();
3167 String res = reply.readString();
3168 data.recycle();
3169 reply.recycle();
3170 return res;
3171 }
3172 public ComponentName getCallingActivity(IBinder token)
3173 throws RemoteException {
3174 Parcel data = Parcel.obtain();
3175 Parcel reply = Parcel.obtain();
3176 data.writeInterfaceToken(IActivityManager.descriptor);
3177 data.writeStrongBinder(token);
3178 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3179 reply.readException();
3180 ComponentName res = ComponentName.readFromParcel(reply);
3181 data.recycle();
3182 reply.recycle();
3183 return res;
3184 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003185 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003189 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003190 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 ArrayList<IAppTask> list = null;
3193 int N = reply.readInt();
3194 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003195 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003196 while (N > 0) {
3197 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3198 list.add(task);
3199 N--;
3200 }
3201 }
3202 data.recycle();
3203 reply.recycle();
3204 return list;
3205 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003206 public int addAppTask(IBinder activityToken, Intent intent,
3207 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 data.writeStrongBinder(activityToken);
3212 intent.writeToParcel(data, 0);
3213 description.writeToParcel(data, 0);
3214 thumbnail.writeToParcel(data, 0);
3215 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3216 reply.readException();
3217 int res = reply.readInt();
3218 data.recycle();
3219 reply.recycle();
3220 return res;
3221 }
3222 public Point getAppTaskThumbnailSize() throws RemoteException {
3223 Parcel data = Parcel.obtain();
3224 Parcel reply = Parcel.obtain();
3225 data.writeInterfaceToken(IActivityManager.descriptor);
3226 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3227 reply.readException();
3228 Point size = Point.CREATOR.createFromParcel(reply);
3229 data.recycle();
3230 reply.recycle();
3231 return size;
3232 }
Todd Kennedye635f662015-01-20 10:36:49 -08003233 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3234 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003235 Parcel data = Parcel.obtain();
3236 Parcel reply = Parcel.obtain();
3237 data.writeInterfaceToken(IActivityManager.descriptor);
3238 data.writeInt(maxNum);
3239 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3241 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003242 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 int N = reply.readInt();
3244 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003245 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003246 while (N > 0) {
3247 ActivityManager.RunningTaskInfo info =
3248 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003249 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003250 list.add(info);
3251 N--;
3252 }
3253 }
3254 data.recycle();
3255 reply.recycle();
3256 return list;
3257 }
3258 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003259 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003260 Parcel data = Parcel.obtain();
3261 Parcel reply = Parcel.obtain();
3262 data.writeInterfaceToken(IActivityManager.descriptor);
3263 data.writeInt(maxNum);
3264 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003265 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003266 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3267 reply.readException();
3268 ArrayList<ActivityManager.RecentTaskInfo> list
3269 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3270 data.recycle();
3271 reply.recycle();
3272 return list;
3273 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003274 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003275 Parcel data = Parcel.obtain();
3276 Parcel reply = Parcel.obtain();
3277 data.writeInterfaceToken(IActivityManager.descriptor);
3278 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003279 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003280 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003281 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003282 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003283 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003284 }
3285 data.recycle();
3286 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003287 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003288 }
Todd Kennedye635f662015-01-20 10:36:49 -08003289 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3290 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeInt(maxNum);
3295 data.writeInt(flags);
3296 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3297 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003298 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003299 int N = reply.readInt();
3300 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003301 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003302 while (N > 0) {
3303 ActivityManager.RunningServiceInfo info =
3304 ActivityManager.RunningServiceInfo.CREATOR
3305 .createFromParcel(reply);
3306 list.add(info);
3307 N--;
3308 }
3309 }
3310 data.recycle();
3311 reply.recycle();
3312 return list;
3313 }
3314 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3315 throws RemoteException {
3316 Parcel data = Parcel.obtain();
3317 Parcel reply = Parcel.obtain();
3318 data.writeInterfaceToken(IActivityManager.descriptor);
3319 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3320 reply.readException();
3321 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3322 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3323 data.recycle();
3324 reply.recycle();
3325 return list;
3326 }
3327 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3328 throws RemoteException {
3329 Parcel data = Parcel.obtain();
3330 Parcel reply = Parcel.obtain();
3331 data.writeInterfaceToken(IActivityManager.descriptor);
3332 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3333 reply.readException();
3334 ArrayList<ActivityManager.RunningAppProcessInfo> list
3335 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3336 data.recycle();
3337 reply.recycle();
3338 return list;
3339 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003340 public List<ApplicationInfo> getRunningExternalApplications()
3341 throws RemoteException {
3342 Parcel data = Parcel.obtain();
3343 Parcel reply = Parcel.obtain();
3344 data.writeInterfaceToken(IActivityManager.descriptor);
3345 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 ArrayList<ApplicationInfo> list
3348 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3349 data.recycle();
3350 reply.recycle();
3351 return list;
3352 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003353 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003354 {
3355 Parcel data = Parcel.obtain();
3356 Parcel reply = Parcel.obtain();
3357 data.writeInterfaceToken(IActivityManager.descriptor);
3358 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003359 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003360 if (options != null) {
3361 data.writeInt(1);
3362 options.writeToParcel(data, 0);
3363 } else {
3364 data.writeInt(0);
3365 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003366 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3367 reply.readException();
3368 data.recycle();
3369 reply.recycle();
3370 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003371 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3372 throws RemoteException {
3373 Parcel data = Parcel.obtain();
3374 Parcel reply = Parcel.obtain();
3375 data.writeInterfaceToken(IActivityManager.descriptor);
3376 data.writeStrongBinder(token);
3377 data.writeInt(nonRoot ? 1 : 0);
3378 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3379 reply.readException();
3380 boolean res = reply.readInt() != 0;
3381 data.recycle();
3382 reply.recycle();
3383 return res;
3384 }
3385 public void moveTaskBackwards(int task) throws RemoteException
3386 {
3387 Parcel data = Parcel.obtain();
3388 Parcel reply = Parcel.obtain();
3389 data.writeInterfaceToken(IActivityManager.descriptor);
3390 data.writeInt(task);
3391 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3392 reply.readException();
3393 data.recycle();
3394 reply.recycle();
3395 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003396 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003397 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3398 {
3399 Parcel data = Parcel.obtain();
3400 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003401 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003402 data.writeInt(taskId);
3403 data.writeInt(stackId);
3404 data.writeInt(toTop ? 1 : 0);
3405 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3406 reply.readException();
3407 data.recycle();
3408 reply.recycle();
3409 }
3410 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003411 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003412 {
3413 Parcel data = Parcel.obtain();
3414 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003415 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003416 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003417 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003418 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003419 reply.readException();
3420 data.recycle();
3421 reply.recycle();
3422 }
Craig Mautner967212c2013-04-13 21:10:58 -07003423 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003424 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003425 {
3426 Parcel data = Parcel.obtain();
3427 Parcel reply = Parcel.obtain();
3428 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003429 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003430 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003431 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003432 data.recycle();
3433 reply.recycle();
3434 return list;
3435 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003436 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003437 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003438 {
3439 Parcel data = Parcel.obtain();
3440 Parcel reply = Parcel.obtain();
3441 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003442 data.writeInt(stackId);
3443 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003444 reply.readException();
3445 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003446 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003447 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003448 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003449 }
3450 data.recycle();
3451 reply.recycle();
3452 return info;
3453 }
3454 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003455 public boolean isInHomeStack(int taskId) throws RemoteException {
3456 Parcel data = Parcel.obtain();
3457 Parcel reply = Parcel.obtain();
3458 data.writeInterfaceToken(IActivityManager.descriptor);
3459 data.writeInt(taskId);
3460 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3461 reply.readException();
3462 boolean isInHomeStack = reply.readInt() > 0;
3463 data.recycle();
3464 reply.recycle();
3465 return isInHomeStack;
3466 }
3467 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003468 public void setFocusedStack(int stackId) throws RemoteException
3469 {
3470 Parcel data = Parcel.obtain();
3471 Parcel reply = Parcel.obtain();
3472 data.writeInterfaceToken(IActivityManager.descriptor);
3473 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003474 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003475 reply.readException();
3476 data.recycle();
3477 reply.recycle();
3478 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003479 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003480 public int getFocusedStackId() throws RemoteException {
3481 Parcel data = Parcel.obtain();
3482 Parcel reply = Parcel.obtain();
3483 data.writeInterfaceToken(IActivityManager.descriptor);
3484 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3485 reply.readException();
3486 int focusedStackId = reply.readInt();
3487 data.recycle();
3488 reply.recycle();
3489 return focusedStackId;
3490 }
3491 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003492 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3493 {
3494 Parcel data = Parcel.obtain();
3495 Parcel reply = Parcel.obtain();
3496 data.writeInterfaceToken(IActivityManager.descriptor);
3497 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003498 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003499 reply.readException();
3500 data.recycle();
3501 reply.recycle();
3502 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003503 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3504 {
3505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 data.writeStrongBinder(token);
3509 data.writeInt(onlyRoot ? 1 : 0);
3510 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3511 reply.readException();
3512 int res = reply.readInt();
3513 data.recycle();
3514 reply.recycle();
3515 return res;
3516 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003517 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003518 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003519 Parcel data = Parcel.obtain();
3520 Parcel reply = Parcel.obtain();
3521 data.writeInterfaceToken(IActivityManager.descriptor);
3522 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3523 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003524 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003525 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003526 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3527 reply.readException();
3528 int res = reply.readInt();
3529 ContentProviderHolder cph = null;
3530 if (res != 0) {
3531 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3532 }
3533 data.recycle();
3534 reply.recycle();
3535 return cph;
3536 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003537 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3538 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003539 Parcel data = Parcel.obtain();
3540 Parcel reply = Parcel.obtain();
3541 data.writeInterfaceToken(IActivityManager.descriptor);
3542 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003543 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003544 data.writeStrongBinder(token);
3545 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3546 reply.readException();
3547 int res = reply.readInt();
3548 ContentProviderHolder cph = null;
3549 if (res != 0) {
3550 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3551 }
3552 data.recycle();
3553 reply.recycle();
3554 return cph;
3555 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003556 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003557 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003558 {
3559 Parcel data = Parcel.obtain();
3560 Parcel reply = Parcel.obtain();
3561 data.writeInterfaceToken(IActivityManager.descriptor);
3562 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3563 data.writeTypedList(providers);
3564 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3565 reply.readException();
3566 data.recycle();
3567 reply.recycle();
3568 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003569 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3570 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003571 Parcel data = Parcel.obtain();
3572 Parcel reply = Parcel.obtain();
3573 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003574 data.writeStrongBinder(connection);
3575 data.writeInt(stable);
3576 data.writeInt(unstable);
3577 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3578 reply.readException();
3579 boolean res = reply.readInt() != 0;
3580 data.recycle();
3581 reply.recycle();
3582 return res;
3583 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003584
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003585 public void unstableProviderDied(IBinder connection) throws RemoteException {
3586 Parcel data = Parcel.obtain();
3587 Parcel reply = Parcel.obtain();
3588 data.writeInterfaceToken(IActivityManager.descriptor);
3589 data.writeStrongBinder(connection);
3590 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3591 reply.readException();
3592 data.recycle();
3593 reply.recycle();
3594 }
3595
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003596 @Override
3597 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3598 Parcel data = Parcel.obtain();
3599 Parcel reply = Parcel.obtain();
3600 data.writeInterfaceToken(IActivityManager.descriptor);
3601 data.writeStrongBinder(connection);
3602 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3603 reply.readException();
3604 data.recycle();
3605 reply.recycle();
3606 }
3607
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003608 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3609 Parcel data = Parcel.obtain();
3610 Parcel reply = Parcel.obtain();
3611 data.writeInterfaceToken(IActivityManager.descriptor);
3612 data.writeStrongBinder(connection);
3613 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003614 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3615 reply.readException();
3616 data.recycle();
3617 reply.recycle();
3618 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003619
3620 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3621 Parcel data = Parcel.obtain();
3622 Parcel reply = Parcel.obtain();
3623 data.writeInterfaceToken(IActivityManager.descriptor);
3624 data.writeString(name);
3625 data.writeStrongBinder(token);
3626 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3627 reply.readException();
3628 data.recycle();
3629 reply.recycle();
3630 }
3631
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003632 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3633 throws RemoteException
3634 {
3635 Parcel data = Parcel.obtain();
3636 Parcel reply = Parcel.obtain();
3637 data.writeInterfaceToken(IActivityManager.descriptor);
3638 service.writeToParcel(data, 0);
3639 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3640 reply.readException();
3641 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3642 data.recycle();
3643 reply.recycle();
3644 return res;
3645 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003646
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003647 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003648 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003649 {
3650 Parcel data = Parcel.obtain();
3651 Parcel reply = Parcel.obtain();
3652 data.writeInterfaceToken(IActivityManager.descriptor);
3653 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3654 service.writeToParcel(data, 0);
3655 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003656 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003657 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 ComponentName res = ComponentName.readFromParcel(reply);
3660 data.recycle();
3661 reply.recycle();
3662 return res;
3663 }
3664 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003665 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003666 {
3667 Parcel data = Parcel.obtain();
3668 Parcel reply = Parcel.obtain();
3669 data.writeInterfaceToken(IActivityManager.descriptor);
3670 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3671 service.writeToParcel(data, 0);
3672 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003673 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003674 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3675 reply.readException();
3676 int res = reply.readInt();
3677 reply.recycle();
3678 data.recycle();
3679 return res;
3680 }
3681 public boolean stopServiceToken(ComponentName className, IBinder token,
3682 int startId) throws RemoteException {
3683 Parcel data = Parcel.obtain();
3684 Parcel reply = Parcel.obtain();
3685 data.writeInterfaceToken(IActivityManager.descriptor);
3686 ComponentName.writeToParcel(className, data);
3687 data.writeStrongBinder(token);
3688 data.writeInt(startId);
3689 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3690 reply.readException();
3691 boolean res = reply.readInt() != 0;
3692 data.recycle();
3693 reply.recycle();
3694 return res;
3695 }
3696 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003697 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003698 Parcel data = Parcel.obtain();
3699 Parcel reply = Parcel.obtain();
3700 data.writeInterfaceToken(IActivityManager.descriptor);
3701 ComponentName.writeToParcel(className, data);
3702 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003703 data.writeInt(id);
3704 if (notification != null) {
3705 data.writeInt(1);
3706 notification.writeToParcel(data, 0);
3707 } else {
3708 data.writeInt(0);
3709 }
3710 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003711 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3712 reply.readException();
3713 data.recycle();
3714 reply.recycle();
3715 }
3716 public int bindService(IApplicationThread caller, IBinder token,
3717 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003718 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003719 Parcel data = Parcel.obtain();
3720 Parcel reply = Parcel.obtain();
3721 data.writeInterfaceToken(IActivityManager.descriptor);
3722 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3723 data.writeStrongBinder(token);
3724 service.writeToParcel(data, 0);
3725 data.writeString(resolvedType);
3726 data.writeStrongBinder(connection.asBinder());
3727 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003728 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003729 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3730 reply.readException();
3731 int res = reply.readInt();
3732 data.recycle();
3733 reply.recycle();
3734 return res;
3735 }
3736 public boolean unbindService(IServiceConnection connection) throws RemoteException
3737 {
3738 Parcel data = Parcel.obtain();
3739 Parcel reply = Parcel.obtain();
3740 data.writeInterfaceToken(IActivityManager.descriptor);
3741 data.writeStrongBinder(connection.asBinder());
3742 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3743 reply.readException();
3744 boolean res = reply.readInt() != 0;
3745 data.recycle();
3746 reply.recycle();
3747 return res;
3748 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003749
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003750 public void publishService(IBinder token,
3751 Intent intent, IBinder service) throws RemoteException {
3752 Parcel data = Parcel.obtain();
3753 Parcel reply = Parcel.obtain();
3754 data.writeInterfaceToken(IActivityManager.descriptor);
3755 data.writeStrongBinder(token);
3756 intent.writeToParcel(data, 0);
3757 data.writeStrongBinder(service);
3758 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3759 reply.readException();
3760 data.recycle();
3761 reply.recycle();
3762 }
3763
3764 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3765 throws RemoteException {
3766 Parcel data = Parcel.obtain();
3767 Parcel reply = Parcel.obtain();
3768 data.writeInterfaceToken(IActivityManager.descriptor);
3769 data.writeStrongBinder(token);
3770 intent.writeToParcel(data, 0);
3771 data.writeInt(doRebind ? 1 : 0);
3772 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3773 reply.readException();
3774 data.recycle();
3775 reply.recycle();
3776 }
3777
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003778 public void serviceDoneExecuting(IBinder token, int type, int startId,
3779 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003780 Parcel data = Parcel.obtain();
3781 Parcel reply = Parcel.obtain();
3782 data.writeInterfaceToken(IActivityManager.descriptor);
3783 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003784 data.writeInt(type);
3785 data.writeInt(startId);
3786 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003787 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3788 reply.readException();
3789 data.recycle();
3790 reply.recycle();
3791 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003792
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3794 Parcel data = Parcel.obtain();
3795 Parcel reply = Parcel.obtain();
3796 data.writeInterfaceToken(IActivityManager.descriptor);
3797 service.writeToParcel(data, 0);
3798 data.writeString(resolvedType);
3799 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 IBinder binder = reply.readStrongBinder();
3802 reply.recycle();
3803 data.recycle();
3804 return binder;
3805 }
3806
Christopher Tate181fafa2009-05-14 11:12:14 -07003807 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3808 throws RemoteException {
3809 Parcel data = Parcel.obtain();
3810 Parcel reply = Parcel.obtain();
3811 data.writeInterfaceToken(IActivityManager.descriptor);
3812 app.writeToParcel(data, 0);
3813 data.writeInt(backupRestoreMode);
3814 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3815 reply.readException();
3816 boolean success = reply.readInt() != 0;
3817 reply.recycle();
3818 data.recycle();
3819 return success;
3820 }
3821
Christopher Tate346acb12012-10-15 19:20:25 -07003822 public void clearPendingBackup() throws RemoteException {
3823 Parcel data = Parcel.obtain();
3824 Parcel reply = Parcel.obtain();
3825 data.writeInterfaceToken(IActivityManager.descriptor);
3826 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3827 reply.recycle();
3828 data.recycle();
3829 }
3830
Christopher Tate181fafa2009-05-14 11:12:14 -07003831 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3832 Parcel data = Parcel.obtain();
3833 Parcel reply = Parcel.obtain();
3834 data.writeInterfaceToken(IActivityManager.descriptor);
3835 data.writeString(packageName);
3836 data.writeStrongBinder(agent);
3837 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3838 reply.recycle();
3839 data.recycle();
3840 }
3841
3842 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3843 Parcel data = Parcel.obtain();
3844 Parcel reply = Parcel.obtain();
3845 data.writeInterfaceToken(IActivityManager.descriptor);
3846 app.writeToParcel(data, 0);
3847 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3848 reply.readException();
3849 reply.recycle();
3850 data.recycle();
3851 }
3852
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003854 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003855 IUiAutomationConnection connection, int userId, String instructionSet)
3856 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003857 Parcel data = Parcel.obtain();
3858 Parcel reply = Parcel.obtain();
3859 data.writeInterfaceToken(IActivityManager.descriptor);
3860 ComponentName.writeToParcel(className, data);
3861 data.writeString(profileFile);
3862 data.writeInt(flags);
3863 data.writeBundle(arguments);
3864 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003865 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003866 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003867 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003868 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3869 reply.readException();
3870 boolean res = reply.readInt() != 0;
3871 reply.recycle();
3872 data.recycle();
3873 return res;
3874 }
3875
3876 public void finishInstrumentation(IApplicationThread target,
3877 int resultCode, Bundle results) throws RemoteException {
3878 Parcel data = Parcel.obtain();
3879 Parcel reply = Parcel.obtain();
3880 data.writeInterfaceToken(IActivityManager.descriptor);
3881 data.writeStrongBinder(target != null ? target.asBinder() : null);
3882 data.writeInt(resultCode);
3883 data.writeBundle(results);
3884 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3885 reply.readException();
3886 data.recycle();
3887 reply.recycle();
3888 }
3889 public Configuration getConfiguration() throws RemoteException
3890 {
3891 Parcel data = Parcel.obtain();
3892 Parcel reply = Parcel.obtain();
3893 data.writeInterfaceToken(IActivityManager.descriptor);
3894 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3895 reply.readException();
3896 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3897 reply.recycle();
3898 data.recycle();
3899 return res;
3900 }
3901 public void updateConfiguration(Configuration values) throws RemoteException
3902 {
3903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
3906 values.writeToParcel(data, 0);
3907 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3908 reply.readException();
3909 data.recycle();
3910 reply.recycle();
3911 }
3912 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3913 throws RemoteException {
3914 Parcel data = Parcel.obtain();
3915 Parcel reply = Parcel.obtain();
3916 data.writeInterfaceToken(IActivityManager.descriptor);
3917 data.writeStrongBinder(token);
3918 data.writeInt(requestedOrientation);
3919 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3920 reply.readException();
3921 data.recycle();
3922 reply.recycle();
3923 }
3924 public int getRequestedOrientation(IBinder token) throws RemoteException {
3925 Parcel data = Parcel.obtain();
3926 Parcel reply = Parcel.obtain();
3927 data.writeInterfaceToken(IActivityManager.descriptor);
3928 data.writeStrongBinder(token);
3929 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3930 reply.readException();
3931 int res = reply.readInt();
3932 data.recycle();
3933 reply.recycle();
3934 return res;
3935 }
3936 public ComponentName getActivityClassForToken(IBinder token)
3937 throws RemoteException {
3938 Parcel data = Parcel.obtain();
3939 Parcel reply = Parcel.obtain();
3940 data.writeInterfaceToken(IActivityManager.descriptor);
3941 data.writeStrongBinder(token);
3942 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3943 reply.readException();
3944 ComponentName res = ComponentName.readFromParcel(reply);
3945 data.recycle();
3946 reply.recycle();
3947 return res;
3948 }
3949 public String getPackageForToken(IBinder token) throws RemoteException
3950 {
3951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 data.writeStrongBinder(token);
3955 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3956 reply.readException();
3957 String res = reply.readString();
3958 data.recycle();
3959 reply.recycle();
3960 return res;
3961 }
3962 public IIntentSender getIntentSender(int type,
3963 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003964 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003965 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003966 Parcel data = Parcel.obtain();
3967 Parcel reply = Parcel.obtain();
3968 data.writeInterfaceToken(IActivityManager.descriptor);
3969 data.writeInt(type);
3970 data.writeString(packageName);
3971 data.writeStrongBinder(token);
3972 data.writeString(resultWho);
3973 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003974 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003975 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003976 data.writeTypedArray(intents, 0);
3977 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003978 } else {
3979 data.writeInt(0);
3980 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003981 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003982 if (options != null) {
3983 data.writeInt(1);
3984 options.writeToParcel(data, 0);
3985 } else {
3986 data.writeInt(0);
3987 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003988 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003989 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3990 reply.readException();
3991 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003992 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003993 data.recycle();
3994 reply.recycle();
3995 return res;
3996 }
3997 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3998 Parcel data = Parcel.obtain();
3999 Parcel reply = Parcel.obtain();
4000 data.writeInterfaceToken(IActivityManager.descriptor);
4001 data.writeStrongBinder(sender.asBinder());
4002 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4003 reply.readException();
4004 data.recycle();
4005 reply.recycle();
4006 }
4007 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4008 Parcel data = Parcel.obtain();
4009 Parcel reply = Parcel.obtain();
4010 data.writeInterfaceToken(IActivityManager.descriptor);
4011 data.writeStrongBinder(sender.asBinder());
4012 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4013 reply.readException();
4014 String res = reply.readString();
4015 data.recycle();
4016 reply.recycle();
4017 return res;
4018 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004019 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4020 Parcel data = Parcel.obtain();
4021 Parcel reply = Parcel.obtain();
4022 data.writeInterfaceToken(IActivityManager.descriptor);
4023 data.writeStrongBinder(sender.asBinder());
4024 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4025 reply.readException();
4026 int res = reply.readInt();
4027 data.recycle();
4028 reply.recycle();
4029 return res;
4030 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004031 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4032 boolean requireFull, String name, String callerPackage) throws RemoteException {
4033 Parcel data = Parcel.obtain();
4034 Parcel reply = Parcel.obtain();
4035 data.writeInterfaceToken(IActivityManager.descriptor);
4036 data.writeInt(callingPid);
4037 data.writeInt(callingUid);
4038 data.writeInt(userId);
4039 data.writeInt(allowAll ? 1 : 0);
4040 data.writeInt(requireFull ? 1 : 0);
4041 data.writeString(name);
4042 data.writeString(callerPackage);
4043 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4044 reply.readException();
4045 int res = reply.readInt();
4046 data.recycle();
4047 reply.recycle();
4048 return res;
4049 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004050 public void setProcessLimit(int max) throws RemoteException
4051 {
4052 Parcel data = Parcel.obtain();
4053 Parcel reply = Parcel.obtain();
4054 data.writeInterfaceToken(IActivityManager.descriptor);
4055 data.writeInt(max);
4056 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4057 reply.readException();
4058 data.recycle();
4059 reply.recycle();
4060 }
4061 public int getProcessLimit() throws RemoteException
4062 {
4063 Parcel data = Parcel.obtain();
4064 Parcel reply = Parcel.obtain();
4065 data.writeInterfaceToken(IActivityManager.descriptor);
4066 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4067 reply.readException();
4068 int res = reply.readInt();
4069 data.recycle();
4070 reply.recycle();
4071 return res;
4072 }
4073 public void setProcessForeground(IBinder token, int pid,
4074 boolean isForeground) throws RemoteException {
4075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 data.writeStrongBinder(token);
4079 data.writeInt(pid);
4080 data.writeInt(isForeground ? 1 : 0);
4081 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4082 reply.readException();
4083 data.recycle();
4084 reply.recycle();
4085 }
4086 public int checkPermission(String permission, int pid, int uid)
4087 throws RemoteException {
4088 Parcel data = Parcel.obtain();
4089 Parcel reply = Parcel.obtain();
4090 data.writeInterfaceToken(IActivityManager.descriptor);
4091 data.writeString(permission);
4092 data.writeInt(pid);
4093 data.writeInt(uid);
4094 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 int res = reply.readInt();
4097 data.recycle();
4098 reply.recycle();
4099 return res;
4100 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004101 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4102 throws RemoteException {
4103 Parcel data = Parcel.obtain();
4104 Parcel reply = Parcel.obtain();
4105 data.writeInterfaceToken(IActivityManager.descriptor);
4106 data.writeString(permission);
4107 data.writeInt(pid);
4108 data.writeInt(uid);
4109 data.writeStrongBinder(callerToken);
4110 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 int res = reply.readInt();
4113 data.recycle();
4114 reply.recycle();
4115 return res;
4116 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004118 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004119 Parcel data = Parcel.obtain();
4120 Parcel reply = Parcel.obtain();
4121 data.writeInterfaceToken(IActivityManager.descriptor);
4122 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004123 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004124 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004125 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4126 reply.readException();
4127 boolean res = reply.readInt() != 0;
4128 data.recycle();
4129 reply.recycle();
4130 return res;
4131 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004132 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4133 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004134 Parcel data = Parcel.obtain();
4135 Parcel reply = Parcel.obtain();
4136 data.writeInterfaceToken(IActivityManager.descriptor);
4137 uri.writeToParcel(data, 0);
4138 data.writeInt(pid);
4139 data.writeInt(uid);
4140 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004141 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004142 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004143 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 int res = reply.readInt();
4146 data.recycle();
4147 reply.recycle();
4148 return res;
4149 }
4150 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004151 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004152 Parcel data = Parcel.obtain();
4153 Parcel reply = Parcel.obtain();
4154 data.writeInterfaceToken(IActivityManager.descriptor);
4155 data.writeStrongBinder(caller.asBinder());
4156 data.writeString(targetPkg);
4157 uri.writeToParcel(data, 0);
4158 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004159 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004160 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4161 reply.readException();
4162 data.recycle();
4163 reply.recycle();
4164 }
4165 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004166 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004167 Parcel data = Parcel.obtain();
4168 Parcel reply = Parcel.obtain();
4169 data.writeInterfaceToken(IActivityManager.descriptor);
4170 data.writeStrongBinder(caller.asBinder());
4171 uri.writeToParcel(data, 0);
4172 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004173 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004174 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4175 reply.readException();
4176 data.recycle();
4177 reply.recycle();
4178 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004179
4180 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004181 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4182 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004183 Parcel data = Parcel.obtain();
4184 Parcel reply = Parcel.obtain();
4185 data.writeInterfaceToken(IActivityManager.descriptor);
4186 uri.writeToParcel(data, 0);
4187 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004188 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004189 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4190 reply.readException();
4191 data.recycle();
4192 reply.recycle();
4193 }
4194
4195 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004196 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4197 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004198 Parcel data = Parcel.obtain();
4199 Parcel reply = Parcel.obtain();
4200 data.writeInterfaceToken(IActivityManager.descriptor);
4201 uri.writeToParcel(data, 0);
4202 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004203 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004204 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4205 reply.readException();
4206 data.recycle();
4207 reply.recycle();
4208 }
4209
4210 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004211 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4212 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004213 Parcel data = Parcel.obtain();
4214 Parcel reply = Parcel.obtain();
4215 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004216 data.writeString(packageName);
4217 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004218 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4219 reply.readException();
4220 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4221 reply);
4222 data.recycle();
4223 reply.recycle();
4224 return perms;
4225 }
4226
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004227 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4228 throws RemoteException {
4229 Parcel data = Parcel.obtain();
4230 Parcel reply = Parcel.obtain();
4231 data.writeInterfaceToken(IActivityManager.descriptor);
4232 data.writeStrongBinder(who.asBinder());
4233 data.writeInt(waiting ? 1 : 0);
4234 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4235 reply.readException();
4236 data.recycle();
4237 reply.recycle();
4238 }
4239 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4240 Parcel data = Parcel.obtain();
4241 Parcel reply = Parcel.obtain();
4242 data.writeInterfaceToken(IActivityManager.descriptor);
4243 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4244 reply.readException();
4245 outInfo.readFromParcel(reply);
4246 data.recycle();
4247 reply.recycle();
4248 }
4249 public void unhandledBack() throws RemoteException
4250 {
4251 Parcel data = Parcel.obtain();
4252 Parcel reply = Parcel.obtain();
4253 data.writeInterfaceToken(IActivityManager.descriptor);
4254 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4255 reply.readException();
4256 data.recycle();
4257 reply.recycle();
4258 }
4259 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4260 {
4261 Parcel data = Parcel.obtain();
4262 Parcel reply = Parcel.obtain();
4263 data.writeInterfaceToken(IActivityManager.descriptor);
4264 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4265 reply.readException();
4266 ParcelFileDescriptor pfd = null;
4267 if (reply.readInt() != 0) {
4268 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4269 }
4270 data.recycle();
4271 reply.recycle();
4272 return pfd;
4273 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004274 public void setLockScreenShown(boolean shown) throws RemoteException
4275 {
4276 Parcel data = Parcel.obtain();
4277 Parcel reply = Parcel.obtain();
4278 data.writeInterfaceToken(IActivityManager.descriptor);
4279 data.writeInt(shown ? 1 : 0);
4280 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4281 reply.readException();
4282 data.recycle();
4283 reply.recycle();
4284 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004285 public void setDebugApp(
4286 String packageName, boolean waitForDebugger, boolean persistent)
4287 throws RemoteException
4288 {
4289 Parcel data = Parcel.obtain();
4290 Parcel reply = Parcel.obtain();
4291 data.writeInterfaceToken(IActivityManager.descriptor);
4292 data.writeString(packageName);
4293 data.writeInt(waitForDebugger ? 1 : 0);
4294 data.writeInt(persistent ? 1 : 0);
4295 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4296 reply.readException();
4297 data.recycle();
4298 reply.recycle();
4299 }
4300 public void setAlwaysFinish(boolean enabled) throws RemoteException
4301 {
4302 Parcel data = Parcel.obtain();
4303 Parcel reply = Parcel.obtain();
4304 data.writeInterfaceToken(IActivityManager.descriptor);
4305 data.writeInt(enabled ? 1 : 0);
4306 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4307 reply.readException();
4308 data.recycle();
4309 reply.recycle();
4310 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004311 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004312 {
4313 Parcel data = Parcel.obtain();
4314 Parcel reply = Parcel.obtain();
4315 data.writeInterfaceToken(IActivityManager.descriptor);
4316 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004317 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004318 reply.readException();
4319 data.recycle();
4320 reply.recycle();
4321 }
4322 public void enterSafeMode() throws RemoteException {
4323 Parcel data = Parcel.obtain();
4324 data.writeInterfaceToken(IActivityManager.descriptor);
4325 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4326 data.recycle();
4327 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004328 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004329 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004330 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004331 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004332 data.writeStrongBinder(sender.asBinder());
4333 data.writeInt(sourceUid);
4334 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004335 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004336 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4337 data.recycle();
4338 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004339 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4340 throws RemoteException {
4341 Parcel data = Parcel.obtain();
4342 data.writeInterfaceToken(IActivityManager.descriptor);
4343 data.writeStrongBinder(sender.asBinder());
4344 data.writeInt(sourceUid);
4345 data.writeString(tag);
4346 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4347 data.recycle();
4348 }
4349 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4350 throws RemoteException {
4351 Parcel data = Parcel.obtain();
4352 data.writeInterfaceToken(IActivityManager.descriptor);
4353 data.writeStrongBinder(sender.asBinder());
4354 data.writeInt(sourceUid);
4355 data.writeString(tag);
4356 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4357 data.recycle();
4358 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004359 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004364 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004365 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004366 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004367 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004368 boolean res = reply.readInt() != 0;
4369 data.recycle();
4370 reply.recycle();
4371 return res;
4372 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004373 @Override
4374 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4375 Parcel data = Parcel.obtain();
4376 Parcel reply = Parcel.obtain();
4377 data.writeInterfaceToken(IActivityManager.descriptor);
4378 data.writeString(reason);
4379 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4380 boolean res = reply.readInt() != 0;
4381 data.recycle();
4382 reply.recycle();
4383 return res;
4384 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004385 public boolean testIsSystemReady()
4386 {
4387 /* this base class version is never called */
4388 return true;
4389 }
Dan Egnor60d87622009-12-16 16:32:58 -08004390 public void handleApplicationCrash(IBinder app,
4391 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4392 {
4393 Parcel data = Parcel.obtain();
4394 Parcel reply = Parcel.obtain();
4395 data.writeInterfaceToken(IActivityManager.descriptor);
4396 data.writeStrongBinder(app);
4397 crashInfo.writeToParcel(data, 0);
4398 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4399 reply.readException();
4400 reply.recycle();
4401 data.recycle();
4402 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004403
Dianne Hackborn52322712014-08-26 22:47:26 -07004404 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004405 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004406 {
4407 Parcel data = Parcel.obtain();
4408 Parcel reply = Parcel.obtain();
4409 data.writeInterfaceToken(IActivityManager.descriptor);
4410 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004411 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004412 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004413 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004414 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004415 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004416 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004417 reply.recycle();
4418 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004419 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004420 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004421
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004422 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004423 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004424 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004425 {
4426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004430 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004431 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004432 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4433 reply.readException();
4434 reply.recycle();
4435 data.recycle();
4436 }
4437
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004438 public void signalPersistentProcesses(int sig) throws RemoteException {
4439 Parcel data = Parcel.obtain();
4440 Parcel reply = Parcel.obtain();
4441 data.writeInterfaceToken(IActivityManager.descriptor);
4442 data.writeInt(sig);
4443 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4444 reply.readException();
4445 data.recycle();
4446 reply.recycle();
4447 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004448
Dianne Hackborn1676c852012-09-10 14:52:30 -07004449 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004454 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004455 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4456 reply.readException();
4457 data.recycle();
4458 reply.recycle();
4459 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004460
4461 public void killAllBackgroundProcesses() throws RemoteException {
4462 Parcel data = Parcel.obtain();
4463 Parcel reply = Parcel.obtain();
4464 data.writeInterfaceToken(IActivityManager.descriptor);
4465 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4466 reply.readException();
4467 data.recycle();
4468 reply.recycle();
4469 }
4470
Dianne Hackborn1676c852012-09-10 14:52:30 -07004471 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004472 Parcel data = Parcel.obtain();
4473 Parcel reply = Parcel.obtain();
4474 data.writeInterfaceToken(IActivityManager.descriptor);
4475 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004476 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004477 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004478 reply.readException();
4479 data.recycle();
4480 reply.recycle();
4481 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004482
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004483 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4484 throws RemoteException
4485 {
4486 Parcel data = Parcel.obtain();
4487 Parcel reply = Parcel.obtain();
4488 data.writeInterfaceToken(IActivityManager.descriptor);
4489 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4490 reply.readException();
4491 outInfo.readFromParcel(reply);
4492 reply.recycle();
4493 data.recycle();
4494 }
4495
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004496 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4497 {
4498 Parcel data = Parcel.obtain();
4499 Parcel reply = Parcel.obtain();
4500 data.writeInterfaceToken(IActivityManager.descriptor);
4501 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4502 reply.readException();
4503 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4504 reply.recycle();
4505 data.recycle();
4506 return res;
4507 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004508
Dianne Hackborn1676c852012-09-10 14:52:30 -07004509 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004510 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004511 {
4512 Parcel data = Parcel.obtain();
4513 Parcel reply = Parcel.obtain();
4514 data.writeInterfaceToken(IActivityManager.descriptor);
4515 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004516 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004517 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004518 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004519 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004520 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004521 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004522 } else {
4523 data.writeInt(0);
4524 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004525 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4526 reply.readException();
4527 boolean res = reply.readInt() != 0;
4528 reply.recycle();
4529 data.recycle();
4530 return res;
4531 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004532
Dianne Hackborn55280a92009-05-07 15:53:46 -07004533 public boolean shutdown(int timeout) throws RemoteException
4534 {
4535 Parcel data = Parcel.obtain();
4536 Parcel reply = Parcel.obtain();
4537 data.writeInterfaceToken(IActivityManager.descriptor);
4538 data.writeInt(timeout);
4539 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4540 reply.readException();
4541 boolean res = reply.readInt() != 0;
4542 reply.recycle();
4543 data.recycle();
4544 return res;
4545 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004546
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004547 public void stopAppSwitches() throws RemoteException {
4548 Parcel data = Parcel.obtain();
4549 Parcel reply = Parcel.obtain();
4550 data.writeInterfaceToken(IActivityManager.descriptor);
4551 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4552 reply.readException();
4553 reply.recycle();
4554 data.recycle();
4555 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004556
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004557 public void resumeAppSwitches() throws RemoteException {
4558 Parcel data = Parcel.obtain();
4559 Parcel reply = Parcel.obtain();
4560 data.writeInterfaceToken(IActivityManager.descriptor);
4561 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4562 reply.readException();
4563 reply.recycle();
4564 data.recycle();
4565 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004566
4567 public void addPackageDependency(String packageName) throws RemoteException {
4568 Parcel data = Parcel.obtain();
4569 Parcel reply = Parcel.obtain();
4570 data.writeInterfaceToken(IActivityManager.descriptor);
4571 data.writeString(packageName);
4572 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4573 reply.readException();
4574 data.recycle();
4575 reply.recycle();
4576 }
4577
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004578 public void killApplicationWithAppId(String pkg, int appid, String reason)
4579 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004580 Parcel data = Parcel.obtain();
4581 Parcel reply = Parcel.obtain();
4582 data.writeInterfaceToken(IActivityManager.descriptor);
4583 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004584 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004585 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004586 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004587 reply.readException();
4588 data.recycle();
4589 reply.recycle();
4590 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004591
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004592 public void closeSystemDialogs(String reason) throws RemoteException {
4593 Parcel data = Parcel.obtain();
4594 Parcel reply = Parcel.obtain();
4595 data.writeInterfaceToken(IActivityManager.descriptor);
4596 data.writeString(reason);
4597 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4598 reply.readException();
4599 data.recycle();
4600 reply.recycle();
4601 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004602
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004603 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004604 throws RemoteException {
4605 Parcel data = Parcel.obtain();
4606 Parcel reply = Parcel.obtain();
4607 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004608 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004609 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4610 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004611 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004612 data.recycle();
4613 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004614 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004615 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004616
4617 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4618 Parcel data = Parcel.obtain();
4619 Parcel reply = Parcel.obtain();
4620 data.writeInterfaceToken(IActivityManager.descriptor);
4621 data.writeString(processName);
4622 data.writeInt(uid);
4623 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4624 reply.readException();
4625 data.recycle();
4626 reply.recycle();
4627 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004628
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004629 public void overridePendingTransition(IBinder token, String packageName,
4630 int enterAnim, int exitAnim) throws RemoteException {
4631 Parcel data = Parcel.obtain();
4632 Parcel reply = Parcel.obtain();
4633 data.writeInterfaceToken(IActivityManager.descriptor);
4634 data.writeStrongBinder(token);
4635 data.writeString(packageName);
4636 data.writeInt(enterAnim);
4637 data.writeInt(exitAnim);
4638 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4639 reply.readException();
4640 data.recycle();
4641 reply.recycle();
4642 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004643
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004644 public boolean isUserAMonkey() throws RemoteException {
4645 Parcel data = Parcel.obtain();
4646 Parcel reply = Parcel.obtain();
4647 data.writeInterfaceToken(IActivityManager.descriptor);
4648 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4649 reply.readException();
4650 boolean res = reply.readInt() != 0;
4651 data.recycle();
4652 reply.recycle();
4653 return res;
4654 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004655
4656 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4657 Parcel data = Parcel.obtain();
4658 Parcel reply = Parcel.obtain();
4659 data.writeInterfaceToken(IActivityManager.descriptor);
4660 data.writeInt(monkey ? 1 : 0);
4661 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4662 reply.readException();
4663 data.recycle();
4664 reply.recycle();
4665 }
4666
Dianne Hackborn860755f2010-06-03 18:47:52 -07004667 public void finishHeavyWeightApp() throws RemoteException {
4668 Parcel data = Parcel.obtain();
4669 Parcel reply = Parcel.obtain();
4670 data.writeInterfaceToken(IActivityManager.descriptor);
4671 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4672 reply.readException();
4673 data.recycle();
4674 reply.recycle();
4675 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004676
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004677 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004678 throws RemoteException {
4679 Parcel data = Parcel.obtain();
4680 Parcel reply = Parcel.obtain();
4681 data.writeInterfaceToken(IActivityManager.descriptor);
4682 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004683 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4684 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004685 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004686 data.recycle();
4687 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004688 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004689 }
4690
Craig Mautner233ceee2014-05-09 17:05:11 -07004691 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004692 throws RemoteException {
4693 Parcel data = Parcel.obtain();
4694 Parcel reply = Parcel.obtain();
4695 data.writeInterfaceToken(IActivityManager.descriptor);
4696 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004697 if (options == null) {
4698 data.writeInt(0);
4699 } else {
4700 data.writeInt(1);
4701 data.writeBundle(options.toBundle());
4702 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004703 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004704 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004705 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004706 data.recycle();
4707 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004708 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004709 }
4710
Craig Mautner233ceee2014-05-09 17:05:11 -07004711 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4712 Parcel data = Parcel.obtain();
4713 Parcel reply = Parcel.obtain();
4714 data.writeInterfaceToken(IActivityManager.descriptor);
4715 data.writeStrongBinder(token);
4716 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4717 reply.readException();
4718 Bundle bundle = reply.readBundle();
4719 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4720 data.recycle();
4721 reply.recycle();
4722 return options;
4723 }
4724
Daniel Sandler69a48172010-06-23 16:29:36 -04004725 public void setImmersive(IBinder token, boolean immersive)
4726 throws RemoteException {
4727 Parcel data = Parcel.obtain();
4728 Parcel reply = Parcel.obtain();
4729 data.writeInterfaceToken(IActivityManager.descriptor);
4730 data.writeStrongBinder(token);
4731 data.writeInt(immersive ? 1 : 0);
4732 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4733 reply.readException();
4734 data.recycle();
4735 reply.recycle();
4736 }
4737
4738 public boolean isImmersive(IBinder token)
4739 throws RemoteException {
4740 Parcel data = Parcel.obtain();
4741 Parcel reply = Parcel.obtain();
4742 data.writeInterfaceToken(IActivityManager.descriptor);
4743 data.writeStrongBinder(token);
4744 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004745 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004746 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004747 data.recycle();
4748 reply.recycle();
4749 return res;
4750 }
4751
Craig Mautnerd61dc202014-07-07 11:09:11 -07004752 public boolean isTopOfTask(IBinder token) throws RemoteException {
4753 Parcel data = Parcel.obtain();
4754 Parcel reply = Parcel.obtain();
4755 data.writeInterfaceToken(IActivityManager.descriptor);
4756 data.writeStrongBinder(token);
4757 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4758 reply.readException();
4759 boolean res = reply.readInt() == 1;
4760 data.recycle();
4761 reply.recycle();
4762 return res;
4763 }
4764
Daniel Sandler69a48172010-06-23 16:29:36 -04004765 public boolean isTopActivityImmersive()
4766 throws RemoteException {
4767 Parcel data = Parcel.obtain();
4768 Parcel reply = Parcel.obtain();
4769 data.writeInterfaceToken(IActivityManager.descriptor);
4770 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004771 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004772 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004773 data.recycle();
4774 reply.recycle();
4775 return res;
4776 }
4777
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004778 public void crashApplication(int uid, int initialPid, String packageName,
4779 String message) throws RemoteException {
4780 Parcel data = Parcel.obtain();
4781 Parcel reply = Parcel.obtain();
4782 data.writeInterfaceToken(IActivityManager.descriptor);
4783 data.writeInt(uid);
4784 data.writeInt(initialPid);
4785 data.writeString(packageName);
4786 data.writeString(message);
4787 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4788 reply.readException();
4789 data.recycle();
4790 reply.recycle();
4791 }
Andy McFadden824c5102010-07-09 16:26:57 -07004792
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004793 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004794 Parcel data = Parcel.obtain();
4795 Parcel reply = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004798 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004799 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4800 reply.readException();
4801 String res = reply.readString();
4802 data.recycle();
4803 reply.recycle();
4804 return res;
4805 }
4806
Dianne Hackborn7e269642010-08-25 19:50:20 -07004807 public IBinder newUriPermissionOwner(String name)
4808 throws RemoteException {
4809 Parcel data = Parcel.obtain();
4810 Parcel reply = Parcel.obtain();
4811 data.writeInterfaceToken(IActivityManager.descriptor);
4812 data.writeString(name);
4813 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4814 reply.readException();
4815 IBinder res = reply.readStrongBinder();
4816 data.recycle();
4817 reply.recycle();
4818 return res;
4819 }
4820
4821 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004822 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004823 Parcel data = Parcel.obtain();
4824 Parcel reply = Parcel.obtain();
4825 data.writeInterfaceToken(IActivityManager.descriptor);
4826 data.writeStrongBinder(owner);
4827 data.writeInt(fromUid);
4828 data.writeString(targetPkg);
4829 uri.writeToParcel(data, 0);
4830 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004831 data.writeInt(sourceUserId);
4832 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004833 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4834 reply.readException();
4835 data.recycle();
4836 reply.recycle();
4837 }
4838
4839 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004840 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004841 Parcel data = Parcel.obtain();
4842 Parcel reply = Parcel.obtain();
4843 data.writeInterfaceToken(IActivityManager.descriptor);
4844 data.writeStrongBinder(owner);
4845 if (uri != null) {
4846 data.writeInt(1);
4847 uri.writeToParcel(data, 0);
4848 } else {
4849 data.writeInt(0);
4850 }
4851 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004852 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004853 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4854 reply.readException();
4855 data.recycle();
4856 reply.recycle();
4857 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004858
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004859 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004860 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004861 Parcel data = Parcel.obtain();
4862 Parcel reply = Parcel.obtain();
4863 data.writeInterfaceToken(IActivityManager.descriptor);
4864 data.writeInt(callingUid);
4865 data.writeString(targetPkg);
4866 uri.writeToParcel(data, 0);
4867 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004868 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004869 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4870 reply.readException();
4871 int res = reply.readInt();
4872 data.recycle();
4873 reply.recycle();
4874 return res;
4875 }
4876
Dianne Hackborn1676c852012-09-10 14:52:30 -07004877 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004878 String path, ParcelFileDescriptor fd) throws RemoteException {
4879 Parcel data = Parcel.obtain();
4880 Parcel reply = Parcel.obtain();
4881 data.writeInterfaceToken(IActivityManager.descriptor);
4882 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004883 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004884 data.writeInt(managed ? 1 : 0);
4885 data.writeString(path);
4886 if (fd != null) {
4887 data.writeInt(1);
4888 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4889 } else {
4890 data.writeInt(0);
4891 }
4892 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4893 reply.readException();
4894 boolean res = reply.readInt() != 0;
4895 reply.recycle();
4896 data.recycle();
4897 return res;
4898 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004899
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004900 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004901 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004902 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004903 Parcel data = Parcel.obtain();
4904 Parcel reply = Parcel.obtain();
4905 data.writeInterfaceToken(IActivityManager.descriptor);
4906 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004907 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004908 data.writeTypedArray(intents, 0);
4909 data.writeStringArray(resolvedTypes);
4910 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004911 if (options != null) {
4912 data.writeInt(1);
4913 options.writeToParcel(data, 0);
4914 } else {
4915 data.writeInt(0);
4916 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004917 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004918 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4919 reply.readException();
4920 int result = reply.readInt();
4921 reply.recycle();
4922 data.recycle();
4923 return result;
4924 }
4925
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004926 public int getFrontActivityScreenCompatMode() throws RemoteException {
4927 Parcel data = Parcel.obtain();
4928 Parcel reply = Parcel.obtain();
4929 data.writeInterfaceToken(IActivityManager.descriptor);
4930 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4931 reply.readException();
4932 int mode = reply.readInt();
4933 reply.recycle();
4934 data.recycle();
4935 return mode;
4936 }
4937
4938 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4939 Parcel data = Parcel.obtain();
4940 Parcel reply = Parcel.obtain();
4941 data.writeInterfaceToken(IActivityManager.descriptor);
4942 data.writeInt(mode);
4943 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4944 reply.readException();
4945 reply.recycle();
4946 data.recycle();
4947 }
4948
4949 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4950 Parcel data = Parcel.obtain();
4951 Parcel reply = Parcel.obtain();
4952 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004953 data.writeString(packageName);
4954 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004955 reply.readException();
4956 int mode = reply.readInt();
4957 reply.recycle();
4958 data.recycle();
4959 return mode;
4960 }
4961
4962 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004963 throws RemoteException {
4964 Parcel data = Parcel.obtain();
4965 Parcel reply = Parcel.obtain();
4966 data.writeInterfaceToken(IActivityManager.descriptor);
4967 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004968 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004969 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4970 reply.readException();
4971 reply.recycle();
4972 data.recycle();
4973 }
4974
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004975 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4976 Parcel data = Parcel.obtain();
4977 Parcel reply = Parcel.obtain();
4978 data.writeInterfaceToken(IActivityManager.descriptor);
4979 data.writeString(packageName);
4980 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4981 reply.readException();
4982 boolean ask = reply.readInt() != 0;
4983 reply.recycle();
4984 data.recycle();
4985 return ask;
4986 }
4987
4988 public void setPackageAskScreenCompat(String packageName, boolean ask)
4989 throws RemoteException {
4990 Parcel data = Parcel.obtain();
4991 Parcel reply = Parcel.obtain();
4992 data.writeInterfaceToken(IActivityManager.descriptor);
4993 data.writeString(packageName);
4994 data.writeInt(ask ? 1 : 0);
4995 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4996 reply.readException();
4997 reply.recycle();
4998 data.recycle();
4999 }
5000
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005001 public boolean switchUser(int userid) throws RemoteException {
5002 Parcel data = Parcel.obtain();
5003 Parcel reply = Parcel.obtain();
5004 data.writeInterfaceToken(IActivityManager.descriptor);
5005 data.writeInt(userid);
5006 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5007 reply.readException();
5008 boolean result = reply.readInt() != 0;
5009 reply.recycle();
5010 data.recycle();
5011 return result;
5012 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005013
Kenny Guy08488bf2014-02-21 17:40:37 +00005014 public boolean startUserInBackground(int userid) throws RemoteException {
5015 Parcel data = Parcel.obtain();
5016 Parcel reply = Parcel.obtain();
5017 data.writeInterfaceToken(IActivityManager.descriptor);
5018 data.writeInt(userid);
5019 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5020 reply.readException();
5021 boolean result = reply.readInt() != 0;
5022 reply.recycle();
5023 data.recycle();
5024 return result;
5025 }
5026
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005027 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5028 Parcel data = Parcel.obtain();
5029 Parcel reply = Parcel.obtain();
5030 data.writeInterfaceToken(IActivityManager.descriptor);
5031 data.writeInt(userid);
5032 data.writeStrongInterface(callback);
5033 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5034 reply.readException();
5035 int result = reply.readInt();
5036 reply.recycle();
5037 data.recycle();
5038 return result;
5039 }
5040
Amith Yamasani52f1d752012-03-28 18:19:29 -07005041 public UserInfo getCurrentUser() throws RemoteException {
5042 Parcel data = Parcel.obtain();
5043 Parcel reply = Parcel.obtain();
5044 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005045 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005046 reply.readException();
5047 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5048 reply.recycle();
5049 data.recycle();
5050 return userInfo;
5051 }
5052
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005053 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005054 Parcel data = Parcel.obtain();
5055 Parcel reply = Parcel.obtain();
5056 data.writeInterfaceToken(IActivityManager.descriptor);
5057 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005058 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005059 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5060 reply.readException();
5061 boolean result = reply.readInt() != 0;
5062 reply.recycle();
5063 data.recycle();
5064 return result;
5065 }
5066
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005067 public int[] getRunningUserIds() throws RemoteException {
5068 Parcel data = Parcel.obtain();
5069 Parcel reply = Parcel.obtain();
5070 data.writeInterfaceToken(IActivityManager.descriptor);
5071 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5072 reply.readException();
5073 int[] result = reply.createIntArray();
5074 reply.recycle();
5075 data.recycle();
5076 return result;
5077 }
5078
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005079 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005080 Parcel data = Parcel.obtain();
5081 Parcel reply = Parcel.obtain();
5082 data.writeInterfaceToken(IActivityManager.descriptor);
5083 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005084 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5085 reply.readException();
5086 boolean result = reply.readInt() != 0;
5087 reply.recycle();
5088 data.recycle();
5089 return result;
5090 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005091
Jeff Sharkeya4620792011-05-20 15:29:23 -07005092 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5093 Parcel data = Parcel.obtain();
5094 Parcel reply = Parcel.obtain();
5095 data.writeInterfaceToken(IActivityManager.descriptor);
5096 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5097 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5098 reply.readException();
5099 data.recycle();
5100 reply.recycle();
5101 }
5102
5103 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5104 Parcel data = Parcel.obtain();
5105 Parcel reply = Parcel.obtain();
5106 data.writeInterfaceToken(IActivityManager.descriptor);
5107 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5108 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5109 reply.readException();
5110 data.recycle();
5111 reply.recycle();
5112 }
5113
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005114 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5115 Parcel data = Parcel.obtain();
5116 Parcel reply = Parcel.obtain();
5117 data.writeInterfaceToken(IActivityManager.descriptor);
5118 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5119 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5120 reply.readException();
5121 data.recycle();
5122 reply.recycle();
5123 }
5124
5125 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5126 Parcel data = Parcel.obtain();
5127 Parcel reply = Parcel.obtain();
5128 data.writeInterfaceToken(IActivityManager.descriptor);
5129 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5130 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5131 reply.readException();
5132 data.recycle();
5133 reply.recycle();
5134 }
5135
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005136 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5137 Parcel data = Parcel.obtain();
5138 Parcel reply = Parcel.obtain();
5139 data.writeInterfaceToken(IActivityManager.descriptor);
5140 data.writeStrongBinder(sender.asBinder());
5141 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5142 reply.readException();
5143 boolean res = reply.readInt() != 0;
5144 data.recycle();
5145 reply.recycle();
5146 return res;
5147 }
5148
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005149 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5150 Parcel data = Parcel.obtain();
5151 Parcel reply = Parcel.obtain();
5152 data.writeInterfaceToken(IActivityManager.descriptor);
5153 data.writeStrongBinder(sender.asBinder());
5154 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5155 reply.readException();
5156 boolean res = reply.readInt() != 0;
5157 data.recycle();
5158 reply.recycle();
5159 return res;
5160 }
5161
Dianne Hackborn81038902012-11-26 17:04:09 -08005162 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5163 Parcel data = Parcel.obtain();
5164 Parcel reply = Parcel.obtain();
5165 data.writeInterfaceToken(IActivityManager.descriptor);
5166 data.writeStrongBinder(sender.asBinder());
5167 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5168 reply.readException();
5169 Intent res = reply.readInt() != 0
5170 ? Intent.CREATOR.createFromParcel(reply) : null;
5171 data.recycle();
5172 reply.recycle();
5173 return res;
5174 }
5175
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005176 public String getTagForIntentSender(IIntentSender sender, String prefix)
5177 throws RemoteException {
5178 Parcel data = Parcel.obtain();
5179 Parcel reply = Parcel.obtain();
5180 data.writeInterfaceToken(IActivityManager.descriptor);
5181 data.writeStrongBinder(sender.asBinder());
5182 data.writeString(prefix);
5183 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5184 reply.readException();
5185 String res = reply.readString();
5186 data.recycle();
5187 reply.recycle();
5188 return res;
5189 }
5190
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005191 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5192 {
5193 Parcel data = Parcel.obtain();
5194 Parcel reply = Parcel.obtain();
5195 data.writeInterfaceToken(IActivityManager.descriptor);
5196 values.writeToParcel(data, 0);
5197 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5198 reply.readException();
5199 data.recycle();
5200 reply.recycle();
5201 }
5202
Dianne Hackbornb437e092011-08-05 17:50:29 -07005203 public long[] getProcessPss(int[] pids) throws RemoteException {
5204 Parcel data = Parcel.obtain();
5205 Parcel reply = Parcel.obtain();
5206 data.writeInterfaceToken(IActivityManager.descriptor);
5207 data.writeIntArray(pids);
5208 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5209 reply.readException();
5210 long[] res = reply.createLongArray();
5211 data.recycle();
5212 reply.recycle();
5213 return res;
5214 }
5215
Dianne Hackborn661cd522011-08-22 00:26:20 -07005216 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5217 Parcel data = Parcel.obtain();
5218 Parcel reply = Parcel.obtain();
5219 data.writeInterfaceToken(IActivityManager.descriptor);
5220 TextUtils.writeToParcel(msg, data, 0);
5221 data.writeInt(always ? 1 : 0);
5222 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5223 reply.readException();
5224 data.recycle();
5225 reply.recycle();
5226 }
5227
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005228 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005229 Parcel data = Parcel.obtain();
5230 Parcel reply = Parcel.obtain();
5231 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005232 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005233 reply.readException();
5234 data.recycle();
5235 reply.recycle();
5236 }
5237
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005238 public void keyguardGoingAway(boolean disableWindowAnimations,
5239 boolean keyguardGoingToNotificationShade) throws RemoteException {
5240 Parcel data = Parcel.obtain();
5241 Parcel reply = Parcel.obtain();
5242 data.writeInterfaceToken(IActivityManager.descriptor);
5243 data.writeInt(disableWindowAnimations ? 1 : 0);
5244 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5245 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5246 reply.readException();
5247 data.recycle();
5248 reply.recycle();
5249 }
5250
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005251 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005252 throws RemoteException {
5253 Parcel data = Parcel.obtain();
5254 Parcel reply = Parcel.obtain();
5255 data.writeInterfaceToken(IActivityManager.descriptor);
5256 data.writeStrongBinder(token);
5257 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005258 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005259 reply.readException();
5260 boolean result = reply.readInt() != 0;
5261 data.recycle();
5262 reply.recycle();
5263 return result;
5264 }
5265
5266 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5267 throws RemoteException {
5268 Parcel data = Parcel.obtain();
5269 Parcel reply = Parcel.obtain();
5270 data.writeInterfaceToken(IActivityManager.descriptor);
5271 data.writeStrongBinder(token);
5272 target.writeToParcel(data, 0);
5273 data.writeInt(resultCode);
5274 if (resultData != null) {
5275 data.writeInt(1);
5276 resultData.writeToParcel(data, 0);
5277 } else {
5278 data.writeInt(0);
5279 }
5280 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5281 reply.readException();
5282 boolean result = reply.readInt() != 0;
5283 data.recycle();
5284 reply.recycle();
5285 return result;
5286 }
5287
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005288 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5289 Parcel data = Parcel.obtain();
5290 Parcel reply = Parcel.obtain();
5291 data.writeInterfaceToken(IActivityManager.descriptor);
5292 data.writeStrongBinder(activityToken);
5293 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5294 reply.readException();
5295 int result = reply.readInt();
5296 data.recycle();
5297 reply.recycle();
5298 return result;
5299 }
5300
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005301 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 data.writeStrongBinder(activityToken);
5306 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5307 reply.readException();
5308 String result = reply.readString();
5309 data.recycle();
5310 reply.recycle();
5311 return result;
5312 }
5313
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005314 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5315 Parcel data = Parcel.obtain();
5316 Parcel reply = Parcel.obtain();
5317 data.writeInterfaceToken(IActivityManager.descriptor);
5318 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5319 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5320 reply.readException();
5321 data.recycle();
5322 reply.recycle();
5323 }
5324
5325 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5326 Parcel data = Parcel.obtain();
5327 Parcel reply = Parcel.obtain();
5328 data.writeInterfaceToken(IActivityManager.descriptor);
5329 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5330 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5331 reply.readException();
5332 data.recycle();
5333 reply.recycle();
5334 }
5335
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005336 public void requestBugReport() throws RemoteException {
5337 Parcel data = Parcel.obtain();
5338 Parcel reply = Parcel.obtain();
5339 data.writeInterfaceToken(IActivityManager.descriptor);
5340 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5341 reply.readException();
5342 data.recycle();
5343 reply.recycle();
5344 }
5345
Jeff Brownbd181bb2013-09-10 16:44:24 -07005346 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5347 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005348 Parcel data = Parcel.obtain();
5349 Parcel reply = Parcel.obtain();
5350 data.writeInterfaceToken(IActivityManager.descriptor);
5351 data.writeInt(pid);
5352 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005353 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005354 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5355 reply.readException();
5356 long res = reply.readInt();
5357 data.recycle();
5358 reply.recycle();
5359 return res;
5360 }
5361
Adam Skorydfc7fd72013-08-05 19:23:41 -07005362 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005363 Parcel data = Parcel.obtain();
5364 Parcel reply = Parcel.obtain();
5365 data.writeInterfaceToken(IActivityManager.descriptor);
5366 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005367 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005368 reply.readException();
5369 Bundle res = reply.readBundle();
5370 data.recycle();
5371 reply.recycle();
5372 return res;
5373 }
5374
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005375 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5376 throws RemoteException {
5377 Parcel data = Parcel.obtain();
5378 Parcel reply = Parcel.obtain();
5379 data.writeInterfaceToken(IActivityManager.descriptor);
5380 data.writeInt(requestType);
5381 data.writeStrongBinder(receiver.asBinder());
5382 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5383 reply.readException();
5384 data.recycle();
5385 reply.recycle();
5386 }
5387
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005388 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005389 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005390 Parcel data = Parcel.obtain();
5391 Parcel reply = Parcel.obtain();
5392 data.writeInterfaceToken(IActivityManager.descriptor);
5393 data.writeStrongBinder(token);
5394 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005395 structure.writeToParcel(data, 0);
5396 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005397 if (referrer != null) {
5398 data.writeInt(1);
5399 referrer.writeToParcel(data, 0);
5400 } else {
5401 data.writeInt(0);
5402 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005403 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005404 reply.readException();
5405 data.recycle();
5406 reply.recycle();
5407 }
5408
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005409 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5410 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005411 Parcel data = Parcel.obtain();
5412 Parcel reply = Parcel.obtain();
5413 data.writeInterfaceToken(IActivityManager.descriptor);
5414 intent.writeToParcel(data, 0);
5415 data.writeInt(requestType);
5416 data.writeString(hint);
5417 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005418 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005419 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5420 reply.readException();
5421 boolean res = reply.readInt() != 0;
5422 data.recycle();
5423 reply.recycle();
5424 return res;
5425 }
5426
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005427 public void killUid(int uid, String reason) throws RemoteException {
5428 Parcel data = Parcel.obtain();
5429 Parcel reply = Parcel.obtain();
5430 data.writeInterfaceToken(IActivityManager.descriptor);
5431 data.writeInt(uid);
5432 data.writeString(reason);
5433 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5434 reply.readException();
5435 data.recycle();
5436 reply.recycle();
5437 }
5438
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005439 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5440 Parcel data = Parcel.obtain();
5441 Parcel reply = Parcel.obtain();
5442 data.writeInterfaceToken(IActivityManager.descriptor);
5443 data.writeStrongBinder(who);
5444 data.writeInt(allowRestart ? 1 : 0);
5445 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5446 reply.readException();
5447 data.recycle();
5448 reply.recycle();
5449 }
5450
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005451 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5452 Parcel data = Parcel.obtain();
5453 Parcel reply = Parcel.obtain();
5454 data.writeInterfaceToken(IActivityManager.descriptor);
5455 data.writeStrongBinder(token);
5456 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5457 reply.readException();
5458 data.recycle();
5459 reply.recycle();
5460 }
5461
Craig Mautner5eda9b32013-07-02 11:58:16 -07005462 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5463 Parcel data = Parcel.obtain();
5464 Parcel reply = Parcel.obtain();
5465 data.writeInterfaceToken(IActivityManager.descriptor);
5466 data.writeStrongBinder(token);
5467 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5468 reply.readException();
5469 data.recycle();
5470 reply.recycle();
5471 }
5472
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005473 public void restart() throws RemoteException {
5474 Parcel data = Parcel.obtain();
5475 Parcel reply = Parcel.obtain();
5476 data.writeInterfaceToken(IActivityManager.descriptor);
5477 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5478 reply.readException();
5479 data.recycle();
5480 reply.recycle();
5481 }
5482
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005483 public void performIdleMaintenance() throws RemoteException {
5484 Parcel data = Parcel.obtain();
5485 Parcel reply = Parcel.obtain();
5486 data.writeInterfaceToken(IActivityManager.descriptor);
5487 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5488 reply.readException();
5489 data.recycle();
5490 reply.recycle();
5491 }
5492
Todd Kennedyca4d8422015-01-15 15:19:22 -08005493 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005494 IActivityContainerCallback callback) throws RemoteException {
5495 Parcel data = Parcel.obtain();
5496 Parcel reply = Parcel.obtain();
5497 data.writeInterfaceToken(IActivityManager.descriptor);
5498 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005499 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005500 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005501 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005502 final int result = reply.readInt();
5503 final IActivityContainer res;
5504 if (result == 1) {
5505 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5506 } else {
5507 res = null;
5508 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005509 data.recycle();
5510 reply.recycle();
5511 return res;
5512 }
5513
Craig Mautner95da1082014-02-24 17:54:35 -08005514 public void deleteActivityContainer(IActivityContainer activityContainer)
5515 throws RemoteException {
5516 Parcel data = Parcel.obtain();
5517 Parcel reply = Parcel.obtain();
5518 data.writeInterfaceToken(IActivityManager.descriptor);
5519 data.writeStrongBinder(activityContainer.asBinder());
5520 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5521 reply.readException();
5522 data.recycle();
5523 reply.recycle();
5524 }
5525
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005526 public boolean startBinderTracking() throws RemoteException {
5527 Parcel data = Parcel.obtain();
5528 Parcel reply = Parcel.obtain();
5529 data.writeInterfaceToken(IActivityManager.descriptor);
5530 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5531 reply.readException();
5532 boolean res = reply.readInt() != 0;
5533 reply.recycle();
5534 data.recycle();
5535 return res;
5536 }
5537
5538 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5539 Parcel data = Parcel.obtain();
5540 Parcel reply = Parcel.obtain();
5541 data.writeInterfaceToken(IActivityManager.descriptor);
5542 if (fd != null) {
5543 data.writeInt(1);
5544 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5545 } else {
5546 data.writeInt(0);
5547 }
5548 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5549 reply.readException();
5550 boolean res = reply.readInt() != 0;
5551 reply.recycle();
5552 data.recycle();
5553 return res;
5554 }
5555
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005556 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005557 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5558 Parcel data = Parcel.obtain();
5559 Parcel reply = Parcel.obtain();
5560 data.writeInterfaceToken(IActivityManager.descriptor);
5561 data.writeInt(displayId);
5562 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5563 reply.readException();
5564 final int result = reply.readInt();
5565 final IActivityContainer res;
5566 if (result == 1) {
5567 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5568 } else {
5569 res = null;
5570 }
5571 data.recycle();
5572 reply.recycle();
5573 return res;
5574 }
5575
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005576 @Override
5577 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005578 throws RemoteException {
5579 Parcel data = Parcel.obtain();
5580 Parcel reply = Parcel.obtain();
5581 data.writeInterfaceToken(IActivityManager.descriptor);
5582 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005583 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005584 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005585 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005586 data.recycle();
5587 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005588 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005589 }
5590
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005591 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005592 public void startLockTaskMode(int taskId) throws RemoteException {
5593 Parcel data = Parcel.obtain();
5594 Parcel reply = Parcel.obtain();
5595 data.writeInterfaceToken(IActivityManager.descriptor);
5596 data.writeInt(taskId);
5597 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5598 reply.readException();
5599 data.recycle();
5600 reply.recycle();
5601 }
5602
5603 @Override
5604 public void startLockTaskMode(IBinder token) throws RemoteException {
5605 Parcel data = Parcel.obtain();
5606 Parcel reply = Parcel.obtain();
5607 data.writeInterfaceToken(IActivityManager.descriptor);
5608 data.writeStrongBinder(token);
5609 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5610 reply.readException();
5611 data.recycle();
5612 reply.recycle();
5613 }
5614
5615 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005616 public void startLockTaskModeOnCurrent() throws RemoteException {
5617 Parcel data = Parcel.obtain();
5618 Parcel reply = Parcel.obtain();
5619 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005620 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005621 reply.readException();
5622 data.recycle();
5623 reply.recycle();
5624 }
5625
5626 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005627 public void stopLockTaskMode() throws RemoteException {
5628 Parcel data = Parcel.obtain();
5629 Parcel reply = Parcel.obtain();
5630 data.writeInterfaceToken(IActivityManager.descriptor);
5631 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5632 reply.readException();
5633 data.recycle();
5634 reply.recycle();
5635 }
5636
5637 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005638 public void stopLockTaskModeOnCurrent() throws RemoteException {
5639 Parcel data = Parcel.obtain();
5640 Parcel reply = Parcel.obtain();
5641 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005642 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005643 reply.readException();
5644 data.recycle();
5645 reply.recycle();
5646 }
5647
5648 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005649 public boolean isInLockTaskMode() throws RemoteException {
5650 Parcel data = Parcel.obtain();
5651 Parcel reply = Parcel.obtain();
5652 data.writeInterfaceToken(IActivityManager.descriptor);
5653 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5654 reply.readException();
5655 boolean isInLockTaskMode = reply.readInt() == 1;
5656 data.recycle();
5657 reply.recycle();
5658 return isInLockTaskMode;
5659 }
5660
Craig Mautner688b5102014-03-27 16:55:03 -07005661 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005662 public int getLockTaskModeState() throws RemoteException {
5663 Parcel data = Parcel.obtain();
5664 Parcel reply = Parcel.obtain();
5665 data.writeInterfaceToken(IActivityManager.descriptor);
5666 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5667 reply.readException();
5668 int lockTaskModeState = reply.readInt();
5669 data.recycle();
5670 reply.recycle();
5671 return lockTaskModeState;
5672 }
5673
5674 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005675 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5676 Parcel data = Parcel.obtain();
5677 Parcel reply = Parcel.obtain();
5678 data.writeInterfaceToken(IActivityManager.descriptor);
5679 data.writeStrongBinder(token);
5680 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5681 IBinder.FLAG_ONEWAY);
5682 reply.readException();
5683 data.recycle();
5684 reply.recycle();
5685 }
5686
5687 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005688 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005689 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005690 Parcel data = Parcel.obtain();
5691 Parcel reply = Parcel.obtain();
5692 data.writeInterfaceToken(IActivityManager.descriptor);
5693 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005694 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005695 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005696 reply.readException();
5697 data.recycle();
5698 reply.recycle();
5699 }
5700
Craig Mautneree2e45a2014-06-27 12:10:03 -07005701 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005702 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5703 Parcel data = Parcel.obtain();
5704 Parcel reply = Parcel.obtain();
5705 data.writeInterfaceToken(IActivityManager.descriptor);
5706 data.writeInt(taskId);
5707 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005708 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005709 reply.readException();
5710 data.recycle();
5711 reply.recycle();
5712 }
5713
5714 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005715 public void resizeTask(int taskId, Rect r) throws RemoteException
5716 {
5717 Parcel data = Parcel.obtain();
5718 Parcel reply = Parcel.obtain();
5719 data.writeInterfaceToken(IActivityManager.descriptor);
5720 data.writeInt(taskId);
5721 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005722 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005723 reply.readException();
5724 data.recycle();
5725 reply.recycle();
5726 }
5727
5728 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005729 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5730 Parcel data = Parcel.obtain();
5731 Parcel reply = Parcel.obtain();
5732 data.writeInterfaceToken(IActivityManager.descriptor);
5733 data.writeString(filename);
5734 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5735 reply.readException();
5736 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5737 data.recycle();
5738 reply.recycle();
5739 return icon;
5740 }
5741
5742 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005743 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5744 throws RemoteException {
5745 Parcel data = Parcel.obtain();
5746 Parcel reply = Parcel.obtain();
5747 data.writeInterfaceToken(IActivityManager.descriptor);
5748 if (options == null) {
5749 data.writeInt(0);
5750 } else {
5751 data.writeInt(1);
5752 data.writeBundle(options.toBundle());
5753 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005754 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005755 reply.readException();
5756 data.recycle();
5757 reply.recycle();
5758 }
5759
5760 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005761 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005762 Parcel data = Parcel.obtain();
5763 Parcel reply = Parcel.obtain();
5764 data.writeInterfaceToken(IActivityManager.descriptor);
5765 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005766 data.writeInt(visible ? 1 : 0);
5767 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005768 reply.readException();
5769 boolean success = reply.readInt() > 0;
5770 data.recycle();
5771 reply.recycle();
5772 return success;
5773 }
5774
5775 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005776 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005777 Parcel data = Parcel.obtain();
5778 Parcel reply = Parcel.obtain();
5779 data.writeInterfaceToken(IActivityManager.descriptor);
5780 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005781 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005782 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005783 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005784 data.recycle();
5785 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005786 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005787 }
5788
5789 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005790 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005791 Parcel data = Parcel.obtain();
5792 Parcel reply = Parcel.obtain();
5793 data.writeInterfaceToken(IActivityManager.descriptor);
5794 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005795 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005796 reply.readException();
5797 data.recycle();
5798 reply.recycle();
5799 }
5800
5801 @Override
5802 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5803 Parcel data = Parcel.obtain();
5804 Parcel reply = Parcel.obtain();
5805 data.writeInterfaceToken(IActivityManager.descriptor);
5806 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005807 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005808 reply.readException();
5809 data.recycle();
5810 reply.recycle();
5811 }
5812
Craig Mautner8746a472014-07-24 15:12:54 -07005813 @Override
5814 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5815 Parcel data = Parcel.obtain();
5816 Parcel reply = Parcel.obtain();
5817 data.writeInterfaceToken(IActivityManager.descriptor);
5818 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005819 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005820 reply.readException();
5821 data.recycle();
5822 reply.recycle();
5823 }
5824
Craig Mautner6e2f3952014-09-09 14:26:41 -07005825 @Override
5826 public void bootAnimationComplete() throws RemoteException {
5827 Parcel data = Parcel.obtain();
5828 Parcel reply = Parcel.obtain();
5829 data.writeInterfaceToken(IActivityManager.descriptor);
5830 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5831 reply.readException();
5832 data.recycle();
5833 reply.recycle();
5834 }
5835
Wale Ogunwale18795a22014-12-03 11:38:33 -08005836 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005837 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5838 Parcel data = Parcel.obtain();
5839 Parcel reply = Parcel.obtain();
5840 data.writeInterfaceToken(IActivityManager.descriptor);
5841 data.writeInt(uid);
5842 data.writeByteArray(firstPacket);
5843 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5844 reply.readException();
5845 data.recycle();
5846 reply.recycle();
5847 }
5848
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005849 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005850 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5851 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005852 Parcel data = Parcel.obtain();
5853 Parcel reply = Parcel.obtain();
5854 data.writeInterfaceToken(IActivityManager.descriptor);
5855 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005856 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005857 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005858 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005859 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5860 reply.readException();
5861 data.recycle();
5862 reply.recycle();
5863 }
5864
5865 @Override
5866 public void dumpHeapFinished(String path) throws RemoteException {
5867 Parcel data = Parcel.obtain();
5868 Parcel reply = Parcel.obtain();
5869 data.writeInterfaceToken(IActivityManager.descriptor);
5870 data.writeString(path);
5871 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5872 reply.readException();
5873 data.recycle();
5874 reply.recycle();
5875 }
5876
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005877 @Override
5878 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5879 throws RemoteException {
5880 Parcel data = Parcel.obtain();
5881 Parcel reply = Parcel.obtain();
5882 data.writeInterfaceToken(IActivityManager.descriptor);
5883 data.writeStrongBinder(session.asBinder());
5884 data.writeInt(keepAwake ? 1 : 0);
5885 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5886 reply.readException();
5887 data.recycle();
5888 reply.recycle();
5889 }
5890
Craig Mautnere5600772015-04-03 21:36:37 -07005891 @Override
5892 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5893 Parcel data = Parcel.obtain();
5894 Parcel reply = Parcel.obtain();
5895 data.writeInterfaceToken(IActivityManager.descriptor);
5896 data.writeInt(userId);
5897 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005898 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005899 reply.readException();
5900 data.recycle();
5901 reply.recycle();
5902 }
5903
Dianne Hackborn1e383822015-04-10 14:02:33 -07005904 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07005905 public void updateDeviceOwner(String packageName) throws RemoteException {
5906 Parcel data = Parcel.obtain();
5907 Parcel reply = Parcel.obtain();
5908 data.writeInterfaceToken(IActivityManager.descriptor);
5909 data.writeString(packageName);
5910 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
5911 reply.readException();
5912 data.recycle();
5913 reply.recycle();
5914 }
5915
5916 @Override
Dianne Hackborn1e383822015-04-10 14:02:33 -07005917 public int getPackageProcessState(String packageName) throws RemoteException {
5918 Parcel data = Parcel.obtain();
5919 Parcel reply = Parcel.obtain();
5920 data.writeInterfaceToken(IActivityManager.descriptor);
5921 data.writeString(packageName);
5922 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5923 reply.readException();
5924 int res = reply.readInt();
5925 data.recycle();
5926 reply.recycle();
5927 return res;
5928 }
5929
Stefan Kuhne16045c22015-06-05 07:18:06 -07005930 @Override
5931 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
5932 throws RemoteException {
5933 Parcel data = Parcel.obtain();
5934 Parcel reply = Parcel.obtain();
5935 data.writeInterfaceToken(IActivityManager.descriptor);
5936 data.writeString(process);
5937 data.writeInt(userId);
5938 data.writeInt(level);
5939 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
5940 reply.readException();
5941 int res = reply.readInt();
5942 data.recycle();
5943 reply.recycle();
5944 return res != 0;
5945 }
5946
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005947 private IBinder mRemote;
5948}