blob: 3035e3d94d7746899eabc1dc6ddfcfa411195ae1 [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();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002542 String callingPackage = data.readString();
2543 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002544 reply.writeNoException();
2545 reply.writeInt(res);
2546 return true;
2547 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002548
2549 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2550 data.enforceInterface(IActivityManager.descriptor);
2551 String process = data.readString();
2552 int userId = data.readInt();
2553 int level = data.readInt();
2554 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2555 reply.writeNoException();
2556 reply.writeInt(res ? 1 : 0);
2557 return true;
2558 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002559 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002560
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002561 return super.onTransact(code, data, reply, flags);
2562 }
2563
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002564 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002565 return this;
2566 }
2567
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002568 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2569 protected IActivityManager create() {
2570 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002571 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002572 Log.v("ActivityManager", "default service binder = " + b);
2573 }
2574 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002575 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002576 Log.v("ActivityManager", "default service = " + am);
2577 }
2578 return am;
2579 }
2580 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002581}
2582
2583class ActivityManagerProxy implements IActivityManager
2584{
2585 public ActivityManagerProxy(IBinder remote)
2586 {
2587 mRemote = remote;
2588 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002590 public IBinder asBinder()
2591 {
2592 return mRemote;
2593 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002594
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002595 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002596 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002597 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002598 Parcel data = Parcel.obtain();
2599 Parcel reply = Parcel.obtain();
2600 data.writeInterfaceToken(IActivityManager.descriptor);
2601 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002602 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002603 intent.writeToParcel(data, 0);
2604 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002605 data.writeStrongBinder(resultTo);
2606 data.writeString(resultWho);
2607 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002608 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002609 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002610 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002611 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002612 } else {
2613 data.writeInt(0);
2614 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002615 if (options != null) {
2616 data.writeInt(1);
2617 options.writeToParcel(data, 0);
2618 } else {
2619 data.writeInt(0);
2620 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002621 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2622 reply.readException();
2623 int result = reply.readInt();
2624 reply.recycle();
2625 data.recycle();
2626 return result;
2627 }
Amith Yamasani82644082012-08-03 13:09:11 -07002628
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002629 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002630 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002631 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2632 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002633 Parcel data = Parcel.obtain();
2634 Parcel reply = Parcel.obtain();
2635 data.writeInterfaceToken(IActivityManager.descriptor);
2636 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002637 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002638 intent.writeToParcel(data, 0);
2639 data.writeString(resolvedType);
2640 data.writeStrongBinder(resultTo);
2641 data.writeString(resultWho);
2642 data.writeInt(requestCode);
2643 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002644 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002645 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002646 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002647 } else {
2648 data.writeInt(0);
2649 }
2650 if (options != null) {
2651 data.writeInt(1);
2652 options.writeToParcel(data, 0);
2653 } else {
2654 data.writeInt(0);
2655 }
2656 data.writeInt(userId);
2657 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2658 reply.readException();
2659 int result = reply.readInt();
2660 reply.recycle();
2661 data.recycle();
2662 return result;
2663 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002664 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2665 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002666 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002667 Parcel data = Parcel.obtain();
2668 Parcel reply = Parcel.obtain();
2669 data.writeInterfaceToken(IActivityManager.descriptor);
2670 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2671 data.writeString(callingPackage);
2672 intent.writeToParcel(data, 0);
2673 data.writeString(resolvedType);
2674 data.writeStrongBinder(resultTo);
2675 data.writeString(resultWho);
2676 data.writeInt(requestCode);
2677 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002678 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002679 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002680 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002681 } else {
2682 data.writeInt(0);
2683 }
2684 if (options != null) {
2685 data.writeInt(1);
2686 options.writeToParcel(data, 0);
2687 } else {
2688 data.writeInt(0);
2689 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002690 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002691 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2692 reply.readException();
2693 int result = reply.readInt();
2694 reply.recycle();
2695 data.recycle();
2696 return result;
2697 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002698 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2699 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002700 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2701 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002702 Parcel data = Parcel.obtain();
2703 Parcel reply = Parcel.obtain();
2704 data.writeInterfaceToken(IActivityManager.descriptor);
2705 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002706 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002707 intent.writeToParcel(data, 0);
2708 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002709 data.writeStrongBinder(resultTo);
2710 data.writeString(resultWho);
2711 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002712 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002713 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002714 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002715 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002716 } else {
2717 data.writeInt(0);
2718 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002719 if (options != null) {
2720 data.writeInt(1);
2721 options.writeToParcel(data, 0);
2722 } else {
2723 data.writeInt(0);
2724 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002725 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002726 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2727 reply.readException();
2728 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2729 reply.recycle();
2730 data.recycle();
2731 return result;
2732 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002733 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2734 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002735 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002736 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002737 Parcel data = Parcel.obtain();
2738 Parcel reply = Parcel.obtain();
2739 data.writeInterfaceToken(IActivityManager.descriptor);
2740 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002741 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002742 intent.writeToParcel(data, 0);
2743 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002744 data.writeStrongBinder(resultTo);
2745 data.writeString(resultWho);
2746 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002747 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002748 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002749 if (options != null) {
2750 data.writeInt(1);
2751 options.writeToParcel(data, 0);
2752 } else {
2753 data.writeInt(0);
2754 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002755 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002756 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2757 reply.readException();
2758 int result = reply.readInt();
2759 reply.recycle();
2760 data.recycle();
2761 return result;
2762 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002763 public int startActivityIntentSender(IApplicationThread caller,
2764 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002765 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002766 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2771 intent.writeToParcel(data, 0);
2772 if (fillInIntent != null) {
2773 data.writeInt(1);
2774 fillInIntent.writeToParcel(data, 0);
2775 } else {
2776 data.writeInt(0);
2777 }
2778 data.writeString(resolvedType);
2779 data.writeStrongBinder(resultTo);
2780 data.writeString(resultWho);
2781 data.writeInt(requestCode);
2782 data.writeInt(flagsMask);
2783 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002784 if (options != null) {
2785 data.writeInt(1);
2786 options.writeToParcel(data, 0);
2787 } else {
2788 data.writeInt(0);
2789 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002790 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002791 reply.readException();
2792 int result = reply.readInt();
2793 reply.recycle();
2794 data.recycle();
2795 return result;
2796 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002797 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2798 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002799 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2800 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 data.writeString(callingPackage);
2805 data.writeInt(callingPid);
2806 data.writeInt(callingUid);
2807 intent.writeToParcel(data, 0);
2808 data.writeString(resolvedType);
2809 data.writeStrongBinder(session.asBinder());
2810 data.writeStrongBinder(interactor.asBinder());
2811 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002812 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002813 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002814 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002815 } else {
2816 data.writeInt(0);
2817 }
2818 if (options != null) {
2819 data.writeInt(1);
2820 options.writeToParcel(data, 0);
2821 } else {
2822 data.writeInt(0);
2823 }
2824 data.writeInt(userId);
2825 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2826 reply.readException();
2827 int result = reply.readInt();
2828 reply.recycle();
2829 data.recycle();
2830 return result;
2831 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002832 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002833 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002834 Parcel data = Parcel.obtain();
2835 Parcel reply = Parcel.obtain();
2836 data.writeInterfaceToken(IActivityManager.descriptor);
2837 data.writeStrongBinder(callingActivity);
2838 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002839 if (options != null) {
2840 data.writeInt(1);
2841 options.writeToParcel(data, 0);
2842 } else {
2843 data.writeInt(0);
2844 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002845 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2846 reply.readException();
2847 int result = reply.readInt();
2848 reply.recycle();
2849 data.recycle();
2850 return result != 0;
2851 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002852 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2853 Parcel data = Parcel.obtain();
2854 Parcel reply = Parcel.obtain();
2855 data.writeInterfaceToken(IActivityManager.descriptor);
2856 data.writeInt(taskId);
2857 if (options == null) {
2858 data.writeInt(0);
2859 } else {
2860 data.writeInt(1);
2861 options.writeToParcel(data, 0);
2862 }
2863 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2864 reply.readException();
2865 int result = reply.readInt();
2866 reply.recycle();
2867 data.recycle();
2868 return result;
2869 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002870 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002871 throws RemoteException {
2872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeStrongBinder(token);
2876 data.writeInt(resultCode);
2877 if (resultData != null) {
2878 data.writeInt(1);
2879 resultData.writeToParcel(data, 0);
2880 } else {
2881 data.writeInt(0);
2882 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002883 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002884 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2885 reply.readException();
2886 boolean res = reply.readInt() != 0;
2887 data.recycle();
2888 reply.recycle();
2889 return res;
2890 }
2891 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2892 {
2893 Parcel data = Parcel.obtain();
2894 Parcel reply = Parcel.obtain();
2895 data.writeInterfaceToken(IActivityManager.descriptor);
2896 data.writeStrongBinder(token);
2897 data.writeString(resultWho);
2898 data.writeInt(requestCode);
2899 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2900 reply.readException();
2901 data.recycle();
2902 reply.recycle();
2903 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002904 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2905 Parcel data = Parcel.obtain();
2906 Parcel reply = Parcel.obtain();
2907 data.writeInterfaceToken(IActivityManager.descriptor);
2908 data.writeStrongBinder(token);
2909 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2910 reply.readException();
2911 boolean res = reply.readInt() != 0;
2912 data.recycle();
2913 reply.recycle();
2914 return res;
2915 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002916 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2917 Parcel data = Parcel.obtain();
2918 Parcel reply = Parcel.obtain();
2919 data.writeInterfaceToken(IActivityManager.descriptor);
2920 data.writeStrongBinder(session.asBinder());
2921 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2922 reply.readException();
2923 data.recycle();
2924 reply.recycle();
2925 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002926 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 data.writeStrongBinder(token);
2931 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2932 reply.readException();
2933 boolean res = reply.readInt() != 0;
2934 data.recycle();
2935 reply.recycle();
2936 return res;
2937 }
2938 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2939 Parcel data = Parcel.obtain();
2940 Parcel reply = Parcel.obtain();
2941 data.writeInterfaceToken(IActivityManager.descriptor);
2942 data.writeStrongBinder(app.asBinder());
2943 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2944 reply.readException();
2945 data.recycle();
2946 reply.recycle();
2947 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002948 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2949 Parcel data = Parcel.obtain();
2950 Parcel reply = Parcel.obtain();
2951 data.writeInterfaceToken(IActivityManager.descriptor);
2952 data.writeStrongBinder(token);
2953 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2954 reply.readException();
2955 boolean res = reply.readInt() != 0;
2956 data.recycle();
2957 reply.recycle();
2958 return res;
2959 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002960 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002962 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002963 {
2964 Parcel data = Parcel.obtain();
2965 Parcel reply = Parcel.obtain();
2966 data.writeInterfaceToken(IActivityManager.descriptor);
2967 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002968 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002969 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2970 filter.writeToParcel(data, 0);
2971 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002972 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2974 reply.readException();
2975 Intent intent = null;
2976 int haveIntent = reply.readInt();
2977 if (haveIntent != 0) {
2978 intent = Intent.CREATOR.createFromParcel(reply);
2979 }
2980 reply.recycle();
2981 data.recycle();
2982 return intent;
2983 }
2984 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2985 {
2986 Parcel data = Parcel.obtain();
2987 Parcel reply = Parcel.obtain();
2988 data.writeInterfaceToken(IActivityManager.descriptor);
2989 data.writeStrongBinder(receiver.asBinder());
2990 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2991 reply.readException();
2992 data.recycle();
2993 reply.recycle();
2994 }
2995 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07002996 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002997 int resultCode, String resultData, Bundle map,
Dianne Hackborna750a632015-06-16 17:18:23 -07002998 String requiredPermission, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002999 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003000 {
3001 Parcel data = Parcel.obtain();
3002 Parcel reply = Parcel.obtain();
3003 data.writeInterfaceToken(IActivityManager.descriptor);
3004 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3005 intent.writeToParcel(data, 0);
3006 data.writeString(resolvedType);
3007 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3008 data.writeInt(resultCode);
3009 data.writeString(resultData);
3010 data.writeBundle(map);
3011 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003012 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003013 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003014 data.writeInt(serialized ? 1 : 0);
3015 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003016 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3018 reply.readException();
3019 int res = reply.readInt();
3020 reply.recycle();
3021 data.recycle();
3022 return res;
3023 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003024 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3025 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003026 {
3027 Parcel data = Parcel.obtain();
3028 Parcel reply = Parcel.obtain();
3029 data.writeInterfaceToken(IActivityManager.descriptor);
3030 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3031 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003032 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003033 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3034 reply.readException();
3035 data.recycle();
3036 reply.recycle();
3037 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003038 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3039 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003040 {
3041 Parcel data = Parcel.obtain();
3042 Parcel reply = Parcel.obtain();
3043 data.writeInterfaceToken(IActivityManager.descriptor);
3044 data.writeStrongBinder(who);
3045 data.writeInt(resultCode);
3046 data.writeString(resultData);
3047 data.writeBundle(map);
3048 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003049 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003050 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3051 reply.readException();
3052 data.recycle();
3053 reply.recycle();
3054 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003055 public void attachApplication(IApplicationThread app) throws RemoteException
3056 {
3057 Parcel data = Parcel.obtain();
3058 Parcel reply = Parcel.obtain();
3059 data.writeInterfaceToken(IActivityManager.descriptor);
3060 data.writeStrongBinder(app.asBinder());
3061 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3062 reply.readException();
3063 data.recycle();
3064 reply.recycle();
3065 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003066 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3067 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003068 {
3069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003073 if (config != null) {
3074 data.writeInt(1);
3075 config.writeToParcel(data, 0);
3076 } else {
3077 data.writeInt(0);
3078 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003079 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003080 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3081 reply.readException();
3082 data.recycle();
3083 reply.recycle();
3084 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003085 public void activityResumed(IBinder token) throws RemoteException
3086 {
3087 Parcel data = Parcel.obtain();
3088 Parcel reply = Parcel.obtain();
3089 data.writeInterfaceToken(IActivityManager.descriptor);
3090 data.writeStrongBinder(token);
3091 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3092 reply.readException();
3093 data.recycle();
3094 reply.recycle();
3095 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003096 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003097 {
3098 Parcel data = Parcel.obtain();
3099 Parcel reply = Parcel.obtain();
3100 data.writeInterfaceToken(IActivityManager.descriptor);
3101 data.writeStrongBinder(token);
3102 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3103 reply.readException();
3104 data.recycle();
3105 reply.recycle();
3106 }
3107 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003108 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003109 {
3110 Parcel data = Parcel.obtain();
3111 Parcel reply = Parcel.obtain();
3112 data.writeInterfaceToken(IActivityManager.descriptor);
3113 data.writeStrongBinder(token);
3114 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003115 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003116 TextUtils.writeToParcel(description, data, 0);
3117 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3118 reply.readException();
3119 data.recycle();
3120 reply.recycle();
3121 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003122 public void activitySlept(IBinder token) throws RemoteException
3123 {
3124 Parcel data = Parcel.obtain();
3125 Parcel reply = Parcel.obtain();
3126 data.writeInterfaceToken(IActivityManager.descriptor);
3127 data.writeStrongBinder(token);
3128 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3129 reply.readException();
3130 data.recycle();
3131 reply.recycle();
3132 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003133 public void activityDestroyed(IBinder token) throws RemoteException
3134 {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeStrongBinder(token);
3139 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3140 reply.readException();
3141 data.recycle();
3142 reply.recycle();
3143 }
3144 public String getCallingPackage(IBinder token) throws RemoteException
3145 {
3146 Parcel data = Parcel.obtain();
3147 Parcel reply = Parcel.obtain();
3148 data.writeInterfaceToken(IActivityManager.descriptor);
3149 data.writeStrongBinder(token);
3150 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3151 reply.readException();
3152 String res = reply.readString();
3153 data.recycle();
3154 reply.recycle();
3155 return res;
3156 }
3157 public ComponentName getCallingActivity(IBinder token)
3158 throws RemoteException {
3159 Parcel data = Parcel.obtain();
3160 Parcel reply = Parcel.obtain();
3161 data.writeInterfaceToken(IActivityManager.descriptor);
3162 data.writeStrongBinder(token);
3163 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3164 reply.readException();
3165 ComponentName res = ComponentName.readFromParcel(reply);
3166 data.recycle();
3167 reply.recycle();
3168 return res;
3169 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003170 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003174 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003175 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3176 reply.readException();
3177 ArrayList<IAppTask> list = null;
3178 int N = reply.readInt();
3179 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003180 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003181 while (N > 0) {
3182 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3183 list.add(task);
3184 N--;
3185 }
3186 }
3187 data.recycle();
3188 reply.recycle();
3189 return list;
3190 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003191 public int addAppTask(IBinder activityToken, Intent intent,
3192 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3193 Parcel data = Parcel.obtain();
3194 Parcel reply = Parcel.obtain();
3195 data.writeInterfaceToken(IActivityManager.descriptor);
3196 data.writeStrongBinder(activityToken);
3197 intent.writeToParcel(data, 0);
3198 description.writeToParcel(data, 0);
3199 thumbnail.writeToParcel(data, 0);
3200 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3201 reply.readException();
3202 int res = reply.readInt();
3203 data.recycle();
3204 reply.recycle();
3205 return res;
3206 }
3207 public Point getAppTaskThumbnailSize() throws RemoteException {
3208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3212 reply.readException();
3213 Point size = Point.CREATOR.createFromParcel(reply);
3214 data.recycle();
3215 reply.recycle();
3216 return size;
3217 }
Todd Kennedye635f662015-01-20 10:36:49 -08003218 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3219 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003220 Parcel data = Parcel.obtain();
3221 Parcel reply = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 data.writeInt(maxNum);
3224 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3226 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003227 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003228 int N = reply.readInt();
3229 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003230 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003231 while (N > 0) {
3232 ActivityManager.RunningTaskInfo info =
3233 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003234 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003235 list.add(info);
3236 N--;
3237 }
3238 }
3239 data.recycle();
3240 reply.recycle();
3241 return list;
3242 }
3243 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003244 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 data.writeInt(maxNum);
3249 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003250 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3252 reply.readException();
3253 ArrayList<ActivityManager.RecentTaskInfo> list
3254 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3255 data.recycle();
3256 reply.recycle();
3257 return list;
3258 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003259 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003260 Parcel data = Parcel.obtain();
3261 Parcel reply = Parcel.obtain();
3262 data.writeInterfaceToken(IActivityManager.descriptor);
3263 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003264 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003265 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003266 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003267 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003268 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003269 }
3270 data.recycle();
3271 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003272 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003273 }
Todd Kennedye635f662015-01-20 10:36:49 -08003274 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3275 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 Parcel data = Parcel.obtain();
3277 Parcel reply = Parcel.obtain();
3278 data.writeInterfaceToken(IActivityManager.descriptor);
3279 data.writeInt(maxNum);
3280 data.writeInt(flags);
3281 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3282 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003283 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003284 int N = reply.readInt();
3285 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003286 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003287 while (N > 0) {
3288 ActivityManager.RunningServiceInfo info =
3289 ActivityManager.RunningServiceInfo.CREATOR
3290 .createFromParcel(reply);
3291 list.add(info);
3292 N--;
3293 }
3294 }
3295 data.recycle();
3296 reply.recycle();
3297 return list;
3298 }
3299 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3300 throws RemoteException {
3301 Parcel data = Parcel.obtain();
3302 Parcel reply = Parcel.obtain();
3303 data.writeInterfaceToken(IActivityManager.descriptor);
3304 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3305 reply.readException();
3306 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3307 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3308 data.recycle();
3309 reply.recycle();
3310 return list;
3311 }
3312 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3313 throws RemoteException {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3318 reply.readException();
3319 ArrayList<ActivityManager.RunningAppProcessInfo> list
3320 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3321 data.recycle();
3322 reply.recycle();
3323 return list;
3324 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003325 public List<ApplicationInfo> getRunningExternalApplications()
3326 throws RemoteException {
3327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
3330 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3331 reply.readException();
3332 ArrayList<ApplicationInfo> list
3333 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3334 data.recycle();
3335 reply.recycle();
3336 return list;
3337 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003338 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003339 {
3340 Parcel data = Parcel.obtain();
3341 Parcel reply = Parcel.obtain();
3342 data.writeInterfaceToken(IActivityManager.descriptor);
3343 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003344 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003345 if (options != null) {
3346 data.writeInt(1);
3347 options.writeToParcel(data, 0);
3348 } else {
3349 data.writeInt(0);
3350 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003351 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3352 reply.readException();
3353 data.recycle();
3354 reply.recycle();
3355 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003356 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3357 throws RemoteException {
3358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 data.writeStrongBinder(token);
3362 data.writeInt(nonRoot ? 1 : 0);
3363 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 boolean res = reply.readInt() != 0;
3366 data.recycle();
3367 reply.recycle();
3368 return res;
3369 }
3370 public void moveTaskBackwards(int task) throws RemoteException
3371 {
3372 Parcel data = Parcel.obtain();
3373 Parcel reply = Parcel.obtain();
3374 data.writeInterfaceToken(IActivityManager.descriptor);
3375 data.writeInt(task);
3376 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3377 reply.readException();
3378 data.recycle();
3379 reply.recycle();
3380 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003381 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003382 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3383 {
3384 Parcel data = Parcel.obtain();
3385 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003386 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003387 data.writeInt(taskId);
3388 data.writeInt(stackId);
3389 data.writeInt(toTop ? 1 : 0);
3390 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3391 reply.readException();
3392 data.recycle();
3393 reply.recycle();
3394 }
3395 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003396 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003397 {
3398 Parcel data = Parcel.obtain();
3399 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003400 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003401 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003402 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003403 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003404 reply.readException();
3405 data.recycle();
3406 reply.recycle();
3407 }
Craig Mautner967212c2013-04-13 21:10:58 -07003408 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003409 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003410 {
3411 Parcel data = Parcel.obtain();
3412 Parcel reply = Parcel.obtain();
3413 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003414 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003415 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003416 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003417 data.recycle();
3418 reply.recycle();
3419 return list;
3420 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003421 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003422 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003423 {
3424 Parcel data = Parcel.obtain();
3425 Parcel reply = Parcel.obtain();
3426 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003427 data.writeInt(stackId);
3428 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003429 reply.readException();
3430 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003431 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003432 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003433 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003434 }
3435 data.recycle();
3436 reply.recycle();
3437 return info;
3438 }
3439 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003440 public boolean isInHomeStack(int taskId) throws RemoteException {
3441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
3444 data.writeInt(taskId);
3445 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3446 reply.readException();
3447 boolean isInHomeStack = reply.readInt() > 0;
3448 data.recycle();
3449 reply.recycle();
3450 return isInHomeStack;
3451 }
3452 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003453 public void setFocusedStack(int stackId) throws RemoteException
3454 {
3455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003459 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003460 reply.readException();
3461 data.recycle();
3462 reply.recycle();
3463 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003464 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003465 public int getFocusedStackId() throws RemoteException {
3466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
3468 data.writeInterfaceToken(IActivityManager.descriptor);
3469 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3470 reply.readException();
3471 int focusedStackId = reply.readInt();
3472 data.recycle();
3473 reply.recycle();
3474 return focusedStackId;
3475 }
3476 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003477 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3478 {
3479 Parcel data = Parcel.obtain();
3480 Parcel reply = Parcel.obtain();
3481 data.writeInterfaceToken(IActivityManager.descriptor);
3482 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003483 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003484 reply.readException();
3485 data.recycle();
3486 reply.recycle();
3487 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003488 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3489 {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 data.writeStrongBinder(token);
3494 data.writeInt(onlyRoot ? 1 : 0);
3495 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3496 reply.readException();
3497 int res = reply.readInt();
3498 data.recycle();
3499 reply.recycle();
3500 return res;
3501 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003502 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003503 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003504 Parcel data = Parcel.obtain();
3505 Parcel reply = Parcel.obtain();
3506 data.writeInterfaceToken(IActivityManager.descriptor);
3507 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3508 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003509 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003510 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003511 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 int res = reply.readInt();
3514 ContentProviderHolder cph = null;
3515 if (res != 0) {
3516 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3517 }
3518 data.recycle();
3519 reply.recycle();
3520 return cph;
3521 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003522 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3523 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003524 Parcel data = Parcel.obtain();
3525 Parcel reply = Parcel.obtain();
3526 data.writeInterfaceToken(IActivityManager.descriptor);
3527 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003528 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003529 data.writeStrongBinder(token);
3530 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3531 reply.readException();
3532 int res = reply.readInt();
3533 ContentProviderHolder cph = null;
3534 if (res != 0) {
3535 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3536 }
3537 data.recycle();
3538 reply.recycle();
3539 return cph;
3540 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003541 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003542 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003543 {
3544 Parcel data = Parcel.obtain();
3545 Parcel reply = Parcel.obtain();
3546 data.writeInterfaceToken(IActivityManager.descriptor);
3547 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3548 data.writeTypedList(providers);
3549 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 data.recycle();
3552 reply.recycle();
3553 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003554 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3555 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003556 Parcel data = Parcel.obtain();
3557 Parcel reply = Parcel.obtain();
3558 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003559 data.writeStrongBinder(connection);
3560 data.writeInt(stable);
3561 data.writeInt(unstable);
3562 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3563 reply.readException();
3564 boolean res = reply.readInt() != 0;
3565 data.recycle();
3566 reply.recycle();
3567 return res;
3568 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003569
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003570 public void unstableProviderDied(IBinder connection) throws RemoteException {
3571 Parcel data = Parcel.obtain();
3572 Parcel reply = Parcel.obtain();
3573 data.writeInterfaceToken(IActivityManager.descriptor);
3574 data.writeStrongBinder(connection);
3575 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3576 reply.readException();
3577 data.recycle();
3578 reply.recycle();
3579 }
3580
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003581 @Override
3582 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3583 Parcel data = Parcel.obtain();
3584 Parcel reply = Parcel.obtain();
3585 data.writeInterfaceToken(IActivityManager.descriptor);
3586 data.writeStrongBinder(connection);
3587 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3588 reply.readException();
3589 data.recycle();
3590 reply.recycle();
3591 }
3592
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003593 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 data.writeStrongBinder(connection);
3598 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003599 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 data.recycle();
3602 reply.recycle();
3603 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003604
3605 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeString(name);
3610 data.writeStrongBinder(token);
3611 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3612 reply.readException();
3613 data.recycle();
3614 reply.recycle();
3615 }
3616
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003617 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3618 throws RemoteException
3619 {
3620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 service.writeToParcel(data, 0);
3624 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3625 reply.readException();
3626 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3627 data.recycle();
3628 reply.recycle();
3629 return res;
3630 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003631
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003632 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003633 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003634 {
3635 Parcel data = Parcel.obtain();
3636 Parcel reply = Parcel.obtain();
3637 data.writeInterfaceToken(IActivityManager.descriptor);
3638 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3639 service.writeToParcel(data, 0);
3640 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003641 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003642 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3643 reply.readException();
3644 ComponentName res = ComponentName.readFromParcel(reply);
3645 data.recycle();
3646 reply.recycle();
3647 return res;
3648 }
3649 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003650 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003651 {
3652 Parcel data = Parcel.obtain();
3653 Parcel reply = Parcel.obtain();
3654 data.writeInterfaceToken(IActivityManager.descriptor);
3655 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3656 service.writeToParcel(data, 0);
3657 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003658 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003659 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3660 reply.readException();
3661 int res = reply.readInt();
3662 reply.recycle();
3663 data.recycle();
3664 return res;
3665 }
3666 public boolean stopServiceToken(ComponentName className, IBinder token,
3667 int startId) throws RemoteException {
3668 Parcel data = Parcel.obtain();
3669 Parcel reply = Parcel.obtain();
3670 data.writeInterfaceToken(IActivityManager.descriptor);
3671 ComponentName.writeToParcel(className, data);
3672 data.writeStrongBinder(token);
3673 data.writeInt(startId);
3674 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3675 reply.readException();
3676 boolean res = reply.readInt() != 0;
3677 data.recycle();
3678 reply.recycle();
3679 return res;
3680 }
3681 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003682 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003683 Parcel data = Parcel.obtain();
3684 Parcel reply = Parcel.obtain();
3685 data.writeInterfaceToken(IActivityManager.descriptor);
3686 ComponentName.writeToParcel(className, data);
3687 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003688 data.writeInt(id);
3689 if (notification != null) {
3690 data.writeInt(1);
3691 notification.writeToParcel(data, 0);
3692 } else {
3693 data.writeInt(0);
3694 }
3695 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003696 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3697 reply.readException();
3698 data.recycle();
3699 reply.recycle();
3700 }
3701 public int bindService(IApplicationThread caller, IBinder token,
3702 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003703 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3708 data.writeStrongBinder(token);
3709 service.writeToParcel(data, 0);
3710 data.writeString(resolvedType);
3711 data.writeStrongBinder(connection.asBinder());
3712 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003713 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003714 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3715 reply.readException();
3716 int res = reply.readInt();
3717 data.recycle();
3718 reply.recycle();
3719 return res;
3720 }
3721 public boolean unbindService(IServiceConnection connection) throws RemoteException
3722 {
3723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 data.writeStrongBinder(connection.asBinder());
3727 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3728 reply.readException();
3729 boolean res = reply.readInt() != 0;
3730 data.recycle();
3731 reply.recycle();
3732 return res;
3733 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003734
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003735 public void publishService(IBinder token,
3736 Intent intent, IBinder service) throws RemoteException {
3737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 data.writeStrongBinder(token);
3741 intent.writeToParcel(data, 0);
3742 data.writeStrongBinder(service);
3743 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3744 reply.readException();
3745 data.recycle();
3746 reply.recycle();
3747 }
3748
3749 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3750 throws RemoteException {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeStrongBinder(token);
3755 intent.writeToParcel(data, 0);
3756 data.writeInt(doRebind ? 1 : 0);
3757 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3758 reply.readException();
3759 data.recycle();
3760 reply.recycle();
3761 }
3762
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003763 public void serviceDoneExecuting(IBinder token, int type, int startId,
3764 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003765 Parcel data = Parcel.obtain();
3766 Parcel reply = Parcel.obtain();
3767 data.writeInterfaceToken(IActivityManager.descriptor);
3768 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003769 data.writeInt(type);
3770 data.writeInt(startId);
3771 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003772 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3773 reply.readException();
3774 data.recycle();
3775 reply.recycle();
3776 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003777
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003778 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3779 Parcel data = Parcel.obtain();
3780 Parcel reply = Parcel.obtain();
3781 data.writeInterfaceToken(IActivityManager.descriptor);
3782 service.writeToParcel(data, 0);
3783 data.writeString(resolvedType);
3784 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3785 reply.readException();
3786 IBinder binder = reply.readStrongBinder();
3787 reply.recycle();
3788 data.recycle();
3789 return binder;
3790 }
3791
Christopher Tate181fafa2009-05-14 11:12:14 -07003792 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3793 throws RemoteException {
3794 Parcel data = Parcel.obtain();
3795 Parcel reply = Parcel.obtain();
3796 data.writeInterfaceToken(IActivityManager.descriptor);
3797 app.writeToParcel(data, 0);
3798 data.writeInt(backupRestoreMode);
3799 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 boolean success = reply.readInt() != 0;
3802 reply.recycle();
3803 data.recycle();
3804 return success;
3805 }
3806
Christopher Tate346acb12012-10-15 19:20:25 -07003807 public void clearPendingBackup() throws RemoteException {
3808 Parcel data = Parcel.obtain();
3809 Parcel reply = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3812 reply.recycle();
3813 data.recycle();
3814 }
3815
Christopher Tate181fafa2009-05-14 11:12:14 -07003816 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3817 Parcel data = Parcel.obtain();
3818 Parcel reply = Parcel.obtain();
3819 data.writeInterfaceToken(IActivityManager.descriptor);
3820 data.writeString(packageName);
3821 data.writeStrongBinder(agent);
3822 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3823 reply.recycle();
3824 data.recycle();
3825 }
3826
3827 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
3831 app.writeToParcel(data, 0);
3832 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3833 reply.readException();
3834 reply.recycle();
3835 data.recycle();
3836 }
3837
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003838 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003839 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003840 IUiAutomationConnection connection, int userId, String instructionSet)
3841 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003842 Parcel data = Parcel.obtain();
3843 Parcel reply = Parcel.obtain();
3844 data.writeInterfaceToken(IActivityManager.descriptor);
3845 ComponentName.writeToParcel(className, data);
3846 data.writeString(profileFile);
3847 data.writeInt(flags);
3848 data.writeBundle(arguments);
3849 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003850 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003851 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003852 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3854 reply.readException();
3855 boolean res = reply.readInt() != 0;
3856 reply.recycle();
3857 data.recycle();
3858 return res;
3859 }
3860
3861 public void finishInstrumentation(IApplicationThread target,
3862 int resultCode, Bundle results) throws RemoteException {
3863 Parcel data = Parcel.obtain();
3864 Parcel reply = Parcel.obtain();
3865 data.writeInterfaceToken(IActivityManager.descriptor);
3866 data.writeStrongBinder(target != null ? target.asBinder() : null);
3867 data.writeInt(resultCode);
3868 data.writeBundle(results);
3869 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 data.recycle();
3872 reply.recycle();
3873 }
3874 public Configuration getConfiguration() throws RemoteException
3875 {
3876 Parcel data = Parcel.obtain();
3877 Parcel reply = Parcel.obtain();
3878 data.writeInterfaceToken(IActivityManager.descriptor);
3879 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3880 reply.readException();
3881 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3882 reply.recycle();
3883 data.recycle();
3884 return res;
3885 }
3886 public void updateConfiguration(Configuration values) throws RemoteException
3887 {
3888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 values.writeToParcel(data, 0);
3892 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3893 reply.readException();
3894 data.recycle();
3895 reply.recycle();
3896 }
3897 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3898 throws RemoteException {
3899 Parcel data = Parcel.obtain();
3900 Parcel reply = Parcel.obtain();
3901 data.writeInterfaceToken(IActivityManager.descriptor);
3902 data.writeStrongBinder(token);
3903 data.writeInt(requestedOrientation);
3904 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3905 reply.readException();
3906 data.recycle();
3907 reply.recycle();
3908 }
3909 public int getRequestedOrientation(IBinder token) throws RemoteException {
3910 Parcel data = Parcel.obtain();
3911 Parcel reply = Parcel.obtain();
3912 data.writeInterfaceToken(IActivityManager.descriptor);
3913 data.writeStrongBinder(token);
3914 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3915 reply.readException();
3916 int res = reply.readInt();
3917 data.recycle();
3918 reply.recycle();
3919 return res;
3920 }
3921 public ComponentName getActivityClassForToken(IBinder token)
3922 throws RemoteException {
3923 Parcel data = Parcel.obtain();
3924 Parcel reply = Parcel.obtain();
3925 data.writeInterfaceToken(IActivityManager.descriptor);
3926 data.writeStrongBinder(token);
3927 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3928 reply.readException();
3929 ComponentName res = ComponentName.readFromParcel(reply);
3930 data.recycle();
3931 reply.recycle();
3932 return res;
3933 }
3934 public String getPackageForToken(IBinder token) throws RemoteException
3935 {
3936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
3939 data.writeStrongBinder(token);
3940 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3941 reply.readException();
3942 String res = reply.readString();
3943 data.recycle();
3944 reply.recycle();
3945 return res;
3946 }
3947 public IIntentSender getIntentSender(int type,
3948 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003949 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003950 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 data.writeInt(type);
3955 data.writeString(packageName);
3956 data.writeStrongBinder(token);
3957 data.writeString(resultWho);
3958 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003959 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003960 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003961 data.writeTypedArray(intents, 0);
3962 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003963 } else {
3964 data.writeInt(0);
3965 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003966 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003967 if (options != null) {
3968 data.writeInt(1);
3969 options.writeToParcel(data, 0);
3970 } else {
3971 data.writeInt(0);
3972 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003973 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003974 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3975 reply.readException();
3976 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003977 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003978 data.recycle();
3979 reply.recycle();
3980 return res;
3981 }
3982 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3983 Parcel data = Parcel.obtain();
3984 Parcel reply = Parcel.obtain();
3985 data.writeInterfaceToken(IActivityManager.descriptor);
3986 data.writeStrongBinder(sender.asBinder());
3987 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3988 reply.readException();
3989 data.recycle();
3990 reply.recycle();
3991 }
3992 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3993 Parcel data = Parcel.obtain();
3994 Parcel reply = Parcel.obtain();
3995 data.writeInterfaceToken(IActivityManager.descriptor);
3996 data.writeStrongBinder(sender.asBinder());
3997 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3998 reply.readException();
3999 String res = reply.readString();
4000 data.recycle();
4001 reply.recycle();
4002 return res;
4003 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004004 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4005 Parcel data = Parcel.obtain();
4006 Parcel reply = Parcel.obtain();
4007 data.writeInterfaceToken(IActivityManager.descriptor);
4008 data.writeStrongBinder(sender.asBinder());
4009 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4010 reply.readException();
4011 int res = reply.readInt();
4012 data.recycle();
4013 reply.recycle();
4014 return res;
4015 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004016 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4017 boolean requireFull, String name, String callerPackage) throws RemoteException {
4018 Parcel data = Parcel.obtain();
4019 Parcel reply = Parcel.obtain();
4020 data.writeInterfaceToken(IActivityManager.descriptor);
4021 data.writeInt(callingPid);
4022 data.writeInt(callingUid);
4023 data.writeInt(userId);
4024 data.writeInt(allowAll ? 1 : 0);
4025 data.writeInt(requireFull ? 1 : 0);
4026 data.writeString(name);
4027 data.writeString(callerPackage);
4028 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4029 reply.readException();
4030 int res = reply.readInt();
4031 data.recycle();
4032 reply.recycle();
4033 return res;
4034 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004035 public void setProcessLimit(int max) throws RemoteException
4036 {
4037 Parcel data = Parcel.obtain();
4038 Parcel reply = Parcel.obtain();
4039 data.writeInterfaceToken(IActivityManager.descriptor);
4040 data.writeInt(max);
4041 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4042 reply.readException();
4043 data.recycle();
4044 reply.recycle();
4045 }
4046 public int getProcessLimit() throws RemoteException
4047 {
4048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4052 reply.readException();
4053 int res = reply.readInt();
4054 data.recycle();
4055 reply.recycle();
4056 return res;
4057 }
4058 public void setProcessForeground(IBinder token, int pid,
4059 boolean isForeground) throws RemoteException {
4060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeStrongBinder(token);
4064 data.writeInt(pid);
4065 data.writeInt(isForeground ? 1 : 0);
4066 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4067 reply.readException();
4068 data.recycle();
4069 reply.recycle();
4070 }
4071 public int checkPermission(String permission, int pid, int uid)
4072 throws RemoteException {
4073 Parcel data = Parcel.obtain();
4074 Parcel reply = Parcel.obtain();
4075 data.writeInterfaceToken(IActivityManager.descriptor);
4076 data.writeString(permission);
4077 data.writeInt(pid);
4078 data.writeInt(uid);
4079 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4080 reply.readException();
4081 int res = reply.readInt();
4082 data.recycle();
4083 reply.recycle();
4084 return res;
4085 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004086 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4087 throws RemoteException {
4088 Parcel data = Parcel.obtain();
4089 Parcel reply = Parcel.obtain();
4090 data.writeInterfaceToken(IActivityManager.descriptor);
4091 data.writeString(permission);
4092 data.writeInt(pid);
4093 data.writeInt(uid);
4094 data.writeStrongBinder(callerToken);
4095 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4096 reply.readException();
4097 int res = reply.readInt();
4098 data.recycle();
4099 reply.recycle();
4100 return res;
4101 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004102 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004103 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004104 Parcel data = Parcel.obtain();
4105 Parcel reply = Parcel.obtain();
4106 data.writeInterfaceToken(IActivityManager.descriptor);
4107 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004108 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004109 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004110 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 boolean res = reply.readInt() != 0;
4113 data.recycle();
4114 reply.recycle();
4115 return res;
4116 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004117 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4118 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004119 Parcel data = Parcel.obtain();
4120 Parcel reply = Parcel.obtain();
4121 data.writeInterfaceToken(IActivityManager.descriptor);
4122 uri.writeToParcel(data, 0);
4123 data.writeInt(pid);
4124 data.writeInt(uid);
4125 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004126 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004127 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004128 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4129 reply.readException();
4130 int res = reply.readInt();
4131 data.recycle();
4132 reply.recycle();
4133 return res;
4134 }
4135 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004136 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004137 Parcel data = Parcel.obtain();
4138 Parcel reply = Parcel.obtain();
4139 data.writeInterfaceToken(IActivityManager.descriptor);
4140 data.writeStrongBinder(caller.asBinder());
4141 data.writeString(targetPkg);
4142 uri.writeToParcel(data, 0);
4143 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004144 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004145 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4146 reply.readException();
4147 data.recycle();
4148 reply.recycle();
4149 }
4150 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004151 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004152 Parcel data = Parcel.obtain();
4153 Parcel reply = Parcel.obtain();
4154 data.writeInterfaceToken(IActivityManager.descriptor);
4155 data.writeStrongBinder(caller.asBinder());
4156 uri.writeToParcel(data, 0);
4157 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004158 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004159 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4160 reply.readException();
4161 data.recycle();
4162 reply.recycle();
4163 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004164
4165 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004166 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4167 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004168 Parcel data = Parcel.obtain();
4169 Parcel reply = Parcel.obtain();
4170 data.writeInterfaceToken(IActivityManager.descriptor);
4171 uri.writeToParcel(data, 0);
4172 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004173 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004174 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4175 reply.readException();
4176 data.recycle();
4177 reply.recycle();
4178 }
4179
4180 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004181 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4182 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004183 Parcel data = Parcel.obtain();
4184 Parcel reply = Parcel.obtain();
4185 data.writeInterfaceToken(IActivityManager.descriptor);
4186 uri.writeToParcel(data, 0);
4187 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004188 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004189 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4190 reply.readException();
4191 data.recycle();
4192 reply.recycle();
4193 }
4194
4195 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004196 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4197 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004198 Parcel data = Parcel.obtain();
4199 Parcel reply = Parcel.obtain();
4200 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004201 data.writeString(packageName);
4202 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004203 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4204 reply.readException();
4205 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4206 reply);
4207 data.recycle();
4208 reply.recycle();
4209 return perms;
4210 }
4211
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004212 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4213 throws RemoteException {
4214 Parcel data = Parcel.obtain();
4215 Parcel reply = Parcel.obtain();
4216 data.writeInterfaceToken(IActivityManager.descriptor);
4217 data.writeStrongBinder(who.asBinder());
4218 data.writeInt(waiting ? 1 : 0);
4219 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4220 reply.readException();
4221 data.recycle();
4222 reply.recycle();
4223 }
4224 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4225 Parcel data = Parcel.obtain();
4226 Parcel reply = Parcel.obtain();
4227 data.writeInterfaceToken(IActivityManager.descriptor);
4228 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4229 reply.readException();
4230 outInfo.readFromParcel(reply);
4231 data.recycle();
4232 reply.recycle();
4233 }
4234 public void unhandledBack() throws RemoteException
4235 {
4236 Parcel data = Parcel.obtain();
4237 Parcel reply = Parcel.obtain();
4238 data.writeInterfaceToken(IActivityManager.descriptor);
4239 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 data.recycle();
4242 reply.recycle();
4243 }
4244 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4245 {
4246 Parcel data = Parcel.obtain();
4247 Parcel reply = Parcel.obtain();
4248 data.writeInterfaceToken(IActivityManager.descriptor);
4249 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4250 reply.readException();
4251 ParcelFileDescriptor pfd = null;
4252 if (reply.readInt() != 0) {
4253 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4254 }
4255 data.recycle();
4256 reply.recycle();
4257 return pfd;
4258 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004259 public void setLockScreenShown(boolean shown) throws RemoteException
4260 {
4261 Parcel data = Parcel.obtain();
4262 Parcel reply = Parcel.obtain();
4263 data.writeInterfaceToken(IActivityManager.descriptor);
4264 data.writeInt(shown ? 1 : 0);
4265 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4266 reply.readException();
4267 data.recycle();
4268 reply.recycle();
4269 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004270 public void setDebugApp(
4271 String packageName, boolean waitForDebugger, boolean persistent)
4272 throws RemoteException
4273 {
4274 Parcel data = Parcel.obtain();
4275 Parcel reply = Parcel.obtain();
4276 data.writeInterfaceToken(IActivityManager.descriptor);
4277 data.writeString(packageName);
4278 data.writeInt(waitForDebugger ? 1 : 0);
4279 data.writeInt(persistent ? 1 : 0);
4280 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4281 reply.readException();
4282 data.recycle();
4283 reply.recycle();
4284 }
4285 public void setAlwaysFinish(boolean enabled) throws RemoteException
4286 {
4287 Parcel data = Parcel.obtain();
4288 Parcel reply = Parcel.obtain();
4289 data.writeInterfaceToken(IActivityManager.descriptor);
4290 data.writeInt(enabled ? 1 : 0);
4291 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4292 reply.readException();
4293 data.recycle();
4294 reply.recycle();
4295 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004296 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004297 {
4298 Parcel data = Parcel.obtain();
4299 Parcel reply = Parcel.obtain();
4300 data.writeInterfaceToken(IActivityManager.descriptor);
4301 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004302 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004303 reply.readException();
4304 data.recycle();
4305 reply.recycle();
4306 }
4307 public void enterSafeMode() throws RemoteException {
4308 Parcel data = Parcel.obtain();
4309 data.writeInterfaceToken(IActivityManager.descriptor);
4310 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4311 data.recycle();
4312 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004313 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004314 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004315 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004316 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004317 data.writeStrongBinder(sender.asBinder());
4318 data.writeInt(sourceUid);
4319 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004320 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004321 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4322 data.recycle();
4323 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004324 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4325 throws RemoteException {
4326 Parcel data = Parcel.obtain();
4327 data.writeInterfaceToken(IActivityManager.descriptor);
4328 data.writeStrongBinder(sender.asBinder());
4329 data.writeInt(sourceUid);
4330 data.writeString(tag);
4331 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4332 data.recycle();
4333 }
4334 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4335 throws RemoteException {
4336 Parcel data = Parcel.obtain();
4337 data.writeInterfaceToken(IActivityManager.descriptor);
4338 data.writeStrongBinder(sender.asBinder());
4339 data.writeInt(sourceUid);
4340 data.writeString(tag);
4341 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4342 data.recycle();
4343 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004344 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004349 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004350 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004351 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004352 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004353 boolean res = reply.readInt() != 0;
4354 data.recycle();
4355 reply.recycle();
4356 return res;
4357 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004358 @Override
4359 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 data.writeString(reason);
4364 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4365 boolean res = reply.readInt() != 0;
4366 data.recycle();
4367 reply.recycle();
4368 return res;
4369 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004370 public boolean testIsSystemReady()
4371 {
4372 /* this base class version is never called */
4373 return true;
4374 }
Dan Egnor60d87622009-12-16 16:32:58 -08004375 public void handleApplicationCrash(IBinder app,
4376 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4377 {
4378 Parcel data = Parcel.obtain();
4379 Parcel reply = Parcel.obtain();
4380 data.writeInterfaceToken(IActivityManager.descriptor);
4381 data.writeStrongBinder(app);
4382 crashInfo.writeToParcel(data, 0);
4383 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4384 reply.readException();
4385 reply.recycle();
4386 data.recycle();
4387 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004388
Dianne Hackborn52322712014-08-26 22:47:26 -07004389 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004390 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004391 {
4392 Parcel data = Parcel.obtain();
4393 Parcel reply = Parcel.obtain();
4394 data.writeInterfaceToken(IActivityManager.descriptor);
4395 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004396 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004397 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004398 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004399 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004400 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004401 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004402 reply.recycle();
4403 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004404 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004405 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004406
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004407 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004408 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004409 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004410 {
4411 Parcel data = Parcel.obtain();
4412 Parcel reply = Parcel.obtain();
4413 data.writeInterfaceToken(IActivityManager.descriptor);
4414 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004415 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004416 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004417 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4418 reply.readException();
4419 reply.recycle();
4420 data.recycle();
4421 }
4422
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004423 public void signalPersistentProcesses(int sig) throws RemoteException {
4424 Parcel data = Parcel.obtain();
4425 Parcel reply = Parcel.obtain();
4426 data.writeInterfaceToken(IActivityManager.descriptor);
4427 data.writeInt(sig);
4428 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4429 reply.readException();
4430 data.recycle();
4431 reply.recycle();
4432 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004433
Dianne Hackborn1676c852012-09-10 14:52:30 -07004434 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004439 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004440 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4441 reply.readException();
4442 data.recycle();
4443 reply.recycle();
4444 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004445
4446 public void killAllBackgroundProcesses() throws RemoteException {
4447 Parcel data = Parcel.obtain();
4448 Parcel reply = Parcel.obtain();
4449 data.writeInterfaceToken(IActivityManager.descriptor);
4450 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4451 reply.readException();
4452 data.recycle();
4453 reply.recycle();
4454 }
4455
Dianne Hackborn1676c852012-09-10 14:52:30 -07004456 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004457 Parcel data = Parcel.obtain();
4458 Parcel reply = Parcel.obtain();
4459 data.writeInterfaceToken(IActivityManager.descriptor);
4460 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004461 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004462 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004463 reply.readException();
4464 data.recycle();
4465 reply.recycle();
4466 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004467
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004468 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4469 throws RemoteException
4470 {
4471 Parcel data = Parcel.obtain();
4472 Parcel reply = Parcel.obtain();
4473 data.writeInterfaceToken(IActivityManager.descriptor);
4474 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4475 reply.readException();
4476 outInfo.readFromParcel(reply);
4477 reply.recycle();
4478 data.recycle();
4479 }
4480
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004481 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4482 {
4483 Parcel data = Parcel.obtain();
4484 Parcel reply = Parcel.obtain();
4485 data.writeInterfaceToken(IActivityManager.descriptor);
4486 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4487 reply.readException();
4488 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4489 reply.recycle();
4490 data.recycle();
4491 return res;
4492 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004493
Dianne Hackborn1676c852012-09-10 14:52:30 -07004494 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004495 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004496 {
4497 Parcel data = Parcel.obtain();
4498 Parcel reply = Parcel.obtain();
4499 data.writeInterfaceToken(IActivityManager.descriptor);
4500 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004501 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004502 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004503 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004504 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004505 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004506 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004507 } else {
4508 data.writeInt(0);
4509 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004510 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4511 reply.readException();
4512 boolean res = reply.readInt() != 0;
4513 reply.recycle();
4514 data.recycle();
4515 return res;
4516 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004517
Dianne Hackborn55280a92009-05-07 15:53:46 -07004518 public boolean shutdown(int timeout) throws RemoteException
4519 {
4520 Parcel data = Parcel.obtain();
4521 Parcel reply = Parcel.obtain();
4522 data.writeInterfaceToken(IActivityManager.descriptor);
4523 data.writeInt(timeout);
4524 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4525 reply.readException();
4526 boolean res = reply.readInt() != 0;
4527 reply.recycle();
4528 data.recycle();
4529 return res;
4530 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004531
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004532 public void stopAppSwitches() throws RemoteException {
4533 Parcel data = Parcel.obtain();
4534 Parcel reply = Parcel.obtain();
4535 data.writeInterfaceToken(IActivityManager.descriptor);
4536 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4537 reply.readException();
4538 reply.recycle();
4539 data.recycle();
4540 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004541
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004542 public void resumeAppSwitches() throws RemoteException {
4543 Parcel data = Parcel.obtain();
4544 Parcel reply = Parcel.obtain();
4545 data.writeInterfaceToken(IActivityManager.descriptor);
4546 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4547 reply.readException();
4548 reply.recycle();
4549 data.recycle();
4550 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004551
4552 public void addPackageDependency(String packageName) throws RemoteException {
4553 Parcel data = Parcel.obtain();
4554 Parcel reply = Parcel.obtain();
4555 data.writeInterfaceToken(IActivityManager.descriptor);
4556 data.writeString(packageName);
4557 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4558 reply.readException();
4559 data.recycle();
4560 reply.recycle();
4561 }
4562
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004563 public void killApplicationWithAppId(String pkg, int appid, String reason)
4564 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004565 Parcel data = Parcel.obtain();
4566 Parcel reply = Parcel.obtain();
4567 data.writeInterfaceToken(IActivityManager.descriptor);
4568 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004569 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004570 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004571 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004572 reply.readException();
4573 data.recycle();
4574 reply.recycle();
4575 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004576
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004577 public void closeSystemDialogs(String reason) throws RemoteException {
4578 Parcel data = Parcel.obtain();
4579 Parcel reply = Parcel.obtain();
4580 data.writeInterfaceToken(IActivityManager.descriptor);
4581 data.writeString(reason);
4582 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4583 reply.readException();
4584 data.recycle();
4585 reply.recycle();
4586 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004587
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004588 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004589 throws RemoteException {
4590 Parcel data = Parcel.obtain();
4591 Parcel reply = Parcel.obtain();
4592 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004593 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004594 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4595 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004596 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004597 data.recycle();
4598 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004599 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004600 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004601
4602 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4603 Parcel data = Parcel.obtain();
4604 Parcel reply = Parcel.obtain();
4605 data.writeInterfaceToken(IActivityManager.descriptor);
4606 data.writeString(processName);
4607 data.writeInt(uid);
4608 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4609 reply.readException();
4610 data.recycle();
4611 reply.recycle();
4612 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004613
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004614 public void overridePendingTransition(IBinder token, String packageName,
4615 int enterAnim, int exitAnim) throws RemoteException {
4616 Parcel data = Parcel.obtain();
4617 Parcel reply = Parcel.obtain();
4618 data.writeInterfaceToken(IActivityManager.descriptor);
4619 data.writeStrongBinder(token);
4620 data.writeString(packageName);
4621 data.writeInt(enterAnim);
4622 data.writeInt(exitAnim);
4623 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4624 reply.readException();
4625 data.recycle();
4626 reply.recycle();
4627 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004628
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004629 public boolean isUserAMonkey() throws RemoteException {
4630 Parcel data = Parcel.obtain();
4631 Parcel reply = Parcel.obtain();
4632 data.writeInterfaceToken(IActivityManager.descriptor);
4633 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4634 reply.readException();
4635 boolean res = reply.readInt() != 0;
4636 data.recycle();
4637 reply.recycle();
4638 return res;
4639 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004640
4641 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4642 Parcel data = Parcel.obtain();
4643 Parcel reply = Parcel.obtain();
4644 data.writeInterfaceToken(IActivityManager.descriptor);
4645 data.writeInt(monkey ? 1 : 0);
4646 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4647 reply.readException();
4648 data.recycle();
4649 reply.recycle();
4650 }
4651
Dianne Hackborn860755f2010-06-03 18:47:52 -07004652 public void finishHeavyWeightApp() throws RemoteException {
4653 Parcel data = Parcel.obtain();
4654 Parcel reply = Parcel.obtain();
4655 data.writeInterfaceToken(IActivityManager.descriptor);
4656 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4657 reply.readException();
4658 data.recycle();
4659 reply.recycle();
4660 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004661
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004662 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004663 throws RemoteException {
4664 Parcel data = Parcel.obtain();
4665 Parcel reply = Parcel.obtain();
4666 data.writeInterfaceToken(IActivityManager.descriptor);
4667 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004668 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4669 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004670 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004671 data.recycle();
4672 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004673 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004674 }
4675
Craig Mautner233ceee2014-05-09 17:05:11 -07004676 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004677 throws RemoteException {
4678 Parcel data = Parcel.obtain();
4679 Parcel reply = Parcel.obtain();
4680 data.writeInterfaceToken(IActivityManager.descriptor);
4681 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004682 if (options == null) {
4683 data.writeInt(0);
4684 } else {
4685 data.writeInt(1);
4686 data.writeBundle(options.toBundle());
4687 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004688 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004689 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004690 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004691 data.recycle();
4692 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004693 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004694 }
4695
Craig Mautner233ceee2014-05-09 17:05:11 -07004696 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4697 Parcel data = Parcel.obtain();
4698 Parcel reply = Parcel.obtain();
4699 data.writeInterfaceToken(IActivityManager.descriptor);
4700 data.writeStrongBinder(token);
4701 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4702 reply.readException();
4703 Bundle bundle = reply.readBundle();
4704 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4705 data.recycle();
4706 reply.recycle();
4707 return options;
4708 }
4709
Daniel Sandler69a48172010-06-23 16:29:36 -04004710 public void setImmersive(IBinder token, boolean immersive)
4711 throws RemoteException {
4712 Parcel data = Parcel.obtain();
4713 Parcel reply = Parcel.obtain();
4714 data.writeInterfaceToken(IActivityManager.descriptor);
4715 data.writeStrongBinder(token);
4716 data.writeInt(immersive ? 1 : 0);
4717 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4718 reply.readException();
4719 data.recycle();
4720 reply.recycle();
4721 }
4722
4723 public boolean isImmersive(IBinder token)
4724 throws RemoteException {
4725 Parcel data = Parcel.obtain();
4726 Parcel reply = Parcel.obtain();
4727 data.writeInterfaceToken(IActivityManager.descriptor);
4728 data.writeStrongBinder(token);
4729 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004730 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004731 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004732 data.recycle();
4733 reply.recycle();
4734 return res;
4735 }
4736
Craig Mautnerd61dc202014-07-07 11:09:11 -07004737 public boolean isTopOfTask(IBinder token) throws RemoteException {
4738 Parcel data = Parcel.obtain();
4739 Parcel reply = Parcel.obtain();
4740 data.writeInterfaceToken(IActivityManager.descriptor);
4741 data.writeStrongBinder(token);
4742 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4743 reply.readException();
4744 boolean res = reply.readInt() == 1;
4745 data.recycle();
4746 reply.recycle();
4747 return res;
4748 }
4749
Daniel Sandler69a48172010-06-23 16:29:36 -04004750 public boolean isTopActivityImmersive()
4751 throws RemoteException {
4752 Parcel data = Parcel.obtain();
4753 Parcel reply = Parcel.obtain();
4754 data.writeInterfaceToken(IActivityManager.descriptor);
4755 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004756 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004757 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004758 data.recycle();
4759 reply.recycle();
4760 return res;
4761 }
4762
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004763 public void crashApplication(int uid, int initialPid, String packageName,
4764 String message) throws RemoteException {
4765 Parcel data = Parcel.obtain();
4766 Parcel reply = Parcel.obtain();
4767 data.writeInterfaceToken(IActivityManager.descriptor);
4768 data.writeInt(uid);
4769 data.writeInt(initialPid);
4770 data.writeString(packageName);
4771 data.writeString(message);
4772 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4773 reply.readException();
4774 data.recycle();
4775 reply.recycle();
4776 }
Andy McFadden824c5102010-07-09 16:26:57 -07004777
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004778 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004779 Parcel data = Parcel.obtain();
4780 Parcel reply = Parcel.obtain();
4781 data.writeInterfaceToken(IActivityManager.descriptor);
4782 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004783 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004784 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4785 reply.readException();
4786 String res = reply.readString();
4787 data.recycle();
4788 reply.recycle();
4789 return res;
4790 }
4791
Dianne Hackborn7e269642010-08-25 19:50:20 -07004792 public IBinder newUriPermissionOwner(String name)
4793 throws RemoteException {
4794 Parcel data = Parcel.obtain();
4795 Parcel reply = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 data.writeString(name);
4798 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4799 reply.readException();
4800 IBinder res = reply.readStrongBinder();
4801 data.recycle();
4802 reply.recycle();
4803 return res;
4804 }
4805
4806 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004807 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004808 Parcel data = Parcel.obtain();
4809 Parcel reply = Parcel.obtain();
4810 data.writeInterfaceToken(IActivityManager.descriptor);
4811 data.writeStrongBinder(owner);
4812 data.writeInt(fromUid);
4813 data.writeString(targetPkg);
4814 uri.writeToParcel(data, 0);
4815 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004816 data.writeInt(sourceUserId);
4817 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004818 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4819 reply.readException();
4820 data.recycle();
4821 reply.recycle();
4822 }
4823
4824 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004825 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004826 Parcel data = Parcel.obtain();
4827 Parcel reply = Parcel.obtain();
4828 data.writeInterfaceToken(IActivityManager.descriptor);
4829 data.writeStrongBinder(owner);
4830 if (uri != null) {
4831 data.writeInt(1);
4832 uri.writeToParcel(data, 0);
4833 } else {
4834 data.writeInt(0);
4835 }
4836 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004837 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004838 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4839 reply.readException();
4840 data.recycle();
4841 reply.recycle();
4842 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004843
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004844 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004845 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004846 Parcel data = Parcel.obtain();
4847 Parcel reply = Parcel.obtain();
4848 data.writeInterfaceToken(IActivityManager.descriptor);
4849 data.writeInt(callingUid);
4850 data.writeString(targetPkg);
4851 uri.writeToParcel(data, 0);
4852 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004853 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004854 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4855 reply.readException();
4856 int res = reply.readInt();
4857 data.recycle();
4858 reply.recycle();
4859 return res;
4860 }
4861
Dianne Hackborn1676c852012-09-10 14:52:30 -07004862 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004863 String path, ParcelFileDescriptor fd) throws RemoteException {
4864 Parcel data = Parcel.obtain();
4865 Parcel reply = Parcel.obtain();
4866 data.writeInterfaceToken(IActivityManager.descriptor);
4867 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004868 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004869 data.writeInt(managed ? 1 : 0);
4870 data.writeString(path);
4871 if (fd != null) {
4872 data.writeInt(1);
4873 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4874 } else {
4875 data.writeInt(0);
4876 }
4877 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4878 reply.readException();
4879 boolean res = reply.readInt() != 0;
4880 reply.recycle();
4881 data.recycle();
4882 return res;
4883 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004884
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004885 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004886 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004887 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004888 Parcel data = Parcel.obtain();
4889 Parcel reply = Parcel.obtain();
4890 data.writeInterfaceToken(IActivityManager.descriptor);
4891 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004892 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004893 data.writeTypedArray(intents, 0);
4894 data.writeStringArray(resolvedTypes);
4895 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004896 if (options != null) {
4897 data.writeInt(1);
4898 options.writeToParcel(data, 0);
4899 } else {
4900 data.writeInt(0);
4901 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004902 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004903 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4904 reply.readException();
4905 int result = reply.readInt();
4906 reply.recycle();
4907 data.recycle();
4908 return result;
4909 }
4910
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004911 public int getFrontActivityScreenCompatMode() throws RemoteException {
4912 Parcel data = Parcel.obtain();
4913 Parcel reply = Parcel.obtain();
4914 data.writeInterfaceToken(IActivityManager.descriptor);
4915 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4916 reply.readException();
4917 int mode = reply.readInt();
4918 reply.recycle();
4919 data.recycle();
4920 return mode;
4921 }
4922
4923 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4924 Parcel data = Parcel.obtain();
4925 Parcel reply = Parcel.obtain();
4926 data.writeInterfaceToken(IActivityManager.descriptor);
4927 data.writeInt(mode);
4928 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4929 reply.readException();
4930 reply.recycle();
4931 data.recycle();
4932 }
4933
4934 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4935 Parcel data = Parcel.obtain();
4936 Parcel reply = Parcel.obtain();
4937 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004938 data.writeString(packageName);
4939 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004940 reply.readException();
4941 int mode = reply.readInt();
4942 reply.recycle();
4943 data.recycle();
4944 return mode;
4945 }
4946
4947 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004948 throws RemoteException {
4949 Parcel data = Parcel.obtain();
4950 Parcel reply = Parcel.obtain();
4951 data.writeInterfaceToken(IActivityManager.descriptor);
4952 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004953 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004954 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4955 reply.readException();
4956 reply.recycle();
4957 data.recycle();
4958 }
4959
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004960 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4961 Parcel data = Parcel.obtain();
4962 Parcel reply = Parcel.obtain();
4963 data.writeInterfaceToken(IActivityManager.descriptor);
4964 data.writeString(packageName);
4965 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4966 reply.readException();
4967 boolean ask = reply.readInt() != 0;
4968 reply.recycle();
4969 data.recycle();
4970 return ask;
4971 }
4972
4973 public void setPackageAskScreenCompat(String packageName, boolean ask)
4974 throws RemoteException {
4975 Parcel data = Parcel.obtain();
4976 Parcel reply = Parcel.obtain();
4977 data.writeInterfaceToken(IActivityManager.descriptor);
4978 data.writeString(packageName);
4979 data.writeInt(ask ? 1 : 0);
4980 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4981 reply.readException();
4982 reply.recycle();
4983 data.recycle();
4984 }
4985
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004986 public boolean switchUser(int userid) throws RemoteException {
4987 Parcel data = Parcel.obtain();
4988 Parcel reply = Parcel.obtain();
4989 data.writeInterfaceToken(IActivityManager.descriptor);
4990 data.writeInt(userid);
4991 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4992 reply.readException();
4993 boolean result = reply.readInt() != 0;
4994 reply.recycle();
4995 data.recycle();
4996 return result;
4997 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004998
Kenny Guy08488bf2014-02-21 17:40:37 +00004999 public boolean startUserInBackground(int userid) throws RemoteException {
5000 Parcel data = Parcel.obtain();
5001 Parcel reply = Parcel.obtain();
5002 data.writeInterfaceToken(IActivityManager.descriptor);
5003 data.writeInt(userid);
5004 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5005 reply.readException();
5006 boolean result = reply.readInt() != 0;
5007 reply.recycle();
5008 data.recycle();
5009 return result;
5010 }
5011
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005012 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5013 Parcel data = Parcel.obtain();
5014 Parcel reply = Parcel.obtain();
5015 data.writeInterfaceToken(IActivityManager.descriptor);
5016 data.writeInt(userid);
5017 data.writeStrongInterface(callback);
5018 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5019 reply.readException();
5020 int result = reply.readInt();
5021 reply.recycle();
5022 data.recycle();
5023 return result;
5024 }
5025
Amith Yamasani52f1d752012-03-28 18:19:29 -07005026 public UserInfo getCurrentUser() throws RemoteException {
5027 Parcel data = Parcel.obtain();
5028 Parcel reply = Parcel.obtain();
5029 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005030 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005031 reply.readException();
5032 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5033 reply.recycle();
5034 data.recycle();
5035 return userInfo;
5036 }
5037
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005038 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005039 Parcel data = Parcel.obtain();
5040 Parcel reply = Parcel.obtain();
5041 data.writeInterfaceToken(IActivityManager.descriptor);
5042 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005043 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005044 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5045 reply.readException();
5046 boolean result = reply.readInt() != 0;
5047 reply.recycle();
5048 data.recycle();
5049 return result;
5050 }
5051
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005052 public int[] getRunningUserIds() throws RemoteException {
5053 Parcel data = Parcel.obtain();
5054 Parcel reply = Parcel.obtain();
5055 data.writeInterfaceToken(IActivityManager.descriptor);
5056 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5057 reply.readException();
5058 int[] result = reply.createIntArray();
5059 reply.recycle();
5060 data.recycle();
5061 return result;
5062 }
5063
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005064 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005065 Parcel data = Parcel.obtain();
5066 Parcel reply = Parcel.obtain();
5067 data.writeInterfaceToken(IActivityManager.descriptor);
5068 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005069 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5070 reply.readException();
5071 boolean result = reply.readInt() != 0;
5072 reply.recycle();
5073 data.recycle();
5074 return result;
5075 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005076
Jeff Sharkeya4620792011-05-20 15:29:23 -07005077 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5078 Parcel data = Parcel.obtain();
5079 Parcel reply = Parcel.obtain();
5080 data.writeInterfaceToken(IActivityManager.descriptor);
5081 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5082 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5083 reply.readException();
5084 data.recycle();
5085 reply.recycle();
5086 }
5087
5088 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5089 Parcel data = Parcel.obtain();
5090 Parcel reply = Parcel.obtain();
5091 data.writeInterfaceToken(IActivityManager.descriptor);
5092 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5093 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5094 reply.readException();
5095 data.recycle();
5096 reply.recycle();
5097 }
5098
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005099 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5100 Parcel data = Parcel.obtain();
5101 Parcel reply = Parcel.obtain();
5102 data.writeInterfaceToken(IActivityManager.descriptor);
5103 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5104 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5105 reply.readException();
5106 data.recycle();
5107 reply.recycle();
5108 }
5109
5110 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5111 Parcel data = Parcel.obtain();
5112 Parcel reply = Parcel.obtain();
5113 data.writeInterfaceToken(IActivityManager.descriptor);
5114 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5115 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5116 reply.readException();
5117 data.recycle();
5118 reply.recycle();
5119 }
5120
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005121 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5122 Parcel data = Parcel.obtain();
5123 Parcel reply = Parcel.obtain();
5124 data.writeInterfaceToken(IActivityManager.descriptor);
5125 data.writeStrongBinder(sender.asBinder());
5126 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5127 reply.readException();
5128 boolean res = reply.readInt() != 0;
5129 data.recycle();
5130 reply.recycle();
5131 return res;
5132 }
5133
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005134 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5135 Parcel data = Parcel.obtain();
5136 Parcel reply = Parcel.obtain();
5137 data.writeInterfaceToken(IActivityManager.descriptor);
5138 data.writeStrongBinder(sender.asBinder());
5139 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5140 reply.readException();
5141 boolean res = reply.readInt() != 0;
5142 data.recycle();
5143 reply.recycle();
5144 return res;
5145 }
5146
Dianne Hackborn81038902012-11-26 17:04:09 -08005147 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5148 Parcel data = Parcel.obtain();
5149 Parcel reply = Parcel.obtain();
5150 data.writeInterfaceToken(IActivityManager.descriptor);
5151 data.writeStrongBinder(sender.asBinder());
5152 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5153 reply.readException();
5154 Intent res = reply.readInt() != 0
5155 ? Intent.CREATOR.createFromParcel(reply) : null;
5156 data.recycle();
5157 reply.recycle();
5158 return res;
5159 }
5160
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005161 public String getTagForIntentSender(IIntentSender sender, String prefix)
5162 throws RemoteException {
5163 Parcel data = Parcel.obtain();
5164 Parcel reply = Parcel.obtain();
5165 data.writeInterfaceToken(IActivityManager.descriptor);
5166 data.writeStrongBinder(sender.asBinder());
5167 data.writeString(prefix);
5168 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5169 reply.readException();
5170 String res = reply.readString();
5171 data.recycle();
5172 reply.recycle();
5173 return res;
5174 }
5175
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005176 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5177 {
5178 Parcel data = Parcel.obtain();
5179 Parcel reply = Parcel.obtain();
5180 data.writeInterfaceToken(IActivityManager.descriptor);
5181 values.writeToParcel(data, 0);
5182 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5183 reply.readException();
5184 data.recycle();
5185 reply.recycle();
5186 }
5187
Dianne Hackbornb437e092011-08-05 17:50:29 -07005188 public long[] getProcessPss(int[] pids) throws RemoteException {
5189 Parcel data = Parcel.obtain();
5190 Parcel reply = Parcel.obtain();
5191 data.writeInterfaceToken(IActivityManager.descriptor);
5192 data.writeIntArray(pids);
5193 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5194 reply.readException();
5195 long[] res = reply.createLongArray();
5196 data.recycle();
5197 reply.recycle();
5198 return res;
5199 }
5200
Dianne Hackborn661cd522011-08-22 00:26:20 -07005201 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5202 Parcel data = Parcel.obtain();
5203 Parcel reply = Parcel.obtain();
5204 data.writeInterfaceToken(IActivityManager.descriptor);
5205 TextUtils.writeToParcel(msg, data, 0);
5206 data.writeInt(always ? 1 : 0);
5207 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5208 reply.readException();
5209 data.recycle();
5210 reply.recycle();
5211 }
5212
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005213 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005214 Parcel data = Parcel.obtain();
5215 Parcel reply = Parcel.obtain();
5216 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005217 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005218 reply.readException();
5219 data.recycle();
5220 reply.recycle();
5221 }
5222
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005223 public void keyguardGoingAway(boolean disableWindowAnimations,
5224 boolean keyguardGoingToNotificationShade) throws RemoteException {
5225 Parcel data = Parcel.obtain();
5226 Parcel reply = Parcel.obtain();
5227 data.writeInterfaceToken(IActivityManager.descriptor);
5228 data.writeInt(disableWindowAnimations ? 1 : 0);
5229 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5230 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5231 reply.readException();
5232 data.recycle();
5233 reply.recycle();
5234 }
5235
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005236 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005237 throws RemoteException {
5238 Parcel data = Parcel.obtain();
5239 Parcel reply = Parcel.obtain();
5240 data.writeInterfaceToken(IActivityManager.descriptor);
5241 data.writeStrongBinder(token);
5242 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005243 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005244 reply.readException();
5245 boolean result = reply.readInt() != 0;
5246 data.recycle();
5247 reply.recycle();
5248 return result;
5249 }
5250
5251 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5252 throws RemoteException {
5253 Parcel data = Parcel.obtain();
5254 Parcel reply = Parcel.obtain();
5255 data.writeInterfaceToken(IActivityManager.descriptor);
5256 data.writeStrongBinder(token);
5257 target.writeToParcel(data, 0);
5258 data.writeInt(resultCode);
5259 if (resultData != null) {
5260 data.writeInt(1);
5261 resultData.writeToParcel(data, 0);
5262 } else {
5263 data.writeInt(0);
5264 }
5265 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5266 reply.readException();
5267 boolean result = reply.readInt() != 0;
5268 data.recycle();
5269 reply.recycle();
5270 return result;
5271 }
5272
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005273 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5274 Parcel data = Parcel.obtain();
5275 Parcel reply = Parcel.obtain();
5276 data.writeInterfaceToken(IActivityManager.descriptor);
5277 data.writeStrongBinder(activityToken);
5278 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5279 reply.readException();
5280 int result = reply.readInt();
5281 data.recycle();
5282 reply.recycle();
5283 return result;
5284 }
5285
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005286 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5287 Parcel data = Parcel.obtain();
5288 Parcel reply = Parcel.obtain();
5289 data.writeInterfaceToken(IActivityManager.descriptor);
5290 data.writeStrongBinder(activityToken);
5291 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5292 reply.readException();
5293 String result = reply.readString();
5294 data.recycle();
5295 reply.recycle();
5296 return result;
5297 }
5298
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005299 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5300 Parcel data = Parcel.obtain();
5301 Parcel reply = Parcel.obtain();
5302 data.writeInterfaceToken(IActivityManager.descriptor);
5303 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5304 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5305 reply.readException();
5306 data.recycle();
5307 reply.recycle();
5308 }
5309
5310 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5311 Parcel data = Parcel.obtain();
5312 Parcel reply = Parcel.obtain();
5313 data.writeInterfaceToken(IActivityManager.descriptor);
5314 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5315 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5316 reply.readException();
5317 data.recycle();
5318 reply.recycle();
5319 }
5320
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005321 public void requestBugReport() throws RemoteException {
5322 Parcel data = Parcel.obtain();
5323 Parcel reply = Parcel.obtain();
5324 data.writeInterfaceToken(IActivityManager.descriptor);
5325 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5326 reply.readException();
5327 data.recycle();
5328 reply.recycle();
5329 }
5330
Jeff Brownbd181bb2013-09-10 16:44:24 -07005331 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5332 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005333 Parcel data = Parcel.obtain();
5334 Parcel reply = Parcel.obtain();
5335 data.writeInterfaceToken(IActivityManager.descriptor);
5336 data.writeInt(pid);
5337 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005338 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005339 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5340 reply.readException();
5341 long res = reply.readInt();
5342 data.recycle();
5343 reply.recycle();
5344 return res;
5345 }
5346
Adam Skorydfc7fd72013-08-05 19:23:41 -07005347 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005348 Parcel data = Parcel.obtain();
5349 Parcel reply = Parcel.obtain();
5350 data.writeInterfaceToken(IActivityManager.descriptor);
5351 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005352 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005353 reply.readException();
5354 Bundle res = reply.readBundle();
5355 data.recycle();
5356 reply.recycle();
5357 return res;
5358 }
5359
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005360 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5361 throws RemoteException {
5362 Parcel data = Parcel.obtain();
5363 Parcel reply = Parcel.obtain();
5364 data.writeInterfaceToken(IActivityManager.descriptor);
5365 data.writeInt(requestType);
5366 data.writeStrongBinder(receiver.asBinder());
5367 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5368 reply.readException();
5369 data.recycle();
5370 reply.recycle();
5371 }
5372
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005373 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005374 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005375 Parcel data = Parcel.obtain();
5376 Parcel reply = Parcel.obtain();
5377 data.writeInterfaceToken(IActivityManager.descriptor);
5378 data.writeStrongBinder(token);
5379 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005380 structure.writeToParcel(data, 0);
5381 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005382 if (referrer != null) {
5383 data.writeInt(1);
5384 referrer.writeToParcel(data, 0);
5385 } else {
5386 data.writeInt(0);
5387 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005388 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005389 reply.readException();
5390 data.recycle();
5391 reply.recycle();
5392 }
5393
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005394 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5395 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005396 Parcel data = Parcel.obtain();
5397 Parcel reply = Parcel.obtain();
5398 data.writeInterfaceToken(IActivityManager.descriptor);
5399 intent.writeToParcel(data, 0);
5400 data.writeInt(requestType);
5401 data.writeString(hint);
5402 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005403 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005404 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5405 reply.readException();
5406 boolean res = reply.readInt() != 0;
5407 data.recycle();
5408 reply.recycle();
5409 return res;
5410 }
5411
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005412 public void killUid(int uid, String reason) throws RemoteException {
5413 Parcel data = Parcel.obtain();
5414 Parcel reply = Parcel.obtain();
5415 data.writeInterfaceToken(IActivityManager.descriptor);
5416 data.writeInt(uid);
5417 data.writeString(reason);
5418 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5419 reply.readException();
5420 data.recycle();
5421 reply.recycle();
5422 }
5423
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005424 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5425 Parcel data = Parcel.obtain();
5426 Parcel reply = Parcel.obtain();
5427 data.writeInterfaceToken(IActivityManager.descriptor);
5428 data.writeStrongBinder(who);
5429 data.writeInt(allowRestart ? 1 : 0);
5430 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5431 reply.readException();
5432 data.recycle();
5433 reply.recycle();
5434 }
5435
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005436 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5437 Parcel data = Parcel.obtain();
5438 Parcel reply = Parcel.obtain();
5439 data.writeInterfaceToken(IActivityManager.descriptor);
5440 data.writeStrongBinder(token);
5441 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5442 reply.readException();
5443 data.recycle();
5444 reply.recycle();
5445 }
5446
Craig Mautner5eda9b32013-07-02 11:58:16 -07005447 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5448 Parcel data = Parcel.obtain();
5449 Parcel reply = Parcel.obtain();
5450 data.writeInterfaceToken(IActivityManager.descriptor);
5451 data.writeStrongBinder(token);
5452 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5453 reply.readException();
5454 data.recycle();
5455 reply.recycle();
5456 }
5457
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005458 public void restart() throws RemoteException {
5459 Parcel data = Parcel.obtain();
5460 Parcel reply = Parcel.obtain();
5461 data.writeInterfaceToken(IActivityManager.descriptor);
5462 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5463 reply.readException();
5464 data.recycle();
5465 reply.recycle();
5466 }
5467
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005468 public void performIdleMaintenance() throws RemoteException {
5469 Parcel data = Parcel.obtain();
5470 Parcel reply = Parcel.obtain();
5471 data.writeInterfaceToken(IActivityManager.descriptor);
5472 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5473 reply.readException();
5474 data.recycle();
5475 reply.recycle();
5476 }
5477
Todd Kennedyca4d8422015-01-15 15:19:22 -08005478 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005479 IActivityContainerCallback callback) throws RemoteException {
5480 Parcel data = Parcel.obtain();
5481 Parcel reply = Parcel.obtain();
5482 data.writeInterfaceToken(IActivityManager.descriptor);
5483 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005484 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005485 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005486 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005487 final int result = reply.readInt();
5488 final IActivityContainer res;
5489 if (result == 1) {
5490 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5491 } else {
5492 res = null;
5493 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005494 data.recycle();
5495 reply.recycle();
5496 return res;
5497 }
5498
Craig Mautner95da1082014-02-24 17:54:35 -08005499 public void deleteActivityContainer(IActivityContainer activityContainer)
5500 throws RemoteException {
5501 Parcel data = Parcel.obtain();
5502 Parcel reply = Parcel.obtain();
5503 data.writeInterfaceToken(IActivityManager.descriptor);
5504 data.writeStrongBinder(activityContainer.asBinder());
5505 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5506 reply.readException();
5507 data.recycle();
5508 reply.recycle();
5509 }
5510
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005511 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005512 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5513 Parcel data = Parcel.obtain();
5514 Parcel reply = Parcel.obtain();
5515 data.writeInterfaceToken(IActivityManager.descriptor);
5516 data.writeInt(displayId);
5517 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5518 reply.readException();
5519 final int result = reply.readInt();
5520 final IActivityContainer res;
5521 if (result == 1) {
5522 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5523 } else {
5524 res = null;
5525 }
5526 data.recycle();
5527 reply.recycle();
5528 return res;
5529 }
5530
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005531 @Override
5532 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005533 throws RemoteException {
5534 Parcel data = Parcel.obtain();
5535 Parcel reply = Parcel.obtain();
5536 data.writeInterfaceToken(IActivityManager.descriptor);
5537 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005538 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005539 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005540 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005541 data.recycle();
5542 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005543 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005544 }
5545
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005546 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005547 public void startLockTaskMode(int taskId) throws RemoteException {
5548 Parcel data = Parcel.obtain();
5549 Parcel reply = Parcel.obtain();
5550 data.writeInterfaceToken(IActivityManager.descriptor);
5551 data.writeInt(taskId);
5552 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5553 reply.readException();
5554 data.recycle();
5555 reply.recycle();
5556 }
5557
5558 @Override
5559 public void startLockTaskMode(IBinder token) throws RemoteException {
5560 Parcel data = Parcel.obtain();
5561 Parcel reply = Parcel.obtain();
5562 data.writeInterfaceToken(IActivityManager.descriptor);
5563 data.writeStrongBinder(token);
5564 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5565 reply.readException();
5566 data.recycle();
5567 reply.recycle();
5568 }
5569
5570 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005571 public void startLockTaskModeOnCurrent() throws RemoteException {
5572 Parcel data = Parcel.obtain();
5573 Parcel reply = Parcel.obtain();
5574 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005575 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005576 reply.readException();
5577 data.recycle();
5578 reply.recycle();
5579 }
5580
5581 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005582 public void stopLockTaskMode() throws RemoteException {
5583 Parcel data = Parcel.obtain();
5584 Parcel reply = Parcel.obtain();
5585 data.writeInterfaceToken(IActivityManager.descriptor);
5586 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5587 reply.readException();
5588 data.recycle();
5589 reply.recycle();
5590 }
5591
5592 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005593 public void stopLockTaskModeOnCurrent() throws RemoteException {
5594 Parcel data = Parcel.obtain();
5595 Parcel reply = Parcel.obtain();
5596 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005597 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005598 reply.readException();
5599 data.recycle();
5600 reply.recycle();
5601 }
5602
5603 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005604 public boolean isInLockTaskMode() throws RemoteException {
5605 Parcel data = Parcel.obtain();
5606 Parcel reply = Parcel.obtain();
5607 data.writeInterfaceToken(IActivityManager.descriptor);
5608 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5609 reply.readException();
5610 boolean isInLockTaskMode = reply.readInt() == 1;
5611 data.recycle();
5612 reply.recycle();
5613 return isInLockTaskMode;
5614 }
5615
Craig Mautner688b5102014-03-27 16:55:03 -07005616 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005617 public int getLockTaskModeState() throws RemoteException {
5618 Parcel data = Parcel.obtain();
5619 Parcel reply = Parcel.obtain();
5620 data.writeInterfaceToken(IActivityManager.descriptor);
5621 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5622 reply.readException();
5623 int lockTaskModeState = reply.readInt();
5624 data.recycle();
5625 reply.recycle();
5626 return lockTaskModeState;
5627 }
5628
5629 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005630 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5631 Parcel data = Parcel.obtain();
5632 Parcel reply = Parcel.obtain();
5633 data.writeInterfaceToken(IActivityManager.descriptor);
5634 data.writeStrongBinder(token);
5635 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5636 IBinder.FLAG_ONEWAY);
5637 reply.readException();
5638 data.recycle();
5639 reply.recycle();
5640 }
5641
5642 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005643 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005644 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005645 Parcel data = Parcel.obtain();
5646 Parcel reply = Parcel.obtain();
5647 data.writeInterfaceToken(IActivityManager.descriptor);
5648 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005649 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005650 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005651 reply.readException();
5652 data.recycle();
5653 reply.recycle();
5654 }
5655
Craig Mautneree2e45a2014-06-27 12:10:03 -07005656 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005657 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5658 Parcel data = Parcel.obtain();
5659 Parcel reply = Parcel.obtain();
5660 data.writeInterfaceToken(IActivityManager.descriptor);
5661 data.writeInt(taskId);
5662 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005663 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005664 reply.readException();
5665 data.recycle();
5666 reply.recycle();
5667 }
5668
5669 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005670 public void resizeTask(int taskId, Rect r) throws RemoteException
5671 {
5672 Parcel data = Parcel.obtain();
5673 Parcel reply = Parcel.obtain();
5674 data.writeInterfaceToken(IActivityManager.descriptor);
5675 data.writeInt(taskId);
5676 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005677 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005678 reply.readException();
5679 data.recycle();
5680 reply.recycle();
5681 }
5682
5683 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005684 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5685 Parcel data = Parcel.obtain();
5686 Parcel reply = Parcel.obtain();
5687 data.writeInterfaceToken(IActivityManager.descriptor);
5688 data.writeString(filename);
5689 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5690 reply.readException();
5691 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5692 data.recycle();
5693 reply.recycle();
5694 return icon;
5695 }
5696
5697 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005698 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5699 throws RemoteException {
5700 Parcel data = Parcel.obtain();
5701 Parcel reply = Parcel.obtain();
5702 data.writeInterfaceToken(IActivityManager.descriptor);
5703 if (options == null) {
5704 data.writeInt(0);
5705 } else {
5706 data.writeInt(1);
5707 data.writeBundle(options.toBundle());
5708 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005709 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005710 reply.readException();
5711 data.recycle();
5712 reply.recycle();
5713 }
5714
5715 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005716 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005717 Parcel data = Parcel.obtain();
5718 Parcel reply = Parcel.obtain();
5719 data.writeInterfaceToken(IActivityManager.descriptor);
5720 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005721 data.writeInt(visible ? 1 : 0);
5722 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005723 reply.readException();
5724 boolean success = reply.readInt() > 0;
5725 data.recycle();
5726 reply.recycle();
5727 return success;
5728 }
5729
5730 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005731 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005732 Parcel data = Parcel.obtain();
5733 Parcel reply = Parcel.obtain();
5734 data.writeInterfaceToken(IActivityManager.descriptor);
5735 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005736 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005737 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005738 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005739 data.recycle();
5740 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005741 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005742 }
5743
5744 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005745 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005746 Parcel data = Parcel.obtain();
5747 Parcel reply = Parcel.obtain();
5748 data.writeInterfaceToken(IActivityManager.descriptor);
5749 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005750 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005751 reply.readException();
5752 data.recycle();
5753 reply.recycle();
5754 }
5755
5756 @Override
5757 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5758 Parcel data = Parcel.obtain();
5759 Parcel reply = Parcel.obtain();
5760 data.writeInterfaceToken(IActivityManager.descriptor);
5761 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005762 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005763 reply.readException();
5764 data.recycle();
5765 reply.recycle();
5766 }
5767
Craig Mautner8746a472014-07-24 15:12:54 -07005768 @Override
5769 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5770 Parcel data = Parcel.obtain();
5771 Parcel reply = Parcel.obtain();
5772 data.writeInterfaceToken(IActivityManager.descriptor);
5773 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005774 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005775 reply.readException();
5776 data.recycle();
5777 reply.recycle();
5778 }
5779
Craig Mautner6e2f3952014-09-09 14:26:41 -07005780 @Override
5781 public void bootAnimationComplete() throws RemoteException {
5782 Parcel data = Parcel.obtain();
5783 Parcel reply = Parcel.obtain();
5784 data.writeInterfaceToken(IActivityManager.descriptor);
5785 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5786 reply.readException();
5787 data.recycle();
5788 reply.recycle();
5789 }
5790
Wale Ogunwale18795a22014-12-03 11:38:33 -08005791 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005792 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5793 Parcel data = Parcel.obtain();
5794 Parcel reply = Parcel.obtain();
5795 data.writeInterfaceToken(IActivityManager.descriptor);
5796 data.writeInt(uid);
5797 data.writeByteArray(firstPacket);
5798 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5799 reply.readException();
5800 data.recycle();
5801 reply.recycle();
5802 }
5803
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005804 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005805 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5806 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005807 Parcel data = Parcel.obtain();
5808 Parcel reply = Parcel.obtain();
5809 data.writeInterfaceToken(IActivityManager.descriptor);
5810 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005811 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005812 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005813 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005814 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5815 reply.readException();
5816 data.recycle();
5817 reply.recycle();
5818 }
5819
5820 @Override
5821 public void dumpHeapFinished(String path) throws RemoteException {
5822 Parcel data = Parcel.obtain();
5823 Parcel reply = Parcel.obtain();
5824 data.writeInterfaceToken(IActivityManager.descriptor);
5825 data.writeString(path);
5826 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5827 reply.readException();
5828 data.recycle();
5829 reply.recycle();
5830 }
5831
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005832 @Override
5833 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5834 throws RemoteException {
5835 Parcel data = Parcel.obtain();
5836 Parcel reply = Parcel.obtain();
5837 data.writeInterfaceToken(IActivityManager.descriptor);
5838 data.writeStrongBinder(session.asBinder());
5839 data.writeInt(keepAwake ? 1 : 0);
5840 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5841 reply.readException();
5842 data.recycle();
5843 reply.recycle();
5844 }
5845
Craig Mautnere5600772015-04-03 21:36:37 -07005846 @Override
5847 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5848 Parcel data = Parcel.obtain();
5849 Parcel reply = Parcel.obtain();
5850 data.writeInterfaceToken(IActivityManager.descriptor);
5851 data.writeInt(userId);
5852 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005853 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005854 reply.readException();
5855 data.recycle();
5856 reply.recycle();
5857 }
5858
Dianne Hackborn1e383822015-04-10 14:02:33 -07005859 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07005860 public void updateDeviceOwner(String packageName) throws RemoteException {
5861 Parcel data = Parcel.obtain();
5862 Parcel reply = Parcel.obtain();
5863 data.writeInterfaceToken(IActivityManager.descriptor);
5864 data.writeString(packageName);
5865 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
5866 reply.readException();
5867 data.recycle();
5868 reply.recycle();
5869 }
5870
5871 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07005872 public int getPackageProcessState(String packageName, String callingPackage)
5873 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07005874 Parcel data = Parcel.obtain();
5875 Parcel reply = Parcel.obtain();
5876 data.writeInterfaceToken(IActivityManager.descriptor);
5877 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07005878 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005879 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5880 reply.readException();
5881 int res = reply.readInt();
5882 data.recycle();
5883 reply.recycle();
5884 return res;
5885 }
5886
Stefan Kuhne16045c22015-06-05 07:18:06 -07005887 @Override
5888 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
5889 throws RemoteException {
5890 Parcel data = Parcel.obtain();
5891 Parcel reply = Parcel.obtain();
5892 data.writeInterfaceToken(IActivityManager.descriptor);
5893 data.writeString(process);
5894 data.writeInt(userId);
5895 data.writeInt(level);
5896 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
5897 reply.readException();
5898 int res = reply.readInt();
5899 data.recycle();
5900 reply.recycle();
5901 return res != 0;
5902 }
5903
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005904 private IBinder mRemote;
5905}