blob: fc408a8158b6354756f8fadf6ca1b7ada7c4c169 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
110 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackborna750a632015-06-16 17:18:23 -0700111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Dianne Hackborn1e383822015-04-10 14:02:33 -0700119 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg, tag);
120 } catch (RemoteException ex) {
121 }
122 }
123
124 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
125 try {
126 getDefault().noteAlarmStart(ps.getTarget(), sourceUid, tag);
127 } catch (RemoteException ex) {
128 }
129 }
130
131 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
132 try {
133 getDefault().noteAlarmFinish(ps.getTarget(), sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 } catch (RemoteException ex) {
135 }
136 }
137
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800138 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 attachInterface(this, descriptor);
140 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700141
142 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
144 throws RemoteException {
145 switch (code) {
146 case START_ACTIVITY_TRANSACTION:
147 {
148 data.enforceInterface(IActivityManager.descriptor);
149 IBinder b = data.readStrongBinder();
150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800151 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 Intent intent = Intent.CREATOR.createFromParcel(data);
153 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800155 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700157 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700158 ProfilerInfo profilerInfo = data.readInt() != 0
159 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700160 Bundle options = data.readInt() != 0
161 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800162 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700163 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 reply.writeNoException();
165 reply.writeInt(result);
166 return true;
167 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700168
Amith Yamasani82644082012-08-03 13:09:11 -0700169 case START_ACTIVITY_AS_USER_TRANSACTION:
170 {
171 data.enforceInterface(IActivityManager.descriptor);
172 IBinder b = data.readStrongBinder();
173 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800174 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700175 Intent intent = Intent.CREATOR.createFromParcel(data);
176 String resolvedType = data.readString();
177 IBinder resultTo = data.readStrongBinder();
178 String resultWho = data.readString();
179 int requestCode = data.readInt();
180 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700181 ProfilerInfo profilerInfo = data.readInt() != 0
182 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700183 Bundle options = data.readInt() != 0
184 ? Bundle.CREATOR.createFromParcel(data) : null;
185 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800186 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700187 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700188 reply.writeNoException();
189 reply.writeInt(result);
190 return true;
191 }
192
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700193 case START_ACTIVITY_AS_CALLER_TRANSACTION:
194 {
195 data.enforceInterface(IActivityManager.descriptor);
196 IBinder b = data.readStrongBinder();
197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
198 String callingPackage = data.readString();
199 Intent intent = Intent.CREATOR.createFromParcel(data);
200 String resolvedType = data.readString();
201 IBinder resultTo = data.readStrongBinder();
202 String resultWho = data.readString();
203 int requestCode = data.readInt();
204 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700205 ProfilerInfo profilerInfo = data.readInt() != 0
206 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700207 Bundle options = data.readInt() != 0
208 ? Bundle.CREATOR.createFromParcel(data) : null;
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();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700459 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800460 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700461 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800462 boolean serialized = data.readInt() != 0;
463 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700464 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800465 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700466 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700467 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468 reply.writeNoException();
469 reply.writeInt(res);
470 return true;
471 }
472
473 case UNBROADCAST_INTENT_TRANSACTION:
474 {
475 data.enforceInterface(IActivityManager.descriptor);
476 IBinder b = data.readStrongBinder();
477 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
478 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700479 int userId = data.readInt();
480 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800481 reply.writeNoException();
482 return true;
483 }
484
485 case FINISH_RECEIVER_TRANSACTION: {
486 data.enforceInterface(IActivityManager.descriptor);
487 IBinder who = data.readStrongBinder();
488 int resultCode = data.readInt();
489 String resultData = data.readString();
490 Bundle resultExtras = data.readBundle();
491 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800492 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800494 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 }
496 reply.writeNoException();
497 return true;
498 }
499
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 case ATTACH_APPLICATION_TRANSACTION: {
501 data.enforceInterface(IActivityManager.descriptor);
502 IApplicationThread app = ApplicationThreadNative.asInterface(
503 data.readStrongBinder());
504 if (app != null) {
505 attachApplication(app);
506 }
507 reply.writeNoException();
508 return true;
509 }
510
511 case ACTIVITY_IDLE_TRANSACTION: {
512 data.enforceInterface(IActivityManager.descriptor);
513 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700514 Configuration config = null;
515 if (data.readInt() != 0) {
516 config = Configuration.CREATOR.createFromParcel(data);
517 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700518 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800519 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700520 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800521 }
522 reply.writeNoException();
523 return true;
524 }
525
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700526 case ACTIVITY_RESUMED_TRANSACTION: {
527 data.enforceInterface(IActivityManager.descriptor);
528 IBinder token = data.readStrongBinder();
529 activityResumed(token);
530 reply.writeNoException();
531 return true;
532 }
533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 case ACTIVITY_PAUSED_TRANSACTION: {
535 data.enforceInterface(IActivityManager.descriptor);
536 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700537 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 reply.writeNoException();
539 return true;
540 }
541
542 case ACTIVITY_STOPPED_TRANSACTION: {
543 data.enforceInterface(IActivityManager.descriptor);
544 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800545 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700546 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800547 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700548 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 reply.writeNoException();
550 return true;
551 }
552
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800553 case ACTIVITY_SLEPT_TRANSACTION: {
554 data.enforceInterface(IActivityManager.descriptor);
555 IBinder token = data.readStrongBinder();
556 activitySlept(token);
557 reply.writeNoException();
558 return true;
559 }
560
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800561 case ACTIVITY_DESTROYED_TRANSACTION: {
562 data.enforceInterface(IActivityManager.descriptor);
563 IBinder token = data.readStrongBinder();
564 activityDestroyed(token);
565 reply.writeNoException();
566 return true;
567 }
568
569 case GET_CALLING_PACKAGE_TRANSACTION: {
570 data.enforceInterface(IActivityManager.descriptor);
571 IBinder token = data.readStrongBinder();
572 String res = token != null ? getCallingPackage(token) : null;
573 reply.writeNoException();
574 reply.writeString(res);
575 return true;
576 }
577
578 case GET_CALLING_ACTIVITY_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 IBinder token = data.readStrongBinder();
581 ComponentName cn = getCallingActivity(token);
582 reply.writeNoException();
583 ComponentName.writeToParcel(cn, reply);
584 return true;
585 }
586
Winson Chung1147c402014-05-14 11:05:00 -0700587 case GET_APP_TASKS_TRANSACTION: {
588 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700589 String callingPackage = data.readString();
590 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700591 reply.writeNoException();
592 int N = list != null ? list.size() : -1;
593 reply.writeInt(N);
594 int i;
595 for (i=0; i<N; i++) {
596 IAppTask task = list.get(i);
597 reply.writeStrongBinder(task.asBinder());
598 }
599 return true;
600 }
601
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700602 case ADD_APP_TASK_TRANSACTION: {
603 data.enforceInterface(IActivityManager.descriptor);
604 IBinder activityToken = data.readStrongBinder();
605 Intent intent = Intent.CREATOR.createFromParcel(data);
606 ActivityManager.TaskDescription descr
607 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
608 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
609 int res = addAppTask(activityToken, intent, descr, thumbnail);
610 reply.writeNoException();
611 reply.writeInt(res);
612 return true;
613 }
614
615 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
616 data.enforceInterface(IActivityManager.descriptor);
617 Point size = getAppTaskThumbnailSize();
618 reply.writeNoException();
619 size.writeToParcel(reply, 0);
620 return true;
621 }
622
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 case GET_TASKS_TRANSACTION: {
624 data.enforceInterface(IActivityManager.descriptor);
625 int maxNum = data.readInt();
626 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700627 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628 reply.writeNoException();
629 int N = list != null ? list.size() : -1;
630 reply.writeInt(N);
631 int i;
632 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700633 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800634 info.writeToParcel(reply, 0);
635 }
636 return true;
637 }
638
639 case GET_RECENT_TASKS_TRANSACTION: {
640 data.enforceInterface(IActivityManager.descriptor);
641 int maxNum = data.readInt();
642 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700643 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800644 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700645 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 reply.writeNoException();
647 reply.writeTypedList(list);
648 return true;
649 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700650
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700651 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800652 data.enforceInterface(IActivityManager.descriptor);
653 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700654 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800655 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700658 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700659 } else {
660 reply.writeInt(0);
661 }
662 return true;
663 }
664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 case GET_SERVICES_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 int maxNum = data.readInt();
668 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700669 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 reply.writeNoException();
671 int N = list != null ? list.size() : -1;
672 reply.writeInt(N);
673 int i;
674 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700675 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800676 info.writeToParcel(reply, 0);
677 }
678 return true;
679 }
680
681 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
682 data.enforceInterface(IActivityManager.descriptor);
683 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
684 reply.writeNoException();
685 reply.writeTypedList(list);
686 return true;
687 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700688
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
690 data.enforceInterface(IActivityManager.descriptor);
691 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
692 reply.writeNoException();
693 reply.writeTypedList(list);
694 return true;
695 }
696
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700697 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
698 data.enforceInterface(IActivityManager.descriptor);
699 List<ApplicationInfo> list = getRunningExternalApplications();
700 reply.writeNoException();
701 reply.writeTypedList(list);
702 return true;
703 }
704
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 case MOVE_TASK_TO_FRONT_TRANSACTION: {
706 data.enforceInterface(IActivityManager.descriptor);
707 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800708 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700709 Bundle options = data.readInt() != 0
710 ? Bundle.CREATOR.createFromParcel(data) : null;
711 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800712 reply.writeNoException();
713 return true;
714 }
715
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
717 data.enforceInterface(IActivityManager.descriptor);
718 IBinder token = data.readStrongBinder();
719 boolean nonRoot = data.readInt() != 0;
720 boolean res = moveActivityTaskToBack(token, nonRoot);
721 reply.writeNoException();
722 reply.writeInt(res ? 1 : 0);
723 return true;
724 }
725
726 case MOVE_TASK_BACKWARDS_TRANSACTION: {
727 data.enforceInterface(IActivityManager.descriptor);
728 int task = data.readInt();
729 moveTaskBackwards(task);
730 reply.writeNoException();
731 return true;
732 }
733
Craig Mautnerc00204b2013-03-05 15:02:14 -0800734 case MOVE_TASK_TO_STACK_TRANSACTION: {
735 data.enforceInterface(IActivityManager.descriptor);
736 int taskId = data.readInt();
737 int stackId = data.readInt();
738 boolean toTop = data.readInt() != 0;
739 moveTaskToStack(taskId, stackId, toTop);
740 reply.writeNoException();
741 return true;
742 }
743
744 case RESIZE_STACK_TRANSACTION: {
745 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800746 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800747 Rect r = Rect.CREATOR.createFromParcel(data);
748 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800749 reply.writeNoException();
750 return true;
751 }
752
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800753 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700754 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800755 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700756 reply.writeNoException();
757 reply.writeTypedList(list);
758 return true;
759 }
760
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800761 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700762 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800763 int stackId = data.readInt();
764 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700765 reply.writeNoException();
766 if (info != null) {
767 reply.writeInt(1);
768 info.writeToParcel(reply, 0);
769 } else {
770 reply.writeInt(0);
771 }
772 return true;
773 }
774
Winson Chung303e1ff2014-03-07 15:06:19 -0800775 case IS_IN_HOME_STACK_TRANSACTION: {
776 data.enforceInterface(IActivityManager.descriptor);
777 int taskId = data.readInt();
778 boolean isInHomeStack = isInHomeStack(taskId);
779 reply.writeNoException();
780 reply.writeInt(isInHomeStack ? 1 : 0);
781 return true;
782 }
783
Craig Mautnercf910b02013-04-23 11:23:27 -0700784 case SET_FOCUSED_STACK_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 int stackId = data.readInt();
787 setFocusedStack(stackId);
788 reply.writeNoException();
789 return true;
790 }
791
Winson Chungd16c5652015-01-26 16:11:07 -0800792 case GET_FOCUSED_STACK_ID_TRANSACTION: {
793 data.enforceInterface(IActivityManager.descriptor);
794 int focusedStackId = getFocusedStackId();
795 reply.writeNoException();
796 reply.writeInt(focusedStackId);
797 return true;
798 }
799
Winson Chung740c3ac2014-11-12 16:14:38 -0800800 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
801 data.enforceInterface(IActivityManager.descriptor);
802 IBinder token = data.readStrongBinder();
803 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
804 reply.writeNoException();
805 return true;
806 }
807
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800808 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
809 data.enforceInterface(IActivityManager.descriptor);
810 IBinder token = data.readStrongBinder();
811 boolean onlyRoot = data.readInt() != 0;
812 int res = token != null
813 ? getTaskForActivity(token, onlyRoot) : -1;
814 reply.writeNoException();
815 reply.writeInt(res);
816 return true;
817 }
818
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 case GET_CONTENT_PROVIDER_TRANSACTION: {
820 data.enforceInterface(IActivityManager.descriptor);
821 IBinder b = data.readStrongBinder();
822 IApplicationThread app = ApplicationThreadNative.asInterface(b);
823 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700824 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700825 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700826 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 reply.writeNoException();
828 if (cph != null) {
829 reply.writeInt(1);
830 cph.writeToParcel(reply, 0);
831 } else {
832 reply.writeInt(0);
833 }
834 return true;
835 }
836
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800837 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
838 data.enforceInterface(IActivityManager.descriptor);
839 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700840 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800841 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700842 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800843 reply.writeNoException();
844 if (cph != null) {
845 reply.writeInt(1);
846 cph.writeToParcel(reply, 0);
847 } else {
848 reply.writeInt(0);
849 }
850 return true;
851 }
852
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800853 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
854 data.enforceInterface(IActivityManager.descriptor);
855 IBinder b = data.readStrongBinder();
856 IApplicationThread app = ApplicationThreadNative.asInterface(b);
857 ArrayList<ContentProviderHolder> providers =
858 data.createTypedArrayList(ContentProviderHolder.CREATOR);
859 publishContentProviders(app, providers);
860 reply.writeNoException();
861 return true;
862 }
863
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700864 case REF_CONTENT_PROVIDER_TRANSACTION: {
865 data.enforceInterface(IActivityManager.descriptor);
866 IBinder b = data.readStrongBinder();
867 int stable = data.readInt();
868 int unstable = data.readInt();
869 boolean res = refContentProvider(b, stable, unstable);
870 reply.writeNoException();
871 reply.writeInt(res ? 1 : 0);
872 return true;
873 }
874
875 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 IBinder b = data.readStrongBinder();
878 unstableProviderDied(b);
879 reply.writeNoException();
880 return true;
881 }
882
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700883 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 IBinder b = data.readStrongBinder();
886 appNotRespondingViaProvider(b);
887 reply.writeNoException();
888 return true;
889 }
890
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800891 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
892 data.enforceInterface(IActivityManager.descriptor);
893 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700894 boolean stable = data.readInt() != 0;
895 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800896 reply.writeNoException();
897 return true;
898 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800899
900 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 String name = data.readString();
903 IBinder token = data.readStrongBinder();
904 removeContentProviderExternal(name, token);
905 reply.writeNoException();
906 return true;
907 }
908
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700909 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
910 data.enforceInterface(IActivityManager.descriptor);
911 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
912 PendingIntent pi = getRunningServiceControlPanel(comp);
913 reply.writeNoException();
914 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
915 return true;
916 }
917
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800918 case START_SERVICE_TRANSACTION: {
919 data.enforceInterface(IActivityManager.descriptor);
920 IBinder b = data.readStrongBinder();
921 IApplicationThread app = ApplicationThreadNative.asInterface(b);
922 Intent service = Intent.CREATOR.createFromParcel(data);
923 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700924 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700925 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700926 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800927 reply.writeNoException();
928 ComponentName.writeToParcel(cn, reply);
929 return true;
930 }
931
932 case STOP_SERVICE_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 IBinder b = data.readStrongBinder();
935 IApplicationThread app = ApplicationThreadNative.asInterface(b);
936 Intent service = Intent.CREATOR.createFromParcel(data);
937 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700938 int userId = data.readInt();
939 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800940 reply.writeNoException();
941 reply.writeInt(res);
942 return true;
943 }
944
945 case STOP_SERVICE_TOKEN_TRANSACTION: {
946 data.enforceInterface(IActivityManager.descriptor);
947 ComponentName className = ComponentName.readFromParcel(data);
948 IBinder token = data.readStrongBinder();
949 int startId = data.readInt();
950 boolean res = stopServiceToken(className, token, startId);
951 reply.writeNoException();
952 reply.writeInt(res ? 1 : 0);
953 return true;
954 }
955
956 case SET_SERVICE_FOREGROUND_TRANSACTION: {
957 data.enforceInterface(IActivityManager.descriptor);
958 ComponentName className = ComponentName.readFromParcel(data);
959 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700960 int id = data.readInt();
961 Notification notification = null;
962 if (data.readInt() != 0) {
963 notification = Notification.CREATOR.createFromParcel(data);
964 }
965 boolean removeNotification = data.readInt() != 0;
966 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800967 reply.writeNoException();
968 return true;
969 }
970
971 case BIND_SERVICE_TRANSACTION: {
972 data.enforceInterface(IActivityManager.descriptor);
973 IBinder b = data.readStrongBinder();
974 IApplicationThread app = ApplicationThreadNative.asInterface(b);
975 IBinder token = data.readStrongBinder();
976 Intent service = Intent.CREATOR.createFromParcel(data);
977 String resolvedType = data.readString();
978 b = data.readStrongBinder();
979 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700980 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800981 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800982 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -0700983 int res = bindService(app, token, service, resolvedType, conn, fl,
984 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985 reply.writeNoException();
986 reply.writeInt(res);
987 return true;
988 }
989
990 case UNBIND_SERVICE_TRANSACTION: {
991 data.enforceInterface(IActivityManager.descriptor);
992 IBinder b = data.readStrongBinder();
993 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
994 boolean res = unbindService(conn);
995 reply.writeNoException();
996 reply.writeInt(res ? 1 : 0);
997 return true;
998 }
999
1000 case PUBLISH_SERVICE_TRANSACTION: {
1001 data.enforceInterface(IActivityManager.descriptor);
1002 IBinder token = data.readStrongBinder();
1003 Intent intent = Intent.CREATOR.createFromParcel(data);
1004 IBinder service = data.readStrongBinder();
1005 publishService(token, intent, service);
1006 reply.writeNoException();
1007 return true;
1008 }
1009
1010 case UNBIND_FINISHED_TRANSACTION: {
1011 data.enforceInterface(IActivityManager.descriptor);
1012 IBinder token = data.readStrongBinder();
1013 Intent intent = Intent.CREATOR.createFromParcel(data);
1014 boolean doRebind = data.readInt() != 0;
1015 unbindFinished(token, intent, doRebind);
1016 reply.writeNoException();
1017 return true;
1018 }
1019
1020 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001023 int type = data.readInt();
1024 int startId = data.readInt();
1025 int res = data.readInt();
1026 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001027 reply.writeNoException();
1028 return true;
1029 }
1030
1031 case START_INSTRUMENTATION_TRANSACTION: {
1032 data.enforceInterface(IActivityManager.descriptor);
1033 ComponentName className = ComponentName.readFromParcel(data);
1034 String profileFile = data.readString();
1035 int fl = data.readInt();
1036 Bundle arguments = data.readBundle();
1037 IBinder b = data.readStrongBinder();
1038 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001039 b = data.readStrongBinder();
1040 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001041 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001042 String abiOverride = data.readString();
1043 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1044 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001045 reply.writeNoException();
1046 reply.writeInt(res ? 1 : 0);
1047 return true;
1048 }
1049
1050
1051 case FINISH_INSTRUMENTATION_TRANSACTION: {
1052 data.enforceInterface(IActivityManager.descriptor);
1053 IBinder b = data.readStrongBinder();
1054 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1055 int resultCode = data.readInt();
1056 Bundle results = data.readBundle();
1057 finishInstrumentation(app, resultCode, results);
1058 reply.writeNoException();
1059 return true;
1060 }
1061
1062 case GET_CONFIGURATION_TRANSACTION: {
1063 data.enforceInterface(IActivityManager.descriptor);
1064 Configuration config = getConfiguration();
1065 reply.writeNoException();
1066 config.writeToParcel(reply, 0);
1067 return true;
1068 }
1069
1070 case UPDATE_CONFIGURATION_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 Configuration config = Configuration.CREATOR.createFromParcel(data);
1073 updateConfiguration(config);
1074 reply.writeNoException();
1075 return true;
1076 }
1077
1078 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1079 data.enforceInterface(IActivityManager.descriptor);
1080 IBinder token = data.readStrongBinder();
1081 int requestedOrientation = data.readInt();
1082 setRequestedOrientation(token, requestedOrientation);
1083 reply.writeNoException();
1084 return true;
1085 }
1086
1087 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1088 data.enforceInterface(IActivityManager.descriptor);
1089 IBinder token = data.readStrongBinder();
1090 int req = getRequestedOrientation(token);
1091 reply.writeNoException();
1092 reply.writeInt(req);
1093 return true;
1094 }
1095
1096 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1097 data.enforceInterface(IActivityManager.descriptor);
1098 IBinder token = data.readStrongBinder();
1099 ComponentName cn = getActivityClassForToken(token);
1100 reply.writeNoException();
1101 ComponentName.writeToParcel(cn, reply);
1102 return true;
1103 }
1104
1105 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1106 data.enforceInterface(IActivityManager.descriptor);
1107 IBinder token = data.readStrongBinder();
1108 reply.writeNoException();
1109 reply.writeString(getPackageForToken(token));
1110 return true;
1111 }
1112
1113 case GET_INTENT_SENDER_TRANSACTION: {
1114 data.enforceInterface(IActivityManager.descriptor);
1115 int type = data.readInt();
1116 String packageName = data.readString();
1117 IBinder token = data.readStrongBinder();
1118 String resultWho = data.readString();
1119 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001120 Intent[] requestIntents;
1121 String[] requestResolvedTypes;
1122 if (data.readInt() != 0) {
1123 requestIntents = data.createTypedArray(Intent.CREATOR);
1124 requestResolvedTypes = data.createStringArray();
1125 } else {
1126 requestIntents = null;
1127 requestResolvedTypes = null;
1128 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001129 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001130 Bundle options = data.readInt() != 0
1131 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001132 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001134 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001135 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001136 reply.writeNoException();
1137 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1138 return true;
1139 }
1140
1141 case CANCEL_INTENT_SENDER_TRANSACTION: {
1142 data.enforceInterface(IActivityManager.descriptor);
1143 IIntentSender r = IIntentSender.Stub.asInterface(
1144 data.readStrongBinder());
1145 cancelIntentSender(r);
1146 reply.writeNoException();
1147 return true;
1148 }
1149
1150 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1151 data.enforceInterface(IActivityManager.descriptor);
1152 IIntentSender r = IIntentSender.Stub.asInterface(
1153 data.readStrongBinder());
1154 String res = getPackageForIntentSender(r);
1155 reply.writeNoException();
1156 reply.writeString(res);
1157 return true;
1158 }
1159
Christopher Tatec4a07d12012-04-06 14:19:13 -07001160 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 IIntentSender r = IIntentSender.Stub.asInterface(
1163 data.readStrongBinder());
1164 int res = getUidForIntentSender(r);
1165 reply.writeNoException();
1166 reply.writeInt(res);
1167 return true;
1168 }
1169
Dianne Hackborn41203752012-08-31 14:05:51 -07001170 case HANDLE_INCOMING_USER_TRANSACTION: {
1171 data.enforceInterface(IActivityManager.descriptor);
1172 int callingPid = data.readInt();
1173 int callingUid = data.readInt();
1174 int userId = data.readInt();
1175 boolean allowAll = data.readInt() != 0 ;
1176 boolean requireFull = data.readInt() != 0;
1177 String name = data.readString();
1178 String callerPackage = data.readString();
1179 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1180 requireFull, name, callerPackage);
1181 reply.writeNoException();
1182 reply.writeInt(res);
1183 return true;
1184 }
1185
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 case SET_PROCESS_LIMIT_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 int max = data.readInt();
1189 setProcessLimit(max);
1190 reply.writeNoException();
1191 return true;
1192 }
1193
1194 case GET_PROCESS_LIMIT_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 int limit = getProcessLimit();
1197 reply.writeNoException();
1198 reply.writeInt(limit);
1199 return true;
1200 }
1201
1202 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 IBinder token = data.readStrongBinder();
1205 int pid = data.readInt();
1206 boolean isForeground = data.readInt() != 0;
1207 setProcessForeground(token, pid, isForeground);
1208 reply.writeNoException();
1209 return true;
1210 }
1211
1212 case CHECK_PERMISSION_TRANSACTION: {
1213 data.enforceInterface(IActivityManager.descriptor);
1214 String perm = data.readString();
1215 int pid = data.readInt();
1216 int uid = data.readInt();
1217 int res = checkPermission(perm, pid, uid);
1218 reply.writeNoException();
1219 reply.writeInt(res);
1220 return true;
1221 }
1222
Dianne Hackbornff170242014-11-19 10:59:01 -08001223 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1224 data.enforceInterface(IActivityManager.descriptor);
1225 String perm = data.readString();
1226 int pid = data.readInt();
1227 int uid = data.readInt();
1228 IBinder token = data.readStrongBinder();
1229 int res = checkPermissionWithToken(perm, pid, uid, token);
1230 reply.writeNoException();
1231 reply.writeInt(res);
1232 return true;
1233 }
1234
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 case CHECK_URI_PERMISSION_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 Uri uri = Uri.CREATOR.createFromParcel(data);
1238 int pid = data.readInt();
1239 int uid = data.readInt();
1240 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001241 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001242 IBinder callerToken = data.readStrongBinder();
1243 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 reply.writeNoException();
1245 reply.writeInt(res);
1246 return true;
1247 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001250 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001251 String packageName = data.readString();
1252 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1253 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001254 int userId = data.readInt();
1255 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001256 reply.writeNoException();
1257 reply.writeInt(res ? 1 : 0);
1258 return true;
1259 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001260
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001261 case GRANT_URI_PERMISSION_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 IBinder b = data.readStrongBinder();
1264 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1265 String targetPkg = data.readString();
1266 Uri uri = Uri.CREATOR.createFromParcel(data);
1267 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001268 int userId = data.readInt();
1269 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 reply.writeNoException();
1271 return true;
1272 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001273
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 case REVOKE_URI_PERMISSION_TRANSACTION: {
1275 data.enforceInterface(IActivityManager.descriptor);
1276 IBinder b = data.readStrongBinder();
1277 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1278 Uri uri = Uri.CREATOR.createFromParcel(data);
1279 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001280 int userId = data.readInt();
1281 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001282 reply.writeNoException();
1283 return true;
1284 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001285
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001286 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1287 data.enforceInterface(IActivityManager.descriptor);
1288 Uri uri = Uri.CREATOR.createFromParcel(data);
1289 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001290 int userId = data.readInt();
1291 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001292 reply.writeNoException();
1293 return true;
1294 }
1295
1296 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 Uri uri = Uri.CREATOR.createFromParcel(data);
1299 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001300 int userId = data.readInt();
1301 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001302 reply.writeNoException();
1303 return true;
1304 }
1305
1306 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001308 final String packageName = data.readString();
1309 final boolean incoming = data.readInt() != 0;
1310 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1311 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001312 reply.writeNoException();
1313 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1314 return true;
1315 }
1316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001317 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 IBinder b = data.readStrongBinder();
1320 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1321 boolean waiting = data.readInt() != 0;
1322 showWaitingForDebugger(app, waiting);
1323 reply.writeNoException();
1324 return true;
1325 }
1326
1327 case GET_MEMORY_INFO_TRANSACTION: {
1328 data.enforceInterface(IActivityManager.descriptor);
1329 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1330 getMemoryInfo(mi);
1331 reply.writeNoException();
1332 mi.writeToParcel(reply, 0);
1333 return true;
1334 }
1335
1336 case UNHANDLED_BACK_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
1338 unhandledBack();
1339 reply.writeNoException();
1340 return true;
1341 }
1342
1343 case OPEN_CONTENT_URI_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
1345 Uri uri = Uri.parse(data.readString());
1346 ParcelFileDescriptor pfd = openContentUri(uri);
1347 reply.writeNoException();
1348 if (pfd != null) {
1349 reply.writeInt(1);
1350 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1351 } else {
1352 reply.writeInt(0);
1353 }
1354 return true;
1355 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001356
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001357 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1358 data.enforceInterface(IActivityManager.descriptor);
1359 setLockScreenShown(data.readInt() != 0);
1360 reply.writeNoException();
1361 return true;
1362 }
1363
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001364 case SET_DEBUG_APP_TRANSACTION: {
1365 data.enforceInterface(IActivityManager.descriptor);
1366 String pn = data.readString();
1367 boolean wfd = data.readInt() != 0;
1368 boolean per = data.readInt() != 0;
1369 setDebugApp(pn, wfd, per);
1370 reply.writeNoException();
1371 return true;
1372 }
1373
1374 case SET_ALWAYS_FINISH_TRANSACTION: {
1375 data.enforceInterface(IActivityManager.descriptor);
1376 boolean enabled = data.readInt() != 0;
1377 setAlwaysFinish(enabled);
1378 reply.writeNoException();
1379 return true;
1380 }
1381
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001382 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001383 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001384 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001386 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001387 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001388 return true;
1389 }
1390
1391 case ENTER_SAFE_MODE_TRANSACTION: {
1392 data.enforceInterface(IActivityManager.descriptor);
1393 enterSafeMode();
1394 reply.writeNoException();
1395 return true;
1396 }
1397
1398 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1399 data.enforceInterface(IActivityManager.descriptor);
1400 IIntentSender is = IIntentSender.Stub.asInterface(
1401 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001402 int sourceUid = data.readInt();
1403 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001404 String tag = data.readString();
1405 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1406 reply.writeNoException();
1407 return true;
1408 }
1409
1410 case NOTE_ALARM_START_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 IIntentSender is = IIntentSender.Stub.asInterface(
1413 data.readStrongBinder());
1414 int sourceUid = data.readInt();
1415 String tag = data.readString();
1416 noteAlarmStart(is, sourceUid, tag);
1417 reply.writeNoException();
1418 return true;
1419 }
1420
1421 case NOTE_ALARM_FINISH_TRANSACTION: {
1422 data.enforceInterface(IActivityManager.descriptor);
1423 IIntentSender is = IIntentSender.Stub.asInterface(
1424 data.readStrongBinder());
1425 int sourceUid = data.readInt();
1426 String tag = data.readString();
1427 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001428 reply.writeNoException();
1429 return true;
1430 }
1431
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001432 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001433 data.enforceInterface(IActivityManager.descriptor);
1434 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001435 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001436 boolean secure = data.readInt() != 0;
1437 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001438 reply.writeNoException();
1439 reply.writeInt(res ? 1 : 0);
1440 return true;
1441 }
1442
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001443 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1444 data.enforceInterface(IActivityManager.descriptor);
1445 String reason = data.readString();
1446 boolean res = killProcessesBelowForeground(reason);
1447 reply.writeNoException();
1448 reply.writeInt(res ? 1 : 0);
1449 return true;
1450 }
1451
Dan Egnor60d87622009-12-16 16:32:58 -08001452 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 IBinder app = data.readStrongBinder();
1455 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1456 handleApplicationCrash(app, ci);
1457 reply.writeNoException();
1458 return true;
1459 }
1460
1461 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001462 data.enforceInterface(IActivityManager.descriptor);
1463 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001464 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001465 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001466 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001467 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001468 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001469 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001470 return true;
1471 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001472
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001473 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1474 data.enforceInterface(IActivityManager.descriptor);
1475 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001476 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001477 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1478 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001479 reply.writeNoException();
1480 return true;
1481 }
1482
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001483 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1484 data.enforceInterface(IActivityManager.descriptor);
1485 int sig = data.readInt();
1486 signalPersistentProcesses(sig);
1487 reply.writeNoException();
1488 return true;
1489 }
1490
Dianne Hackborn03abb812010-01-04 18:43:19 -08001491 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1492 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001493 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001494 int userId = data.readInt();
1495 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001496 reply.writeNoException();
1497 return true;
1498 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001499
1500 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 killAllBackgroundProcesses();
1503 reply.writeNoException();
1504 return true;
1505 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001506
Dianne Hackborn03abb812010-01-04 18:43:19 -08001507 case FORCE_STOP_PACKAGE_TRANSACTION: {
1508 data.enforceInterface(IActivityManager.descriptor);
1509 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001510 int userId = data.readInt();
1511 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001512 reply.writeNoException();
1513 return true;
1514 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001515
1516 case GET_MY_MEMORY_STATE_TRANSACTION: {
1517 data.enforceInterface(IActivityManager.descriptor);
1518 ActivityManager.RunningAppProcessInfo info =
1519 new ActivityManager.RunningAppProcessInfo();
1520 getMyMemoryState(info);
1521 reply.writeNoException();
1522 info.writeToParcel(reply, 0);
1523 return true;
1524 }
1525
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001526 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1527 data.enforceInterface(IActivityManager.descriptor);
1528 ConfigurationInfo config = getDeviceConfigurationInfo();
1529 reply.writeNoException();
1530 config.writeToParcel(reply, 0);
1531 return true;
1532 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001533
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001534 case PROFILE_CONTROL_TRANSACTION: {
1535 data.enforceInterface(IActivityManager.descriptor);
1536 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001537 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001538 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001539 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001540 ProfilerInfo profilerInfo = data.readInt() != 0
1541 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1542 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001543 reply.writeNoException();
1544 reply.writeInt(res ? 1 : 0);
1545 return true;
1546 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001547
Dianne Hackborn55280a92009-05-07 15:53:46 -07001548 case SHUTDOWN_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 boolean res = shutdown(data.readInt());
1551 reply.writeNoException();
1552 reply.writeInt(res ? 1 : 0);
1553 return true;
1554 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001555
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001556 case STOP_APP_SWITCHES_TRANSACTION: {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 stopAppSwitches();
1559 reply.writeNoException();
1560 return true;
1561 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001562
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001563 case RESUME_APP_SWITCHES_TRANSACTION: {
1564 data.enforceInterface(IActivityManager.descriptor);
1565 resumeAppSwitches();
1566 reply.writeNoException();
1567 return true;
1568 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001569
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001570 case PEEK_SERVICE_TRANSACTION: {
1571 data.enforceInterface(IActivityManager.descriptor);
1572 Intent service = Intent.CREATOR.createFromParcel(data);
1573 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001574 String callingPackage = data.readString();
1575 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001576 reply.writeNoException();
1577 reply.writeStrongBinder(binder);
1578 return true;
1579 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001580
Christopher Tate181fafa2009-05-14 11:12:14 -07001581 case START_BACKUP_AGENT_TRANSACTION: {
1582 data.enforceInterface(IActivityManager.descriptor);
1583 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1584 int backupRestoreMode = data.readInt();
1585 boolean success = bindBackupAgent(info, backupRestoreMode);
1586 reply.writeNoException();
1587 reply.writeInt(success ? 1 : 0);
1588 return true;
1589 }
1590
1591 case BACKUP_AGENT_CREATED_TRANSACTION: {
1592 data.enforceInterface(IActivityManager.descriptor);
1593 String packageName = data.readString();
1594 IBinder agent = data.readStrongBinder();
1595 backupAgentCreated(packageName, agent);
1596 reply.writeNoException();
1597 return true;
1598 }
1599
1600 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1601 data.enforceInterface(IActivityManager.descriptor);
1602 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1603 unbindBackupAgent(info);
1604 reply.writeNoException();
1605 return true;
1606 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001607
1608 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1609 data.enforceInterface(IActivityManager.descriptor);
1610 String packageName = data.readString();
1611 addPackageDependency(packageName);
1612 reply.writeNoException();
1613 return true;
1614 }
1615
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001616 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001617 data.enforceInterface(IActivityManager.descriptor);
1618 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001619 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001620 String reason = data.readString();
1621 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001622 reply.writeNoException();
1623 return true;
1624 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001625
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001626 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1627 data.enforceInterface(IActivityManager.descriptor);
1628 String reason = data.readString();
1629 closeSystemDialogs(reason);
1630 reply.writeNoException();
1631 return true;
1632 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001633
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001634 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001636 int[] pids = data.createIntArray();
1637 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001638 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001639 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001640 return true;
1641 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001642
1643 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1644 data.enforceInterface(IActivityManager.descriptor);
1645 String processName = data.readString();
1646 int uid = data.readInt();
1647 killApplicationProcess(processName, uid);
1648 reply.writeNoException();
1649 return true;
1650 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001651
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001652 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1653 data.enforceInterface(IActivityManager.descriptor);
1654 IBinder token = data.readStrongBinder();
1655 String packageName = data.readString();
1656 int enterAnim = data.readInt();
1657 int exitAnim = data.readInt();
1658 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001659 reply.writeNoException();
1660 return true;
1661 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001662
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001663 case IS_USER_A_MONKEY_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001665 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001666 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001667 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001668 return true;
1669 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001670
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001671 case SET_USER_IS_MONKEY_TRANSACTION: {
1672 data.enforceInterface(IActivityManager.descriptor);
1673 final boolean monkey = (data.readInt() == 1);
1674 setUserIsMonkey(monkey);
1675 reply.writeNoException();
1676 return true;
1677 }
1678
Dianne Hackborn860755f2010-06-03 18:47:52 -07001679 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1680 data.enforceInterface(IActivityManager.descriptor);
1681 finishHeavyWeightApp();
1682 reply.writeNoException();
1683 return true;
1684 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001685
1686 case IS_IMMERSIVE_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001689 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001690 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001691 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001692 return true;
1693 }
1694
Craig Mautnerd61dc202014-07-07 11:09:11 -07001695 case IS_TOP_OF_TASK_TRANSACTION: {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 IBinder token = data.readStrongBinder();
1698 final boolean isTopOfTask = isTopOfTask(token);
1699 reply.writeNoException();
1700 reply.writeInt(isTopOfTask ? 1 : 0);
1701 return true;
1702 }
1703
Craig Mautner5eda9b32013-07-02 11:58:16 -07001704 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001705 data.enforceInterface(IActivityManager.descriptor);
1706 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001707 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001708 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001709 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001710 return true;
1711 }
1712
1713 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001716 final Bundle bundle;
1717 if (data.readInt() == 0) {
1718 bundle = null;
1719 } else {
1720 bundle = data.readBundle();
1721 }
1722 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1723 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001724 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001725 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001726 return true;
1727 }
1728
Craig Mautner233ceee2014-05-09 17:05:11 -07001729 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1730 data.enforceInterface(IActivityManager.descriptor);
1731 IBinder token = data.readStrongBinder();
1732 final ActivityOptions options = getActivityOptions(token);
1733 reply.writeNoException();
1734 reply.writeBundle(options == null ? null : options.toBundle());
1735 return true;
1736 }
1737
Daniel Sandler69a48172010-06-23 16:29:36 -04001738 case SET_IMMERSIVE_TRANSACTION: {
1739 data.enforceInterface(IActivityManager.descriptor);
1740 IBinder token = data.readStrongBinder();
1741 boolean imm = data.readInt() == 1;
1742 setImmersive(token, imm);
1743 reply.writeNoException();
1744 return true;
1745 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001746
Daniel Sandler69a48172010-06-23 16:29:36 -04001747 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1748 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001749 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001750 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001751 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001752 return true;
1753 }
1754
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001755 case CRASH_APPLICATION_TRANSACTION: {
1756 data.enforceInterface(IActivityManager.descriptor);
1757 int uid = data.readInt();
1758 int initialPid = data.readInt();
1759 String packageName = data.readString();
1760 String message = data.readString();
1761 crashApplication(uid, initialPid, packageName, message);
1762 reply.writeNoException();
1763 return true;
1764 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001765
1766 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1767 data.enforceInterface(IActivityManager.descriptor);
1768 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001769 int userId = data.readInt();
1770 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001771 reply.writeNoException();
1772 reply.writeString(type);
1773 return true;
1774 }
1775
Dianne Hackborn7e269642010-08-25 19:50:20 -07001776 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1777 data.enforceInterface(IActivityManager.descriptor);
1778 String name = data.readString();
1779 IBinder perm = newUriPermissionOwner(name);
1780 reply.writeNoException();
1781 reply.writeStrongBinder(perm);
1782 return true;
1783 }
1784
1785 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1786 data.enforceInterface(IActivityManager.descriptor);
1787 IBinder owner = data.readStrongBinder();
1788 int fromUid = data.readInt();
1789 String targetPkg = data.readString();
1790 Uri uri = Uri.CREATOR.createFromParcel(data);
1791 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001792 int sourceUserId = data.readInt();
1793 int targetUserId = data.readInt();
1794 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1795 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001796 reply.writeNoException();
1797 return true;
1798 }
1799
1800 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1801 data.enforceInterface(IActivityManager.descriptor);
1802 IBinder owner = data.readStrongBinder();
1803 Uri uri = null;
1804 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001805 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001806 }
1807 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001808 int userId = data.readInt();
1809 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001810 reply.writeNoException();
1811 return true;
1812 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001813
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001814 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1815 data.enforceInterface(IActivityManager.descriptor);
1816 int callingUid = data.readInt();
1817 String targetPkg = data.readString();
1818 Uri uri = Uri.CREATOR.createFromParcel(data);
1819 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001820 int userId = data.readInt();
1821 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001822 reply.writeNoException();
1823 reply.writeInt(res);
1824 return true;
1825 }
1826
Andy McFadden824c5102010-07-09 16:26:57 -07001827 case DUMP_HEAP_TRANSACTION: {
1828 data.enforceInterface(IActivityManager.descriptor);
1829 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001830 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001831 boolean managed = data.readInt() != 0;
1832 String path = data.readString();
1833 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001834 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001835 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001836 reply.writeNoException();
1837 reply.writeInt(res ? 1 : 0);
1838 return true;
1839 }
1840
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001841 case START_ACTIVITIES_TRANSACTION:
1842 {
1843 data.enforceInterface(IActivityManager.descriptor);
1844 IBinder b = data.readStrongBinder();
1845 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001846 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001847 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1848 String[] resolvedTypes = data.createStringArray();
1849 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001850 Bundle options = data.readInt() != 0
1851 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001852 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001853 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001854 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001855 reply.writeNoException();
1856 reply.writeInt(result);
1857 return true;
1858 }
1859
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001860 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1861 {
1862 data.enforceInterface(IActivityManager.descriptor);
1863 int mode = getFrontActivityScreenCompatMode();
1864 reply.writeNoException();
1865 reply.writeInt(mode);
1866 return true;
1867 }
1868
1869 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1870 {
1871 data.enforceInterface(IActivityManager.descriptor);
1872 int mode = data.readInt();
1873 setFrontActivityScreenCompatMode(mode);
1874 reply.writeNoException();
1875 reply.writeInt(mode);
1876 return true;
1877 }
1878
1879 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1880 {
1881 data.enforceInterface(IActivityManager.descriptor);
1882 String pkg = data.readString();
1883 int mode = getPackageScreenCompatMode(pkg);
1884 reply.writeNoException();
1885 reply.writeInt(mode);
1886 return true;
1887 }
1888
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001889 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1890 {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001893 int mode = data.readInt();
1894 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001895 reply.writeNoException();
1896 return true;
1897 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001898
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001899 case SWITCH_USER_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 int userid = data.readInt();
1902 boolean result = switchUser(userid);
1903 reply.writeNoException();
1904 reply.writeInt(result ? 1 : 0);
1905 return true;
1906 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001907
Kenny Guy08488bf2014-02-21 17:40:37 +00001908 case START_USER_IN_BACKGROUND_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 int userid = data.readInt();
1911 boolean result = startUserInBackground(userid);
1912 reply.writeNoException();
1913 reply.writeInt(result ? 1 : 0);
1914 return true;
1915 }
1916
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001917 case STOP_USER_TRANSACTION: {
1918 data.enforceInterface(IActivityManager.descriptor);
1919 int userid = data.readInt();
1920 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1921 data.readStrongBinder());
1922 int result = stopUser(userid, callback);
1923 reply.writeNoException();
1924 reply.writeInt(result);
1925 return true;
1926 }
1927
Amith Yamasani52f1d752012-03-28 18:19:29 -07001928 case GET_CURRENT_USER_TRANSACTION: {
1929 data.enforceInterface(IActivityManager.descriptor);
1930 UserInfo userInfo = getCurrentUser();
1931 reply.writeNoException();
1932 userInfo.writeToParcel(reply, 0);
1933 return true;
1934 }
1935
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001936 case IS_USER_RUNNING_TRANSACTION: {
1937 data.enforceInterface(IActivityManager.descriptor);
1938 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001939 boolean orStopping = data.readInt() != 0;
1940 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001941 reply.writeNoException();
1942 reply.writeInt(result ? 1 : 0);
1943 return true;
1944 }
1945
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001946 case GET_RUNNING_USER_IDS_TRANSACTION: {
1947 data.enforceInterface(IActivityManager.descriptor);
1948 int[] result = getRunningUserIds();
1949 reply.writeNoException();
1950 reply.writeIntArray(result);
1951 return true;
1952 }
1953
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001954 case REMOVE_TASK_TRANSACTION:
1955 {
1956 data.enforceInterface(IActivityManager.descriptor);
1957 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001958 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001959 reply.writeNoException();
1960 reply.writeInt(result ? 1 : 0);
1961 return true;
1962 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001963
Jeff Sharkeya4620792011-05-20 15:29:23 -07001964 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1965 data.enforceInterface(IActivityManager.descriptor);
1966 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1967 data.readStrongBinder());
1968 registerProcessObserver(observer);
1969 return true;
1970 }
1971
1972 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1973 data.enforceInterface(IActivityManager.descriptor);
1974 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1975 data.readStrongBinder());
1976 unregisterProcessObserver(observer);
1977 return true;
1978 }
1979
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07001980 case REGISTER_UID_OBSERVER_TRANSACTION: {
1981 data.enforceInterface(IActivityManager.descriptor);
1982 IUidObserver observer = IUidObserver.Stub.asInterface(
1983 data.readStrongBinder());
1984 registerUidObserver(observer);
1985 return true;
1986 }
1987
1988 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
1989 data.enforceInterface(IActivityManager.descriptor);
1990 IUidObserver observer = IUidObserver.Stub.asInterface(
1991 data.readStrongBinder());
1992 unregisterUidObserver(observer);
1993 return true;
1994 }
1995
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001996 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1997 {
1998 data.enforceInterface(IActivityManager.descriptor);
1999 String pkg = data.readString();
2000 boolean ask = getPackageAskScreenCompat(pkg);
2001 reply.writeNoException();
2002 reply.writeInt(ask ? 1 : 0);
2003 return true;
2004 }
2005
2006 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2007 {
2008 data.enforceInterface(IActivityManager.descriptor);
2009 String pkg = data.readString();
2010 boolean ask = data.readInt() != 0;
2011 setPackageAskScreenCompat(pkg, ask);
2012 reply.writeNoException();
2013 return true;
2014 }
2015
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002016 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2017 data.enforceInterface(IActivityManager.descriptor);
2018 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002019 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002020 boolean res = isIntentSenderTargetedToPackage(r);
2021 reply.writeNoException();
2022 reply.writeInt(res ? 1 : 0);
2023 return true;
2024 }
2025
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002026 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2027 data.enforceInterface(IActivityManager.descriptor);
2028 IIntentSender r = IIntentSender.Stub.asInterface(
2029 data.readStrongBinder());
2030 boolean res = isIntentSenderAnActivity(r);
2031 reply.writeNoException();
2032 reply.writeInt(res ? 1 : 0);
2033 return true;
2034 }
2035
Dianne Hackborn81038902012-11-26 17:04:09 -08002036 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2037 data.enforceInterface(IActivityManager.descriptor);
2038 IIntentSender r = IIntentSender.Stub.asInterface(
2039 data.readStrongBinder());
2040 Intent intent = getIntentForIntentSender(r);
2041 reply.writeNoException();
2042 if (intent != null) {
2043 reply.writeInt(1);
2044 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2045 } else {
2046 reply.writeInt(0);
2047 }
2048 return true;
2049 }
2050
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002051 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2052 data.enforceInterface(IActivityManager.descriptor);
2053 IIntentSender r = IIntentSender.Stub.asInterface(
2054 data.readStrongBinder());
2055 String prefix = data.readString();
2056 String tag = getTagForIntentSender(r, prefix);
2057 reply.writeNoException();
2058 reply.writeString(tag);
2059 return true;
2060 }
2061
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002062 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2063 data.enforceInterface(IActivityManager.descriptor);
2064 Configuration config = Configuration.CREATOR.createFromParcel(data);
2065 updatePersistentConfiguration(config);
2066 reply.writeNoException();
2067 return true;
2068 }
2069
Dianne Hackbornb437e092011-08-05 17:50:29 -07002070 case GET_PROCESS_PSS_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 int[] pids = data.createIntArray();
2073 long[] pss = getProcessPss(pids);
2074 reply.writeNoException();
2075 reply.writeLongArray(pss);
2076 return true;
2077 }
2078
Dianne Hackborn661cd522011-08-22 00:26:20 -07002079 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2080 data.enforceInterface(IActivityManager.descriptor);
2081 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2082 boolean always = data.readInt() != 0;
2083 showBootMessage(msg, always);
2084 reply.writeNoException();
2085 return true;
2086 }
2087
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002088 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002089 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002090 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002091 reply.writeNoException();
2092 return true;
2093 }
2094
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002095 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2096 data.enforceInterface(IActivityManager.descriptor);
2097 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2098 reply.writeNoException();
2099 return true;
2100 }
2101
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002102 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002103 data.enforceInterface(IActivityManager.descriptor);
2104 IBinder token = data.readStrongBinder();
2105 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002106 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002107 reply.writeNoException();
2108 reply.writeInt(res ? 1 : 0);
2109 return true;
2110 }
2111
2112 case NAVIGATE_UP_TO_TRANSACTION: {
2113 data.enforceInterface(IActivityManager.descriptor);
2114 IBinder token = data.readStrongBinder();
2115 Intent target = Intent.CREATOR.createFromParcel(data);
2116 int resultCode = data.readInt();
2117 Intent resultData = null;
2118 if (data.readInt() != 0) {
2119 resultData = Intent.CREATOR.createFromParcel(data);
2120 }
2121 boolean res = navigateUpTo(token, target, resultCode, resultData);
2122 reply.writeNoException();
2123 reply.writeInt(res ? 1 : 0);
2124 return true;
2125 }
2126
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002127 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2128 data.enforceInterface(IActivityManager.descriptor);
2129 IBinder token = data.readStrongBinder();
2130 int res = getLaunchedFromUid(token);
2131 reply.writeNoException();
2132 reply.writeInt(res);
2133 return true;
2134 }
2135
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002136 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2137 data.enforceInterface(IActivityManager.descriptor);
2138 IBinder token = data.readStrongBinder();
2139 String res = getLaunchedFromPackage(token);
2140 reply.writeNoException();
2141 reply.writeString(res);
2142 return true;
2143 }
2144
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002145 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2146 data.enforceInterface(IActivityManager.descriptor);
2147 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2148 data.readStrongBinder());
2149 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002150 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002151 return true;
2152 }
2153
2154 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2155 data.enforceInterface(IActivityManager.descriptor);
2156 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2157 data.readStrongBinder());
2158 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002159 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002160 return true;
2161 }
2162
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002163 case REQUEST_BUG_REPORT_TRANSACTION: {
2164 data.enforceInterface(IActivityManager.descriptor);
2165 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002166 reply.writeNoException();
2167 return true;
2168 }
2169
2170 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2171 data.enforceInterface(IActivityManager.descriptor);
2172 int pid = data.readInt();
2173 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002174 String reason = data.readString();
2175 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002176 reply.writeNoException();
2177 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002178 return true;
2179 }
2180
Adam Skorydfc7fd72013-08-05 19:23:41 -07002181 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002182 data.enforceInterface(IActivityManager.descriptor);
2183 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002184 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002185 reply.writeNoException();
2186 reply.writeBundle(res);
2187 return true;
2188 }
2189
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002190 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2191 data.enforceInterface(IActivityManager.descriptor);
2192 int requestType = data.readInt();
2193 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
2194 requestAssistContextExtras(requestType, receiver);
2195 reply.writeNoException();
2196 return true;
2197 }
2198
Adam Skorydfc7fd72013-08-05 19:23:41 -07002199 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002200 data.enforceInterface(IActivityManager.descriptor);
2201 IBinder token = data.readStrongBinder();
2202 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002203 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2204 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002205 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2206 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002207 reply.writeNoException();
2208 return true;
2209 }
2210
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002211 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2212 data.enforceInterface(IActivityManager.descriptor);
2213 Intent intent = Intent.CREATOR.createFromParcel(data);
2214 int requestType = data.readInt();
2215 String hint = data.readString();
2216 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002217 Bundle args = data.readBundle();
2218 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002219 reply.writeNoException();
2220 reply.writeInt(res ? 1 : 0);
2221 return true;
2222 }
2223
Benjamin Franzc200f442015-06-25 18:20:04 +01002224 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2225 data.enforceInterface(IActivityManager.descriptor);
2226 boolean res = isScreenCaptureAllowedOnCurrentActivity();
2227 reply.writeNoException();
2228 reply.writeInt(res ? 1 : 0);
2229 return true;
2230 }
2231
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002232 case KILL_UID_TRANSACTION: {
2233 data.enforceInterface(IActivityManager.descriptor);
2234 int uid = data.readInt();
2235 String reason = data.readString();
2236 killUid(uid, reason);
2237 reply.writeNoException();
2238 return true;
2239 }
2240
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002241 case HANG_TRANSACTION: {
2242 data.enforceInterface(IActivityManager.descriptor);
2243 IBinder who = data.readStrongBinder();
2244 boolean allowRestart = data.readInt() != 0;
2245 hang(who, allowRestart);
2246 reply.writeNoException();
2247 return true;
2248 }
2249
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002250 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2251 data.enforceInterface(IActivityManager.descriptor);
2252 IBinder token = data.readStrongBinder();
2253 reportActivityFullyDrawn(token);
2254 reply.writeNoException();
2255 return true;
2256 }
2257
Craig Mautner5eda9b32013-07-02 11:58:16 -07002258 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2259 data.enforceInterface(IActivityManager.descriptor);
2260 IBinder token = data.readStrongBinder();
2261 notifyActivityDrawn(token);
2262 reply.writeNoException();
2263 return true;
2264 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002265
2266 case RESTART_TRANSACTION: {
2267 data.enforceInterface(IActivityManager.descriptor);
2268 restart();
2269 reply.writeNoException();
2270 return true;
2271 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002272
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002273 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2274 data.enforceInterface(IActivityManager.descriptor);
2275 performIdleMaintenance();
2276 reply.writeNoException();
2277 return true;
2278 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002279
Todd Kennedyca4d8422015-01-15 15:19:22 -08002280 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002281 data.enforceInterface(IActivityManager.descriptor);
2282 IBinder parentActivityToken = data.readStrongBinder();
2283 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002284 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002285 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002286 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002287 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002288 if (activityContainer != null) {
2289 reply.writeInt(1);
2290 reply.writeStrongBinder(activityContainer.asBinder());
2291 } else {
2292 reply.writeInt(0);
2293 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002294 return true;
2295 }
2296
Craig Mautner95da1082014-02-24 17:54:35 -08002297 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2298 data.enforceInterface(IActivityManager.descriptor);
2299 IActivityContainer activityContainer =
2300 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2301 deleteActivityContainer(activityContainer);
2302 reply.writeNoException();
2303 return true;
2304 }
2305
Todd Kennedy4900bf92015-01-16 16:05:14 -08002306 case CREATE_STACK_ON_DISPLAY: {
2307 data.enforceInterface(IActivityManager.descriptor);
2308 int displayId = data.readInt();
2309 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2310 reply.writeNoException();
2311 if (activityContainer != null) {
2312 reply.writeInt(1);
2313 reply.writeStrongBinder(activityContainer.asBinder());
2314 } else {
2315 reply.writeInt(0);
2316 }
2317 return true;
2318 }
2319
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002320 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002321 data.enforceInterface(IActivityManager.descriptor);
2322 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002323 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002324 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002325 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002326 return true;
2327 }
2328
Craig Mautneraea74a52014-03-08 14:23:10 -08002329 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2330 data.enforceInterface(IActivityManager.descriptor);
2331 final int taskId = data.readInt();
2332 startLockTaskMode(taskId);
2333 reply.writeNoException();
2334 return true;
2335 }
2336
2337 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2338 data.enforceInterface(IActivityManager.descriptor);
2339 IBinder token = data.readStrongBinder();
2340 startLockTaskMode(token);
2341 reply.writeNoException();
2342 return true;
2343 }
2344
Craig Mautnerd61dc202014-07-07 11:09:11 -07002345 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002346 data.enforceInterface(IActivityManager.descriptor);
2347 startLockTaskModeOnCurrent();
2348 reply.writeNoException();
2349 return true;
2350 }
2351
Craig Mautneraea74a52014-03-08 14:23:10 -08002352 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2353 data.enforceInterface(IActivityManager.descriptor);
2354 stopLockTaskMode();
2355 reply.writeNoException();
2356 return true;
2357 }
2358
Craig Mautnerd61dc202014-07-07 11:09:11 -07002359 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002360 data.enforceInterface(IActivityManager.descriptor);
2361 stopLockTaskModeOnCurrent();
2362 reply.writeNoException();
2363 return true;
2364 }
2365
Craig Mautneraea74a52014-03-08 14:23:10 -08002366 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2367 data.enforceInterface(IActivityManager.descriptor);
2368 final boolean isInLockTaskMode = isInLockTaskMode();
2369 reply.writeNoException();
2370 reply.writeInt(isInLockTaskMode ? 1 : 0);
2371 return true;
2372 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002373
Benjamin Franz43261142015-02-11 15:59:44 +00002374 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2375 data.enforceInterface(IActivityManager.descriptor);
2376 final int lockTaskModeState = getLockTaskModeState();
2377 reply.writeNoException();
2378 reply.writeInt(lockTaskModeState);
2379 return true;
2380 }
2381
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002382 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2383 data.enforceInterface(IActivityManager.descriptor);
2384 final IBinder token = data.readStrongBinder();
2385 showLockTaskEscapeMessage(token);
2386 reply.writeNoException();
2387 return true;
2388 }
2389
Winson Chunga449dc02014-05-16 11:15:04 -07002390 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002391 data.enforceInterface(IActivityManager.descriptor);
2392 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002393 ActivityManager.TaskDescription values =
2394 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2395 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002396 reply.writeNoException();
2397 return true;
2398 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002399
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002400 case SET_TASK_RESIZEABLE_TRANSACTION: {
2401 data.enforceInterface(IActivityManager.descriptor);
2402 int taskId = data.readInt();
2403 boolean resizeable = (data.readInt() == 1) ? true : false;
2404 setTaskResizeable(taskId, resizeable);
2405 reply.writeNoException();
2406 return true;
2407 }
2408
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002409 case RESIZE_TASK_TRANSACTION: {
2410 data.enforceInterface(IActivityManager.descriptor);
2411 int taskId = data.readInt();
2412 Rect r = Rect.CREATOR.createFromParcel(data);
2413 resizeTask(taskId, r);
2414 reply.writeNoException();
2415 return true;
2416 }
2417
Craig Mautner648f69b2014-09-18 14:16:26 -07002418 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2419 data.enforceInterface(IActivityManager.descriptor);
2420 String filename = data.readString();
2421 Bitmap icon = getTaskDescriptionIcon(filename);
2422 reply.writeNoException();
2423 if (icon == null) {
2424 reply.writeInt(0);
2425 } else {
2426 reply.writeInt(1);
2427 icon.writeToParcel(reply, 0);
2428 }
2429 return true;
2430 }
2431
Winson Chung044d5292014-11-06 11:05:19 -08002432 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2433 data.enforceInterface(IActivityManager.descriptor);
2434 final Bundle bundle;
2435 if (data.readInt() == 0) {
2436 bundle = null;
2437 } else {
2438 bundle = data.readBundle();
2439 }
2440 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2441 startInPlaceAnimationOnFrontMostApplication(options);
2442 reply.writeNoException();
2443 return true;
2444 }
2445
Jose Lima4b6c6692014-08-12 17:41:12 -07002446 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002447 data.enforceInterface(IActivityManager.descriptor);
2448 IBinder token = data.readStrongBinder();
2449 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002450 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002451 reply.writeNoException();
2452 reply.writeInt(success ? 1 : 0);
2453 return true;
2454 }
2455
Jose Lima4b6c6692014-08-12 17:41:12 -07002456 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002457 data.enforceInterface(IActivityManager.descriptor);
2458 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002459 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002460 reply.writeNoException();
2461 reply.writeInt(enabled ? 1 : 0);
2462 return true;
2463 }
2464
Jose Lima4b6c6692014-08-12 17:41:12 -07002465 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002466 data.enforceInterface(IActivityManager.descriptor);
2467 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002468 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002469 reply.writeNoException();
2470 return true;
2471 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002472
2473 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2474 data.enforceInterface(IActivityManager.descriptor);
2475 IBinder token = data.readStrongBinder();
2476 notifyLaunchTaskBehindComplete(token);
2477 reply.writeNoException();
2478 return true;
2479 }
Craig Mautner8746a472014-07-24 15:12:54 -07002480
2481 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2482 data.enforceInterface(IActivityManager.descriptor);
2483 IBinder token = data.readStrongBinder();
2484 notifyEnterAnimationComplete(token);
2485 reply.writeNoException();
2486 return true;
2487 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002488
2489 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2490 data.enforceInterface(IActivityManager.descriptor);
2491 bootAnimationComplete();
2492 reply.writeNoException();
2493 return true;
2494 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002495
Jeff Sharkey605eb792014-11-04 13:34:06 -08002496 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2497 data.enforceInterface(IActivityManager.descriptor);
2498 final int uid = data.readInt();
2499 final byte[] firstPacket = data.createByteArray();
2500 notifyCleartextNetwork(uid, firstPacket);
2501 reply.writeNoException();
2502 return true;
2503 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002504
2505 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2506 data.enforceInterface(IActivityManager.descriptor);
2507 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002508 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002509 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002510 String reportPackage = data.readString();
2511 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002512 reply.writeNoException();
2513 return true;
2514 }
2515
2516 case DUMP_HEAP_FINISHED_TRANSACTION: {
2517 data.enforceInterface(IActivityManager.descriptor);
2518 String path = data.readString();
2519 dumpHeapFinished(path);
2520 reply.writeNoException();
2521 return true;
2522 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002523
2524 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2525 data.enforceInterface(IActivityManager.descriptor);
2526 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2527 data.readStrongBinder());
2528 boolean keepAwake = data.readInt() != 0;
2529 setVoiceKeepAwake(session, keepAwake);
2530 reply.writeNoException();
2531 return true;
2532 }
Craig Mautnere5600772015-04-03 21:36:37 -07002533
2534 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2535 data.enforceInterface(IActivityManager.descriptor);
2536 int userId = data.readInt();
2537 String[] packages = data.readStringArray();
2538 updateLockTaskPackages(userId, packages);
2539 reply.writeNoException();
2540 return true;
2541 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002542
Craig Mautner015c5e52015-04-23 10:39:39 -07002543 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2544 data.enforceInterface(IActivityManager.descriptor);
2545 String packageName = data.readString();
2546 updateDeviceOwner(packageName);
2547 reply.writeNoException();
2548 return true;
2549 }
2550
Dianne Hackborn1e383822015-04-10 14:02:33 -07002551 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2552 data.enforceInterface(IActivityManager.descriptor);
2553 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002554 String callingPackage = data.readString();
2555 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002556 reply.writeNoException();
2557 reply.writeInt(res);
2558 return true;
2559 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002560
2561 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2562 data.enforceInterface(IActivityManager.descriptor);
2563 String process = data.readString();
2564 int userId = data.readInt();
2565 int level = data.readInt();
2566 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2567 reply.writeNoException();
2568 reply.writeInt(res ? 1 : 0);
2569 return true;
2570 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002571 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002572
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002573 return super.onTransact(code, data, reply, flags);
2574 }
2575
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002576 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002577 return this;
2578 }
2579
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002580 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2581 protected IActivityManager create() {
2582 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002583 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002584 Log.v("ActivityManager", "default service binder = " + b);
2585 }
2586 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002587 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002588 Log.v("ActivityManager", "default service = " + am);
2589 }
2590 return am;
2591 }
2592 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593}
2594
2595class ActivityManagerProxy implements IActivityManager
2596{
2597 public ActivityManagerProxy(IBinder remote)
2598 {
2599 mRemote = remote;
2600 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002601
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002602 public IBinder asBinder()
2603 {
2604 return mRemote;
2605 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002606
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002607 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002608 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002609 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002610 Parcel data = Parcel.obtain();
2611 Parcel reply = Parcel.obtain();
2612 data.writeInterfaceToken(IActivityManager.descriptor);
2613 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002614 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002615 intent.writeToParcel(data, 0);
2616 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002617 data.writeStrongBinder(resultTo);
2618 data.writeString(resultWho);
2619 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002620 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002621 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002622 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002623 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002624 } else {
2625 data.writeInt(0);
2626 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002627 if (options != null) {
2628 data.writeInt(1);
2629 options.writeToParcel(data, 0);
2630 } else {
2631 data.writeInt(0);
2632 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002633 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2634 reply.readException();
2635 int result = reply.readInt();
2636 reply.recycle();
2637 data.recycle();
2638 return result;
2639 }
Amith Yamasani82644082012-08-03 13:09:11 -07002640
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002641 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002642 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002643 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2644 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002645 Parcel data = Parcel.obtain();
2646 Parcel reply = Parcel.obtain();
2647 data.writeInterfaceToken(IActivityManager.descriptor);
2648 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002649 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002650 intent.writeToParcel(data, 0);
2651 data.writeString(resolvedType);
2652 data.writeStrongBinder(resultTo);
2653 data.writeString(resultWho);
2654 data.writeInt(requestCode);
2655 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002656 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002657 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002658 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002659 } else {
2660 data.writeInt(0);
2661 }
2662 if (options != null) {
2663 data.writeInt(1);
2664 options.writeToParcel(data, 0);
2665 } else {
2666 data.writeInt(0);
2667 }
2668 data.writeInt(userId);
2669 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2670 reply.readException();
2671 int result = reply.readInt();
2672 reply.recycle();
2673 data.recycle();
2674 return result;
2675 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002676 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2677 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002678 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002679 Parcel data = Parcel.obtain();
2680 Parcel reply = Parcel.obtain();
2681 data.writeInterfaceToken(IActivityManager.descriptor);
2682 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2683 data.writeString(callingPackage);
2684 intent.writeToParcel(data, 0);
2685 data.writeString(resolvedType);
2686 data.writeStrongBinder(resultTo);
2687 data.writeString(resultWho);
2688 data.writeInt(requestCode);
2689 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002690 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002691 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002692 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002693 } else {
2694 data.writeInt(0);
2695 }
2696 if (options != null) {
2697 data.writeInt(1);
2698 options.writeToParcel(data, 0);
2699 } else {
2700 data.writeInt(0);
2701 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002702 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002703 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2704 reply.readException();
2705 int result = reply.readInt();
2706 reply.recycle();
2707 data.recycle();
2708 return result;
2709 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002710 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2711 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002712 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2713 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002714 Parcel data = Parcel.obtain();
2715 Parcel reply = Parcel.obtain();
2716 data.writeInterfaceToken(IActivityManager.descriptor);
2717 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002718 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002719 intent.writeToParcel(data, 0);
2720 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002721 data.writeStrongBinder(resultTo);
2722 data.writeString(resultWho);
2723 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002724 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002725 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002726 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002727 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002728 } else {
2729 data.writeInt(0);
2730 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002731 if (options != null) {
2732 data.writeInt(1);
2733 options.writeToParcel(data, 0);
2734 } else {
2735 data.writeInt(0);
2736 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002737 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002738 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2739 reply.readException();
2740 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2741 reply.recycle();
2742 data.recycle();
2743 return result;
2744 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002745 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2746 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002747 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002748 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002749 Parcel data = Parcel.obtain();
2750 Parcel reply = Parcel.obtain();
2751 data.writeInterfaceToken(IActivityManager.descriptor);
2752 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002753 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002754 intent.writeToParcel(data, 0);
2755 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002756 data.writeStrongBinder(resultTo);
2757 data.writeString(resultWho);
2758 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002759 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002760 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002761 if (options != null) {
2762 data.writeInt(1);
2763 options.writeToParcel(data, 0);
2764 } else {
2765 data.writeInt(0);
2766 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002767 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002768 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2769 reply.readException();
2770 int result = reply.readInt();
2771 reply.recycle();
2772 data.recycle();
2773 return result;
2774 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002775 public int startActivityIntentSender(IApplicationThread caller,
2776 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002777 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002778 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002779 Parcel data = Parcel.obtain();
2780 Parcel reply = Parcel.obtain();
2781 data.writeInterfaceToken(IActivityManager.descriptor);
2782 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2783 intent.writeToParcel(data, 0);
2784 if (fillInIntent != null) {
2785 data.writeInt(1);
2786 fillInIntent.writeToParcel(data, 0);
2787 } else {
2788 data.writeInt(0);
2789 }
2790 data.writeString(resolvedType);
2791 data.writeStrongBinder(resultTo);
2792 data.writeString(resultWho);
2793 data.writeInt(requestCode);
2794 data.writeInt(flagsMask);
2795 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002796 if (options != null) {
2797 data.writeInt(1);
2798 options.writeToParcel(data, 0);
2799 } else {
2800 data.writeInt(0);
2801 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002802 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002803 reply.readException();
2804 int result = reply.readInt();
2805 reply.recycle();
2806 data.recycle();
2807 return result;
2808 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002809 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2810 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002811 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2812 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 data.writeString(callingPackage);
2817 data.writeInt(callingPid);
2818 data.writeInt(callingUid);
2819 intent.writeToParcel(data, 0);
2820 data.writeString(resolvedType);
2821 data.writeStrongBinder(session.asBinder());
2822 data.writeStrongBinder(interactor.asBinder());
2823 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002824 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002825 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002826 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002827 } else {
2828 data.writeInt(0);
2829 }
2830 if (options != null) {
2831 data.writeInt(1);
2832 options.writeToParcel(data, 0);
2833 } else {
2834 data.writeInt(0);
2835 }
2836 data.writeInt(userId);
2837 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2838 reply.readException();
2839 int result = reply.readInt();
2840 reply.recycle();
2841 data.recycle();
2842 return result;
2843 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002844 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002845 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 data.writeStrongBinder(callingActivity);
2850 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002851 if (options != null) {
2852 data.writeInt(1);
2853 options.writeToParcel(data, 0);
2854 } else {
2855 data.writeInt(0);
2856 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002857 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2858 reply.readException();
2859 int result = reply.readInt();
2860 reply.recycle();
2861 data.recycle();
2862 return result != 0;
2863 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002864 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2865 Parcel data = Parcel.obtain();
2866 Parcel reply = Parcel.obtain();
2867 data.writeInterfaceToken(IActivityManager.descriptor);
2868 data.writeInt(taskId);
2869 if (options == null) {
2870 data.writeInt(0);
2871 } else {
2872 data.writeInt(1);
2873 options.writeToParcel(data, 0);
2874 }
2875 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2876 reply.readException();
2877 int result = reply.readInt();
2878 reply.recycle();
2879 data.recycle();
2880 return result;
2881 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002882 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002883 throws RemoteException {
2884 Parcel data = Parcel.obtain();
2885 Parcel reply = Parcel.obtain();
2886 data.writeInterfaceToken(IActivityManager.descriptor);
2887 data.writeStrongBinder(token);
2888 data.writeInt(resultCode);
2889 if (resultData != null) {
2890 data.writeInt(1);
2891 resultData.writeToParcel(data, 0);
2892 } else {
2893 data.writeInt(0);
2894 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002895 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002896 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2897 reply.readException();
2898 boolean res = reply.readInt() != 0;
2899 data.recycle();
2900 reply.recycle();
2901 return res;
2902 }
2903 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2904 {
2905 Parcel data = Parcel.obtain();
2906 Parcel reply = Parcel.obtain();
2907 data.writeInterfaceToken(IActivityManager.descriptor);
2908 data.writeStrongBinder(token);
2909 data.writeString(resultWho);
2910 data.writeInt(requestCode);
2911 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2912 reply.readException();
2913 data.recycle();
2914 reply.recycle();
2915 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002916 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2917 Parcel data = Parcel.obtain();
2918 Parcel reply = Parcel.obtain();
2919 data.writeInterfaceToken(IActivityManager.descriptor);
2920 data.writeStrongBinder(token);
2921 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2922 reply.readException();
2923 boolean res = reply.readInt() != 0;
2924 data.recycle();
2925 reply.recycle();
2926 return res;
2927 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002928 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2929 Parcel data = Parcel.obtain();
2930 Parcel reply = Parcel.obtain();
2931 data.writeInterfaceToken(IActivityManager.descriptor);
2932 data.writeStrongBinder(session.asBinder());
2933 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2934 reply.readException();
2935 data.recycle();
2936 reply.recycle();
2937 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002938 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2939 Parcel data = Parcel.obtain();
2940 Parcel reply = Parcel.obtain();
2941 data.writeInterfaceToken(IActivityManager.descriptor);
2942 data.writeStrongBinder(token);
2943 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2944 reply.readException();
2945 boolean res = reply.readInt() != 0;
2946 data.recycle();
2947 reply.recycle();
2948 return res;
2949 }
2950 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2951 Parcel data = Parcel.obtain();
2952 Parcel reply = Parcel.obtain();
2953 data.writeInterfaceToken(IActivityManager.descriptor);
2954 data.writeStrongBinder(app.asBinder());
2955 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2956 reply.readException();
2957 data.recycle();
2958 reply.recycle();
2959 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002960 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2961 Parcel data = Parcel.obtain();
2962 Parcel reply = Parcel.obtain();
2963 data.writeInterfaceToken(IActivityManager.descriptor);
2964 data.writeStrongBinder(token);
2965 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2966 reply.readException();
2967 boolean res = reply.readInt() != 0;
2968 data.recycle();
2969 reply.recycle();
2970 return res;
2971 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002972 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002974 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002975 {
2976 Parcel data = Parcel.obtain();
2977 Parcel reply = Parcel.obtain();
2978 data.writeInterfaceToken(IActivityManager.descriptor);
2979 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002980 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002981 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2982 filter.writeToParcel(data, 0);
2983 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002984 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002985 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2986 reply.readException();
2987 Intent intent = null;
2988 int haveIntent = reply.readInt();
2989 if (haveIntent != 0) {
2990 intent = Intent.CREATOR.createFromParcel(reply);
2991 }
2992 reply.recycle();
2993 data.recycle();
2994 return intent;
2995 }
2996 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2997 {
2998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 data.writeStrongBinder(receiver.asBinder());
3002 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3003 reply.readException();
3004 data.recycle();
3005 reply.recycle();
3006 }
3007 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003008 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003009 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003010 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003011 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003012 {
3013 Parcel data = Parcel.obtain();
3014 Parcel reply = Parcel.obtain();
3015 data.writeInterfaceToken(IActivityManager.descriptor);
3016 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3017 intent.writeToParcel(data, 0);
3018 data.writeString(resolvedType);
3019 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3020 data.writeInt(resultCode);
3021 data.writeString(resultData);
3022 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003023 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003024 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003025 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003026 data.writeInt(serialized ? 1 : 0);
3027 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003028 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003029 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3030 reply.readException();
3031 int res = reply.readInt();
3032 reply.recycle();
3033 data.recycle();
3034 return res;
3035 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003036 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3037 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003038 {
3039 Parcel data = Parcel.obtain();
3040 Parcel reply = Parcel.obtain();
3041 data.writeInterfaceToken(IActivityManager.descriptor);
3042 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3043 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003044 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003045 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3046 reply.readException();
3047 data.recycle();
3048 reply.recycle();
3049 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003050 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3051 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003052 {
3053 Parcel data = Parcel.obtain();
3054 Parcel reply = Parcel.obtain();
3055 data.writeInterfaceToken(IActivityManager.descriptor);
3056 data.writeStrongBinder(who);
3057 data.writeInt(resultCode);
3058 data.writeString(resultData);
3059 data.writeBundle(map);
3060 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003061 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003062 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3063 reply.readException();
3064 data.recycle();
3065 reply.recycle();
3066 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 public void attachApplication(IApplicationThread app) throws RemoteException
3068 {
3069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 data.writeStrongBinder(app.asBinder());
3073 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3074 reply.readException();
3075 data.recycle();
3076 reply.recycle();
3077 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003078 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3079 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003080 {
3081 Parcel data = Parcel.obtain();
3082 Parcel reply = Parcel.obtain();
3083 data.writeInterfaceToken(IActivityManager.descriptor);
3084 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003085 if (config != null) {
3086 data.writeInt(1);
3087 config.writeToParcel(data, 0);
3088 } else {
3089 data.writeInt(0);
3090 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003091 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003092 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3093 reply.readException();
3094 data.recycle();
3095 reply.recycle();
3096 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003097 public void activityResumed(IBinder token) throws RemoteException
3098 {
3099 Parcel data = Parcel.obtain();
3100 Parcel reply = Parcel.obtain();
3101 data.writeInterfaceToken(IActivityManager.descriptor);
3102 data.writeStrongBinder(token);
3103 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3104 reply.readException();
3105 data.recycle();
3106 reply.recycle();
3107 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003108 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003109 {
3110 Parcel data = Parcel.obtain();
3111 Parcel reply = Parcel.obtain();
3112 data.writeInterfaceToken(IActivityManager.descriptor);
3113 data.writeStrongBinder(token);
3114 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3115 reply.readException();
3116 data.recycle();
3117 reply.recycle();
3118 }
3119 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003120 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003121 {
3122 Parcel data = Parcel.obtain();
3123 Parcel reply = Parcel.obtain();
3124 data.writeInterfaceToken(IActivityManager.descriptor);
3125 data.writeStrongBinder(token);
3126 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003127 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 TextUtils.writeToParcel(description, data, 0);
3129 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3130 reply.readException();
3131 data.recycle();
3132 reply.recycle();
3133 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003134 public void activitySlept(IBinder token) throws RemoteException
3135 {
3136 Parcel data = Parcel.obtain();
3137 Parcel reply = Parcel.obtain();
3138 data.writeInterfaceToken(IActivityManager.descriptor);
3139 data.writeStrongBinder(token);
3140 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3141 reply.readException();
3142 data.recycle();
3143 reply.recycle();
3144 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003145 public void activityDestroyed(IBinder token) throws RemoteException
3146 {
3147 Parcel data = Parcel.obtain();
3148 Parcel reply = Parcel.obtain();
3149 data.writeInterfaceToken(IActivityManager.descriptor);
3150 data.writeStrongBinder(token);
3151 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3152 reply.readException();
3153 data.recycle();
3154 reply.recycle();
3155 }
3156 public String getCallingPackage(IBinder token) throws RemoteException
3157 {
3158 Parcel data = Parcel.obtain();
3159 Parcel reply = Parcel.obtain();
3160 data.writeInterfaceToken(IActivityManager.descriptor);
3161 data.writeStrongBinder(token);
3162 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 String res = reply.readString();
3165 data.recycle();
3166 reply.recycle();
3167 return res;
3168 }
3169 public ComponentName getCallingActivity(IBinder token)
3170 throws RemoteException {
3171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
3174 data.writeStrongBinder(token);
3175 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3176 reply.readException();
3177 ComponentName res = ComponentName.readFromParcel(reply);
3178 data.recycle();
3179 reply.recycle();
3180 return res;
3181 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003182 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003183 Parcel data = Parcel.obtain();
3184 Parcel reply = Parcel.obtain();
3185 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003186 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003187 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3188 reply.readException();
3189 ArrayList<IAppTask> list = null;
3190 int N = reply.readInt();
3191 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003192 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003193 while (N > 0) {
3194 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3195 list.add(task);
3196 N--;
3197 }
3198 }
3199 data.recycle();
3200 reply.recycle();
3201 return list;
3202 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003203 public int addAppTask(IBinder activityToken, Intent intent,
3204 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3205 Parcel data = Parcel.obtain();
3206 Parcel reply = Parcel.obtain();
3207 data.writeInterfaceToken(IActivityManager.descriptor);
3208 data.writeStrongBinder(activityToken);
3209 intent.writeToParcel(data, 0);
3210 description.writeToParcel(data, 0);
3211 thumbnail.writeToParcel(data, 0);
3212 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3213 reply.readException();
3214 int res = reply.readInt();
3215 data.recycle();
3216 reply.recycle();
3217 return res;
3218 }
3219 public Point getAppTaskThumbnailSize() throws RemoteException {
3220 Parcel data = Parcel.obtain();
3221 Parcel reply = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3224 reply.readException();
3225 Point size = Point.CREATOR.createFromParcel(reply);
3226 data.recycle();
3227 reply.recycle();
3228 return size;
3229 }
Todd Kennedye635f662015-01-20 10:36:49 -08003230 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3231 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003232 Parcel data = Parcel.obtain();
3233 Parcel reply = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 data.writeInt(maxNum);
3236 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003237 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3238 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003239 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 int N = reply.readInt();
3241 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003242 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 while (N > 0) {
3244 ActivityManager.RunningTaskInfo info =
3245 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003246 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003247 list.add(info);
3248 N--;
3249 }
3250 }
3251 data.recycle();
3252 reply.recycle();
3253 return list;
3254 }
3255 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003256 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003257 Parcel data = Parcel.obtain();
3258 Parcel reply = Parcel.obtain();
3259 data.writeInterfaceToken(IActivityManager.descriptor);
3260 data.writeInt(maxNum);
3261 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003262 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003263 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3264 reply.readException();
3265 ArrayList<ActivityManager.RecentTaskInfo> list
3266 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3267 data.recycle();
3268 reply.recycle();
3269 return list;
3270 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003271 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003276 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003277 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003278 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003279 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003280 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003281 }
3282 data.recycle();
3283 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003284 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003285 }
Todd Kennedye635f662015-01-20 10:36:49 -08003286 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3287 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003288 Parcel data = Parcel.obtain();
3289 Parcel reply = Parcel.obtain();
3290 data.writeInterfaceToken(IActivityManager.descriptor);
3291 data.writeInt(maxNum);
3292 data.writeInt(flags);
3293 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3294 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003295 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 int N = reply.readInt();
3297 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003298 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003299 while (N > 0) {
3300 ActivityManager.RunningServiceInfo info =
3301 ActivityManager.RunningServiceInfo.CREATOR
3302 .createFromParcel(reply);
3303 list.add(info);
3304 N--;
3305 }
3306 }
3307 data.recycle();
3308 reply.recycle();
3309 return list;
3310 }
3311 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3312 throws RemoteException {
3313 Parcel data = Parcel.obtain();
3314 Parcel reply = Parcel.obtain();
3315 data.writeInterfaceToken(IActivityManager.descriptor);
3316 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3319 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3320 data.recycle();
3321 reply.recycle();
3322 return list;
3323 }
3324 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3325 throws RemoteException {
3326 Parcel data = Parcel.obtain();
3327 Parcel reply = Parcel.obtain();
3328 data.writeInterfaceToken(IActivityManager.descriptor);
3329 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 ArrayList<ActivityManager.RunningAppProcessInfo> list
3332 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3333 data.recycle();
3334 reply.recycle();
3335 return list;
3336 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003337 public List<ApplicationInfo> getRunningExternalApplications()
3338 throws RemoteException {
3339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3343 reply.readException();
3344 ArrayList<ApplicationInfo> list
3345 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3346 data.recycle();
3347 reply.recycle();
3348 return list;
3349 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003350 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003351 {
3352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003356 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003357 if (options != null) {
3358 data.writeInt(1);
3359 options.writeToParcel(data, 0);
3360 } else {
3361 data.writeInt(0);
3362 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003363 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 data.recycle();
3366 reply.recycle();
3367 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003368 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3369 throws RemoteException {
3370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
3372 data.writeInterfaceToken(IActivityManager.descriptor);
3373 data.writeStrongBinder(token);
3374 data.writeInt(nonRoot ? 1 : 0);
3375 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3376 reply.readException();
3377 boolean res = reply.readInt() != 0;
3378 data.recycle();
3379 reply.recycle();
3380 return res;
3381 }
3382 public void moveTaskBackwards(int task) throws RemoteException
3383 {
3384 Parcel data = Parcel.obtain();
3385 Parcel reply = Parcel.obtain();
3386 data.writeInterfaceToken(IActivityManager.descriptor);
3387 data.writeInt(task);
3388 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3389 reply.readException();
3390 data.recycle();
3391 reply.recycle();
3392 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003393 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003394 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3395 {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003398 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003399 data.writeInt(taskId);
3400 data.writeInt(stackId);
3401 data.writeInt(toTop ? 1 : 0);
3402 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3403 reply.readException();
3404 data.recycle();
3405 reply.recycle();
3406 }
3407 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003408 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003409 {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003412 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003413 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003414 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003415 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003416 reply.readException();
3417 data.recycle();
3418 reply.recycle();
3419 }
Craig Mautner967212c2013-04-13 21:10:58 -07003420 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003421 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003422 {
3423 Parcel data = Parcel.obtain();
3424 Parcel reply = Parcel.obtain();
3425 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003426 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003427 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003428 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003429 data.recycle();
3430 reply.recycle();
3431 return list;
3432 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003433 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003434 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003435 {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003439 data.writeInt(stackId);
3440 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003441 reply.readException();
3442 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003443 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003444 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003445 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003446 }
3447 data.recycle();
3448 reply.recycle();
3449 return info;
3450 }
3451 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003452 public boolean isInHomeStack(int taskId) throws RemoteException {
3453 Parcel data = Parcel.obtain();
3454 Parcel reply = Parcel.obtain();
3455 data.writeInterfaceToken(IActivityManager.descriptor);
3456 data.writeInt(taskId);
3457 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3458 reply.readException();
3459 boolean isInHomeStack = reply.readInt() > 0;
3460 data.recycle();
3461 reply.recycle();
3462 return isInHomeStack;
3463 }
3464 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003465 public void setFocusedStack(int stackId) throws RemoteException
3466 {
3467 Parcel data = Parcel.obtain();
3468 Parcel reply = Parcel.obtain();
3469 data.writeInterfaceToken(IActivityManager.descriptor);
3470 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003471 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003472 reply.readException();
3473 data.recycle();
3474 reply.recycle();
3475 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003476 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003477 public int getFocusedStackId() throws RemoteException {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3482 reply.readException();
3483 int focusedStackId = reply.readInt();
3484 data.recycle();
3485 reply.recycle();
3486 return focusedStackId;
3487 }
3488 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003489 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3490 {
3491 Parcel data = Parcel.obtain();
3492 Parcel reply = Parcel.obtain();
3493 data.writeInterfaceToken(IActivityManager.descriptor);
3494 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003495 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003496 reply.readException();
3497 data.recycle();
3498 reply.recycle();
3499 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003500 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3501 {
3502 Parcel data = Parcel.obtain();
3503 Parcel reply = Parcel.obtain();
3504 data.writeInterfaceToken(IActivityManager.descriptor);
3505 data.writeStrongBinder(token);
3506 data.writeInt(onlyRoot ? 1 : 0);
3507 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3508 reply.readException();
3509 int res = reply.readInt();
3510 data.recycle();
3511 reply.recycle();
3512 return res;
3513 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003514 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003515 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003516 Parcel data = Parcel.obtain();
3517 Parcel reply = Parcel.obtain();
3518 data.writeInterfaceToken(IActivityManager.descriptor);
3519 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3520 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003521 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003522 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003523 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3524 reply.readException();
3525 int res = reply.readInt();
3526 ContentProviderHolder cph = null;
3527 if (res != 0) {
3528 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3529 }
3530 data.recycle();
3531 reply.recycle();
3532 return cph;
3533 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003534 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3535 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003536 Parcel data = Parcel.obtain();
3537 Parcel reply = Parcel.obtain();
3538 data.writeInterfaceToken(IActivityManager.descriptor);
3539 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003540 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003541 data.writeStrongBinder(token);
3542 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3543 reply.readException();
3544 int res = reply.readInt();
3545 ContentProviderHolder cph = null;
3546 if (res != 0) {
3547 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3548 }
3549 data.recycle();
3550 reply.recycle();
3551 return cph;
3552 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003553 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003554 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003555 {
3556 Parcel data = Parcel.obtain();
3557 Parcel reply = Parcel.obtain();
3558 data.writeInterfaceToken(IActivityManager.descriptor);
3559 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3560 data.writeTypedList(providers);
3561 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 data.recycle();
3564 reply.recycle();
3565 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003566 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3567 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003568 Parcel data = Parcel.obtain();
3569 Parcel reply = Parcel.obtain();
3570 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003571 data.writeStrongBinder(connection);
3572 data.writeInt(stable);
3573 data.writeInt(unstable);
3574 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3575 reply.readException();
3576 boolean res = reply.readInt() != 0;
3577 data.recycle();
3578 reply.recycle();
3579 return res;
3580 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003581
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003582 public void unstableProviderDied(IBinder connection) throws RemoteException {
3583 Parcel data = Parcel.obtain();
3584 Parcel reply = Parcel.obtain();
3585 data.writeInterfaceToken(IActivityManager.descriptor);
3586 data.writeStrongBinder(connection);
3587 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3588 reply.readException();
3589 data.recycle();
3590 reply.recycle();
3591 }
3592
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003593 @Override
3594 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3595 Parcel data = Parcel.obtain();
3596 Parcel reply = Parcel.obtain();
3597 data.writeInterfaceToken(IActivityManager.descriptor);
3598 data.writeStrongBinder(connection);
3599 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 data.recycle();
3602 reply.recycle();
3603 }
3604
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003605 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeStrongBinder(connection);
3610 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003611 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3612 reply.readException();
3613 data.recycle();
3614 reply.recycle();
3615 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003616
3617 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3618 Parcel data = Parcel.obtain();
3619 Parcel reply = Parcel.obtain();
3620 data.writeInterfaceToken(IActivityManager.descriptor);
3621 data.writeString(name);
3622 data.writeStrongBinder(token);
3623 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3624 reply.readException();
3625 data.recycle();
3626 reply.recycle();
3627 }
3628
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003629 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3630 throws RemoteException
3631 {
3632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 service.writeToParcel(data, 0);
3636 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3637 reply.readException();
3638 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3639 data.recycle();
3640 reply.recycle();
3641 return res;
3642 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003643
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003644 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003645 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003646 {
3647 Parcel data = Parcel.obtain();
3648 Parcel reply = Parcel.obtain();
3649 data.writeInterfaceToken(IActivityManager.descriptor);
3650 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3651 service.writeToParcel(data, 0);
3652 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003653 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003654 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003655 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3656 reply.readException();
3657 ComponentName res = ComponentName.readFromParcel(reply);
3658 data.recycle();
3659 reply.recycle();
3660 return res;
3661 }
3662 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003663 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003664 {
3665 Parcel data = Parcel.obtain();
3666 Parcel reply = Parcel.obtain();
3667 data.writeInterfaceToken(IActivityManager.descriptor);
3668 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3669 service.writeToParcel(data, 0);
3670 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003671 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003672 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3673 reply.readException();
3674 int res = reply.readInt();
3675 reply.recycle();
3676 data.recycle();
3677 return res;
3678 }
3679 public boolean stopServiceToken(ComponentName className, IBinder token,
3680 int startId) throws RemoteException {
3681 Parcel data = Parcel.obtain();
3682 Parcel reply = Parcel.obtain();
3683 data.writeInterfaceToken(IActivityManager.descriptor);
3684 ComponentName.writeToParcel(className, data);
3685 data.writeStrongBinder(token);
3686 data.writeInt(startId);
3687 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3688 reply.readException();
3689 boolean res = reply.readInt() != 0;
3690 data.recycle();
3691 reply.recycle();
3692 return res;
3693 }
3694 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003695 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003696 Parcel data = Parcel.obtain();
3697 Parcel reply = Parcel.obtain();
3698 data.writeInterfaceToken(IActivityManager.descriptor);
3699 ComponentName.writeToParcel(className, data);
3700 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003701 data.writeInt(id);
3702 if (notification != null) {
3703 data.writeInt(1);
3704 notification.writeToParcel(data, 0);
3705 } else {
3706 data.writeInt(0);
3707 }
3708 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003709 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3710 reply.readException();
3711 data.recycle();
3712 reply.recycle();
3713 }
3714 public int bindService(IApplicationThread caller, IBinder token,
3715 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003716 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3721 data.writeStrongBinder(token);
3722 service.writeToParcel(data, 0);
3723 data.writeString(resolvedType);
3724 data.writeStrongBinder(connection.asBinder());
3725 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003726 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003727 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003728 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3729 reply.readException();
3730 int res = reply.readInt();
3731 data.recycle();
3732 reply.recycle();
3733 return res;
3734 }
3735 public boolean unbindService(IServiceConnection connection) throws RemoteException
3736 {
3737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 data.writeStrongBinder(connection.asBinder());
3741 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3742 reply.readException();
3743 boolean res = reply.readInt() != 0;
3744 data.recycle();
3745 reply.recycle();
3746 return res;
3747 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003748
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003749 public void publishService(IBinder token,
3750 Intent intent, IBinder service) throws RemoteException {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeStrongBinder(token);
3755 intent.writeToParcel(data, 0);
3756 data.writeStrongBinder(service);
3757 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3758 reply.readException();
3759 data.recycle();
3760 reply.recycle();
3761 }
3762
3763 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3764 throws RemoteException {
3765 Parcel data = Parcel.obtain();
3766 Parcel reply = Parcel.obtain();
3767 data.writeInterfaceToken(IActivityManager.descriptor);
3768 data.writeStrongBinder(token);
3769 intent.writeToParcel(data, 0);
3770 data.writeInt(doRebind ? 1 : 0);
3771 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3772 reply.readException();
3773 data.recycle();
3774 reply.recycle();
3775 }
3776
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003777 public void serviceDoneExecuting(IBinder token, int type, int startId,
3778 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003779 Parcel data = Parcel.obtain();
3780 Parcel reply = Parcel.obtain();
3781 data.writeInterfaceToken(IActivityManager.descriptor);
3782 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003783 data.writeInt(type);
3784 data.writeInt(startId);
3785 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003786 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3787 reply.readException();
3788 data.recycle();
3789 reply.recycle();
3790 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003791
Svet Ganov99b60432015-06-27 13:15:22 -07003792 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
3793 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003794 Parcel data = Parcel.obtain();
3795 Parcel reply = Parcel.obtain();
3796 data.writeInterfaceToken(IActivityManager.descriptor);
3797 service.writeToParcel(data, 0);
3798 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003799 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003800 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3801 reply.readException();
3802 IBinder binder = reply.readStrongBinder();
3803 reply.recycle();
3804 data.recycle();
3805 return binder;
3806 }
3807
Christopher Tate181fafa2009-05-14 11:12:14 -07003808 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3809 throws RemoteException {
3810 Parcel data = Parcel.obtain();
3811 Parcel reply = Parcel.obtain();
3812 data.writeInterfaceToken(IActivityManager.descriptor);
3813 app.writeToParcel(data, 0);
3814 data.writeInt(backupRestoreMode);
3815 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3816 reply.readException();
3817 boolean success = reply.readInt() != 0;
3818 reply.recycle();
3819 data.recycle();
3820 return success;
3821 }
3822
Christopher Tate346acb12012-10-15 19:20:25 -07003823 public void clearPendingBackup() throws RemoteException {
3824 Parcel data = Parcel.obtain();
3825 Parcel reply = Parcel.obtain();
3826 data.writeInterfaceToken(IActivityManager.descriptor);
3827 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3828 reply.recycle();
3829 data.recycle();
3830 }
3831
Christopher Tate181fafa2009-05-14 11:12:14 -07003832 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3833 Parcel data = Parcel.obtain();
3834 Parcel reply = Parcel.obtain();
3835 data.writeInterfaceToken(IActivityManager.descriptor);
3836 data.writeString(packageName);
3837 data.writeStrongBinder(agent);
3838 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3839 reply.recycle();
3840 data.recycle();
3841 }
3842
3843 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
3847 app.writeToParcel(data, 0);
3848 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3849 reply.readException();
3850 reply.recycle();
3851 data.recycle();
3852 }
3853
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003854 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003855 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003856 IUiAutomationConnection connection, int userId, String instructionSet)
3857 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003858 Parcel data = Parcel.obtain();
3859 Parcel reply = Parcel.obtain();
3860 data.writeInterfaceToken(IActivityManager.descriptor);
3861 ComponentName.writeToParcel(className, data);
3862 data.writeString(profileFile);
3863 data.writeInt(flags);
3864 data.writeBundle(arguments);
3865 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003866 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003867 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003868 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003869 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 boolean res = reply.readInt() != 0;
3872 reply.recycle();
3873 data.recycle();
3874 return res;
3875 }
3876
3877 public void finishInstrumentation(IApplicationThread target,
3878 int resultCode, Bundle results) throws RemoteException {
3879 Parcel data = Parcel.obtain();
3880 Parcel reply = Parcel.obtain();
3881 data.writeInterfaceToken(IActivityManager.descriptor);
3882 data.writeStrongBinder(target != null ? target.asBinder() : null);
3883 data.writeInt(resultCode);
3884 data.writeBundle(results);
3885 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3886 reply.readException();
3887 data.recycle();
3888 reply.recycle();
3889 }
3890 public Configuration getConfiguration() throws RemoteException
3891 {
3892 Parcel data = Parcel.obtain();
3893 Parcel reply = Parcel.obtain();
3894 data.writeInterfaceToken(IActivityManager.descriptor);
3895 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3896 reply.readException();
3897 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3898 reply.recycle();
3899 data.recycle();
3900 return res;
3901 }
3902 public void updateConfiguration(Configuration values) throws RemoteException
3903 {
3904 Parcel data = Parcel.obtain();
3905 Parcel reply = Parcel.obtain();
3906 data.writeInterfaceToken(IActivityManager.descriptor);
3907 values.writeToParcel(data, 0);
3908 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3909 reply.readException();
3910 data.recycle();
3911 reply.recycle();
3912 }
3913 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3914 throws RemoteException {
3915 Parcel data = Parcel.obtain();
3916 Parcel reply = Parcel.obtain();
3917 data.writeInterfaceToken(IActivityManager.descriptor);
3918 data.writeStrongBinder(token);
3919 data.writeInt(requestedOrientation);
3920 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3921 reply.readException();
3922 data.recycle();
3923 reply.recycle();
3924 }
3925 public int getRequestedOrientation(IBinder token) throws RemoteException {
3926 Parcel data = Parcel.obtain();
3927 Parcel reply = Parcel.obtain();
3928 data.writeInterfaceToken(IActivityManager.descriptor);
3929 data.writeStrongBinder(token);
3930 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3931 reply.readException();
3932 int res = reply.readInt();
3933 data.recycle();
3934 reply.recycle();
3935 return res;
3936 }
3937 public ComponentName getActivityClassForToken(IBinder token)
3938 throws RemoteException {
3939 Parcel data = Parcel.obtain();
3940 Parcel reply = Parcel.obtain();
3941 data.writeInterfaceToken(IActivityManager.descriptor);
3942 data.writeStrongBinder(token);
3943 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3944 reply.readException();
3945 ComponentName res = ComponentName.readFromParcel(reply);
3946 data.recycle();
3947 reply.recycle();
3948 return res;
3949 }
3950 public String getPackageForToken(IBinder token) throws RemoteException
3951 {
3952 Parcel data = Parcel.obtain();
3953 Parcel reply = Parcel.obtain();
3954 data.writeInterfaceToken(IActivityManager.descriptor);
3955 data.writeStrongBinder(token);
3956 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3957 reply.readException();
3958 String res = reply.readString();
3959 data.recycle();
3960 reply.recycle();
3961 return res;
3962 }
3963 public IIntentSender getIntentSender(int type,
3964 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003965 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003966 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003967 Parcel data = Parcel.obtain();
3968 Parcel reply = Parcel.obtain();
3969 data.writeInterfaceToken(IActivityManager.descriptor);
3970 data.writeInt(type);
3971 data.writeString(packageName);
3972 data.writeStrongBinder(token);
3973 data.writeString(resultWho);
3974 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003975 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003976 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003977 data.writeTypedArray(intents, 0);
3978 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003979 } else {
3980 data.writeInt(0);
3981 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003982 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003983 if (options != null) {
3984 data.writeInt(1);
3985 options.writeToParcel(data, 0);
3986 } else {
3987 data.writeInt(0);
3988 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003989 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003990 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3991 reply.readException();
3992 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003993 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003994 data.recycle();
3995 reply.recycle();
3996 return res;
3997 }
3998 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3999 Parcel data = Parcel.obtain();
4000 Parcel reply = Parcel.obtain();
4001 data.writeInterfaceToken(IActivityManager.descriptor);
4002 data.writeStrongBinder(sender.asBinder());
4003 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4004 reply.readException();
4005 data.recycle();
4006 reply.recycle();
4007 }
4008 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4009 Parcel data = Parcel.obtain();
4010 Parcel reply = Parcel.obtain();
4011 data.writeInterfaceToken(IActivityManager.descriptor);
4012 data.writeStrongBinder(sender.asBinder());
4013 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4014 reply.readException();
4015 String res = reply.readString();
4016 data.recycle();
4017 reply.recycle();
4018 return res;
4019 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004020 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4021 Parcel data = Parcel.obtain();
4022 Parcel reply = Parcel.obtain();
4023 data.writeInterfaceToken(IActivityManager.descriptor);
4024 data.writeStrongBinder(sender.asBinder());
4025 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4026 reply.readException();
4027 int res = reply.readInt();
4028 data.recycle();
4029 reply.recycle();
4030 return res;
4031 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004032 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4033 boolean requireFull, String name, String callerPackage) throws RemoteException {
4034 Parcel data = Parcel.obtain();
4035 Parcel reply = Parcel.obtain();
4036 data.writeInterfaceToken(IActivityManager.descriptor);
4037 data.writeInt(callingPid);
4038 data.writeInt(callingUid);
4039 data.writeInt(userId);
4040 data.writeInt(allowAll ? 1 : 0);
4041 data.writeInt(requireFull ? 1 : 0);
4042 data.writeString(name);
4043 data.writeString(callerPackage);
4044 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4045 reply.readException();
4046 int res = reply.readInt();
4047 data.recycle();
4048 reply.recycle();
4049 return res;
4050 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004051 public void setProcessLimit(int max) throws RemoteException
4052 {
4053 Parcel data = Parcel.obtain();
4054 Parcel reply = Parcel.obtain();
4055 data.writeInterfaceToken(IActivityManager.descriptor);
4056 data.writeInt(max);
4057 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4058 reply.readException();
4059 data.recycle();
4060 reply.recycle();
4061 }
4062 public int getProcessLimit() throws RemoteException
4063 {
4064 Parcel data = Parcel.obtain();
4065 Parcel reply = Parcel.obtain();
4066 data.writeInterfaceToken(IActivityManager.descriptor);
4067 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4068 reply.readException();
4069 int res = reply.readInt();
4070 data.recycle();
4071 reply.recycle();
4072 return res;
4073 }
4074 public void setProcessForeground(IBinder token, int pid,
4075 boolean isForeground) throws RemoteException {
4076 Parcel data = Parcel.obtain();
4077 Parcel reply = Parcel.obtain();
4078 data.writeInterfaceToken(IActivityManager.descriptor);
4079 data.writeStrongBinder(token);
4080 data.writeInt(pid);
4081 data.writeInt(isForeground ? 1 : 0);
4082 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4083 reply.readException();
4084 data.recycle();
4085 reply.recycle();
4086 }
4087 public int checkPermission(String permission, int pid, int uid)
4088 throws RemoteException {
4089 Parcel data = Parcel.obtain();
4090 Parcel reply = Parcel.obtain();
4091 data.writeInterfaceToken(IActivityManager.descriptor);
4092 data.writeString(permission);
4093 data.writeInt(pid);
4094 data.writeInt(uid);
4095 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4096 reply.readException();
4097 int res = reply.readInt();
4098 data.recycle();
4099 reply.recycle();
4100 return res;
4101 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004102 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4103 throws RemoteException {
4104 Parcel data = Parcel.obtain();
4105 Parcel reply = Parcel.obtain();
4106 data.writeInterfaceToken(IActivityManager.descriptor);
4107 data.writeString(permission);
4108 data.writeInt(pid);
4109 data.writeInt(uid);
4110 data.writeStrongBinder(callerToken);
4111 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4112 reply.readException();
4113 int res = reply.readInt();
4114 data.recycle();
4115 reply.recycle();
4116 return res;
4117 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004118 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004119 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004120 Parcel data = Parcel.obtain();
4121 Parcel reply = Parcel.obtain();
4122 data.writeInterfaceToken(IActivityManager.descriptor);
4123 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004124 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004125 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004126 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4127 reply.readException();
4128 boolean res = reply.readInt() != 0;
4129 data.recycle();
4130 reply.recycle();
4131 return res;
4132 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004133 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4134 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004135 Parcel data = Parcel.obtain();
4136 Parcel reply = Parcel.obtain();
4137 data.writeInterfaceToken(IActivityManager.descriptor);
4138 uri.writeToParcel(data, 0);
4139 data.writeInt(pid);
4140 data.writeInt(uid);
4141 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004142 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004143 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004144 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4145 reply.readException();
4146 int res = reply.readInt();
4147 data.recycle();
4148 reply.recycle();
4149 return res;
4150 }
4151 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004152 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004153 Parcel data = Parcel.obtain();
4154 Parcel reply = Parcel.obtain();
4155 data.writeInterfaceToken(IActivityManager.descriptor);
4156 data.writeStrongBinder(caller.asBinder());
4157 data.writeString(targetPkg);
4158 uri.writeToParcel(data, 0);
4159 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004160 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004161 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4162 reply.readException();
4163 data.recycle();
4164 reply.recycle();
4165 }
4166 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004167 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004168 Parcel data = Parcel.obtain();
4169 Parcel reply = Parcel.obtain();
4170 data.writeInterfaceToken(IActivityManager.descriptor);
4171 data.writeStrongBinder(caller.asBinder());
4172 uri.writeToParcel(data, 0);
4173 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004174 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004175 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4176 reply.readException();
4177 data.recycle();
4178 reply.recycle();
4179 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004180
4181 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004182 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4183 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004184 Parcel data = Parcel.obtain();
4185 Parcel reply = Parcel.obtain();
4186 data.writeInterfaceToken(IActivityManager.descriptor);
4187 uri.writeToParcel(data, 0);
4188 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004189 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004190 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4191 reply.readException();
4192 data.recycle();
4193 reply.recycle();
4194 }
4195
4196 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004197 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4198 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004199 Parcel data = Parcel.obtain();
4200 Parcel reply = Parcel.obtain();
4201 data.writeInterfaceToken(IActivityManager.descriptor);
4202 uri.writeToParcel(data, 0);
4203 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004204 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004205 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4206 reply.readException();
4207 data.recycle();
4208 reply.recycle();
4209 }
4210
4211 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004212 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4213 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004214 Parcel data = Parcel.obtain();
4215 Parcel reply = Parcel.obtain();
4216 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004217 data.writeString(packageName);
4218 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004219 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4220 reply.readException();
4221 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4222 reply);
4223 data.recycle();
4224 reply.recycle();
4225 return perms;
4226 }
4227
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004228 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4229 throws RemoteException {
4230 Parcel data = Parcel.obtain();
4231 Parcel reply = Parcel.obtain();
4232 data.writeInterfaceToken(IActivityManager.descriptor);
4233 data.writeStrongBinder(who.asBinder());
4234 data.writeInt(waiting ? 1 : 0);
4235 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4236 reply.readException();
4237 data.recycle();
4238 reply.recycle();
4239 }
4240 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4241 Parcel data = Parcel.obtain();
4242 Parcel reply = Parcel.obtain();
4243 data.writeInterfaceToken(IActivityManager.descriptor);
4244 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4245 reply.readException();
4246 outInfo.readFromParcel(reply);
4247 data.recycle();
4248 reply.recycle();
4249 }
4250 public void unhandledBack() throws RemoteException
4251 {
4252 Parcel data = Parcel.obtain();
4253 Parcel reply = Parcel.obtain();
4254 data.writeInterfaceToken(IActivityManager.descriptor);
4255 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4256 reply.readException();
4257 data.recycle();
4258 reply.recycle();
4259 }
4260 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4261 {
4262 Parcel data = Parcel.obtain();
4263 Parcel reply = Parcel.obtain();
4264 data.writeInterfaceToken(IActivityManager.descriptor);
4265 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4266 reply.readException();
4267 ParcelFileDescriptor pfd = null;
4268 if (reply.readInt() != 0) {
4269 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4270 }
4271 data.recycle();
4272 reply.recycle();
4273 return pfd;
4274 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004275 public void setLockScreenShown(boolean shown) throws RemoteException
4276 {
4277 Parcel data = Parcel.obtain();
4278 Parcel reply = Parcel.obtain();
4279 data.writeInterfaceToken(IActivityManager.descriptor);
4280 data.writeInt(shown ? 1 : 0);
4281 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4282 reply.readException();
4283 data.recycle();
4284 reply.recycle();
4285 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004286 public void setDebugApp(
4287 String packageName, boolean waitForDebugger, boolean persistent)
4288 throws RemoteException
4289 {
4290 Parcel data = Parcel.obtain();
4291 Parcel reply = Parcel.obtain();
4292 data.writeInterfaceToken(IActivityManager.descriptor);
4293 data.writeString(packageName);
4294 data.writeInt(waitForDebugger ? 1 : 0);
4295 data.writeInt(persistent ? 1 : 0);
4296 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4297 reply.readException();
4298 data.recycle();
4299 reply.recycle();
4300 }
4301 public void setAlwaysFinish(boolean enabled) throws RemoteException
4302 {
4303 Parcel data = Parcel.obtain();
4304 Parcel reply = Parcel.obtain();
4305 data.writeInterfaceToken(IActivityManager.descriptor);
4306 data.writeInt(enabled ? 1 : 0);
4307 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4308 reply.readException();
4309 data.recycle();
4310 reply.recycle();
4311 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004312 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004313 {
4314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004318 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004319 reply.readException();
4320 data.recycle();
4321 reply.recycle();
4322 }
4323 public void enterSafeMode() throws RemoteException {
4324 Parcel data = Parcel.obtain();
4325 data.writeInterfaceToken(IActivityManager.descriptor);
4326 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4327 data.recycle();
4328 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004329 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004330 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004331 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004332 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004333 data.writeStrongBinder(sender.asBinder());
4334 data.writeInt(sourceUid);
4335 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004336 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004337 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4338 data.recycle();
4339 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004340 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4341 throws RemoteException {
4342 Parcel data = Parcel.obtain();
4343 data.writeInterfaceToken(IActivityManager.descriptor);
4344 data.writeStrongBinder(sender.asBinder());
4345 data.writeInt(sourceUid);
4346 data.writeString(tag);
4347 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4348 data.recycle();
4349 }
4350 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4351 throws RemoteException {
4352 Parcel data = Parcel.obtain();
4353 data.writeInterfaceToken(IActivityManager.descriptor);
4354 data.writeStrongBinder(sender.asBinder());
4355 data.writeInt(sourceUid);
4356 data.writeString(tag);
4357 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4358 data.recycle();
4359 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004360 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004361 Parcel data = Parcel.obtain();
4362 Parcel reply = Parcel.obtain();
4363 data.writeInterfaceToken(IActivityManager.descriptor);
4364 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004365 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004366 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004367 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004368 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004369 boolean res = reply.readInt() != 0;
4370 data.recycle();
4371 reply.recycle();
4372 return res;
4373 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004374 @Override
4375 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4376 Parcel data = Parcel.obtain();
4377 Parcel reply = Parcel.obtain();
4378 data.writeInterfaceToken(IActivityManager.descriptor);
4379 data.writeString(reason);
4380 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4381 boolean res = reply.readInt() != 0;
4382 data.recycle();
4383 reply.recycle();
4384 return res;
4385 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004386 public boolean testIsSystemReady()
4387 {
4388 /* this base class version is never called */
4389 return true;
4390 }
Dan Egnor60d87622009-12-16 16:32:58 -08004391 public void handleApplicationCrash(IBinder app,
4392 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4393 {
4394 Parcel data = Parcel.obtain();
4395 Parcel reply = Parcel.obtain();
4396 data.writeInterfaceToken(IActivityManager.descriptor);
4397 data.writeStrongBinder(app);
4398 crashInfo.writeToParcel(data, 0);
4399 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4400 reply.readException();
4401 reply.recycle();
4402 data.recycle();
4403 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004404
Dianne Hackborn52322712014-08-26 22:47:26 -07004405 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004406 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004407 {
4408 Parcel data = Parcel.obtain();
4409 Parcel reply = Parcel.obtain();
4410 data.writeInterfaceToken(IActivityManager.descriptor);
4411 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004412 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004413 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004414 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004415 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004416 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004417 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004418 reply.recycle();
4419 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004420 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004421 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004422
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004423 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004424 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004425 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004426 {
4427 Parcel data = Parcel.obtain();
4428 Parcel reply = Parcel.obtain();
4429 data.writeInterfaceToken(IActivityManager.descriptor);
4430 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004431 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004432 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004433 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4434 reply.readException();
4435 reply.recycle();
4436 data.recycle();
4437 }
4438
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004439 public void signalPersistentProcesses(int sig) throws RemoteException {
4440 Parcel data = Parcel.obtain();
4441 Parcel reply = Parcel.obtain();
4442 data.writeInterfaceToken(IActivityManager.descriptor);
4443 data.writeInt(sig);
4444 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4445 reply.readException();
4446 data.recycle();
4447 reply.recycle();
4448 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004449
Dianne Hackborn1676c852012-09-10 14:52:30 -07004450 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004451 Parcel data = Parcel.obtain();
4452 Parcel reply = Parcel.obtain();
4453 data.writeInterfaceToken(IActivityManager.descriptor);
4454 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004455 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004456 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4457 reply.readException();
4458 data.recycle();
4459 reply.recycle();
4460 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004461
4462 public void killAllBackgroundProcesses() throws RemoteException {
4463 Parcel data = Parcel.obtain();
4464 Parcel reply = Parcel.obtain();
4465 data.writeInterfaceToken(IActivityManager.descriptor);
4466 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4467 reply.readException();
4468 data.recycle();
4469 reply.recycle();
4470 }
4471
Dianne Hackborn1676c852012-09-10 14:52:30 -07004472 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004473 Parcel data = Parcel.obtain();
4474 Parcel reply = Parcel.obtain();
4475 data.writeInterfaceToken(IActivityManager.descriptor);
4476 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004477 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004478 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004479 reply.readException();
4480 data.recycle();
4481 reply.recycle();
4482 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004483
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004484 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4485 throws RemoteException
4486 {
4487 Parcel data = Parcel.obtain();
4488 Parcel reply = Parcel.obtain();
4489 data.writeInterfaceToken(IActivityManager.descriptor);
4490 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4491 reply.readException();
4492 outInfo.readFromParcel(reply);
4493 reply.recycle();
4494 data.recycle();
4495 }
4496
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004497 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4498 {
4499 Parcel data = Parcel.obtain();
4500 Parcel reply = Parcel.obtain();
4501 data.writeInterfaceToken(IActivityManager.descriptor);
4502 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4503 reply.readException();
4504 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4505 reply.recycle();
4506 data.recycle();
4507 return res;
4508 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004509
Dianne Hackborn1676c852012-09-10 14:52:30 -07004510 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004511 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004512 {
4513 Parcel data = Parcel.obtain();
4514 Parcel reply = Parcel.obtain();
4515 data.writeInterfaceToken(IActivityManager.descriptor);
4516 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004517 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004518 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004519 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004520 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004521 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004522 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004523 } else {
4524 data.writeInt(0);
4525 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004526 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4527 reply.readException();
4528 boolean res = reply.readInt() != 0;
4529 reply.recycle();
4530 data.recycle();
4531 return res;
4532 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004533
Dianne Hackborn55280a92009-05-07 15:53:46 -07004534 public boolean shutdown(int timeout) throws RemoteException
4535 {
4536 Parcel data = Parcel.obtain();
4537 Parcel reply = Parcel.obtain();
4538 data.writeInterfaceToken(IActivityManager.descriptor);
4539 data.writeInt(timeout);
4540 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4541 reply.readException();
4542 boolean res = reply.readInt() != 0;
4543 reply.recycle();
4544 data.recycle();
4545 return res;
4546 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004547
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004548 public void stopAppSwitches() throws RemoteException {
4549 Parcel data = Parcel.obtain();
4550 Parcel reply = Parcel.obtain();
4551 data.writeInterfaceToken(IActivityManager.descriptor);
4552 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4553 reply.readException();
4554 reply.recycle();
4555 data.recycle();
4556 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004557
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004558 public void resumeAppSwitches() throws RemoteException {
4559 Parcel data = Parcel.obtain();
4560 Parcel reply = Parcel.obtain();
4561 data.writeInterfaceToken(IActivityManager.descriptor);
4562 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4563 reply.readException();
4564 reply.recycle();
4565 data.recycle();
4566 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004567
4568 public void addPackageDependency(String packageName) throws RemoteException {
4569 Parcel data = Parcel.obtain();
4570 Parcel reply = Parcel.obtain();
4571 data.writeInterfaceToken(IActivityManager.descriptor);
4572 data.writeString(packageName);
4573 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4574 reply.readException();
4575 data.recycle();
4576 reply.recycle();
4577 }
4578
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004579 public void killApplicationWithAppId(String pkg, int appid, String reason)
4580 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004581 Parcel data = Parcel.obtain();
4582 Parcel reply = Parcel.obtain();
4583 data.writeInterfaceToken(IActivityManager.descriptor);
4584 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004585 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004586 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004587 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004588 reply.readException();
4589 data.recycle();
4590 reply.recycle();
4591 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004592
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004593 public void closeSystemDialogs(String reason) throws RemoteException {
4594 Parcel data = Parcel.obtain();
4595 Parcel reply = Parcel.obtain();
4596 data.writeInterfaceToken(IActivityManager.descriptor);
4597 data.writeString(reason);
4598 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4599 reply.readException();
4600 data.recycle();
4601 reply.recycle();
4602 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004603
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004604 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004605 throws RemoteException {
4606 Parcel data = Parcel.obtain();
4607 Parcel reply = Parcel.obtain();
4608 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004609 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004610 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4611 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004612 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004613 data.recycle();
4614 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004615 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004616 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004617
4618 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4619 Parcel data = Parcel.obtain();
4620 Parcel reply = Parcel.obtain();
4621 data.writeInterfaceToken(IActivityManager.descriptor);
4622 data.writeString(processName);
4623 data.writeInt(uid);
4624 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4625 reply.readException();
4626 data.recycle();
4627 reply.recycle();
4628 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004629
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004630 public void overridePendingTransition(IBinder token, String packageName,
4631 int enterAnim, int exitAnim) throws RemoteException {
4632 Parcel data = Parcel.obtain();
4633 Parcel reply = Parcel.obtain();
4634 data.writeInterfaceToken(IActivityManager.descriptor);
4635 data.writeStrongBinder(token);
4636 data.writeString(packageName);
4637 data.writeInt(enterAnim);
4638 data.writeInt(exitAnim);
4639 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4640 reply.readException();
4641 data.recycle();
4642 reply.recycle();
4643 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004644
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004645 public boolean isUserAMonkey() throws RemoteException {
4646 Parcel data = Parcel.obtain();
4647 Parcel reply = Parcel.obtain();
4648 data.writeInterfaceToken(IActivityManager.descriptor);
4649 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4650 reply.readException();
4651 boolean res = reply.readInt() != 0;
4652 data.recycle();
4653 reply.recycle();
4654 return res;
4655 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004656
4657 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4658 Parcel data = Parcel.obtain();
4659 Parcel reply = Parcel.obtain();
4660 data.writeInterfaceToken(IActivityManager.descriptor);
4661 data.writeInt(monkey ? 1 : 0);
4662 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4663 reply.readException();
4664 data.recycle();
4665 reply.recycle();
4666 }
4667
Dianne Hackborn860755f2010-06-03 18:47:52 -07004668 public void finishHeavyWeightApp() throws RemoteException {
4669 Parcel data = Parcel.obtain();
4670 Parcel reply = Parcel.obtain();
4671 data.writeInterfaceToken(IActivityManager.descriptor);
4672 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4673 reply.readException();
4674 data.recycle();
4675 reply.recycle();
4676 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004677
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004678 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004679 throws RemoteException {
4680 Parcel data = Parcel.obtain();
4681 Parcel reply = Parcel.obtain();
4682 data.writeInterfaceToken(IActivityManager.descriptor);
4683 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004684 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4685 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004686 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004687 data.recycle();
4688 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004689 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004690 }
4691
Craig Mautner233ceee2014-05-09 17:05:11 -07004692 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004693 throws RemoteException {
4694 Parcel data = Parcel.obtain();
4695 Parcel reply = Parcel.obtain();
4696 data.writeInterfaceToken(IActivityManager.descriptor);
4697 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004698 if (options == null) {
4699 data.writeInt(0);
4700 } else {
4701 data.writeInt(1);
4702 data.writeBundle(options.toBundle());
4703 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004704 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004705 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004706 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004707 data.recycle();
4708 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004709 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004710 }
4711
Craig Mautner233ceee2014-05-09 17:05:11 -07004712 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4713 Parcel data = Parcel.obtain();
4714 Parcel reply = Parcel.obtain();
4715 data.writeInterfaceToken(IActivityManager.descriptor);
4716 data.writeStrongBinder(token);
4717 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4718 reply.readException();
4719 Bundle bundle = reply.readBundle();
4720 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4721 data.recycle();
4722 reply.recycle();
4723 return options;
4724 }
4725
Daniel Sandler69a48172010-06-23 16:29:36 -04004726 public void setImmersive(IBinder token, boolean immersive)
4727 throws RemoteException {
4728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
4731 data.writeStrongBinder(token);
4732 data.writeInt(immersive ? 1 : 0);
4733 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4734 reply.readException();
4735 data.recycle();
4736 reply.recycle();
4737 }
4738
4739 public boolean isImmersive(IBinder token)
4740 throws RemoteException {
4741 Parcel data = Parcel.obtain();
4742 Parcel reply = Parcel.obtain();
4743 data.writeInterfaceToken(IActivityManager.descriptor);
4744 data.writeStrongBinder(token);
4745 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004746 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004747 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004748 data.recycle();
4749 reply.recycle();
4750 return res;
4751 }
4752
Craig Mautnerd61dc202014-07-07 11:09:11 -07004753 public boolean isTopOfTask(IBinder token) throws RemoteException {
4754 Parcel data = Parcel.obtain();
4755 Parcel reply = Parcel.obtain();
4756 data.writeInterfaceToken(IActivityManager.descriptor);
4757 data.writeStrongBinder(token);
4758 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4759 reply.readException();
4760 boolean res = reply.readInt() == 1;
4761 data.recycle();
4762 reply.recycle();
4763 return res;
4764 }
4765
Daniel Sandler69a48172010-06-23 16:29:36 -04004766 public boolean isTopActivityImmersive()
4767 throws RemoteException {
4768 Parcel data = Parcel.obtain();
4769 Parcel reply = Parcel.obtain();
4770 data.writeInterfaceToken(IActivityManager.descriptor);
4771 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004772 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004773 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004774 data.recycle();
4775 reply.recycle();
4776 return res;
4777 }
4778
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004779 public void crashApplication(int uid, int initialPid, String packageName,
4780 String message) throws RemoteException {
4781 Parcel data = Parcel.obtain();
4782 Parcel reply = Parcel.obtain();
4783 data.writeInterfaceToken(IActivityManager.descriptor);
4784 data.writeInt(uid);
4785 data.writeInt(initialPid);
4786 data.writeString(packageName);
4787 data.writeString(message);
4788 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4789 reply.readException();
4790 data.recycle();
4791 reply.recycle();
4792 }
Andy McFadden824c5102010-07-09 16:26:57 -07004793
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004794 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004795 Parcel data = Parcel.obtain();
4796 Parcel reply = Parcel.obtain();
4797 data.writeInterfaceToken(IActivityManager.descriptor);
4798 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004799 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004800 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4801 reply.readException();
4802 String res = reply.readString();
4803 data.recycle();
4804 reply.recycle();
4805 return res;
4806 }
4807
Dianne Hackborn7e269642010-08-25 19:50:20 -07004808 public IBinder newUriPermissionOwner(String name)
4809 throws RemoteException {
4810 Parcel data = Parcel.obtain();
4811 Parcel reply = Parcel.obtain();
4812 data.writeInterfaceToken(IActivityManager.descriptor);
4813 data.writeString(name);
4814 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4815 reply.readException();
4816 IBinder res = reply.readStrongBinder();
4817 data.recycle();
4818 reply.recycle();
4819 return res;
4820 }
4821
4822 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004823 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004824 Parcel data = Parcel.obtain();
4825 Parcel reply = Parcel.obtain();
4826 data.writeInterfaceToken(IActivityManager.descriptor);
4827 data.writeStrongBinder(owner);
4828 data.writeInt(fromUid);
4829 data.writeString(targetPkg);
4830 uri.writeToParcel(data, 0);
4831 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004832 data.writeInt(sourceUserId);
4833 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004834 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4835 reply.readException();
4836 data.recycle();
4837 reply.recycle();
4838 }
4839
4840 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004841 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004842 Parcel data = Parcel.obtain();
4843 Parcel reply = Parcel.obtain();
4844 data.writeInterfaceToken(IActivityManager.descriptor);
4845 data.writeStrongBinder(owner);
4846 if (uri != null) {
4847 data.writeInt(1);
4848 uri.writeToParcel(data, 0);
4849 } else {
4850 data.writeInt(0);
4851 }
4852 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004853 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004854 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4855 reply.readException();
4856 data.recycle();
4857 reply.recycle();
4858 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004859
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004860 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004861 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004862 Parcel data = Parcel.obtain();
4863 Parcel reply = Parcel.obtain();
4864 data.writeInterfaceToken(IActivityManager.descriptor);
4865 data.writeInt(callingUid);
4866 data.writeString(targetPkg);
4867 uri.writeToParcel(data, 0);
4868 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004869 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004870 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4871 reply.readException();
4872 int res = reply.readInt();
4873 data.recycle();
4874 reply.recycle();
4875 return res;
4876 }
4877
Dianne Hackborn1676c852012-09-10 14:52:30 -07004878 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004879 String path, ParcelFileDescriptor fd) throws RemoteException {
4880 Parcel data = Parcel.obtain();
4881 Parcel reply = Parcel.obtain();
4882 data.writeInterfaceToken(IActivityManager.descriptor);
4883 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004884 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004885 data.writeInt(managed ? 1 : 0);
4886 data.writeString(path);
4887 if (fd != null) {
4888 data.writeInt(1);
4889 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4890 } else {
4891 data.writeInt(0);
4892 }
4893 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4894 reply.readException();
4895 boolean res = reply.readInt() != 0;
4896 reply.recycle();
4897 data.recycle();
4898 return res;
4899 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004900
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004901 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004902 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004903 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004904 Parcel data = Parcel.obtain();
4905 Parcel reply = Parcel.obtain();
4906 data.writeInterfaceToken(IActivityManager.descriptor);
4907 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004908 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004909 data.writeTypedArray(intents, 0);
4910 data.writeStringArray(resolvedTypes);
4911 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004912 if (options != null) {
4913 data.writeInt(1);
4914 options.writeToParcel(data, 0);
4915 } else {
4916 data.writeInt(0);
4917 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004918 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004919 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4920 reply.readException();
4921 int result = reply.readInt();
4922 reply.recycle();
4923 data.recycle();
4924 return result;
4925 }
4926
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004927 public int getFrontActivityScreenCompatMode() throws RemoteException {
4928 Parcel data = Parcel.obtain();
4929 Parcel reply = Parcel.obtain();
4930 data.writeInterfaceToken(IActivityManager.descriptor);
4931 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4932 reply.readException();
4933 int mode = reply.readInt();
4934 reply.recycle();
4935 data.recycle();
4936 return mode;
4937 }
4938
4939 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4940 Parcel data = Parcel.obtain();
4941 Parcel reply = Parcel.obtain();
4942 data.writeInterfaceToken(IActivityManager.descriptor);
4943 data.writeInt(mode);
4944 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4945 reply.readException();
4946 reply.recycle();
4947 data.recycle();
4948 }
4949
4950 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4951 Parcel data = Parcel.obtain();
4952 Parcel reply = Parcel.obtain();
4953 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004954 data.writeString(packageName);
4955 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004956 reply.readException();
4957 int mode = reply.readInt();
4958 reply.recycle();
4959 data.recycle();
4960 return mode;
4961 }
4962
4963 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004964 throws RemoteException {
4965 Parcel data = Parcel.obtain();
4966 Parcel reply = Parcel.obtain();
4967 data.writeInterfaceToken(IActivityManager.descriptor);
4968 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004969 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004970 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4971 reply.readException();
4972 reply.recycle();
4973 data.recycle();
4974 }
4975
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004976 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4977 Parcel data = Parcel.obtain();
4978 Parcel reply = Parcel.obtain();
4979 data.writeInterfaceToken(IActivityManager.descriptor);
4980 data.writeString(packageName);
4981 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4982 reply.readException();
4983 boolean ask = reply.readInt() != 0;
4984 reply.recycle();
4985 data.recycle();
4986 return ask;
4987 }
4988
4989 public void setPackageAskScreenCompat(String packageName, boolean ask)
4990 throws RemoteException {
4991 Parcel data = Parcel.obtain();
4992 Parcel reply = Parcel.obtain();
4993 data.writeInterfaceToken(IActivityManager.descriptor);
4994 data.writeString(packageName);
4995 data.writeInt(ask ? 1 : 0);
4996 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4997 reply.readException();
4998 reply.recycle();
4999 data.recycle();
5000 }
5001
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005002 public boolean switchUser(int userid) throws RemoteException {
5003 Parcel data = Parcel.obtain();
5004 Parcel reply = Parcel.obtain();
5005 data.writeInterfaceToken(IActivityManager.descriptor);
5006 data.writeInt(userid);
5007 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5008 reply.readException();
5009 boolean result = reply.readInt() != 0;
5010 reply.recycle();
5011 data.recycle();
5012 return result;
5013 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005014
Kenny Guy08488bf2014-02-21 17:40:37 +00005015 public boolean startUserInBackground(int userid) throws RemoteException {
5016 Parcel data = Parcel.obtain();
5017 Parcel reply = Parcel.obtain();
5018 data.writeInterfaceToken(IActivityManager.descriptor);
5019 data.writeInt(userid);
5020 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5021 reply.readException();
5022 boolean result = reply.readInt() != 0;
5023 reply.recycle();
5024 data.recycle();
5025 return result;
5026 }
5027
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005028 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5029 Parcel data = Parcel.obtain();
5030 Parcel reply = Parcel.obtain();
5031 data.writeInterfaceToken(IActivityManager.descriptor);
5032 data.writeInt(userid);
5033 data.writeStrongInterface(callback);
5034 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5035 reply.readException();
5036 int result = reply.readInt();
5037 reply.recycle();
5038 data.recycle();
5039 return result;
5040 }
5041
Amith Yamasani52f1d752012-03-28 18:19:29 -07005042 public UserInfo getCurrentUser() throws RemoteException {
5043 Parcel data = Parcel.obtain();
5044 Parcel reply = Parcel.obtain();
5045 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005046 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005047 reply.readException();
5048 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5049 reply.recycle();
5050 data.recycle();
5051 return userInfo;
5052 }
5053
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005054 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005055 Parcel data = Parcel.obtain();
5056 Parcel reply = Parcel.obtain();
5057 data.writeInterfaceToken(IActivityManager.descriptor);
5058 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005059 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005060 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5061 reply.readException();
5062 boolean result = reply.readInt() != 0;
5063 reply.recycle();
5064 data.recycle();
5065 return result;
5066 }
5067
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005068 public int[] getRunningUserIds() throws RemoteException {
5069 Parcel data = Parcel.obtain();
5070 Parcel reply = Parcel.obtain();
5071 data.writeInterfaceToken(IActivityManager.descriptor);
5072 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5073 reply.readException();
5074 int[] result = reply.createIntArray();
5075 reply.recycle();
5076 data.recycle();
5077 return result;
5078 }
5079
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005080 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005081 Parcel data = Parcel.obtain();
5082 Parcel reply = Parcel.obtain();
5083 data.writeInterfaceToken(IActivityManager.descriptor);
5084 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005085 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5086 reply.readException();
5087 boolean result = reply.readInt() != 0;
5088 reply.recycle();
5089 data.recycle();
5090 return result;
5091 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005092
Jeff Sharkeya4620792011-05-20 15:29:23 -07005093 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5094 Parcel data = Parcel.obtain();
5095 Parcel reply = Parcel.obtain();
5096 data.writeInterfaceToken(IActivityManager.descriptor);
5097 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5098 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5099 reply.readException();
5100 data.recycle();
5101 reply.recycle();
5102 }
5103
5104 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5105 Parcel data = Parcel.obtain();
5106 Parcel reply = Parcel.obtain();
5107 data.writeInterfaceToken(IActivityManager.descriptor);
5108 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5109 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5110 reply.readException();
5111 data.recycle();
5112 reply.recycle();
5113 }
5114
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005115 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5116 Parcel data = Parcel.obtain();
5117 Parcel reply = Parcel.obtain();
5118 data.writeInterfaceToken(IActivityManager.descriptor);
5119 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5120 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5121 reply.readException();
5122 data.recycle();
5123 reply.recycle();
5124 }
5125
5126 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5127 Parcel data = Parcel.obtain();
5128 Parcel reply = Parcel.obtain();
5129 data.writeInterfaceToken(IActivityManager.descriptor);
5130 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5131 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5132 reply.readException();
5133 data.recycle();
5134 reply.recycle();
5135 }
5136
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005137 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5138 Parcel data = Parcel.obtain();
5139 Parcel reply = Parcel.obtain();
5140 data.writeInterfaceToken(IActivityManager.descriptor);
5141 data.writeStrongBinder(sender.asBinder());
5142 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5143 reply.readException();
5144 boolean res = reply.readInt() != 0;
5145 data.recycle();
5146 reply.recycle();
5147 return res;
5148 }
5149
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005150 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5151 Parcel data = Parcel.obtain();
5152 Parcel reply = Parcel.obtain();
5153 data.writeInterfaceToken(IActivityManager.descriptor);
5154 data.writeStrongBinder(sender.asBinder());
5155 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5156 reply.readException();
5157 boolean res = reply.readInt() != 0;
5158 data.recycle();
5159 reply.recycle();
5160 return res;
5161 }
5162
Dianne Hackborn81038902012-11-26 17:04:09 -08005163 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5164 Parcel data = Parcel.obtain();
5165 Parcel reply = Parcel.obtain();
5166 data.writeInterfaceToken(IActivityManager.descriptor);
5167 data.writeStrongBinder(sender.asBinder());
5168 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5169 reply.readException();
5170 Intent res = reply.readInt() != 0
5171 ? Intent.CREATOR.createFromParcel(reply) : null;
5172 data.recycle();
5173 reply.recycle();
5174 return res;
5175 }
5176
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005177 public String getTagForIntentSender(IIntentSender sender, String prefix)
5178 throws RemoteException {
5179 Parcel data = Parcel.obtain();
5180 Parcel reply = Parcel.obtain();
5181 data.writeInterfaceToken(IActivityManager.descriptor);
5182 data.writeStrongBinder(sender.asBinder());
5183 data.writeString(prefix);
5184 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5185 reply.readException();
5186 String res = reply.readString();
5187 data.recycle();
5188 reply.recycle();
5189 return res;
5190 }
5191
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005192 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5193 {
5194 Parcel data = Parcel.obtain();
5195 Parcel reply = Parcel.obtain();
5196 data.writeInterfaceToken(IActivityManager.descriptor);
5197 values.writeToParcel(data, 0);
5198 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5199 reply.readException();
5200 data.recycle();
5201 reply.recycle();
5202 }
5203
Dianne Hackbornb437e092011-08-05 17:50:29 -07005204 public long[] getProcessPss(int[] pids) throws RemoteException {
5205 Parcel data = Parcel.obtain();
5206 Parcel reply = Parcel.obtain();
5207 data.writeInterfaceToken(IActivityManager.descriptor);
5208 data.writeIntArray(pids);
5209 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5210 reply.readException();
5211 long[] res = reply.createLongArray();
5212 data.recycle();
5213 reply.recycle();
5214 return res;
5215 }
5216
Dianne Hackborn661cd522011-08-22 00:26:20 -07005217 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5218 Parcel data = Parcel.obtain();
5219 Parcel reply = Parcel.obtain();
5220 data.writeInterfaceToken(IActivityManager.descriptor);
5221 TextUtils.writeToParcel(msg, data, 0);
5222 data.writeInt(always ? 1 : 0);
5223 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5224 reply.readException();
5225 data.recycle();
5226 reply.recycle();
5227 }
5228
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005229 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005230 Parcel data = Parcel.obtain();
5231 Parcel reply = Parcel.obtain();
5232 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005233 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005234 reply.readException();
5235 data.recycle();
5236 reply.recycle();
5237 }
5238
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005239 public void keyguardGoingAway(boolean disableWindowAnimations,
5240 boolean keyguardGoingToNotificationShade) throws RemoteException {
5241 Parcel data = Parcel.obtain();
5242 Parcel reply = Parcel.obtain();
5243 data.writeInterfaceToken(IActivityManager.descriptor);
5244 data.writeInt(disableWindowAnimations ? 1 : 0);
5245 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5246 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5247 reply.readException();
5248 data.recycle();
5249 reply.recycle();
5250 }
5251
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005252 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005253 throws RemoteException {
5254 Parcel data = Parcel.obtain();
5255 Parcel reply = Parcel.obtain();
5256 data.writeInterfaceToken(IActivityManager.descriptor);
5257 data.writeStrongBinder(token);
5258 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005259 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005260 reply.readException();
5261 boolean result = reply.readInt() != 0;
5262 data.recycle();
5263 reply.recycle();
5264 return result;
5265 }
5266
5267 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5268 throws RemoteException {
5269 Parcel data = Parcel.obtain();
5270 Parcel reply = Parcel.obtain();
5271 data.writeInterfaceToken(IActivityManager.descriptor);
5272 data.writeStrongBinder(token);
5273 target.writeToParcel(data, 0);
5274 data.writeInt(resultCode);
5275 if (resultData != null) {
5276 data.writeInt(1);
5277 resultData.writeToParcel(data, 0);
5278 } else {
5279 data.writeInt(0);
5280 }
5281 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5282 reply.readException();
5283 boolean result = reply.readInt() != 0;
5284 data.recycle();
5285 reply.recycle();
5286 return result;
5287 }
5288
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005289 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5290 Parcel data = Parcel.obtain();
5291 Parcel reply = Parcel.obtain();
5292 data.writeInterfaceToken(IActivityManager.descriptor);
5293 data.writeStrongBinder(activityToken);
5294 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5295 reply.readException();
5296 int result = reply.readInt();
5297 data.recycle();
5298 reply.recycle();
5299 return result;
5300 }
5301
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005302 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5303 Parcel data = Parcel.obtain();
5304 Parcel reply = Parcel.obtain();
5305 data.writeInterfaceToken(IActivityManager.descriptor);
5306 data.writeStrongBinder(activityToken);
5307 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5308 reply.readException();
5309 String result = reply.readString();
5310 data.recycle();
5311 reply.recycle();
5312 return result;
5313 }
5314
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005315 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5316 Parcel data = Parcel.obtain();
5317 Parcel reply = Parcel.obtain();
5318 data.writeInterfaceToken(IActivityManager.descriptor);
5319 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5320 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5321 reply.readException();
5322 data.recycle();
5323 reply.recycle();
5324 }
5325
5326 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5327 Parcel data = Parcel.obtain();
5328 Parcel reply = Parcel.obtain();
5329 data.writeInterfaceToken(IActivityManager.descriptor);
5330 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5331 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5332 reply.readException();
5333 data.recycle();
5334 reply.recycle();
5335 }
5336
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005337 public void requestBugReport() throws RemoteException {
5338 Parcel data = Parcel.obtain();
5339 Parcel reply = Parcel.obtain();
5340 data.writeInterfaceToken(IActivityManager.descriptor);
5341 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5342 reply.readException();
5343 data.recycle();
5344 reply.recycle();
5345 }
5346
Jeff Brownbd181bb2013-09-10 16:44:24 -07005347 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5348 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005349 Parcel data = Parcel.obtain();
5350 Parcel reply = Parcel.obtain();
5351 data.writeInterfaceToken(IActivityManager.descriptor);
5352 data.writeInt(pid);
5353 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005354 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005355 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5356 reply.readException();
5357 long res = reply.readInt();
5358 data.recycle();
5359 reply.recycle();
5360 return res;
5361 }
5362
Adam Skorydfc7fd72013-08-05 19:23:41 -07005363 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005364 Parcel data = Parcel.obtain();
5365 Parcel reply = Parcel.obtain();
5366 data.writeInterfaceToken(IActivityManager.descriptor);
5367 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005368 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005369 reply.readException();
5370 Bundle res = reply.readBundle();
5371 data.recycle();
5372 reply.recycle();
5373 return res;
5374 }
5375
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005376 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5377 throws RemoteException {
5378 Parcel data = Parcel.obtain();
5379 Parcel reply = Parcel.obtain();
5380 data.writeInterfaceToken(IActivityManager.descriptor);
5381 data.writeInt(requestType);
5382 data.writeStrongBinder(receiver.asBinder());
5383 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5384 reply.readException();
5385 data.recycle();
5386 reply.recycle();
5387 }
5388
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005389 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005390 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005391 Parcel data = Parcel.obtain();
5392 Parcel reply = Parcel.obtain();
5393 data.writeInterfaceToken(IActivityManager.descriptor);
5394 data.writeStrongBinder(token);
5395 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005396 structure.writeToParcel(data, 0);
5397 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005398 if (referrer != null) {
5399 data.writeInt(1);
5400 referrer.writeToParcel(data, 0);
5401 } else {
5402 data.writeInt(0);
5403 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005404 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005405 reply.readException();
5406 data.recycle();
5407 reply.recycle();
5408 }
5409
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005410 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5411 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005412 Parcel data = Parcel.obtain();
5413 Parcel reply = Parcel.obtain();
5414 data.writeInterfaceToken(IActivityManager.descriptor);
5415 intent.writeToParcel(data, 0);
5416 data.writeInt(requestType);
5417 data.writeString(hint);
5418 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005419 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005420 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5421 reply.readException();
5422 boolean res = reply.readInt() != 0;
5423 data.recycle();
5424 reply.recycle();
5425 return res;
5426 }
5427
Benjamin Franzc200f442015-06-25 18:20:04 +01005428 public boolean isScreenCaptureAllowedOnCurrentActivity() throws RemoteException {
5429 Parcel data = Parcel.obtain();
5430 Parcel reply = Parcel.obtain();
5431 data.writeInterfaceToken(IActivityManager.descriptor);
5432 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5433 reply.readException();
5434 boolean res = reply.readInt() != 0;
5435 data.recycle();
5436 reply.recycle();
5437 return res;
5438 }
5439
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005440 public void killUid(int uid, String reason) throws RemoteException {
5441 Parcel data = Parcel.obtain();
5442 Parcel reply = Parcel.obtain();
5443 data.writeInterfaceToken(IActivityManager.descriptor);
5444 data.writeInt(uid);
5445 data.writeString(reason);
5446 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5447 reply.readException();
5448 data.recycle();
5449 reply.recycle();
5450 }
5451
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005452 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5453 Parcel data = Parcel.obtain();
5454 Parcel reply = Parcel.obtain();
5455 data.writeInterfaceToken(IActivityManager.descriptor);
5456 data.writeStrongBinder(who);
5457 data.writeInt(allowRestart ? 1 : 0);
5458 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5459 reply.readException();
5460 data.recycle();
5461 reply.recycle();
5462 }
5463
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005464 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5465 Parcel data = Parcel.obtain();
5466 Parcel reply = Parcel.obtain();
5467 data.writeInterfaceToken(IActivityManager.descriptor);
5468 data.writeStrongBinder(token);
5469 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5470 reply.readException();
5471 data.recycle();
5472 reply.recycle();
5473 }
5474
Craig Mautner5eda9b32013-07-02 11:58:16 -07005475 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5476 Parcel data = Parcel.obtain();
5477 Parcel reply = Parcel.obtain();
5478 data.writeInterfaceToken(IActivityManager.descriptor);
5479 data.writeStrongBinder(token);
5480 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5481 reply.readException();
5482 data.recycle();
5483 reply.recycle();
5484 }
5485
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005486 public void restart() throws RemoteException {
5487 Parcel data = Parcel.obtain();
5488 Parcel reply = Parcel.obtain();
5489 data.writeInterfaceToken(IActivityManager.descriptor);
5490 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5491 reply.readException();
5492 data.recycle();
5493 reply.recycle();
5494 }
5495
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005496 public void performIdleMaintenance() throws RemoteException {
5497 Parcel data = Parcel.obtain();
5498 Parcel reply = Parcel.obtain();
5499 data.writeInterfaceToken(IActivityManager.descriptor);
5500 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5501 reply.readException();
5502 data.recycle();
5503 reply.recycle();
5504 }
5505
Todd Kennedyca4d8422015-01-15 15:19:22 -08005506 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005507 IActivityContainerCallback callback) throws RemoteException {
5508 Parcel data = Parcel.obtain();
5509 Parcel reply = Parcel.obtain();
5510 data.writeInterfaceToken(IActivityManager.descriptor);
5511 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005512 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005513 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005514 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005515 final int result = reply.readInt();
5516 final IActivityContainer res;
5517 if (result == 1) {
5518 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5519 } else {
5520 res = null;
5521 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005522 data.recycle();
5523 reply.recycle();
5524 return res;
5525 }
5526
Craig Mautner95da1082014-02-24 17:54:35 -08005527 public void deleteActivityContainer(IActivityContainer activityContainer)
5528 throws RemoteException {
5529 Parcel data = Parcel.obtain();
5530 Parcel reply = Parcel.obtain();
5531 data.writeInterfaceToken(IActivityManager.descriptor);
5532 data.writeStrongBinder(activityContainer.asBinder());
5533 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5534 reply.readException();
5535 data.recycle();
5536 reply.recycle();
5537 }
5538
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005539 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005540 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5541 Parcel data = Parcel.obtain();
5542 Parcel reply = Parcel.obtain();
5543 data.writeInterfaceToken(IActivityManager.descriptor);
5544 data.writeInt(displayId);
5545 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5546 reply.readException();
5547 final int result = reply.readInt();
5548 final IActivityContainer res;
5549 if (result == 1) {
5550 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5551 } else {
5552 res = null;
5553 }
5554 data.recycle();
5555 reply.recycle();
5556 return res;
5557 }
5558
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005559 @Override
5560 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005561 throws RemoteException {
5562 Parcel data = Parcel.obtain();
5563 Parcel reply = Parcel.obtain();
5564 data.writeInterfaceToken(IActivityManager.descriptor);
5565 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005566 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005567 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005568 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005569 data.recycle();
5570 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005571 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005572 }
5573
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005574 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005575 public void startLockTaskMode(int taskId) throws RemoteException {
5576 Parcel data = Parcel.obtain();
5577 Parcel reply = Parcel.obtain();
5578 data.writeInterfaceToken(IActivityManager.descriptor);
5579 data.writeInt(taskId);
5580 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5581 reply.readException();
5582 data.recycle();
5583 reply.recycle();
5584 }
5585
5586 @Override
5587 public void startLockTaskMode(IBinder token) throws RemoteException {
5588 Parcel data = Parcel.obtain();
5589 Parcel reply = Parcel.obtain();
5590 data.writeInterfaceToken(IActivityManager.descriptor);
5591 data.writeStrongBinder(token);
5592 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5593 reply.readException();
5594 data.recycle();
5595 reply.recycle();
5596 }
5597
5598 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005599 public void startLockTaskModeOnCurrent() throws RemoteException {
5600 Parcel data = Parcel.obtain();
5601 Parcel reply = Parcel.obtain();
5602 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005603 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005604 reply.readException();
5605 data.recycle();
5606 reply.recycle();
5607 }
5608
5609 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005610 public void stopLockTaskMode() throws RemoteException {
5611 Parcel data = Parcel.obtain();
5612 Parcel reply = Parcel.obtain();
5613 data.writeInterfaceToken(IActivityManager.descriptor);
5614 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5615 reply.readException();
5616 data.recycle();
5617 reply.recycle();
5618 }
5619
5620 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005621 public void stopLockTaskModeOnCurrent() throws RemoteException {
5622 Parcel data = Parcel.obtain();
5623 Parcel reply = Parcel.obtain();
5624 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005625 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005626 reply.readException();
5627 data.recycle();
5628 reply.recycle();
5629 }
5630
5631 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005632 public boolean isInLockTaskMode() throws RemoteException {
5633 Parcel data = Parcel.obtain();
5634 Parcel reply = Parcel.obtain();
5635 data.writeInterfaceToken(IActivityManager.descriptor);
5636 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5637 reply.readException();
5638 boolean isInLockTaskMode = reply.readInt() == 1;
5639 data.recycle();
5640 reply.recycle();
5641 return isInLockTaskMode;
5642 }
5643
Craig Mautner688b5102014-03-27 16:55:03 -07005644 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005645 public int getLockTaskModeState() throws RemoteException {
5646 Parcel data = Parcel.obtain();
5647 Parcel reply = Parcel.obtain();
5648 data.writeInterfaceToken(IActivityManager.descriptor);
5649 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5650 reply.readException();
5651 int lockTaskModeState = reply.readInt();
5652 data.recycle();
5653 reply.recycle();
5654 return lockTaskModeState;
5655 }
5656
5657 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005658 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5659 Parcel data = Parcel.obtain();
5660 Parcel reply = Parcel.obtain();
5661 data.writeInterfaceToken(IActivityManager.descriptor);
5662 data.writeStrongBinder(token);
5663 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5664 IBinder.FLAG_ONEWAY);
5665 reply.readException();
5666 data.recycle();
5667 reply.recycle();
5668 }
5669
5670 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005671 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005672 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005673 Parcel data = Parcel.obtain();
5674 Parcel reply = Parcel.obtain();
5675 data.writeInterfaceToken(IActivityManager.descriptor);
5676 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005677 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005678 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005679 reply.readException();
5680 data.recycle();
5681 reply.recycle();
5682 }
5683
Craig Mautneree2e45a2014-06-27 12:10:03 -07005684 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005685 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5686 Parcel data = Parcel.obtain();
5687 Parcel reply = Parcel.obtain();
5688 data.writeInterfaceToken(IActivityManager.descriptor);
5689 data.writeInt(taskId);
5690 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005691 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005692 reply.readException();
5693 data.recycle();
5694 reply.recycle();
5695 }
5696
5697 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005698 public void resizeTask(int taskId, Rect r) throws RemoteException
5699 {
5700 Parcel data = Parcel.obtain();
5701 Parcel reply = Parcel.obtain();
5702 data.writeInterfaceToken(IActivityManager.descriptor);
5703 data.writeInt(taskId);
5704 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005705 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005706 reply.readException();
5707 data.recycle();
5708 reply.recycle();
5709 }
5710
5711 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005712 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5713 Parcel data = Parcel.obtain();
5714 Parcel reply = Parcel.obtain();
5715 data.writeInterfaceToken(IActivityManager.descriptor);
5716 data.writeString(filename);
5717 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5718 reply.readException();
5719 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5720 data.recycle();
5721 reply.recycle();
5722 return icon;
5723 }
5724
5725 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005726 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5727 throws RemoteException {
5728 Parcel data = Parcel.obtain();
5729 Parcel reply = Parcel.obtain();
5730 data.writeInterfaceToken(IActivityManager.descriptor);
5731 if (options == null) {
5732 data.writeInt(0);
5733 } else {
5734 data.writeInt(1);
5735 data.writeBundle(options.toBundle());
5736 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005737 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005738 reply.readException();
5739 data.recycle();
5740 reply.recycle();
5741 }
5742
5743 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005744 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005745 Parcel data = Parcel.obtain();
5746 Parcel reply = Parcel.obtain();
5747 data.writeInterfaceToken(IActivityManager.descriptor);
5748 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005749 data.writeInt(visible ? 1 : 0);
5750 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005751 reply.readException();
5752 boolean success = reply.readInt() > 0;
5753 data.recycle();
5754 reply.recycle();
5755 return success;
5756 }
5757
5758 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005759 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005760 Parcel data = Parcel.obtain();
5761 Parcel reply = Parcel.obtain();
5762 data.writeInterfaceToken(IActivityManager.descriptor);
5763 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005764 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005765 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005766 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005767 data.recycle();
5768 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005769 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005770 }
5771
5772 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005773 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005774 Parcel data = Parcel.obtain();
5775 Parcel reply = Parcel.obtain();
5776 data.writeInterfaceToken(IActivityManager.descriptor);
5777 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005778 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005779 reply.readException();
5780 data.recycle();
5781 reply.recycle();
5782 }
5783
5784 @Override
5785 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5786 Parcel data = Parcel.obtain();
5787 Parcel reply = Parcel.obtain();
5788 data.writeInterfaceToken(IActivityManager.descriptor);
5789 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005790 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005791 reply.readException();
5792 data.recycle();
5793 reply.recycle();
5794 }
5795
Craig Mautner8746a472014-07-24 15:12:54 -07005796 @Override
5797 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5798 Parcel data = Parcel.obtain();
5799 Parcel reply = Parcel.obtain();
5800 data.writeInterfaceToken(IActivityManager.descriptor);
5801 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005802 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005803 reply.readException();
5804 data.recycle();
5805 reply.recycle();
5806 }
5807
Craig Mautner6e2f3952014-09-09 14:26:41 -07005808 @Override
5809 public void bootAnimationComplete() throws RemoteException {
5810 Parcel data = Parcel.obtain();
5811 Parcel reply = Parcel.obtain();
5812 data.writeInterfaceToken(IActivityManager.descriptor);
5813 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5814 reply.readException();
5815 data.recycle();
5816 reply.recycle();
5817 }
5818
Wale Ogunwale18795a22014-12-03 11:38:33 -08005819 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005820 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5821 Parcel data = Parcel.obtain();
5822 Parcel reply = Parcel.obtain();
5823 data.writeInterfaceToken(IActivityManager.descriptor);
5824 data.writeInt(uid);
5825 data.writeByteArray(firstPacket);
5826 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5827 reply.readException();
5828 data.recycle();
5829 reply.recycle();
5830 }
5831
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005832 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005833 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5834 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005835 Parcel data = Parcel.obtain();
5836 Parcel reply = Parcel.obtain();
5837 data.writeInterfaceToken(IActivityManager.descriptor);
5838 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005839 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005840 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005841 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005842 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5843 reply.readException();
5844 data.recycle();
5845 reply.recycle();
5846 }
5847
5848 @Override
5849 public void dumpHeapFinished(String path) throws RemoteException {
5850 Parcel data = Parcel.obtain();
5851 Parcel reply = Parcel.obtain();
5852 data.writeInterfaceToken(IActivityManager.descriptor);
5853 data.writeString(path);
5854 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5855 reply.readException();
5856 data.recycle();
5857 reply.recycle();
5858 }
5859
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005860 @Override
5861 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5862 throws RemoteException {
5863 Parcel data = Parcel.obtain();
5864 Parcel reply = Parcel.obtain();
5865 data.writeInterfaceToken(IActivityManager.descriptor);
5866 data.writeStrongBinder(session.asBinder());
5867 data.writeInt(keepAwake ? 1 : 0);
5868 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5869 reply.readException();
5870 data.recycle();
5871 reply.recycle();
5872 }
5873
Craig Mautnere5600772015-04-03 21:36:37 -07005874 @Override
5875 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5876 Parcel data = Parcel.obtain();
5877 Parcel reply = Parcel.obtain();
5878 data.writeInterfaceToken(IActivityManager.descriptor);
5879 data.writeInt(userId);
5880 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005881 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005882 reply.readException();
5883 data.recycle();
5884 reply.recycle();
5885 }
5886
Dianne Hackborn1e383822015-04-10 14:02:33 -07005887 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07005888 public void updateDeviceOwner(String packageName) throws RemoteException {
5889 Parcel data = Parcel.obtain();
5890 Parcel reply = Parcel.obtain();
5891 data.writeInterfaceToken(IActivityManager.descriptor);
5892 data.writeString(packageName);
5893 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
5894 reply.readException();
5895 data.recycle();
5896 reply.recycle();
5897 }
5898
5899 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07005900 public int getPackageProcessState(String packageName, String callingPackage)
5901 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07005902 Parcel data = Parcel.obtain();
5903 Parcel reply = Parcel.obtain();
5904 data.writeInterfaceToken(IActivityManager.descriptor);
5905 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07005906 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005907 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5908 reply.readException();
5909 int res = reply.readInt();
5910 data.recycle();
5911 reply.recycle();
5912 return res;
5913 }
5914
Stefan Kuhne16045c22015-06-05 07:18:06 -07005915 @Override
5916 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
5917 throws RemoteException {
5918 Parcel data = Parcel.obtain();
5919 Parcel reply = Parcel.obtain();
5920 data.writeInterfaceToken(IActivityManager.descriptor);
5921 data.writeString(process);
5922 data.writeInt(userId);
5923 data.writeInt(level);
5924 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
5925 reply.readException();
5926 int res = reply.readInt();
5927 data.recycle();
5928 reply.recycle();
5929 return res != 0;
5930 }
5931
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005932 private IBinder mRemote;
5933}