blob: e144c297f50ea8271ab21a959a75b91172688033 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
110 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackborna750a632015-06-16 17:18:23 -0700111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Dianne Hackborn1e383822015-04-10 14:02:33 -0700119 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg, tag);
120 } catch (RemoteException ex) {
121 }
122 }
123
124 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
125 try {
126 getDefault().noteAlarmStart(ps.getTarget(), sourceUid, tag);
127 } catch (RemoteException ex) {
128 }
129 }
130
131 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
132 try {
133 getDefault().noteAlarmFinish(ps.getTarget(), sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 } catch (RemoteException ex) {
135 }
136 }
137
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800138 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 attachInterface(this, descriptor);
140 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700141
142 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
144 throws RemoteException {
145 switch (code) {
146 case START_ACTIVITY_TRANSACTION:
147 {
148 data.enforceInterface(IActivityManager.descriptor);
149 IBinder b = data.readStrongBinder();
150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800151 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 Intent intent = Intent.CREATOR.createFromParcel(data);
153 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800155 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700157 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700158 ProfilerInfo profilerInfo = data.readInt() != 0
159 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700160 Bundle options = data.readInt() != 0
161 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800162 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700163 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 reply.writeNoException();
165 reply.writeInt(result);
166 return true;
167 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700168
Amith Yamasani82644082012-08-03 13:09:11 -0700169 case START_ACTIVITY_AS_USER_TRANSACTION:
170 {
171 data.enforceInterface(IActivityManager.descriptor);
172 IBinder b = data.readStrongBinder();
173 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800174 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700175 Intent intent = Intent.CREATOR.createFromParcel(data);
176 String resolvedType = data.readString();
177 IBinder resultTo = data.readStrongBinder();
178 String resultWho = data.readString();
179 int requestCode = data.readInt();
180 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700181 ProfilerInfo profilerInfo = data.readInt() != 0
182 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700183 Bundle options = data.readInt() != 0
184 ? Bundle.CREATOR.createFromParcel(data) : null;
185 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800186 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700187 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700188 reply.writeNoException();
189 reply.writeInt(result);
190 return true;
191 }
192
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700193 case START_ACTIVITY_AS_CALLER_TRANSACTION:
194 {
195 data.enforceInterface(IActivityManager.descriptor);
196 IBinder b = data.readStrongBinder();
197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
198 String callingPackage = data.readString();
199 Intent intent = Intent.CREATOR.createFromParcel(data);
200 String resolvedType = data.readString();
201 IBinder resultTo = data.readStrongBinder();
202 String resultWho = data.readString();
203 int requestCode = data.readInt();
204 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700205 ProfilerInfo profilerInfo = data.readInt() != 0
206 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700207 Bundle options = data.readInt() != 0
208 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700209 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700210 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700211 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
213 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700214 reply.writeNoException();
215 reply.writeInt(result);
216 return true;
217 }
218
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800219 case START_ACTIVITY_AND_WAIT_TRANSACTION:
220 {
221 data.enforceInterface(IActivityManager.descriptor);
222 IBinder b = data.readStrongBinder();
223 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800224 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800225 Intent intent = Intent.CREATOR.createFromParcel(data);
226 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800227 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800228 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800229 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700231 ProfilerInfo profilerInfo = data.readInt() != 0
232 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700233 Bundle options = data.readInt() != 0
234 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700235 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800236 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700237 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800238 reply.writeNoException();
239 result.writeToParcel(reply, 0);
240 return true;
241 }
242
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700243 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
244 {
245 data.enforceInterface(IActivityManager.descriptor);
246 IBinder b = data.readStrongBinder();
247 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800248 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700249 Intent intent = Intent.CREATOR.createFromParcel(data);
250 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700251 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700252 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700253 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700254 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700255 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700256 Bundle options = data.readInt() != 0
257 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700258 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800259 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700260 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700261 reply.writeNoException();
262 reply.writeInt(result);
263 return true;
264 }
265
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700266 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700267 {
268 data.enforceInterface(IActivityManager.descriptor);
269 IBinder b = data.readStrongBinder();
270 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700271 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700272 Intent fillInIntent = null;
273 if (data.readInt() != 0) {
274 fillInIntent = Intent.CREATOR.createFromParcel(data);
275 }
276 String resolvedType = data.readString();
277 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700278 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700279 int requestCode = data.readInt();
280 int flagsMask = data.readInt();
281 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700282 Bundle options = data.readInt() != 0
283 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700284 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700285 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700286 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700287 reply.writeNoException();
288 reply.writeInt(result);
289 return true;
290 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700291
Dianne Hackborn91097de2014-04-04 18:02:06 -0700292 case START_VOICE_ACTIVITY_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 String callingPackage = data.readString();
296 int callingPid = data.readInt();
297 int callingUid = data.readInt();
298 Intent intent = Intent.CREATOR.createFromParcel(data);
299 String resolvedType = data.readString();
300 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
301 data.readStrongBinder());
302 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
303 data.readStrongBinder());
304 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700305 ProfilerInfo profilerInfo = data.readInt() != 0
306 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700307 Bundle options = data.readInt() != 0
308 ? Bundle.CREATOR.createFromParcel(data) : null;
309 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700310 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
311 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700312 reply.writeNoException();
313 reply.writeInt(result);
314 return true;
315 }
316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
318 {
319 data.enforceInterface(IActivityManager.descriptor);
320 IBinder callingActivity = data.readStrongBinder();
321 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700322 Bundle options = data.readInt() != 0
323 ? Bundle.CREATOR.createFromParcel(data) : null;
324 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800325 reply.writeNoException();
326 reply.writeInt(result ? 1 : 0);
327 return true;
328 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700329
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700330 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
331 {
332 data.enforceInterface(IActivityManager.descriptor);
333 int taskId = data.readInt();
334 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
335 int result = startActivityFromRecents(taskId, options);
336 reply.writeNoException();
337 reply.writeInt(result);
338 return true;
339 }
340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800341 case FINISH_ACTIVITY_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 Intent resultData = null;
345 int resultCode = data.readInt();
346 if (data.readInt() != 0) {
347 resultData = Intent.CREATOR.createFromParcel(data);
348 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700349 boolean finishTask = (data.readInt() != 0);
350 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 reply.writeNoException();
352 reply.writeInt(res ? 1 : 0);
353 return true;
354 }
355
356 case FINISH_SUB_ACTIVITY_TRANSACTION: {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700359 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 int requestCode = data.readInt();
361 finishSubActivity(token, resultWho, requestCode);
362 reply.writeNoException();
363 return true;
364 }
365
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700366 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
367 data.enforceInterface(IActivityManager.descriptor);
368 IBinder token = data.readStrongBinder();
369 boolean res = finishActivityAffinity(token);
370 reply.writeNoException();
371 reply.writeInt(res ? 1 : 0);
372 return true;
373 }
374
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700375 case FINISH_VOICE_TASK_TRANSACTION: {
376 data.enforceInterface(IActivityManager.descriptor);
377 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
378 data.readStrongBinder());
379 finishVoiceTask(session);
380 reply.writeNoException();
381 return true;
382 }
383
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700384 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
385 data.enforceInterface(IActivityManager.descriptor);
386 IBinder token = data.readStrongBinder();
387 boolean res = releaseActivityInstance(token);
388 reply.writeNoException();
389 reply.writeInt(res ? 1 : 0);
390 return true;
391 }
392
393 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
394 data.enforceInterface(IActivityManager.descriptor);
395 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
396 releaseSomeActivities(app);
397 reply.writeNoException();
398 return true;
399 }
400
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800401 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
402 data.enforceInterface(IActivityManager.descriptor);
403 IBinder token = data.readStrongBinder();
404 boolean res = willActivityBeVisible(token);
405 reply.writeNoException();
406 reply.writeInt(res ? 1 : 0);
407 return true;
408 }
409
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800410 case REGISTER_RECEIVER_TRANSACTION:
411 {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder b = data.readStrongBinder();
414 IApplicationThread app =
415 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700416 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 b = data.readStrongBinder();
418 IIntentReceiver rec
419 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
420 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
421 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700422 int userId = data.readInt();
423 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 reply.writeNoException();
425 if (intent != null) {
426 reply.writeInt(1);
427 intent.writeToParcel(reply, 0);
428 } else {
429 reply.writeInt(0);
430 }
431 return true;
432 }
433
434 case UNREGISTER_RECEIVER_TRANSACTION:
435 {
436 data.enforceInterface(IActivityManager.descriptor);
437 IBinder b = data.readStrongBinder();
438 if (b == null) {
439 return true;
440 }
441 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
442 unregisterReceiver(rec);
443 reply.writeNoException();
444 return true;
445 }
446
447 case BROADCAST_INTENT_TRANSACTION:
448 {
449 data.enforceInterface(IActivityManager.descriptor);
450 IBinder b = data.readStrongBinder();
451 IApplicationThread app =
452 b != null ? ApplicationThreadNative.asInterface(b) : null;
453 Intent intent = Intent.CREATOR.createFromParcel(data);
454 String resolvedType = data.readString();
455 b = data.readStrongBinder();
456 IIntentReceiver resultTo =
457 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
458 int resultCode = data.readInt();
459 String resultData = data.readString();
460 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700461 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800462 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700463 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800464 boolean serialized = data.readInt() != 0;
465 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700466 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700468 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700469 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 reply.writeNoException();
471 reply.writeInt(res);
472 return true;
473 }
474
475 case UNBROADCAST_INTENT_TRANSACTION:
476 {
477 data.enforceInterface(IActivityManager.descriptor);
478 IBinder b = data.readStrongBinder();
479 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
480 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700481 int userId = data.readInt();
482 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 reply.writeNoException();
484 return true;
485 }
486
487 case FINISH_RECEIVER_TRANSACTION: {
488 data.enforceInterface(IActivityManager.descriptor);
489 IBinder who = data.readStrongBinder();
490 int resultCode = data.readInt();
491 String resultData = data.readString();
492 Bundle resultExtras = data.readBundle();
493 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800494 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800496 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 }
498 reply.writeNoException();
499 return true;
500 }
501
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 case ATTACH_APPLICATION_TRANSACTION: {
503 data.enforceInterface(IActivityManager.descriptor);
504 IApplicationThread app = ApplicationThreadNative.asInterface(
505 data.readStrongBinder());
506 if (app != null) {
507 attachApplication(app);
508 }
509 reply.writeNoException();
510 return true;
511 }
512
513 case ACTIVITY_IDLE_TRANSACTION: {
514 data.enforceInterface(IActivityManager.descriptor);
515 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700516 Configuration config = null;
517 if (data.readInt() != 0) {
518 config = Configuration.CREATOR.createFromParcel(data);
519 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700520 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800521 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700522 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 }
524 reply.writeNoException();
525 return true;
526 }
527
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700528 case ACTIVITY_RESUMED_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 IBinder token = data.readStrongBinder();
531 activityResumed(token);
532 reply.writeNoException();
533 return true;
534 }
535
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 case ACTIVITY_PAUSED_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700539 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 reply.writeNoException();
541 return true;
542 }
543
544 case ACTIVITY_STOPPED_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800547 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700548 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700550 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 reply.writeNoException();
552 return true;
553 }
554
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800555 case ACTIVITY_SLEPT_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 activitySlept(token);
559 reply.writeNoException();
560 return true;
561 }
562
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800563 case ACTIVITY_DESTROYED_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
565 IBinder token = data.readStrongBinder();
566 activityDestroyed(token);
567 reply.writeNoException();
568 return true;
569 }
570
571 case GET_CALLING_PACKAGE_TRANSACTION: {
572 data.enforceInterface(IActivityManager.descriptor);
573 IBinder token = data.readStrongBinder();
574 String res = token != null ? getCallingPackage(token) : null;
575 reply.writeNoException();
576 reply.writeString(res);
577 return true;
578 }
579
580 case GET_CALLING_ACTIVITY_TRANSACTION: {
581 data.enforceInterface(IActivityManager.descriptor);
582 IBinder token = data.readStrongBinder();
583 ComponentName cn = getCallingActivity(token);
584 reply.writeNoException();
585 ComponentName.writeToParcel(cn, reply);
586 return true;
587 }
588
Winson Chung1147c402014-05-14 11:05:00 -0700589 case GET_APP_TASKS_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700591 String callingPackage = data.readString();
592 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700593 reply.writeNoException();
594 int N = list != null ? list.size() : -1;
595 reply.writeInt(N);
596 int i;
597 for (i=0; i<N; i++) {
598 IAppTask task = list.get(i);
599 reply.writeStrongBinder(task.asBinder());
600 }
601 return true;
602 }
603
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700604 case ADD_APP_TASK_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 IBinder activityToken = data.readStrongBinder();
607 Intent intent = Intent.CREATOR.createFromParcel(data);
608 ActivityManager.TaskDescription descr
609 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
610 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
611 int res = addAppTask(activityToken, intent, descr, thumbnail);
612 reply.writeNoException();
613 reply.writeInt(res);
614 return true;
615 }
616
617 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
618 data.enforceInterface(IActivityManager.descriptor);
619 Point size = getAppTaskThumbnailSize();
620 reply.writeNoException();
621 size.writeToParcel(reply, 0);
622 return true;
623 }
624
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 case GET_TASKS_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 int maxNum = data.readInt();
628 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700629 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800630 reply.writeNoException();
631 int N = list != null ? list.size() : -1;
632 reply.writeInt(N);
633 int i;
634 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700635 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 info.writeToParcel(reply, 0);
637 }
638 return true;
639 }
640
641 case GET_RECENT_TASKS_TRANSACTION: {
642 data.enforceInterface(IActivityManager.descriptor);
643 int maxNum = data.readInt();
644 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700645 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700647 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 reply.writeNoException();
649 reply.writeTypedList(list);
650 return true;
651 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700652
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700653 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800654 data.enforceInterface(IActivityManager.descriptor);
655 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700658 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800659 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700660 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700661 } else {
662 reply.writeInt(0);
663 }
664 return true;
665 }
666
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667 case GET_SERVICES_TRANSACTION: {
668 data.enforceInterface(IActivityManager.descriptor);
669 int maxNum = data.readInt();
670 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700671 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 reply.writeNoException();
673 int N = list != null ? list.size() : -1;
674 reply.writeInt(N);
675 int i;
676 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700677 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 info.writeToParcel(reply, 0);
679 }
680 return true;
681 }
682
683 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
684 data.enforceInterface(IActivityManager.descriptor);
685 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
686 reply.writeNoException();
687 reply.writeTypedList(list);
688 return true;
689 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700690
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800691 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
694 reply.writeNoException();
695 reply.writeTypedList(list);
696 return true;
697 }
698
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700699 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
700 data.enforceInterface(IActivityManager.descriptor);
701 List<ApplicationInfo> list = getRunningExternalApplications();
702 reply.writeNoException();
703 reply.writeTypedList(list);
704 return true;
705 }
706
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 case MOVE_TASK_TO_FRONT_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800710 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700711 Bundle options = data.readInt() != 0
712 ? Bundle.CREATOR.createFromParcel(data) : null;
713 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 reply.writeNoException();
715 return true;
716 }
717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 IBinder token = data.readStrongBinder();
721 boolean nonRoot = data.readInt() != 0;
722 boolean res = moveActivityTaskToBack(token, nonRoot);
723 reply.writeNoException();
724 reply.writeInt(res ? 1 : 0);
725 return true;
726 }
727
728 case MOVE_TASK_BACKWARDS_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 int task = data.readInt();
731 moveTaskBackwards(task);
732 reply.writeNoException();
733 return true;
734 }
735
Craig Mautnerc00204b2013-03-05 15:02:14 -0800736 case MOVE_TASK_TO_STACK_TRANSACTION: {
737 data.enforceInterface(IActivityManager.descriptor);
738 int taskId = data.readInt();
739 int stackId = data.readInt();
740 boolean toTop = data.readInt() != 0;
741 moveTaskToStack(taskId, stackId, toTop);
742 reply.writeNoException();
743 return true;
744 }
745
746 case RESIZE_STACK_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800748 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800749 Rect r = Rect.CREATOR.createFromParcel(data);
750 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800751 reply.writeNoException();
752 return true;
753 }
754
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800755 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700756 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800757 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700758 reply.writeNoException();
759 reply.writeTypedList(list);
760 return true;
761 }
762
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800763 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700764 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800765 int stackId = data.readInt();
766 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700767 reply.writeNoException();
768 if (info != null) {
769 reply.writeInt(1);
770 info.writeToParcel(reply, 0);
771 } else {
772 reply.writeInt(0);
773 }
774 return true;
775 }
776
Winson Chung303e1ff2014-03-07 15:06:19 -0800777 case IS_IN_HOME_STACK_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 int taskId = data.readInt();
780 boolean isInHomeStack = isInHomeStack(taskId);
781 reply.writeNoException();
782 reply.writeInt(isInHomeStack ? 1 : 0);
783 return true;
784 }
785
Craig Mautnercf910b02013-04-23 11:23:27 -0700786 case SET_FOCUSED_STACK_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 int stackId = data.readInt();
789 setFocusedStack(stackId);
790 reply.writeNoException();
791 return true;
792 }
793
Winson Chungd16c5652015-01-26 16:11:07 -0800794 case GET_FOCUSED_STACK_ID_TRANSACTION: {
795 data.enforceInterface(IActivityManager.descriptor);
796 int focusedStackId = getFocusedStackId();
797 reply.writeNoException();
798 reply.writeInt(focusedStackId);
799 return true;
800 }
801
Winson Chung740c3ac2014-11-12 16:14:38 -0800802 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
803 data.enforceInterface(IActivityManager.descriptor);
804 IBinder token = data.readStrongBinder();
805 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
806 reply.writeNoException();
807 return true;
808 }
809
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800810 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
812 IBinder token = data.readStrongBinder();
813 boolean onlyRoot = data.readInt() != 0;
814 int res = token != null
815 ? getTaskForActivity(token, onlyRoot) : -1;
816 reply.writeNoException();
817 reply.writeInt(res);
818 return true;
819 }
820
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800821 case GET_CONTENT_PROVIDER_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 IBinder b = data.readStrongBinder();
824 IApplicationThread app = ApplicationThreadNative.asInterface(b);
825 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700826 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700827 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700828 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800829 reply.writeNoException();
830 if (cph != null) {
831 reply.writeInt(1);
832 cph.writeToParcel(reply, 0);
833 } else {
834 reply.writeInt(0);
835 }
836 return true;
837 }
838
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800839 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
840 data.enforceInterface(IActivityManager.descriptor);
841 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700842 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800843 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700844 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800845 reply.writeNoException();
846 if (cph != null) {
847 reply.writeInt(1);
848 cph.writeToParcel(reply, 0);
849 } else {
850 reply.writeInt(0);
851 }
852 return true;
853 }
854
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800855 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
856 data.enforceInterface(IActivityManager.descriptor);
857 IBinder b = data.readStrongBinder();
858 IApplicationThread app = ApplicationThreadNative.asInterface(b);
859 ArrayList<ContentProviderHolder> providers =
860 data.createTypedArrayList(ContentProviderHolder.CREATOR);
861 publishContentProviders(app, providers);
862 reply.writeNoException();
863 return true;
864 }
865
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700866 case REF_CONTENT_PROVIDER_TRANSACTION: {
867 data.enforceInterface(IActivityManager.descriptor);
868 IBinder b = data.readStrongBinder();
869 int stable = data.readInt();
870 int unstable = data.readInt();
871 boolean res = refContentProvider(b, stable, unstable);
872 reply.writeNoException();
873 reply.writeInt(res ? 1 : 0);
874 return true;
875 }
876
877 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 IBinder b = data.readStrongBinder();
880 unstableProviderDied(b);
881 reply.writeNoException();
882 return true;
883 }
884
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700885 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 IBinder b = data.readStrongBinder();
888 appNotRespondingViaProvider(b);
889 reply.writeNoException();
890 return true;
891 }
892
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800893 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
894 data.enforceInterface(IActivityManager.descriptor);
895 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700896 boolean stable = data.readInt() != 0;
897 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800898 reply.writeNoException();
899 return true;
900 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800901
902 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
903 data.enforceInterface(IActivityManager.descriptor);
904 String name = data.readString();
905 IBinder token = data.readStrongBinder();
906 removeContentProviderExternal(name, token);
907 reply.writeNoException();
908 return true;
909 }
910
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700911 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
912 data.enforceInterface(IActivityManager.descriptor);
913 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
914 PendingIntent pi = getRunningServiceControlPanel(comp);
915 reply.writeNoException();
916 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
917 return true;
918 }
919
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800920 case START_SERVICE_TRANSACTION: {
921 data.enforceInterface(IActivityManager.descriptor);
922 IBinder b = data.readStrongBinder();
923 IApplicationThread app = ApplicationThreadNative.asInterface(b);
924 Intent service = Intent.CREATOR.createFromParcel(data);
925 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700926 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700927 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700928 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800929 reply.writeNoException();
930 ComponentName.writeToParcel(cn, reply);
931 return true;
932 }
933
934 case STOP_SERVICE_TRANSACTION: {
935 data.enforceInterface(IActivityManager.descriptor);
936 IBinder b = data.readStrongBinder();
937 IApplicationThread app = ApplicationThreadNative.asInterface(b);
938 Intent service = Intent.CREATOR.createFromParcel(data);
939 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700940 int userId = data.readInt();
941 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 reply.writeNoException();
943 reply.writeInt(res);
944 return true;
945 }
946
947 case STOP_SERVICE_TOKEN_TRANSACTION: {
948 data.enforceInterface(IActivityManager.descriptor);
949 ComponentName className = ComponentName.readFromParcel(data);
950 IBinder token = data.readStrongBinder();
951 int startId = data.readInt();
952 boolean res = stopServiceToken(className, token, startId);
953 reply.writeNoException();
954 reply.writeInt(res ? 1 : 0);
955 return true;
956 }
957
958 case SET_SERVICE_FOREGROUND_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 ComponentName className = ComponentName.readFromParcel(data);
961 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700962 int id = data.readInt();
963 Notification notification = null;
964 if (data.readInt() != 0) {
965 notification = Notification.CREATOR.createFromParcel(data);
966 }
967 boolean removeNotification = data.readInt() != 0;
968 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800969 reply.writeNoException();
970 return true;
971 }
972
973 case BIND_SERVICE_TRANSACTION: {
974 data.enforceInterface(IActivityManager.descriptor);
975 IBinder b = data.readStrongBinder();
976 IApplicationThread app = ApplicationThreadNative.asInterface(b);
977 IBinder token = data.readStrongBinder();
978 Intent service = Intent.CREATOR.createFromParcel(data);
979 String resolvedType = data.readString();
980 b = data.readStrongBinder();
981 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700982 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800983 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800984 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -0700985 int res = bindService(app, token, service, resolvedType, conn, fl,
986 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 reply.writeNoException();
988 reply.writeInt(res);
989 return true;
990 }
991
992 case UNBIND_SERVICE_TRANSACTION: {
993 data.enforceInterface(IActivityManager.descriptor);
994 IBinder b = data.readStrongBinder();
995 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
996 boolean res = unbindService(conn);
997 reply.writeNoException();
998 reply.writeInt(res ? 1 : 0);
999 return true;
1000 }
1001
1002 case PUBLISH_SERVICE_TRANSACTION: {
1003 data.enforceInterface(IActivityManager.descriptor);
1004 IBinder token = data.readStrongBinder();
1005 Intent intent = Intent.CREATOR.createFromParcel(data);
1006 IBinder service = data.readStrongBinder();
1007 publishService(token, intent, service);
1008 reply.writeNoException();
1009 return true;
1010 }
1011
1012 case UNBIND_FINISHED_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 IBinder token = data.readStrongBinder();
1015 Intent intent = Intent.CREATOR.createFromParcel(data);
1016 boolean doRebind = data.readInt() != 0;
1017 unbindFinished(token, intent, doRebind);
1018 reply.writeNoException();
1019 return true;
1020 }
1021
1022 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1023 data.enforceInterface(IActivityManager.descriptor);
1024 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001025 int type = data.readInt();
1026 int startId = data.readInt();
1027 int res = data.readInt();
1028 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001029 reply.writeNoException();
1030 return true;
1031 }
1032
1033 case START_INSTRUMENTATION_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 ComponentName className = ComponentName.readFromParcel(data);
1036 String profileFile = data.readString();
1037 int fl = data.readInt();
1038 Bundle arguments = data.readBundle();
1039 IBinder b = data.readStrongBinder();
1040 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001041 b = data.readStrongBinder();
1042 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001043 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001044 String abiOverride = data.readString();
1045 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1046 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001047 reply.writeNoException();
1048 reply.writeInt(res ? 1 : 0);
1049 return true;
1050 }
1051
1052
1053 case FINISH_INSTRUMENTATION_TRANSACTION: {
1054 data.enforceInterface(IActivityManager.descriptor);
1055 IBinder b = data.readStrongBinder();
1056 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1057 int resultCode = data.readInt();
1058 Bundle results = data.readBundle();
1059 finishInstrumentation(app, resultCode, results);
1060 reply.writeNoException();
1061 return true;
1062 }
1063
1064 case GET_CONFIGURATION_TRANSACTION: {
1065 data.enforceInterface(IActivityManager.descriptor);
1066 Configuration config = getConfiguration();
1067 reply.writeNoException();
1068 config.writeToParcel(reply, 0);
1069 return true;
1070 }
1071
1072 case UPDATE_CONFIGURATION_TRANSACTION: {
1073 data.enforceInterface(IActivityManager.descriptor);
1074 Configuration config = Configuration.CREATOR.createFromParcel(data);
1075 updateConfiguration(config);
1076 reply.writeNoException();
1077 return true;
1078 }
1079
1080 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 IBinder token = data.readStrongBinder();
1083 int requestedOrientation = data.readInt();
1084 setRequestedOrientation(token, requestedOrientation);
1085 reply.writeNoException();
1086 return true;
1087 }
1088
1089 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1090 data.enforceInterface(IActivityManager.descriptor);
1091 IBinder token = data.readStrongBinder();
1092 int req = getRequestedOrientation(token);
1093 reply.writeNoException();
1094 reply.writeInt(req);
1095 return true;
1096 }
1097
1098 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 IBinder token = data.readStrongBinder();
1101 ComponentName cn = getActivityClassForToken(token);
1102 reply.writeNoException();
1103 ComponentName.writeToParcel(cn, reply);
1104 return true;
1105 }
1106
1107 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 IBinder token = data.readStrongBinder();
1110 reply.writeNoException();
1111 reply.writeString(getPackageForToken(token));
1112 return true;
1113 }
1114
1115 case GET_INTENT_SENDER_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 int type = data.readInt();
1118 String packageName = data.readString();
1119 IBinder token = data.readStrongBinder();
1120 String resultWho = data.readString();
1121 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001122 Intent[] requestIntents;
1123 String[] requestResolvedTypes;
1124 if (data.readInt() != 0) {
1125 requestIntents = data.createTypedArray(Intent.CREATOR);
1126 requestResolvedTypes = data.createStringArray();
1127 } else {
1128 requestIntents = null;
1129 requestResolvedTypes = null;
1130 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001131 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001132 Bundle options = data.readInt() != 0
1133 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001134 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001136 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001137 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 reply.writeNoException();
1139 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1140 return true;
1141 }
1142
1143 case CANCEL_INTENT_SENDER_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 IIntentSender r = IIntentSender.Stub.asInterface(
1146 data.readStrongBinder());
1147 cancelIntentSender(r);
1148 reply.writeNoException();
1149 return true;
1150 }
1151
1152 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 IIntentSender r = IIntentSender.Stub.asInterface(
1155 data.readStrongBinder());
1156 String res = getPackageForIntentSender(r);
1157 reply.writeNoException();
1158 reply.writeString(res);
1159 return true;
1160 }
1161
Christopher Tatec4a07d12012-04-06 14:19:13 -07001162 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1163 data.enforceInterface(IActivityManager.descriptor);
1164 IIntentSender r = IIntentSender.Stub.asInterface(
1165 data.readStrongBinder());
1166 int res = getUidForIntentSender(r);
1167 reply.writeNoException();
1168 reply.writeInt(res);
1169 return true;
1170 }
1171
Dianne Hackborn41203752012-08-31 14:05:51 -07001172 case HANDLE_INCOMING_USER_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 int callingPid = data.readInt();
1175 int callingUid = data.readInt();
1176 int userId = data.readInt();
1177 boolean allowAll = data.readInt() != 0 ;
1178 boolean requireFull = data.readInt() != 0;
1179 String name = data.readString();
1180 String callerPackage = data.readString();
1181 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1182 requireFull, name, callerPackage);
1183 reply.writeNoException();
1184 reply.writeInt(res);
1185 return true;
1186 }
1187
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188 case SET_PROCESS_LIMIT_TRANSACTION: {
1189 data.enforceInterface(IActivityManager.descriptor);
1190 int max = data.readInt();
1191 setProcessLimit(max);
1192 reply.writeNoException();
1193 return true;
1194 }
1195
1196 case GET_PROCESS_LIMIT_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 int limit = getProcessLimit();
1199 reply.writeNoException();
1200 reply.writeInt(limit);
1201 return true;
1202 }
1203
1204 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 IBinder token = data.readStrongBinder();
1207 int pid = data.readInt();
1208 boolean isForeground = data.readInt() != 0;
1209 setProcessForeground(token, pid, isForeground);
1210 reply.writeNoException();
1211 return true;
1212 }
1213
1214 case CHECK_PERMISSION_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 String perm = data.readString();
1217 int pid = data.readInt();
1218 int uid = data.readInt();
1219 int res = checkPermission(perm, pid, uid);
1220 reply.writeNoException();
1221 reply.writeInt(res);
1222 return true;
1223 }
1224
Dianne Hackbornff170242014-11-19 10:59:01 -08001225 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 String perm = data.readString();
1228 int pid = data.readInt();
1229 int uid = data.readInt();
1230 IBinder token = data.readStrongBinder();
1231 int res = checkPermissionWithToken(perm, pid, uid, token);
1232 reply.writeNoException();
1233 reply.writeInt(res);
1234 return true;
1235 }
1236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001237 case CHECK_URI_PERMISSION_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 Uri uri = Uri.CREATOR.createFromParcel(data);
1240 int pid = data.readInt();
1241 int uid = data.readInt();
1242 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001243 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001244 IBinder callerToken = data.readStrongBinder();
1245 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 reply.writeNoException();
1247 reply.writeInt(res);
1248 return true;
1249 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001250
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001251 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001252 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 String packageName = data.readString();
1254 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1255 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001256 int userId = data.readInt();
1257 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 reply.writeNoException();
1259 reply.writeInt(res ? 1 : 0);
1260 return true;
1261 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001262
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001263 case GRANT_URI_PERMISSION_TRANSACTION: {
1264 data.enforceInterface(IActivityManager.descriptor);
1265 IBinder b = data.readStrongBinder();
1266 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1267 String targetPkg = data.readString();
1268 Uri uri = Uri.CREATOR.createFromParcel(data);
1269 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001270 int userId = data.readInt();
1271 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001272 reply.writeNoException();
1273 return true;
1274 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001275
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001276 case REVOKE_URI_PERMISSION_TRANSACTION: {
1277 data.enforceInterface(IActivityManager.descriptor);
1278 IBinder b = data.readStrongBinder();
1279 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1280 Uri uri = Uri.CREATOR.createFromParcel(data);
1281 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001282 int userId = data.readInt();
1283 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 reply.writeNoException();
1285 return true;
1286 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001287
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001288 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 Uri uri = Uri.CREATOR.createFromParcel(data);
1291 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001292 int userId = data.readInt();
1293 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001294 reply.writeNoException();
1295 return true;
1296 }
1297
1298 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
1300 Uri uri = Uri.CREATOR.createFromParcel(data);
1301 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001302 int userId = data.readInt();
1303 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001304 reply.writeNoException();
1305 return true;
1306 }
1307
1308 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1309 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001310 final String packageName = data.readString();
1311 final boolean incoming = data.readInt() != 0;
1312 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1313 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001314 reply.writeNoException();
1315 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1316 return true;
1317 }
1318
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001319 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 IBinder b = data.readStrongBinder();
1322 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1323 boolean waiting = data.readInt() != 0;
1324 showWaitingForDebugger(app, waiting);
1325 reply.writeNoException();
1326 return true;
1327 }
1328
1329 case GET_MEMORY_INFO_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1332 getMemoryInfo(mi);
1333 reply.writeNoException();
1334 mi.writeToParcel(reply, 0);
1335 return true;
1336 }
1337
1338 case UNHANDLED_BACK_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 unhandledBack();
1341 reply.writeNoException();
1342 return true;
1343 }
1344
1345 case OPEN_CONTENT_URI_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 Uri uri = Uri.parse(data.readString());
1348 ParcelFileDescriptor pfd = openContentUri(uri);
1349 reply.writeNoException();
1350 if (pfd != null) {
1351 reply.writeInt(1);
1352 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1353 } else {
1354 reply.writeInt(0);
1355 }
1356 return true;
1357 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001358
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001359 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1360 data.enforceInterface(IActivityManager.descriptor);
1361 setLockScreenShown(data.readInt() != 0);
1362 reply.writeNoException();
1363 return true;
1364 }
1365
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001366 case SET_DEBUG_APP_TRANSACTION: {
1367 data.enforceInterface(IActivityManager.descriptor);
1368 String pn = data.readString();
1369 boolean wfd = data.readInt() != 0;
1370 boolean per = data.readInt() != 0;
1371 setDebugApp(pn, wfd, per);
1372 reply.writeNoException();
1373 return true;
1374 }
1375
1376 case SET_ALWAYS_FINISH_TRANSACTION: {
1377 data.enforceInterface(IActivityManager.descriptor);
1378 boolean enabled = data.readInt() != 0;
1379 setAlwaysFinish(enabled);
1380 reply.writeNoException();
1381 return true;
1382 }
1383
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001384 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001386 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001387 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001388 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001389 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001390 return true;
1391 }
1392
1393 case ENTER_SAFE_MODE_TRANSACTION: {
1394 data.enforceInterface(IActivityManager.descriptor);
1395 enterSafeMode();
1396 reply.writeNoException();
1397 return true;
1398 }
1399
1400 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1401 data.enforceInterface(IActivityManager.descriptor);
1402 IIntentSender is = IIntentSender.Stub.asInterface(
1403 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001404 int sourceUid = data.readInt();
1405 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001406 String tag = data.readString();
1407 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1408 reply.writeNoException();
1409 return true;
1410 }
1411
1412 case NOTE_ALARM_START_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 IIntentSender is = IIntentSender.Stub.asInterface(
1415 data.readStrongBinder());
1416 int sourceUid = data.readInt();
1417 String tag = data.readString();
1418 noteAlarmStart(is, sourceUid, tag);
1419 reply.writeNoException();
1420 return true;
1421 }
1422
1423 case NOTE_ALARM_FINISH_TRANSACTION: {
1424 data.enforceInterface(IActivityManager.descriptor);
1425 IIntentSender is = IIntentSender.Stub.asInterface(
1426 data.readStrongBinder());
1427 int sourceUid = data.readInt();
1428 String tag = data.readString();
1429 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001430 reply.writeNoException();
1431 return true;
1432 }
1433
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001434 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001435 data.enforceInterface(IActivityManager.descriptor);
1436 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001437 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001438 boolean secure = data.readInt() != 0;
1439 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001440 reply.writeNoException();
1441 reply.writeInt(res ? 1 : 0);
1442 return true;
1443 }
1444
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001445 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 String reason = data.readString();
1448 boolean res = killProcessesBelowForeground(reason);
1449 reply.writeNoException();
1450 reply.writeInt(res ? 1 : 0);
1451 return true;
1452 }
1453
Dan Egnor60d87622009-12-16 16:32:58 -08001454 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1455 data.enforceInterface(IActivityManager.descriptor);
1456 IBinder app = data.readStrongBinder();
1457 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1458 handleApplicationCrash(app, ci);
1459 reply.writeNoException();
1460 return true;
1461 }
1462
1463 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001464 data.enforceInterface(IActivityManager.descriptor);
1465 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001466 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001467 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001468 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001469 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001470 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001471 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001472 return true;
1473 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001474
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001475 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1476 data.enforceInterface(IActivityManager.descriptor);
1477 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001478 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001479 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1480 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001481 reply.writeNoException();
1482 return true;
1483 }
1484
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001485 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 int sig = data.readInt();
1488 signalPersistentProcesses(sig);
1489 reply.writeNoException();
1490 return true;
1491 }
1492
Dianne Hackborn03abb812010-01-04 18:43:19 -08001493 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001495 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001496 int userId = data.readInt();
1497 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001498 reply.writeNoException();
1499 return true;
1500 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001501
1502 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1503 data.enforceInterface(IActivityManager.descriptor);
1504 killAllBackgroundProcesses();
1505 reply.writeNoException();
1506 return true;
1507 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001508
Dianne Hackborn03abb812010-01-04 18:43:19 -08001509 case FORCE_STOP_PACKAGE_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001512 int userId = data.readInt();
1513 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001514 reply.writeNoException();
1515 return true;
1516 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001517
1518 case GET_MY_MEMORY_STATE_TRANSACTION: {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 ActivityManager.RunningAppProcessInfo info =
1521 new ActivityManager.RunningAppProcessInfo();
1522 getMyMemoryState(info);
1523 reply.writeNoException();
1524 info.writeToParcel(reply, 0);
1525 return true;
1526 }
1527
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001528 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 ConfigurationInfo config = getDeviceConfigurationInfo();
1531 reply.writeNoException();
1532 config.writeToParcel(reply, 0);
1533 return true;
1534 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001535
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001536 case PROFILE_CONTROL_TRANSACTION: {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001539 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001540 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001541 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001542 ProfilerInfo profilerInfo = data.readInt() != 0
1543 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1544 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001545 reply.writeNoException();
1546 reply.writeInt(res ? 1 : 0);
1547 return true;
1548 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001549
Dianne Hackborn55280a92009-05-07 15:53:46 -07001550 case SHUTDOWN_TRANSACTION: {
1551 data.enforceInterface(IActivityManager.descriptor);
1552 boolean res = shutdown(data.readInt());
1553 reply.writeNoException();
1554 reply.writeInt(res ? 1 : 0);
1555 return true;
1556 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001557
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001558 case STOP_APP_SWITCHES_TRANSACTION: {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 stopAppSwitches();
1561 reply.writeNoException();
1562 return true;
1563 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001564
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001565 case RESUME_APP_SWITCHES_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 resumeAppSwitches();
1568 reply.writeNoException();
1569 return true;
1570 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001571
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001572 case PEEK_SERVICE_TRANSACTION: {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 Intent service = Intent.CREATOR.createFromParcel(data);
1575 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001576 String callingPackage = data.readString();
1577 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001578 reply.writeNoException();
1579 reply.writeStrongBinder(binder);
1580 return true;
1581 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001582
Christopher Tate181fafa2009-05-14 11:12:14 -07001583 case START_BACKUP_AGENT_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1586 int backupRestoreMode = data.readInt();
1587 boolean success = bindBackupAgent(info, backupRestoreMode);
1588 reply.writeNoException();
1589 reply.writeInt(success ? 1 : 0);
1590 return true;
1591 }
1592
1593 case BACKUP_AGENT_CREATED_TRANSACTION: {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 String packageName = data.readString();
1596 IBinder agent = data.readStrongBinder();
1597 backupAgentCreated(packageName, agent);
1598 reply.writeNoException();
1599 return true;
1600 }
1601
1602 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1605 unbindBackupAgent(info);
1606 reply.writeNoException();
1607 return true;
1608 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001609
1610 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1611 data.enforceInterface(IActivityManager.descriptor);
1612 String packageName = data.readString();
1613 addPackageDependency(packageName);
1614 reply.writeNoException();
1615 return true;
1616 }
1617
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001618 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001619 data.enforceInterface(IActivityManager.descriptor);
1620 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001621 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001622 String reason = data.readString();
1623 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001624 reply.writeNoException();
1625 return true;
1626 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001627
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001628 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 String reason = data.readString();
1631 closeSystemDialogs(reason);
1632 reply.writeNoException();
1633 return true;
1634 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001635
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001636 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1637 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001638 int[] pids = data.createIntArray();
1639 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001640 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001641 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001642 return true;
1643 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001644
1645 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1646 data.enforceInterface(IActivityManager.descriptor);
1647 String processName = data.readString();
1648 int uid = data.readInt();
1649 killApplicationProcess(processName, uid);
1650 reply.writeNoException();
1651 return true;
1652 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001653
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001654 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 IBinder token = data.readStrongBinder();
1657 String packageName = data.readString();
1658 int enterAnim = data.readInt();
1659 int exitAnim = data.readInt();
1660 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001661 reply.writeNoException();
1662 return true;
1663 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001664
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001665 case IS_USER_A_MONKEY_TRANSACTION: {
1666 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001667 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001668 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001669 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001670 return true;
1671 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001672
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001673 case SET_USER_IS_MONKEY_TRANSACTION: {
1674 data.enforceInterface(IActivityManager.descriptor);
1675 final boolean monkey = (data.readInt() == 1);
1676 setUserIsMonkey(monkey);
1677 reply.writeNoException();
1678 return true;
1679 }
1680
Dianne Hackborn860755f2010-06-03 18:47:52 -07001681 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1682 data.enforceInterface(IActivityManager.descriptor);
1683 finishHeavyWeightApp();
1684 reply.writeNoException();
1685 return true;
1686 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001687
1688 case IS_IMMERSIVE_TRANSACTION: {
1689 data.enforceInterface(IActivityManager.descriptor);
1690 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001691 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001692 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001693 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001694 return true;
1695 }
1696
Craig Mautnerd61dc202014-07-07 11:09:11 -07001697 case IS_TOP_OF_TASK_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
1699 IBinder token = data.readStrongBinder();
1700 final boolean isTopOfTask = isTopOfTask(token);
1701 reply.writeNoException();
1702 reply.writeInt(isTopOfTask ? 1 : 0);
1703 return true;
1704 }
1705
Craig Mautner5eda9b32013-07-02 11:58:16 -07001706 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001707 data.enforceInterface(IActivityManager.descriptor);
1708 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001709 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001710 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001711 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001712 return true;
1713 }
1714
1715 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1716 data.enforceInterface(IActivityManager.descriptor);
1717 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001718 final Bundle bundle;
1719 if (data.readInt() == 0) {
1720 bundle = null;
1721 } else {
1722 bundle = data.readBundle();
1723 }
1724 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1725 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001726 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001727 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001728 return true;
1729 }
1730
Craig Mautner233ceee2014-05-09 17:05:11 -07001731 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1732 data.enforceInterface(IActivityManager.descriptor);
1733 IBinder token = data.readStrongBinder();
1734 final ActivityOptions options = getActivityOptions(token);
1735 reply.writeNoException();
1736 reply.writeBundle(options == null ? null : options.toBundle());
1737 return true;
1738 }
1739
Daniel Sandler69a48172010-06-23 16:29:36 -04001740 case SET_IMMERSIVE_TRANSACTION: {
1741 data.enforceInterface(IActivityManager.descriptor);
1742 IBinder token = data.readStrongBinder();
1743 boolean imm = data.readInt() == 1;
1744 setImmersive(token, imm);
1745 reply.writeNoException();
1746 return true;
1747 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001748
Daniel Sandler69a48172010-06-23 16:29:36 -04001749 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1750 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001751 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001752 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001753 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001754 return true;
1755 }
1756
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001757 case CRASH_APPLICATION_TRANSACTION: {
1758 data.enforceInterface(IActivityManager.descriptor);
1759 int uid = data.readInt();
1760 int initialPid = data.readInt();
1761 String packageName = data.readString();
1762 String message = data.readString();
1763 crashApplication(uid, initialPid, packageName, message);
1764 reply.writeNoException();
1765 return true;
1766 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001767
1768 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1769 data.enforceInterface(IActivityManager.descriptor);
1770 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001771 int userId = data.readInt();
1772 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001773 reply.writeNoException();
1774 reply.writeString(type);
1775 return true;
1776 }
1777
Dianne Hackborn7e269642010-08-25 19:50:20 -07001778 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 String name = data.readString();
1781 IBinder perm = newUriPermissionOwner(name);
1782 reply.writeNoException();
1783 reply.writeStrongBinder(perm);
1784 return true;
1785 }
1786
1787 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1788 data.enforceInterface(IActivityManager.descriptor);
1789 IBinder owner = data.readStrongBinder();
1790 int fromUid = data.readInt();
1791 String targetPkg = data.readString();
1792 Uri uri = Uri.CREATOR.createFromParcel(data);
1793 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001794 int sourceUserId = data.readInt();
1795 int targetUserId = data.readInt();
1796 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1797 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001798 reply.writeNoException();
1799 return true;
1800 }
1801
1802 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1803 data.enforceInterface(IActivityManager.descriptor);
1804 IBinder owner = data.readStrongBinder();
1805 Uri uri = null;
1806 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001807 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001808 }
1809 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001810 int userId = data.readInt();
1811 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001812 reply.writeNoException();
1813 return true;
1814 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001815
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001816 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1817 data.enforceInterface(IActivityManager.descriptor);
1818 int callingUid = data.readInt();
1819 String targetPkg = data.readString();
1820 Uri uri = Uri.CREATOR.createFromParcel(data);
1821 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001822 int userId = data.readInt();
1823 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001824 reply.writeNoException();
1825 reply.writeInt(res);
1826 return true;
1827 }
1828
Andy McFadden824c5102010-07-09 16:26:57 -07001829 case DUMP_HEAP_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001832 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001833 boolean managed = data.readInt() != 0;
1834 String path = data.readString();
1835 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001836 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001837 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001838 reply.writeNoException();
1839 reply.writeInt(res ? 1 : 0);
1840 return true;
1841 }
1842
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001843 case START_ACTIVITIES_TRANSACTION:
1844 {
1845 data.enforceInterface(IActivityManager.descriptor);
1846 IBinder b = data.readStrongBinder();
1847 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001848 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001849 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1850 String[] resolvedTypes = data.createStringArray();
1851 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001852 Bundle options = data.readInt() != 0
1853 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001854 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001855 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001856 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001857 reply.writeNoException();
1858 reply.writeInt(result);
1859 return true;
1860 }
1861
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001862 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1863 {
1864 data.enforceInterface(IActivityManager.descriptor);
1865 int mode = getFrontActivityScreenCompatMode();
1866 reply.writeNoException();
1867 reply.writeInt(mode);
1868 return true;
1869 }
1870
1871 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1872 {
1873 data.enforceInterface(IActivityManager.descriptor);
1874 int mode = data.readInt();
1875 setFrontActivityScreenCompatMode(mode);
1876 reply.writeNoException();
1877 reply.writeInt(mode);
1878 return true;
1879 }
1880
1881 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1882 {
1883 data.enforceInterface(IActivityManager.descriptor);
1884 String pkg = data.readString();
1885 int mode = getPackageScreenCompatMode(pkg);
1886 reply.writeNoException();
1887 reply.writeInt(mode);
1888 return true;
1889 }
1890
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001891 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1892 {
1893 data.enforceInterface(IActivityManager.descriptor);
1894 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001895 int mode = data.readInt();
1896 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001897 reply.writeNoException();
1898 return true;
1899 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001900
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001901 case SWITCH_USER_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 int userid = data.readInt();
1904 boolean result = switchUser(userid);
1905 reply.writeNoException();
1906 reply.writeInt(result ? 1 : 0);
1907 return true;
1908 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001909
Kenny Guy08488bf2014-02-21 17:40:37 +00001910 case START_USER_IN_BACKGROUND_TRANSACTION: {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 int userid = data.readInt();
1913 boolean result = startUserInBackground(userid);
1914 reply.writeNoException();
1915 reply.writeInt(result ? 1 : 0);
1916 return true;
1917 }
1918
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001919 case STOP_USER_TRANSACTION: {
1920 data.enforceInterface(IActivityManager.descriptor);
1921 int userid = data.readInt();
1922 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1923 data.readStrongBinder());
1924 int result = stopUser(userid, callback);
1925 reply.writeNoException();
1926 reply.writeInt(result);
1927 return true;
1928 }
1929
Amith Yamasani52f1d752012-03-28 18:19:29 -07001930 case GET_CURRENT_USER_TRANSACTION: {
1931 data.enforceInterface(IActivityManager.descriptor);
1932 UserInfo userInfo = getCurrentUser();
1933 reply.writeNoException();
1934 userInfo.writeToParcel(reply, 0);
1935 return true;
1936 }
1937
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001938 case IS_USER_RUNNING_TRANSACTION: {
1939 data.enforceInterface(IActivityManager.descriptor);
1940 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001941 boolean orStopping = data.readInt() != 0;
1942 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001943 reply.writeNoException();
1944 reply.writeInt(result ? 1 : 0);
1945 return true;
1946 }
1947
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001948 case GET_RUNNING_USER_IDS_TRANSACTION: {
1949 data.enforceInterface(IActivityManager.descriptor);
1950 int[] result = getRunningUserIds();
1951 reply.writeNoException();
1952 reply.writeIntArray(result);
1953 return true;
1954 }
1955
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001956 case REMOVE_TASK_TRANSACTION:
1957 {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001960 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001961 reply.writeNoException();
1962 reply.writeInt(result ? 1 : 0);
1963 return true;
1964 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001965
Jeff Sharkeya4620792011-05-20 15:29:23 -07001966 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1969 data.readStrongBinder());
1970 registerProcessObserver(observer);
1971 return true;
1972 }
1973
1974 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1975 data.enforceInterface(IActivityManager.descriptor);
1976 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1977 data.readStrongBinder());
1978 unregisterProcessObserver(observer);
1979 return true;
1980 }
1981
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07001982 case REGISTER_UID_OBSERVER_TRANSACTION: {
1983 data.enforceInterface(IActivityManager.descriptor);
1984 IUidObserver observer = IUidObserver.Stub.asInterface(
1985 data.readStrongBinder());
1986 registerUidObserver(observer);
1987 return true;
1988 }
1989
1990 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
1991 data.enforceInterface(IActivityManager.descriptor);
1992 IUidObserver observer = IUidObserver.Stub.asInterface(
1993 data.readStrongBinder());
1994 unregisterUidObserver(observer);
1995 return true;
1996 }
1997
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001998 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1999 {
2000 data.enforceInterface(IActivityManager.descriptor);
2001 String pkg = data.readString();
2002 boolean ask = getPackageAskScreenCompat(pkg);
2003 reply.writeNoException();
2004 reply.writeInt(ask ? 1 : 0);
2005 return true;
2006 }
2007
2008 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2009 {
2010 data.enforceInterface(IActivityManager.descriptor);
2011 String pkg = data.readString();
2012 boolean ask = data.readInt() != 0;
2013 setPackageAskScreenCompat(pkg, ask);
2014 reply.writeNoException();
2015 return true;
2016 }
2017
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002018 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002021 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002022 boolean res = isIntentSenderTargetedToPackage(r);
2023 reply.writeNoException();
2024 reply.writeInt(res ? 1 : 0);
2025 return true;
2026 }
2027
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002028 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2029 data.enforceInterface(IActivityManager.descriptor);
2030 IIntentSender r = IIntentSender.Stub.asInterface(
2031 data.readStrongBinder());
2032 boolean res = isIntentSenderAnActivity(r);
2033 reply.writeNoException();
2034 reply.writeInt(res ? 1 : 0);
2035 return true;
2036 }
2037
Dianne Hackborn81038902012-11-26 17:04:09 -08002038 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 IIntentSender r = IIntentSender.Stub.asInterface(
2041 data.readStrongBinder());
2042 Intent intent = getIntentForIntentSender(r);
2043 reply.writeNoException();
2044 if (intent != null) {
2045 reply.writeInt(1);
2046 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2047 } else {
2048 reply.writeInt(0);
2049 }
2050 return true;
2051 }
2052
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002053 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2054 data.enforceInterface(IActivityManager.descriptor);
2055 IIntentSender r = IIntentSender.Stub.asInterface(
2056 data.readStrongBinder());
2057 String prefix = data.readString();
2058 String tag = getTagForIntentSender(r, prefix);
2059 reply.writeNoException();
2060 reply.writeString(tag);
2061 return true;
2062 }
2063
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002064 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2065 data.enforceInterface(IActivityManager.descriptor);
2066 Configuration config = Configuration.CREATOR.createFromParcel(data);
2067 updatePersistentConfiguration(config);
2068 reply.writeNoException();
2069 return true;
2070 }
2071
Dianne Hackbornb437e092011-08-05 17:50:29 -07002072 case GET_PROCESS_PSS_TRANSACTION: {
2073 data.enforceInterface(IActivityManager.descriptor);
2074 int[] pids = data.createIntArray();
2075 long[] pss = getProcessPss(pids);
2076 reply.writeNoException();
2077 reply.writeLongArray(pss);
2078 return true;
2079 }
2080
Dianne Hackborn661cd522011-08-22 00:26:20 -07002081 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2082 data.enforceInterface(IActivityManager.descriptor);
2083 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2084 boolean always = data.readInt() != 0;
2085 showBootMessage(msg, always);
2086 reply.writeNoException();
2087 return true;
2088 }
2089
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002090 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002091 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002092 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002093 reply.writeNoException();
2094 return true;
2095 }
2096
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002097 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2098 data.enforceInterface(IActivityManager.descriptor);
2099 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2100 reply.writeNoException();
2101 return true;
2102 }
2103
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002104 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002105 data.enforceInterface(IActivityManager.descriptor);
2106 IBinder token = data.readStrongBinder();
2107 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002108 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002109 reply.writeNoException();
2110 reply.writeInt(res ? 1 : 0);
2111 return true;
2112 }
2113
2114 case NAVIGATE_UP_TO_TRANSACTION: {
2115 data.enforceInterface(IActivityManager.descriptor);
2116 IBinder token = data.readStrongBinder();
2117 Intent target = Intent.CREATOR.createFromParcel(data);
2118 int resultCode = data.readInt();
2119 Intent resultData = null;
2120 if (data.readInt() != 0) {
2121 resultData = Intent.CREATOR.createFromParcel(data);
2122 }
2123 boolean res = navigateUpTo(token, target, resultCode, resultData);
2124 reply.writeNoException();
2125 reply.writeInt(res ? 1 : 0);
2126 return true;
2127 }
2128
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002129 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2130 data.enforceInterface(IActivityManager.descriptor);
2131 IBinder token = data.readStrongBinder();
2132 int res = getLaunchedFromUid(token);
2133 reply.writeNoException();
2134 reply.writeInt(res);
2135 return true;
2136 }
2137
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002138 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2139 data.enforceInterface(IActivityManager.descriptor);
2140 IBinder token = data.readStrongBinder();
2141 String res = getLaunchedFromPackage(token);
2142 reply.writeNoException();
2143 reply.writeString(res);
2144 return true;
2145 }
2146
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002147 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2148 data.enforceInterface(IActivityManager.descriptor);
2149 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2150 data.readStrongBinder());
2151 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002152 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002153 return true;
2154 }
2155
2156 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2157 data.enforceInterface(IActivityManager.descriptor);
2158 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2159 data.readStrongBinder());
2160 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002161 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002162 return true;
2163 }
2164
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002165 case REQUEST_BUG_REPORT_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002168 reply.writeNoException();
2169 return true;
2170 }
2171
2172 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2173 data.enforceInterface(IActivityManager.descriptor);
2174 int pid = data.readInt();
2175 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002176 String reason = data.readString();
2177 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002178 reply.writeNoException();
2179 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002180 return true;
2181 }
2182
Adam Skorydfc7fd72013-08-05 19:23:41 -07002183 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002184 data.enforceInterface(IActivityManager.descriptor);
2185 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002186 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002187 reply.writeNoException();
2188 reply.writeBundle(res);
2189 return true;
2190 }
2191
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002192 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2193 data.enforceInterface(IActivityManager.descriptor);
2194 int requestType = data.readInt();
2195 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002196 IBinder activityToken = data.readStrongBinder();
2197 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002198 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002199 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002200 return true;
2201 }
2202
Adam Skorydfc7fd72013-08-05 19:23:41 -07002203 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002204 data.enforceInterface(IActivityManager.descriptor);
2205 IBinder token = data.readStrongBinder();
2206 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002207 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2208 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002209 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2210 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002211 reply.writeNoException();
2212 return true;
2213 }
2214
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002215 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2216 data.enforceInterface(IActivityManager.descriptor);
2217 Intent intent = Intent.CREATOR.createFromParcel(data);
2218 int requestType = data.readInt();
2219 String hint = data.readString();
2220 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002221 Bundle args = data.readBundle();
2222 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002223 reply.writeNoException();
2224 reply.writeInt(res ? 1 : 0);
2225 return true;
2226 }
2227
Benjamin Franzc200f442015-06-25 18:20:04 +01002228 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2229 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002230 boolean res = isAssistDataAllowedOnCurrentActivity();
2231 reply.writeNoException();
2232 reply.writeInt(res ? 1 : 0);
2233 return true;
2234 }
2235
2236 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 IBinder token = data.readStrongBinder();
2239 Bundle args = data.readBundle();
2240 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002241 reply.writeNoException();
2242 reply.writeInt(res ? 1 : 0);
2243 return true;
2244 }
2245
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002246 case KILL_UID_TRANSACTION: {
2247 data.enforceInterface(IActivityManager.descriptor);
2248 int uid = data.readInt();
2249 String reason = data.readString();
2250 killUid(uid, reason);
2251 reply.writeNoException();
2252 return true;
2253 }
2254
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002255 case HANG_TRANSACTION: {
2256 data.enforceInterface(IActivityManager.descriptor);
2257 IBinder who = data.readStrongBinder();
2258 boolean allowRestart = data.readInt() != 0;
2259 hang(who, allowRestart);
2260 reply.writeNoException();
2261 return true;
2262 }
2263
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002264 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2265 data.enforceInterface(IActivityManager.descriptor);
2266 IBinder token = data.readStrongBinder();
2267 reportActivityFullyDrawn(token);
2268 reply.writeNoException();
2269 return true;
2270 }
2271
Craig Mautner5eda9b32013-07-02 11:58:16 -07002272 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2273 data.enforceInterface(IActivityManager.descriptor);
2274 IBinder token = data.readStrongBinder();
2275 notifyActivityDrawn(token);
2276 reply.writeNoException();
2277 return true;
2278 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002279
2280 case RESTART_TRANSACTION: {
2281 data.enforceInterface(IActivityManager.descriptor);
2282 restart();
2283 reply.writeNoException();
2284 return true;
2285 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002286
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002287 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2288 data.enforceInterface(IActivityManager.descriptor);
2289 performIdleMaintenance();
2290 reply.writeNoException();
2291 return true;
2292 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002293
Todd Kennedyca4d8422015-01-15 15:19:22 -08002294 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002295 data.enforceInterface(IActivityManager.descriptor);
2296 IBinder parentActivityToken = data.readStrongBinder();
2297 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002298 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002299 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002300 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002301 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002302 if (activityContainer != null) {
2303 reply.writeInt(1);
2304 reply.writeStrongBinder(activityContainer.asBinder());
2305 } else {
2306 reply.writeInt(0);
2307 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002308 return true;
2309 }
2310
Craig Mautner95da1082014-02-24 17:54:35 -08002311 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2312 data.enforceInterface(IActivityManager.descriptor);
2313 IActivityContainer activityContainer =
2314 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2315 deleteActivityContainer(activityContainer);
2316 reply.writeNoException();
2317 return true;
2318 }
2319
Todd Kennedy4900bf92015-01-16 16:05:14 -08002320 case CREATE_STACK_ON_DISPLAY: {
2321 data.enforceInterface(IActivityManager.descriptor);
2322 int displayId = data.readInt();
2323 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2324 reply.writeNoException();
2325 if (activityContainer != null) {
2326 reply.writeInt(1);
2327 reply.writeStrongBinder(activityContainer.asBinder());
2328 } else {
2329 reply.writeInt(0);
2330 }
2331 return true;
2332 }
2333
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002334 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002335 data.enforceInterface(IActivityManager.descriptor);
2336 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002337 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002338 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002339 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002340 return true;
2341 }
2342
Craig Mautneraea74a52014-03-08 14:23:10 -08002343 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2344 data.enforceInterface(IActivityManager.descriptor);
2345 final int taskId = data.readInt();
2346 startLockTaskMode(taskId);
2347 reply.writeNoException();
2348 return true;
2349 }
2350
2351 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2352 data.enforceInterface(IActivityManager.descriptor);
2353 IBinder token = data.readStrongBinder();
2354 startLockTaskMode(token);
2355 reply.writeNoException();
2356 return true;
2357 }
2358
Craig Mautnerd61dc202014-07-07 11:09:11 -07002359 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002360 data.enforceInterface(IActivityManager.descriptor);
2361 startLockTaskModeOnCurrent();
2362 reply.writeNoException();
2363 return true;
2364 }
2365
Craig Mautneraea74a52014-03-08 14:23:10 -08002366 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2367 data.enforceInterface(IActivityManager.descriptor);
2368 stopLockTaskMode();
2369 reply.writeNoException();
2370 return true;
2371 }
2372
Craig Mautnerd61dc202014-07-07 11:09:11 -07002373 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002374 data.enforceInterface(IActivityManager.descriptor);
2375 stopLockTaskModeOnCurrent();
2376 reply.writeNoException();
2377 return true;
2378 }
2379
Craig Mautneraea74a52014-03-08 14:23:10 -08002380 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2381 data.enforceInterface(IActivityManager.descriptor);
2382 final boolean isInLockTaskMode = isInLockTaskMode();
2383 reply.writeNoException();
2384 reply.writeInt(isInLockTaskMode ? 1 : 0);
2385 return true;
2386 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002387
Benjamin Franz43261142015-02-11 15:59:44 +00002388 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2389 data.enforceInterface(IActivityManager.descriptor);
2390 final int lockTaskModeState = getLockTaskModeState();
2391 reply.writeNoException();
2392 reply.writeInt(lockTaskModeState);
2393 return true;
2394 }
2395
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002396 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2397 data.enforceInterface(IActivityManager.descriptor);
2398 final IBinder token = data.readStrongBinder();
2399 showLockTaskEscapeMessage(token);
2400 reply.writeNoException();
2401 return true;
2402 }
2403
Winson Chunga449dc02014-05-16 11:15:04 -07002404 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002405 data.enforceInterface(IActivityManager.descriptor);
2406 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002407 ActivityManager.TaskDescription values =
2408 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2409 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002410 reply.writeNoException();
2411 return true;
2412 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002413
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002414 case SET_TASK_RESIZEABLE_TRANSACTION: {
2415 data.enforceInterface(IActivityManager.descriptor);
2416 int taskId = data.readInt();
2417 boolean resizeable = (data.readInt() == 1) ? true : false;
2418 setTaskResizeable(taskId, resizeable);
2419 reply.writeNoException();
2420 return true;
2421 }
2422
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002423 case RESIZE_TASK_TRANSACTION: {
2424 data.enforceInterface(IActivityManager.descriptor);
2425 int taskId = data.readInt();
2426 Rect r = Rect.CREATOR.createFromParcel(data);
2427 resizeTask(taskId, r);
2428 reply.writeNoException();
2429 return true;
2430 }
2431
Craig Mautner648f69b2014-09-18 14:16:26 -07002432 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2433 data.enforceInterface(IActivityManager.descriptor);
2434 String filename = data.readString();
2435 Bitmap icon = getTaskDescriptionIcon(filename);
2436 reply.writeNoException();
2437 if (icon == null) {
2438 reply.writeInt(0);
2439 } else {
2440 reply.writeInt(1);
2441 icon.writeToParcel(reply, 0);
2442 }
2443 return true;
2444 }
2445
Winson Chung044d5292014-11-06 11:05:19 -08002446 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2447 data.enforceInterface(IActivityManager.descriptor);
2448 final Bundle bundle;
2449 if (data.readInt() == 0) {
2450 bundle = null;
2451 } else {
2452 bundle = data.readBundle();
2453 }
2454 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2455 startInPlaceAnimationOnFrontMostApplication(options);
2456 reply.writeNoException();
2457 return true;
2458 }
2459
Jose Lima4b6c6692014-08-12 17:41:12 -07002460 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002461 data.enforceInterface(IActivityManager.descriptor);
2462 IBinder token = data.readStrongBinder();
2463 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002464 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002465 reply.writeNoException();
2466 reply.writeInt(success ? 1 : 0);
2467 return true;
2468 }
2469
Jose Lima4b6c6692014-08-12 17:41:12 -07002470 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002471 data.enforceInterface(IActivityManager.descriptor);
2472 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002473 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002474 reply.writeNoException();
2475 reply.writeInt(enabled ? 1 : 0);
2476 return true;
2477 }
2478
Jose Lima4b6c6692014-08-12 17:41:12 -07002479 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002480 data.enforceInterface(IActivityManager.descriptor);
2481 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002482 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002483 reply.writeNoException();
2484 return true;
2485 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002486
2487 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2488 data.enforceInterface(IActivityManager.descriptor);
2489 IBinder token = data.readStrongBinder();
2490 notifyLaunchTaskBehindComplete(token);
2491 reply.writeNoException();
2492 return true;
2493 }
Craig Mautner8746a472014-07-24 15:12:54 -07002494
2495 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2496 data.enforceInterface(IActivityManager.descriptor);
2497 IBinder token = data.readStrongBinder();
2498 notifyEnterAnimationComplete(token);
2499 reply.writeNoException();
2500 return true;
2501 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002502
2503 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2504 data.enforceInterface(IActivityManager.descriptor);
2505 bootAnimationComplete();
2506 reply.writeNoException();
2507 return true;
2508 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002509
Jeff Sharkey605eb792014-11-04 13:34:06 -08002510 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2511 data.enforceInterface(IActivityManager.descriptor);
2512 final int uid = data.readInt();
2513 final byte[] firstPacket = data.createByteArray();
2514 notifyCleartextNetwork(uid, firstPacket);
2515 reply.writeNoException();
2516 return true;
2517 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002518
2519 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2520 data.enforceInterface(IActivityManager.descriptor);
2521 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002522 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002523 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002524 String reportPackage = data.readString();
2525 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002526 reply.writeNoException();
2527 return true;
2528 }
2529
2530 case DUMP_HEAP_FINISHED_TRANSACTION: {
2531 data.enforceInterface(IActivityManager.descriptor);
2532 String path = data.readString();
2533 dumpHeapFinished(path);
2534 reply.writeNoException();
2535 return true;
2536 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002537
2538 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2539 data.enforceInterface(IActivityManager.descriptor);
2540 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2541 data.readStrongBinder());
2542 boolean keepAwake = data.readInt() != 0;
2543 setVoiceKeepAwake(session, keepAwake);
2544 reply.writeNoException();
2545 return true;
2546 }
Craig Mautnere5600772015-04-03 21:36:37 -07002547
2548 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2549 data.enforceInterface(IActivityManager.descriptor);
2550 int userId = data.readInt();
2551 String[] packages = data.readStringArray();
2552 updateLockTaskPackages(userId, packages);
2553 reply.writeNoException();
2554 return true;
2555 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002556
Craig Mautner015c5e52015-04-23 10:39:39 -07002557 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2558 data.enforceInterface(IActivityManager.descriptor);
2559 String packageName = data.readString();
2560 updateDeviceOwner(packageName);
2561 reply.writeNoException();
2562 return true;
2563 }
2564
Dianne Hackborn1e383822015-04-10 14:02:33 -07002565 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2566 data.enforceInterface(IActivityManager.descriptor);
2567 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002568 String callingPackage = data.readString();
2569 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002570 reply.writeNoException();
2571 reply.writeInt(res);
2572 return true;
2573 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002574
2575 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2576 data.enforceInterface(IActivityManager.descriptor);
2577 String process = data.readString();
2578 int userId = data.readInt();
2579 int level = data.readInt();
2580 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2581 reply.writeNoException();
2582 reply.writeInt(res ? 1 : 0);
2583 return true;
2584 }
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002585
2586 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2587 data.enforceInterface(IActivityManager.descriptor);
2588 IBinder token = data.readStrongBinder();
2589 boolean res = isRootVoiceInteraction(token);
2590 reply.writeNoException();
2591 reply.writeInt(res ? 1 : 0);
2592 return true;
2593 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002594 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002595
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002596 return super.onTransact(code, data, reply, flags);
2597 }
2598
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002599 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002600 return this;
2601 }
2602
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002603 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2604 protected IActivityManager create() {
2605 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002606 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002607 Log.v("ActivityManager", "default service binder = " + b);
2608 }
2609 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002610 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002611 Log.v("ActivityManager", "default service = " + am);
2612 }
2613 return am;
2614 }
2615 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616}
2617
2618class ActivityManagerProxy implements IActivityManager
2619{
2620 public ActivityManagerProxy(IBinder remote)
2621 {
2622 mRemote = remote;
2623 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002624
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002625 public IBinder asBinder()
2626 {
2627 return mRemote;
2628 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002629
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002630 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002631 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002632 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002633 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);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002638 intent.writeToParcel(data, 0);
2639 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 data.writeStrongBinder(resultTo);
2641 data.writeString(resultWho);
2642 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002643 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002644 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002645 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002646 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002647 } else {
2648 data.writeInt(0);
2649 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002650 if (options != null) {
2651 data.writeInt(1);
2652 options.writeToParcel(data, 0);
2653 } else {
2654 data.writeInt(0);
2655 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2657 reply.readException();
2658 int result = reply.readInt();
2659 reply.recycle();
2660 data.recycle();
2661 return result;
2662 }
Amith Yamasani82644082012-08-03 13:09:11 -07002663
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002664 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002665 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002666 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2667 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002668 Parcel data = Parcel.obtain();
2669 Parcel reply = Parcel.obtain();
2670 data.writeInterfaceToken(IActivityManager.descriptor);
2671 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002672 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002673 intent.writeToParcel(data, 0);
2674 data.writeString(resolvedType);
2675 data.writeStrongBinder(resultTo);
2676 data.writeString(resultWho);
2677 data.writeInt(requestCode);
2678 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002679 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002680 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002681 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002682 } else {
2683 data.writeInt(0);
2684 }
2685 if (options != null) {
2686 data.writeInt(1);
2687 options.writeToParcel(data, 0);
2688 } else {
2689 data.writeInt(0);
2690 }
2691 data.writeInt(userId);
2692 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2693 reply.readException();
2694 int result = reply.readInt();
2695 reply.recycle();
2696 data.recycle();
2697 return result;
2698 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002699 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2700 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002701 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2702 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002703 Parcel data = Parcel.obtain();
2704 Parcel reply = Parcel.obtain();
2705 data.writeInterfaceToken(IActivityManager.descriptor);
2706 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2707 data.writeString(callingPackage);
2708 intent.writeToParcel(data, 0);
2709 data.writeString(resolvedType);
2710 data.writeStrongBinder(resultTo);
2711 data.writeString(resultWho);
2712 data.writeInt(requestCode);
2713 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002714 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002715 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002716 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002717 } else {
2718 data.writeInt(0);
2719 }
2720 if (options != null) {
2721 data.writeInt(1);
2722 options.writeToParcel(data, 0);
2723 } else {
2724 data.writeInt(0);
2725 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002726 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002727 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002728 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2729 reply.readException();
2730 int result = reply.readInt();
2731 reply.recycle();
2732 data.recycle();
2733 return result;
2734 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002735 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2736 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002737 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2738 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002739 Parcel data = Parcel.obtain();
2740 Parcel reply = Parcel.obtain();
2741 data.writeInterfaceToken(IActivityManager.descriptor);
2742 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002743 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002744 intent.writeToParcel(data, 0);
2745 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002746 data.writeStrongBinder(resultTo);
2747 data.writeString(resultWho);
2748 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002749 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002750 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002751 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002752 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002753 } else {
2754 data.writeInt(0);
2755 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002756 if (options != null) {
2757 data.writeInt(1);
2758 options.writeToParcel(data, 0);
2759 } else {
2760 data.writeInt(0);
2761 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002762 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002763 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2764 reply.readException();
2765 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2766 reply.recycle();
2767 data.recycle();
2768 return result;
2769 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002770 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2771 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002772 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002773 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002774 Parcel data = Parcel.obtain();
2775 Parcel reply = Parcel.obtain();
2776 data.writeInterfaceToken(IActivityManager.descriptor);
2777 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002778 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002779 intent.writeToParcel(data, 0);
2780 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002781 data.writeStrongBinder(resultTo);
2782 data.writeString(resultWho);
2783 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002784 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002785 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002786 if (options != null) {
2787 data.writeInt(1);
2788 options.writeToParcel(data, 0);
2789 } else {
2790 data.writeInt(0);
2791 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002792 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002793 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2794 reply.readException();
2795 int result = reply.readInt();
2796 reply.recycle();
2797 data.recycle();
2798 return result;
2799 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002800 public int startActivityIntentSender(IApplicationThread caller,
2801 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002802 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002803 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002804 Parcel data = Parcel.obtain();
2805 Parcel reply = Parcel.obtain();
2806 data.writeInterfaceToken(IActivityManager.descriptor);
2807 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2808 intent.writeToParcel(data, 0);
2809 if (fillInIntent != null) {
2810 data.writeInt(1);
2811 fillInIntent.writeToParcel(data, 0);
2812 } else {
2813 data.writeInt(0);
2814 }
2815 data.writeString(resolvedType);
2816 data.writeStrongBinder(resultTo);
2817 data.writeString(resultWho);
2818 data.writeInt(requestCode);
2819 data.writeInt(flagsMask);
2820 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002821 if (options != null) {
2822 data.writeInt(1);
2823 options.writeToParcel(data, 0);
2824 } else {
2825 data.writeInt(0);
2826 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002827 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002828 reply.readException();
2829 int result = reply.readInt();
2830 reply.recycle();
2831 data.recycle();
2832 return result;
2833 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002834 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2835 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002836 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2837 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002838 Parcel data = Parcel.obtain();
2839 Parcel reply = Parcel.obtain();
2840 data.writeInterfaceToken(IActivityManager.descriptor);
2841 data.writeString(callingPackage);
2842 data.writeInt(callingPid);
2843 data.writeInt(callingUid);
2844 intent.writeToParcel(data, 0);
2845 data.writeString(resolvedType);
2846 data.writeStrongBinder(session.asBinder());
2847 data.writeStrongBinder(interactor.asBinder());
2848 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002849 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002850 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002851 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002852 } else {
2853 data.writeInt(0);
2854 }
2855 if (options != null) {
2856 data.writeInt(1);
2857 options.writeToParcel(data, 0);
2858 } else {
2859 data.writeInt(0);
2860 }
2861 data.writeInt(userId);
2862 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2863 reply.readException();
2864 int result = reply.readInt();
2865 reply.recycle();
2866 data.recycle();
2867 return result;
2868 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002870 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeStrongBinder(callingActivity);
2875 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002876 if (options != null) {
2877 data.writeInt(1);
2878 options.writeToParcel(data, 0);
2879 } else {
2880 data.writeInt(0);
2881 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002882 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2883 reply.readException();
2884 int result = reply.readInt();
2885 reply.recycle();
2886 data.recycle();
2887 return result != 0;
2888 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002889 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2890 Parcel data = Parcel.obtain();
2891 Parcel reply = Parcel.obtain();
2892 data.writeInterfaceToken(IActivityManager.descriptor);
2893 data.writeInt(taskId);
2894 if (options == null) {
2895 data.writeInt(0);
2896 } else {
2897 data.writeInt(1);
2898 options.writeToParcel(data, 0);
2899 }
2900 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 int result = reply.readInt();
2903 reply.recycle();
2904 data.recycle();
2905 return result;
2906 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002907 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002908 throws RemoteException {
2909 Parcel data = Parcel.obtain();
2910 Parcel reply = Parcel.obtain();
2911 data.writeInterfaceToken(IActivityManager.descriptor);
2912 data.writeStrongBinder(token);
2913 data.writeInt(resultCode);
2914 if (resultData != null) {
2915 data.writeInt(1);
2916 resultData.writeToParcel(data, 0);
2917 } else {
2918 data.writeInt(0);
2919 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002920 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002921 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2922 reply.readException();
2923 boolean res = reply.readInt() != 0;
2924 data.recycle();
2925 reply.recycle();
2926 return res;
2927 }
2928 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2929 {
2930 Parcel data = Parcel.obtain();
2931 Parcel reply = Parcel.obtain();
2932 data.writeInterfaceToken(IActivityManager.descriptor);
2933 data.writeStrongBinder(token);
2934 data.writeString(resultWho);
2935 data.writeInt(requestCode);
2936 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2937 reply.readException();
2938 data.recycle();
2939 reply.recycle();
2940 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002941 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2942 Parcel data = Parcel.obtain();
2943 Parcel reply = Parcel.obtain();
2944 data.writeInterfaceToken(IActivityManager.descriptor);
2945 data.writeStrongBinder(token);
2946 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 boolean res = reply.readInt() != 0;
2949 data.recycle();
2950 reply.recycle();
2951 return res;
2952 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002953 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeStrongBinder(session.asBinder());
2958 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2959 reply.readException();
2960 data.recycle();
2961 reply.recycle();
2962 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002963 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2964 Parcel data = Parcel.obtain();
2965 Parcel reply = Parcel.obtain();
2966 data.writeInterfaceToken(IActivityManager.descriptor);
2967 data.writeStrongBinder(token);
2968 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2969 reply.readException();
2970 boolean res = reply.readInt() != 0;
2971 data.recycle();
2972 reply.recycle();
2973 return res;
2974 }
2975 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2976 Parcel data = Parcel.obtain();
2977 Parcel reply = Parcel.obtain();
2978 data.writeInterfaceToken(IActivityManager.descriptor);
2979 data.writeStrongBinder(app.asBinder());
2980 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 data.recycle();
2983 reply.recycle();
2984 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002985 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2986 Parcel data = Parcel.obtain();
2987 Parcel reply = Parcel.obtain();
2988 data.writeInterfaceToken(IActivityManager.descriptor);
2989 data.writeStrongBinder(token);
2990 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2991 reply.readException();
2992 boolean res = reply.readInt() != 0;
2993 data.recycle();
2994 reply.recycle();
2995 return res;
2996 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002997 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002998 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002999 IntentFilter filter, String perm, 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);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003005 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3007 filter.writeToParcel(data, 0);
3008 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003009 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003010 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3011 reply.readException();
3012 Intent intent = null;
3013 int haveIntent = reply.readInt();
3014 if (haveIntent != 0) {
3015 intent = Intent.CREATOR.createFromParcel(reply);
3016 }
3017 reply.recycle();
3018 data.recycle();
3019 return intent;
3020 }
3021 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3022 {
3023 Parcel data = Parcel.obtain();
3024 Parcel reply = Parcel.obtain();
3025 data.writeInterfaceToken(IActivityManager.descriptor);
3026 data.writeStrongBinder(receiver.asBinder());
3027 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 data.recycle();
3030 reply.recycle();
3031 }
3032 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003033 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003034 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003035 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003036 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003037 {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3042 intent.writeToParcel(data, 0);
3043 data.writeString(resolvedType);
3044 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3045 data.writeInt(resultCode);
3046 data.writeString(resultData);
3047 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003048 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003049 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003050 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003051 data.writeInt(serialized ? 1 : 0);
3052 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003053 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003054 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3055 reply.readException();
3056 int res = reply.readInt();
3057 reply.recycle();
3058 data.recycle();
3059 return res;
3060 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003061 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3062 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003063 {
3064 Parcel data = Parcel.obtain();
3065 Parcel reply = Parcel.obtain();
3066 data.writeInterfaceToken(IActivityManager.descriptor);
3067 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3068 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003069 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003070 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 data.recycle();
3073 reply.recycle();
3074 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003075 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3076 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003077 {
3078 Parcel data = Parcel.obtain();
3079 Parcel reply = Parcel.obtain();
3080 data.writeInterfaceToken(IActivityManager.descriptor);
3081 data.writeStrongBinder(who);
3082 data.writeInt(resultCode);
3083 data.writeString(resultData);
3084 data.writeBundle(map);
3085 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003086 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003087 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3088 reply.readException();
3089 data.recycle();
3090 reply.recycle();
3091 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003092 public void attachApplication(IApplicationThread app) throws RemoteException
3093 {
3094 Parcel data = Parcel.obtain();
3095 Parcel reply = Parcel.obtain();
3096 data.writeInterfaceToken(IActivityManager.descriptor);
3097 data.writeStrongBinder(app.asBinder());
3098 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3099 reply.readException();
3100 data.recycle();
3101 reply.recycle();
3102 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003103 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3104 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003105 {
3106 Parcel data = Parcel.obtain();
3107 Parcel reply = Parcel.obtain();
3108 data.writeInterfaceToken(IActivityManager.descriptor);
3109 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003110 if (config != null) {
3111 data.writeInt(1);
3112 config.writeToParcel(data, 0);
3113 } else {
3114 data.writeInt(0);
3115 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003116 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003117 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3118 reply.readException();
3119 data.recycle();
3120 reply.recycle();
3121 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003122 public void activityResumed(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_RESUMED_TRANSACTION, data, reply, 0);
3129 reply.readException();
3130 data.recycle();
3131 reply.recycle();
3132 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003133 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003134 {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeStrongBinder(token);
3139 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3140 reply.readException();
3141 data.recycle();
3142 reply.recycle();
3143 }
3144 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003145 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003146 {
3147 Parcel data = Parcel.obtain();
3148 Parcel reply = Parcel.obtain();
3149 data.writeInterfaceToken(IActivityManager.descriptor);
3150 data.writeStrongBinder(token);
3151 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003152 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003153 TextUtils.writeToParcel(description, data, 0);
3154 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3155 reply.readException();
3156 data.recycle();
3157 reply.recycle();
3158 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003159 public void activitySlept(IBinder token) throws RemoteException
3160 {
3161 Parcel data = Parcel.obtain();
3162 Parcel reply = Parcel.obtain();
3163 data.writeInterfaceToken(IActivityManager.descriptor);
3164 data.writeStrongBinder(token);
3165 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3166 reply.readException();
3167 data.recycle();
3168 reply.recycle();
3169 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003170 public void activityDestroyed(IBinder token) throws RemoteException
3171 {
3172 Parcel data = Parcel.obtain();
3173 Parcel reply = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 data.writeStrongBinder(token);
3176 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3177 reply.readException();
3178 data.recycle();
3179 reply.recycle();
3180 }
3181 public String getCallingPackage(IBinder token) throws RemoteException
3182 {
3183 Parcel data = Parcel.obtain();
3184 Parcel reply = Parcel.obtain();
3185 data.writeInterfaceToken(IActivityManager.descriptor);
3186 data.writeStrongBinder(token);
3187 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3188 reply.readException();
3189 String res = reply.readString();
3190 data.recycle();
3191 reply.recycle();
3192 return res;
3193 }
3194 public ComponentName getCallingActivity(IBinder token)
3195 throws RemoteException {
3196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 data.writeStrongBinder(token);
3200 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3201 reply.readException();
3202 ComponentName res = ComponentName.readFromParcel(reply);
3203 data.recycle();
3204 reply.recycle();
3205 return res;
3206 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003207 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003211 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003212 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3213 reply.readException();
3214 ArrayList<IAppTask> list = null;
3215 int N = reply.readInt();
3216 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003217 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003218 while (N > 0) {
3219 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3220 list.add(task);
3221 N--;
3222 }
3223 }
3224 data.recycle();
3225 reply.recycle();
3226 return list;
3227 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003228 public int addAppTask(IBinder activityToken, Intent intent,
3229 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(activityToken);
3234 intent.writeToParcel(data, 0);
3235 description.writeToParcel(data, 0);
3236 thumbnail.writeToParcel(data, 0);
3237 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3238 reply.readException();
3239 int res = reply.readInt();
3240 data.recycle();
3241 reply.recycle();
3242 return res;
3243 }
3244 public Point getAppTaskThumbnailSize() throws RemoteException {
3245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3249 reply.readException();
3250 Point size = Point.CREATOR.createFromParcel(reply);
3251 data.recycle();
3252 reply.recycle();
3253 return size;
3254 }
Todd Kennedye635f662015-01-20 10:36:49 -08003255 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3256 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003257 Parcel data = Parcel.obtain();
3258 Parcel reply = Parcel.obtain();
3259 data.writeInterfaceToken(IActivityManager.descriptor);
3260 data.writeInt(maxNum);
3261 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3263 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003264 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003265 int N = reply.readInt();
3266 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003267 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003268 while (N > 0) {
3269 ActivityManager.RunningTaskInfo info =
3270 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003271 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003272 list.add(info);
3273 N--;
3274 }
3275 }
3276 data.recycle();
3277 reply.recycle();
3278 return list;
3279 }
3280 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003281 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 Parcel data = Parcel.obtain();
3283 Parcel reply = Parcel.obtain();
3284 data.writeInterfaceToken(IActivityManager.descriptor);
3285 data.writeInt(maxNum);
3286 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003287 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003288 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3289 reply.readException();
3290 ArrayList<ActivityManager.RecentTaskInfo> list
3291 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3292 data.recycle();
3293 reply.recycle();
3294 return list;
3295 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003296 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003297 Parcel data = Parcel.obtain();
3298 Parcel reply = Parcel.obtain();
3299 data.writeInterfaceToken(IActivityManager.descriptor);
3300 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003301 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003302 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003303 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003304 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003305 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003306 }
3307 data.recycle();
3308 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003309 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003310 }
Todd Kennedye635f662015-01-20 10:36:49 -08003311 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3312 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003313 Parcel data = Parcel.obtain();
3314 Parcel reply = Parcel.obtain();
3315 data.writeInterfaceToken(IActivityManager.descriptor);
3316 data.writeInt(maxNum);
3317 data.writeInt(flags);
3318 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3319 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003320 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003321 int N = reply.readInt();
3322 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003323 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003324 while (N > 0) {
3325 ActivityManager.RunningServiceInfo info =
3326 ActivityManager.RunningServiceInfo.CREATOR
3327 .createFromParcel(reply);
3328 list.add(info);
3329 N--;
3330 }
3331 }
3332 data.recycle();
3333 reply.recycle();
3334 return list;
3335 }
3336 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3337 throws RemoteException {
3338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3344 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3345 data.recycle();
3346 reply.recycle();
3347 return list;
3348 }
3349 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3350 throws RemoteException {
3351 Parcel data = Parcel.obtain();
3352 Parcel reply = Parcel.obtain();
3353 data.writeInterfaceToken(IActivityManager.descriptor);
3354 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3355 reply.readException();
3356 ArrayList<ActivityManager.RunningAppProcessInfo> list
3357 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3358 data.recycle();
3359 reply.recycle();
3360 return list;
3361 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003362 public List<ApplicationInfo> getRunningExternalApplications()
3363 throws RemoteException {
3364 Parcel data = Parcel.obtain();
3365 Parcel reply = Parcel.obtain();
3366 data.writeInterfaceToken(IActivityManager.descriptor);
3367 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3368 reply.readException();
3369 ArrayList<ApplicationInfo> list
3370 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3371 data.recycle();
3372 reply.recycle();
3373 return list;
3374 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003375 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003376 {
3377 Parcel data = Parcel.obtain();
3378 Parcel reply = Parcel.obtain();
3379 data.writeInterfaceToken(IActivityManager.descriptor);
3380 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003381 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003382 if (options != null) {
3383 data.writeInt(1);
3384 options.writeToParcel(data, 0);
3385 } else {
3386 data.writeInt(0);
3387 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003388 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3389 reply.readException();
3390 data.recycle();
3391 reply.recycle();
3392 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003393 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3394 throws RemoteException {
3395 Parcel data = Parcel.obtain();
3396 Parcel reply = Parcel.obtain();
3397 data.writeInterfaceToken(IActivityManager.descriptor);
3398 data.writeStrongBinder(token);
3399 data.writeInt(nonRoot ? 1 : 0);
3400 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3401 reply.readException();
3402 boolean res = reply.readInt() != 0;
3403 data.recycle();
3404 reply.recycle();
3405 return res;
3406 }
3407 public void moveTaskBackwards(int task) throws RemoteException
3408 {
3409 Parcel data = Parcel.obtain();
3410 Parcel reply = Parcel.obtain();
3411 data.writeInterfaceToken(IActivityManager.descriptor);
3412 data.writeInt(task);
3413 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3414 reply.readException();
3415 data.recycle();
3416 reply.recycle();
3417 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003418 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003419 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3420 {
3421 Parcel data = Parcel.obtain();
3422 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003423 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003424 data.writeInt(taskId);
3425 data.writeInt(stackId);
3426 data.writeInt(toTop ? 1 : 0);
3427 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 data.recycle();
3430 reply.recycle();
3431 }
3432 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003433 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003434 {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003437 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003438 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003439 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003440 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003441 reply.readException();
3442 data.recycle();
3443 reply.recycle();
3444 }
Craig Mautner967212c2013-04-13 21:10:58 -07003445 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003446 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003447 {
3448 Parcel data = Parcel.obtain();
3449 Parcel reply = Parcel.obtain();
3450 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003451 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003452 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003453 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003454 data.recycle();
3455 reply.recycle();
3456 return list;
3457 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003458 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003459 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003460 {
3461 Parcel data = Parcel.obtain();
3462 Parcel reply = Parcel.obtain();
3463 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003464 data.writeInt(stackId);
3465 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003466 reply.readException();
3467 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003468 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003469 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003470 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003471 }
3472 data.recycle();
3473 reply.recycle();
3474 return info;
3475 }
3476 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003477 public boolean isInHomeStack(int taskId) throws RemoteException {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeInt(taskId);
3482 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3483 reply.readException();
3484 boolean isInHomeStack = reply.readInt() > 0;
3485 data.recycle();
3486 reply.recycle();
3487 return isInHomeStack;
3488 }
3489 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003490 public void setFocusedStack(int stackId) throws RemoteException
3491 {
3492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003496 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003497 reply.readException();
3498 data.recycle();
3499 reply.recycle();
3500 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003501 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003502 public int getFocusedStackId() throws RemoteException {
3503 Parcel data = Parcel.obtain();
3504 Parcel reply = Parcel.obtain();
3505 data.writeInterfaceToken(IActivityManager.descriptor);
3506 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 int focusedStackId = reply.readInt();
3509 data.recycle();
3510 reply.recycle();
3511 return focusedStackId;
3512 }
3513 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003514 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3515 {
3516 Parcel data = Parcel.obtain();
3517 Parcel reply = Parcel.obtain();
3518 data.writeInterfaceToken(IActivityManager.descriptor);
3519 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003520 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003521 reply.readException();
3522 data.recycle();
3523 reply.recycle();
3524 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003525 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3526 {
3527 Parcel data = Parcel.obtain();
3528 Parcel reply = Parcel.obtain();
3529 data.writeInterfaceToken(IActivityManager.descriptor);
3530 data.writeStrongBinder(token);
3531 data.writeInt(onlyRoot ? 1 : 0);
3532 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3533 reply.readException();
3534 int res = reply.readInt();
3535 data.recycle();
3536 reply.recycle();
3537 return res;
3538 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003539 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003540 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003541 Parcel data = Parcel.obtain();
3542 Parcel reply = Parcel.obtain();
3543 data.writeInterfaceToken(IActivityManager.descriptor);
3544 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3545 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003546 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003547 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003548 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3549 reply.readException();
3550 int res = reply.readInt();
3551 ContentProviderHolder cph = null;
3552 if (res != 0) {
3553 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3554 }
3555 data.recycle();
3556 reply.recycle();
3557 return cph;
3558 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003559 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3560 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003565 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003566 data.writeStrongBinder(token);
3567 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 int res = reply.readInt();
3570 ContentProviderHolder cph = null;
3571 if (res != 0) {
3572 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3573 }
3574 data.recycle();
3575 reply.recycle();
3576 return cph;
3577 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003578 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003579 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003580 {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3585 data.writeTypedList(providers);
3586 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3587 reply.readException();
3588 data.recycle();
3589 reply.recycle();
3590 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003591 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3592 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003593 Parcel data = Parcel.obtain();
3594 Parcel reply = Parcel.obtain();
3595 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003596 data.writeStrongBinder(connection);
3597 data.writeInt(stable);
3598 data.writeInt(unstable);
3599 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 boolean res = reply.readInt() != 0;
3602 data.recycle();
3603 reply.recycle();
3604 return res;
3605 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003606
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003607 public void unstableProviderDied(IBinder connection) throws RemoteException {
3608 Parcel data = Parcel.obtain();
3609 Parcel reply = Parcel.obtain();
3610 data.writeInterfaceToken(IActivityManager.descriptor);
3611 data.writeStrongBinder(connection);
3612 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3613 reply.readException();
3614 data.recycle();
3615 reply.recycle();
3616 }
3617
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003618 @Override
3619 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 data.writeStrongBinder(connection);
3624 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3625 reply.readException();
3626 data.recycle();
3627 reply.recycle();
3628 }
3629
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003630 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeStrongBinder(connection);
3635 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003636 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3637 reply.readException();
3638 data.recycle();
3639 reply.recycle();
3640 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003641
3642 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 data.writeString(name);
3647 data.writeStrongBinder(token);
3648 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3649 reply.readException();
3650 data.recycle();
3651 reply.recycle();
3652 }
3653
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003654 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3655 throws RemoteException
3656 {
3657 Parcel data = Parcel.obtain();
3658 Parcel reply = Parcel.obtain();
3659 data.writeInterfaceToken(IActivityManager.descriptor);
3660 service.writeToParcel(data, 0);
3661 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3662 reply.readException();
3663 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3664 data.recycle();
3665 reply.recycle();
3666 return res;
3667 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003668
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003669 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003670 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003671 {
3672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3676 service.writeToParcel(data, 0);
3677 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003678 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003679 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003680 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3681 reply.readException();
3682 ComponentName res = ComponentName.readFromParcel(reply);
3683 data.recycle();
3684 reply.recycle();
3685 return res;
3686 }
3687 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003688 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003689 {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3694 service.writeToParcel(data, 0);
3695 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003696 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003697 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3698 reply.readException();
3699 int res = reply.readInt();
3700 reply.recycle();
3701 data.recycle();
3702 return res;
3703 }
3704 public boolean stopServiceToken(ComponentName className, IBinder token,
3705 int startId) throws RemoteException {
3706 Parcel data = Parcel.obtain();
3707 Parcel reply = Parcel.obtain();
3708 data.writeInterfaceToken(IActivityManager.descriptor);
3709 ComponentName.writeToParcel(className, data);
3710 data.writeStrongBinder(token);
3711 data.writeInt(startId);
3712 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3713 reply.readException();
3714 boolean res = reply.readInt() != 0;
3715 data.recycle();
3716 reply.recycle();
3717 return res;
3718 }
3719 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003720 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003721 Parcel data = Parcel.obtain();
3722 Parcel reply = Parcel.obtain();
3723 data.writeInterfaceToken(IActivityManager.descriptor);
3724 ComponentName.writeToParcel(className, data);
3725 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003726 data.writeInt(id);
3727 if (notification != null) {
3728 data.writeInt(1);
3729 notification.writeToParcel(data, 0);
3730 } else {
3731 data.writeInt(0);
3732 }
3733 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003734 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3735 reply.readException();
3736 data.recycle();
3737 reply.recycle();
3738 }
3739 public int bindService(IApplicationThread caller, IBinder token,
3740 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003741 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003742 Parcel data = Parcel.obtain();
3743 Parcel reply = Parcel.obtain();
3744 data.writeInterfaceToken(IActivityManager.descriptor);
3745 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3746 data.writeStrongBinder(token);
3747 service.writeToParcel(data, 0);
3748 data.writeString(resolvedType);
3749 data.writeStrongBinder(connection.asBinder());
3750 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003751 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003752 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003753 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3754 reply.readException();
3755 int res = reply.readInt();
3756 data.recycle();
3757 reply.recycle();
3758 return res;
3759 }
3760 public boolean unbindService(IServiceConnection connection) throws RemoteException
3761 {
3762 Parcel data = Parcel.obtain();
3763 Parcel reply = Parcel.obtain();
3764 data.writeInterfaceToken(IActivityManager.descriptor);
3765 data.writeStrongBinder(connection.asBinder());
3766 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3767 reply.readException();
3768 boolean res = reply.readInt() != 0;
3769 data.recycle();
3770 reply.recycle();
3771 return res;
3772 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003773
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003774 public void publishService(IBinder token,
3775 Intent intent, IBinder service) throws RemoteException {
3776 Parcel data = Parcel.obtain();
3777 Parcel reply = Parcel.obtain();
3778 data.writeInterfaceToken(IActivityManager.descriptor);
3779 data.writeStrongBinder(token);
3780 intent.writeToParcel(data, 0);
3781 data.writeStrongBinder(service);
3782 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3783 reply.readException();
3784 data.recycle();
3785 reply.recycle();
3786 }
3787
3788 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3789 throws RemoteException {
3790 Parcel data = Parcel.obtain();
3791 Parcel reply = Parcel.obtain();
3792 data.writeInterfaceToken(IActivityManager.descriptor);
3793 data.writeStrongBinder(token);
3794 intent.writeToParcel(data, 0);
3795 data.writeInt(doRebind ? 1 : 0);
3796 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3797 reply.readException();
3798 data.recycle();
3799 reply.recycle();
3800 }
3801
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003802 public void serviceDoneExecuting(IBinder token, int type, int startId,
3803 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003804 Parcel data = Parcel.obtain();
3805 Parcel reply = Parcel.obtain();
3806 data.writeInterfaceToken(IActivityManager.descriptor);
3807 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003808 data.writeInt(type);
3809 data.writeInt(startId);
3810 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003811 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3812 reply.readException();
3813 data.recycle();
3814 reply.recycle();
3815 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003816
Svet Ganov99b60432015-06-27 13:15:22 -07003817 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
3818 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003819 Parcel data = Parcel.obtain();
3820 Parcel reply = Parcel.obtain();
3821 data.writeInterfaceToken(IActivityManager.descriptor);
3822 service.writeToParcel(data, 0);
3823 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003824 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003825 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3826 reply.readException();
3827 IBinder binder = reply.readStrongBinder();
3828 reply.recycle();
3829 data.recycle();
3830 return binder;
3831 }
3832
Christopher Tate181fafa2009-05-14 11:12:14 -07003833 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3834 throws RemoteException {
3835 Parcel data = Parcel.obtain();
3836 Parcel reply = Parcel.obtain();
3837 data.writeInterfaceToken(IActivityManager.descriptor);
3838 app.writeToParcel(data, 0);
3839 data.writeInt(backupRestoreMode);
3840 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3841 reply.readException();
3842 boolean success = reply.readInt() != 0;
3843 reply.recycle();
3844 data.recycle();
3845 return success;
3846 }
3847
Christopher Tate346acb12012-10-15 19:20:25 -07003848 public void clearPendingBackup() throws RemoteException {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3853 reply.recycle();
3854 data.recycle();
3855 }
3856
Christopher Tate181fafa2009-05-14 11:12:14 -07003857 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3858 Parcel data = Parcel.obtain();
3859 Parcel reply = Parcel.obtain();
3860 data.writeInterfaceToken(IActivityManager.descriptor);
3861 data.writeString(packageName);
3862 data.writeStrongBinder(agent);
3863 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3864 reply.recycle();
3865 data.recycle();
3866 }
3867
3868 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3869 Parcel data = Parcel.obtain();
3870 Parcel reply = Parcel.obtain();
3871 data.writeInterfaceToken(IActivityManager.descriptor);
3872 app.writeToParcel(data, 0);
3873 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3874 reply.readException();
3875 reply.recycle();
3876 data.recycle();
3877 }
3878
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003879 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003880 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003881 IUiAutomationConnection connection, int userId, String instructionSet)
3882 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003883 Parcel data = Parcel.obtain();
3884 Parcel reply = Parcel.obtain();
3885 data.writeInterfaceToken(IActivityManager.descriptor);
3886 ComponentName.writeToParcel(className, data);
3887 data.writeString(profileFile);
3888 data.writeInt(flags);
3889 data.writeBundle(arguments);
3890 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003891 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003892 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003893 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003894 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3895 reply.readException();
3896 boolean res = reply.readInt() != 0;
3897 reply.recycle();
3898 data.recycle();
3899 return res;
3900 }
3901
3902 public void finishInstrumentation(IApplicationThread target,
3903 int resultCode, Bundle results) throws RemoteException {
3904 Parcel data = Parcel.obtain();
3905 Parcel reply = Parcel.obtain();
3906 data.writeInterfaceToken(IActivityManager.descriptor);
3907 data.writeStrongBinder(target != null ? target.asBinder() : null);
3908 data.writeInt(resultCode);
3909 data.writeBundle(results);
3910 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 data.recycle();
3913 reply.recycle();
3914 }
3915 public Configuration getConfiguration() throws RemoteException
3916 {
3917 Parcel data = Parcel.obtain();
3918 Parcel reply = Parcel.obtain();
3919 data.writeInterfaceToken(IActivityManager.descriptor);
3920 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3921 reply.readException();
3922 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3923 reply.recycle();
3924 data.recycle();
3925 return res;
3926 }
3927 public void updateConfiguration(Configuration values) throws RemoteException
3928 {
3929 Parcel data = Parcel.obtain();
3930 Parcel reply = Parcel.obtain();
3931 data.writeInterfaceToken(IActivityManager.descriptor);
3932 values.writeToParcel(data, 0);
3933 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3934 reply.readException();
3935 data.recycle();
3936 reply.recycle();
3937 }
3938 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3939 throws RemoteException {
3940 Parcel data = Parcel.obtain();
3941 Parcel reply = Parcel.obtain();
3942 data.writeInterfaceToken(IActivityManager.descriptor);
3943 data.writeStrongBinder(token);
3944 data.writeInt(requestedOrientation);
3945 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3946 reply.readException();
3947 data.recycle();
3948 reply.recycle();
3949 }
3950 public int getRequestedOrientation(IBinder token) throws RemoteException {
3951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 data.writeStrongBinder(token);
3955 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3956 reply.readException();
3957 int res = reply.readInt();
3958 data.recycle();
3959 reply.recycle();
3960 return res;
3961 }
3962 public ComponentName getActivityClassForToken(IBinder token)
3963 throws RemoteException {
3964 Parcel data = Parcel.obtain();
3965 Parcel reply = Parcel.obtain();
3966 data.writeInterfaceToken(IActivityManager.descriptor);
3967 data.writeStrongBinder(token);
3968 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3969 reply.readException();
3970 ComponentName res = ComponentName.readFromParcel(reply);
3971 data.recycle();
3972 reply.recycle();
3973 return res;
3974 }
3975 public String getPackageForToken(IBinder token) throws RemoteException
3976 {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 data.writeStrongBinder(token);
3981 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3982 reply.readException();
3983 String res = reply.readString();
3984 data.recycle();
3985 reply.recycle();
3986 return res;
3987 }
3988 public IIntentSender getIntentSender(int type,
3989 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003990 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003991 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
3995 data.writeInt(type);
3996 data.writeString(packageName);
3997 data.writeStrongBinder(token);
3998 data.writeString(resultWho);
3999 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004000 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004001 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004002 data.writeTypedArray(intents, 0);
4003 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004004 } else {
4005 data.writeInt(0);
4006 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004007 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004008 if (options != null) {
4009 data.writeInt(1);
4010 options.writeToParcel(data, 0);
4011 } else {
4012 data.writeInt(0);
4013 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004014 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004015 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4016 reply.readException();
4017 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004018 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004019 data.recycle();
4020 reply.recycle();
4021 return res;
4022 }
4023 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4024 Parcel data = Parcel.obtain();
4025 Parcel reply = Parcel.obtain();
4026 data.writeInterfaceToken(IActivityManager.descriptor);
4027 data.writeStrongBinder(sender.asBinder());
4028 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4029 reply.readException();
4030 data.recycle();
4031 reply.recycle();
4032 }
4033 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4034 Parcel data = Parcel.obtain();
4035 Parcel reply = Parcel.obtain();
4036 data.writeInterfaceToken(IActivityManager.descriptor);
4037 data.writeStrongBinder(sender.asBinder());
4038 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4039 reply.readException();
4040 String res = reply.readString();
4041 data.recycle();
4042 reply.recycle();
4043 return res;
4044 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004045 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4046 Parcel data = Parcel.obtain();
4047 Parcel reply = Parcel.obtain();
4048 data.writeInterfaceToken(IActivityManager.descriptor);
4049 data.writeStrongBinder(sender.asBinder());
4050 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4051 reply.readException();
4052 int res = reply.readInt();
4053 data.recycle();
4054 reply.recycle();
4055 return res;
4056 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004057 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4058 boolean requireFull, String name, String callerPackage) throws RemoteException {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 data.writeInt(callingPid);
4063 data.writeInt(callingUid);
4064 data.writeInt(userId);
4065 data.writeInt(allowAll ? 1 : 0);
4066 data.writeInt(requireFull ? 1 : 0);
4067 data.writeString(name);
4068 data.writeString(callerPackage);
4069 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4070 reply.readException();
4071 int res = reply.readInt();
4072 data.recycle();
4073 reply.recycle();
4074 return res;
4075 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004076 public void setProcessLimit(int max) throws RemoteException
4077 {
4078 Parcel data = Parcel.obtain();
4079 Parcel reply = Parcel.obtain();
4080 data.writeInterfaceToken(IActivityManager.descriptor);
4081 data.writeInt(max);
4082 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4083 reply.readException();
4084 data.recycle();
4085 reply.recycle();
4086 }
4087 public int getProcessLimit() throws RemoteException
4088 {
4089 Parcel data = Parcel.obtain();
4090 Parcel reply = Parcel.obtain();
4091 data.writeInterfaceToken(IActivityManager.descriptor);
4092 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4093 reply.readException();
4094 int res = reply.readInt();
4095 data.recycle();
4096 reply.recycle();
4097 return res;
4098 }
4099 public void setProcessForeground(IBinder token, int pid,
4100 boolean isForeground) throws RemoteException {
4101 Parcel data = Parcel.obtain();
4102 Parcel reply = Parcel.obtain();
4103 data.writeInterfaceToken(IActivityManager.descriptor);
4104 data.writeStrongBinder(token);
4105 data.writeInt(pid);
4106 data.writeInt(isForeground ? 1 : 0);
4107 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4108 reply.readException();
4109 data.recycle();
4110 reply.recycle();
4111 }
4112 public int checkPermission(String permission, int pid, int uid)
4113 throws RemoteException {
4114 Parcel data = Parcel.obtain();
4115 Parcel reply = Parcel.obtain();
4116 data.writeInterfaceToken(IActivityManager.descriptor);
4117 data.writeString(permission);
4118 data.writeInt(pid);
4119 data.writeInt(uid);
4120 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4121 reply.readException();
4122 int res = reply.readInt();
4123 data.recycle();
4124 reply.recycle();
4125 return res;
4126 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004127 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4128 throws RemoteException {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 data.writeString(permission);
4133 data.writeInt(pid);
4134 data.writeInt(uid);
4135 data.writeStrongBinder(callerToken);
4136 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4137 reply.readException();
4138 int res = reply.readInt();
4139 data.recycle();
4140 reply.recycle();
4141 return res;
4142 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004143 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004144 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004145 Parcel data = Parcel.obtain();
4146 Parcel reply = Parcel.obtain();
4147 data.writeInterfaceToken(IActivityManager.descriptor);
4148 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004149 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004150 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004151 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4152 reply.readException();
4153 boolean res = reply.readInt() != 0;
4154 data.recycle();
4155 reply.recycle();
4156 return res;
4157 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004158 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4159 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004160 Parcel data = Parcel.obtain();
4161 Parcel reply = Parcel.obtain();
4162 data.writeInterfaceToken(IActivityManager.descriptor);
4163 uri.writeToParcel(data, 0);
4164 data.writeInt(pid);
4165 data.writeInt(uid);
4166 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004167 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004168 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004169 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4170 reply.readException();
4171 int res = reply.readInt();
4172 data.recycle();
4173 reply.recycle();
4174 return res;
4175 }
4176 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004177 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004178 Parcel data = Parcel.obtain();
4179 Parcel reply = Parcel.obtain();
4180 data.writeInterfaceToken(IActivityManager.descriptor);
4181 data.writeStrongBinder(caller.asBinder());
4182 data.writeString(targetPkg);
4183 uri.writeToParcel(data, 0);
4184 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004185 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004186 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4187 reply.readException();
4188 data.recycle();
4189 reply.recycle();
4190 }
4191 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004192 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004193 Parcel data = Parcel.obtain();
4194 Parcel reply = Parcel.obtain();
4195 data.writeInterfaceToken(IActivityManager.descriptor);
4196 data.writeStrongBinder(caller.asBinder());
4197 uri.writeToParcel(data, 0);
4198 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004199 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004200 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4201 reply.readException();
4202 data.recycle();
4203 reply.recycle();
4204 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004205
4206 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004207 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4208 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004209 Parcel data = Parcel.obtain();
4210 Parcel reply = Parcel.obtain();
4211 data.writeInterfaceToken(IActivityManager.descriptor);
4212 uri.writeToParcel(data, 0);
4213 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004214 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004215 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4216 reply.readException();
4217 data.recycle();
4218 reply.recycle();
4219 }
4220
4221 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004222 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4223 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004224 Parcel data = Parcel.obtain();
4225 Parcel reply = Parcel.obtain();
4226 data.writeInterfaceToken(IActivityManager.descriptor);
4227 uri.writeToParcel(data, 0);
4228 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004229 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004230 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4231 reply.readException();
4232 data.recycle();
4233 reply.recycle();
4234 }
4235
4236 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004237 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4238 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004239 Parcel data = Parcel.obtain();
4240 Parcel reply = Parcel.obtain();
4241 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004242 data.writeString(packageName);
4243 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004244 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4245 reply.readException();
4246 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4247 reply);
4248 data.recycle();
4249 reply.recycle();
4250 return perms;
4251 }
4252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004253 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4254 throws RemoteException {
4255 Parcel data = Parcel.obtain();
4256 Parcel reply = Parcel.obtain();
4257 data.writeInterfaceToken(IActivityManager.descriptor);
4258 data.writeStrongBinder(who.asBinder());
4259 data.writeInt(waiting ? 1 : 0);
4260 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4261 reply.readException();
4262 data.recycle();
4263 reply.recycle();
4264 }
4265 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4266 Parcel data = Parcel.obtain();
4267 Parcel reply = Parcel.obtain();
4268 data.writeInterfaceToken(IActivityManager.descriptor);
4269 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4270 reply.readException();
4271 outInfo.readFromParcel(reply);
4272 data.recycle();
4273 reply.recycle();
4274 }
4275 public void unhandledBack() throws RemoteException
4276 {
4277 Parcel data = Parcel.obtain();
4278 Parcel reply = Parcel.obtain();
4279 data.writeInterfaceToken(IActivityManager.descriptor);
4280 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4281 reply.readException();
4282 data.recycle();
4283 reply.recycle();
4284 }
4285 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4286 {
4287 Parcel data = Parcel.obtain();
4288 Parcel reply = Parcel.obtain();
4289 data.writeInterfaceToken(IActivityManager.descriptor);
4290 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4291 reply.readException();
4292 ParcelFileDescriptor pfd = null;
4293 if (reply.readInt() != 0) {
4294 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4295 }
4296 data.recycle();
4297 reply.recycle();
4298 return pfd;
4299 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004300 public void setLockScreenShown(boolean shown) throws RemoteException
4301 {
4302 Parcel data = Parcel.obtain();
4303 Parcel reply = Parcel.obtain();
4304 data.writeInterfaceToken(IActivityManager.descriptor);
4305 data.writeInt(shown ? 1 : 0);
4306 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4307 reply.readException();
4308 data.recycle();
4309 reply.recycle();
4310 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004311 public void setDebugApp(
4312 String packageName, boolean waitForDebugger, boolean persistent)
4313 throws RemoteException
4314 {
4315 Parcel data = Parcel.obtain();
4316 Parcel reply = Parcel.obtain();
4317 data.writeInterfaceToken(IActivityManager.descriptor);
4318 data.writeString(packageName);
4319 data.writeInt(waitForDebugger ? 1 : 0);
4320 data.writeInt(persistent ? 1 : 0);
4321 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4322 reply.readException();
4323 data.recycle();
4324 reply.recycle();
4325 }
4326 public void setAlwaysFinish(boolean enabled) throws RemoteException
4327 {
4328 Parcel data = Parcel.obtain();
4329 Parcel reply = Parcel.obtain();
4330 data.writeInterfaceToken(IActivityManager.descriptor);
4331 data.writeInt(enabled ? 1 : 0);
4332 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4333 reply.readException();
4334 data.recycle();
4335 reply.recycle();
4336 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004337 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004338 {
4339 Parcel data = Parcel.obtain();
4340 Parcel reply = Parcel.obtain();
4341 data.writeInterfaceToken(IActivityManager.descriptor);
4342 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004343 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004344 reply.readException();
4345 data.recycle();
4346 reply.recycle();
4347 }
4348 public void enterSafeMode() throws RemoteException {
4349 Parcel data = Parcel.obtain();
4350 data.writeInterfaceToken(IActivityManager.descriptor);
4351 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4352 data.recycle();
4353 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004354 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004355 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004356 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004357 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004358 data.writeStrongBinder(sender.asBinder());
4359 data.writeInt(sourceUid);
4360 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004361 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004362 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4363 data.recycle();
4364 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004365 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4366 throws RemoteException {
4367 Parcel data = Parcel.obtain();
4368 data.writeInterfaceToken(IActivityManager.descriptor);
4369 data.writeStrongBinder(sender.asBinder());
4370 data.writeInt(sourceUid);
4371 data.writeString(tag);
4372 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4373 data.recycle();
4374 }
4375 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4376 throws RemoteException {
4377 Parcel data = Parcel.obtain();
4378 data.writeInterfaceToken(IActivityManager.descriptor);
4379 data.writeStrongBinder(sender.asBinder());
4380 data.writeInt(sourceUid);
4381 data.writeString(tag);
4382 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4383 data.recycle();
4384 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004385 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004386 Parcel data = Parcel.obtain();
4387 Parcel reply = Parcel.obtain();
4388 data.writeInterfaceToken(IActivityManager.descriptor);
4389 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004390 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004391 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004392 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004393 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004394 boolean res = reply.readInt() != 0;
4395 data.recycle();
4396 reply.recycle();
4397 return res;
4398 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004399 @Override
4400 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4401 Parcel data = Parcel.obtain();
4402 Parcel reply = Parcel.obtain();
4403 data.writeInterfaceToken(IActivityManager.descriptor);
4404 data.writeString(reason);
4405 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4406 boolean res = reply.readInt() != 0;
4407 data.recycle();
4408 reply.recycle();
4409 return res;
4410 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004411 public boolean testIsSystemReady()
4412 {
4413 /* this base class version is never called */
4414 return true;
4415 }
Dan Egnor60d87622009-12-16 16:32:58 -08004416 public void handleApplicationCrash(IBinder app,
4417 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4418 {
4419 Parcel data = Parcel.obtain();
4420 Parcel reply = Parcel.obtain();
4421 data.writeInterfaceToken(IActivityManager.descriptor);
4422 data.writeStrongBinder(app);
4423 crashInfo.writeToParcel(data, 0);
4424 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4425 reply.readException();
4426 reply.recycle();
4427 data.recycle();
4428 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004429
Dianne Hackborn52322712014-08-26 22:47:26 -07004430 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004431 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004432 {
4433 Parcel data = Parcel.obtain();
4434 Parcel reply = Parcel.obtain();
4435 data.writeInterfaceToken(IActivityManager.descriptor);
4436 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004437 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004438 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004439 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004440 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004441 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004442 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004443 reply.recycle();
4444 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004445 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004446 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004447
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004448 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004449 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004450 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004451 {
4452 Parcel data = Parcel.obtain();
4453 Parcel reply = Parcel.obtain();
4454 data.writeInterfaceToken(IActivityManager.descriptor);
4455 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004456 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004457 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004458 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4459 reply.readException();
4460 reply.recycle();
4461 data.recycle();
4462 }
4463
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004464 public void signalPersistentProcesses(int sig) throws RemoteException {
4465 Parcel data = Parcel.obtain();
4466 Parcel reply = Parcel.obtain();
4467 data.writeInterfaceToken(IActivityManager.descriptor);
4468 data.writeInt(sig);
4469 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4470 reply.readException();
4471 data.recycle();
4472 reply.recycle();
4473 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004474
Dianne Hackborn1676c852012-09-10 14:52:30 -07004475 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004476 Parcel data = Parcel.obtain();
4477 Parcel reply = Parcel.obtain();
4478 data.writeInterfaceToken(IActivityManager.descriptor);
4479 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004480 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004481 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4482 reply.readException();
4483 data.recycle();
4484 reply.recycle();
4485 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004486
4487 public void killAllBackgroundProcesses() throws RemoteException {
4488 Parcel data = Parcel.obtain();
4489 Parcel reply = Parcel.obtain();
4490 data.writeInterfaceToken(IActivityManager.descriptor);
4491 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4492 reply.readException();
4493 data.recycle();
4494 reply.recycle();
4495 }
4496
Dianne Hackborn1676c852012-09-10 14:52:30 -07004497 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004498 Parcel data = Parcel.obtain();
4499 Parcel reply = Parcel.obtain();
4500 data.writeInterfaceToken(IActivityManager.descriptor);
4501 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004502 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004503 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004504 reply.readException();
4505 data.recycle();
4506 reply.recycle();
4507 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004508
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004509 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4510 throws RemoteException
4511 {
4512 Parcel data = Parcel.obtain();
4513 Parcel reply = Parcel.obtain();
4514 data.writeInterfaceToken(IActivityManager.descriptor);
4515 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4516 reply.readException();
4517 outInfo.readFromParcel(reply);
4518 reply.recycle();
4519 data.recycle();
4520 }
4521
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004522 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4523 {
4524 Parcel data = Parcel.obtain();
4525 Parcel reply = Parcel.obtain();
4526 data.writeInterfaceToken(IActivityManager.descriptor);
4527 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4528 reply.readException();
4529 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4530 reply.recycle();
4531 data.recycle();
4532 return res;
4533 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004534
Dianne Hackborn1676c852012-09-10 14:52:30 -07004535 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004536 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004537 {
4538 Parcel data = Parcel.obtain();
4539 Parcel reply = Parcel.obtain();
4540 data.writeInterfaceToken(IActivityManager.descriptor);
4541 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004542 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004543 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004544 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004545 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004546 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004547 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004548 } else {
4549 data.writeInt(0);
4550 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004551 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4552 reply.readException();
4553 boolean res = reply.readInt() != 0;
4554 reply.recycle();
4555 data.recycle();
4556 return res;
4557 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004558
Dianne Hackborn55280a92009-05-07 15:53:46 -07004559 public boolean shutdown(int timeout) throws RemoteException
4560 {
4561 Parcel data = Parcel.obtain();
4562 Parcel reply = Parcel.obtain();
4563 data.writeInterfaceToken(IActivityManager.descriptor);
4564 data.writeInt(timeout);
4565 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4566 reply.readException();
4567 boolean res = reply.readInt() != 0;
4568 reply.recycle();
4569 data.recycle();
4570 return res;
4571 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004572
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004573 public void stopAppSwitches() throws RemoteException {
4574 Parcel data = Parcel.obtain();
4575 Parcel reply = Parcel.obtain();
4576 data.writeInterfaceToken(IActivityManager.descriptor);
4577 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4578 reply.readException();
4579 reply.recycle();
4580 data.recycle();
4581 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004582
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004583 public void resumeAppSwitches() throws RemoteException {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
4587 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4588 reply.readException();
4589 reply.recycle();
4590 data.recycle();
4591 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004592
4593 public void addPackageDependency(String packageName) throws RemoteException {
4594 Parcel data = Parcel.obtain();
4595 Parcel reply = Parcel.obtain();
4596 data.writeInterfaceToken(IActivityManager.descriptor);
4597 data.writeString(packageName);
4598 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4599 reply.readException();
4600 data.recycle();
4601 reply.recycle();
4602 }
4603
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004604 public void killApplicationWithAppId(String pkg, int appid, String reason)
4605 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004606 Parcel data = Parcel.obtain();
4607 Parcel reply = Parcel.obtain();
4608 data.writeInterfaceToken(IActivityManager.descriptor);
4609 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004610 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004611 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004612 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004613 reply.readException();
4614 data.recycle();
4615 reply.recycle();
4616 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004617
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004618 public void closeSystemDialogs(String reason) throws RemoteException {
4619 Parcel data = Parcel.obtain();
4620 Parcel reply = Parcel.obtain();
4621 data.writeInterfaceToken(IActivityManager.descriptor);
4622 data.writeString(reason);
4623 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4624 reply.readException();
4625 data.recycle();
4626 reply.recycle();
4627 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004628
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004629 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004630 throws RemoteException {
4631 Parcel data = Parcel.obtain();
4632 Parcel reply = Parcel.obtain();
4633 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004634 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004635 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4636 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004637 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004638 data.recycle();
4639 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004640 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004641 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004642
4643 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4644 Parcel data = Parcel.obtain();
4645 Parcel reply = Parcel.obtain();
4646 data.writeInterfaceToken(IActivityManager.descriptor);
4647 data.writeString(processName);
4648 data.writeInt(uid);
4649 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4650 reply.readException();
4651 data.recycle();
4652 reply.recycle();
4653 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004654
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004655 public void overridePendingTransition(IBinder token, String packageName,
4656 int enterAnim, int exitAnim) throws RemoteException {
4657 Parcel data = Parcel.obtain();
4658 Parcel reply = Parcel.obtain();
4659 data.writeInterfaceToken(IActivityManager.descriptor);
4660 data.writeStrongBinder(token);
4661 data.writeString(packageName);
4662 data.writeInt(enterAnim);
4663 data.writeInt(exitAnim);
4664 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4665 reply.readException();
4666 data.recycle();
4667 reply.recycle();
4668 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004669
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004670 public boolean isUserAMonkey() throws RemoteException {
4671 Parcel data = Parcel.obtain();
4672 Parcel reply = Parcel.obtain();
4673 data.writeInterfaceToken(IActivityManager.descriptor);
4674 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4675 reply.readException();
4676 boolean res = reply.readInt() != 0;
4677 data.recycle();
4678 reply.recycle();
4679 return res;
4680 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004681
4682 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4683 Parcel data = Parcel.obtain();
4684 Parcel reply = Parcel.obtain();
4685 data.writeInterfaceToken(IActivityManager.descriptor);
4686 data.writeInt(monkey ? 1 : 0);
4687 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4688 reply.readException();
4689 data.recycle();
4690 reply.recycle();
4691 }
4692
Dianne Hackborn860755f2010-06-03 18:47:52 -07004693 public void finishHeavyWeightApp() throws RemoteException {
4694 Parcel data = Parcel.obtain();
4695 Parcel reply = Parcel.obtain();
4696 data.writeInterfaceToken(IActivityManager.descriptor);
4697 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4698 reply.readException();
4699 data.recycle();
4700 reply.recycle();
4701 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004702
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004703 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004704 throws RemoteException {
4705 Parcel data = Parcel.obtain();
4706 Parcel reply = Parcel.obtain();
4707 data.writeInterfaceToken(IActivityManager.descriptor);
4708 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004709 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4710 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004711 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004712 data.recycle();
4713 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004714 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004715 }
4716
Craig Mautner233ceee2014-05-09 17:05:11 -07004717 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004718 throws RemoteException {
4719 Parcel data = Parcel.obtain();
4720 Parcel reply = Parcel.obtain();
4721 data.writeInterfaceToken(IActivityManager.descriptor);
4722 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004723 if (options == null) {
4724 data.writeInt(0);
4725 } else {
4726 data.writeInt(1);
4727 data.writeBundle(options.toBundle());
4728 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004729 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004730 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004731 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004732 data.recycle();
4733 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004734 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004735 }
4736
Craig Mautner233ceee2014-05-09 17:05:11 -07004737 public ActivityOptions getActivityOptions(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(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4743 reply.readException();
4744 Bundle bundle = reply.readBundle();
4745 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4746 data.recycle();
4747 reply.recycle();
4748 return options;
4749 }
4750
Daniel Sandler69a48172010-06-23 16:29:36 -04004751 public void setImmersive(IBinder token, boolean immersive)
4752 throws RemoteException {
4753 Parcel data = Parcel.obtain();
4754 Parcel reply = Parcel.obtain();
4755 data.writeInterfaceToken(IActivityManager.descriptor);
4756 data.writeStrongBinder(token);
4757 data.writeInt(immersive ? 1 : 0);
4758 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4759 reply.readException();
4760 data.recycle();
4761 reply.recycle();
4762 }
4763
4764 public boolean isImmersive(IBinder token)
4765 throws RemoteException {
4766 Parcel data = Parcel.obtain();
4767 Parcel reply = Parcel.obtain();
4768 data.writeInterfaceToken(IActivityManager.descriptor);
4769 data.writeStrongBinder(token);
4770 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004771 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004772 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004773 data.recycle();
4774 reply.recycle();
4775 return res;
4776 }
4777
Craig Mautnerd61dc202014-07-07 11:09:11 -07004778 public boolean isTopOfTask(IBinder token) throws RemoteException {
4779 Parcel data = Parcel.obtain();
4780 Parcel reply = Parcel.obtain();
4781 data.writeInterfaceToken(IActivityManager.descriptor);
4782 data.writeStrongBinder(token);
4783 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4784 reply.readException();
4785 boolean res = reply.readInt() == 1;
4786 data.recycle();
4787 reply.recycle();
4788 return res;
4789 }
4790
Daniel Sandler69a48172010-06-23 16:29:36 -04004791 public boolean isTopActivityImmersive()
4792 throws RemoteException {
4793 Parcel data = Parcel.obtain();
4794 Parcel reply = Parcel.obtain();
4795 data.writeInterfaceToken(IActivityManager.descriptor);
4796 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004797 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004798 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004799 data.recycle();
4800 reply.recycle();
4801 return res;
4802 }
4803
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004804 public void crashApplication(int uid, int initialPid, String packageName,
4805 String message) throws RemoteException {
4806 Parcel data = Parcel.obtain();
4807 Parcel reply = Parcel.obtain();
4808 data.writeInterfaceToken(IActivityManager.descriptor);
4809 data.writeInt(uid);
4810 data.writeInt(initialPid);
4811 data.writeString(packageName);
4812 data.writeString(message);
4813 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4814 reply.readException();
4815 data.recycle();
4816 reply.recycle();
4817 }
Andy McFadden824c5102010-07-09 16:26:57 -07004818
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004819 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004820 Parcel data = Parcel.obtain();
4821 Parcel reply = Parcel.obtain();
4822 data.writeInterfaceToken(IActivityManager.descriptor);
4823 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004824 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004825 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4826 reply.readException();
4827 String res = reply.readString();
4828 data.recycle();
4829 reply.recycle();
4830 return res;
4831 }
4832
Dianne Hackborn7e269642010-08-25 19:50:20 -07004833 public IBinder newUriPermissionOwner(String name)
4834 throws RemoteException {
4835 Parcel data = Parcel.obtain();
4836 Parcel reply = Parcel.obtain();
4837 data.writeInterfaceToken(IActivityManager.descriptor);
4838 data.writeString(name);
4839 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4840 reply.readException();
4841 IBinder res = reply.readStrongBinder();
4842 data.recycle();
4843 reply.recycle();
4844 return res;
4845 }
4846
4847 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004848 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004849 Parcel data = Parcel.obtain();
4850 Parcel reply = Parcel.obtain();
4851 data.writeInterfaceToken(IActivityManager.descriptor);
4852 data.writeStrongBinder(owner);
4853 data.writeInt(fromUid);
4854 data.writeString(targetPkg);
4855 uri.writeToParcel(data, 0);
4856 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004857 data.writeInt(sourceUserId);
4858 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004859 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4860 reply.readException();
4861 data.recycle();
4862 reply.recycle();
4863 }
4864
4865 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004866 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004867 Parcel data = Parcel.obtain();
4868 Parcel reply = Parcel.obtain();
4869 data.writeInterfaceToken(IActivityManager.descriptor);
4870 data.writeStrongBinder(owner);
4871 if (uri != null) {
4872 data.writeInt(1);
4873 uri.writeToParcel(data, 0);
4874 } else {
4875 data.writeInt(0);
4876 }
4877 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004878 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004879 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4880 reply.readException();
4881 data.recycle();
4882 reply.recycle();
4883 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004884
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004885 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004886 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004887 Parcel data = Parcel.obtain();
4888 Parcel reply = Parcel.obtain();
4889 data.writeInterfaceToken(IActivityManager.descriptor);
4890 data.writeInt(callingUid);
4891 data.writeString(targetPkg);
4892 uri.writeToParcel(data, 0);
4893 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004894 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004895 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4896 reply.readException();
4897 int res = reply.readInt();
4898 data.recycle();
4899 reply.recycle();
4900 return res;
4901 }
4902
Dianne Hackborn1676c852012-09-10 14:52:30 -07004903 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004904 String path, ParcelFileDescriptor fd) throws RemoteException {
4905 Parcel data = Parcel.obtain();
4906 Parcel reply = Parcel.obtain();
4907 data.writeInterfaceToken(IActivityManager.descriptor);
4908 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004909 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004910 data.writeInt(managed ? 1 : 0);
4911 data.writeString(path);
4912 if (fd != null) {
4913 data.writeInt(1);
4914 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4915 } else {
4916 data.writeInt(0);
4917 }
4918 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4919 reply.readException();
4920 boolean res = reply.readInt() != 0;
4921 reply.recycle();
4922 data.recycle();
4923 return res;
4924 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004925
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004926 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004927 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004928 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004929 Parcel data = Parcel.obtain();
4930 Parcel reply = Parcel.obtain();
4931 data.writeInterfaceToken(IActivityManager.descriptor);
4932 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004933 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004934 data.writeTypedArray(intents, 0);
4935 data.writeStringArray(resolvedTypes);
4936 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004937 if (options != null) {
4938 data.writeInt(1);
4939 options.writeToParcel(data, 0);
4940 } else {
4941 data.writeInt(0);
4942 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004943 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004944 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4945 reply.readException();
4946 int result = reply.readInt();
4947 reply.recycle();
4948 data.recycle();
4949 return result;
4950 }
4951
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004952 public int getFrontActivityScreenCompatMode() throws RemoteException {
4953 Parcel data = Parcel.obtain();
4954 Parcel reply = Parcel.obtain();
4955 data.writeInterfaceToken(IActivityManager.descriptor);
4956 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4957 reply.readException();
4958 int mode = reply.readInt();
4959 reply.recycle();
4960 data.recycle();
4961 return mode;
4962 }
4963
4964 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4965 Parcel data = Parcel.obtain();
4966 Parcel reply = Parcel.obtain();
4967 data.writeInterfaceToken(IActivityManager.descriptor);
4968 data.writeInt(mode);
4969 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4970 reply.readException();
4971 reply.recycle();
4972 data.recycle();
4973 }
4974
4975 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4976 Parcel data = Parcel.obtain();
4977 Parcel reply = Parcel.obtain();
4978 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004979 data.writeString(packageName);
4980 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004981 reply.readException();
4982 int mode = reply.readInt();
4983 reply.recycle();
4984 data.recycle();
4985 return mode;
4986 }
4987
4988 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004989 throws RemoteException {
4990 Parcel data = Parcel.obtain();
4991 Parcel reply = Parcel.obtain();
4992 data.writeInterfaceToken(IActivityManager.descriptor);
4993 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004994 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004995 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4996 reply.readException();
4997 reply.recycle();
4998 data.recycle();
4999 }
5000
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005001 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5002 Parcel data = Parcel.obtain();
5003 Parcel reply = Parcel.obtain();
5004 data.writeInterfaceToken(IActivityManager.descriptor);
5005 data.writeString(packageName);
5006 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5007 reply.readException();
5008 boolean ask = reply.readInt() != 0;
5009 reply.recycle();
5010 data.recycle();
5011 return ask;
5012 }
5013
5014 public void setPackageAskScreenCompat(String packageName, boolean ask)
5015 throws RemoteException {
5016 Parcel data = Parcel.obtain();
5017 Parcel reply = Parcel.obtain();
5018 data.writeInterfaceToken(IActivityManager.descriptor);
5019 data.writeString(packageName);
5020 data.writeInt(ask ? 1 : 0);
5021 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5022 reply.readException();
5023 reply.recycle();
5024 data.recycle();
5025 }
5026
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005027 public boolean switchUser(int userid) throws RemoteException {
5028 Parcel data = Parcel.obtain();
5029 Parcel reply = Parcel.obtain();
5030 data.writeInterfaceToken(IActivityManager.descriptor);
5031 data.writeInt(userid);
5032 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5033 reply.readException();
5034 boolean result = reply.readInt() != 0;
5035 reply.recycle();
5036 data.recycle();
5037 return result;
5038 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005039
Kenny Guy08488bf2014-02-21 17:40:37 +00005040 public boolean startUserInBackground(int userid) throws RemoteException {
5041 Parcel data = Parcel.obtain();
5042 Parcel reply = Parcel.obtain();
5043 data.writeInterfaceToken(IActivityManager.descriptor);
5044 data.writeInt(userid);
5045 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5046 reply.readException();
5047 boolean result = reply.readInt() != 0;
5048 reply.recycle();
5049 data.recycle();
5050 return result;
5051 }
5052
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005053 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5054 Parcel data = Parcel.obtain();
5055 Parcel reply = Parcel.obtain();
5056 data.writeInterfaceToken(IActivityManager.descriptor);
5057 data.writeInt(userid);
5058 data.writeStrongInterface(callback);
5059 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5060 reply.readException();
5061 int result = reply.readInt();
5062 reply.recycle();
5063 data.recycle();
5064 return result;
5065 }
5066
Amith Yamasani52f1d752012-03-28 18:19:29 -07005067 public UserInfo getCurrentUser() throws RemoteException {
5068 Parcel data = Parcel.obtain();
5069 Parcel reply = Parcel.obtain();
5070 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005071 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005072 reply.readException();
5073 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5074 reply.recycle();
5075 data.recycle();
5076 return userInfo;
5077 }
5078
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005079 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005080 Parcel data = Parcel.obtain();
5081 Parcel reply = Parcel.obtain();
5082 data.writeInterfaceToken(IActivityManager.descriptor);
5083 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005084 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005085 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5086 reply.readException();
5087 boolean result = reply.readInt() != 0;
5088 reply.recycle();
5089 data.recycle();
5090 return result;
5091 }
5092
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005093 public int[] getRunningUserIds() throws RemoteException {
5094 Parcel data = Parcel.obtain();
5095 Parcel reply = Parcel.obtain();
5096 data.writeInterfaceToken(IActivityManager.descriptor);
5097 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5098 reply.readException();
5099 int[] result = reply.createIntArray();
5100 reply.recycle();
5101 data.recycle();
5102 return result;
5103 }
5104
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005105 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005106 Parcel data = Parcel.obtain();
5107 Parcel reply = Parcel.obtain();
5108 data.writeInterfaceToken(IActivityManager.descriptor);
5109 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005110 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5111 reply.readException();
5112 boolean result = reply.readInt() != 0;
5113 reply.recycle();
5114 data.recycle();
5115 return result;
5116 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005117
Jeff Sharkeya4620792011-05-20 15:29:23 -07005118 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5119 Parcel data = Parcel.obtain();
5120 Parcel reply = Parcel.obtain();
5121 data.writeInterfaceToken(IActivityManager.descriptor);
5122 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5123 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5124 reply.readException();
5125 data.recycle();
5126 reply.recycle();
5127 }
5128
5129 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5130 Parcel data = Parcel.obtain();
5131 Parcel reply = Parcel.obtain();
5132 data.writeInterfaceToken(IActivityManager.descriptor);
5133 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5134 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5135 reply.readException();
5136 data.recycle();
5137 reply.recycle();
5138 }
5139
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005140 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5141 Parcel data = Parcel.obtain();
5142 Parcel reply = Parcel.obtain();
5143 data.writeInterfaceToken(IActivityManager.descriptor);
5144 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5145 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5146 reply.readException();
5147 data.recycle();
5148 reply.recycle();
5149 }
5150
5151 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5152 Parcel data = Parcel.obtain();
5153 Parcel reply = Parcel.obtain();
5154 data.writeInterfaceToken(IActivityManager.descriptor);
5155 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5156 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5157 reply.readException();
5158 data.recycle();
5159 reply.recycle();
5160 }
5161
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005162 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5163 Parcel data = Parcel.obtain();
5164 Parcel reply = Parcel.obtain();
5165 data.writeInterfaceToken(IActivityManager.descriptor);
5166 data.writeStrongBinder(sender.asBinder());
5167 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5168 reply.readException();
5169 boolean res = reply.readInt() != 0;
5170 data.recycle();
5171 reply.recycle();
5172 return res;
5173 }
5174
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005175 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5176 Parcel data = Parcel.obtain();
5177 Parcel reply = Parcel.obtain();
5178 data.writeInterfaceToken(IActivityManager.descriptor);
5179 data.writeStrongBinder(sender.asBinder());
5180 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5181 reply.readException();
5182 boolean res = reply.readInt() != 0;
5183 data.recycle();
5184 reply.recycle();
5185 return res;
5186 }
5187
Dianne Hackborn81038902012-11-26 17:04:09 -08005188 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5189 Parcel data = Parcel.obtain();
5190 Parcel reply = Parcel.obtain();
5191 data.writeInterfaceToken(IActivityManager.descriptor);
5192 data.writeStrongBinder(sender.asBinder());
5193 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5194 reply.readException();
5195 Intent res = reply.readInt() != 0
5196 ? Intent.CREATOR.createFromParcel(reply) : null;
5197 data.recycle();
5198 reply.recycle();
5199 return res;
5200 }
5201
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005202 public String getTagForIntentSender(IIntentSender sender, String prefix)
5203 throws RemoteException {
5204 Parcel data = Parcel.obtain();
5205 Parcel reply = Parcel.obtain();
5206 data.writeInterfaceToken(IActivityManager.descriptor);
5207 data.writeStrongBinder(sender.asBinder());
5208 data.writeString(prefix);
5209 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5210 reply.readException();
5211 String res = reply.readString();
5212 data.recycle();
5213 reply.recycle();
5214 return res;
5215 }
5216
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005217 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5218 {
5219 Parcel data = Parcel.obtain();
5220 Parcel reply = Parcel.obtain();
5221 data.writeInterfaceToken(IActivityManager.descriptor);
5222 values.writeToParcel(data, 0);
5223 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5224 reply.readException();
5225 data.recycle();
5226 reply.recycle();
5227 }
5228
Dianne Hackbornb437e092011-08-05 17:50:29 -07005229 public long[] getProcessPss(int[] pids) throws RemoteException {
5230 Parcel data = Parcel.obtain();
5231 Parcel reply = Parcel.obtain();
5232 data.writeInterfaceToken(IActivityManager.descriptor);
5233 data.writeIntArray(pids);
5234 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5235 reply.readException();
5236 long[] res = reply.createLongArray();
5237 data.recycle();
5238 reply.recycle();
5239 return res;
5240 }
5241
Dianne Hackborn661cd522011-08-22 00:26:20 -07005242 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5243 Parcel data = Parcel.obtain();
5244 Parcel reply = Parcel.obtain();
5245 data.writeInterfaceToken(IActivityManager.descriptor);
5246 TextUtils.writeToParcel(msg, data, 0);
5247 data.writeInt(always ? 1 : 0);
5248 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5249 reply.readException();
5250 data.recycle();
5251 reply.recycle();
5252 }
5253
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005254 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005255 Parcel data = Parcel.obtain();
5256 Parcel reply = Parcel.obtain();
5257 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005258 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005259 reply.readException();
5260 data.recycle();
5261 reply.recycle();
5262 }
5263
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005264 public void keyguardGoingAway(boolean disableWindowAnimations,
5265 boolean keyguardGoingToNotificationShade) throws RemoteException {
5266 Parcel data = Parcel.obtain();
5267 Parcel reply = Parcel.obtain();
5268 data.writeInterfaceToken(IActivityManager.descriptor);
5269 data.writeInt(disableWindowAnimations ? 1 : 0);
5270 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5271 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5272 reply.readException();
5273 data.recycle();
5274 reply.recycle();
5275 }
5276
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005277 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005278 throws RemoteException {
5279 Parcel data = Parcel.obtain();
5280 Parcel reply = Parcel.obtain();
5281 data.writeInterfaceToken(IActivityManager.descriptor);
5282 data.writeStrongBinder(token);
5283 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005284 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005285 reply.readException();
5286 boolean result = reply.readInt() != 0;
5287 data.recycle();
5288 reply.recycle();
5289 return result;
5290 }
5291
5292 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5293 throws RemoteException {
5294 Parcel data = Parcel.obtain();
5295 Parcel reply = Parcel.obtain();
5296 data.writeInterfaceToken(IActivityManager.descriptor);
5297 data.writeStrongBinder(token);
5298 target.writeToParcel(data, 0);
5299 data.writeInt(resultCode);
5300 if (resultData != null) {
5301 data.writeInt(1);
5302 resultData.writeToParcel(data, 0);
5303 } else {
5304 data.writeInt(0);
5305 }
5306 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5307 reply.readException();
5308 boolean result = reply.readInt() != 0;
5309 data.recycle();
5310 reply.recycle();
5311 return result;
5312 }
5313
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005314 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5315 Parcel data = Parcel.obtain();
5316 Parcel reply = Parcel.obtain();
5317 data.writeInterfaceToken(IActivityManager.descriptor);
5318 data.writeStrongBinder(activityToken);
5319 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5320 reply.readException();
5321 int result = reply.readInt();
5322 data.recycle();
5323 reply.recycle();
5324 return result;
5325 }
5326
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005327 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5328 Parcel data = Parcel.obtain();
5329 Parcel reply = Parcel.obtain();
5330 data.writeInterfaceToken(IActivityManager.descriptor);
5331 data.writeStrongBinder(activityToken);
5332 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5333 reply.readException();
5334 String result = reply.readString();
5335 data.recycle();
5336 reply.recycle();
5337 return result;
5338 }
5339
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005340 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5341 Parcel data = Parcel.obtain();
5342 Parcel reply = Parcel.obtain();
5343 data.writeInterfaceToken(IActivityManager.descriptor);
5344 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5345 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5346 reply.readException();
5347 data.recycle();
5348 reply.recycle();
5349 }
5350
5351 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5352 Parcel data = Parcel.obtain();
5353 Parcel reply = Parcel.obtain();
5354 data.writeInterfaceToken(IActivityManager.descriptor);
5355 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5356 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5357 reply.readException();
5358 data.recycle();
5359 reply.recycle();
5360 }
5361
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005362 public void requestBugReport() throws RemoteException {
5363 Parcel data = Parcel.obtain();
5364 Parcel reply = Parcel.obtain();
5365 data.writeInterfaceToken(IActivityManager.descriptor);
5366 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5367 reply.readException();
5368 data.recycle();
5369 reply.recycle();
5370 }
5371
Jeff Brownbd181bb2013-09-10 16:44:24 -07005372 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5373 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005374 Parcel data = Parcel.obtain();
5375 Parcel reply = Parcel.obtain();
5376 data.writeInterfaceToken(IActivityManager.descriptor);
5377 data.writeInt(pid);
5378 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005379 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005380 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5381 reply.readException();
5382 long res = reply.readInt();
5383 data.recycle();
5384 reply.recycle();
5385 return res;
5386 }
5387
Adam Skorydfc7fd72013-08-05 19:23:41 -07005388 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005389 Parcel data = Parcel.obtain();
5390 Parcel reply = Parcel.obtain();
5391 data.writeInterfaceToken(IActivityManager.descriptor);
5392 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005393 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005394 reply.readException();
5395 Bundle res = reply.readBundle();
5396 data.recycle();
5397 reply.recycle();
5398 return res;
5399 }
5400
Dianne Hackborn17f69352015-07-17 18:04:14 -07005401 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5402 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005403 Parcel data = Parcel.obtain();
5404 Parcel reply = Parcel.obtain();
5405 data.writeInterfaceToken(IActivityManager.descriptor);
5406 data.writeInt(requestType);
5407 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005408 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005409 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5410 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005411 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005412 data.recycle();
5413 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005414 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005415 }
5416
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005417 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005418 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005419 Parcel data = Parcel.obtain();
5420 Parcel reply = Parcel.obtain();
5421 data.writeInterfaceToken(IActivityManager.descriptor);
5422 data.writeStrongBinder(token);
5423 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005424 structure.writeToParcel(data, 0);
5425 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005426 if (referrer != null) {
5427 data.writeInt(1);
5428 referrer.writeToParcel(data, 0);
5429 } else {
5430 data.writeInt(0);
5431 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005432 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005433 reply.readException();
5434 data.recycle();
5435 reply.recycle();
5436 }
5437
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005438 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5439 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005440 Parcel data = Parcel.obtain();
5441 Parcel reply = Parcel.obtain();
5442 data.writeInterfaceToken(IActivityManager.descriptor);
5443 intent.writeToParcel(data, 0);
5444 data.writeInt(requestType);
5445 data.writeString(hint);
5446 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005447 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005448 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5449 reply.readException();
5450 boolean res = reply.readInt() != 0;
5451 data.recycle();
5452 reply.recycle();
5453 return res;
5454 }
5455
Dianne Hackborn17f69352015-07-17 18:04:14 -07005456 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005457 Parcel data = Parcel.obtain();
5458 Parcel reply = Parcel.obtain();
5459 data.writeInterfaceToken(IActivityManager.descriptor);
5460 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5461 reply.readException();
5462 boolean res = reply.readInt() != 0;
5463 data.recycle();
5464 reply.recycle();
5465 return res;
5466 }
5467
Dianne Hackborn17f69352015-07-17 18:04:14 -07005468 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5469 Parcel data = Parcel.obtain();
5470 Parcel reply = Parcel.obtain();
5471 data.writeInterfaceToken(IActivityManager.descriptor);
5472 data.writeStrongBinder(token);
5473 data.writeBundle(args);
5474 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5475 reply.readException();
5476 boolean res = reply.readInt() != 0;
5477 data.recycle();
5478 reply.recycle();
5479 return res;
5480 }
5481
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005482 public void killUid(int uid, String reason) throws RemoteException {
5483 Parcel data = Parcel.obtain();
5484 Parcel reply = Parcel.obtain();
5485 data.writeInterfaceToken(IActivityManager.descriptor);
5486 data.writeInt(uid);
5487 data.writeString(reason);
5488 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5489 reply.readException();
5490 data.recycle();
5491 reply.recycle();
5492 }
5493
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005494 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5495 Parcel data = Parcel.obtain();
5496 Parcel reply = Parcel.obtain();
5497 data.writeInterfaceToken(IActivityManager.descriptor);
5498 data.writeStrongBinder(who);
5499 data.writeInt(allowRestart ? 1 : 0);
5500 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5501 reply.readException();
5502 data.recycle();
5503 reply.recycle();
5504 }
5505
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005506 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5507 Parcel data = Parcel.obtain();
5508 Parcel reply = Parcel.obtain();
5509 data.writeInterfaceToken(IActivityManager.descriptor);
5510 data.writeStrongBinder(token);
5511 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5512 reply.readException();
5513 data.recycle();
5514 reply.recycle();
5515 }
5516
Craig Mautner5eda9b32013-07-02 11:58:16 -07005517 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5518 Parcel data = Parcel.obtain();
5519 Parcel reply = Parcel.obtain();
5520 data.writeInterfaceToken(IActivityManager.descriptor);
5521 data.writeStrongBinder(token);
5522 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5523 reply.readException();
5524 data.recycle();
5525 reply.recycle();
5526 }
5527
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005528 public void restart() throws RemoteException {
5529 Parcel data = Parcel.obtain();
5530 Parcel reply = Parcel.obtain();
5531 data.writeInterfaceToken(IActivityManager.descriptor);
5532 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5533 reply.readException();
5534 data.recycle();
5535 reply.recycle();
5536 }
5537
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005538 public void performIdleMaintenance() throws RemoteException {
5539 Parcel data = Parcel.obtain();
5540 Parcel reply = Parcel.obtain();
5541 data.writeInterfaceToken(IActivityManager.descriptor);
5542 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5543 reply.readException();
5544 data.recycle();
5545 reply.recycle();
5546 }
5547
Todd Kennedyca4d8422015-01-15 15:19:22 -08005548 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005549 IActivityContainerCallback callback) throws RemoteException {
5550 Parcel data = Parcel.obtain();
5551 Parcel reply = Parcel.obtain();
5552 data.writeInterfaceToken(IActivityManager.descriptor);
5553 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005554 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005555 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005556 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005557 final int result = reply.readInt();
5558 final IActivityContainer res;
5559 if (result == 1) {
5560 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5561 } else {
5562 res = null;
5563 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005564 data.recycle();
5565 reply.recycle();
5566 return res;
5567 }
5568
Craig Mautner95da1082014-02-24 17:54:35 -08005569 public void deleteActivityContainer(IActivityContainer activityContainer)
5570 throws RemoteException {
5571 Parcel data = Parcel.obtain();
5572 Parcel reply = Parcel.obtain();
5573 data.writeInterfaceToken(IActivityManager.descriptor);
5574 data.writeStrongBinder(activityContainer.asBinder());
5575 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5576 reply.readException();
5577 data.recycle();
5578 reply.recycle();
5579 }
5580
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005581 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005582 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5583 Parcel data = Parcel.obtain();
5584 Parcel reply = Parcel.obtain();
5585 data.writeInterfaceToken(IActivityManager.descriptor);
5586 data.writeInt(displayId);
5587 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5588 reply.readException();
5589 final int result = reply.readInt();
5590 final IActivityContainer res;
5591 if (result == 1) {
5592 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5593 } else {
5594 res = null;
5595 }
5596 data.recycle();
5597 reply.recycle();
5598 return res;
5599 }
5600
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005601 @Override
5602 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005603 throws RemoteException {
5604 Parcel data = Parcel.obtain();
5605 Parcel reply = Parcel.obtain();
5606 data.writeInterfaceToken(IActivityManager.descriptor);
5607 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005608 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005609 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005610 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005611 data.recycle();
5612 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005613 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005614 }
5615
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005616 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005617 public void startLockTaskMode(int taskId) throws RemoteException {
5618 Parcel data = Parcel.obtain();
5619 Parcel reply = Parcel.obtain();
5620 data.writeInterfaceToken(IActivityManager.descriptor);
5621 data.writeInt(taskId);
5622 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5623 reply.readException();
5624 data.recycle();
5625 reply.recycle();
5626 }
5627
5628 @Override
5629 public void startLockTaskMode(IBinder token) throws RemoteException {
5630 Parcel data = Parcel.obtain();
5631 Parcel reply = Parcel.obtain();
5632 data.writeInterfaceToken(IActivityManager.descriptor);
5633 data.writeStrongBinder(token);
5634 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5635 reply.readException();
5636 data.recycle();
5637 reply.recycle();
5638 }
5639
5640 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005641 public void startLockTaskModeOnCurrent() throws RemoteException {
5642 Parcel data = Parcel.obtain();
5643 Parcel reply = Parcel.obtain();
5644 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005645 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005646 reply.readException();
5647 data.recycle();
5648 reply.recycle();
5649 }
5650
5651 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005652 public void stopLockTaskMode() throws RemoteException {
5653 Parcel data = Parcel.obtain();
5654 Parcel reply = Parcel.obtain();
5655 data.writeInterfaceToken(IActivityManager.descriptor);
5656 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5657 reply.readException();
5658 data.recycle();
5659 reply.recycle();
5660 }
5661
5662 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005663 public void stopLockTaskModeOnCurrent() throws RemoteException {
5664 Parcel data = Parcel.obtain();
5665 Parcel reply = Parcel.obtain();
5666 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005667 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005668 reply.readException();
5669 data.recycle();
5670 reply.recycle();
5671 }
5672
5673 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005674 public boolean isInLockTaskMode() throws RemoteException {
5675 Parcel data = Parcel.obtain();
5676 Parcel reply = Parcel.obtain();
5677 data.writeInterfaceToken(IActivityManager.descriptor);
5678 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5679 reply.readException();
5680 boolean isInLockTaskMode = reply.readInt() == 1;
5681 data.recycle();
5682 reply.recycle();
5683 return isInLockTaskMode;
5684 }
5685
Craig Mautner688b5102014-03-27 16:55:03 -07005686 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005687 public int getLockTaskModeState() throws RemoteException {
5688 Parcel data = Parcel.obtain();
5689 Parcel reply = Parcel.obtain();
5690 data.writeInterfaceToken(IActivityManager.descriptor);
5691 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5692 reply.readException();
5693 int lockTaskModeState = reply.readInt();
5694 data.recycle();
5695 reply.recycle();
5696 return lockTaskModeState;
5697 }
5698
5699 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005700 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5701 Parcel data = Parcel.obtain();
5702 Parcel reply = Parcel.obtain();
5703 data.writeInterfaceToken(IActivityManager.descriptor);
5704 data.writeStrongBinder(token);
5705 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5706 IBinder.FLAG_ONEWAY);
5707 reply.readException();
5708 data.recycle();
5709 reply.recycle();
5710 }
5711
5712 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005713 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005714 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005715 Parcel data = Parcel.obtain();
5716 Parcel reply = Parcel.obtain();
5717 data.writeInterfaceToken(IActivityManager.descriptor);
5718 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005719 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005720 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005721 reply.readException();
5722 data.recycle();
5723 reply.recycle();
5724 }
5725
Craig Mautneree2e45a2014-06-27 12:10:03 -07005726 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005727 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5728 Parcel data = Parcel.obtain();
5729 Parcel reply = Parcel.obtain();
5730 data.writeInterfaceToken(IActivityManager.descriptor);
5731 data.writeInt(taskId);
5732 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005733 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005734 reply.readException();
5735 data.recycle();
5736 reply.recycle();
5737 }
5738
5739 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005740 public void resizeTask(int taskId, Rect r) throws RemoteException
5741 {
5742 Parcel data = Parcel.obtain();
5743 Parcel reply = Parcel.obtain();
5744 data.writeInterfaceToken(IActivityManager.descriptor);
5745 data.writeInt(taskId);
5746 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005747 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005748 reply.readException();
5749 data.recycle();
5750 reply.recycle();
5751 }
5752
5753 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005754 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5755 Parcel data = Parcel.obtain();
5756 Parcel reply = Parcel.obtain();
5757 data.writeInterfaceToken(IActivityManager.descriptor);
5758 data.writeString(filename);
5759 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5760 reply.readException();
5761 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5762 data.recycle();
5763 reply.recycle();
5764 return icon;
5765 }
5766
5767 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005768 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5769 throws RemoteException {
5770 Parcel data = Parcel.obtain();
5771 Parcel reply = Parcel.obtain();
5772 data.writeInterfaceToken(IActivityManager.descriptor);
5773 if (options == null) {
5774 data.writeInt(0);
5775 } else {
5776 data.writeInt(1);
5777 data.writeBundle(options.toBundle());
5778 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005779 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005780 reply.readException();
5781 data.recycle();
5782 reply.recycle();
5783 }
5784
5785 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005786 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005787 Parcel data = Parcel.obtain();
5788 Parcel reply = Parcel.obtain();
5789 data.writeInterfaceToken(IActivityManager.descriptor);
5790 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005791 data.writeInt(visible ? 1 : 0);
5792 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005793 reply.readException();
5794 boolean success = reply.readInt() > 0;
5795 data.recycle();
5796 reply.recycle();
5797 return success;
5798 }
5799
5800 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005801 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005802 Parcel data = Parcel.obtain();
5803 Parcel reply = Parcel.obtain();
5804 data.writeInterfaceToken(IActivityManager.descriptor);
5805 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005806 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005807 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005808 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005809 data.recycle();
5810 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005811 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005812 }
5813
5814 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005815 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005816 Parcel data = Parcel.obtain();
5817 Parcel reply = Parcel.obtain();
5818 data.writeInterfaceToken(IActivityManager.descriptor);
5819 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005820 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005821 reply.readException();
5822 data.recycle();
5823 reply.recycle();
5824 }
5825
5826 @Override
5827 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5828 Parcel data = Parcel.obtain();
5829 Parcel reply = Parcel.obtain();
5830 data.writeInterfaceToken(IActivityManager.descriptor);
5831 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005832 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005833 reply.readException();
5834 data.recycle();
5835 reply.recycle();
5836 }
5837
Craig Mautner8746a472014-07-24 15:12:54 -07005838 @Override
5839 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5840 Parcel data = Parcel.obtain();
5841 Parcel reply = Parcel.obtain();
5842 data.writeInterfaceToken(IActivityManager.descriptor);
5843 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005844 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005845 reply.readException();
5846 data.recycle();
5847 reply.recycle();
5848 }
5849
Craig Mautner6e2f3952014-09-09 14:26:41 -07005850 @Override
5851 public void bootAnimationComplete() throws RemoteException {
5852 Parcel data = Parcel.obtain();
5853 Parcel reply = Parcel.obtain();
5854 data.writeInterfaceToken(IActivityManager.descriptor);
5855 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5856 reply.readException();
5857 data.recycle();
5858 reply.recycle();
5859 }
5860
Wale Ogunwale18795a22014-12-03 11:38:33 -08005861 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005862 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5863 Parcel data = Parcel.obtain();
5864 Parcel reply = Parcel.obtain();
5865 data.writeInterfaceToken(IActivityManager.descriptor);
5866 data.writeInt(uid);
5867 data.writeByteArray(firstPacket);
5868 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5869 reply.readException();
5870 data.recycle();
5871 reply.recycle();
5872 }
5873
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005874 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005875 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5876 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005877 Parcel data = Parcel.obtain();
5878 Parcel reply = Parcel.obtain();
5879 data.writeInterfaceToken(IActivityManager.descriptor);
5880 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005881 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005882 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005883 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005884 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5885 reply.readException();
5886 data.recycle();
5887 reply.recycle();
5888 }
5889
5890 @Override
5891 public void dumpHeapFinished(String path) throws RemoteException {
5892 Parcel data = Parcel.obtain();
5893 Parcel reply = Parcel.obtain();
5894 data.writeInterfaceToken(IActivityManager.descriptor);
5895 data.writeString(path);
5896 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5897 reply.readException();
5898 data.recycle();
5899 reply.recycle();
5900 }
5901
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005902 @Override
5903 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5904 throws RemoteException {
5905 Parcel data = Parcel.obtain();
5906 Parcel reply = Parcel.obtain();
5907 data.writeInterfaceToken(IActivityManager.descriptor);
5908 data.writeStrongBinder(session.asBinder());
5909 data.writeInt(keepAwake ? 1 : 0);
5910 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5911 reply.readException();
5912 data.recycle();
5913 reply.recycle();
5914 }
5915
Craig Mautnere5600772015-04-03 21:36:37 -07005916 @Override
5917 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5918 Parcel data = Parcel.obtain();
5919 Parcel reply = Parcel.obtain();
5920 data.writeInterfaceToken(IActivityManager.descriptor);
5921 data.writeInt(userId);
5922 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005923 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005924 reply.readException();
5925 data.recycle();
5926 reply.recycle();
5927 }
5928
Dianne Hackborn1e383822015-04-10 14:02:33 -07005929 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07005930 public void updateDeviceOwner(String packageName) throws RemoteException {
5931 Parcel data = Parcel.obtain();
5932 Parcel reply = Parcel.obtain();
5933 data.writeInterfaceToken(IActivityManager.descriptor);
5934 data.writeString(packageName);
5935 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
5936 reply.readException();
5937 data.recycle();
5938 reply.recycle();
5939 }
5940
5941 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07005942 public int getPackageProcessState(String packageName, String callingPackage)
5943 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07005944 Parcel data = Parcel.obtain();
5945 Parcel reply = Parcel.obtain();
5946 data.writeInterfaceToken(IActivityManager.descriptor);
5947 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07005948 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005949 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5950 reply.readException();
5951 int res = reply.readInt();
5952 data.recycle();
5953 reply.recycle();
5954 return res;
5955 }
5956
Stefan Kuhne16045c22015-06-05 07:18:06 -07005957 @Override
5958 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
5959 throws RemoteException {
5960 Parcel data = Parcel.obtain();
5961 Parcel reply = Parcel.obtain();
5962 data.writeInterfaceToken(IActivityManager.descriptor);
5963 data.writeString(process);
5964 data.writeInt(userId);
5965 data.writeInt(level);
5966 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
5967 reply.readException();
5968 int res = reply.readInt();
5969 data.recycle();
5970 reply.recycle();
5971 return res != 0;
5972 }
5973
Dianne Hackbornfb81d092015-08-03 17:14:46 -07005974 @Override
5975 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
5976 Parcel data = Parcel.obtain();
5977 Parcel reply = Parcel.obtain();
5978 data.writeInterfaceToken(IActivityManager.descriptor);
5979 data.writeStrongBinder(token);
5980 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
5981 reply.readException();
5982 int res = reply.readInt();
5983 data.recycle();
5984 reply.recycle();
5985 return res != 0;
5986 }
5987
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005988 private IBinder mRemote;
5989}