blob: 680feae0b831a8a9d4045dbfb2656905713d616d [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();
459 String perm = data.readString();
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,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800466 resultCode, resultData, resultExtras, perm, 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();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700924 int userId = data.readInt();
925 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 reply.writeNoException();
927 ComponentName.writeToParcel(cn, reply);
928 return true;
929 }
930
931 case STOP_SERVICE_TRANSACTION: {
932 data.enforceInterface(IActivityManager.descriptor);
933 IBinder b = data.readStrongBinder();
934 IApplicationThread app = ApplicationThreadNative.asInterface(b);
935 Intent service = Intent.CREATOR.createFromParcel(data);
936 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700937 int userId = data.readInt();
938 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 reply.writeNoException();
940 reply.writeInt(res);
941 return true;
942 }
943
944 case STOP_SERVICE_TOKEN_TRANSACTION: {
945 data.enforceInterface(IActivityManager.descriptor);
946 ComponentName className = ComponentName.readFromParcel(data);
947 IBinder token = data.readStrongBinder();
948 int startId = data.readInt();
949 boolean res = stopServiceToken(className, token, startId);
950 reply.writeNoException();
951 reply.writeInt(res ? 1 : 0);
952 return true;
953 }
954
955 case SET_SERVICE_FOREGROUND_TRANSACTION: {
956 data.enforceInterface(IActivityManager.descriptor);
957 ComponentName className = ComponentName.readFromParcel(data);
958 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700959 int id = data.readInt();
960 Notification notification = null;
961 if (data.readInt() != 0) {
962 notification = Notification.CREATOR.createFromParcel(data);
963 }
964 boolean removeNotification = data.readInt() != 0;
965 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800966 reply.writeNoException();
967 return true;
968 }
969
970 case BIND_SERVICE_TRANSACTION: {
971 data.enforceInterface(IActivityManager.descriptor);
972 IBinder b = data.readStrongBinder();
973 IApplicationThread app = ApplicationThreadNative.asInterface(b);
974 IBinder token = data.readStrongBinder();
975 Intent service = Intent.CREATOR.createFromParcel(data);
976 String resolvedType = data.readString();
977 b = data.readStrongBinder();
978 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800979 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800980 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800981 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800982 reply.writeNoException();
983 reply.writeInt(res);
984 return true;
985 }
986
987 case UNBIND_SERVICE_TRANSACTION: {
988 data.enforceInterface(IActivityManager.descriptor);
989 IBinder b = data.readStrongBinder();
990 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
991 boolean res = unbindService(conn);
992 reply.writeNoException();
993 reply.writeInt(res ? 1 : 0);
994 return true;
995 }
996
997 case PUBLISH_SERVICE_TRANSACTION: {
998 data.enforceInterface(IActivityManager.descriptor);
999 IBinder token = data.readStrongBinder();
1000 Intent intent = Intent.CREATOR.createFromParcel(data);
1001 IBinder service = data.readStrongBinder();
1002 publishService(token, intent, service);
1003 reply.writeNoException();
1004 return true;
1005 }
1006
1007 case UNBIND_FINISHED_TRANSACTION: {
1008 data.enforceInterface(IActivityManager.descriptor);
1009 IBinder token = data.readStrongBinder();
1010 Intent intent = Intent.CREATOR.createFromParcel(data);
1011 boolean doRebind = data.readInt() != 0;
1012 unbindFinished(token, intent, doRebind);
1013 reply.writeNoException();
1014 return true;
1015 }
1016
1017 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1018 data.enforceInterface(IActivityManager.descriptor);
1019 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001020 int type = data.readInt();
1021 int startId = data.readInt();
1022 int res = data.readInt();
1023 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 reply.writeNoException();
1025 return true;
1026 }
1027
1028 case START_INSTRUMENTATION_TRANSACTION: {
1029 data.enforceInterface(IActivityManager.descriptor);
1030 ComponentName className = ComponentName.readFromParcel(data);
1031 String profileFile = data.readString();
1032 int fl = data.readInt();
1033 Bundle arguments = data.readBundle();
1034 IBinder b = data.readStrongBinder();
1035 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001036 b = data.readStrongBinder();
1037 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001038 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001039 String abiOverride = data.readString();
1040 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1041 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001042 reply.writeNoException();
1043 reply.writeInt(res ? 1 : 0);
1044 return true;
1045 }
1046
1047
1048 case FINISH_INSTRUMENTATION_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 IBinder b = data.readStrongBinder();
1051 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1052 int resultCode = data.readInt();
1053 Bundle results = data.readBundle();
1054 finishInstrumentation(app, resultCode, results);
1055 reply.writeNoException();
1056 return true;
1057 }
1058
1059 case GET_CONFIGURATION_TRANSACTION: {
1060 data.enforceInterface(IActivityManager.descriptor);
1061 Configuration config = getConfiguration();
1062 reply.writeNoException();
1063 config.writeToParcel(reply, 0);
1064 return true;
1065 }
1066
1067 case UPDATE_CONFIGURATION_TRANSACTION: {
1068 data.enforceInterface(IActivityManager.descriptor);
1069 Configuration config = Configuration.CREATOR.createFromParcel(data);
1070 updateConfiguration(config);
1071 reply.writeNoException();
1072 return true;
1073 }
1074
1075 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1076 data.enforceInterface(IActivityManager.descriptor);
1077 IBinder token = data.readStrongBinder();
1078 int requestedOrientation = data.readInt();
1079 setRequestedOrientation(token, requestedOrientation);
1080 reply.writeNoException();
1081 return true;
1082 }
1083
1084 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1085 data.enforceInterface(IActivityManager.descriptor);
1086 IBinder token = data.readStrongBinder();
1087 int req = getRequestedOrientation(token);
1088 reply.writeNoException();
1089 reply.writeInt(req);
1090 return true;
1091 }
1092
1093 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1094 data.enforceInterface(IActivityManager.descriptor);
1095 IBinder token = data.readStrongBinder();
1096 ComponentName cn = getActivityClassForToken(token);
1097 reply.writeNoException();
1098 ComponentName.writeToParcel(cn, reply);
1099 return true;
1100 }
1101
1102 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1103 data.enforceInterface(IActivityManager.descriptor);
1104 IBinder token = data.readStrongBinder();
1105 reply.writeNoException();
1106 reply.writeString(getPackageForToken(token));
1107 return true;
1108 }
1109
1110 case GET_INTENT_SENDER_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 int type = data.readInt();
1113 String packageName = data.readString();
1114 IBinder token = data.readStrongBinder();
1115 String resultWho = data.readString();
1116 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001117 Intent[] requestIntents;
1118 String[] requestResolvedTypes;
1119 if (data.readInt() != 0) {
1120 requestIntents = data.createTypedArray(Intent.CREATOR);
1121 requestResolvedTypes = data.createStringArray();
1122 } else {
1123 requestIntents = null;
1124 requestResolvedTypes = null;
1125 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001126 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001127 Bundle options = data.readInt() != 0
1128 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001129 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001131 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001132 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 reply.writeNoException();
1134 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1135 return true;
1136 }
1137
1138 case CANCEL_INTENT_SENDER_TRANSACTION: {
1139 data.enforceInterface(IActivityManager.descriptor);
1140 IIntentSender r = IIntentSender.Stub.asInterface(
1141 data.readStrongBinder());
1142 cancelIntentSender(r);
1143 reply.writeNoException();
1144 return true;
1145 }
1146
1147 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1148 data.enforceInterface(IActivityManager.descriptor);
1149 IIntentSender r = IIntentSender.Stub.asInterface(
1150 data.readStrongBinder());
1151 String res = getPackageForIntentSender(r);
1152 reply.writeNoException();
1153 reply.writeString(res);
1154 return true;
1155 }
1156
Christopher Tatec4a07d12012-04-06 14:19:13 -07001157 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1158 data.enforceInterface(IActivityManager.descriptor);
1159 IIntentSender r = IIntentSender.Stub.asInterface(
1160 data.readStrongBinder());
1161 int res = getUidForIntentSender(r);
1162 reply.writeNoException();
1163 reply.writeInt(res);
1164 return true;
1165 }
1166
Dianne Hackborn41203752012-08-31 14:05:51 -07001167 case HANDLE_INCOMING_USER_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 int callingPid = data.readInt();
1170 int callingUid = data.readInt();
1171 int userId = data.readInt();
1172 boolean allowAll = data.readInt() != 0 ;
1173 boolean requireFull = data.readInt() != 0;
1174 String name = data.readString();
1175 String callerPackage = data.readString();
1176 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1177 requireFull, name, callerPackage);
1178 reply.writeNoException();
1179 reply.writeInt(res);
1180 return true;
1181 }
1182
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001183 case SET_PROCESS_LIMIT_TRANSACTION: {
1184 data.enforceInterface(IActivityManager.descriptor);
1185 int max = data.readInt();
1186 setProcessLimit(max);
1187 reply.writeNoException();
1188 return true;
1189 }
1190
1191 case GET_PROCESS_LIMIT_TRANSACTION: {
1192 data.enforceInterface(IActivityManager.descriptor);
1193 int limit = getProcessLimit();
1194 reply.writeNoException();
1195 reply.writeInt(limit);
1196 return true;
1197 }
1198
1199 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1200 data.enforceInterface(IActivityManager.descriptor);
1201 IBinder token = data.readStrongBinder();
1202 int pid = data.readInt();
1203 boolean isForeground = data.readInt() != 0;
1204 setProcessForeground(token, pid, isForeground);
1205 reply.writeNoException();
1206 return true;
1207 }
1208
1209 case CHECK_PERMISSION_TRANSACTION: {
1210 data.enforceInterface(IActivityManager.descriptor);
1211 String perm = data.readString();
1212 int pid = data.readInt();
1213 int uid = data.readInt();
1214 int res = checkPermission(perm, pid, uid);
1215 reply.writeNoException();
1216 reply.writeInt(res);
1217 return true;
1218 }
1219
Dianne Hackbornff170242014-11-19 10:59:01 -08001220 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1221 data.enforceInterface(IActivityManager.descriptor);
1222 String perm = data.readString();
1223 int pid = data.readInt();
1224 int uid = data.readInt();
1225 IBinder token = data.readStrongBinder();
1226 int res = checkPermissionWithToken(perm, pid, uid, token);
1227 reply.writeNoException();
1228 reply.writeInt(res);
1229 return true;
1230 }
1231
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001232 case CHECK_URI_PERMISSION_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 Uri uri = Uri.CREATOR.createFromParcel(data);
1235 int pid = data.readInt();
1236 int uid = data.readInt();
1237 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001238 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001239 IBinder callerToken = data.readStrongBinder();
1240 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 reply.writeNoException();
1242 reply.writeInt(res);
1243 return true;
1244 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001245
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001247 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001248 String packageName = data.readString();
1249 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1250 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001251 int userId = data.readInt();
1252 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 reply.writeNoException();
1254 reply.writeInt(res ? 1 : 0);
1255 return true;
1256 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 case GRANT_URI_PERMISSION_TRANSACTION: {
1259 data.enforceInterface(IActivityManager.descriptor);
1260 IBinder b = data.readStrongBinder();
1261 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1262 String targetPkg = data.readString();
1263 Uri uri = Uri.CREATOR.createFromParcel(data);
1264 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001265 int userId = data.readInt();
1266 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001267 reply.writeNoException();
1268 return true;
1269 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001270
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 case REVOKE_URI_PERMISSION_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
1273 IBinder b = data.readStrongBinder();
1274 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1275 Uri uri = Uri.CREATOR.createFromParcel(data);
1276 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001277 int userId = data.readInt();
1278 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001279 reply.writeNoException();
1280 return true;
1281 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001282
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001283 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1284 data.enforceInterface(IActivityManager.descriptor);
1285 Uri uri = Uri.CREATOR.createFromParcel(data);
1286 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001287 int userId = data.readInt();
1288 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001289 reply.writeNoException();
1290 return true;
1291 }
1292
1293 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1294 data.enforceInterface(IActivityManager.descriptor);
1295 Uri uri = Uri.CREATOR.createFromParcel(data);
1296 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001297 int userId = data.readInt();
1298 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001299 reply.writeNoException();
1300 return true;
1301 }
1302
1303 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1304 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001305 final String packageName = data.readString();
1306 final boolean incoming = data.readInt() != 0;
1307 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1308 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001309 reply.writeNoException();
1310 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1311 return true;
1312 }
1313
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001314 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1315 data.enforceInterface(IActivityManager.descriptor);
1316 IBinder b = data.readStrongBinder();
1317 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1318 boolean waiting = data.readInt() != 0;
1319 showWaitingForDebugger(app, waiting);
1320 reply.writeNoException();
1321 return true;
1322 }
1323
1324 case GET_MEMORY_INFO_TRANSACTION: {
1325 data.enforceInterface(IActivityManager.descriptor);
1326 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1327 getMemoryInfo(mi);
1328 reply.writeNoException();
1329 mi.writeToParcel(reply, 0);
1330 return true;
1331 }
1332
1333 case UNHANDLED_BACK_TRANSACTION: {
1334 data.enforceInterface(IActivityManager.descriptor);
1335 unhandledBack();
1336 reply.writeNoException();
1337 return true;
1338 }
1339
1340 case OPEN_CONTENT_URI_TRANSACTION: {
1341 data.enforceInterface(IActivityManager.descriptor);
1342 Uri uri = Uri.parse(data.readString());
1343 ParcelFileDescriptor pfd = openContentUri(uri);
1344 reply.writeNoException();
1345 if (pfd != null) {
1346 reply.writeInt(1);
1347 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1348 } else {
1349 reply.writeInt(0);
1350 }
1351 return true;
1352 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001353
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001354 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1355 data.enforceInterface(IActivityManager.descriptor);
1356 setLockScreenShown(data.readInt() != 0);
1357 reply.writeNoException();
1358 return true;
1359 }
1360
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001361 case SET_DEBUG_APP_TRANSACTION: {
1362 data.enforceInterface(IActivityManager.descriptor);
1363 String pn = data.readString();
1364 boolean wfd = data.readInt() != 0;
1365 boolean per = data.readInt() != 0;
1366 setDebugApp(pn, wfd, per);
1367 reply.writeNoException();
1368 return true;
1369 }
1370
1371 case SET_ALWAYS_FINISH_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
1373 boolean enabled = data.readInt() != 0;
1374 setAlwaysFinish(enabled);
1375 reply.writeNoException();
1376 return true;
1377 }
1378
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001379 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001381 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001382 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001383 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001384 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 return true;
1386 }
1387
1388 case ENTER_SAFE_MODE_TRANSACTION: {
1389 data.enforceInterface(IActivityManager.descriptor);
1390 enterSafeMode();
1391 reply.writeNoException();
1392 return true;
1393 }
1394
1395 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 IIntentSender is = IIntentSender.Stub.asInterface(
1398 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001399 int sourceUid = data.readInt();
1400 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001401 String tag = data.readString();
1402 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1403 reply.writeNoException();
1404 return true;
1405 }
1406
1407 case NOTE_ALARM_START_TRANSACTION: {
1408 data.enforceInterface(IActivityManager.descriptor);
1409 IIntentSender is = IIntentSender.Stub.asInterface(
1410 data.readStrongBinder());
1411 int sourceUid = data.readInt();
1412 String tag = data.readString();
1413 noteAlarmStart(is, sourceUid, tag);
1414 reply.writeNoException();
1415 return true;
1416 }
1417
1418 case NOTE_ALARM_FINISH_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 IIntentSender is = IIntentSender.Stub.asInterface(
1421 data.readStrongBinder());
1422 int sourceUid = data.readInt();
1423 String tag = data.readString();
1424 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001425 reply.writeNoException();
1426 return true;
1427 }
1428
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001429 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001430 data.enforceInterface(IActivityManager.descriptor);
1431 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001432 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001433 boolean secure = data.readInt() != 0;
1434 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001435 reply.writeNoException();
1436 reply.writeInt(res ? 1 : 0);
1437 return true;
1438 }
1439
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001440 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1441 data.enforceInterface(IActivityManager.descriptor);
1442 String reason = data.readString();
1443 boolean res = killProcessesBelowForeground(reason);
1444 reply.writeNoException();
1445 reply.writeInt(res ? 1 : 0);
1446 return true;
1447 }
1448
Dan Egnor60d87622009-12-16 16:32:58 -08001449 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1450 data.enforceInterface(IActivityManager.descriptor);
1451 IBinder app = data.readStrongBinder();
1452 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1453 handleApplicationCrash(app, ci);
1454 reply.writeNoException();
1455 return true;
1456 }
1457
1458 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001459 data.enforceInterface(IActivityManager.descriptor);
1460 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001461 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001462 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001463 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001464 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001465 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001466 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001467 return true;
1468 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001469
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001470 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1471 data.enforceInterface(IActivityManager.descriptor);
1472 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001473 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001474 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1475 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001476 reply.writeNoException();
1477 return true;
1478 }
1479
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001480 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1481 data.enforceInterface(IActivityManager.descriptor);
1482 int sig = data.readInt();
1483 signalPersistentProcesses(sig);
1484 reply.writeNoException();
1485 return true;
1486 }
1487
Dianne Hackborn03abb812010-01-04 18:43:19 -08001488 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1489 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001490 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001491 int userId = data.readInt();
1492 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001493 reply.writeNoException();
1494 return true;
1495 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001496
1497 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 killAllBackgroundProcesses();
1500 reply.writeNoException();
1501 return true;
1502 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001503
Dianne Hackborn03abb812010-01-04 18:43:19 -08001504 case FORCE_STOP_PACKAGE_TRANSACTION: {
1505 data.enforceInterface(IActivityManager.descriptor);
1506 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001507 int userId = data.readInt();
1508 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001509 reply.writeNoException();
1510 return true;
1511 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001512
1513 case GET_MY_MEMORY_STATE_TRANSACTION: {
1514 data.enforceInterface(IActivityManager.descriptor);
1515 ActivityManager.RunningAppProcessInfo info =
1516 new ActivityManager.RunningAppProcessInfo();
1517 getMyMemoryState(info);
1518 reply.writeNoException();
1519 info.writeToParcel(reply, 0);
1520 return true;
1521 }
1522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001523 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1524 data.enforceInterface(IActivityManager.descriptor);
1525 ConfigurationInfo config = getDeviceConfigurationInfo();
1526 reply.writeNoException();
1527 config.writeToParcel(reply, 0);
1528 return true;
1529 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001530
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001531 case PROFILE_CONTROL_TRANSACTION: {
1532 data.enforceInterface(IActivityManager.descriptor);
1533 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001534 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001535 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001536 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001537 ProfilerInfo profilerInfo = data.readInt() != 0
1538 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1539 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001540 reply.writeNoException();
1541 reply.writeInt(res ? 1 : 0);
1542 return true;
1543 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001544
Dianne Hackborn55280a92009-05-07 15:53:46 -07001545 case SHUTDOWN_TRANSACTION: {
1546 data.enforceInterface(IActivityManager.descriptor);
1547 boolean res = shutdown(data.readInt());
1548 reply.writeNoException();
1549 reply.writeInt(res ? 1 : 0);
1550 return true;
1551 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001552
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001553 case STOP_APP_SWITCHES_TRANSACTION: {
1554 data.enforceInterface(IActivityManager.descriptor);
1555 stopAppSwitches();
1556 reply.writeNoException();
1557 return true;
1558 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001559
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001560 case RESUME_APP_SWITCHES_TRANSACTION: {
1561 data.enforceInterface(IActivityManager.descriptor);
1562 resumeAppSwitches();
1563 reply.writeNoException();
1564 return true;
1565 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001567 case PEEK_SERVICE_TRANSACTION: {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 Intent service = Intent.CREATOR.createFromParcel(data);
1570 String resolvedType = data.readString();
1571 IBinder binder = peekService(service, resolvedType);
1572 reply.writeNoException();
1573 reply.writeStrongBinder(binder);
1574 return true;
1575 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001576
Christopher Tate181fafa2009-05-14 11:12:14 -07001577 case START_BACKUP_AGENT_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1580 int backupRestoreMode = data.readInt();
1581 boolean success = bindBackupAgent(info, backupRestoreMode);
1582 reply.writeNoException();
1583 reply.writeInt(success ? 1 : 0);
1584 return true;
1585 }
1586
1587 case BACKUP_AGENT_CREATED_TRANSACTION: {
1588 data.enforceInterface(IActivityManager.descriptor);
1589 String packageName = data.readString();
1590 IBinder agent = data.readStrongBinder();
1591 backupAgentCreated(packageName, agent);
1592 reply.writeNoException();
1593 return true;
1594 }
1595
1596 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1599 unbindBackupAgent(info);
1600 reply.writeNoException();
1601 return true;
1602 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001603
1604 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1605 data.enforceInterface(IActivityManager.descriptor);
1606 String packageName = data.readString();
1607 addPackageDependency(packageName);
1608 reply.writeNoException();
1609 return true;
1610 }
1611
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001612 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001613 data.enforceInterface(IActivityManager.descriptor);
1614 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001615 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001616 String reason = data.readString();
1617 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001618 reply.writeNoException();
1619 return true;
1620 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001621
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001622 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1623 data.enforceInterface(IActivityManager.descriptor);
1624 String reason = data.readString();
1625 closeSystemDialogs(reason);
1626 reply.writeNoException();
1627 return true;
1628 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001629
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001630 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001632 int[] pids = data.createIntArray();
1633 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001634 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001635 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001636 return true;
1637 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001638
1639 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 String processName = data.readString();
1642 int uid = data.readInt();
1643 killApplicationProcess(processName, uid);
1644 reply.writeNoException();
1645 return true;
1646 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001647
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001648 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1649 data.enforceInterface(IActivityManager.descriptor);
1650 IBinder token = data.readStrongBinder();
1651 String packageName = data.readString();
1652 int enterAnim = data.readInt();
1653 int exitAnim = data.readInt();
1654 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001655 reply.writeNoException();
1656 return true;
1657 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001658
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001659 case IS_USER_A_MONKEY_TRANSACTION: {
1660 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001661 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001662 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001663 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001664 return true;
1665 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001666
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001667 case SET_USER_IS_MONKEY_TRANSACTION: {
1668 data.enforceInterface(IActivityManager.descriptor);
1669 final boolean monkey = (data.readInt() == 1);
1670 setUserIsMonkey(monkey);
1671 reply.writeNoException();
1672 return true;
1673 }
1674
Dianne Hackborn860755f2010-06-03 18:47:52 -07001675 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1676 data.enforceInterface(IActivityManager.descriptor);
1677 finishHeavyWeightApp();
1678 reply.writeNoException();
1679 return true;
1680 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001681
1682 case IS_IMMERSIVE_TRANSACTION: {
1683 data.enforceInterface(IActivityManager.descriptor);
1684 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001685 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001686 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001687 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001688 return true;
1689 }
1690
Craig Mautnerd61dc202014-07-07 11:09:11 -07001691 case IS_TOP_OF_TASK_TRANSACTION: {
1692 data.enforceInterface(IActivityManager.descriptor);
1693 IBinder token = data.readStrongBinder();
1694 final boolean isTopOfTask = isTopOfTask(token);
1695 reply.writeNoException();
1696 reply.writeInt(isTopOfTask ? 1 : 0);
1697 return true;
1698 }
1699
Craig Mautner5eda9b32013-07-02 11:58:16 -07001700 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001701 data.enforceInterface(IActivityManager.descriptor);
1702 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001703 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001704 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001705 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001706 return true;
1707 }
1708
1709 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1710 data.enforceInterface(IActivityManager.descriptor);
1711 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001712 final Bundle bundle;
1713 if (data.readInt() == 0) {
1714 bundle = null;
1715 } else {
1716 bundle = data.readBundle();
1717 }
1718 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1719 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001720 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001721 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001722 return true;
1723 }
1724
Craig Mautner233ceee2014-05-09 17:05:11 -07001725 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 IBinder token = data.readStrongBinder();
1728 final ActivityOptions options = getActivityOptions(token);
1729 reply.writeNoException();
1730 reply.writeBundle(options == null ? null : options.toBundle());
1731 return true;
1732 }
1733
Daniel Sandler69a48172010-06-23 16:29:36 -04001734 case SET_IMMERSIVE_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 IBinder token = data.readStrongBinder();
1737 boolean imm = data.readInt() == 1;
1738 setImmersive(token, imm);
1739 reply.writeNoException();
1740 return true;
1741 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001742
Daniel Sandler69a48172010-06-23 16:29:36 -04001743 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001745 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001746 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001747 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001748 return true;
1749 }
1750
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001751 case CRASH_APPLICATION_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 int uid = data.readInt();
1754 int initialPid = data.readInt();
1755 String packageName = data.readString();
1756 String message = data.readString();
1757 crashApplication(uid, initialPid, packageName, message);
1758 reply.writeNoException();
1759 return true;
1760 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001761
1762 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1763 data.enforceInterface(IActivityManager.descriptor);
1764 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001765 int userId = data.readInt();
1766 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001767 reply.writeNoException();
1768 reply.writeString(type);
1769 return true;
1770 }
1771
Dianne Hackborn7e269642010-08-25 19:50:20 -07001772 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1773 data.enforceInterface(IActivityManager.descriptor);
1774 String name = data.readString();
1775 IBinder perm = newUriPermissionOwner(name);
1776 reply.writeNoException();
1777 reply.writeStrongBinder(perm);
1778 return true;
1779 }
1780
1781 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1782 data.enforceInterface(IActivityManager.descriptor);
1783 IBinder owner = data.readStrongBinder();
1784 int fromUid = data.readInt();
1785 String targetPkg = data.readString();
1786 Uri uri = Uri.CREATOR.createFromParcel(data);
1787 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001788 int sourceUserId = data.readInt();
1789 int targetUserId = data.readInt();
1790 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1791 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001792 reply.writeNoException();
1793 return true;
1794 }
1795
1796 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
1798 IBinder owner = data.readStrongBinder();
1799 Uri uri = null;
1800 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001801 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001802 }
1803 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001804 int userId = data.readInt();
1805 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001806 reply.writeNoException();
1807 return true;
1808 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001809
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001810 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1811 data.enforceInterface(IActivityManager.descriptor);
1812 int callingUid = data.readInt();
1813 String targetPkg = data.readString();
1814 Uri uri = Uri.CREATOR.createFromParcel(data);
1815 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001816 int userId = data.readInt();
1817 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001818 reply.writeNoException();
1819 reply.writeInt(res);
1820 return true;
1821 }
1822
Andy McFadden824c5102010-07-09 16:26:57 -07001823 case DUMP_HEAP_TRANSACTION: {
1824 data.enforceInterface(IActivityManager.descriptor);
1825 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001826 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001827 boolean managed = data.readInt() != 0;
1828 String path = data.readString();
1829 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001830 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001831 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001832 reply.writeNoException();
1833 reply.writeInt(res ? 1 : 0);
1834 return true;
1835 }
1836
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001837 case START_ACTIVITIES_TRANSACTION:
1838 {
1839 data.enforceInterface(IActivityManager.descriptor);
1840 IBinder b = data.readStrongBinder();
1841 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001842 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001843 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1844 String[] resolvedTypes = data.createStringArray();
1845 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001846 Bundle options = data.readInt() != 0
1847 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001848 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001849 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001850 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001851 reply.writeNoException();
1852 reply.writeInt(result);
1853 return true;
1854 }
1855
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001856 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1857 {
1858 data.enforceInterface(IActivityManager.descriptor);
1859 int mode = getFrontActivityScreenCompatMode();
1860 reply.writeNoException();
1861 reply.writeInt(mode);
1862 return true;
1863 }
1864
1865 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1866 {
1867 data.enforceInterface(IActivityManager.descriptor);
1868 int mode = data.readInt();
1869 setFrontActivityScreenCompatMode(mode);
1870 reply.writeNoException();
1871 reply.writeInt(mode);
1872 return true;
1873 }
1874
1875 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1876 {
1877 data.enforceInterface(IActivityManager.descriptor);
1878 String pkg = data.readString();
1879 int mode = getPackageScreenCompatMode(pkg);
1880 reply.writeNoException();
1881 reply.writeInt(mode);
1882 return true;
1883 }
1884
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001885 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1886 {
1887 data.enforceInterface(IActivityManager.descriptor);
1888 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001889 int mode = data.readInt();
1890 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001891 reply.writeNoException();
1892 return true;
1893 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001894
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001895 case SWITCH_USER_TRANSACTION: {
1896 data.enforceInterface(IActivityManager.descriptor);
1897 int userid = data.readInt();
1898 boolean result = switchUser(userid);
1899 reply.writeNoException();
1900 reply.writeInt(result ? 1 : 0);
1901 return true;
1902 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001903
Kenny Guy08488bf2014-02-21 17:40:37 +00001904 case START_USER_IN_BACKGROUND_TRANSACTION: {
1905 data.enforceInterface(IActivityManager.descriptor);
1906 int userid = data.readInt();
1907 boolean result = startUserInBackground(userid);
1908 reply.writeNoException();
1909 reply.writeInt(result ? 1 : 0);
1910 return true;
1911 }
1912
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001913 case STOP_USER_TRANSACTION: {
1914 data.enforceInterface(IActivityManager.descriptor);
1915 int userid = data.readInt();
1916 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1917 data.readStrongBinder());
1918 int result = stopUser(userid, callback);
1919 reply.writeNoException();
1920 reply.writeInt(result);
1921 return true;
1922 }
1923
Amith Yamasani52f1d752012-03-28 18:19:29 -07001924 case GET_CURRENT_USER_TRANSACTION: {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 UserInfo userInfo = getCurrentUser();
1927 reply.writeNoException();
1928 userInfo.writeToParcel(reply, 0);
1929 return true;
1930 }
1931
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001932 case IS_USER_RUNNING_TRANSACTION: {
1933 data.enforceInterface(IActivityManager.descriptor);
1934 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001935 boolean orStopping = data.readInt() != 0;
1936 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001937 reply.writeNoException();
1938 reply.writeInt(result ? 1 : 0);
1939 return true;
1940 }
1941
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001942 case GET_RUNNING_USER_IDS_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 int[] result = getRunningUserIds();
1945 reply.writeNoException();
1946 reply.writeIntArray(result);
1947 return true;
1948 }
1949
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001950 case REMOVE_TASK_TRANSACTION:
1951 {
1952 data.enforceInterface(IActivityManager.descriptor);
1953 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001954 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001955 reply.writeNoException();
1956 reply.writeInt(result ? 1 : 0);
1957 return true;
1958 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001959
Jeff Sharkeya4620792011-05-20 15:29:23 -07001960 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1963 data.readStrongBinder());
1964 registerProcessObserver(observer);
1965 return true;
1966 }
1967
1968 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1969 data.enforceInterface(IActivityManager.descriptor);
1970 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1971 data.readStrongBinder());
1972 unregisterProcessObserver(observer);
1973 return true;
1974 }
1975
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07001976 case REGISTER_UID_OBSERVER_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 IUidObserver observer = IUidObserver.Stub.asInterface(
1979 data.readStrongBinder());
1980 registerUidObserver(observer);
1981 return true;
1982 }
1983
1984 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 IUidObserver observer = IUidObserver.Stub.asInterface(
1987 data.readStrongBinder());
1988 unregisterUidObserver(observer);
1989 return true;
1990 }
1991
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001992 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1993 {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 String pkg = data.readString();
1996 boolean ask = getPackageAskScreenCompat(pkg);
1997 reply.writeNoException();
1998 reply.writeInt(ask ? 1 : 0);
1999 return true;
2000 }
2001
2002 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2003 {
2004 data.enforceInterface(IActivityManager.descriptor);
2005 String pkg = data.readString();
2006 boolean ask = data.readInt() != 0;
2007 setPackageAskScreenCompat(pkg, ask);
2008 reply.writeNoException();
2009 return true;
2010 }
2011
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002012 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2013 data.enforceInterface(IActivityManager.descriptor);
2014 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002015 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002016 boolean res = isIntentSenderTargetedToPackage(r);
2017 reply.writeNoException();
2018 reply.writeInt(res ? 1 : 0);
2019 return true;
2020 }
2021
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002022 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2023 data.enforceInterface(IActivityManager.descriptor);
2024 IIntentSender r = IIntentSender.Stub.asInterface(
2025 data.readStrongBinder());
2026 boolean res = isIntentSenderAnActivity(r);
2027 reply.writeNoException();
2028 reply.writeInt(res ? 1 : 0);
2029 return true;
2030 }
2031
Dianne Hackborn81038902012-11-26 17:04:09 -08002032 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2033 data.enforceInterface(IActivityManager.descriptor);
2034 IIntentSender r = IIntentSender.Stub.asInterface(
2035 data.readStrongBinder());
2036 Intent intent = getIntentForIntentSender(r);
2037 reply.writeNoException();
2038 if (intent != null) {
2039 reply.writeInt(1);
2040 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2041 } else {
2042 reply.writeInt(0);
2043 }
2044 return true;
2045 }
2046
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002047 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2048 data.enforceInterface(IActivityManager.descriptor);
2049 IIntentSender r = IIntentSender.Stub.asInterface(
2050 data.readStrongBinder());
2051 String prefix = data.readString();
2052 String tag = getTagForIntentSender(r, prefix);
2053 reply.writeNoException();
2054 reply.writeString(tag);
2055 return true;
2056 }
2057
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002058 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2059 data.enforceInterface(IActivityManager.descriptor);
2060 Configuration config = Configuration.CREATOR.createFromParcel(data);
2061 updatePersistentConfiguration(config);
2062 reply.writeNoException();
2063 return true;
2064 }
2065
Dianne Hackbornb437e092011-08-05 17:50:29 -07002066 case GET_PROCESS_PSS_TRANSACTION: {
2067 data.enforceInterface(IActivityManager.descriptor);
2068 int[] pids = data.createIntArray();
2069 long[] pss = getProcessPss(pids);
2070 reply.writeNoException();
2071 reply.writeLongArray(pss);
2072 return true;
2073 }
2074
Dianne Hackborn661cd522011-08-22 00:26:20 -07002075 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2076 data.enforceInterface(IActivityManager.descriptor);
2077 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2078 boolean always = data.readInt() != 0;
2079 showBootMessage(msg, always);
2080 reply.writeNoException();
2081 return true;
2082 }
2083
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002084 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002085 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002086 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002087 reply.writeNoException();
2088 return true;
2089 }
2090
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002091 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2092 data.enforceInterface(IActivityManager.descriptor);
2093 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2094 reply.writeNoException();
2095 return true;
2096 }
2097
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002098 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002099 data.enforceInterface(IActivityManager.descriptor);
2100 IBinder token = data.readStrongBinder();
2101 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002102 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002103 reply.writeNoException();
2104 reply.writeInt(res ? 1 : 0);
2105 return true;
2106 }
2107
2108 case NAVIGATE_UP_TO_TRANSACTION: {
2109 data.enforceInterface(IActivityManager.descriptor);
2110 IBinder token = data.readStrongBinder();
2111 Intent target = Intent.CREATOR.createFromParcel(data);
2112 int resultCode = data.readInt();
2113 Intent resultData = null;
2114 if (data.readInt() != 0) {
2115 resultData = Intent.CREATOR.createFromParcel(data);
2116 }
2117 boolean res = navigateUpTo(token, target, resultCode, resultData);
2118 reply.writeNoException();
2119 reply.writeInt(res ? 1 : 0);
2120 return true;
2121 }
2122
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002123 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2124 data.enforceInterface(IActivityManager.descriptor);
2125 IBinder token = data.readStrongBinder();
2126 int res = getLaunchedFromUid(token);
2127 reply.writeNoException();
2128 reply.writeInt(res);
2129 return true;
2130 }
2131
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002132 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 IBinder token = data.readStrongBinder();
2135 String res = getLaunchedFromPackage(token);
2136 reply.writeNoException();
2137 reply.writeString(res);
2138 return true;
2139 }
2140
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002141 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2142 data.enforceInterface(IActivityManager.descriptor);
2143 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2144 data.readStrongBinder());
2145 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002146 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002147 return true;
2148 }
2149
2150 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2151 data.enforceInterface(IActivityManager.descriptor);
2152 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2153 data.readStrongBinder());
2154 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002155 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002156 return true;
2157 }
2158
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002159 case REQUEST_BUG_REPORT_TRANSACTION: {
2160 data.enforceInterface(IActivityManager.descriptor);
2161 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002162 reply.writeNoException();
2163 return true;
2164 }
2165
2166 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2167 data.enforceInterface(IActivityManager.descriptor);
2168 int pid = data.readInt();
2169 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002170 String reason = data.readString();
2171 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002172 reply.writeNoException();
2173 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002174 return true;
2175 }
2176
Adam Skorydfc7fd72013-08-05 19:23:41 -07002177 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002178 data.enforceInterface(IActivityManager.descriptor);
2179 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002180 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002181 reply.writeNoException();
2182 reply.writeBundle(res);
2183 return true;
2184 }
2185
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002186 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2187 data.enforceInterface(IActivityManager.descriptor);
2188 int requestType = data.readInt();
2189 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
2190 requestAssistContextExtras(requestType, receiver);
2191 reply.writeNoException();
2192 return true;
2193 }
2194
Adam Skorydfc7fd72013-08-05 19:23:41 -07002195 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002196 data.enforceInterface(IActivityManager.descriptor);
2197 IBinder token = data.readStrongBinder();
2198 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002199 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2200 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002201 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2202 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002203 reply.writeNoException();
2204 return true;
2205 }
2206
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002207 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2208 data.enforceInterface(IActivityManager.descriptor);
2209 Intent intent = Intent.CREATOR.createFromParcel(data);
2210 int requestType = data.readInt();
2211 String hint = data.readString();
2212 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002213 Bundle args = data.readBundle();
2214 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002215 reply.writeNoException();
2216 reply.writeInt(res ? 1 : 0);
2217 return true;
2218 }
2219
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002220 case KILL_UID_TRANSACTION: {
2221 data.enforceInterface(IActivityManager.descriptor);
2222 int uid = data.readInt();
2223 String reason = data.readString();
2224 killUid(uid, reason);
2225 reply.writeNoException();
2226 return true;
2227 }
2228
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002229 case HANG_TRANSACTION: {
2230 data.enforceInterface(IActivityManager.descriptor);
2231 IBinder who = data.readStrongBinder();
2232 boolean allowRestart = data.readInt() != 0;
2233 hang(who, allowRestart);
2234 reply.writeNoException();
2235 return true;
2236 }
2237
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002238 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2239 data.enforceInterface(IActivityManager.descriptor);
2240 IBinder token = data.readStrongBinder();
2241 reportActivityFullyDrawn(token);
2242 reply.writeNoException();
2243 return true;
2244 }
2245
Craig Mautner5eda9b32013-07-02 11:58:16 -07002246 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2247 data.enforceInterface(IActivityManager.descriptor);
2248 IBinder token = data.readStrongBinder();
2249 notifyActivityDrawn(token);
2250 reply.writeNoException();
2251 return true;
2252 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002253
2254 case RESTART_TRANSACTION: {
2255 data.enforceInterface(IActivityManager.descriptor);
2256 restart();
2257 reply.writeNoException();
2258 return true;
2259 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002260
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002261 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2262 data.enforceInterface(IActivityManager.descriptor);
2263 performIdleMaintenance();
2264 reply.writeNoException();
2265 return true;
2266 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002267
Todd Kennedyca4d8422015-01-15 15:19:22 -08002268 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002269 data.enforceInterface(IActivityManager.descriptor);
2270 IBinder parentActivityToken = data.readStrongBinder();
2271 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002272 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002273 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002274 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002275 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002276 if (activityContainer != null) {
2277 reply.writeInt(1);
2278 reply.writeStrongBinder(activityContainer.asBinder());
2279 } else {
2280 reply.writeInt(0);
2281 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002282 return true;
2283 }
2284
Craig Mautner95da1082014-02-24 17:54:35 -08002285 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2286 data.enforceInterface(IActivityManager.descriptor);
2287 IActivityContainer activityContainer =
2288 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2289 deleteActivityContainer(activityContainer);
2290 reply.writeNoException();
2291 return true;
2292 }
2293
Todd Kennedy4900bf92015-01-16 16:05:14 -08002294 case CREATE_STACK_ON_DISPLAY: {
2295 data.enforceInterface(IActivityManager.descriptor);
2296 int displayId = data.readInt();
2297 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2298 reply.writeNoException();
2299 if (activityContainer != null) {
2300 reply.writeInt(1);
2301 reply.writeStrongBinder(activityContainer.asBinder());
2302 } else {
2303 reply.writeInt(0);
2304 }
2305 return true;
2306 }
2307
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002308 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002309 data.enforceInterface(IActivityManager.descriptor);
2310 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002311 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002312 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002313 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002314 return true;
2315 }
2316
Craig Mautneraea74a52014-03-08 14:23:10 -08002317 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2318 data.enforceInterface(IActivityManager.descriptor);
2319 final int taskId = data.readInt();
2320 startLockTaskMode(taskId);
2321 reply.writeNoException();
2322 return true;
2323 }
2324
2325 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2326 data.enforceInterface(IActivityManager.descriptor);
2327 IBinder token = data.readStrongBinder();
2328 startLockTaskMode(token);
2329 reply.writeNoException();
2330 return true;
2331 }
2332
Craig Mautnerd61dc202014-07-07 11:09:11 -07002333 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002334 data.enforceInterface(IActivityManager.descriptor);
2335 startLockTaskModeOnCurrent();
2336 reply.writeNoException();
2337 return true;
2338 }
2339
Craig Mautneraea74a52014-03-08 14:23:10 -08002340 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2341 data.enforceInterface(IActivityManager.descriptor);
2342 stopLockTaskMode();
2343 reply.writeNoException();
2344 return true;
2345 }
2346
Craig Mautnerd61dc202014-07-07 11:09:11 -07002347 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002348 data.enforceInterface(IActivityManager.descriptor);
2349 stopLockTaskModeOnCurrent();
2350 reply.writeNoException();
2351 return true;
2352 }
2353
Craig Mautneraea74a52014-03-08 14:23:10 -08002354 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2355 data.enforceInterface(IActivityManager.descriptor);
2356 final boolean isInLockTaskMode = isInLockTaskMode();
2357 reply.writeNoException();
2358 reply.writeInt(isInLockTaskMode ? 1 : 0);
2359 return true;
2360 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002361
Benjamin Franz43261142015-02-11 15:59:44 +00002362 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2363 data.enforceInterface(IActivityManager.descriptor);
2364 final int lockTaskModeState = getLockTaskModeState();
2365 reply.writeNoException();
2366 reply.writeInt(lockTaskModeState);
2367 return true;
2368 }
2369
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002370 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2371 data.enforceInterface(IActivityManager.descriptor);
2372 final IBinder token = data.readStrongBinder();
2373 showLockTaskEscapeMessage(token);
2374 reply.writeNoException();
2375 return true;
2376 }
2377
Winson Chunga449dc02014-05-16 11:15:04 -07002378 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002379 data.enforceInterface(IActivityManager.descriptor);
2380 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002381 ActivityManager.TaskDescription values =
2382 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2383 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002384 reply.writeNoException();
2385 return true;
2386 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002387
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002388 case SET_TASK_RESIZEABLE_TRANSACTION: {
2389 data.enforceInterface(IActivityManager.descriptor);
2390 int taskId = data.readInt();
2391 boolean resizeable = (data.readInt() == 1) ? true : false;
2392 setTaskResizeable(taskId, resizeable);
2393 reply.writeNoException();
2394 return true;
2395 }
2396
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002397 case RESIZE_TASK_TRANSACTION: {
2398 data.enforceInterface(IActivityManager.descriptor);
2399 int taskId = data.readInt();
2400 Rect r = Rect.CREATOR.createFromParcel(data);
2401 resizeTask(taskId, r);
2402 reply.writeNoException();
2403 return true;
2404 }
2405
Craig Mautner648f69b2014-09-18 14:16:26 -07002406 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2407 data.enforceInterface(IActivityManager.descriptor);
2408 String filename = data.readString();
2409 Bitmap icon = getTaskDescriptionIcon(filename);
2410 reply.writeNoException();
2411 if (icon == null) {
2412 reply.writeInt(0);
2413 } else {
2414 reply.writeInt(1);
2415 icon.writeToParcel(reply, 0);
2416 }
2417 return true;
2418 }
2419
Winson Chung044d5292014-11-06 11:05:19 -08002420 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2421 data.enforceInterface(IActivityManager.descriptor);
2422 final Bundle bundle;
2423 if (data.readInt() == 0) {
2424 bundle = null;
2425 } else {
2426 bundle = data.readBundle();
2427 }
2428 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2429 startInPlaceAnimationOnFrontMostApplication(options);
2430 reply.writeNoException();
2431 return true;
2432 }
2433
Jose Lima4b6c6692014-08-12 17:41:12 -07002434 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002435 data.enforceInterface(IActivityManager.descriptor);
2436 IBinder token = data.readStrongBinder();
2437 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002438 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002439 reply.writeNoException();
2440 reply.writeInt(success ? 1 : 0);
2441 return true;
2442 }
2443
Jose Lima4b6c6692014-08-12 17:41:12 -07002444 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002445 data.enforceInterface(IActivityManager.descriptor);
2446 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002447 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002448 reply.writeNoException();
2449 reply.writeInt(enabled ? 1 : 0);
2450 return true;
2451 }
2452
Jose Lima4b6c6692014-08-12 17:41:12 -07002453 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002454 data.enforceInterface(IActivityManager.descriptor);
2455 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002456 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002457 reply.writeNoException();
2458 return true;
2459 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002460
2461 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2462 data.enforceInterface(IActivityManager.descriptor);
2463 IBinder token = data.readStrongBinder();
2464 notifyLaunchTaskBehindComplete(token);
2465 reply.writeNoException();
2466 return true;
2467 }
Craig Mautner8746a472014-07-24 15:12:54 -07002468
2469 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2470 data.enforceInterface(IActivityManager.descriptor);
2471 IBinder token = data.readStrongBinder();
2472 notifyEnterAnimationComplete(token);
2473 reply.writeNoException();
2474 return true;
2475 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002476
2477 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2478 data.enforceInterface(IActivityManager.descriptor);
2479 bootAnimationComplete();
2480 reply.writeNoException();
2481 return true;
2482 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002483
Jeff Sharkey605eb792014-11-04 13:34:06 -08002484 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2485 data.enforceInterface(IActivityManager.descriptor);
2486 final int uid = data.readInt();
2487 final byte[] firstPacket = data.createByteArray();
2488 notifyCleartextNetwork(uid, firstPacket);
2489 reply.writeNoException();
2490 return true;
2491 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002492
2493 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2494 data.enforceInterface(IActivityManager.descriptor);
2495 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002496 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002497 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002498 String reportPackage = data.readString();
2499 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002500 reply.writeNoException();
2501 return true;
2502 }
2503
2504 case DUMP_HEAP_FINISHED_TRANSACTION: {
2505 data.enforceInterface(IActivityManager.descriptor);
2506 String path = data.readString();
2507 dumpHeapFinished(path);
2508 reply.writeNoException();
2509 return true;
2510 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002511
2512 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2513 data.enforceInterface(IActivityManager.descriptor);
2514 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2515 data.readStrongBinder());
2516 boolean keepAwake = data.readInt() != 0;
2517 setVoiceKeepAwake(session, keepAwake);
2518 reply.writeNoException();
2519 return true;
2520 }
Craig Mautnere5600772015-04-03 21:36:37 -07002521
2522 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2523 data.enforceInterface(IActivityManager.descriptor);
2524 int userId = data.readInt();
2525 String[] packages = data.readStringArray();
2526 updateLockTaskPackages(userId, packages);
2527 reply.writeNoException();
2528 return true;
2529 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002530
Craig Mautner015c5e52015-04-23 10:39:39 -07002531 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2532 data.enforceInterface(IActivityManager.descriptor);
2533 String packageName = data.readString();
2534 updateDeviceOwner(packageName);
2535 reply.writeNoException();
2536 return true;
2537 }
2538
Dianne Hackborn1e383822015-04-10 14:02:33 -07002539 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2540 data.enforceInterface(IActivityManager.descriptor);
2541 String pkg = data.readString();
2542 int res = getPackageProcessState(pkg);
2543 reply.writeNoException();
2544 reply.writeInt(res);
2545 return true;
2546 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002547
2548 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2549 data.enforceInterface(IActivityManager.descriptor);
2550 String process = data.readString();
2551 int userId = data.readInt();
2552 int level = data.readInt();
2553 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2554 reply.writeNoException();
2555 reply.writeInt(res ? 1 : 0);
2556 return true;
2557 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002558 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002559
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002560 return super.onTransact(code, data, reply, flags);
2561 }
2562
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002563 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002564 return this;
2565 }
2566
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002567 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2568 protected IActivityManager create() {
2569 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002570 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002571 Log.v("ActivityManager", "default service binder = " + b);
2572 }
2573 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002574 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002575 Log.v("ActivityManager", "default service = " + am);
2576 }
2577 return am;
2578 }
2579 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002580}
2581
2582class ActivityManagerProxy implements IActivityManager
2583{
2584 public ActivityManagerProxy(IBinder remote)
2585 {
2586 mRemote = remote;
2587 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002588
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002589 public IBinder asBinder()
2590 {
2591 return mRemote;
2592 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002593
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002594 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002595 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002596 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002597 Parcel data = Parcel.obtain();
2598 Parcel reply = Parcel.obtain();
2599 data.writeInterfaceToken(IActivityManager.descriptor);
2600 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002601 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002602 intent.writeToParcel(data, 0);
2603 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002604 data.writeStrongBinder(resultTo);
2605 data.writeString(resultWho);
2606 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002607 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002608 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002609 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002610 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002611 } else {
2612 data.writeInt(0);
2613 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002614 if (options != null) {
2615 data.writeInt(1);
2616 options.writeToParcel(data, 0);
2617 } else {
2618 data.writeInt(0);
2619 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002620 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2621 reply.readException();
2622 int result = reply.readInt();
2623 reply.recycle();
2624 data.recycle();
2625 return result;
2626 }
Amith Yamasani82644082012-08-03 13:09:11 -07002627
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002628 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002629 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002630 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2631 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002632 Parcel data = Parcel.obtain();
2633 Parcel reply = Parcel.obtain();
2634 data.writeInterfaceToken(IActivityManager.descriptor);
2635 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002636 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002637 intent.writeToParcel(data, 0);
2638 data.writeString(resolvedType);
2639 data.writeStrongBinder(resultTo);
2640 data.writeString(resultWho);
2641 data.writeInt(requestCode);
2642 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002643 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002644 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002645 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002646 } else {
2647 data.writeInt(0);
2648 }
2649 if (options != null) {
2650 data.writeInt(1);
2651 options.writeToParcel(data, 0);
2652 } else {
2653 data.writeInt(0);
2654 }
2655 data.writeInt(userId);
2656 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2657 reply.readException();
2658 int result = reply.readInt();
2659 reply.recycle();
2660 data.recycle();
2661 return result;
2662 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002663 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2664 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002665 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002666 Parcel data = Parcel.obtain();
2667 Parcel reply = Parcel.obtain();
2668 data.writeInterfaceToken(IActivityManager.descriptor);
2669 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2670 data.writeString(callingPackage);
2671 intent.writeToParcel(data, 0);
2672 data.writeString(resolvedType);
2673 data.writeStrongBinder(resultTo);
2674 data.writeString(resultWho);
2675 data.writeInt(requestCode);
2676 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002677 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002678 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002679 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002680 } else {
2681 data.writeInt(0);
2682 }
2683 if (options != null) {
2684 data.writeInt(1);
2685 options.writeToParcel(data, 0);
2686 } else {
2687 data.writeInt(0);
2688 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002689 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002690 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2691 reply.readException();
2692 int result = reply.readInt();
2693 reply.recycle();
2694 data.recycle();
2695 return result;
2696 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002697 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2698 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002699 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2700 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002701 Parcel data = Parcel.obtain();
2702 Parcel reply = Parcel.obtain();
2703 data.writeInterfaceToken(IActivityManager.descriptor);
2704 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002705 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002706 intent.writeToParcel(data, 0);
2707 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002708 data.writeStrongBinder(resultTo);
2709 data.writeString(resultWho);
2710 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002711 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002712 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002713 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002714 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002715 } else {
2716 data.writeInt(0);
2717 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002718 if (options != null) {
2719 data.writeInt(1);
2720 options.writeToParcel(data, 0);
2721 } else {
2722 data.writeInt(0);
2723 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002724 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002725 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2726 reply.readException();
2727 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2728 reply.recycle();
2729 data.recycle();
2730 return result;
2731 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002732 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2733 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002734 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002735 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002736 Parcel data = Parcel.obtain();
2737 Parcel reply = Parcel.obtain();
2738 data.writeInterfaceToken(IActivityManager.descriptor);
2739 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002740 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002741 intent.writeToParcel(data, 0);
2742 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002743 data.writeStrongBinder(resultTo);
2744 data.writeString(resultWho);
2745 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002746 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002747 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002748 if (options != null) {
2749 data.writeInt(1);
2750 options.writeToParcel(data, 0);
2751 } else {
2752 data.writeInt(0);
2753 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002754 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002755 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2756 reply.readException();
2757 int result = reply.readInt();
2758 reply.recycle();
2759 data.recycle();
2760 return result;
2761 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002762 public int startActivityIntentSender(IApplicationThread caller,
2763 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002764 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002765 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002766 Parcel data = Parcel.obtain();
2767 Parcel reply = Parcel.obtain();
2768 data.writeInterfaceToken(IActivityManager.descriptor);
2769 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2770 intent.writeToParcel(data, 0);
2771 if (fillInIntent != null) {
2772 data.writeInt(1);
2773 fillInIntent.writeToParcel(data, 0);
2774 } else {
2775 data.writeInt(0);
2776 }
2777 data.writeString(resolvedType);
2778 data.writeStrongBinder(resultTo);
2779 data.writeString(resultWho);
2780 data.writeInt(requestCode);
2781 data.writeInt(flagsMask);
2782 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002783 if (options != null) {
2784 data.writeInt(1);
2785 options.writeToParcel(data, 0);
2786 } else {
2787 data.writeInt(0);
2788 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002789 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002790 reply.readException();
2791 int result = reply.readInt();
2792 reply.recycle();
2793 data.recycle();
2794 return result;
2795 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002796 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2797 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002798 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2799 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 data.writeString(callingPackage);
2804 data.writeInt(callingPid);
2805 data.writeInt(callingUid);
2806 intent.writeToParcel(data, 0);
2807 data.writeString(resolvedType);
2808 data.writeStrongBinder(session.asBinder());
2809 data.writeStrongBinder(interactor.asBinder());
2810 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002811 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002812 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002813 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002814 } else {
2815 data.writeInt(0);
2816 }
2817 if (options != null) {
2818 data.writeInt(1);
2819 options.writeToParcel(data, 0);
2820 } else {
2821 data.writeInt(0);
2822 }
2823 data.writeInt(userId);
2824 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2825 reply.readException();
2826 int result = reply.readInt();
2827 reply.recycle();
2828 data.recycle();
2829 return result;
2830 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002831 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002832 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002833 Parcel data = Parcel.obtain();
2834 Parcel reply = Parcel.obtain();
2835 data.writeInterfaceToken(IActivityManager.descriptor);
2836 data.writeStrongBinder(callingActivity);
2837 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002838 if (options != null) {
2839 data.writeInt(1);
2840 options.writeToParcel(data, 0);
2841 } else {
2842 data.writeInt(0);
2843 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002844 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2845 reply.readException();
2846 int result = reply.readInt();
2847 reply.recycle();
2848 data.recycle();
2849 return result != 0;
2850 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002851 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2852 Parcel data = Parcel.obtain();
2853 Parcel reply = Parcel.obtain();
2854 data.writeInterfaceToken(IActivityManager.descriptor);
2855 data.writeInt(taskId);
2856 if (options == null) {
2857 data.writeInt(0);
2858 } else {
2859 data.writeInt(1);
2860 options.writeToParcel(data, 0);
2861 }
2862 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2863 reply.readException();
2864 int result = reply.readInt();
2865 reply.recycle();
2866 data.recycle();
2867 return result;
2868 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002869 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002870 throws RemoteException {
2871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeStrongBinder(token);
2875 data.writeInt(resultCode);
2876 if (resultData != null) {
2877 data.writeInt(1);
2878 resultData.writeToParcel(data, 0);
2879 } else {
2880 data.writeInt(0);
2881 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002882 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002883 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2884 reply.readException();
2885 boolean res = reply.readInt() != 0;
2886 data.recycle();
2887 reply.recycle();
2888 return res;
2889 }
2890 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2891 {
2892 Parcel data = Parcel.obtain();
2893 Parcel reply = Parcel.obtain();
2894 data.writeInterfaceToken(IActivityManager.descriptor);
2895 data.writeStrongBinder(token);
2896 data.writeString(resultWho);
2897 data.writeInt(requestCode);
2898 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2899 reply.readException();
2900 data.recycle();
2901 reply.recycle();
2902 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002903 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2904 Parcel data = Parcel.obtain();
2905 Parcel reply = Parcel.obtain();
2906 data.writeInterfaceToken(IActivityManager.descriptor);
2907 data.writeStrongBinder(token);
2908 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2909 reply.readException();
2910 boolean res = reply.readInt() != 0;
2911 data.recycle();
2912 reply.recycle();
2913 return res;
2914 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002915 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2916 Parcel data = Parcel.obtain();
2917 Parcel reply = Parcel.obtain();
2918 data.writeInterfaceToken(IActivityManager.descriptor);
2919 data.writeStrongBinder(session.asBinder());
2920 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2921 reply.readException();
2922 data.recycle();
2923 reply.recycle();
2924 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002925 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2926 Parcel data = Parcel.obtain();
2927 Parcel reply = Parcel.obtain();
2928 data.writeInterfaceToken(IActivityManager.descriptor);
2929 data.writeStrongBinder(token);
2930 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2931 reply.readException();
2932 boolean res = reply.readInt() != 0;
2933 data.recycle();
2934 reply.recycle();
2935 return res;
2936 }
2937 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2938 Parcel data = Parcel.obtain();
2939 Parcel reply = Parcel.obtain();
2940 data.writeInterfaceToken(IActivityManager.descriptor);
2941 data.writeStrongBinder(app.asBinder());
2942 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2943 reply.readException();
2944 data.recycle();
2945 reply.recycle();
2946 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002947 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2948 Parcel data = Parcel.obtain();
2949 Parcel reply = Parcel.obtain();
2950 data.writeInterfaceToken(IActivityManager.descriptor);
2951 data.writeStrongBinder(token);
2952 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2953 reply.readException();
2954 boolean res = reply.readInt() != 0;
2955 data.recycle();
2956 reply.recycle();
2957 return res;
2958 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002959 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002960 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002961 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002962 {
2963 Parcel data = Parcel.obtain();
2964 Parcel reply = Parcel.obtain();
2965 data.writeInterfaceToken(IActivityManager.descriptor);
2966 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002967 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002968 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2969 filter.writeToParcel(data, 0);
2970 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002971 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002972 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2973 reply.readException();
2974 Intent intent = null;
2975 int haveIntent = reply.readInt();
2976 if (haveIntent != 0) {
2977 intent = Intent.CREATOR.createFromParcel(reply);
2978 }
2979 reply.recycle();
2980 data.recycle();
2981 return intent;
2982 }
2983 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2984 {
2985 Parcel data = Parcel.obtain();
2986 Parcel reply = Parcel.obtain();
2987 data.writeInterfaceToken(IActivityManager.descriptor);
2988 data.writeStrongBinder(receiver.asBinder());
2989 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 data.recycle();
2992 reply.recycle();
2993 }
2994 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07002995 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002996 int resultCode, String resultData, Bundle map,
Dianne Hackborna750a632015-06-16 17:18:23 -07002997 String requiredPermission, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002998 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 {
3000 Parcel data = Parcel.obtain();
3001 Parcel reply = Parcel.obtain();
3002 data.writeInterfaceToken(IActivityManager.descriptor);
3003 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3004 intent.writeToParcel(data, 0);
3005 data.writeString(resolvedType);
3006 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3007 data.writeInt(resultCode);
3008 data.writeString(resultData);
3009 data.writeBundle(map);
3010 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003011 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003012 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003013 data.writeInt(serialized ? 1 : 0);
3014 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003015 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3017 reply.readException();
3018 int res = reply.readInt();
3019 reply.recycle();
3020 data.recycle();
3021 return res;
3022 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003023 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3024 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003025 {
3026 Parcel data = Parcel.obtain();
3027 Parcel reply = Parcel.obtain();
3028 data.writeInterfaceToken(IActivityManager.descriptor);
3029 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3030 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003031 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003032 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3033 reply.readException();
3034 data.recycle();
3035 reply.recycle();
3036 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003037 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3038 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003039 {
3040 Parcel data = Parcel.obtain();
3041 Parcel reply = Parcel.obtain();
3042 data.writeInterfaceToken(IActivityManager.descriptor);
3043 data.writeStrongBinder(who);
3044 data.writeInt(resultCode);
3045 data.writeString(resultData);
3046 data.writeBundle(map);
3047 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003048 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003049 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3050 reply.readException();
3051 data.recycle();
3052 reply.recycle();
3053 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003054 public void attachApplication(IApplicationThread app) throws RemoteException
3055 {
3056 Parcel data = Parcel.obtain();
3057 Parcel reply = Parcel.obtain();
3058 data.writeInterfaceToken(IActivityManager.descriptor);
3059 data.writeStrongBinder(app.asBinder());
3060 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3061 reply.readException();
3062 data.recycle();
3063 reply.recycle();
3064 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003065 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3066 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 {
3068 Parcel data = Parcel.obtain();
3069 Parcel reply = Parcel.obtain();
3070 data.writeInterfaceToken(IActivityManager.descriptor);
3071 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003072 if (config != null) {
3073 data.writeInt(1);
3074 config.writeToParcel(data, 0);
3075 } else {
3076 data.writeInt(0);
3077 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003078 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003079 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3080 reply.readException();
3081 data.recycle();
3082 reply.recycle();
3083 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003084 public void activityResumed(IBinder token) throws RemoteException
3085 {
3086 Parcel data = Parcel.obtain();
3087 Parcel reply = Parcel.obtain();
3088 data.writeInterfaceToken(IActivityManager.descriptor);
3089 data.writeStrongBinder(token);
3090 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3091 reply.readException();
3092 data.recycle();
3093 reply.recycle();
3094 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003095 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003096 {
3097 Parcel data = Parcel.obtain();
3098 Parcel reply = Parcel.obtain();
3099 data.writeInterfaceToken(IActivityManager.descriptor);
3100 data.writeStrongBinder(token);
3101 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3102 reply.readException();
3103 data.recycle();
3104 reply.recycle();
3105 }
3106 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003107 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003108 {
3109 Parcel data = Parcel.obtain();
3110 Parcel reply = Parcel.obtain();
3111 data.writeInterfaceToken(IActivityManager.descriptor);
3112 data.writeStrongBinder(token);
3113 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003114 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003115 TextUtils.writeToParcel(description, data, 0);
3116 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3117 reply.readException();
3118 data.recycle();
3119 reply.recycle();
3120 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003121 public void activitySlept(IBinder token) throws RemoteException
3122 {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 data.writeStrongBinder(token);
3127 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3128 reply.readException();
3129 data.recycle();
3130 reply.recycle();
3131 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003132 public void activityDestroyed(IBinder token) throws RemoteException
3133 {
3134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
3137 data.writeStrongBinder(token);
3138 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3139 reply.readException();
3140 data.recycle();
3141 reply.recycle();
3142 }
3143 public String getCallingPackage(IBinder token) throws RemoteException
3144 {
3145 Parcel data = Parcel.obtain();
3146 Parcel reply = Parcel.obtain();
3147 data.writeInterfaceToken(IActivityManager.descriptor);
3148 data.writeStrongBinder(token);
3149 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3150 reply.readException();
3151 String res = reply.readString();
3152 data.recycle();
3153 reply.recycle();
3154 return res;
3155 }
3156 public ComponentName getCallingActivity(IBinder token)
3157 throws RemoteException {
3158 Parcel data = Parcel.obtain();
3159 Parcel reply = Parcel.obtain();
3160 data.writeInterfaceToken(IActivityManager.descriptor);
3161 data.writeStrongBinder(token);
3162 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 ComponentName res = ComponentName.readFromParcel(reply);
3165 data.recycle();
3166 reply.recycle();
3167 return res;
3168 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003169 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003173 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003174 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3175 reply.readException();
3176 ArrayList<IAppTask> list = null;
3177 int N = reply.readInt();
3178 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003179 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003180 while (N > 0) {
3181 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3182 list.add(task);
3183 N--;
3184 }
3185 }
3186 data.recycle();
3187 reply.recycle();
3188 return list;
3189 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003190 public int addAppTask(IBinder activityToken, Intent intent,
3191 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3192 Parcel data = Parcel.obtain();
3193 Parcel reply = Parcel.obtain();
3194 data.writeInterfaceToken(IActivityManager.descriptor);
3195 data.writeStrongBinder(activityToken);
3196 intent.writeToParcel(data, 0);
3197 description.writeToParcel(data, 0);
3198 thumbnail.writeToParcel(data, 0);
3199 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3200 reply.readException();
3201 int res = reply.readInt();
3202 data.recycle();
3203 reply.recycle();
3204 return res;
3205 }
3206 public Point getAppTaskThumbnailSize() throws RemoteException {
3207 Parcel data = Parcel.obtain();
3208 Parcel reply = Parcel.obtain();
3209 data.writeInterfaceToken(IActivityManager.descriptor);
3210 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3211 reply.readException();
3212 Point size = Point.CREATOR.createFromParcel(reply);
3213 data.recycle();
3214 reply.recycle();
3215 return size;
3216 }
Todd Kennedye635f662015-01-20 10:36:49 -08003217 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3218 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003219 Parcel data = Parcel.obtain();
3220 Parcel reply = Parcel.obtain();
3221 data.writeInterfaceToken(IActivityManager.descriptor);
3222 data.writeInt(maxNum);
3223 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003224 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3225 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003226 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003227 int N = reply.readInt();
3228 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003229 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003230 while (N > 0) {
3231 ActivityManager.RunningTaskInfo info =
3232 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003233 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003234 list.add(info);
3235 N--;
3236 }
3237 }
3238 data.recycle();
3239 reply.recycle();
3240 return list;
3241 }
3242 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003243 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003244 Parcel data = Parcel.obtain();
3245 Parcel reply = Parcel.obtain();
3246 data.writeInterfaceToken(IActivityManager.descriptor);
3247 data.writeInt(maxNum);
3248 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003249 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003250 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3251 reply.readException();
3252 ArrayList<ActivityManager.RecentTaskInfo> list
3253 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3254 data.recycle();
3255 reply.recycle();
3256 return list;
3257 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003258 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003259 Parcel data = Parcel.obtain();
3260 Parcel reply = Parcel.obtain();
3261 data.writeInterfaceToken(IActivityManager.descriptor);
3262 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003263 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003264 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003265 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003266 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003267 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003268 }
3269 data.recycle();
3270 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003271 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003272 }
Todd Kennedye635f662015-01-20 10:36:49 -08003273 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3274 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003275 Parcel data = Parcel.obtain();
3276 Parcel reply = Parcel.obtain();
3277 data.writeInterfaceToken(IActivityManager.descriptor);
3278 data.writeInt(maxNum);
3279 data.writeInt(flags);
3280 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3281 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003282 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003283 int N = reply.readInt();
3284 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003285 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003286 while (N > 0) {
3287 ActivityManager.RunningServiceInfo info =
3288 ActivityManager.RunningServiceInfo.CREATOR
3289 .createFromParcel(reply);
3290 list.add(info);
3291 N--;
3292 }
3293 }
3294 data.recycle();
3295 reply.recycle();
3296 return list;
3297 }
3298 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3299 throws RemoteException {
3300 Parcel data = Parcel.obtain();
3301 Parcel reply = Parcel.obtain();
3302 data.writeInterfaceToken(IActivityManager.descriptor);
3303 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3304 reply.readException();
3305 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3306 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3307 data.recycle();
3308 reply.recycle();
3309 return list;
3310 }
3311 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3312 throws RemoteException {
3313 Parcel data = Parcel.obtain();
3314 Parcel reply = Parcel.obtain();
3315 data.writeInterfaceToken(IActivityManager.descriptor);
3316 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 ArrayList<ActivityManager.RunningAppProcessInfo> list
3319 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3320 data.recycle();
3321 reply.recycle();
3322 return list;
3323 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003324 public List<ApplicationInfo> getRunningExternalApplications()
3325 throws RemoteException {
3326 Parcel data = Parcel.obtain();
3327 Parcel reply = Parcel.obtain();
3328 data.writeInterfaceToken(IActivityManager.descriptor);
3329 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 ArrayList<ApplicationInfo> list
3332 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3333 data.recycle();
3334 reply.recycle();
3335 return list;
3336 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003337 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003338 {
3339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003343 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003344 if (options != null) {
3345 data.writeInt(1);
3346 options.writeToParcel(data, 0);
3347 } else {
3348 data.writeInt(0);
3349 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3351 reply.readException();
3352 data.recycle();
3353 reply.recycle();
3354 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003355 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3356 throws RemoteException {
3357 Parcel data = Parcel.obtain();
3358 Parcel reply = Parcel.obtain();
3359 data.writeInterfaceToken(IActivityManager.descriptor);
3360 data.writeStrongBinder(token);
3361 data.writeInt(nonRoot ? 1 : 0);
3362 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 boolean res = reply.readInt() != 0;
3365 data.recycle();
3366 reply.recycle();
3367 return res;
3368 }
3369 public void moveTaskBackwards(int task) throws RemoteException
3370 {
3371 Parcel data = Parcel.obtain();
3372 Parcel reply = Parcel.obtain();
3373 data.writeInterfaceToken(IActivityManager.descriptor);
3374 data.writeInt(task);
3375 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3376 reply.readException();
3377 data.recycle();
3378 reply.recycle();
3379 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003380 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003381 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3382 {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003385 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003386 data.writeInt(taskId);
3387 data.writeInt(stackId);
3388 data.writeInt(toTop ? 1 : 0);
3389 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3390 reply.readException();
3391 data.recycle();
3392 reply.recycle();
3393 }
3394 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003395 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003396 {
3397 Parcel data = Parcel.obtain();
3398 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003399 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003400 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003401 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003402 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003403 reply.readException();
3404 data.recycle();
3405 reply.recycle();
3406 }
Craig Mautner967212c2013-04-13 21:10:58 -07003407 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003408 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003409 {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003413 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003414 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003415 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003416 data.recycle();
3417 reply.recycle();
3418 return list;
3419 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003420 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003421 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003422 {
3423 Parcel data = Parcel.obtain();
3424 Parcel reply = Parcel.obtain();
3425 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003426 data.writeInt(stackId);
3427 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003428 reply.readException();
3429 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003430 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003431 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003432 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003433 }
3434 data.recycle();
3435 reply.recycle();
3436 return info;
3437 }
3438 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003439 public boolean isInHomeStack(int taskId) throws RemoteException {
3440 Parcel data = Parcel.obtain();
3441 Parcel reply = Parcel.obtain();
3442 data.writeInterfaceToken(IActivityManager.descriptor);
3443 data.writeInt(taskId);
3444 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3445 reply.readException();
3446 boolean isInHomeStack = reply.readInt() > 0;
3447 data.recycle();
3448 reply.recycle();
3449 return isInHomeStack;
3450 }
3451 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003452 public void setFocusedStack(int stackId) throws RemoteException
3453 {
3454 Parcel data = Parcel.obtain();
3455 Parcel reply = Parcel.obtain();
3456 data.writeInterfaceToken(IActivityManager.descriptor);
3457 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003458 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003459 reply.readException();
3460 data.recycle();
3461 reply.recycle();
3462 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003463 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003464 public int getFocusedStackId() throws RemoteException {
3465 Parcel data = Parcel.obtain();
3466 Parcel reply = Parcel.obtain();
3467 data.writeInterfaceToken(IActivityManager.descriptor);
3468 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3469 reply.readException();
3470 int focusedStackId = reply.readInt();
3471 data.recycle();
3472 reply.recycle();
3473 return focusedStackId;
3474 }
3475 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003476 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3477 {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003482 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003483 reply.readException();
3484 data.recycle();
3485 reply.recycle();
3486 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003487 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3488 {
3489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
3492 data.writeStrongBinder(token);
3493 data.writeInt(onlyRoot ? 1 : 0);
3494 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 int res = reply.readInt();
3497 data.recycle();
3498 reply.recycle();
3499 return res;
3500 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003501 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003502 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003503 Parcel data = Parcel.obtain();
3504 Parcel reply = Parcel.obtain();
3505 data.writeInterfaceToken(IActivityManager.descriptor);
3506 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3507 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003508 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003509 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003510 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3511 reply.readException();
3512 int res = reply.readInt();
3513 ContentProviderHolder cph = null;
3514 if (res != 0) {
3515 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3516 }
3517 data.recycle();
3518 reply.recycle();
3519 return cph;
3520 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003521 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3522 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003527 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003528 data.writeStrongBinder(token);
3529 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3530 reply.readException();
3531 int res = reply.readInt();
3532 ContentProviderHolder cph = null;
3533 if (res != 0) {
3534 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3535 }
3536 data.recycle();
3537 reply.recycle();
3538 return cph;
3539 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003540 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003541 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003542 {
3543 Parcel data = Parcel.obtain();
3544 Parcel reply = Parcel.obtain();
3545 data.writeInterfaceToken(IActivityManager.descriptor);
3546 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3547 data.writeTypedList(providers);
3548 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3549 reply.readException();
3550 data.recycle();
3551 reply.recycle();
3552 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003553 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3554 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003555 Parcel data = Parcel.obtain();
3556 Parcel reply = Parcel.obtain();
3557 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003558 data.writeStrongBinder(connection);
3559 data.writeInt(stable);
3560 data.writeInt(unstable);
3561 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 boolean res = reply.readInt() != 0;
3564 data.recycle();
3565 reply.recycle();
3566 return res;
3567 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003568
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003569 public void unstableProviderDied(IBinder connection) throws RemoteException {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeStrongBinder(connection);
3574 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3575 reply.readException();
3576 data.recycle();
3577 reply.recycle();
3578 }
3579
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003580 @Override
3581 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 data.writeStrongBinder(connection);
3586 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3587 reply.readException();
3588 data.recycle();
3589 reply.recycle();
3590 }
3591
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003592 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3593 Parcel data = Parcel.obtain();
3594 Parcel reply = Parcel.obtain();
3595 data.writeInterfaceToken(IActivityManager.descriptor);
3596 data.writeStrongBinder(connection);
3597 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003598 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3599 reply.readException();
3600 data.recycle();
3601 reply.recycle();
3602 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003603
3604 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3605 Parcel data = Parcel.obtain();
3606 Parcel reply = Parcel.obtain();
3607 data.writeInterfaceToken(IActivityManager.descriptor);
3608 data.writeString(name);
3609 data.writeStrongBinder(token);
3610 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3611 reply.readException();
3612 data.recycle();
3613 reply.recycle();
3614 }
3615
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003616 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3617 throws RemoteException
3618 {
3619 Parcel data = Parcel.obtain();
3620 Parcel reply = Parcel.obtain();
3621 data.writeInterfaceToken(IActivityManager.descriptor);
3622 service.writeToParcel(data, 0);
3623 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3624 reply.readException();
3625 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3626 data.recycle();
3627 reply.recycle();
3628 return res;
3629 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003630
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003631 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003632 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003633 {
3634 Parcel data = Parcel.obtain();
3635 Parcel reply = Parcel.obtain();
3636 data.writeInterfaceToken(IActivityManager.descriptor);
3637 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3638 service.writeToParcel(data, 0);
3639 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003640 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003641 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3642 reply.readException();
3643 ComponentName res = ComponentName.readFromParcel(reply);
3644 data.recycle();
3645 reply.recycle();
3646 return res;
3647 }
3648 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003649 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003650 {
3651 Parcel data = Parcel.obtain();
3652 Parcel reply = Parcel.obtain();
3653 data.writeInterfaceToken(IActivityManager.descriptor);
3654 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3655 service.writeToParcel(data, 0);
3656 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003657 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003658 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3659 reply.readException();
3660 int res = reply.readInt();
3661 reply.recycle();
3662 data.recycle();
3663 return res;
3664 }
3665 public boolean stopServiceToken(ComponentName className, IBinder token,
3666 int startId) throws RemoteException {
3667 Parcel data = Parcel.obtain();
3668 Parcel reply = Parcel.obtain();
3669 data.writeInterfaceToken(IActivityManager.descriptor);
3670 ComponentName.writeToParcel(className, data);
3671 data.writeStrongBinder(token);
3672 data.writeInt(startId);
3673 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3674 reply.readException();
3675 boolean res = reply.readInt() != 0;
3676 data.recycle();
3677 reply.recycle();
3678 return res;
3679 }
3680 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003681 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003682 Parcel data = Parcel.obtain();
3683 Parcel reply = Parcel.obtain();
3684 data.writeInterfaceToken(IActivityManager.descriptor);
3685 ComponentName.writeToParcel(className, data);
3686 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003687 data.writeInt(id);
3688 if (notification != null) {
3689 data.writeInt(1);
3690 notification.writeToParcel(data, 0);
3691 } else {
3692 data.writeInt(0);
3693 }
3694 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003695 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3696 reply.readException();
3697 data.recycle();
3698 reply.recycle();
3699 }
3700 public int bindService(IApplicationThread caller, IBinder token,
3701 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003702 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003703 Parcel data = Parcel.obtain();
3704 Parcel reply = Parcel.obtain();
3705 data.writeInterfaceToken(IActivityManager.descriptor);
3706 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3707 data.writeStrongBinder(token);
3708 service.writeToParcel(data, 0);
3709 data.writeString(resolvedType);
3710 data.writeStrongBinder(connection.asBinder());
3711 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003712 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003713 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3714 reply.readException();
3715 int res = reply.readInt();
3716 data.recycle();
3717 reply.recycle();
3718 return res;
3719 }
3720 public boolean unbindService(IServiceConnection connection) throws RemoteException
3721 {
3722 Parcel data = Parcel.obtain();
3723 Parcel reply = Parcel.obtain();
3724 data.writeInterfaceToken(IActivityManager.descriptor);
3725 data.writeStrongBinder(connection.asBinder());
3726 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3727 reply.readException();
3728 boolean res = reply.readInt() != 0;
3729 data.recycle();
3730 reply.recycle();
3731 return res;
3732 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003733
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003734 public void publishService(IBinder token,
3735 Intent intent, IBinder service) throws RemoteException {
3736 Parcel data = Parcel.obtain();
3737 Parcel reply = Parcel.obtain();
3738 data.writeInterfaceToken(IActivityManager.descriptor);
3739 data.writeStrongBinder(token);
3740 intent.writeToParcel(data, 0);
3741 data.writeStrongBinder(service);
3742 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3743 reply.readException();
3744 data.recycle();
3745 reply.recycle();
3746 }
3747
3748 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3749 throws RemoteException {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 data.writeStrongBinder(token);
3754 intent.writeToParcel(data, 0);
3755 data.writeInt(doRebind ? 1 : 0);
3756 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3757 reply.readException();
3758 data.recycle();
3759 reply.recycle();
3760 }
3761
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003762 public void serviceDoneExecuting(IBinder token, int type, int startId,
3763 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003764 Parcel data = Parcel.obtain();
3765 Parcel reply = Parcel.obtain();
3766 data.writeInterfaceToken(IActivityManager.descriptor);
3767 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003768 data.writeInt(type);
3769 data.writeInt(startId);
3770 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003771 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3772 reply.readException();
3773 data.recycle();
3774 reply.recycle();
3775 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003776
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003777 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3778 Parcel data = Parcel.obtain();
3779 Parcel reply = Parcel.obtain();
3780 data.writeInterfaceToken(IActivityManager.descriptor);
3781 service.writeToParcel(data, 0);
3782 data.writeString(resolvedType);
3783 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 IBinder binder = reply.readStrongBinder();
3786 reply.recycle();
3787 data.recycle();
3788 return binder;
3789 }
3790
Christopher Tate181fafa2009-05-14 11:12:14 -07003791 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3792 throws RemoteException {
3793 Parcel data = Parcel.obtain();
3794 Parcel reply = Parcel.obtain();
3795 data.writeInterfaceToken(IActivityManager.descriptor);
3796 app.writeToParcel(data, 0);
3797 data.writeInt(backupRestoreMode);
3798 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3799 reply.readException();
3800 boolean success = reply.readInt() != 0;
3801 reply.recycle();
3802 data.recycle();
3803 return success;
3804 }
3805
Christopher Tate346acb12012-10-15 19:20:25 -07003806 public void clearPendingBackup() throws RemoteException {
3807 Parcel data = Parcel.obtain();
3808 Parcel reply = Parcel.obtain();
3809 data.writeInterfaceToken(IActivityManager.descriptor);
3810 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3811 reply.recycle();
3812 data.recycle();
3813 }
3814
Christopher Tate181fafa2009-05-14 11:12:14 -07003815 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3816 Parcel data = Parcel.obtain();
3817 Parcel reply = Parcel.obtain();
3818 data.writeInterfaceToken(IActivityManager.descriptor);
3819 data.writeString(packageName);
3820 data.writeStrongBinder(agent);
3821 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3822 reply.recycle();
3823 data.recycle();
3824 }
3825
3826 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3827 Parcel data = Parcel.obtain();
3828 Parcel reply = Parcel.obtain();
3829 data.writeInterfaceToken(IActivityManager.descriptor);
3830 app.writeToParcel(data, 0);
3831 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3832 reply.readException();
3833 reply.recycle();
3834 data.recycle();
3835 }
3836
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003837 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003838 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003839 IUiAutomationConnection connection, int userId, String instructionSet)
3840 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
3843 data.writeInterfaceToken(IActivityManager.descriptor);
3844 ComponentName.writeToParcel(className, data);
3845 data.writeString(profileFile);
3846 data.writeInt(flags);
3847 data.writeBundle(arguments);
3848 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003849 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003850 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003851 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003852 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3853 reply.readException();
3854 boolean res = reply.readInt() != 0;
3855 reply.recycle();
3856 data.recycle();
3857 return res;
3858 }
3859
3860 public void finishInstrumentation(IApplicationThread target,
3861 int resultCode, Bundle results) throws RemoteException {
3862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 data.writeStrongBinder(target != null ? target.asBinder() : null);
3866 data.writeInt(resultCode);
3867 data.writeBundle(results);
3868 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3869 reply.readException();
3870 data.recycle();
3871 reply.recycle();
3872 }
3873 public Configuration getConfiguration() throws RemoteException
3874 {
3875 Parcel data = Parcel.obtain();
3876 Parcel reply = Parcel.obtain();
3877 data.writeInterfaceToken(IActivityManager.descriptor);
3878 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3881 reply.recycle();
3882 data.recycle();
3883 return res;
3884 }
3885 public void updateConfiguration(Configuration values) throws RemoteException
3886 {
3887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 values.writeToParcel(data, 0);
3891 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3892 reply.readException();
3893 data.recycle();
3894 reply.recycle();
3895 }
3896 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3897 throws RemoteException {
3898 Parcel data = Parcel.obtain();
3899 Parcel reply = Parcel.obtain();
3900 data.writeInterfaceToken(IActivityManager.descriptor);
3901 data.writeStrongBinder(token);
3902 data.writeInt(requestedOrientation);
3903 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3904 reply.readException();
3905 data.recycle();
3906 reply.recycle();
3907 }
3908 public int getRequestedOrientation(IBinder token) throws RemoteException {
3909 Parcel data = Parcel.obtain();
3910 Parcel reply = Parcel.obtain();
3911 data.writeInterfaceToken(IActivityManager.descriptor);
3912 data.writeStrongBinder(token);
3913 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3914 reply.readException();
3915 int res = reply.readInt();
3916 data.recycle();
3917 reply.recycle();
3918 return res;
3919 }
3920 public ComponentName getActivityClassForToken(IBinder token)
3921 throws RemoteException {
3922 Parcel data = Parcel.obtain();
3923 Parcel reply = Parcel.obtain();
3924 data.writeInterfaceToken(IActivityManager.descriptor);
3925 data.writeStrongBinder(token);
3926 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3927 reply.readException();
3928 ComponentName res = ComponentName.readFromParcel(reply);
3929 data.recycle();
3930 reply.recycle();
3931 return res;
3932 }
3933 public String getPackageForToken(IBinder token) throws RemoteException
3934 {
3935 Parcel data = Parcel.obtain();
3936 Parcel reply = Parcel.obtain();
3937 data.writeInterfaceToken(IActivityManager.descriptor);
3938 data.writeStrongBinder(token);
3939 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3940 reply.readException();
3941 String res = reply.readString();
3942 data.recycle();
3943 reply.recycle();
3944 return res;
3945 }
3946 public IIntentSender getIntentSender(int type,
3947 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003948 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003949 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 data.writeInt(type);
3954 data.writeString(packageName);
3955 data.writeStrongBinder(token);
3956 data.writeString(resultWho);
3957 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003958 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003959 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003960 data.writeTypedArray(intents, 0);
3961 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003962 } else {
3963 data.writeInt(0);
3964 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003965 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003966 if (options != null) {
3967 data.writeInt(1);
3968 options.writeToParcel(data, 0);
3969 } else {
3970 data.writeInt(0);
3971 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003972 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003973 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3974 reply.readException();
3975 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003976 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003977 data.recycle();
3978 reply.recycle();
3979 return res;
3980 }
3981 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3982 Parcel data = Parcel.obtain();
3983 Parcel reply = Parcel.obtain();
3984 data.writeInterfaceToken(IActivityManager.descriptor);
3985 data.writeStrongBinder(sender.asBinder());
3986 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3987 reply.readException();
3988 data.recycle();
3989 reply.recycle();
3990 }
3991 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
3995 data.writeStrongBinder(sender.asBinder());
3996 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3997 reply.readException();
3998 String res = reply.readString();
3999 data.recycle();
4000 reply.recycle();
4001 return res;
4002 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004003 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4004 Parcel data = Parcel.obtain();
4005 Parcel reply = Parcel.obtain();
4006 data.writeInterfaceToken(IActivityManager.descriptor);
4007 data.writeStrongBinder(sender.asBinder());
4008 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4009 reply.readException();
4010 int res = reply.readInt();
4011 data.recycle();
4012 reply.recycle();
4013 return res;
4014 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004015 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4016 boolean requireFull, String name, String callerPackage) throws RemoteException {
4017 Parcel data = Parcel.obtain();
4018 Parcel reply = Parcel.obtain();
4019 data.writeInterfaceToken(IActivityManager.descriptor);
4020 data.writeInt(callingPid);
4021 data.writeInt(callingUid);
4022 data.writeInt(userId);
4023 data.writeInt(allowAll ? 1 : 0);
4024 data.writeInt(requireFull ? 1 : 0);
4025 data.writeString(name);
4026 data.writeString(callerPackage);
4027 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4028 reply.readException();
4029 int res = reply.readInt();
4030 data.recycle();
4031 reply.recycle();
4032 return res;
4033 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004034 public void setProcessLimit(int max) throws RemoteException
4035 {
4036 Parcel data = Parcel.obtain();
4037 Parcel reply = Parcel.obtain();
4038 data.writeInterfaceToken(IActivityManager.descriptor);
4039 data.writeInt(max);
4040 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4041 reply.readException();
4042 data.recycle();
4043 reply.recycle();
4044 }
4045 public int getProcessLimit() throws RemoteException
4046 {
4047 Parcel data = Parcel.obtain();
4048 Parcel reply = Parcel.obtain();
4049 data.writeInterfaceToken(IActivityManager.descriptor);
4050 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4051 reply.readException();
4052 int res = reply.readInt();
4053 data.recycle();
4054 reply.recycle();
4055 return res;
4056 }
4057 public void setProcessForeground(IBinder token, int pid,
4058 boolean isForeground) throws RemoteException {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 data.writeStrongBinder(token);
4063 data.writeInt(pid);
4064 data.writeInt(isForeground ? 1 : 0);
4065 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 data.recycle();
4068 reply.recycle();
4069 }
4070 public int checkPermission(String permission, int pid, int uid)
4071 throws RemoteException {
4072 Parcel data = Parcel.obtain();
4073 Parcel reply = Parcel.obtain();
4074 data.writeInterfaceToken(IActivityManager.descriptor);
4075 data.writeString(permission);
4076 data.writeInt(pid);
4077 data.writeInt(uid);
4078 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4079 reply.readException();
4080 int res = reply.readInt();
4081 data.recycle();
4082 reply.recycle();
4083 return res;
4084 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004085 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4086 throws RemoteException {
4087 Parcel data = Parcel.obtain();
4088 Parcel reply = Parcel.obtain();
4089 data.writeInterfaceToken(IActivityManager.descriptor);
4090 data.writeString(permission);
4091 data.writeInt(pid);
4092 data.writeInt(uid);
4093 data.writeStrongBinder(callerToken);
4094 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 int res = reply.readInt();
4097 data.recycle();
4098 reply.recycle();
4099 return res;
4100 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004101 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004102 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004103 Parcel data = Parcel.obtain();
4104 Parcel reply = Parcel.obtain();
4105 data.writeInterfaceToken(IActivityManager.descriptor);
4106 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004107 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004108 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004109 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4110 reply.readException();
4111 boolean res = reply.readInt() != 0;
4112 data.recycle();
4113 reply.recycle();
4114 return res;
4115 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004116 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4117 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004118 Parcel data = Parcel.obtain();
4119 Parcel reply = Parcel.obtain();
4120 data.writeInterfaceToken(IActivityManager.descriptor);
4121 uri.writeToParcel(data, 0);
4122 data.writeInt(pid);
4123 data.writeInt(uid);
4124 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004125 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004126 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004127 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4128 reply.readException();
4129 int res = reply.readInt();
4130 data.recycle();
4131 reply.recycle();
4132 return res;
4133 }
4134 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004135 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004136 Parcel data = Parcel.obtain();
4137 Parcel reply = Parcel.obtain();
4138 data.writeInterfaceToken(IActivityManager.descriptor);
4139 data.writeStrongBinder(caller.asBinder());
4140 data.writeString(targetPkg);
4141 uri.writeToParcel(data, 0);
4142 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004143 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004144 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4145 reply.readException();
4146 data.recycle();
4147 reply.recycle();
4148 }
4149 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004150 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004151 Parcel data = Parcel.obtain();
4152 Parcel reply = Parcel.obtain();
4153 data.writeInterfaceToken(IActivityManager.descriptor);
4154 data.writeStrongBinder(caller.asBinder());
4155 uri.writeToParcel(data, 0);
4156 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004157 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004158 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4159 reply.readException();
4160 data.recycle();
4161 reply.recycle();
4162 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004163
4164 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004165 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4166 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004167 Parcel data = Parcel.obtain();
4168 Parcel reply = Parcel.obtain();
4169 data.writeInterfaceToken(IActivityManager.descriptor);
4170 uri.writeToParcel(data, 0);
4171 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004172 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004173 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4174 reply.readException();
4175 data.recycle();
4176 reply.recycle();
4177 }
4178
4179 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004180 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4181 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004182 Parcel data = Parcel.obtain();
4183 Parcel reply = Parcel.obtain();
4184 data.writeInterfaceToken(IActivityManager.descriptor);
4185 uri.writeToParcel(data, 0);
4186 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004187 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004188 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4189 reply.readException();
4190 data.recycle();
4191 reply.recycle();
4192 }
4193
4194 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004195 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4196 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004197 Parcel data = Parcel.obtain();
4198 Parcel reply = Parcel.obtain();
4199 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004200 data.writeString(packageName);
4201 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004202 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4203 reply.readException();
4204 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4205 reply);
4206 data.recycle();
4207 reply.recycle();
4208 return perms;
4209 }
4210
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004211 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4212 throws RemoteException {
4213 Parcel data = Parcel.obtain();
4214 Parcel reply = Parcel.obtain();
4215 data.writeInterfaceToken(IActivityManager.descriptor);
4216 data.writeStrongBinder(who.asBinder());
4217 data.writeInt(waiting ? 1 : 0);
4218 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4219 reply.readException();
4220 data.recycle();
4221 reply.recycle();
4222 }
4223 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4224 Parcel data = Parcel.obtain();
4225 Parcel reply = Parcel.obtain();
4226 data.writeInterfaceToken(IActivityManager.descriptor);
4227 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4228 reply.readException();
4229 outInfo.readFromParcel(reply);
4230 data.recycle();
4231 reply.recycle();
4232 }
4233 public void unhandledBack() throws RemoteException
4234 {
4235 Parcel data = Parcel.obtain();
4236 Parcel reply = Parcel.obtain();
4237 data.writeInterfaceToken(IActivityManager.descriptor);
4238 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4239 reply.readException();
4240 data.recycle();
4241 reply.recycle();
4242 }
4243 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4244 {
4245 Parcel data = Parcel.obtain();
4246 Parcel reply = Parcel.obtain();
4247 data.writeInterfaceToken(IActivityManager.descriptor);
4248 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4249 reply.readException();
4250 ParcelFileDescriptor pfd = null;
4251 if (reply.readInt() != 0) {
4252 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4253 }
4254 data.recycle();
4255 reply.recycle();
4256 return pfd;
4257 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004258 public void setLockScreenShown(boolean shown) throws RemoteException
4259 {
4260 Parcel data = Parcel.obtain();
4261 Parcel reply = Parcel.obtain();
4262 data.writeInterfaceToken(IActivityManager.descriptor);
4263 data.writeInt(shown ? 1 : 0);
4264 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4265 reply.readException();
4266 data.recycle();
4267 reply.recycle();
4268 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004269 public void setDebugApp(
4270 String packageName, boolean waitForDebugger, boolean persistent)
4271 throws RemoteException
4272 {
4273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 data.writeString(packageName);
4277 data.writeInt(waitForDebugger ? 1 : 0);
4278 data.writeInt(persistent ? 1 : 0);
4279 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4280 reply.readException();
4281 data.recycle();
4282 reply.recycle();
4283 }
4284 public void setAlwaysFinish(boolean enabled) throws RemoteException
4285 {
4286 Parcel data = Parcel.obtain();
4287 Parcel reply = Parcel.obtain();
4288 data.writeInterfaceToken(IActivityManager.descriptor);
4289 data.writeInt(enabled ? 1 : 0);
4290 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4291 reply.readException();
4292 data.recycle();
4293 reply.recycle();
4294 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004295 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004296 {
4297 Parcel data = Parcel.obtain();
4298 Parcel reply = Parcel.obtain();
4299 data.writeInterfaceToken(IActivityManager.descriptor);
4300 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004301 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004302 reply.readException();
4303 data.recycle();
4304 reply.recycle();
4305 }
4306 public void enterSafeMode() throws RemoteException {
4307 Parcel data = Parcel.obtain();
4308 data.writeInterfaceToken(IActivityManager.descriptor);
4309 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4310 data.recycle();
4311 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004312 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004313 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004314 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004315 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004316 data.writeStrongBinder(sender.asBinder());
4317 data.writeInt(sourceUid);
4318 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004319 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004320 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4321 data.recycle();
4322 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004323 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4324 throws RemoteException {
4325 Parcel data = Parcel.obtain();
4326 data.writeInterfaceToken(IActivityManager.descriptor);
4327 data.writeStrongBinder(sender.asBinder());
4328 data.writeInt(sourceUid);
4329 data.writeString(tag);
4330 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4331 data.recycle();
4332 }
4333 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4334 throws RemoteException {
4335 Parcel data = Parcel.obtain();
4336 data.writeInterfaceToken(IActivityManager.descriptor);
4337 data.writeStrongBinder(sender.asBinder());
4338 data.writeInt(sourceUid);
4339 data.writeString(tag);
4340 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4341 data.recycle();
4342 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004343 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004344 Parcel data = Parcel.obtain();
4345 Parcel reply = Parcel.obtain();
4346 data.writeInterfaceToken(IActivityManager.descriptor);
4347 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004348 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004349 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004350 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004351 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004352 boolean res = reply.readInt() != 0;
4353 data.recycle();
4354 reply.recycle();
4355 return res;
4356 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004357 @Override
4358 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4359 Parcel data = Parcel.obtain();
4360 Parcel reply = Parcel.obtain();
4361 data.writeInterfaceToken(IActivityManager.descriptor);
4362 data.writeString(reason);
4363 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4364 boolean res = reply.readInt() != 0;
4365 data.recycle();
4366 reply.recycle();
4367 return res;
4368 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004369 public boolean testIsSystemReady()
4370 {
4371 /* this base class version is never called */
4372 return true;
4373 }
Dan Egnor60d87622009-12-16 16:32:58 -08004374 public void handleApplicationCrash(IBinder app,
4375 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4376 {
4377 Parcel data = Parcel.obtain();
4378 Parcel reply = Parcel.obtain();
4379 data.writeInterfaceToken(IActivityManager.descriptor);
4380 data.writeStrongBinder(app);
4381 crashInfo.writeToParcel(data, 0);
4382 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4383 reply.readException();
4384 reply.recycle();
4385 data.recycle();
4386 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004387
Dianne Hackborn52322712014-08-26 22:47:26 -07004388 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004389 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004390 {
4391 Parcel data = Parcel.obtain();
4392 Parcel reply = Parcel.obtain();
4393 data.writeInterfaceToken(IActivityManager.descriptor);
4394 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004395 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004396 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004397 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004398 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004399 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004400 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004401 reply.recycle();
4402 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004403 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004404 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004405
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004406 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004407 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004408 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004409 {
4410 Parcel data = Parcel.obtain();
4411 Parcel reply = Parcel.obtain();
4412 data.writeInterfaceToken(IActivityManager.descriptor);
4413 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004414 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004415 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004416 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4417 reply.readException();
4418 reply.recycle();
4419 data.recycle();
4420 }
4421
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004422 public void signalPersistentProcesses(int sig) throws RemoteException {
4423 Parcel data = Parcel.obtain();
4424 Parcel reply = Parcel.obtain();
4425 data.writeInterfaceToken(IActivityManager.descriptor);
4426 data.writeInt(sig);
4427 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4428 reply.readException();
4429 data.recycle();
4430 reply.recycle();
4431 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004432
Dianne Hackborn1676c852012-09-10 14:52:30 -07004433 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004438 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004439 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4440 reply.readException();
4441 data.recycle();
4442 reply.recycle();
4443 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004444
4445 public void killAllBackgroundProcesses() throws RemoteException {
4446 Parcel data = Parcel.obtain();
4447 Parcel reply = Parcel.obtain();
4448 data.writeInterfaceToken(IActivityManager.descriptor);
4449 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4450 reply.readException();
4451 data.recycle();
4452 reply.recycle();
4453 }
4454
Dianne Hackborn1676c852012-09-10 14:52:30 -07004455 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004456 Parcel data = Parcel.obtain();
4457 Parcel reply = Parcel.obtain();
4458 data.writeInterfaceToken(IActivityManager.descriptor);
4459 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004460 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004461 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004462 reply.readException();
4463 data.recycle();
4464 reply.recycle();
4465 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004466
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004467 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4468 throws RemoteException
4469 {
4470 Parcel data = Parcel.obtain();
4471 Parcel reply = Parcel.obtain();
4472 data.writeInterfaceToken(IActivityManager.descriptor);
4473 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4474 reply.readException();
4475 outInfo.readFromParcel(reply);
4476 reply.recycle();
4477 data.recycle();
4478 }
4479
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004480 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4481 {
4482 Parcel data = Parcel.obtain();
4483 Parcel reply = Parcel.obtain();
4484 data.writeInterfaceToken(IActivityManager.descriptor);
4485 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4486 reply.readException();
4487 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4488 reply.recycle();
4489 data.recycle();
4490 return res;
4491 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004492
Dianne Hackborn1676c852012-09-10 14:52:30 -07004493 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004494 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004495 {
4496 Parcel data = Parcel.obtain();
4497 Parcel reply = Parcel.obtain();
4498 data.writeInterfaceToken(IActivityManager.descriptor);
4499 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004500 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004501 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004502 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004503 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004504 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004505 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004506 } else {
4507 data.writeInt(0);
4508 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004509 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4510 reply.readException();
4511 boolean res = reply.readInt() != 0;
4512 reply.recycle();
4513 data.recycle();
4514 return res;
4515 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004516
Dianne Hackborn55280a92009-05-07 15:53:46 -07004517 public boolean shutdown(int timeout) throws RemoteException
4518 {
4519 Parcel data = Parcel.obtain();
4520 Parcel reply = Parcel.obtain();
4521 data.writeInterfaceToken(IActivityManager.descriptor);
4522 data.writeInt(timeout);
4523 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4524 reply.readException();
4525 boolean res = reply.readInt() != 0;
4526 reply.recycle();
4527 data.recycle();
4528 return res;
4529 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004530
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004531 public void stopAppSwitches() throws RemoteException {
4532 Parcel data = Parcel.obtain();
4533 Parcel reply = Parcel.obtain();
4534 data.writeInterfaceToken(IActivityManager.descriptor);
4535 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4536 reply.readException();
4537 reply.recycle();
4538 data.recycle();
4539 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004540
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004541 public void resumeAppSwitches() throws RemoteException {
4542 Parcel data = Parcel.obtain();
4543 Parcel reply = Parcel.obtain();
4544 data.writeInterfaceToken(IActivityManager.descriptor);
4545 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4546 reply.readException();
4547 reply.recycle();
4548 data.recycle();
4549 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004550
4551 public void addPackageDependency(String packageName) throws RemoteException {
4552 Parcel data = Parcel.obtain();
4553 Parcel reply = Parcel.obtain();
4554 data.writeInterfaceToken(IActivityManager.descriptor);
4555 data.writeString(packageName);
4556 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4557 reply.readException();
4558 data.recycle();
4559 reply.recycle();
4560 }
4561
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004562 public void killApplicationWithAppId(String pkg, int appid, String reason)
4563 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004564 Parcel data = Parcel.obtain();
4565 Parcel reply = Parcel.obtain();
4566 data.writeInterfaceToken(IActivityManager.descriptor);
4567 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004568 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004569 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004570 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004571 reply.readException();
4572 data.recycle();
4573 reply.recycle();
4574 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004575
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004576 public void closeSystemDialogs(String reason) throws RemoteException {
4577 Parcel data = Parcel.obtain();
4578 Parcel reply = Parcel.obtain();
4579 data.writeInterfaceToken(IActivityManager.descriptor);
4580 data.writeString(reason);
4581 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4582 reply.readException();
4583 data.recycle();
4584 reply.recycle();
4585 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004586
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004587 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004588 throws RemoteException {
4589 Parcel data = Parcel.obtain();
4590 Parcel reply = Parcel.obtain();
4591 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004592 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004593 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4594 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004595 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004596 data.recycle();
4597 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004598 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004599 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004600
4601 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4602 Parcel data = Parcel.obtain();
4603 Parcel reply = Parcel.obtain();
4604 data.writeInterfaceToken(IActivityManager.descriptor);
4605 data.writeString(processName);
4606 data.writeInt(uid);
4607 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4608 reply.readException();
4609 data.recycle();
4610 reply.recycle();
4611 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004612
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004613 public void overridePendingTransition(IBinder token, String packageName,
4614 int enterAnim, int exitAnim) throws RemoteException {
4615 Parcel data = Parcel.obtain();
4616 Parcel reply = Parcel.obtain();
4617 data.writeInterfaceToken(IActivityManager.descriptor);
4618 data.writeStrongBinder(token);
4619 data.writeString(packageName);
4620 data.writeInt(enterAnim);
4621 data.writeInt(exitAnim);
4622 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4623 reply.readException();
4624 data.recycle();
4625 reply.recycle();
4626 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004627
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004628 public boolean isUserAMonkey() throws RemoteException {
4629 Parcel data = Parcel.obtain();
4630 Parcel reply = Parcel.obtain();
4631 data.writeInterfaceToken(IActivityManager.descriptor);
4632 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4633 reply.readException();
4634 boolean res = reply.readInt() != 0;
4635 data.recycle();
4636 reply.recycle();
4637 return res;
4638 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004639
4640 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4641 Parcel data = Parcel.obtain();
4642 Parcel reply = Parcel.obtain();
4643 data.writeInterfaceToken(IActivityManager.descriptor);
4644 data.writeInt(monkey ? 1 : 0);
4645 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4646 reply.readException();
4647 data.recycle();
4648 reply.recycle();
4649 }
4650
Dianne Hackborn860755f2010-06-03 18:47:52 -07004651 public void finishHeavyWeightApp() throws RemoteException {
4652 Parcel data = Parcel.obtain();
4653 Parcel reply = Parcel.obtain();
4654 data.writeInterfaceToken(IActivityManager.descriptor);
4655 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4656 reply.readException();
4657 data.recycle();
4658 reply.recycle();
4659 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004660
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004661 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004662 throws RemoteException {
4663 Parcel data = Parcel.obtain();
4664 Parcel reply = Parcel.obtain();
4665 data.writeInterfaceToken(IActivityManager.descriptor);
4666 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004667 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4668 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004669 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004670 data.recycle();
4671 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004672 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004673 }
4674
Craig Mautner233ceee2014-05-09 17:05:11 -07004675 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004676 throws RemoteException {
4677 Parcel data = Parcel.obtain();
4678 Parcel reply = Parcel.obtain();
4679 data.writeInterfaceToken(IActivityManager.descriptor);
4680 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004681 if (options == null) {
4682 data.writeInt(0);
4683 } else {
4684 data.writeInt(1);
4685 data.writeBundle(options.toBundle());
4686 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004687 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004688 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004689 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004690 data.recycle();
4691 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004692 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004693 }
4694
Craig Mautner233ceee2014-05-09 17:05:11 -07004695 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4696 Parcel data = Parcel.obtain();
4697 Parcel reply = Parcel.obtain();
4698 data.writeInterfaceToken(IActivityManager.descriptor);
4699 data.writeStrongBinder(token);
4700 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4701 reply.readException();
4702 Bundle bundle = reply.readBundle();
4703 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4704 data.recycle();
4705 reply.recycle();
4706 return options;
4707 }
4708
Daniel Sandler69a48172010-06-23 16:29:36 -04004709 public void setImmersive(IBinder token, boolean immersive)
4710 throws RemoteException {
4711 Parcel data = Parcel.obtain();
4712 Parcel reply = Parcel.obtain();
4713 data.writeInterfaceToken(IActivityManager.descriptor);
4714 data.writeStrongBinder(token);
4715 data.writeInt(immersive ? 1 : 0);
4716 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4717 reply.readException();
4718 data.recycle();
4719 reply.recycle();
4720 }
4721
4722 public boolean isImmersive(IBinder token)
4723 throws RemoteException {
4724 Parcel data = Parcel.obtain();
4725 Parcel reply = Parcel.obtain();
4726 data.writeInterfaceToken(IActivityManager.descriptor);
4727 data.writeStrongBinder(token);
4728 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004729 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004730 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004731 data.recycle();
4732 reply.recycle();
4733 return res;
4734 }
4735
Craig Mautnerd61dc202014-07-07 11:09:11 -07004736 public boolean isTopOfTask(IBinder token) throws RemoteException {
4737 Parcel data = Parcel.obtain();
4738 Parcel reply = Parcel.obtain();
4739 data.writeInterfaceToken(IActivityManager.descriptor);
4740 data.writeStrongBinder(token);
4741 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4742 reply.readException();
4743 boolean res = reply.readInt() == 1;
4744 data.recycle();
4745 reply.recycle();
4746 return res;
4747 }
4748
Daniel Sandler69a48172010-06-23 16:29:36 -04004749 public boolean isTopActivityImmersive()
4750 throws RemoteException {
4751 Parcel data = Parcel.obtain();
4752 Parcel reply = Parcel.obtain();
4753 data.writeInterfaceToken(IActivityManager.descriptor);
4754 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004755 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004756 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004757 data.recycle();
4758 reply.recycle();
4759 return res;
4760 }
4761
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004762 public void crashApplication(int uid, int initialPid, String packageName,
4763 String message) throws RemoteException {
4764 Parcel data = Parcel.obtain();
4765 Parcel reply = Parcel.obtain();
4766 data.writeInterfaceToken(IActivityManager.descriptor);
4767 data.writeInt(uid);
4768 data.writeInt(initialPid);
4769 data.writeString(packageName);
4770 data.writeString(message);
4771 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4772 reply.readException();
4773 data.recycle();
4774 reply.recycle();
4775 }
Andy McFadden824c5102010-07-09 16:26:57 -07004776
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004777 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004778 Parcel data = Parcel.obtain();
4779 Parcel reply = Parcel.obtain();
4780 data.writeInterfaceToken(IActivityManager.descriptor);
4781 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004782 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004783 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4784 reply.readException();
4785 String res = reply.readString();
4786 data.recycle();
4787 reply.recycle();
4788 return res;
4789 }
4790
Dianne Hackborn7e269642010-08-25 19:50:20 -07004791 public IBinder newUriPermissionOwner(String name)
4792 throws RemoteException {
4793 Parcel data = Parcel.obtain();
4794 Parcel reply = Parcel.obtain();
4795 data.writeInterfaceToken(IActivityManager.descriptor);
4796 data.writeString(name);
4797 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4798 reply.readException();
4799 IBinder res = reply.readStrongBinder();
4800 data.recycle();
4801 reply.recycle();
4802 return res;
4803 }
4804
4805 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004806 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004807 Parcel data = Parcel.obtain();
4808 Parcel reply = Parcel.obtain();
4809 data.writeInterfaceToken(IActivityManager.descriptor);
4810 data.writeStrongBinder(owner);
4811 data.writeInt(fromUid);
4812 data.writeString(targetPkg);
4813 uri.writeToParcel(data, 0);
4814 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004815 data.writeInt(sourceUserId);
4816 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004817 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4818 reply.readException();
4819 data.recycle();
4820 reply.recycle();
4821 }
4822
4823 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004824 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004825 Parcel data = Parcel.obtain();
4826 Parcel reply = Parcel.obtain();
4827 data.writeInterfaceToken(IActivityManager.descriptor);
4828 data.writeStrongBinder(owner);
4829 if (uri != null) {
4830 data.writeInt(1);
4831 uri.writeToParcel(data, 0);
4832 } else {
4833 data.writeInt(0);
4834 }
4835 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004836 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004837 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4838 reply.readException();
4839 data.recycle();
4840 reply.recycle();
4841 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004842
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004843 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004844 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004845 Parcel data = Parcel.obtain();
4846 Parcel reply = Parcel.obtain();
4847 data.writeInterfaceToken(IActivityManager.descriptor);
4848 data.writeInt(callingUid);
4849 data.writeString(targetPkg);
4850 uri.writeToParcel(data, 0);
4851 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004852 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004853 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4854 reply.readException();
4855 int res = reply.readInt();
4856 data.recycle();
4857 reply.recycle();
4858 return res;
4859 }
4860
Dianne Hackborn1676c852012-09-10 14:52:30 -07004861 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004862 String path, ParcelFileDescriptor fd) throws RemoteException {
4863 Parcel data = Parcel.obtain();
4864 Parcel reply = Parcel.obtain();
4865 data.writeInterfaceToken(IActivityManager.descriptor);
4866 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004867 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004868 data.writeInt(managed ? 1 : 0);
4869 data.writeString(path);
4870 if (fd != null) {
4871 data.writeInt(1);
4872 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4873 } else {
4874 data.writeInt(0);
4875 }
4876 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4877 reply.readException();
4878 boolean res = reply.readInt() != 0;
4879 reply.recycle();
4880 data.recycle();
4881 return res;
4882 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004883
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004884 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004885 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004886 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004887 Parcel data = Parcel.obtain();
4888 Parcel reply = Parcel.obtain();
4889 data.writeInterfaceToken(IActivityManager.descriptor);
4890 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004891 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004892 data.writeTypedArray(intents, 0);
4893 data.writeStringArray(resolvedTypes);
4894 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004895 if (options != null) {
4896 data.writeInt(1);
4897 options.writeToParcel(data, 0);
4898 } else {
4899 data.writeInt(0);
4900 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004901 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004902 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4903 reply.readException();
4904 int result = reply.readInt();
4905 reply.recycle();
4906 data.recycle();
4907 return result;
4908 }
4909
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004910 public int getFrontActivityScreenCompatMode() throws RemoteException {
4911 Parcel data = Parcel.obtain();
4912 Parcel reply = Parcel.obtain();
4913 data.writeInterfaceToken(IActivityManager.descriptor);
4914 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4915 reply.readException();
4916 int mode = reply.readInt();
4917 reply.recycle();
4918 data.recycle();
4919 return mode;
4920 }
4921
4922 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4923 Parcel data = Parcel.obtain();
4924 Parcel reply = Parcel.obtain();
4925 data.writeInterfaceToken(IActivityManager.descriptor);
4926 data.writeInt(mode);
4927 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4928 reply.readException();
4929 reply.recycle();
4930 data.recycle();
4931 }
4932
4933 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4934 Parcel data = Parcel.obtain();
4935 Parcel reply = Parcel.obtain();
4936 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004937 data.writeString(packageName);
4938 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004939 reply.readException();
4940 int mode = reply.readInt();
4941 reply.recycle();
4942 data.recycle();
4943 return mode;
4944 }
4945
4946 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004947 throws RemoteException {
4948 Parcel data = Parcel.obtain();
4949 Parcel reply = Parcel.obtain();
4950 data.writeInterfaceToken(IActivityManager.descriptor);
4951 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004952 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004953 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4954 reply.readException();
4955 reply.recycle();
4956 data.recycle();
4957 }
4958
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004959 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4960 Parcel data = Parcel.obtain();
4961 Parcel reply = Parcel.obtain();
4962 data.writeInterfaceToken(IActivityManager.descriptor);
4963 data.writeString(packageName);
4964 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4965 reply.readException();
4966 boolean ask = reply.readInt() != 0;
4967 reply.recycle();
4968 data.recycle();
4969 return ask;
4970 }
4971
4972 public void setPackageAskScreenCompat(String packageName, boolean ask)
4973 throws RemoteException {
4974 Parcel data = Parcel.obtain();
4975 Parcel reply = Parcel.obtain();
4976 data.writeInterfaceToken(IActivityManager.descriptor);
4977 data.writeString(packageName);
4978 data.writeInt(ask ? 1 : 0);
4979 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4980 reply.readException();
4981 reply.recycle();
4982 data.recycle();
4983 }
4984
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004985 public boolean switchUser(int userid) throws RemoteException {
4986 Parcel data = Parcel.obtain();
4987 Parcel reply = Parcel.obtain();
4988 data.writeInterfaceToken(IActivityManager.descriptor);
4989 data.writeInt(userid);
4990 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4991 reply.readException();
4992 boolean result = reply.readInt() != 0;
4993 reply.recycle();
4994 data.recycle();
4995 return result;
4996 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004997
Kenny Guy08488bf2014-02-21 17:40:37 +00004998 public boolean startUserInBackground(int userid) throws RemoteException {
4999 Parcel data = Parcel.obtain();
5000 Parcel reply = Parcel.obtain();
5001 data.writeInterfaceToken(IActivityManager.descriptor);
5002 data.writeInt(userid);
5003 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5004 reply.readException();
5005 boolean result = reply.readInt() != 0;
5006 reply.recycle();
5007 data.recycle();
5008 return result;
5009 }
5010
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005011 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5012 Parcel data = Parcel.obtain();
5013 Parcel reply = Parcel.obtain();
5014 data.writeInterfaceToken(IActivityManager.descriptor);
5015 data.writeInt(userid);
5016 data.writeStrongInterface(callback);
5017 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5018 reply.readException();
5019 int result = reply.readInt();
5020 reply.recycle();
5021 data.recycle();
5022 return result;
5023 }
5024
Amith Yamasani52f1d752012-03-28 18:19:29 -07005025 public UserInfo getCurrentUser() throws RemoteException {
5026 Parcel data = Parcel.obtain();
5027 Parcel reply = Parcel.obtain();
5028 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005029 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005030 reply.readException();
5031 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5032 reply.recycle();
5033 data.recycle();
5034 return userInfo;
5035 }
5036
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005037 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005038 Parcel data = Parcel.obtain();
5039 Parcel reply = Parcel.obtain();
5040 data.writeInterfaceToken(IActivityManager.descriptor);
5041 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005042 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005043 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5044 reply.readException();
5045 boolean result = reply.readInt() != 0;
5046 reply.recycle();
5047 data.recycle();
5048 return result;
5049 }
5050
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005051 public int[] getRunningUserIds() throws RemoteException {
5052 Parcel data = Parcel.obtain();
5053 Parcel reply = Parcel.obtain();
5054 data.writeInterfaceToken(IActivityManager.descriptor);
5055 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5056 reply.readException();
5057 int[] result = reply.createIntArray();
5058 reply.recycle();
5059 data.recycle();
5060 return result;
5061 }
5062
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005063 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005064 Parcel data = Parcel.obtain();
5065 Parcel reply = Parcel.obtain();
5066 data.writeInterfaceToken(IActivityManager.descriptor);
5067 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005068 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5069 reply.readException();
5070 boolean result = reply.readInt() != 0;
5071 reply.recycle();
5072 data.recycle();
5073 return result;
5074 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005075
Jeff Sharkeya4620792011-05-20 15:29:23 -07005076 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5077 Parcel data = Parcel.obtain();
5078 Parcel reply = Parcel.obtain();
5079 data.writeInterfaceToken(IActivityManager.descriptor);
5080 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5081 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5082 reply.readException();
5083 data.recycle();
5084 reply.recycle();
5085 }
5086
5087 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5088 Parcel data = Parcel.obtain();
5089 Parcel reply = Parcel.obtain();
5090 data.writeInterfaceToken(IActivityManager.descriptor);
5091 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5092 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5093 reply.readException();
5094 data.recycle();
5095 reply.recycle();
5096 }
5097
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005098 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5099 Parcel data = Parcel.obtain();
5100 Parcel reply = Parcel.obtain();
5101 data.writeInterfaceToken(IActivityManager.descriptor);
5102 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5103 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5104 reply.readException();
5105 data.recycle();
5106 reply.recycle();
5107 }
5108
5109 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5110 Parcel data = Parcel.obtain();
5111 Parcel reply = Parcel.obtain();
5112 data.writeInterfaceToken(IActivityManager.descriptor);
5113 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5114 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5115 reply.readException();
5116 data.recycle();
5117 reply.recycle();
5118 }
5119
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005120 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5121 Parcel data = Parcel.obtain();
5122 Parcel reply = Parcel.obtain();
5123 data.writeInterfaceToken(IActivityManager.descriptor);
5124 data.writeStrongBinder(sender.asBinder());
5125 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5126 reply.readException();
5127 boolean res = reply.readInt() != 0;
5128 data.recycle();
5129 reply.recycle();
5130 return res;
5131 }
5132
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005133 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5134 Parcel data = Parcel.obtain();
5135 Parcel reply = Parcel.obtain();
5136 data.writeInterfaceToken(IActivityManager.descriptor);
5137 data.writeStrongBinder(sender.asBinder());
5138 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5139 reply.readException();
5140 boolean res = reply.readInt() != 0;
5141 data.recycle();
5142 reply.recycle();
5143 return res;
5144 }
5145
Dianne Hackborn81038902012-11-26 17:04:09 -08005146 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5147 Parcel data = Parcel.obtain();
5148 Parcel reply = Parcel.obtain();
5149 data.writeInterfaceToken(IActivityManager.descriptor);
5150 data.writeStrongBinder(sender.asBinder());
5151 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5152 reply.readException();
5153 Intent res = reply.readInt() != 0
5154 ? Intent.CREATOR.createFromParcel(reply) : null;
5155 data.recycle();
5156 reply.recycle();
5157 return res;
5158 }
5159
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005160 public String getTagForIntentSender(IIntentSender sender, String prefix)
5161 throws RemoteException {
5162 Parcel data = Parcel.obtain();
5163 Parcel reply = Parcel.obtain();
5164 data.writeInterfaceToken(IActivityManager.descriptor);
5165 data.writeStrongBinder(sender.asBinder());
5166 data.writeString(prefix);
5167 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5168 reply.readException();
5169 String res = reply.readString();
5170 data.recycle();
5171 reply.recycle();
5172 return res;
5173 }
5174
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005175 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5176 {
5177 Parcel data = Parcel.obtain();
5178 Parcel reply = Parcel.obtain();
5179 data.writeInterfaceToken(IActivityManager.descriptor);
5180 values.writeToParcel(data, 0);
5181 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5182 reply.readException();
5183 data.recycle();
5184 reply.recycle();
5185 }
5186
Dianne Hackbornb437e092011-08-05 17:50:29 -07005187 public long[] getProcessPss(int[] pids) throws RemoteException {
5188 Parcel data = Parcel.obtain();
5189 Parcel reply = Parcel.obtain();
5190 data.writeInterfaceToken(IActivityManager.descriptor);
5191 data.writeIntArray(pids);
5192 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5193 reply.readException();
5194 long[] res = reply.createLongArray();
5195 data.recycle();
5196 reply.recycle();
5197 return res;
5198 }
5199
Dianne Hackborn661cd522011-08-22 00:26:20 -07005200 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5201 Parcel data = Parcel.obtain();
5202 Parcel reply = Parcel.obtain();
5203 data.writeInterfaceToken(IActivityManager.descriptor);
5204 TextUtils.writeToParcel(msg, data, 0);
5205 data.writeInt(always ? 1 : 0);
5206 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5207 reply.readException();
5208 data.recycle();
5209 reply.recycle();
5210 }
5211
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005212 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005213 Parcel data = Parcel.obtain();
5214 Parcel reply = Parcel.obtain();
5215 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005216 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005217 reply.readException();
5218 data.recycle();
5219 reply.recycle();
5220 }
5221
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005222 public void keyguardGoingAway(boolean disableWindowAnimations,
5223 boolean keyguardGoingToNotificationShade) throws RemoteException {
5224 Parcel data = Parcel.obtain();
5225 Parcel reply = Parcel.obtain();
5226 data.writeInterfaceToken(IActivityManager.descriptor);
5227 data.writeInt(disableWindowAnimations ? 1 : 0);
5228 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5229 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5230 reply.readException();
5231 data.recycle();
5232 reply.recycle();
5233 }
5234
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005235 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005236 throws RemoteException {
5237 Parcel data = Parcel.obtain();
5238 Parcel reply = Parcel.obtain();
5239 data.writeInterfaceToken(IActivityManager.descriptor);
5240 data.writeStrongBinder(token);
5241 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005242 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005243 reply.readException();
5244 boolean result = reply.readInt() != 0;
5245 data.recycle();
5246 reply.recycle();
5247 return result;
5248 }
5249
5250 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5251 throws RemoteException {
5252 Parcel data = Parcel.obtain();
5253 Parcel reply = Parcel.obtain();
5254 data.writeInterfaceToken(IActivityManager.descriptor);
5255 data.writeStrongBinder(token);
5256 target.writeToParcel(data, 0);
5257 data.writeInt(resultCode);
5258 if (resultData != null) {
5259 data.writeInt(1);
5260 resultData.writeToParcel(data, 0);
5261 } else {
5262 data.writeInt(0);
5263 }
5264 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5265 reply.readException();
5266 boolean result = reply.readInt() != 0;
5267 data.recycle();
5268 reply.recycle();
5269 return result;
5270 }
5271
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005272 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5273 Parcel data = Parcel.obtain();
5274 Parcel reply = Parcel.obtain();
5275 data.writeInterfaceToken(IActivityManager.descriptor);
5276 data.writeStrongBinder(activityToken);
5277 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5278 reply.readException();
5279 int result = reply.readInt();
5280 data.recycle();
5281 reply.recycle();
5282 return result;
5283 }
5284
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005285 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5286 Parcel data = Parcel.obtain();
5287 Parcel reply = Parcel.obtain();
5288 data.writeInterfaceToken(IActivityManager.descriptor);
5289 data.writeStrongBinder(activityToken);
5290 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5291 reply.readException();
5292 String result = reply.readString();
5293 data.recycle();
5294 reply.recycle();
5295 return result;
5296 }
5297
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005298 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5299 Parcel data = Parcel.obtain();
5300 Parcel reply = Parcel.obtain();
5301 data.writeInterfaceToken(IActivityManager.descriptor);
5302 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5303 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5304 reply.readException();
5305 data.recycle();
5306 reply.recycle();
5307 }
5308
5309 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5310 Parcel data = Parcel.obtain();
5311 Parcel reply = Parcel.obtain();
5312 data.writeInterfaceToken(IActivityManager.descriptor);
5313 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5314 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5315 reply.readException();
5316 data.recycle();
5317 reply.recycle();
5318 }
5319
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005320 public void requestBugReport() throws RemoteException {
5321 Parcel data = Parcel.obtain();
5322 Parcel reply = Parcel.obtain();
5323 data.writeInterfaceToken(IActivityManager.descriptor);
5324 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5325 reply.readException();
5326 data.recycle();
5327 reply.recycle();
5328 }
5329
Jeff Brownbd181bb2013-09-10 16:44:24 -07005330 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5331 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005332 Parcel data = Parcel.obtain();
5333 Parcel reply = Parcel.obtain();
5334 data.writeInterfaceToken(IActivityManager.descriptor);
5335 data.writeInt(pid);
5336 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005337 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005338 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5339 reply.readException();
5340 long res = reply.readInt();
5341 data.recycle();
5342 reply.recycle();
5343 return res;
5344 }
5345
Adam Skorydfc7fd72013-08-05 19:23:41 -07005346 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005347 Parcel data = Parcel.obtain();
5348 Parcel reply = Parcel.obtain();
5349 data.writeInterfaceToken(IActivityManager.descriptor);
5350 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005351 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005352 reply.readException();
5353 Bundle res = reply.readBundle();
5354 data.recycle();
5355 reply.recycle();
5356 return res;
5357 }
5358
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005359 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5360 throws RemoteException {
5361 Parcel data = Parcel.obtain();
5362 Parcel reply = Parcel.obtain();
5363 data.writeInterfaceToken(IActivityManager.descriptor);
5364 data.writeInt(requestType);
5365 data.writeStrongBinder(receiver.asBinder());
5366 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5367 reply.readException();
5368 data.recycle();
5369 reply.recycle();
5370 }
5371
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005372 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005373 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005374 Parcel data = Parcel.obtain();
5375 Parcel reply = Parcel.obtain();
5376 data.writeInterfaceToken(IActivityManager.descriptor);
5377 data.writeStrongBinder(token);
5378 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005379 structure.writeToParcel(data, 0);
5380 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005381 if (referrer != null) {
5382 data.writeInt(1);
5383 referrer.writeToParcel(data, 0);
5384 } else {
5385 data.writeInt(0);
5386 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005387 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005388 reply.readException();
5389 data.recycle();
5390 reply.recycle();
5391 }
5392
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005393 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5394 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005395 Parcel data = Parcel.obtain();
5396 Parcel reply = Parcel.obtain();
5397 data.writeInterfaceToken(IActivityManager.descriptor);
5398 intent.writeToParcel(data, 0);
5399 data.writeInt(requestType);
5400 data.writeString(hint);
5401 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005402 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005403 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5404 reply.readException();
5405 boolean res = reply.readInt() != 0;
5406 data.recycle();
5407 reply.recycle();
5408 return res;
5409 }
5410
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005411 public void killUid(int uid, String reason) throws RemoteException {
5412 Parcel data = Parcel.obtain();
5413 Parcel reply = Parcel.obtain();
5414 data.writeInterfaceToken(IActivityManager.descriptor);
5415 data.writeInt(uid);
5416 data.writeString(reason);
5417 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5418 reply.readException();
5419 data.recycle();
5420 reply.recycle();
5421 }
5422
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005423 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5424 Parcel data = Parcel.obtain();
5425 Parcel reply = Parcel.obtain();
5426 data.writeInterfaceToken(IActivityManager.descriptor);
5427 data.writeStrongBinder(who);
5428 data.writeInt(allowRestart ? 1 : 0);
5429 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5430 reply.readException();
5431 data.recycle();
5432 reply.recycle();
5433 }
5434
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005435 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5436 Parcel data = Parcel.obtain();
5437 Parcel reply = Parcel.obtain();
5438 data.writeInterfaceToken(IActivityManager.descriptor);
5439 data.writeStrongBinder(token);
5440 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5441 reply.readException();
5442 data.recycle();
5443 reply.recycle();
5444 }
5445
Craig Mautner5eda9b32013-07-02 11:58:16 -07005446 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5447 Parcel data = Parcel.obtain();
5448 Parcel reply = Parcel.obtain();
5449 data.writeInterfaceToken(IActivityManager.descriptor);
5450 data.writeStrongBinder(token);
5451 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5452 reply.readException();
5453 data.recycle();
5454 reply.recycle();
5455 }
5456
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005457 public void restart() throws RemoteException {
5458 Parcel data = Parcel.obtain();
5459 Parcel reply = Parcel.obtain();
5460 data.writeInterfaceToken(IActivityManager.descriptor);
5461 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5462 reply.readException();
5463 data.recycle();
5464 reply.recycle();
5465 }
5466
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005467 public void performIdleMaintenance() throws RemoteException {
5468 Parcel data = Parcel.obtain();
5469 Parcel reply = Parcel.obtain();
5470 data.writeInterfaceToken(IActivityManager.descriptor);
5471 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5472 reply.readException();
5473 data.recycle();
5474 reply.recycle();
5475 }
5476
Todd Kennedyca4d8422015-01-15 15:19:22 -08005477 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005478 IActivityContainerCallback callback) throws RemoteException {
5479 Parcel data = Parcel.obtain();
5480 Parcel reply = Parcel.obtain();
5481 data.writeInterfaceToken(IActivityManager.descriptor);
5482 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005483 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005484 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005485 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005486 final int result = reply.readInt();
5487 final IActivityContainer res;
5488 if (result == 1) {
5489 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5490 } else {
5491 res = null;
5492 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005493 data.recycle();
5494 reply.recycle();
5495 return res;
5496 }
5497
Craig Mautner95da1082014-02-24 17:54:35 -08005498 public void deleteActivityContainer(IActivityContainer activityContainer)
5499 throws RemoteException {
5500 Parcel data = Parcel.obtain();
5501 Parcel reply = Parcel.obtain();
5502 data.writeInterfaceToken(IActivityManager.descriptor);
5503 data.writeStrongBinder(activityContainer.asBinder());
5504 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5505 reply.readException();
5506 data.recycle();
5507 reply.recycle();
5508 }
5509
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005510 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005511 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5512 Parcel data = Parcel.obtain();
5513 Parcel reply = Parcel.obtain();
5514 data.writeInterfaceToken(IActivityManager.descriptor);
5515 data.writeInt(displayId);
5516 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5517 reply.readException();
5518 final int result = reply.readInt();
5519 final IActivityContainer res;
5520 if (result == 1) {
5521 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5522 } else {
5523 res = null;
5524 }
5525 data.recycle();
5526 reply.recycle();
5527 return res;
5528 }
5529
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005530 @Override
5531 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005532 throws RemoteException {
5533 Parcel data = Parcel.obtain();
5534 Parcel reply = Parcel.obtain();
5535 data.writeInterfaceToken(IActivityManager.descriptor);
5536 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005537 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005538 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005539 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005540 data.recycle();
5541 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005542 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005543 }
5544
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005545 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005546 public void startLockTaskMode(int taskId) throws RemoteException {
5547 Parcel data = Parcel.obtain();
5548 Parcel reply = Parcel.obtain();
5549 data.writeInterfaceToken(IActivityManager.descriptor);
5550 data.writeInt(taskId);
5551 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5552 reply.readException();
5553 data.recycle();
5554 reply.recycle();
5555 }
5556
5557 @Override
5558 public void startLockTaskMode(IBinder token) throws RemoteException {
5559 Parcel data = Parcel.obtain();
5560 Parcel reply = Parcel.obtain();
5561 data.writeInterfaceToken(IActivityManager.descriptor);
5562 data.writeStrongBinder(token);
5563 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5564 reply.readException();
5565 data.recycle();
5566 reply.recycle();
5567 }
5568
5569 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005570 public void startLockTaskModeOnCurrent() throws RemoteException {
5571 Parcel data = Parcel.obtain();
5572 Parcel reply = Parcel.obtain();
5573 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005574 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005575 reply.readException();
5576 data.recycle();
5577 reply.recycle();
5578 }
5579
5580 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005581 public void stopLockTaskMode() throws RemoteException {
5582 Parcel data = Parcel.obtain();
5583 Parcel reply = Parcel.obtain();
5584 data.writeInterfaceToken(IActivityManager.descriptor);
5585 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5586 reply.readException();
5587 data.recycle();
5588 reply.recycle();
5589 }
5590
5591 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005592 public void stopLockTaskModeOnCurrent() throws RemoteException {
5593 Parcel data = Parcel.obtain();
5594 Parcel reply = Parcel.obtain();
5595 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005596 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005597 reply.readException();
5598 data.recycle();
5599 reply.recycle();
5600 }
5601
5602 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005603 public boolean isInLockTaskMode() throws RemoteException {
5604 Parcel data = Parcel.obtain();
5605 Parcel reply = Parcel.obtain();
5606 data.writeInterfaceToken(IActivityManager.descriptor);
5607 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5608 reply.readException();
5609 boolean isInLockTaskMode = reply.readInt() == 1;
5610 data.recycle();
5611 reply.recycle();
5612 return isInLockTaskMode;
5613 }
5614
Craig Mautner688b5102014-03-27 16:55:03 -07005615 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005616 public int getLockTaskModeState() throws RemoteException {
5617 Parcel data = Parcel.obtain();
5618 Parcel reply = Parcel.obtain();
5619 data.writeInterfaceToken(IActivityManager.descriptor);
5620 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5621 reply.readException();
5622 int lockTaskModeState = reply.readInt();
5623 data.recycle();
5624 reply.recycle();
5625 return lockTaskModeState;
5626 }
5627
5628 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005629 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5630 Parcel data = Parcel.obtain();
5631 Parcel reply = Parcel.obtain();
5632 data.writeInterfaceToken(IActivityManager.descriptor);
5633 data.writeStrongBinder(token);
5634 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5635 IBinder.FLAG_ONEWAY);
5636 reply.readException();
5637 data.recycle();
5638 reply.recycle();
5639 }
5640
5641 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005642 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005643 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005644 Parcel data = Parcel.obtain();
5645 Parcel reply = Parcel.obtain();
5646 data.writeInterfaceToken(IActivityManager.descriptor);
5647 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005648 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005649 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005650 reply.readException();
5651 data.recycle();
5652 reply.recycle();
5653 }
5654
Craig Mautneree2e45a2014-06-27 12:10:03 -07005655 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005656 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5657 Parcel data = Parcel.obtain();
5658 Parcel reply = Parcel.obtain();
5659 data.writeInterfaceToken(IActivityManager.descriptor);
5660 data.writeInt(taskId);
5661 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005662 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005663 reply.readException();
5664 data.recycle();
5665 reply.recycle();
5666 }
5667
5668 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005669 public void resizeTask(int taskId, Rect r) throws RemoteException
5670 {
5671 Parcel data = Parcel.obtain();
5672 Parcel reply = Parcel.obtain();
5673 data.writeInterfaceToken(IActivityManager.descriptor);
5674 data.writeInt(taskId);
5675 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005676 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005677 reply.readException();
5678 data.recycle();
5679 reply.recycle();
5680 }
5681
5682 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005683 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5684 Parcel data = Parcel.obtain();
5685 Parcel reply = Parcel.obtain();
5686 data.writeInterfaceToken(IActivityManager.descriptor);
5687 data.writeString(filename);
5688 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5689 reply.readException();
5690 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5691 data.recycle();
5692 reply.recycle();
5693 return icon;
5694 }
5695
5696 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005697 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5698 throws RemoteException {
5699 Parcel data = Parcel.obtain();
5700 Parcel reply = Parcel.obtain();
5701 data.writeInterfaceToken(IActivityManager.descriptor);
5702 if (options == null) {
5703 data.writeInt(0);
5704 } else {
5705 data.writeInt(1);
5706 data.writeBundle(options.toBundle());
5707 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005708 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005709 reply.readException();
5710 data.recycle();
5711 reply.recycle();
5712 }
5713
5714 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005715 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005716 Parcel data = Parcel.obtain();
5717 Parcel reply = Parcel.obtain();
5718 data.writeInterfaceToken(IActivityManager.descriptor);
5719 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005720 data.writeInt(visible ? 1 : 0);
5721 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005722 reply.readException();
5723 boolean success = reply.readInt() > 0;
5724 data.recycle();
5725 reply.recycle();
5726 return success;
5727 }
5728
5729 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005730 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005731 Parcel data = Parcel.obtain();
5732 Parcel reply = Parcel.obtain();
5733 data.writeInterfaceToken(IActivityManager.descriptor);
5734 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005735 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005736 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005737 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005738 data.recycle();
5739 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005740 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005741 }
5742
5743 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005744 public void backgroundResourcesReleased(IBinder token) 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);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005749 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005750 reply.readException();
5751 data.recycle();
5752 reply.recycle();
5753 }
5754
5755 @Override
5756 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5757 Parcel data = Parcel.obtain();
5758 Parcel reply = Parcel.obtain();
5759 data.writeInterfaceToken(IActivityManager.descriptor);
5760 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005761 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005762 reply.readException();
5763 data.recycle();
5764 reply.recycle();
5765 }
5766
Craig Mautner8746a472014-07-24 15:12:54 -07005767 @Override
5768 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5769 Parcel data = Parcel.obtain();
5770 Parcel reply = Parcel.obtain();
5771 data.writeInterfaceToken(IActivityManager.descriptor);
5772 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005773 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005774 reply.readException();
5775 data.recycle();
5776 reply.recycle();
5777 }
5778
Craig Mautner6e2f3952014-09-09 14:26:41 -07005779 @Override
5780 public void bootAnimationComplete() throws RemoteException {
5781 Parcel data = Parcel.obtain();
5782 Parcel reply = Parcel.obtain();
5783 data.writeInterfaceToken(IActivityManager.descriptor);
5784 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5785 reply.readException();
5786 data.recycle();
5787 reply.recycle();
5788 }
5789
Wale Ogunwale18795a22014-12-03 11:38:33 -08005790 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005791 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5792 Parcel data = Parcel.obtain();
5793 Parcel reply = Parcel.obtain();
5794 data.writeInterfaceToken(IActivityManager.descriptor);
5795 data.writeInt(uid);
5796 data.writeByteArray(firstPacket);
5797 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5798 reply.readException();
5799 data.recycle();
5800 reply.recycle();
5801 }
5802
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005803 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005804 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5805 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005806 Parcel data = Parcel.obtain();
5807 Parcel reply = Parcel.obtain();
5808 data.writeInterfaceToken(IActivityManager.descriptor);
5809 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005810 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005811 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005812 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005813 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5814 reply.readException();
5815 data.recycle();
5816 reply.recycle();
5817 }
5818
5819 @Override
5820 public void dumpHeapFinished(String path) throws RemoteException {
5821 Parcel data = Parcel.obtain();
5822 Parcel reply = Parcel.obtain();
5823 data.writeInterfaceToken(IActivityManager.descriptor);
5824 data.writeString(path);
5825 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5826 reply.readException();
5827 data.recycle();
5828 reply.recycle();
5829 }
5830
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005831 @Override
5832 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5833 throws RemoteException {
5834 Parcel data = Parcel.obtain();
5835 Parcel reply = Parcel.obtain();
5836 data.writeInterfaceToken(IActivityManager.descriptor);
5837 data.writeStrongBinder(session.asBinder());
5838 data.writeInt(keepAwake ? 1 : 0);
5839 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5840 reply.readException();
5841 data.recycle();
5842 reply.recycle();
5843 }
5844
Craig Mautnere5600772015-04-03 21:36:37 -07005845 @Override
5846 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5847 Parcel data = Parcel.obtain();
5848 Parcel reply = Parcel.obtain();
5849 data.writeInterfaceToken(IActivityManager.descriptor);
5850 data.writeInt(userId);
5851 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005852 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005853 reply.readException();
5854 data.recycle();
5855 reply.recycle();
5856 }
5857
Dianne Hackborn1e383822015-04-10 14:02:33 -07005858 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07005859 public void updateDeviceOwner(String packageName) throws RemoteException {
5860 Parcel data = Parcel.obtain();
5861 Parcel reply = Parcel.obtain();
5862 data.writeInterfaceToken(IActivityManager.descriptor);
5863 data.writeString(packageName);
5864 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
5865 reply.readException();
5866 data.recycle();
5867 reply.recycle();
5868 }
5869
5870 @Override
Dianne Hackborn1e383822015-04-10 14:02:33 -07005871 public int getPackageProcessState(String packageName) throws RemoteException {
5872 Parcel data = Parcel.obtain();
5873 Parcel reply = Parcel.obtain();
5874 data.writeInterfaceToken(IActivityManager.descriptor);
5875 data.writeString(packageName);
5876 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5877 reply.readException();
5878 int res = reply.readInt();
5879 data.recycle();
5880 reply.recycle();
5881 return res;
5882 }
5883
Stefan Kuhne16045c22015-06-05 07:18:06 -07005884 @Override
5885 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
5886 throws RemoteException {
5887 Parcel data = Parcel.obtain();
5888 Parcel reply = Parcel.obtain();
5889 data.writeInterfaceToken(IActivityManager.descriptor);
5890 data.writeString(process);
5891 data.writeInt(userId);
5892 data.writeInt(level);
5893 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
5894 reply.readException();
5895 int res = reply.readInt();
5896 data.recycle();
5897 reply.recycle();
5898 return res != 0;
5899 }
5900
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005901 private IBinder mRemote;
5902}