blob: 4232db4748204556eeca756c2e7435c49c2b5190 [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 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700349 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700350 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
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700755 case POSITION_TASK_IN_STACK_TRANSACTION: {
756 data.enforceInterface(IActivityManager.descriptor);
757 int taskId = data.readInt();
758 int stackId = data.readInt();
759 int position = data.readInt();
760 positionTaskInStack(taskId, stackId, position);
761 reply.writeNoException();
762 return true;
763 }
764
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800765 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700766 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800767 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700768 reply.writeNoException();
769 reply.writeTypedList(list);
770 return true;
771 }
772
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800773 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700774 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800775 int stackId = data.readInt();
776 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700777 reply.writeNoException();
778 if (info != null) {
779 reply.writeInt(1);
780 info.writeToParcel(reply, 0);
781 } else {
782 reply.writeInt(0);
783 }
784 return true;
785 }
786
Winson Chung303e1ff2014-03-07 15:06:19 -0800787 case IS_IN_HOME_STACK_TRANSACTION: {
788 data.enforceInterface(IActivityManager.descriptor);
789 int taskId = data.readInt();
790 boolean isInHomeStack = isInHomeStack(taskId);
791 reply.writeNoException();
792 reply.writeInt(isInHomeStack ? 1 : 0);
793 return true;
794 }
795
Craig Mautnercf910b02013-04-23 11:23:27 -0700796 case SET_FOCUSED_STACK_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 int stackId = data.readInt();
799 setFocusedStack(stackId);
800 reply.writeNoException();
801 return true;
802 }
803
Winson Chungd16c5652015-01-26 16:11:07 -0800804 case GET_FOCUSED_STACK_ID_TRANSACTION: {
805 data.enforceInterface(IActivityManager.descriptor);
806 int focusedStackId = getFocusedStackId();
807 reply.writeNoException();
808 reply.writeInt(focusedStackId);
809 return true;
810 }
811
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700812 case SET_FOCUSED_TASK_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 int taskId = data.readInt();
815 setFocusedStack(taskId);
816 reply.writeNoException();
817 return true;
818 }
819
Winson Chung740c3ac2014-11-12 16:14:38 -0800820 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
821 data.enforceInterface(IActivityManager.descriptor);
822 IBinder token = data.readStrongBinder();
823 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
824 reply.writeNoException();
825 return true;
826 }
827
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800828 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
829 data.enforceInterface(IActivityManager.descriptor);
830 IBinder token = data.readStrongBinder();
831 boolean onlyRoot = data.readInt() != 0;
832 int res = token != null
833 ? getTaskForActivity(token, onlyRoot) : -1;
834 reply.writeNoException();
835 reply.writeInt(res);
836 return true;
837 }
838
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800839 case GET_CONTENT_PROVIDER_TRANSACTION: {
840 data.enforceInterface(IActivityManager.descriptor);
841 IBinder b = data.readStrongBinder();
842 IApplicationThread app = ApplicationThreadNative.asInterface(b);
843 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700844 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700845 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700846 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800847 reply.writeNoException();
848 if (cph != null) {
849 reply.writeInt(1);
850 cph.writeToParcel(reply, 0);
851 } else {
852 reply.writeInt(0);
853 }
854 return true;
855 }
856
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800857 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
858 data.enforceInterface(IActivityManager.descriptor);
859 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700860 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800861 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700862 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800863 reply.writeNoException();
864 if (cph != null) {
865 reply.writeInt(1);
866 cph.writeToParcel(reply, 0);
867 } else {
868 reply.writeInt(0);
869 }
870 return true;
871 }
872
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
874 data.enforceInterface(IActivityManager.descriptor);
875 IBinder b = data.readStrongBinder();
876 IApplicationThread app = ApplicationThreadNative.asInterface(b);
877 ArrayList<ContentProviderHolder> providers =
878 data.createTypedArrayList(ContentProviderHolder.CREATOR);
879 publishContentProviders(app, providers);
880 reply.writeNoException();
881 return true;
882 }
883
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700884 case REF_CONTENT_PROVIDER_TRANSACTION: {
885 data.enforceInterface(IActivityManager.descriptor);
886 IBinder b = data.readStrongBinder();
887 int stable = data.readInt();
888 int unstable = data.readInt();
889 boolean res = refContentProvider(b, stable, unstable);
890 reply.writeNoException();
891 reply.writeInt(res ? 1 : 0);
892 return true;
893 }
894
895 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
896 data.enforceInterface(IActivityManager.descriptor);
897 IBinder b = data.readStrongBinder();
898 unstableProviderDied(b);
899 reply.writeNoException();
900 return true;
901 }
902
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700903 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
904 data.enforceInterface(IActivityManager.descriptor);
905 IBinder b = data.readStrongBinder();
906 appNotRespondingViaProvider(b);
907 reply.writeNoException();
908 return true;
909 }
910
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800911 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
912 data.enforceInterface(IActivityManager.descriptor);
913 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700914 boolean stable = data.readInt() != 0;
915 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800916 reply.writeNoException();
917 return true;
918 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800919
920 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
921 data.enforceInterface(IActivityManager.descriptor);
922 String name = data.readString();
923 IBinder token = data.readStrongBinder();
924 removeContentProviderExternal(name, token);
925 reply.writeNoException();
926 return true;
927 }
928
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700929 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
932 PendingIntent pi = getRunningServiceControlPanel(comp);
933 reply.writeNoException();
934 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
935 return true;
936 }
937
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 case START_SERVICE_TRANSACTION: {
939 data.enforceInterface(IActivityManager.descriptor);
940 IBinder b = data.readStrongBinder();
941 IApplicationThread app = ApplicationThreadNative.asInterface(b);
942 Intent service = Intent.CREATOR.createFromParcel(data);
943 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700944 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700945 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700946 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 reply.writeNoException();
948 ComponentName.writeToParcel(cn, reply);
949 return true;
950 }
951
952 case STOP_SERVICE_TRANSACTION: {
953 data.enforceInterface(IActivityManager.descriptor);
954 IBinder b = data.readStrongBinder();
955 IApplicationThread app = ApplicationThreadNative.asInterface(b);
956 Intent service = Intent.CREATOR.createFromParcel(data);
957 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700958 int userId = data.readInt();
959 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800960 reply.writeNoException();
961 reply.writeInt(res);
962 return true;
963 }
964
965 case STOP_SERVICE_TOKEN_TRANSACTION: {
966 data.enforceInterface(IActivityManager.descriptor);
967 ComponentName className = ComponentName.readFromParcel(data);
968 IBinder token = data.readStrongBinder();
969 int startId = data.readInt();
970 boolean res = stopServiceToken(className, token, startId);
971 reply.writeNoException();
972 reply.writeInt(res ? 1 : 0);
973 return true;
974 }
975
976 case SET_SERVICE_FOREGROUND_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 ComponentName className = ComponentName.readFromParcel(data);
979 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700980 int id = data.readInt();
981 Notification notification = null;
982 if (data.readInt() != 0) {
983 notification = Notification.CREATOR.createFromParcel(data);
984 }
985 boolean removeNotification = data.readInt() != 0;
986 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 reply.writeNoException();
988 return true;
989 }
990
991 case BIND_SERVICE_TRANSACTION: {
992 data.enforceInterface(IActivityManager.descriptor);
993 IBinder b = data.readStrongBinder();
994 IApplicationThread app = ApplicationThreadNative.asInterface(b);
995 IBinder token = data.readStrongBinder();
996 Intent service = Intent.CREATOR.createFromParcel(data);
997 String resolvedType = data.readString();
998 b = data.readStrongBinder();
999 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001000 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001001 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001002 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001003 int res = bindService(app, token, service, resolvedType, conn, fl,
1004 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005 reply.writeNoException();
1006 reply.writeInt(res);
1007 return true;
1008 }
1009
1010 case UNBIND_SERVICE_TRANSACTION: {
1011 data.enforceInterface(IActivityManager.descriptor);
1012 IBinder b = data.readStrongBinder();
1013 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1014 boolean res = unbindService(conn);
1015 reply.writeNoException();
1016 reply.writeInt(res ? 1 : 0);
1017 return true;
1018 }
1019
1020 case PUBLISH_SERVICE_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 IBinder token = data.readStrongBinder();
1023 Intent intent = Intent.CREATOR.createFromParcel(data);
1024 IBinder service = data.readStrongBinder();
1025 publishService(token, intent, service);
1026 reply.writeNoException();
1027 return true;
1028 }
1029
1030 case UNBIND_FINISHED_TRANSACTION: {
1031 data.enforceInterface(IActivityManager.descriptor);
1032 IBinder token = data.readStrongBinder();
1033 Intent intent = Intent.CREATOR.createFromParcel(data);
1034 boolean doRebind = data.readInt() != 0;
1035 unbindFinished(token, intent, doRebind);
1036 reply.writeNoException();
1037 return true;
1038 }
1039
1040 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001043 int type = data.readInt();
1044 int startId = data.readInt();
1045 int res = data.readInt();
1046 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001047 reply.writeNoException();
1048 return true;
1049 }
1050
1051 case START_INSTRUMENTATION_TRANSACTION: {
1052 data.enforceInterface(IActivityManager.descriptor);
1053 ComponentName className = ComponentName.readFromParcel(data);
1054 String profileFile = data.readString();
1055 int fl = data.readInt();
1056 Bundle arguments = data.readBundle();
1057 IBinder b = data.readStrongBinder();
1058 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001059 b = data.readStrongBinder();
1060 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001061 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001062 String abiOverride = data.readString();
1063 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1064 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001065 reply.writeNoException();
1066 reply.writeInt(res ? 1 : 0);
1067 return true;
1068 }
1069
1070
1071 case FINISH_INSTRUMENTATION_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 IBinder b = data.readStrongBinder();
1074 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1075 int resultCode = data.readInt();
1076 Bundle results = data.readBundle();
1077 finishInstrumentation(app, resultCode, results);
1078 reply.writeNoException();
1079 return true;
1080 }
1081
1082 case GET_CONFIGURATION_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
1084 Configuration config = getConfiguration();
1085 reply.writeNoException();
1086 config.writeToParcel(reply, 0);
1087 return true;
1088 }
1089
1090 case UPDATE_CONFIGURATION_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 Configuration config = Configuration.CREATOR.createFromParcel(data);
1093 updateConfiguration(config);
1094 reply.writeNoException();
1095 return true;
1096 }
1097
1098 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 IBinder token = data.readStrongBinder();
1101 int requestedOrientation = data.readInt();
1102 setRequestedOrientation(token, requestedOrientation);
1103 reply.writeNoException();
1104 return true;
1105 }
1106
1107 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 IBinder token = data.readStrongBinder();
1110 int req = getRequestedOrientation(token);
1111 reply.writeNoException();
1112 reply.writeInt(req);
1113 return true;
1114 }
1115
1116 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 IBinder token = data.readStrongBinder();
1119 ComponentName cn = getActivityClassForToken(token);
1120 reply.writeNoException();
1121 ComponentName.writeToParcel(cn, reply);
1122 return true;
1123 }
1124
1125 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 IBinder token = data.readStrongBinder();
1128 reply.writeNoException();
1129 reply.writeString(getPackageForToken(token));
1130 return true;
1131 }
1132
1133 case GET_INTENT_SENDER_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 int type = data.readInt();
1136 String packageName = data.readString();
1137 IBinder token = data.readStrongBinder();
1138 String resultWho = data.readString();
1139 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001140 Intent[] requestIntents;
1141 String[] requestResolvedTypes;
1142 if (data.readInt() != 0) {
1143 requestIntents = data.createTypedArray(Intent.CREATOR);
1144 requestResolvedTypes = data.createStringArray();
1145 } else {
1146 requestIntents = null;
1147 requestResolvedTypes = null;
1148 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001149 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001150 Bundle options = data.readInt() != 0
1151 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001152 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001153 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001154 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001155 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001156 reply.writeNoException();
1157 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1158 return true;
1159 }
1160
1161 case CANCEL_INTENT_SENDER_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 IIntentSender r = IIntentSender.Stub.asInterface(
1164 data.readStrongBinder());
1165 cancelIntentSender(r);
1166 reply.writeNoException();
1167 return true;
1168 }
1169
1170 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1171 data.enforceInterface(IActivityManager.descriptor);
1172 IIntentSender r = IIntentSender.Stub.asInterface(
1173 data.readStrongBinder());
1174 String res = getPackageForIntentSender(r);
1175 reply.writeNoException();
1176 reply.writeString(res);
1177 return true;
1178 }
1179
Christopher Tatec4a07d12012-04-06 14:19:13 -07001180 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 IIntentSender r = IIntentSender.Stub.asInterface(
1183 data.readStrongBinder());
1184 int res = getUidForIntentSender(r);
1185 reply.writeNoException();
1186 reply.writeInt(res);
1187 return true;
1188 }
1189
Dianne Hackborn41203752012-08-31 14:05:51 -07001190 case HANDLE_INCOMING_USER_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 int callingPid = data.readInt();
1193 int callingUid = data.readInt();
1194 int userId = data.readInt();
1195 boolean allowAll = data.readInt() != 0 ;
1196 boolean requireFull = data.readInt() != 0;
1197 String name = data.readString();
1198 String callerPackage = data.readString();
1199 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1200 requireFull, name, callerPackage);
1201 reply.writeNoException();
1202 reply.writeInt(res);
1203 return true;
1204 }
1205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 case SET_PROCESS_LIMIT_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 int max = data.readInt();
1209 setProcessLimit(max);
1210 reply.writeNoException();
1211 return true;
1212 }
1213
1214 case GET_PROCESS_LIMIT_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 int limit = getProcessLimit();
1217 reply.writeNoException();
1218 reply.writeInt(limit);
1219 return true;
1220 }
1221
1222 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1223 data.enforceInterface(IActivityManager.descriptor);
1224 IBinder token = data.readStrongBinder();
1225 int pid = data.readInt();
1226 boolean isForeground = data.readInt() != 0;
1227 setProcessForeground(token, pid, isForeground);
1228 reply.writeNoException();
1229 return true;
1230 }
1231
1232 case CHECK_PERMISSION_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 String perm = data.readString();
1235 int pid = data.readInt();
1236 int uid = data.readInt();
1237 int res = checkPermission(perm, pid, uid);
1238 reply.writeNoException();
1239 reply.writeInt(res);
1240 return true;
1241 }
1242
Dianne Hackbornff170242014-11-19 10:59:01 -08001243 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1244 data.enforceInterface(IActivityManager.descriptor);
1245 String perm = data.readString();
1246 int pid = data.readInt();
1247 int uid = data.readInt();
1248 IBinder token = data.readStrongBinder();
1249 int res = checkPermissionWithToken(perm, pid, uid, token);
1250 reply.writeNoException();
1251 reply.writeInt(res);
1252 return true;
1253 }
1254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001255 case CHECK_URI_PERMISSION_TRANSACTION: {
1256 data.enforceInterface(IActivityManager.descriptor);
1257 Uri uri = Uri.CREATOR.createFromParcel(data);
1258 int pid = data.readInt();
1259 int uid = data.readInt();
1260 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001261 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001262 IBinder callerToken = data.readStrongBinder();
1263 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001264 reply.writeNoException();
1265 reply.writeInt(res);
1266 return true;
1267 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001268
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001270 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 String packageName = data.readString();
1272 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1273 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001274 int userId = data.readInt();
1275 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001276 reply.writeNoException();
1277 reply.writeInt(res ? 1 : 0);
1278 return true;
1279 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001280
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001281 case GRANT_URI_PERMISSION_TRANSACTION: {
1282 data.enforceInterface(IActivityManager.descriptor);
1283 IBinder b = data.readStrongBinder();
1284 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1285 String targetPkg = data.readString();
1286 Uri uri = Uri.CREATOR.createFromParcel(data);
1287 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001288 int userId = data.readInt();
1289 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001290 reply.writeNoException();
1291 return true;
1292 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001294 case REVOKE_URI_PERMISSION_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 IBinder b = data.readStrongBinder();
1297 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1298 Uri uri = Uri.CREATOR.createFromParcel(data);
1299 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001300 int userId = data.readInt();
1301 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001302 reply.writeNoException();
1303 return true;
1304 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001305
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001306 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 Uri uri = Uri.CREATOR.createFromParcel(data);
1309 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001310 int userId = data.readInt();
1311 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001312 reply.writeNoException();
1313 return true;
1314 }
1315
1316 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 Uri uri = Uri.CREATOR.createFromParcel(data);
1319 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001320 int userId = data.readInt();
1321 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001322 reply.writeNoException();
1323 return true;
1324 }
1325
1326 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001328 final String packageName = data.readString();
1329 final boolean incoming = data.readInt() != 0;
1330 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1331 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001332 reply.writeNoException();
1333 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1334 return true;
1335 }
1336
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1338 data.enforceInterface(IActivityManager.descriptor);
1339 IBinder b = data.readStrongBinder();
1340 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1341 boolean waiting = data.readInt() != 0;
1342 showWaitingForDebugger(app, waiting);
1343 reply.writeNoException();
1344 return true;
1345 }
1346
1347 case GET_MEMORY_INFO_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1350 getMemoryInfo(mi);
1351 reply.writeNoException();
1352 mi.writeToParcel(reply, 0);
1353 return true;
1354 }
1355
1356 case UNHANDLED_BACK_TRANSACTION: {
1357 data.enforceInterface(IActivityManager.descriptor);
1358 unhandledBack();
1359 reply.writeNoException();
1360 return true;
1361 }
1362
1363 case OPEN_CONTENT_URI_TRANSACTION: {
1364 data.enforceInterface(IActivityManager.descriptor);
1365 Uri uri = Uri.parse(data.readString());
1366 ParcelFileDescriptor pfd = openContentUri(uri);
1367 reply.writeNoException();
1368 if (pfd != null) {
1369 reply.writeInt(1);
1370 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1371 } else {
1372 reply.writeInt(0);
1373 }
1374 return true;
1375 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001376
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001377 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1378 data.enforceInterface(IActivityManager.descriptor);
1379 setLockScreenShown(data.readInt() != 0);
1380 reply.writeNoException();
1381 return true;
1382 }
1383
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 case SET_DEBUG_APP_TRANSACTION: {
1385 data.enforceInterface(IActivityManager.descriptor);
1386 String pn = data.readString();
1387 boolean wfd = data.readInt() != 0;
1388 boolean per = data.readInt() != 0;
1389 setDebugApp(pn, wfd, per);
1390 reply.writeNoException();
1391 return true;
1392 }
1393
1394 case SET_ALWAYS_FINISH_TRANSACTION: {
1395 data.enforceInterface(IActivityManager.descriptor);
1396 boolean enabled = data.readInt() != 0;
1397 setAlwaysFinish(enabled);
1398 reply.writeNoException();
1399 return true;
1400 }
1401
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001402 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001403 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001404 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001405 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001406 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001407 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001408 return true;
1409 }
1410
1411 case ENTER_SAFE_MODE_TRANSACTION: {
1412 data.enforceInterface(IActivityManager.descriptor);
1413 enterSafeMode();
1414 reply.writeNoException();
1415 return true;
1416 }
1417
1418 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 IIntentSender is = IIntentSender.Stub.asInterface(
1421 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001422 int sourceUid = data.readInt();
1423 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001424 String tag = data.readString();
1425 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1426 reply.writeNoException();
1427 return true;
1428 }
1429
1430 case NOTE_ALARM_START_TRANSACTION: {
1431 data.enforceInterface(IActivityManager.descriptor);
1432 IIntentSender is = IIntentSender.Stub.asInterface(
1433 data.readStrongBinder());
1434 int sourceUid = data.readInt();
1435 String tag = data.readString();
1436 noteAlarmStart(is, sourceUid, tag);
1437 reply.writeNoException();
1438 return true;
1439 }
1440
1441 case NOTE_ALARM_FINISH_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 IIntentSender is = IIntentSender.Stub.asInterface(
1444 data.readStrongBinder());
1445 int sourceUid = data.readInt();
1446 String tag = data.readString();
1447 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001448 reply.writeNoException();
1449 return true;
1450 }
1451
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001452 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001453 data.enforceInterface(IActivityManager.descriptor);
1454 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001455 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001456 boolean secure = data.readInt() != 0;
1457 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 reply.writeNoException();
1459 reply.writeInt(res ? 1 : 0);
1460 return true;
1461 }
1462
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001463 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1464 data.enforceInterface(IActivityManager.descriptor);
1465 String reason = data.readString();
1466 boolean res = killProcessesBelowForeground(reason);
1467 reply.writeNoException();
1468 reply.writeInt(res ? 1 : 0);
1469 return true;
1470 }
1471
Dan Egnor60d87622009-12-16 16:32:58 -08001472 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1473 data.enforceInterface(IActivityManager.descriptor);
1474 IBinder app = data.readStrongBinder();
1475 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1476 handleApplicationCrash(app, ci);
1477 reply.writeNoException();
1478 return true;
1479 }
1480
1481 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001482 data.enforceInterface(IActivityManager.descriptor);
1483 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001484 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001485 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001486 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001487 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001488 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001489 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001490 return true;
1491 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001492
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001493 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
1495 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001496 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001497 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1498 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001499 reply.writeNoException();
1500 return true;
1501 }
1502
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001503 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1504 data.enforceInterface(IActivityManager.descriptor);
1505 int sig = data.readInt();
1506 signalPersistentProcesses(sig);
1507 reply.writeNoException();
1508 return true;
1509 }
1510
Dianne Hackborn03abb812010-01-04 18:43:19 -08001511 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1512 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001513 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001514 int userId = data.readInt();
1515 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001516 reply.writeNoException();
1517 return true;
1518 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001519
1520 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1521 data.enforceInterface(IActivityManager.descriptor);
1522 killAllBackgroundProcesses();
1523 reply.writeNoException();
1524 return true;
1525 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001526
Dianne Hackborn03abb812010-01-04 18:43:19 -08001527 case FORCE_STOP_PACKAGE_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
1529 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001530 int userId = data.readInt();
1531 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001532 reply.writeNoException();
1533 return true;
1534 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001535
1536 case GET_MY_MEMORY_STATE_TRANSACTION: {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 ActivityManager.RunningAppProcessInfo info =
1539 new ActivityManager.RunningAppProcessInfo();
1540 getMyMemoryState(info);
1541 reply.writeNoException();
1542 info.writeToParcel(reply, 0);
1543 return true;
1544 }
1545
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001546 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 ConfigurationInfo config = getDeviceConfigurationInfo();
1549 reply.writeNoException();
1550 config.writeToParcel(reply, 0);
1551 return true;
1552 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001553
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001554 case PROFILE_CONTROL_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001557 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001558 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001559 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001560 ProfilerInfo profilerInfo = data.readInt() != 0
1561 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1562 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001563 reply.writeNoException();
1564 reply.writeInt(res ? 1 : 0);
1565 return true;
1566 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001567
Dianne Hackborn55280a92009-05-07 15:53:46 -07001568 case SHUTDOWN_TRANSACTION: {
1569 data.enforceInterface(IActivityManager.descriptor);
1570 boolean res = shutdown(data.readInt());
1571 reply.writeNoException();
1572 reply.writeInt(res ? 1 : 0);
1573 return true;
1574 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001575
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001576 case STOP_APP_SWITCHES_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 stopAppSwitches();
1579 reply.writeNoException();
1580 return true;
1581 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001582
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001583 case RESUME_APP_SWITCHES_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 resumeAppSwitches();
1586 reply.writeNoException();
1587 return true;
1588 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001590 case PEEK_SERVICE_TRANSACTION: {
1591 data.enforceInterface(IActivityManager.descriptor);
1592 Intent service = Intent.CREATOR.createFromParcel(data);
1593 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001594 String callingPackage = data.readString();
1595 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001596 reply.writeNoException();
1597 reply.writeStrongBinder(binder);
1598 return true;
1599 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001600
Christopher Tate181fafa2009-05-14 11:12:14 -07001601 case START_BACKUP_AGENT_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1604 int backupRestoreMode = data.readInt();
1605 boolean success = bindBackupAgent(info, backupRestoreMode);
1606 reply.writeNoException();
1607 reply.writeInt(success ? 1 : 0);
1608 return true;
1609 }
1610
1611 case BACKUP_AGENT_CREATED_TRANSACTION: {
1612 data.enforceInterface(IActivityManager.descriptor);
1613 String packageName = data.readString();
1614 IBinder agent = data.readStrongBinder();
1615 backupAgentCreated(packageName, agent);
1616 reply.writeNoException();
1617 return true;
1618 }
1619
1620 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1621 data.enforceInterface(IActivityManager.descriptor);
1622 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1623 unbindBackupAgent(info);
1624 reply.writeNoException();
1625 return true;
1626 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001627
1628 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 String packageName = data.readString();
1631 addPackageDependency(packageName);
1632 reply.writeNoException();
1633 return true;
1634 }
1635
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001636 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001637 data.enforceInterface(IActivityManager.descriptor);
1638 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001639 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001640 String reason = data.readString();
1641 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001642 reply.writeNoException();
1643 return true;
1644 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001645
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001646 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1647 data.enforceInterface(IActivityManager.descriptor);
1648 String reason = data.readString();
1649 closeSystemDialogs(reason);
1650 reply.writeNoException();
1651 return true;
1652 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001653
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001654 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001656 int[] pids = data.createIntArray();
1657 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001658 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001659 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001660 return true;
1661 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001662
1663 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 String processName = data.readString();
1666 int uid = data.readInt();
1667 killApplicationProcess(processName, uid);
1668 reply.writeNoException();
1669 return true;
1670 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001671
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001672 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 IBinder token = data.readStrongBinder();
1675 String packageName = data.readString();
1676 int enterAnim = data.readInt();
1677 int exitAnim = data.readInt();
1678 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001679 reply.writeNoException();
1680 return true;
1681 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001682
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001683 case IS_USER_A_MONKEY_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001685 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001686 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001687 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001688 return true;
1689 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001690
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001691 case SET_USER_IS_MONKEY_TRANSACTION: {
1692 data.enforceInterface(IActivityManager.descriptor);
1693 final boolean monkey = (data.readInt() == 1);
1694 setUserIsMonkey(monkey);
1695 reply.writeNoException();
1696 return true;
1697 }
1698
Dianne Hackborn860755f2010-06-03 18:47:52 -07001699 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1700 data.enforceInterface(IActivityManager.descriptor);
1701 finishHeavyWeightApp();
1702 reply.writeNoException();
1703 return true;
1704 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001705
1706 case IS_IMMERSIVE_TRANSACTION: {
1707 data.enforceInterface(IActivityManager.descriptor);
1708 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001709 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001710 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001711 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001712 return true;
1713 }
1714
Craig Mautnerd61dc202014-07-07 11:09:11 -07001715 case IS_TOP_OF_TASK_TRANSACTION: {
1716 data.enforceInterface(IActivityManager.descriptor);
1717 IBinder token = data.readStrongBinder();
1718 final boolean isTopOfTask = isTopOfTask(token);
1719 reply.writeNoException();
1720 reply.writeInt(isTopOfTask ? 1 : 0);
1721 return true;
1722 }
1723
Craig Mautner5eda9b32013-07-02 11:58:16 -07001724 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001725 data.enforceInterface(IActivityManager.descriptor);
1726 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001727 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001728 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001729 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001730 return true;
1731 }
1732
1733 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001736 final Bundle bundle;
1737 if (data.readInt() == 0) {
1738 bundle = null;
1739 } else {
1740 bundle = data.readBundle();
1741 }
1742 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1743 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001744 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001745 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001746 return true;
1747 }
1748
Craig Mautner233ceee2014-05-09 17:05:11 -07001749 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1750 data.enforceInterface(IActivityManager.descriptor);
1751 IBinder token = data.readStrongBinder();
1752 final ActivityOptions options = getActivityOptions(token);
1753 reply.writeNoException();
1754 reply.writeBundle(options == null ? null : options.toBundle());
1755 return true;
1756 }
1757
Daniel Sandler69a48172010-06-23 16:29:36 -04001758 case SET_IMMERSIVE_TRANSACTION: {
1759 data.enforceInterface(IActivityManager.descriptor);
1760 IBinder token = data.readStrongBinder();
1761 boolean imm = data.readInt() == 1;
1762 setImmersive(token, imm);
1763 reply.writeNoException();
1764 return true;
1765 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001766
Daniel Sandler69a48172010-06-23 16:29:36 -04001767 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1768 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001769 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001770 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001771 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001772 return true;
1773 }
1774
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001775 case CRASH_APPLICATION_TRANSACTION: {
1776 data.enforceInterface(IActivityManager.descriptor);
1777 int uid = data.readInt();
1778 int initialPid = data.readInt();
1779 String packageName = data.readString();
1780 String message = data.readString();
1781 crashApplication(uid, initialPid, packageName, message);
1782 reply.writeNoException();
1783 return true;
1784 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001785
1786 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1787 data.enforceInterface(IActivityManager.descriptor);
1788 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001789 int userId = data.readInt();
1790 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001791 reply.writeNoException();
1792 reply.writeString(type);
1793 return true;
1794 }
1795
Dianne Hackborn7e269642010-08-25 19:50:20 -07001796 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
1798 String name = data.readString();
1799 IBinder perm = newUriPermissionOwner(name);
1800 reply.writeNoException();
1801 reply.writeStrongBinder(perm);
1802 return true;
1803 }
1804
1805 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1806 data.enforceInterface(IActivityManager.descriptor);
1807 IBinder owner = data.readStrongBinder();
1808 int fromUid = data.readInt();
1809 String targetPkg = data.readString();
1810 Uri uri = Uri.CREATOR.createFromParcel(data);
1811 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001812 int sourceUserId = data.readInt();
1813 int targetUserId = data.readInt();
1814 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1815 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001816 reply.writeNoException();
1817 return true;
1818 }
1819
1820 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 IBinder owner = data.readStrongBinder();
1823 Uri uri = null;
1824 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001825 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001826 }
1827 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001828 int userId = data.readInt();
1829 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001830 reply.writeNoException();
1831 return true;
1832 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001833
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001834 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1835 data.enforceInterface(IActivityManager.descriptor);
1836 int callingUid = data.readInt();
1837 String targetPkg = data.readString();
1838 Uri uri = Uri.CREATOR.createFromParcel(data);
1839 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001840 int userId = data.readInt();
1841 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001842 reply.writeNoException();
1843 reply.writeInt(res);
1844 return true;
1845 }
1846
Andy McFadden824c5102010-07-09 16:26:57 -07001847 case DUMP_HEAP_TRANSACTION: {
1848 data.enforceInterface(IActivityManager.descriptor);
1849 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001850 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001851 boolean managed = data.readInt() != 0;
1852 String path = data.readString();
1853 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001854 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001855 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001856 reply.writeNoException();
1857 reply.writeInt(res ? 1 : 0);
1858 return true;
1859 }
1860
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001861 case START_ACTIVITIES_TRANSACTION:
1862 {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 IBinder b = data.readStrongBinder();
1865 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001866 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001867 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1868 String[] resolvedTypes = data.createStringArray();
1869 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001870 Bundle options = data.readInt() != 0
1871 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001872 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001873 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001874 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001875 reply.writeNoException();
1876 reply.writeInt(result);
1877 return true;
1878 }
1879
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001880 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1881 {
1882 data.enforceInterface(IActivityManager.descriptor);
1883 int mode = getFrontActivityScreenCompatMode();
1884 reply.writeNoException();
1885 reply.writeInt(mode);
1886 return true;
1887 }
1888
1889 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1890 {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 int mode = data.readInt();
1893 setFrontActivityScreenCompatMode(mode);
1894 reply.writeNoException();
1895 reply.writeInt(mode);
1896 return true;
1897 }
1898
1899 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1900 {
1901 data.enforceInterface(IActivityManager.descriptor);
1902 String pkg = data.readString();
1903 int mode = getPackageScreenCompatMode(pkg);
1904 reply.writeNoException();
1905 reply.writeInt(mode);
1906 return true;
1907 }
1908
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001909 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1910 {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001913 int mode = data.readInt();
1914 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001915 reply.writeNoException();
1916 return true;
1917 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001918
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001919 case SWITCH_USER_TRANSACTION: {
1920 data.enforceInterface(IActivityManager.descriptor);
1921 int userid = data.readInt();
1922 boolean result = switchUser(userid);
1923 reply.writeNoException();
1924 reply.writeInt(result ? 1 : 0);
1925 return true;
1926 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001927
Kenny Guy08488bf2014-02-21 17:40:37 +00001928 case START_USER_IN_BACKGROUND_TRANSACTION: {
1929 data.enforceInterface(IActivityManager.descriptor);
1930 int userid = data.readInt();
1931 boolean result = startUserInBackground(userid);
1932 reply.writeNoException();
1933 reply.writeInt(result ? 1 : 0);
1934 return true;
1935 }
1936
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001937 case STOP_USER_TRANSACTION: {
1938 data.enforceInterface(IActivityManager.descriptor);
1939 int userid = data.readInt();
1940 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1941 data.readStrongBinder());
1942 int result = stopUser(userid, callback);
1943 reply.writeNoException();
1944 reply.writeInt(result);
1945 return true;
1946 }
1947
Amith Yamasani52f1d752012-03-28 18:19:29 -07001948 case GET_CURRENT_USER_TRANSACTION: {
1949 data.enforceInterface(IActivityManager.descriptor);
1950 UserInfo userInfo = getCurrentUser();
1951 reply.writeNoException();
1952 userInfo.writeToParcel(reply, 0);
1953 return true;
1954 }
1955
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001956 case IS_USER_RUNNING_TRANSACTION: {
1957 data.enforceInterface(IActivityManager.descriptor);
1958 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001959 boolean orStopping = data.readInt() != 0;
1960 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001961 reply.writeNoException();
1962 reply.writeInt(result ? 1 : 0);
1963 return true;
1964 }
1965
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001966 case GET_RUNNING_USER_IDS_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 int[] result = getRunningUserIds();
1969 reply.writeNoException();
1970 reply.writeIntArray(result);
1971 return true;
1972 }
1973
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001974 case REMOVE_TASK_TRANSACTION:
1975 {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001978 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001979 reply.writeNoException();
1980 reply.writeInt(result ? 1 : 0);
1981 return true;
1982 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001983
Jeff Sharkeya4620792011-05-20 15:29:23 -07001984 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1987 data.readStrongBinder());
1988 registerProcessObserver(observer);
1989 return true;
1990 }
1991
1992 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1995 data.readStrongBinder());
1996 unregisterProcessObserver(observer);
1997 return true;
1998 }
1999
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002000 case REGISTER_UID_OBSERVER_TRANSACTION: {
2001 data.enforceInterface(IActivityManager.descriptor);
2002 IUidObserver observer = IUidObserver.Stub.asInterface(
2003 data.readStrongBinder());
2004 registerUidObserver(observer);
2005 return true;
2006 }
2007
2008 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2009 data.enforceInterface(IActivityManager.descriptor);
2010 IUidObserver observer = IUidObserver.Stub.asInterface(
2011 data.readStrongBinder());
2012 unregisterUidObserver(observer);
2013 return true;
2014 }
2015
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002016 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2017 {
2018 data.enforceInterface(IActivityManager.descriptor);
2019 String pkg = data.readString();
2020 boolean ask = getPackageAskScreenCompat(pkg);
2021 reply.writeNoException();
2022 reply.writeInt(ask ? 1 : 0);
2023 return true;
2024 }
2025
2026 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2027 {
2028 data.enforceInterface(IActivityManager.descriptor);
2029 String pkg = data.readString();
2030 boolean ask = data.readInt() != 0;
2031 setPackageAskScreenCompat(pkg, ask);
2032 reply.writeNoException();
2033 return true;
2034 }
2035
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002036 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2037 data.enforceInterface(IActivityManager.descriptor);
2038 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002039 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002040 boolean res = isIntentSenderTargetedToPackage(r);
2041 reply.writeNoException();
2042 reply.writeInt(res ? 1 : 0);
2043 return true;
2044 }
2045
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002046 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 IIntentSender r = IIntentSender.Stub.asInterface(
2049 data.readStrongBinder());
2050 boolean res = isIntentSenderAnActivity(r);
2051 reply.writeNoException();
2052 reply.writeInt(res ? 1 : 0);
2053 return true;
2054 }
2055
Dianne Hackborn81038902012-11-26 17:04:09 -08002056 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2057 data.enforceInterface(IActivityManager.descriptor);
2058 IIntentSender r = IIntentSender.Stub.asInterface(
2059 data.readStrongBinder());
2060 Intent intent = getIntentForIntentSender(r);
2061 reply.writeNoException();
2062 if (intent != null) {
2063 reply.writeInt(1);
2064 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2065 } else {
2066 reply.writeInt(0);
2067 }
2068 return true;
2069 }
2070
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002071 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2072 data.enforceInterface(IActivityManager.descriptor);
2073 IIntentSender r = IIntentSender.Stub.asInterface(
2074 data.readStrongBinder());
2075 String prefix = data.readString();
2076 String tag = getTagForIntentSender(r, prefix);
2077 reply.writeNoException();
2078 reply.writeString(tag);
2079 return true;
2080 }
2081
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002082 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2083 data.enforceInterface(IActivityManager.descriptor);
2084 Configuration config = Configuration.CREATOR.createFromParcel(data);
2085 updatePersistentConfiguration(config);
2086 reply.writeNoException();
2087 return true;
2088 }
2089
Dianne Hackbornb437e092011-08-05 17:50:29 -07002090 case GET_PROCESS_PSS_TRANSACTION: {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 int[] pids = data.createIntArray();
2093 long[] pss = getProcessPss(pids);
2094 reply.writeNoException();
2095 reply.writeLongArray(pss);
2096 return true;
2097 }
2098
Dianne Hackborn661cd522011-08-22 00:26:20 -07002099 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2100 data.enforceInterface(IActivityManager.descriptor);
2101 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2102 boolean always = data.readInt() != 0;
2103 showBootMessage(msg, always);
2104 reply.writeNoException();
2105 return true;
2106 }
2107
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002108 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002109 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002110 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002111 reply.writeNoException();
2112 return true;
2113 }
2114
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002115 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2118 reply.writeNoException();
2119 return true;
2120 }
2121
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002122 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002123 data.enforceInterface(IActivityManager.descriptor);
2124 IBinder token = data.readStrongBinder();
2125 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002126 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002127 reply.writeNoException();
2128 reply.writeInt(res ? 1 : 0);
2129 return true;
2130 }
2131
2132 case NAVIGATE_UP_TO_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 IBinder token = data.readStrongBinder();
2135 Intent target = Intent.CREATOR.createFromParcel(data);
2136 int resultCode = data.readInt();
2137 Intent resultData = null;
2138 if (data.readInt() != 0) {
2139 resultData = Intent.CREATOR.createFromParcel(data);
2140 }
2141 boolean res = navigateUpTo(token, target, resultCode, resultData);
2142 reply.writeNoException();
2143 reply.writeInt(res ? 1 : 0);
2144 return true;
2145 }
2146
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002147 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2148 data.enforceInterface(IActivityManager.descriptor);
2149 IBinder token = data.readStrongBinder();
2150 int res = getLaunchedFromUid(token);
2151 reply.writeNoException();
2152 reply.writeInt(res);
2153 return true;
2154 }
2155
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002156 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2157 data.enforceInterface(IActivityManager.descriptor);
2158 IBinder token = data.readStrongBinder();
2159 String res = getLaunchedFromPackage(token);
2160 reply.writeNoException();
2161 reply.writeString(res);
2162 return true;
2163 }
2164
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002165 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2168 data.readStrongBinder());
2169 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002170 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002171 return true;
2172 }
2173
2174 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2175 data.enforceInterface(IActivityManager.descriptor);
2176 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2177 data.readStrongBinder());
2178 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002179 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002180 return true;
2181 }
2182
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002183 case REQUEST_BUG_REPORT_TRANSACTION: {
2184 data.enforceInterface(IActivityManager.descriptor);
2185 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002186 reply.writeNoException();
2187 return true;
2188 }
2189
2190 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2191 data.enforceInterface(IActivityManager.descriptor);
2192 int pid = data.readInt();
2193 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002194 String reason = data.readString();
2195 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002196 reply.writeNoException();
2197 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002198 return true;
2199 }
2200
Adam Skorydfc7fd72013-08-05 19:23:41 -07002201 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002202 data.enforceInterface(IActivityManager.descriptor);
2203 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002204 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002205 reply.writeNoException();
2206 reply.writeBundle(res);
2207 return true;
2208 }
2209
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002210 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2211 data.enforceInterface(IActivityManager.descriptor);
2212 int requestType = data.readInt();
2213 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002214 IBinder activityToken = data.readStrongBinder();
2215 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002216 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002217 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002218 return true;
2219 }
2220
Adam Skorydfc7fd72013-08-05 19:23:41 -07002221 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002222 data.enforceInterface(IActivityManager.descriptor);
2223 IBinder token = data.readStrongBinder();
2224 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002225 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2226 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002227 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2228 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002229 reply.writeNoException();
2230 return true;
2231 }
2232
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002233 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2234 data.enforceInterface(IActivityManager.descriptor);
2235 Intent intent = Intent.CREATOR.createFromParcel(data);
2236 int requestType = data.readInt();
2237 String hint = data.readString();
2238 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002239 Bundle args = data.readBundle();
2240 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002241 reply.writeNoException();
2242 reply.writeInt(res ? 1 : 0);
2243 return true;
2244 }
2245
Benjamin Franzc200f442015-06-25 18:20:04 +01002246 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2247 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002248 boolean res = isAssistDataAllowedOnCurrentActivity();
2249 reply.writeNoException();
2250 reply.writeInt(res ? 1 : 0);
2251 return true;
2252 }
2253
2254 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2255 data.enforceInterface(IActivityManager.descriptor);
2256 IBinder token = data.readStrongBinder();
2257 Bundle args = data.readBundle();
2258 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002259 reply.writeNoException();
2260 reply.writeInt(res ? 1 : 0);
2261 return true;
2262 }
2263
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002264 case KILL_UID_TRANSACTION: {
2265 data.enforceInterface(IActivityManager.descriptor);
2266 int uid = data.readInt();
2267 String reason = data.readString();
2268 killUid(uid, reason);
2269 reply.writeNoException();
2270 return true;
2271 }
2272
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002273 case HANG_TRANSACTION: {
2274 data.enforceInterface(IActivityManager.descriptor);
2275 IBinder who = data.readStrongBinder();
2276 boolean allowRestart = data.readInt() != 0;
2277 hang(who, allowRestart);
2278 reply.writeNoException();
2279 return true;
2280 }
2281
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002282 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2283 data.enforceInterface(IActivityManager.descriptor);
2284 IBinder token = data.readStrongBinder();
2285 reportActivityFullyDrawn(token);
2286 reply.writeNoException();
2287 return true;
2288 }
2289
Craig Mautner5eda9b32013-07-02 11:58:16 -07002290 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2291 data.enforceInterface(IActivityManager.descriptor);
2292 IBinder token = data.readStrongBinder();
2293 notifyActivityDrawn(token);
2294 reply.writeNoException();
2295 return true;
2296 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002297
2298 case RESTART_TRANSACTION: {
2299 data.enforceInterface(IActivityManager.descriptor);
2300 restart();
2301 reply.writeNoException();
2302 return true;
2303 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002304
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002305 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2306 data.enforceInterface(IActivityManager.descriptor);
2307 performIdleMaintenance();
2308 reply.writeNoException();
2309 return true;
2310 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002311
Todd Kennedyca4d8422015-01-15 15:19:22 -08002312 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002313 data.enforceInterface(IActivityManager.descriptor);
2314 IBinder parentActivityToken = data.readStrongBinder();
2315 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002316 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002317 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002318 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002319 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002320 if (activityContainer != null) {
2321 reply.writeInt(1);
2322 reply.writeStrongBinder(activityContainer.asBinder());
2323 } else {
2324 reply.writeInt(0);
2325 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002326 return true;
2327 }
2328
Craig Mautner95da1082014-02-24 17:54:35 -08002329 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2330 data.enforceInterface(IActivityManager.descriptor);
2331 IActivityContainer activityContainer =
2332 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2333 deleteActivityContainer(activityContainer);
2334 reply.writeNoException();
2335 return true;
2336 }
2337
Todd Kennedy4900bf92015-01-16 16:05:14 -08002338 case CREATE_STACK_ON_DISPLAY: {
2339 data.enforceInterface(IActivityManager.descriptor);
2340 int displayId = data.readInt();
2341 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2342 reply.writeNoException();
2343 if (activityContainer != null) {
2344 reply.writeInt(1);
2345 reply.writeStrongBinder(activityContainer.asBinder());
2346 } else {
2347 reply.writeInt(0);
2348 }
2349 return true;
2350 }
2351
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002352 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002353 data.enforceInterface(IActivityManager.descriptor);
2354 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002355 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002356 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002357 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002358 return true;
2359 }
2360
Craig Mautneraea74a52014-03-08 14:23:10 -08002361 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2362 data.enforceInterface(IActivityManager.descriptor);
2363 final int taskId = data.readInt();
2364 startLockTaskMode(taskId);
2365 reply.writeNoException();
2366 return true;
2367 }
2368
2369 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2370 data.enforceInterface(IActivityManager.descriptor);
2371 IBinder token = data.readStrongBinder();
2372 startLockTaskMode(token);
2373 reply.writeNoException();
2374 return true;
2375 }
2376
Craig Mautnerd61dc202014-07-07 11:09:11 -07002377 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002378 data.enforceInterface(IActivityManager.descriptor);
2379 startLockTaskModeOnCurrent();
2380 reply.writeNoException();
2381 return true;
2382 }
2383
Craig Mautneraea74a52014-03-08 14:23:10 -08002384 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2385 data.enforceInterface(IActivityManager.descriptor);
2386 stopLockTaskMode();
2387 reply.writeNoException();
2388 return true;
2389 }
2390
Craig Mautnerd61dc202014-07-07 11:09:11 -07002391 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002392 data.enforceInterface(IActivityManager.descriptor);
2393 stopLockTaskModeOnCurrent();
2394 reply.writeNoException();
2395 return true;
2396 }
2397
Craig Mautneraea74a52014-03-08 14:23:10 -08002398 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2399 data.enforceInterface(IActivityManager.descriptor);
2400 final boolean isInLockTaskMode = isInLockTaskMode();
2401 reply.writeNoException();
2402 reply.writeInt(isInLockTaskMode ? 1 : 0);
2403 return true;
2404 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002405
Benjamin Franz43261142015-02-11 15:59:44 +00002406 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2407 data.enforceInterface(IActivityManager.descriptor);
2408 final int lockTaskModeState = getLockTaskModeState();
2409 reply.writeNoException();
2410 reply.writeInt(lockTaskModeState);
2411 return true;
2412 }
2413
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002414 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2415 data.enforceInterface(IActivityManager.descriptor);
2416 final IBinder token = data.readStrongBinder();
2417 showLockTaskEscapeMessage(token);
2418 reply.writeNoException();
2419 return true;
2420 }
2421
Winson Chunga449dc02014-05-16 11:15:04 -07002422 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002423 data.enforceInterface(IActivityManager.descriptor);
2424 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002425 ActivityManager.TaskDescription values =
2426 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2427 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002428 reply.writeNoException();
2429 return true;
2430 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002431
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002432 case SET_TASK_RESIZEABLE_TRANSACTION: {
2433 data.enforceInterface(IActivityManager.descriptor);
2434 int taskId = data.readInt();
2435 boolean resizeable = (data.readInt() == 1) ? true : false;
2436 setTaskResizeable(taskId, resizeable);
2437 reply.writeNoException();
2438 return true;
2439 }
2440
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002441 case RESIZE_TASK_TRANSACTION: {
2442 data.enforceInterface(IActivityManager.descriptor);
2443 int taskId = data.readInt();
2444 Rect r = Rect.CREATOR.createFromParcel(data);
2445 resizeTask(taskId, r);
2446 reply.writeNoException();
2447 return true;
2448 }
2449
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002450 case GET_TASK_BOUNDS_TRANSACTION: {
2451 data.enforceInterface(IActivityManager.descriptor);
2452 int taskId = data.readInt();
2453 Rect r = getTaskBounds(taskId);
2454 reply.writeNoException();
2455 r.writeToParcel(reply, 0);
2456 return true;
2457 }
2458
Craig Mautner648f69b2014-09-18 14:16:26 -07002459 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2460 data.enforceInterface(IActivityManager.descriptor);
2461 String filename = data.readString();
2462 Bitmap icon = getTaskDescriptionIcon(filename);
2463 reply.writeNoException();
2464 if (icon == null) {
2465 reply.writeInt(0);
2466 } else {
2467 reply.writeInt(1);
2468 icon.writeToParcel(reply, 0);
2469 }
2470 return true;
2471 }
2472
Winson Chung044d5292014-11-06 11:05:19 -08002473 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2474 data.enforceInterface(IActivityManager.descriptor);
2475 final Bundle bundle;
2476 if (data.readInt() == 0) {
2477 bundle = null;
2478 } else {
2479 bundle = data.readBundle();
2480 }
2481 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2482 startInPlaceAnimationOnFrontMostApplication(options);
2483 reply.writeNoException();
2484 return true;
2485 }
2486
Jose Lima4b6c6692014-08-12 17:41:12 -07002487 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002488 data.enforceInterface(IActivityManager.descriptor);
2489 IBinder token = data.readStrongBinder();
2490 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002491 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002492 reply.writeNoException();
2493 reply.writeInt(success ? 1 : 0);
2494 return true;
2495 }
2496
Jose Lima4b6c6692014-08-12 17:41:12 -07002497 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002498 data.enforceInterface(IActivityManager.descriptor);
2499 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002500 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002501 reply.writeNoException();
2502 reply.writeInt(enabled ? 1 : 0);
2503 return true;
2504 }
2505
Jose Lima4b6c6692014-08-12 17:41:12 -07002506 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002507 data.enforceInterface(IActivityManager.descriptor);
2508 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002509 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002510 reply.writeNoException();
2511 return true;
2512 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002513
2514 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2515 data.enforceInterface(IActivityManager.descriptor);
2516 IBinder token = data.readStrongBinder();
2517 notifyLaunchTaskBehindComplete(token);
2518 reply.writeNoException();
2519 return true;
2520 }
Craig Mautner8746a472014-07-24 15:12:54 -07002521
2522 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2523 data.enforceInterface(IActivityManager.descriptor);
2524 IBinder token = data.readStrongBinder();
2525 notifyEnterAnimationComplete(token);
2526 reply.writeNoException();
2527 return true;
2528 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002529
2530 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2531 data.enforceInterface(IActivityManager.descriptor);
2532 bootAnimationComplete();
2533 reply.writeNoException();
2534 return true;
2535 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002536
Jeff Sharkey605eb792014-11-04 13:34:06 -08002537 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2538 data.enforceInterface(IActivityManager.descriptor);
2539 final int uid = data.readInt();
2540 final byte[] firstPacket = data.createByteArray();
2541 notifyCleartextNetwork(uid, firstPacket);
2542 reply.writeNoException();
2543 return true;
2544 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002545
2546 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2547 data.enforceInterface(IActivityManager.descriptor);
2548 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002549 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002550 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002551 String reportPackage = data.readString();
2552 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002553 reply.writeNoException();
2554 return true;
2555 }
2556
2557 case DUMP_HEAP_FINISHED_TRANSACTION: {
2558 data.enforceInterface(IActivityManager.descriptor);
2559 String path = data.readString();
2560 dumpHeapFinished(path);
2561 reply.writeNoException();
2562 return true;
2563 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002564
2565 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2566 data.enforceInterface(IActivityManager.descriptor);
2567 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2568 data.readStrongBinder());
2569 boolean keepAwake = data.readInt() != 0;
2570 setVoiceKeepAwake(session, keepAwake);
2571 reply.writeNoException();
2572 return true;
2573 }
Craig Mautnere5600772015-04-03 21:36:37 -07002574
2575 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2576 data.enforceInterface(IActivityManager.descriptor);
2577 int userId = data.readInt();
2578 String[] packages = data.readStringArray();
2579 updateLockTaskPackages(userId, packages);
2580 reply.writeNoException();
2581 return true;
2582 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002583
Craig Mautner015c5e52015-04-23 10:39:39 -07002584 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2585 data.enforceInterface(IActivityManager.descriptor);
2586 String packageName = data.readString();
2587 updateDeviceOwner(packageName);
2588 reply.writeNoException();
2589 return true;
2590 }
2591
Dianne Hackborn1e383822015-04-10 14:02:33 -07002592 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2593 data.enforceInterface(IActivityManager.descriptor);
2594 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002595 String callingPackage = data.readString();
2596 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002597 reply.writeNoException();
2598 reply.writeInt(res);
2599 return true;
2600 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002601
2602 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2603 data.enforceInterface(IActivityManager.descriptor);
2604 String process = data.readString();
2605 int userId = data.readInt();
2606 int level = data.readInt();
2607 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2608 reply.writeNoException();
2609 reply.writeInt(res ? 1 : 0);
2610 return true;
2611 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002612
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002613 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2614 data.enforceInterface(IActivityManager.descriptor);
2615 IBinder token = data.readStrongBinder();
2616 boolean res = isRootVoiceInteraction(token);
2617 reply.writeNoException();
2618 reply.writeInt(res ? 1 : 0);
2619 return true;
2620 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002621
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002622 case START_BINDER_TRACKING_TRANSACTION: {
2623 data.enforceInterface(IActivityManager.descriptor);
2624 boolean res = startBinderTracking();
2625 reply.writeNoException();
2626 reply.writeInt(res ? 1 : 0);
2627 return true;
2628 }
2629
2630 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2631 data.enforceInterface(IActivityManager.descriptor);
2632 ParcelFileDescriptor fd = data.readInt() != 0
2633 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2634 boolean res = stopBinderTrackingAndDump(fd);
2635 reply.writeNoException();
2636 reply.writeInt(res ? 1 : 0);
2637 return true;
2638 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002639 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2640 data.enforceInterface(IActivityManager.descriptor);
2641 IBinder token = data.readStrongBinder();
2642 int stackId = getActivityStackId(token);
2643 reply.writeNoException();
2644 reply.writeInt(stackId);
2645 return true;
2646 }
2647 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2648 data.enforceInterface(IActivityManager.descriptor);
2649 IBinder token = data.readStrongBinder();
2650 int stackId = data.readInt();
2651 moveActivityToStack(token, stackId);
2652 reply.writeNoException();
2653 return true;
2654 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002656
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002657 return super.onTransact(code, data, reply, flags);
2658 }
2659
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002660 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002661 return this;
2662 }
2663
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002664 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2665 protected IActivityManager create() {
2666 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002667 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002668 Log.v("ActivityManager", "default service binder = " + b);
2669 }
2670 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002671 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002672 Log.v("ActivityManager", "default service = " + am);
2673 }
2674 return am;
2675 }
2676 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002677}
2678
2679class ActivityManagerProxy implements IActivityManager
2680{
2681 public ActivityManagerProxy(IBinder remote)
2682 {
2683 mRemote = remote;
2684 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002685
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002686 public IBinder asBinder()
2687 {
2688 return mRemote;
2689 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002690
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002691 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002692 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002693 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002694 Parcel data = Parcel.obtain();
2695 Parcel reply = Parcel.obtain();
2696 data.writeInterfaceToken(IActivityManager.descriptor);
2697 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002698 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 intent.writeToParcel(data, 0);
2700 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002701 data.writeStrongBinder(resultTo);
2702 data.writeString(resultWho);
2703 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002704 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002705 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002706 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002707 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002708 } else {
2709 data.writeInt(0);
2710 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002711 if (options != null) {
2712 data.writeInt(1);
2713 options.writeToParcel(data, 0);
2714 } else {
2715 data.writeInt(0);
2716 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002717 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 int result = reply.readInt();
2720 reply.recycle();
2721 data.recycle();
2722 return result;
2723 }
Amith Yamasani82644082012-08-03 13:09:11 -07002724
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002725 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002726 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002727 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2728 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002729 Parcel data = Parcel.obtain();
2730 Parcel reply = Parcel.obtain();
2731 data.writeInterfaceToken(IActivityManager.descriptor);
2732 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002733 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002734 intent.writeToParcel(data, 0);
2735 data.writeString(resolvedType);
2736 data.writeStrongBinder(resultTo);
2737 data.writeString(resultWho);
2738 data.writeInt(requestCode);
2739 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002740 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002741 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002742 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002743 } else {
2744 data.writeInt(0);
2745 }
2746 if (options != null) {
2747 data.writeInt(1);
2748 options.writeToParcel(data, 0);
2749 } else {
2750 data.writeInt(0);
2751 }
2752 data.writeInt(userId);
2753 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2754 reply.readException();
2755 int result = reply.readInt();
2756 reply.recycle();
2757 data.recycle();
2758 return result;
2759 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002760 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2761 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002762 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2763 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002764 Parcel data = Parcel.obtain();
2765 Parcel reply = Parcel.obtain();
2766 data.writeInterfaceToken(IActivityManager.descriptor);
2767 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2768 data.writeString(callingPackage);
2769 intent.writeToParcel(data, 0);
2770 data.writeString(resolvedType);
2771 data.writeStrongBinder(resultTo);
2772 data.writeString(resultWho);
2773 data.writeInt(requestCode);
2774 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002775 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002776 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002777 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002778 } else {
2779 data.writeInt(0);
2780 }
2781 if (options != null) {
2782 data.writeInt(1);
2783 options.writeToParcel(data, 0);
2784 } else {
2785 data.writeInt(0);
2786 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002787 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002788 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002789 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2790 reply.readException();
2791 int result = reply.readInt();
2792 reply.recycle();
2793 data.recycle();
2794 return result;
2795 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002796 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2797 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002798 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2799 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002804 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002805 intent.writeToParcel(data, 0);
2806 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002807 data.writeStrongBinder(resultTo);
2808 data.writeString(resultWho);
2809 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002810 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002811 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002812 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002813 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002814 } else {
2815 data.writeInt(0);
2816 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002817 if (options != null) {
2818 data.writeInt(1);
2819 options.writeToParcel(data, 0);
2820 } else {
2821 data.writeInt(0);
2822 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002823 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002824 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2825 reply.readException();
2826 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2827 reply.recycle();
2828 data.recycle();
2829 return result;
2830 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002831 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2832 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002833 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002834 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002835 Parcel data = Parcel.obtain();
2836 Parcel reply = Parcel.obtain();
2837 data.writeInterfaceToken(IActivityManager.descriptor);
2838 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002839 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002840 intent.writeToParcel(data, 0);
2841 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002842 data.writeStrongBinder(resultTo);
2843 data.writeString(resultWho);
2844 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002845 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002846 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002847 if (options != null) {
2848 data.writeInt(1);
2849 options.writeToParcel(data, 0);
2850 } else {
2851 data.writeInt(0);
2852 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002853 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002854 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2855 reply.readException();
2856 int result = reply.readInt();
2857 reply.recycle();
2858 data.recycle();
2859 return result;
2860 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002861 public int startActivityIntentSender(IApplicationThread caller,
2862 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002863 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002864 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002865 Parcel data = Parcel.obtain();
2866 Parcel reply = Parcel.obtain();
2867 data.writeInterfaceToken(IActivityManager.descriptor);
2868 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2869 intent.writeToParcel(data, 0);
2870 if (fillInIntent != null) {
2871 data.writeInt(1);
2872 fillInIntent.writeToParcel(data, 0);
2873 } else {
2874 data.writeInt(0);
2875 }
2876 data.writeString(resolvedType);
2877 data.writeStrongBinder(resultTo);
2878 data.writeString(resultWho);
2879 data.writeInt(requestCode);
2880 data.writeInt(flagsMask);
2881 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002882 if (options != null) {
2883 data.writeInt(1);
2884 options.writeToParcel(data, 0);
2885 } else {
2886 data.writeInt(0);
2887 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002888 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002889 reply.readException();
2890 int result = reply.readInt();
2891 reply.recycle();
2892 data.recycle();
2893 return result;
2894 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002895 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2896 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002897 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2898 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002899 Parcel data = Parcel.obtain();
2900 Parcel reply = Parcel.obtain();
2901 data.writeInterfaceToken(IActivityManager.descriptor);
2902 data.writeString(callingPackage);
2903 data.writeInt(callingPid);
2904 data.writeInt(callingUid);
2905 intent.writeToParcel(data, 0);
2906 data.writeString(resolvedType);
2907 data.writeStrongBinder(session.asBinder());
2908 data.writeStrongBinder(interactor.asBinder());
2909 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002910 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002911 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002912 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002913 } else {
2914 data.writeInt(0);
2915 }
2916 if (options != null) {
2917 data.writeInt(1);
2918 options.writeToParcel(data, 0);
2919 } else {
2920 data.writeInt(0);
2921 }
2922 data.writeInt(userId);
2923 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2924 reply.readException();
2925 int result = reply.readInt();
2926 reply.recycle();
2927 data.recycle();
2928 return result;
2929 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002930 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002931 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002932 Parcel data = Parcel.obtain();
2933 Parcel reply = Parcel.obtain();
2934 data.writeInterfaceToken(IActivityManager.descriptor);
2935 data.writeStrongBinder(callingActivity);
2936 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002937 if (options != null) {
2938 data.writeInt(1);
2939 options.writeToParcel(data, 0);
2940 } else {
2941 data.writeInt(0);
2942 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2944 reply.readException();
2945 int result = reply.readInt();
2946 reply.recycle();
2947 data.recycle();
2948 return result != 0;
2949 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002950 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2951 Parcel data = Parcel.obtain();
2952 Parcel reply = Parcel.obtain();
2953 data.writeInterfaceToken(IActivityManager.descriptor);
2954 data.writeInt(taskId);
2955 if (options == null) {
2956 data.writeInt(0);
2957 } else {
2958 data.writeInt(1);
2959 options.writeToParcel(data, 0);
2960 }
2961 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2962 reply.readException();
2963 int result = reply.readInt();
2964 reply.recycle();
2965 data.recycle();
2966 return result;
2967 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07002968 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002969 throws RemoteException {
2970 Parcel data = Parcel.obtain();
2971 Parcel reply = Parcel.obtain();
2972 data.writeInterfaceToken(IActivityManager.descriptor);
2973 data.writeStrongBinder(token);
2974 data.writeInt(resultCode);
2975 if (resultData != null) {
2976 data.writeInt(1);
2977 resultData.writeToParcel(data, 0);
2978 } else {
2979 data.writeInt(0);
2980 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07002981 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002982 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2983 reply.readException();
2984 boolean res = reply.readInt() != 0;
2985 data.recycle();
2986 reply.recycle();
2987 return res;
2988 }
2989 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2990 {
2991 Parcel data = Parcel.obtain();
2992 Parcel reply = Parcel.obtain();
2993 data.writeInterfaceToken(IActivityManager.descriptor);
2994 data.writeStrongBinder(token);
2995 data.writeString(resultWho);
2996 data.writeInt(requestCode);
2997 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2998 reply.readException();
2999 data.recycle();
3000 reply.recycle();
3001 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003002 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3003 Parcel data = Parcel.obtain();
3004 Parcel reply = Parcel.obtain();
3005 data.writeInterfaceToken(IActivityManager.descriptor);
3006 data.writeStrongBinder(token);
3007 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3008 reply.readException();
3009 boolean res = reply.readInt() != 0;
3010 data.recycle();
3011 reply.recycle();
3012 return res;
3013 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003014 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3015 Parcel data = Parcel.obtain();
3016 Parcel reply = Parcel.obtain();
3017 data.writeInterfaceToken(IActivityManager.descriptor);
3018 data.writeStrongBinder(session.asBinder());
3019 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3020 reply.readException();
3021 data.recycle();
3022 reply.recycle();
3023 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003024 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3025 Parcel data = Parcel.obtain();
3026 Parcel reply = Parcel.obtain();
3027 data.writeInterfaceToken(IActivityManager.descriptor);
3028 data.writeStrongBinder(token);
3029 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3030 reply.readException();
3031 boolean res = reply.readInt() != 0;
3032 data.recycle();
3033 reply.recycle();
3034 return res;
3035 }
3036 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 data.writeStrongBinder(app.asBinder());
3041 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3042 reply.readException();
3043 data.recycle();
3044 reply.recycle();
3045 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003046 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3047 Parcel data = Parcel.obtain();
3048 Parcel reply = Parcel.obtain();
3049 data.writeInterfaceToken(IActivityManager.descriptor);
3050 data.writeStrongBinder(token);
3051 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3052 reply.readException();
3053 boolean res = reply.readInt() != 0;
3054 data.recycle();
3055 reply.recycle();
3056 return res;
3057 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003058 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003059 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003060 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003061 {
3062 Parcel data = Parcel.obtain();
3063 Parcel reply = Parcel.obtain();
3064 data.writeInterfaceToken(IActivityManager.descriptor);
3065 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003066 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3068 filter.writeToParcel(data, 0);
3069 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003070 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003071 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3072 reply.readException();
3073 Intent intent = null;
3074 int haveIntent = reply.readInt();
3075 if (haveIntent != 0) {
3076 intent = Intent.CREATOR.createFromParcel(reply);
3077 }
3078 reply.recycle();
3079 data.recycle();
3080 return intent;
3081 }
3082 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3083 {
3084 Parcel data = Parcel.obtain();
3085 Parcel reply = Parcel.obtain();
3086 data.writeInterfaceToken(IActivityManager.descriptor);
3087 data.writeStrongBinder(receiver.asBinder());
3088 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3089 reply.readException();
3090 data.recycle();
3091 reply.recycle();
3092 }
3093 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003094 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003095 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003096 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003097 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003098 {
3099 Parcel data = Parcel.obtain();
3100 Parcel reply = Parcel.obtain();
3101 data.writeInterfaceToken(IActivityManager.descriptor);
3102 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3103 intent.writeToParcel(data, 0);
3104 data.writeString(resolvedType);
3105 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3106 data.writeInt(resultCode);
3107 data.writeString(resultData);
3108 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003109 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003110 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003111 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003112 data.writeInt(serialized ? 1 : 0);
3113 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003114 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003115 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3116 reply.readException();
3117 int res = reply.readInt();
3118 reply.recycle();
3119 data.recycle();
3120 return res;
3121 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003122 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3123 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003124 {
3125 Parcel data = Parcel.obtain();
3126 Parcel reply = Parcel.obtain();
3127 data.writeInterfaceToken(IActivityManager.descriptor);
3128 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3129 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003130 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003131 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3132 reply.readException();
3133 data.recycle();
3134 reply.recycle();
3135 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003136 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3137 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003138 {
3139 Parcel data = Parcel.obtain();
3140 Parcel reply = Parcel.obtain();
3141 data.writeInterfaceToken(IActivityManager.descriptor);
3142 data.writeStrongBinder(who);
3143 data.writeInt(resultCode);
3144 data.writeString(resultData);
3145 data.writeBundle(map);
3146 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003147 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003148 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3149 reply.readException();
3150 data.recycle();
3151 reply.recycle();
3152 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003153 public void attachApplication(IApplicationThread app) throws RemoteException
3154 {
3155 Parcel data = Parcel.obtain();
3156 Parcel reply = Parcel.obtain();
3157 data.writeInterfaceToken(IActivityManager.descriptor);
3158 data.writeStrongBinder(app.asBinder());
3159 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3160 reply.readException();
3161 data.recycle();
3162 reply.recycle();
3163 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003164 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3165 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003166 {
3167 Parcel data = Parcel.obtain();
3168 Parcel reply = Parcel.obtain();
3169 data.writeInterfaceToken(IActivityManager.descriptor);
3170 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003171 if (config != null) {
3172 data.writeInt(1);
3173 config.writeToParcel(data, 0);
3174 } else {
3175 data.writeInt(0);
3176 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003177 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003178 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3179 reply.readException();
3180 data.recycle();
3181 reply.recycle();
3182 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003183 public void activityResumed(IBinder token) throws RemoteException
3184 {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeStrongBinder(token);
3189 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 data.recycle();
3192 reply.recycle();
3193 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003194 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003195 {
3196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 data.writeStrongBinder(token);
3200 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3201 reply.readException();
3202 data.recycle();
3203 reply.recycle();
3204 }
3205 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003206 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 {
3208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 data.writeStrongBinder(token);
3212 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003213 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003214 TextUtils.writeToParcel(description, data, 0);
3215 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3216 reply.readException();
3217 data.recycle();
3218 reply.recycle();
3219 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003220 public void activitySlept(IBinder token) throws RemoteException
3221 {
3222 Parcel data = Parcel.obtain();
3223 Parcel reply = Parcel.obtain();
3224 data.writeInterfaceToken(IActivityManager.descriptor);
3225 data.writeStrongBinder(token);
3226 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3227 reply.readException();
3228 data.recycle();
3229 reply.recycle();
3230 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003231 public void activityDestroyed(IBinder token) throws RemoteException
3232 {
3233 Parcel data = Parcel.obtain();
3234 Parcel reply = Parcel.obtain();
3235 data.writeInterfaceToken(IActivityManager.descriptor);
3236 data.writeStrongBinder(token);
3237 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3238 reply.readException();
3239 data.recycle();
3240 reply.recycle();
3241 }
3242 public String getCallingPackage(IBinder token) throws RemoteException
3243 {
3244 Parcel data = Parcel.obtain();
3245 Parcel reply = Parcel.obtain();
3246 data.writeInterfaceToken(IActivityManager.descriptor);
3247 data.writeStrongBinder(token);
3248 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3249 reply.readException();
3250 String res = reply.readString();
3251 data.recycle();
3252 reply.recycle();
3253 return res;
3254 }
3255 public ComponentName getCallingActivity(IBinder token)
3256 throws RemoteException {
3257 Parcel data = Parcel.obtain();
3258 Parcel reply = Parcel.obtain();
3259 data.writeInterfaceToken(IActivityManager.descriptor);
3260 data.writeStrongBinder(token);
3261 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3262 reply.readException();
3263 ComponentName res = ComponentName.readFromParcel(reply);
3264 data.recycle();
3265 reply.recycle();
3266 return res;
3267 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003268 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003269 Parcel data = Parcel.obtain();
3270 Parcel reply = Parcel.obtain();
3271 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003272 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003273 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3274 reply.readException();
3275 ArrayList<IAppTask> list = null;
3276 int N = reply.readInt();
3277 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003278 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003279 while (N > 0) {
3280 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3281 list.add(task);
3282 N--;
3283 }
3284 }
3285 data.recycle();
3286 reply.recycle();
3287 return list;
3288 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003289 public int addAppTask(IBinder activityToken, Intent intent,
3290 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeStrongBinder(activityToken);
3295 intent.writeToParcel(data, 0);
3296 description.writeToParcel(data, 0);
3297 thumbnail.writeToParcel(data, 0);
3298 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3299 reply.readException();
3300 int res = reply.readInt();
3301 data.recycle();
3302 reply.recycle();
3303 return res;
3304 }
3305 public Point getAppTaskThumbnailSize() throws RemoteException {
3306 Parcel data = Parcel.obtain();
3307 Parcel reply = Parcel.obtain();
3308 data.writeInterfaceToken(IActivityManager.descriptor);
3309 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3310 reply.readException();
3311 Point size = Point.CREATOR.createFromParcel(reply);
3312 data.recycle();
3313 reply.recycle();
3314 return size;
3315 }
Todd Kennedye635f662015-01-20 10:36:49 -08003316 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3317 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 Parcel data = Parcel.obtain();
3319 Parcel reply = Parcel.obtain();
3320 data.writeInterfaceToken(IActivityManager.descriptor);
3321 data.writeInt(maxNum);
3322 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003323 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3324 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003325 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003326 int N = reply.readInt();
3327 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003328 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003329 while (N > 0) {
3330 ActivityManager.RunningTaskInfo info =
3331 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003332 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 list.add(info);
3334 N--;
3335 }
3336 }
3337 data.recycle();
3338 reply.recycle();
3339 return list;
3340 }
3341 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003342 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003343 Parcel data = Parcel.obtain();
3344 Parcel reply = Parcel.obtain();
3345 data.writeInterfaceToken(IActivityManager.descriptor);
3346 data.writeInt(maxNum);
3347 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003348 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003349 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3350 reply.readException();
3351 ArrayList<ActivityManager.RecentTaskInfo> list
3352 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3353 data.recycle();
3354 reply.recycle();
3355 return list;
3356 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003357 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003362 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003363 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003364 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003365 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003366 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003367 }
3368 data.recycle();
3369 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003370 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003371 }
Todd Kennedye635f662015-01-20 10:36:49 -08003372 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3373 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003374 Parcel data = Parcel.obtain();
3375 Parcel reply = Parcel.obtain();
3376 data.writeInterfaceToken(IActivityManager.descriptor);
3377 data.writeInt(maxNum);
3378 data.writeInt(flags);
3379 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3380 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003381 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003382 int N = reply.readInt();
3383 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003384 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003385 while (N > 0) {
3386 ActivityManager.RunningServiceInfo info =
3387 ActivityManager.RunningServiceInfo.CREATOR
3388 .createFromParcel(reply);
3389 list.add(info);
3390 N--;
3391 }
3392 }
3393 data.recycle();
3394 reply.recycle();
3395 return list;
3396 }
3397 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3398 throws RemoteException {
3399 Parcel data = Parcel.obtain();
3400 Parcel reply = Parcel.obtain();
3401 data.writeInterfaceToken(IActivityManager.descriptor);
3402 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3403 reply.readException();
3404 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3405 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3406 data.recycle();
3407 reply.recycle();
3408 return list;
3409 }
3410 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3411 throws RemoteException {
3412 Parcel data = Parcel.obtain();
3413 Parcel reply = Parcel.obtain();
3414 data.writeInterfaceToken(IActivityManager.descriptor);
3415 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3416 reply.readException();
3417 ArrayList<ActivityManager.RunningAppProcessInfo> list
3418 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3419 data.recycle();
3420 reply.recycle();
3421 return list;
3422 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003423 public List<ApplicationInfo> getRunningExternalApplications()
3424 throws RemoteException {
3425 Parcel data = Parcel.obtain();
3426 Parcel reply = Parcel.obtain();
3427 data.writeInterfaceToken(IActivityManager.descriptor);
3428 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3429 reply.readException();
3430 ArrayList<ApplicationInfo> list
3431 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3432 data.recycle();
3433 reply.recycle();
3434 return list;
3435 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003436 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003437 {
3438 Parcel data = Parcel.obtain();
3439 Parcel reply = Parcel.obtain();
3440 data.writeInterfaceToken(IActivityManager.descriptor);
3441 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003442 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003443 if (options != null) {
3444 data.writeInt(1);
3445 options.writeToParcel(data, 0);
3446 } else {
3447 data.writeInt(0);
3448 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003449 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3450 reply.readException();
3451 data.recycle();
3452 reply.recycle();
3453 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003454 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3455 throws RemoteException {
3456 Parcel data = Parcel.obtain();
3457 Parcel reply = Parcel.obtain();
3458 data.writeInterfaceToken(IActivityManager.descriptor);
3459 data.writeStrongBinder(token);
3460 data.writeInt(nonRoot ? 1 : 0);
3461 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3462 reply.readException();
3463 boolean res = reply.readInt() != 0;
3464 data.recycle();
3465 reply.recycle();
3466 return res;
3467 }
3468 public void moveTaskBackwards(int task) throws RemoteException
3469 {
3470 Parcel data = Parcel.obtain();
3471 Parcel reply = Parcel.obtain();
3472 data.writeInterfaceToken(IActivityManager.descriptor);
3473 data.writeInt(task);
3474 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3475 reply.readException();
3476 data.recycle();
3477 reply.recycle();
3478 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003479 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003480 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3481 {
3482 Parcel data = Parcel.obtain();
3483 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003484 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003485 data.writeInt(taskId);
3486 data.writeInt(stackId);
3487 data.writeInt(toTop ? 1 : 0);
3488 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3489 reply.readException();
3490 data.recycle();
3491 reply.recycle();
3492 }
3493 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003494 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003495 {
3496 Parcel data = Parcel.obtain();
3497 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003498 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003499 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003500 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003501 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003502 reply.readException();
3503 data.recycle();
3504 reply.recycle();
3505 }
Craig Mautner967212c2013-04-13 21:10:58 -07003506 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003507 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3508 {
3509 Parcel data = Parcel.obtain();
3510 Parcel reply = Parcel.obtain();
3511 data.writeInterfaceToken(IActivityManager.descriptor);
3512 data.writeInt(taskId);
3513 data.writeInt(stackId);
3514 data.writeInt(position);
3515 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3516 reply.readException();
3517 data.recycle();
3518 reply.recycle();
3519 }
3520 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003521 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003522 {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003526 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003527 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003528 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003529 data.recycle();
3530 reply.recycle();
3531 return list;
3532 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003533 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003534 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003535 {
3536 Parcel data = Parcel.obtain();
3537 Parcel reply = Parcel.obtain();
3538 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003539 data.writeInt(stackId);
3540 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003541 reply.readException();
3542 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003543 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003544 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003545 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003546 }
3547 data.recycle();
3548 reply.recycle();
3549 return info;
3550 }
3551 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003552 public boolean isInHomeStack(int taskId) throws RemoteException {
3553 Parcel data = Parcel.obtain();
3554 Parcel reply = Parcel.obtain();
3555 data.writeInterfaceToken(IActivityManager.descriptor);
3556 data.writeInt(taskId);
3557 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 boolean isInHomeStack = reply.readInt() > 0;
3560 data.recycle();
3561 reply.recycle();
3562 return isInHomeStack;
3563 }
3564 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003565 public void setFocusedStack(int stackId) throws RemoteException
3566 {
3567 Parcel data = Parcel.obtain();
3568 Parcel reply = Parcel.obtain();
3569 data.writeInterfaceToken(IActivityManager.descriptor);
3570 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003571 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003572 reply.readException();
3573 data.recycle();
3574 reply.recycle();
3575 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003576 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003577 public int getFocusedStackId() throws RemoteException {
3578 Parcel data = Parcel.obtain();
3579 Parcel reply = Parcel.obtain();
3580 data.writeInterfaceToken(IActivityManager.descriptor);
3581 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3582 reply.readException();
3583 int focusedStackId = reply.readInt();
3584 data.recycle();
3585 reply.recycle();
3586 return focusedStackId;
3587 }
3588 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003589 public void setFocusedTask(int taskId) throws RemoteException
3590 {
3591 Parcel data = Parcel.obtain();
3592 Parcel reply = Parcel.obtain();
3593 data.writeInterfaceToken(IActivityManager.descriptor);
3594 data.writeInt(taskId);
3595 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3596 reply.readException();
3597 data.recycle();
3598 reply.recycle();
3599 }
3600 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003601 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3602 {
3603 Parcel data = Parcel.obtain();
3604 Parcel reply = Parcel.obtain();
3605 data.writeInterfaceToken(IActivityManager.descriptor);
3606 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003607 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003608 reply.readException();
3609 data.recycle();
3610 reply.recycle();
3611 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003612 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3613 {
3614 Parcel data = Parcel.obtain();
3615 Parcel reply = Parcel.obtain();
3616 data.writeInterfaceToken(IActivityManager.descriptor);
3617 data.writeStrongBinder(token);
3618 data.writeInt(onlyRoot ? 1 : 0);
3619 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3620 reply.readException();
3621 int res = reply.readInt();
3622 data.recycle();
3623 reply.recycle();
3624 return res;
3625 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003626 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003627 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003628 Parcel data = Parcel.obtain();
3629 Parcel reply = Parcel.obtain();
3630 data.writeInterfaceToken(IActivityManager.descriptor);
3631 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3632 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003633 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003634 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003635 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3636 reply.readException();
3637 int res = reply.readInt();
3638 ContentProviderHolder cph = null;
3639 if (res != 0) {
3640 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3641 }
3642 data.recycle();
3643 reply.recycle();
3644 return cph;
3645 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003646 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3647 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003648 Parcel data = Parcel.obtain();
3649 Parcel reply = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003652 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003653 data.writeStrongBinder(token);
3654 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3655 reply.readException();
3656 int res = reply.readInt();
3657 ContentProviderHolder cph = null;
3658 if (res != 0) {
3659 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3660 }
3661 data.recycle();
3662 reply.recycle();
3663 return cph;
3664 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003665 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003666 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003667 {
3668 Parcel data = Parcel.obtain();
3669 Parcel reply = Parcel.obtain();
3670 data.writeInterfaceToken(IActivityManager.descriptor);
3671 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3672 data.writeTypedList(providers);
3673 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3674 reply.readException();
3675 data.recycle();
3676 reply.recycle();
3677 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003678 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3679 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003680 Parcel data = Parcel.obtain();
3681 Parcel reply = Parcel.obtain();
3682 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003683 data.writeStrongBinder(connection);
3684 data.writeInt(stable);
3685 data.writeInt(unstable);
3686 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3687 reply.readException();
3688 boolean res = reply.readInt() != 0;
3689 data.recycle();
3690 reply.recycle();
3691 return res;
3692 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003693
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003694 public void unstableProviderDied(IBinder connection) throws RemoteException {
3695 Parcel data = Parcel.obtain();
3696 Parcel reply = Parcel.obtain();
3697 data.writeInterfaceToken(IActivityManager.descriptor);
3698 data.writeStrongBinder(connection);
3699 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3700 reply.readException();
3701 data.recycle();
3702 reply.recycle();
3703 }
3704
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003705 @Override
3706 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 data.writeStrongBinder(connection);
3711 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3712 reply.readException();
3713 data.recycle();
3714 reply.recycle();
3715 }
3716
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003717 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3718 Parcel data = Parcel.obtain();
3719 Parcel reply = Parcel.obtain();
3720 data.writeInterfaceToken(IActivityManager.descriptor);
3721 data.writeStrongBinder(connection);
3722 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003723 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3724 reply.readException();
3725 data.recycle();
3726 reply.recycle();
3727 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003728
3729 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3730 Parcel data = Parcel.obtain();
3731 Parcel reply = Parcel.obtain();
3732 data.writeInterfaceToken(IActivityManager.descriptor);
3733 data.writeString(name);
3734 data.writeStrongBinder(token);
3735 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3736 reply.readException();
3737 data.recycle();
3738 reply.recycle();
3739 }
3740
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003741 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3742 throws RemoteException
3743 {
3744 Parcel data = Parcel.obtain();
3745 Parcel reply = Parcel.obtain();
3746 data.writeInterfaceToken(IActivityManager.descriptor);
3747 service.writeToParcel(data, 0);
3748 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3751 data.recycle();
3752 reply.recycle();
3753 return res;
3754 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003755
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003756 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003757 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003758 {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3763 service.writeToParcel(data, 0);
3764 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003765 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003766 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003767 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3768 reply.readException();
3769 ComponentName res = ComponentName.readFromParcel(reply);
3770 data.recycle();
3771 reply.recycle();
3772 return res;
3773 }
3774 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003775 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003776 {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3781 service.writeToParcel(data, 0);
3782 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003783 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003784 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3785 reply.readException();
3786 int res = reply.readInt();
3787 reply.recycle();
3788 data.recycle();
3789 return res;
3790 }
3791 public boolean stopServiceToken(ComponentName className, IBinder token,
3792 int startId) throws RemoteException {
3793 Parcel data = Parcel.obtain();
3794 Parcel reply = Parcel.obtain();
3795 data.writeInterfaceToken(IActivityManager.descriptor);
3796 ComponentName.writeToParcel(className, data);
3797 data.writeStrongBinder(token);
3798 data.writeInt(startId);
3799 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 boolean res = reply.readInt() != 0;
3802 data.recycle();
3803 reply.recycle();
3804 return res;
3805 }
3806 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003807 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003808 Parcel data = Parcel.obtain();
3809 Parcel reply = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 ComponentName.writeToParcel(className, data);
3812 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003813 data.writeInt(id);
3814 if (notification != null) {
3815 data.writeInt(1);
3816 notification.writeToParcel(data, 0);
3817 } else {
3818 data.writeInt(0);
3819 }
3820 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003821 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3822 reply.readException();
3823 data.recycle();
3824 reply.recycle();
3825 }
3826 public int bindService(IApplicationThread caller, IBinder token,
3827 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003828 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003829 Parcel data = Parcel.obtain();
3830 Parcel reply = Parcel.obtain();
3831 data.writeInterfaceToken(IActivityManager.descriptor);
3832 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3833 data.writeStrongBinder(token);
3834 service.writeToParcel(data, 0);
3835 data.writeString(resolvedType);
3836 data.writeStrongBinder(connection.asBinder());
3837 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003838 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003839 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003840 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3841 reply.readException();
3842 int res = reply.readInt();
3843 data.recycle();
3844 reply.recycle();
3845 return res;
3846 }
3847 public boolean unbindService(IServiceConnection connection) throws RemoteException
3848 {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 data.writeStrongBinder(connection.asBinder());
3853 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3854 reply.readException();
3855 boolean res = reply.readInt() != 0;
3856 data.recycle();
3857 reply.recycle();
3858 return res;
3859 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003860
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003861 public void publishService(IBinder token,
3862 Intent intent, IBinder service) throws RemoteException {
3863 Parcel data = Parcel.obtain();
3864 Parcel reply = Parcel.obtain();
3865 data.writeInterfaceToken(IActivityManager.descriptor);
3866 data.writeStrongBinder(token);
3867 intent.writeToParcel(data, 0);
3868 data.writeStrongBinder(service);
3869 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 data.recycle();
3872 reply.recycle();
3873 }
3874
3875 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3876 throws RemoteException {
3877 Parcel data = Parcel.obtain();
3878 Parcel reply = Parcel.obtain();
3879 data.writeInterfaceToken(IActivityManager.descriptor);
3880 data.writeStrongBinder(token);
3881 intent.writeToParcel(data, 0);
3882 data.writeInt(doRebind ? 1 : 0);
3883 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3884 reply.readException();
3885 data.recycle();
3886 reply.recycle();
3887 }
3888
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003889 public void serviceDoneExecuting(IBinder token, int type, int startId,
3890 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003891 Parcel data = Parcel.obtain();
3892 Parcel reply = Parcel.obtain();
3893 data.writeInterfaceToken(IActivityManager.descriptor);
3894 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003895 data.writeInt(type);
3896 data.writeInt(startId);
3897 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003898 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3899 reply.readException();
3900 data.recycle();
3901 reply.recycle();
3902 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003903
Svet Ganov99b60432015-06-27 13:15:22 -07003904 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
3905 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003906 Parcel data = Parcel.obtain();
3907 Parcel reply = Parcel.obtain();
3908 data.writeInterfaceToken(IActivityManager.descriptor);
3909 service.writeToParcel(data, 0);
3910 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003911 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003912 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3913 reply.readException();
3914 IBinder binder = reply.readStrongBinder();
3915 reply.recycle();
3916 data.recycle();
3917 return binder;
3918 }
3919
Christopher Tate181fafa2009-05-14 11:12:14 -07003920 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3921 throws RemoteException {
3922 Parcel data = Parcel.obtain();
3923 Parcel reply = Parcel.obtain();
3924 data.writeInterfaceToken(IActivityManager.descriptor);
3925 app.writeToParcel(data, 0);
3926 data.writeInt(backupRestoreMode);
3927 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3928 reply.readException();
3929 boolean success = reply.readInt() != 0;
3930 reply.recycle();
3931 data.recycle();
3932 return success;
3933 }
3934
Christopher Tate346acb12012-10-15 19:20:25 -07003935 public void clearPendingBackup() throws RemoteException {
3936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
3939 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3940 reply.recycle();
3941 data.recycle();
3942 }
3943
Christopher Tate181fafa2009-05-14 11:12:14 -07003944 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3945 Parcel data = Parcel.obtain();
3946 Parcel reply = Parcel.obtain();
3947 data.writeInterfaceToken(IActivityManager.descriptor);
3948 data.writeString(packageName);
3949 data.writeStrongBinder(agent);
3950 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3951 reply.recycle();
3952 data.recycle();
3953 }
3954
3955 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3956 Parcel data = Parcel.obtain();
3957 Parcel reply = Parcel.obtain();
3958 data.writeInterfaceToken(IActivityManager.descriptor);
3959 app.writeToParcel(data, 0);
3960 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3961 reply.readException();
3962 reply.recycle();
3963 data.recycle();
3964 }
3965
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003966 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003967 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003968 IUiAutomationConnection connection, int userId, String instructionSet)
3969 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003970 Parcel data = Parcel.obtain();
3971 Parcel reply = Parcel.obtain();
3972 data.writeInterfaceToken(IActivityManager.descriptor);
3973 ComponentName.writeToParcel(className, data);
3974 data.writeString(profileFile);
3975 data.writeInt(flags);
3976 data.writeBundle(arguments);
3977 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003978 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003979 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003980 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003981 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3982 reply.readException();
3983 boolean res = reply.readInt() != 0;
3984 reply.recycle();
3985 data.recycle();
3986 return res;
3987 }
3988
3989 public void finishInstrumentation(IApplicationThread target,
3990 int resultCode, Bundle results) throws RemoteException {
3991 Parcel data = Parcel.obtain();
3992 Parcel reply = Parcel.obtain();
3993 data.writeInterfaceToken(IActivityManager.descriptor);
3994 data.writeStrongBinder(target != null ? target.asBinder() : null);
3995 data.writeInt(resultCode);
3996 data.writeBundle(results);
3997 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3998 reply.readException();
3999 data.recycle();
4000 reply.recycle();
4001 }
4002 public Configuration getConfiguration() throws RemoteException
4003 {
4004 Parcel data = Parcel.obtain();
4005 Parcel reply = Parcel.obtain();
4006 data.writeInterfaceToken(IActivityManager.descriptor);
4007 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4008 reply.readException();
4009 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4010 reply.recycle();
4011 data.recycle();
4012 return res;
4013 }
4014 public void updateConfiguration(Configuration values) throws RemoteException
4015 {
4016 Parcel data = Parcel.obtain();
4017 Parcel reply = Parcel.obtain();
4018 data.writeInterfaceToken(IActivityManager.descriptor);
4019 values.writeToParcel(data, 0);
4020 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4021 reply.readException();
4022 data.recycle();
4023 reply.recycle();
4024 }
4025 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4026 throws RemoteException {
4027 Parcel data = Parcel.obtain();
4028 Parcel reply = Parcel.obtain();
4029 data.writeInterfaceToken(IActivityManager.descriptor);
4030 data.writeStrongBinder(token);
4031 data.writeInt(requestedOrientation);
4032 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4033 reply.readException();
4034 data.recycle();
4035 reply.recycle();
4036 }
4037 public int getRequestedOrientation(IBinder token) throws RemoteException {
4038 Parcel data = Parcel.obtain();
4039 Parcel reply = Parcel.obtain();
4040 data.writeInterfaceToken(IActivityManager.descriptor);
4041 data.writeStrongBinder(token);
4042 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4043 reply.readException();
4044 int res = reply.readInt();
4045 data.recycle();
4046 reply.recycle();
4047 return res;
4048 }
4049 public ComponentName getActivityClassForToken(IBinder token)
4050 throws RemoteException {
4051 Parcel data = Parcel.obtain();
4052 Parcel reply = Parcel.obtain();
4053 data.writeInterfaceToken(IActivityManager.descriptor);
4054 data.writeStrongBinder(token);
4055 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4056 reply.readException();
4057 ComponentName res = ComponentName.readFromParcel(reply);
4058 data.recycle();
4059 reply.recycle();
4060 return res;
4061 }
4062 public String getPackageForToken(IBinder token) throws RemoteException
4063 {
4064 Parcel data = Parcel.obtain();
4065 Parcel reply = Parcel.obtain();
4066 data.writeInterfaceToken(IActivityManager.descriptor);
4067 data.writeStrongBinder(token);
4068 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4069 reply.readException();
4070 String res = reply.readString();
4071 data.recycle();
4072 reply.recycle();
4073 return res;
4074 }
4075 public IIntentSender getIntentSender(int type,
4076 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004077 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004078 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 data.writeInt(type);
4083 data.writeString(packageName);
4084 data.writeStrongBinder(token);
4085 data.writeString(resultWho);
4086 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004087 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004088 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004089 data.writeTypedArray(intents, 0);
4090 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004091 } else {
4092 data.writeInt(0);
4093 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004094 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004095 if (options != null) {
4096 data.writeInt(1);
4097 options.writeToParcel(data, 0);
4098 } else {
4099 data.writeInt(0);
4100 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004101 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004102 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4103 reply.readException();
4104 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004105 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004106 data.recycle();
4107 reply.recycle();
4108 return res;
4109 }
4110 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4111 Parcel data = Parcel.obtain();
4112 Parcel reply = Parcel.obtain();
4113 data.writeInterfaceToken(IActivityManager.descriptor);
4114 data.writeStrongBinder(sender.asBinder());
4115 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4116 reply.readException();
4117 data.recycle();
4118 reply.recycle();
4119 }
4120 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4121 Parcel data = Parcel.obtain();
4122 Parcel reply = Parcel.obtain();
4123 data.writeInterfaceToken(IActivityManager.descriptor);
4124 data.writeStrongBinder(sender.asBinder());
4125 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4126 reply.readException();
4127 String res = reply.readString();
4128 data.recycle();
4129 reply.recycle();
4130 return res;
4131 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004132 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4133 Parcel data = Parcel.obtain();
4134 Parcel reply = Parcel.obtain();
4135 data.writeInterfaceToken(IActivityManager.descriptor);
4136 data.writeStrongBinder(sender.asBinder());
4137 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4138 reply.readException();
4139 int res = reply.readInt();
4140 data.recycle();
4141 reply.recycle();
4142 return res;
4143 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004144 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4145 boolean requireFull, String name, String callerPackage) throws RemoteException {
4146 Parcel data = Parcel.obtain();
4147 Parcel reply = Parcel.obtain();
4148 data.writeInterfaceToken(IActivityManager.descriptor);
4149 data.writeInt(callingPid);
4150 data.writeInt(callingUid);
4151 data.writeInt(userId);
4152 data.writeInt(allowAll ? 1 : 0);
4153 data.writeInt(requireFull ? 1 : 0);
4154 data.writeString(name);
4155 data.writeString(callerPackage);
4156 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4157 reply.readException();
4158 int res = reply.readInt();
4159 data.recycle();
4160 reply.recycle();
4161 return res;
4162 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004163 public void setProcessLimit(int max) throws RemoteException
4164 {
4165 Parcel data = Parcel.obtain();
4166 Parcel reply = Parcel.obtain();
4167 data.writeInterfaceToken(IActivityManager.descriptor);
4168 data.writeInt(max);
4169 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4170 reply.readException();
4171 data.recycle();
4172 reply.recycle();
4173 }
4174 public int getProcessLimit() throws RemoteException
4175 {
4176 Parcel data = Parcel.obtain();
4177 Parcel reply = Parcel.obtain();
4178 data.writeInterfaceToken(IActivityManager.descriptor);
4179 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4180 reply.readException();
4181 int res = reply.readInt();
4182 data.recycle();
4183 reply.recycle();
4184 return res;
4185 }
4186 public void setProcessForeground(IBinder token, int pid,
4187 boolean isForeground) throws RemoteException {
4188 Parcel data = Parcel.obtain();
4189 Parcel reply = Parcel.obtain();
4190 data.writeInterfaceToken(IActivityManager.descriptor);
4191 data.writeStrongBinder(token);
4192 data.writeInt(pid);
4193 data.writeInt(isForeground ? 1 : 0);
4194 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4195 reply.readException();
4196 data.recycle();
4197 reply.recycle();
4198 }
4199 public int checkPermission(String permission, int pid, int uid)
4200 throws RemoteException {
4201 Parcel data = Parcel.obtain();
4202 Parcel reply = Parcel.obtain();
4203 data.writeInterfaceToken(IActivityManager.descriptor);
4204 data.writeString(permission);
4205 data.writeInt(pid);
4206 data.writeInt(uid);
4207 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4208 reply.readException();
4209 int res = reply.readInt();
4210 data.recycle();
4211 reply.recycle();
4212 return res;
4213 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004214 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4215 throws RemoteException {
4216 Parcel data = Parcel.obtain();
4217 Parcel reply = Parcel.obtain();
4218 data.writeInterfaceToken(IActivityManager.descriptor);
4219 data.writeString(permission);
4220 data.writeInt(pid);
4221 data.writeInt(uid);
4222 data.writeStrongBinder(callerToken);
4223 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4224 reply.readException();
4225 int res = reply.readInt();
4226 data.recycle();
4227 reply.recycle();
4228 return res;
4229 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004230 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004231 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004236 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004237 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004238 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4239 reply.readException();
4240 boolean res = reply.readInt() != 0;
4241 data.recycle();
4242 reply.recycle();
4243 return res;
4244 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004245 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4246 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004247 Parcel data = Parcel.obtain();
4248 Parcel reply = Parcel.obtain();
4249 data.writeInterfaceToken(IActivityManager.descriptor);
4250 uri.writeToParcel(data, 0);
4251 data.writeInt(pid);
4252 data.writeInt(uid);
4253 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004254 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004255 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004256 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4257 reply.readException();
4258 int res = reply.readInt();
4259 data.recycle();
4260 reply.recycle();
4261 return res;
4262 }
4263 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004264 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004265 Parcel data = Parcel.obtain();
4266 Parcel reply = Parcel.obtain();
4267 data.writeInterfaceToken(IActivityManager.descriptor);
4268 data.writeStrongBinder(caller.asBinder());
4269 data.writeString(targetPkg);
4270 uri.writeToParcel(data, 0);
4271 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004272 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004273 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4274 reply.readException();
4275 data.recycle();
4276 reply.recycle();
4277 }
4278 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004279 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004280 Parcel data = Parcel.obtain();
4281 Parcel reply = Parcel.obtain();
4282 data.writeInterfaceToken(IActivityManager.descriptor);
4283 data.writeStrongBinder(caller.asBinder());
4284 uri.writeToParcel(data, 0);
4285 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004286 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004287 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4288 reply.readException();
4289 data.recycle();
4290 reply.recycle();
4291 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004292
4293 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004294 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4295 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004296 Parcel data = Parcel.obtain();
4297 Parcel reply = Parcel.obtain();
4298 data.writeInterfaceToken(IActivityManager.descriptor);
4299 uri.writeToParcel(data, 0);
4300 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004301 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004302 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4303 reply.readException();
4304 data.recycle();
4305 reply.recycle();
4306 }
4307
4308 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004309 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4310 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004311 Parcel data = Parcel.obtain();
4312 Parcel reply = Parcel.obtain();
4313 data.writeInterfaceToken(IActivityManager.descriptor);
4314 uri.writeToParcel(data, 0);
4315 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004316 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004317 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4318 reply.readException();
4319 data.recycle();
4320 reply.recycle();
4321 }
4322
4323 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004324 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4325 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004326 Parcel data = Parcel.obtain();
4327 Parcel reply = Parcel.obtain();
4328 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004329 data.writeString(packageName);
4330 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004331 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4332 reply.readException();
4333 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4334 reply);
4335 data.recycle();
4336 reply.recycle();
4337 return perms;
4338 }
4339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004340 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4341 throws RemoteException {
4342 Parcel data = Parcel.obtain();
4343 Parcel reply = Parcel.obtain();
4344 data.writeInterfaceToken(IActivityManager.descriptor);
4345 data.writeStrongBinder(who.asBinder());
4346 data.writeInt(waiting ? 1 : 0);
4347 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4348 reply.readException();
4349 data.recycle();
4350 reply.recycle();
4351 }
4352 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4353 Parcel data = Parcel.obtain();
4354 Parcel reply = Parcel.obtain();
4355 data.writeInterfaceToken(IActivityManager.descriptor);
4356 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4357 reply.readException();
4358 outInfo.readFromParcel(reply);
4359 data.recycle();
4360 reply.recycle();
4361 }
4362 public void unhandledBack() throws RemoteException
4363 {
4364 Parcel data = Parcel.obtain();
4365 Parcel reply = Parcel.obtain();
4366 data.writeInterfaceToken(IActivityManager.descriptor);
4367 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4368 reply.readException();
4369 data.recycle();
4370 reply.recycle();
4371 }
4372 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4373 {
4374 Parcel data = Parcel.obtain();
4375 Parcel reply = Parcel.obtain();
4376 data.writeInterfaceToken(IActivityManager.descriptor);
4377 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4378 reply.readException();
4379 ParcelFileDescriptor pfd = null;
4380 if (reply.readInt() != 0) {
4381 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4382 }
4383 data.recycle();
4384 reply.recycle();
4385 return pfd;
4386 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004387 public void setLockScreenShown(boolean shown) throws RemoteException
4388 {
4389 Parcel data = Parcel.obtain();
4390 Parcel reply = Parcel.obtain();
4391 data.writeInterfaceToken(IActivityManager.descriptor);
4392 data.writeInt(shown ? 1 : 0);
4393 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4394 reply.readException();
4395 data.recycle();
4396 reply.recycle();
4397 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004398 public void setDebugApp(
4399 String packageName, boolean waitForDebugger, boolean persistent)
4400 throws RemoteException
4401 {
4402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 data.writeString(packageName);
4406 data.writeInt(waitForDebugger ? 1 : 0);
4407 data.writeInt(persistent ? 1 : 0);
4408 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4409 reply.readException();
4410 data.recycle();
4411 reply.recycle();
4412 }
4413 public void setAlwaysFinish(boolean enabled) throws RemoteException
4414 {
4415 Parcel data = Parcel.obtain();
4416 Parcel reply = Parcel.obtain();
4417 data.writeInterfaceToken(IActivityManager.descriptor);
4418 data.writeInt(enabled ? 1 : 0);
4419 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4420 reply.readException();
4421 data.recycle();
4422 reply.recycle();
4423 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004424 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004425 {
4426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004430 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004431 reply.readException();
4432 data.recycle();
4433 reply.recycle();
4434 }
4435 public void enterSafeMode() throws RemoteException {
4436 Parcel data = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4439 data.recycle();
4440 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004441 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004442 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004443 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004444 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004445 data.writeStrongBinder(sender.asBinder());
4446 data.writeInt(sourceUid);
4447 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004448 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004449 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4450 data.recycle();
4451 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004452 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4453 throws RemoteException {
4454 Parcel data = Parcel.obtain();
4455 data.writeInterfaceToken(IActivityManager.descriptor);
4456 data.writeStrongBinder(sender.asBinder());
4457 data.writeInt(sourceUid);
4458 data.writeString(tag);
4459 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4460 data.recycle();
4461 }
4462 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4463 throws RemoteException {
4464 Parcel data = Parcel.obtain();
4465 data.writeInterfaceToken(IActivityManager.descriptor);
4466 data.writeStrongBinder(sender.asBinder());
4467 data.writeInt(sourceUid);
4468 data.writeString(tag);
4469 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4470 data.recycle();
4471 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004472 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004473 Parcel data = Parcel.obtain();
4474 Parcel reply = Parcel.obtain();
4475 data.writeInterfaceToken(IActivityManager.descriptor);
4476 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004477 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004478 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004479 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004480 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004481 boolean res = reply.readInt() != 0;
4482 data.recycle();
4483 reply.recycle();
4484 return res;
4485 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004486 @Override
4487 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4488 Parcel data = Parcel.obtain();
4489 Parcel reply = Parcel.obtain();
4490 data.writeInterfaceToken(IActivityManager.descriptor);
4491 data.writeString(reason);
4492 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4493 boolean res = reply.readInt() != 0;
4494 data.recycle();
4495 reply.recycle();
4496 return res;
4497 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004498 public boolean testIsSystemReady()
4499 {
4500 /* this base class version is never called */
4501 return true;
4502 }
Dan Egnor60d87622009-12-16 16:32:58 -08004503 public void handleApplicationCrash(IBinder app,
4504 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4505 {
4506 Parcel data = Parcel.obtain();
4507 Parcel reply = Parcel.obtain();
4508 data.writeInterfaceToken(IActivityManager.descriptor);
4509 data.writeStrongBinder(app);
4510 crashInfo.writeToParcel(data, 0);
4511 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4512 reply.readException();
4513 reply.recycle();
4514 data.recycle();
4515 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004516
Dianne Hackborn52322712014-08-26 22:47:26 -07004517 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004518 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004519 {
4520 Parcel data = Parcel.obtain();
4521 Parcel reply = Parcel.obtain();
4522 data.writeInterfaceToken(IActivityManager.descriptor);
4523 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004524 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004525 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004526 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004527 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004528 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004529 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004530 reply.recycle();
4531 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004532 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004533 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004534
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004535 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004536 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004537 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004538 {
4539 Parcel data = Parcel.obtain();
4540 Parcel reply = Parcel.obtain();
4541 data.writeInterfaceToken(IActivityManager.descriptor);
4542 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004543 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004544 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004545 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4546 reply.readException();
4547 reply.recycle();
4548 data.recycle();
4549 }
4550
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004551 public void signalPersistentProcesses(int sig) throws RemoteException {
4552 Parcel data = Parcel.obtain();
4553 Parcel reply = Parcel.obtain();
4554 data.writeInterfaceToken(IActivityManager.descriptor);
4555 data.writeInt(sig);
4556 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4557 reply.readException();
4558 data.recycle();
4559 reply.recycle();
4560 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004561
Dianne Hackborn1676c852012-09-10 14:52:30 -07004562 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004563 Parcel data = Parcel.obtain();
4564 Parcel reply = Parcel.obtain();
4565 data.writeInterfaceToken(IActivityManager.descriptor);
4566 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004567 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004568 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4569 reply.readException();
4570 data.recycle();
4571 reply.recycle();
4572 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004573
4574 public void killAllBackgroundProcesses() throws RemoteException {
4575 Parcel data = Parcel.obtain();
4576 Parcel reply = Parcel.obtain();
4577 data.writeInterfaceToken(IActivityManager.descriptor);
4578 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4579 reply.readException();
4580 data.recycle();
4581 reply.recycle();
4582 }
4583
Dianne Hackborn1676c852012-09-10 14:52:30 -07004584 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004585 Parcel data = Parcel.obtain();
4586 Parcel reply = Parcel.obtain();
4587 data.writeInterfaceToken(IActivityManager.descriptor);
4588 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004589 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004590 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004591 reply.readException();
4592 data.recycle();
4593 reply.recycle();
4594 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004595
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004596 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4597 throws RemoteException
4598 {
4599 Parcel data = Parcel.obtain();
4600 Parcel reply = Parcel.obtain();
4601 data.writeInterfaceToken(IActivityManager.descriptor);
4602 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4603 reply.readException();
4604 outInfo.readFromParcel(reply);
4605 reply.recycle();
4606 data.recycle();
4607 }
4608
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004609 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4610 {
4611 Parcel data = Parcel.obtain();
4612 Parcel reply = Parcel.obtain();
4613 data.writeInterfaceToken(IActivityManager.descriptor);
4614 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4615 reply.readException();
4616 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4617 reply.recycle();
4618 data.recycle();
4619 return res;
4620 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004621
Dianne Hackborn1676c852012-09-10 14:52:30 -07004622 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004623 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004624 {
4625 Parcel data = Parcel.obtain();
4626 Parcel reply = Parcel.obtain();
4627 data.writeInterfaceToken(IActivityManager.descriptor);
4628 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004629 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004630 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004631 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004632 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004633 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004634 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004635 } else {
4636 data.writeInt(0);
4637 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004638 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4639 reply.readException();
4640 boolean res = reply.readInt() != 0;
4641 reply.recycle();
4642 data.recycle();
4643 return res;
4644 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004645
Dianne Hackborn55280a92009-05-07 15:53:46 -07004646 public boolean shutdown(int timeout) throws RemoteException
4647 {
4648 Parcel data = Parcel.obtain();
4649 Parcel reply = Parcel.obtain();
4650 data.writeInterfaceToken(IActivityManager.descriptor);
4651 data.writeInt(timeout);
4652 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4653 reply.readException();
4654 boolean res = reply.readInt() != 0;
4655 reply.recycle();
4656 data.recycle();
4657 return res;
4658 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004659
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004660 public void stopAppSwitches() throws RemoteException {
4661 Parcel data = Parcel.obtain();
4662 Parcel reply = Parcel.obtain();
4663 data.writeInterfaceToken(IActivityManager.descriptor);
4664 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4665 reply.readException();
4666 reply.recycle();
4667 data.recycle();
4668 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004669
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004670 public void resumeAppSwitches() throws RemoteException {
4671 Parcel data = Parcel.obtain();
4672 Parcel reply = Parcel.obtain();
4673 data.writeInterfaceToken(IActivityManager.descriptor);
4674 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4675 reply.readException();
4676 reply.recycle();
4677 data.recycle();
4678 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004679
4680 public void addPackageDependency(String packageName) throws RemoteException {
4681 Parcel data = Parcel.obtain();
4682 Parcel reply = Parcel.obtain();
4683 data.writeInterfaceToken(IActivityManager.descriptor);
4684 data.writeString(packageName);
4685 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4686 reply.readException();
4687 data.recycle();
4688 reply.recycle();
4689 }
4690
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004691 public void killApplicationWithAppId(String pkg, int appid, String reason)
4692 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004693 Parcel data = Parcel.obtain();
4694 Parcel reply = Parcel.obtain();
4695 data.writeInterfaceToken(IActivityManager.descriptor);
4696 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004697 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004698 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004699 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004700 reply.readException();
4701 data.recycle();
4702 reply.recycle();
4703 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004704
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004705 public void closeSystemDialogs(String reason) throws RemoteException {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 data.writeString(reason);
4710 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 data.recycle();
4713 reply.recycle();
4714 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004715
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004716 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004717 throws RemoteException {
4718 Parcel data = Parcel.obtain();
4719 Parcel reply = Parcel.obtain();
4720 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004721 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004722 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4723 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004724 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004725 data.recycle();
4726 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004727 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004728 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004729
4730 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4731 Parcel data = Parcel.obtain();
4732 Parcel reply = Parcel.obtain();
4733 data.writeInterfaceToken(IActivityManager.descriptor);
4734 data.writeString(processName);
4735 data.writeInt(uid);
4736 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4737 reply.readException();
4738 data.recycle();
4739 reply.recycle();
4740 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004741
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004742 public void overridePendingTransition(IBinder token, String packageName,
4743 int enterAnim, int exitAnim) throws RemoteException {
4744 Parcel data = Parcel.obtain();
4745 Parcel reply = Parcel.obtain();
4746 data.writeInterfaceToken(IActivityManager.descriptor);
4747 data.writeStrongBinder(token);
4748 data.writeString(packageName);
4749 data.writeInt(enterAnim);
4750 data.writeInt(exitAnim);
4751 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4752 reply.readException();
4753 data.recycle();
4754 reply.recycle();
4755 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004756
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004757 public boolean isUserAMonkey() throws RemoteException {
4758 Parcel data = Parcel.obtain();
4759 Parcel reply = Parcel.obtain();
4760 data.writeInterfaceToken(IActivityManager.descriptor);
4761 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4762 reply.readException();
4763 boolean res = reply.readInt() != 0;
4764 data.recycle();
4765 reply.recycle();
4766 return res;
4767 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004768
4769 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4770 Parcel data = Parcel.obtain();
4771 Parcel reply = Parcel.obtain();
4772 data.writeInterfaceToken(IActivityManager.descriptor);
4773 data.writeInt(monkey ? 1 : 0);
4774 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4775 reply.readException();
4776 data.recycle();
4777 reply.recycle();
4778 }
4779
Dianne Hackborn860755f2010-06-03 18:47:52 -07004780 public void finishHeavyWeightApp() throws RemoteException {
4781 Parcel data = Parcel.obtain();
4782 Parcel reply = Parcel.obtain();
4783 data.writeInterfaceToken(IActivityManager.descriptor);
4784 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4785 reply.readException();
4786 data.recycle();
4787 reply.recycle();
4788 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004789
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004790 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004791 throws RemoteException {
4792 Parcel data = Parcel.obtain();
4793 Parcel reply = Parcel.obtain();
4794 data.writeInterfaceToken(IActivityManager.descriptor);
4795 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004796 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4797 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004798 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004799 data.recycle();
4800 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004801 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004802 }
4803
Craig Mautner233ceee2014-05-09 17:05:11 -07004804 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004805 throws RemoteException {
4806 Parcel data = Parcel.obtain();
4807 Parcel reply = Parcel.obtain();
4808 data.writeInterfaceToken(IActivityManager.descriptor);
4809 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004810 if (options == null) {
4811 data.writeInt(0);
4812 } else {
4813 data.writeInt(1);
4814 data.writeBundle(options.toBundle());
4815 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004816 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004817 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004818 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004819 data.recycle();
4820 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004821 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004822 }
4823
Craig Mautner233ceee2014-05-09 17:05:11 -07004824 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4825 Parcel data = Parcel.obtain();
4826 Parcel reply = Parcel.obtain();
4827 data.writeInterfaceToken(IActivityManager.descriptor);
4828 data.writeStrongBinder(token);
4829 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4830 reply.readException();
4831 Bundle bundle = reply.readBundle();
4832 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4833 data.recycle();
4834 reply.recycle();
4835 return options;
4836 }
4837
Daniel Sandler69a48172010-06-23 16:29:36 -04004838 public void setImmersive(IBinder token, boolean immersive)
4839 throws RemoteException {
4840 Parcel data = Parcel.obtain();
4841 Parcel reply = Parcel.obtain();
4842 data.writeInterfaceToken(IActivityManager.descriptor);
4843 data.writeStrongBinder(token);
4844 data.writeInt(immersive ? 1 : 0);
4845 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4846 reply.readException();
4847 data.recycle();
4848 reply.recycle();
4849 }
4850
4851 public boolean isImmersive(IBinder token)
4852 throws RemoteException {
4853 Parcel data = Parcel.obtain();
4854 Parcel reply = Parcel.obtain();
4855 data.writeInterfaceToken(IActivityManager.descriptor);
4856 data.writeStrongBinder(token);
4857 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004858 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004859 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004860 data.recycle();
4861 reply.recycle();
4862 return res;
4863 }
4864
Craig Mautnerd61dc202014-07-07 11:09:11 -07004865 public boolean isTopOfTask(IBinder token) throws RemoteException {
4866 Parcel data = Parcel.obtain();
4867 Parcel reply = Parcel.obtain();
4868 data.writeInterfaceToken(IActivityManager.descriptor);
4869 data.writeStrongBinder(token);
4870 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4871 reply.readException();
4872 boolean res = reply.readInt() == 1;
4873 data.recycle();
4874 reply.recycle();
4875 return res;
4876 }
4877
Daniel Sandler69a48172010-06-23 16:29:36 -04004878 public boolean isTopActivityImmersive()
4879 throws RemoteException {
4880 Parcel data = Parcel.obtain();
4881 Parcel reply = Parcel.obtain();
4882 data.writeInterfaceToken(IActivityManager.descriptor);
4883 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004884 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004885 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004886 data.recycle();
4887 reply.recycle();
4888 return res;
4889 }
4890
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004891 public void crashApplication(int uid, int initialPid, String packageName,
4892 String message) throws RemoteException {
4893 Parcel data = Parcel.obtain();
4894 Parcel reply = Parcel.obtain();
4895 data.writeInterfaceToken(IActivityManager.descriptor);
4896 data.writeInt(uid);
4897 data.writeInt(initialPid);
4898 data.writeString(packageName);
4899 data.writeString(message);
4900 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4901 reply.readException();
4902 data.recycle();
4903 reply.recycle();
4904 }
Andy McFadden824c5102010-07-09 16:26:57 -07004905
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004906 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004907 Parcel data = Parcel.obtain();
4908 Parcel reply = Parcel.obtain();
4909 data.writeInterfaceToken(IActivityManager.descriptor);
4910 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004911 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004912 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4913 reply.readException();
4914 String res = reply.readString();
4915 data.recycle();
4916 reply.recycle();
4917 return res;
4918 }
4919
Dianne Hackborn7e269642010-08-25 19:50:20 -07004920 public IBinder newUriPermissionOwner(String name)
4921 throws RemoteException {
4922 Parcel data = Parcel.obtain();
4923 Parcel reply = Parcel.obtain();
4924 data.writeInterfaceToken(IActivityManager.descriptor);
4925 data.writeString(name);
4926 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4927 reply.readException();
4928 IBinder res = reply.readStrongBinder();
4929 data.recycle();
4930 reply.recycle();
4931 return res;
4932 }
4933
4934 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004935 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004936 Parcel data = Parcel.obtain();
4937 Parcel reply = Parcel.obtain();
4938 data.writeInterfaceToken(IActivityManager.descriptor);
4939 data.writeStrongBinder(owner);
4940 data.writeInt(fromUid);
4941 data.writeString(targetPkg);
4942 uri.writeToParcel(data, 0);
4943 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004944 data.writeInt(sourceUserId);
4945 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004946 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4947 reply.readException();
4948 data.recycle();
4949 reply.recycle();
4950 }
4951
4952 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004953 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004954 Parcel data = Parcel.obtain();
4955 Parcel reply = Parcel.obtain();
4956 data.writeInterfaceToken(IActivityManager.descriptor);
4957 data.writeStrongBinder(owner);
4958 if (uri != null) {
4959 data.writeInt(1);
4960 uri.writeToParcel(data, 0);
4961 } else {
4962 data.writeInt(0);
4963 }
4964 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004965 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004966 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4967 reply.readException();
4968 data.recycle();
4969 reply.recycle();
4970 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004971
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004972 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004973 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004974 Parcel data = Parcel.obtain();
4975 Parcel reply = Parcel.obtain();
4976 data.writeInterfaceToken(IActivityManager.descriptor);
4977 data.writeInt(callingUid);
4978 data.writeString(targetPkg);
4979 uri.writeToParcel(data, 0);
4980 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004981 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004982 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4983 reply.readException();
4984 int res = reply.readInt();
4985 data.recycle();
4986 reply.recycle();
4987 return res;
4988 }
4989
Dianne Hackborn1676c852012-09-10 14:52:30 -07004990 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004991 String path, ParcelFileDescriptor fd) throws RemoteException {
4992 Parcel data = Parcel.obtain();
4993 Parcel reply = Parcel.obtain();
4994 data.writeInterfaceToken(IActivityManager.descriptor);
4995 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004996 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004997 data.writeInt(managed ? 1 : 0);
4998 data.writeString(path);
4999 if (fd != null) {
5000 data.writeInt(1);
5001 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5002 } else {
5003 data.writeInt(0);
5004 }
5005 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5006 reply.readException();
5007 boolean res = reply.readInt() != 0;
5008 reply.recycle();
5009 data.recycle();
5010 return res;
5011 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005012
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005013 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005014 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005015 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005016 Parcel data = Parcel.obtain();
5017 Parcel reply = Parcel.obtain();
5018 data.writeInterfaceToken(IActivityManager.descriptor);
5019 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005020 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005021 data.writeTypedArray(intents, 0);
5022 data.writeStringArray(resolvedTypes);
5023 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005024 if (options != null) {
5025 data.writeInt(1);
5026 options.writeToParcel(data, 0);
5027 } else {
5028 data.writeInt(0);
5029 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005030 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005031 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5032 reply.readException();
5033 int result = reply.readInt();
5034 reply.recycle();
5035 data.recycle();
5036 return result;
5037 }
5038
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005039 public int getFrontActivityScreenCompatMode() throws RemoteException {
5040 Parcel data = Parcel.obtain();
5041 Parcel reply = Parcel.obtain();
5042 data.writeInterfaceToken(IActivityManager.descriptor);
5043 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5044 reply.readException();
5045 int mode = reply.readInt();
5046 reply.recycle();
5047 data.recycle();
5048 return mode;
5049 }
5050
5051 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5052 Parcel data = Parcel.obtain();
5053 Parcel reply = Parcel.obtain();
5054 data.writeInterfaceToken(IActivityManager.descriptor);
5055 data.writeInt(mode);
5056 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5057 reply.readException();
5058 reply.recycle();
5059 data.recycle();
5060 }
5061
5062 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5063 Parcel data = Parcel.obtain();
5064 Parcel reply = Parcel.obtain();
5065 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005066 data.writeString(packageName);
5067 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005068 reply.readException();
5069 int mode = reply.readInt();
5070 reply.recycle();
5071 data.recycle();
5072 return mode;
5073 }
5074
5075 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005076 throws RemoteException {
5077 Parcel data = Parcel.obtain();
5078 Parcel reply = Parcel.obtain();
5079 data.writeInterfaceToken(IActivityManager.descriptor);
5080 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005081 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005082 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5083 reply.readException();
5084 reply.recycle();
5085 data.recycle();
5086 }
5087
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005088 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5089 Parcel data = Parcel.obtain();
5090 Parcel reply = Parcel.obtain();
5091 data.writeInterfaceToken(IActivityManager.descriptor);
5092 data.writeString(packageName);
5093 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5094 reply.readException();
5095 boolean ask = reply.readInt() != 0;
5096 reply.recycle();
5097 data.recycle();
5098 return ask;
5099 }
5100
5101 public void setPackageAskScreenCompat(String packageName, boolean ask)
5102 throws RemoteException {
5103 Parcel data = Parcel.obtain();
5104 Parcel reply = Parcel.obtain();
5105 data.writeInterfaceToken(IActivityManager.descriptor);
5106 data.writeString(packageName);
5107 data.writeInt(ask ? 1 : 0);
5108 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5109 reply.readException();
5110 reply.recycle();
5111 data.recycle();
5112 }
5113
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005114 public boolean switchUser(int userid) throws RemoteException {
5115 Parcel data = Parcel.obtain();
5116 Parcel reply = Parcel.obtain();
5117 data.writeInterfaceToken(IActivityManager.descriptor);
5118 data.writeInt(userid);
5119 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5120 reply.readException();
5121 boolean result = reply.readInt() != 0;
5122 reply.recycle();
5123 data.recycle();
5124 return result;
5125 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005126
Kenny Guy08488bf2014-02-21 17:40:37 +00005127 public boolean startUserInBackground(int userid) throws RemoteException {
5128 Parcel data = Parcel.obtain();
5129 Parcel reply = Parcel.obtain();
5130 data.writeInterfaceToken(IActivityManager.descriptor);
5131 data.writeInt(userid);
5132 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5133 reply.readException();
5134 boolean result = reply.readInt() != 0;
5135 reply.recycle();
5136 data.recycle();
5137 return result;
5138 }
5139
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005140 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5141 Parcel data = Parcel.obtain();
5142 Parcel reply = Parcel.obtain();
5143 data.writeInterfaceToken(IActivityManager.descriptor);
5144 data.writeInt(userid);
5145 data.writeStrongInterface(callback);
5146 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5147 reply.readException();
5148 int result = reply.readInt();
5149 reply.recycle();
5150 data.recycle();
5151 return result;
5152 }
5153
Amith Yamasani52f1d752012-03-28 18:19:29 -07005154 public UserInfo getCurrentUser() throws RemoteException {
5155 Parcel data = Parcel.obtain();
5156 Parcel reply = Parcel.obtain();
5157 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005158 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005159 reply.readException();
5160 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5161 reply.recycle();
5162 data.recycle();
5163 return userInfo;
5164 }
5165
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005166 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005167 Parcel data = Parcel.obtain();
5168 Parcel reply = Parcel.obtain();
5169 data.writeInterfaceToken(IActivityManager.descriptor);
5170 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005171 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005172 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5173 reply.readException();
5174 boolean result = reply.readInt() != 0;
5175 reply.recycle();
5176 data.recycle();
5177 return result;
5178 }
5179
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005180 public int[] getRunningUserIds() throws RemoteException {
5181 Parcel data = Parcel.obtain();
5182 Parcel reply = Parcel.obtain();
5183 data.writeInterfaceToken(IActivityManager.descriptor);
5184 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5185 reply.readException();
5186 int[] result = reply.createIntArray();
5187 reply.recycle();
5188 data.recycle();
5189 return result;
5190 }
5191
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005192 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005193 Parcel data = Parcel.obtain();
5194 Parcel reply = Parcel.obtain();
5195 data.writeInterfaceToken(IActivityManager.descriptor);
5196 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005197 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5198 reply.readException();
5199 boolean result = reply.readInt() != 0;
5200 reply.recycle();
5201 data.recycle();
5202 return result;
5203 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005204
Jeff Sharkeya4620792011-05-20 15:29:23 -07005205 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5206 Parcel data = Parcel.obtain();
5207 Parcel reply = Parcel.obtain();
5208 data.writeInterfaceToken(IActivityManager.descriptor);
5209 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5210 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5211 reply.readException();
5212 data.recycle();
5213 reply.recycle();
5214 }
5215
5216 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5217 Parcel data = Parcel.obtain();
5218 Parcel reply = Parcel.obtain();
5219 data.writeInterfaceToken(IActivityManager.descriptor);
5220 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5221 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5222 reply.readException();
5223 data.recycle();
5224 reply.recycle();
5225 }
5226
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005227 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5228 Parcel data = Parcel.obtain();
5229 Parcel reply = Parcel.obtain();
5230 data.writeInterfaceToken(IActivityManager.descriptor);
5231 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5232 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5233 reply.readException();
5234 data.recycle();
5235 reply.recycle();
5236 }
5237
5238 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5239 Parcel data = Parcel.obtain();
5240 Parcel reply = Parcel.obtain();
5241 data.writeInterfaceToken(IActivityManager.descriptor);
5242 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5243 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5244 reply.readException();
5245 data.recycle();
5246 reply.recycle();
5247 }
5248
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005249 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5250 Parcel data = Parcel.obtain();
5251 Parcel reply = Parcel.obtain();
5252 data.writeInterfaceToken(IActivityManager.descriptor);
5253 data.writeStrongBinder(sender.asBinder());
5254 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5255 reply.readException();
5256 boolean res = reply.readInt() != 0;
5257 data.recycle();
5258 reply.recycle();
5259 return res;
5260 }
5261
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005262 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5263 Parcel data = Parcel.obtain();
5264 Parcel reply = Parcel.obtain();
5265 data.writeInterfaceToken(IActivityManager.descriptor);
5266 data.writeStrongBinder(sender.asBinder());
5267 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5268 reply.readException();
5269 boolean res = reply.readInt() != 0;
5270 data.recycle();
5271 reply.recycle();
5272 return res;
5273 }
5274
Dianne Hackborn81038902012-11-26 17:04:09 -08005275 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5276 Parcel data = Parcel.obtain();
5277 Parcel reply = Parcel.obtain();
5278 data.writeInterfaceToken(IActivityManager.descriptor);
5279 data.writeStrongBinder(sender.asBinder());
5280 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5281 reply.readException();
5282 Intent res = reply.readInt() != 0
5283 ? Intent.CREATOR.createFromParcel(reply) : null;
5284 data.recycle();
5285 reply.recycle();
5286 return res;
5287 }
5288
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005289 public String getTagForIntentSender(IIntentSender sender, String prefix)
5290 throws RemoteException {
5291 Parcel data = Parcel.obtain();
5292 Parcel reply = Parcel.obtain();
5293 data.writeInterfaceToken(IActivityManager.descriptor);
5294 data.writeStrongBinder(sender.asBinder());
5295 data.writeString(prefix);
5296 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5297 reply.readException();
5298 String res = reply.readString();
5299 data.recycle();
5300 reply.recycle();
5301 return res;
5302 }
5303
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005304 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5305 {
5306 Parcel data = Parcel.obtain();
5307 Parcel reply = Parcel.obtain();
5308 data.writeInterfaceToken(IActivityManager.descriptor);
5309 values.writeToParcel(data, 0);
5310 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5311 reply.readException();
5312 data.recycle();
5313 reply.recycle();
5314 }
5315
Dianne Hackbornb437e092011-08-05 17:50:29 -07005316 public long[] getProcessPss(int[] pids) throws RemoteException {
5317 Parcel data = Parcel.obtain();
5318 Parcel reply = Parcel.obtain();
5319 data.writeInterfaceToken(IActivityManager.descriptor);
5320 data.writeIntArray(pids);
5321 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5322 reply.readException();
5323 long[] res = reply.createLongArray();
5324 data.recycle();
5325 reply.recycle();
5326 return res;
5327 }
5328
Dianne Hackborn661cd522011-08-22 00:26:20 -07005329 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5330 Parcel data = Parcel.obtain();
5331 Parcel reply = Parcel.obtain();
5332 data.writeInterfaceToken(IActivityManager.descriptor);
5333 TextUtils.writeToParcel(msg, data, 0);
5334 data.writeInt(always ? 1 : 0);
5335 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5336 reply.readException();
5337 data.recycle();
5338 reply.recycle();
5339 }
5340
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005341 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005342 Parcel data = Parcel.obtain();
5343 Parcel reply = Parcel.obtain();
5344 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005345 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005346 reply.readException();
5347 data.recycle();
5348 reply.recycle();
5349 }
5350
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005351 public void keyguardGoingAway(boolean disableWindowAnimations,
5352 boolean keyguardGoingToNotificationShade) throws RemoteException {
5353 Parcel data = Parcel.obtain();
5354 Parcel reply = Parcel.obtain();
5355 data.writeInterfaceToken(IActivityManager.descriptor);
5356 data.writeInt(disableWindowAnimations ? 1 : 0);
5357 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5358 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5359 reply.readException();
5360 data.recycle();
5361 reply.recycle();
5362 }
5363
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005364 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005365 throws RemoteException {
5366 Parcel data = Parcel.obtain();
5367 Parcel reply = Parcel.obtain();
5368 data.writeInterfaceToken(IActivityManager.descriptor);
5369 data.writeStrongBinder(token);
5370 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005371 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005372 reply.readException();
5373 boolean result = reply.readInt() != 0;
5374 data.recycle();
5375 reply.recycle();
5376 return result;
5377 }
5378
5379 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5380 throws RemoteException {
5381 Parcel data = Parcel.obtain();
5382 Parcel reply = Parcel.obtain();
5383 data.writeInterfaceToken(IActivityManager.descriptor);
5384 data.writeStrongBinder(token);
5385 target.writeToParcel(data, 0);
5386 data.writeInt(resultCode);
5387 if (resultData != null) {
5388 data.writeInt(1);
5389 resultData.writeToParcel(data, 0);
5390 } else {
5391 data.writeInt(0);
5392 }
5393 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5394 reply.readException();
5395 boolean result = reply.readInt() != 0;
5396 data.recycle();
5397 reply.recycle();
5398 return result;
5399 }
5400
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005401 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5402 Parcel data = Parcel.obtain();
5403 Parcel reply = Parcel.obtain();
5404 data.writeInterfaceToken(IActivityManager.descriptor);
5405 data.writeStrongBinder(activityToken);
5406 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5407 reply.readException();
5408 int result = reply.readInt();
5409 data.recycle();
5410 reply.recycle();
5411 return result;
5412 }
5413
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005414 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5415 Parcel data = Parcel.obtain();
5416 Parcel reply = Parcel.obtain();
5417 data.writeInterfaceToken(IActivityManager.descriptor);
5418 data.writeStrongBinder(activityToken);
5419 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5420 reply.readException();
5421 String result = reply.readString();
5422 data.recycle();
5423 reply.recycle();
5424 return result;
5425 }
5426
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005427 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5428 Parcel data = Parcel.obtain();
5429 Parcel reply = Parcel.obtain();
5430 data.writeInterfaceToken(IActivityManager.descriptor);
5431 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5432 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5433 reply.readException();
5434 data.recycle();
5435 reply.recycle();
5436 }
5437
5438 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5439 Parcel data = Parcel.obtain();
5440 Parcel reply = Parcel.obtain();
5441 data.writeInterfaceToken(IActivityManager.descriptor);
5442 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5443 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5444 reply.readException();
5445 data.recycle();
5446 reply.recycle();
5447 }
5448
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005449 public void requestBugReport() throws RemoteException {
5450 Parcel data = Parcel.obtain();
5451 Parcel reply = Parcel.obtain();
5452 data.writeInterfaceToken(IActivityManager.descriptor);
5453 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5454 reply.readException();
5455 data.recycle();
5456 reply.recycle();
5457 }
5458
Jeff Brownbd181bb2013-09-10 16:44:24 -07005459 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5460 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005461 Parcel data = Parcel.obtain();
5462 Parcel reply = Parcel.obtain();
5463 data.writeInterfaceToken(IActivityManager.descriptor);
5464 data.writeInt(pid);
5465 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005466 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005467 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5468 reply.readException();
5469 long res = reply.readInt();
5470 data.recycle();
5471 reply.recycle();
5472 return res;
5473 }
5474
Adam Skorydfc7fd72013-08-05 19:23:41 -07005475 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005476 Parcel data = Parcel.obtain();
5477 Parcel reply = Parcel.obtain();
5478 data.writeInterfaceToken(IActivityManager.descriptor);
5479 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005480 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005481 reply.readException();
5482 Bundle res = reply.readBundle();
5483 data.recycle();
5484 reply.recycle();
5485 return res;
5486 }
5487
Dianne Hackborn17f69352015-07-17 18:04:14 -07005488 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5489 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005490 Parcel data = Parcel.obtain();
5491 Parcel reply = Parcel.obtain();
5492 data.writeInterfaceToken(IActivityManager.descriptor);
5493 data.writeInt(requestType);
5494 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005495 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005496 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5497 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005498 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005499 data.recycle();
5500 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005501 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005502 }
5503
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005504 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005505 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005506 Parcel data = Parcel.obtain();
5507 Parcel reply = Parcel.obtain();
5508 data.writeInterfaceToken(IActivityManager.descriptor);
5509 data.writeStrongBinder(token);
5510 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005511 structure.writeToParcel(data, 0);
5512 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005513 if (referrer != null) {
5514 data.writeInt(1);
5515 referrer.writeToParcel(data, 0);
5516 } else {
5517 data.writeInt(0);
5518 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005519 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005520 reply.readException();
5521 data.recycle();
5522 reply.recycle();
5523 }
5524
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005525 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5526 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005527 Parcel data = Parcel.obtain();
5528 Parcel reply = Parcel.obtain();
5529 data.writeInterfaceToken(IActivityManager.descriptor);
5530 intent.writeToParcel(data, 0);
5531 data.writeInt(requestType);
5532 data.writeString(hint);
5533 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005534 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005535 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5536 reply.readException();
5537 boolean res = reply.readInt() != 0;
5538 data.recycle();
5539 reply.recycle();
5540 return res;
5541 }
5542
Dianne Hackborn17f69352015-07-17 18:04:14 -07005543 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005544 Parcel data = Parcel.obtain();
5545 Parcel reply = Parcel.obtain();
5546 data.writeInterfaceToken(IActivityManager.descriptor);
5547 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5548 reply.readException();
5549 boolean res = reply.readInt() != 0;
5550 data.recycle();
5551 reply.recycle();
5552 return res;
5553 }
5554
Dianne Hackborn17f69352015-07-17 18:04:14 -07005555 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5556 Parcel data = Parcel.obtain();
5557 Parcel reply = Parcel.obtain();
5558 data.writeInterfaceToken(IActivityManager.descriptor);
5559 data.writeStrongBinder(token);
5560 data.writeBundle(args);
5561 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5562 reply.readException();
5563 boolean res = reply.readInt() != 0;
5564 data.recycle();
5565 reply.recycle();
5566 return res;
5567 }
5568
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005569 public void killUid(int uid, String reason) throws RemoteException {
5570 Parcel data = Parcel.obtain();
5571 Parcel reply = Parcel.obtain();
5572 data.writeInterfaceToken(IActivityManager.descriptor);
5573 data.writeInt(uid);
5574 data.writeString(reason);
5575 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5576 reply.readException();
5577 data.recycle();
5578 reply.recycle();
5579 }
5580
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005581 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5582 Parcel data = Parcel.obtain();
5583 Parcel reply = Parcel.obtain();
5584 data.writeInterfaceToken(IActivityManager.descriptor);
5585 data.writeStrongBinder(who);
5586 data.writeInt(allowRestart ? 1 : 0);
5587 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5588 reply.readException();
5589 data.recycle();
5590 reply.recycle();
5591 }
5592
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005593 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5594 Parcel data = Parcel.obtain();
5595 Parcel reply = Parcel.obtain();
5596 data.writeInterfaceToken(IActivityManager.descriptor);
5597 data.writeStrongBinder(token);
5598 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5599 reply.readException();
5600 data.recycle();
5601 reply.recycle();
5602 }
5603
Craig Mautner5eda9b32013-07-02 11:58:16 -07005604 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5605 Parcel data = Parcel.obtain();
5606 Parcel reply = Parcel.obtain();
5607 data.writeInterfaceToken(IActivityManager.descriptor);
5608 data.writeStrongBinder(token);
5609 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5610 reply.readException();
5611 data.recycle();
5612 reply.recycle();
5613 }
5614
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005615 public void restart() throws RemoteException {
5616 Parcel data = Parcel.obtain();
5617 Parcel reply = Parcel.obtain();
5618 data.writeInterfaceToken(IActivityManager.descriptor);
5619 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5620 reply.readException();
5621 data.recycle();
5622 reply.recycle();
5623 }
5624
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005625 public void performIdleMaintenance() throws RemoteException {
5626 Parcel data = Parcel.obtain();
5627 Parcel reply = Parcel.obtain();
5628 data.writeInterfaceToken(IActivityManager.descriptor);
5629 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5630 reply.readException();
5631 data.recycle();
5632 reply.recycle();
5633 }
5634
Todd Kennedyca4d8422015-01-15 15:19:22 -08005635 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005636 IActivityContainerCallback callback) throws RemoteException {
5637 Parcel data = Parcel.obtain();
5638 Parcel reply = Parcel.obtain();
5639 data.writeInterfaceToken(IActivityManager.descriptor);
5640 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005641 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005642 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005643 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005644 final int result = reply.readInt();
5645 final IActivityContainer res;
5646 if (result == 1) {
5647 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5648 } else {
5649 res = null;
5650 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005651 data.recycle();
5652 reply.recycle();
5653 return res;
5654 }
5655
Craig Mautner95da1082014-02-24 17:54:35 -08005656 public void deleteActivityContainer(IActivityContainer activityContainer)
5657 throws RemoteException {
5658 Parcel data = Parcel.obtain();
5659 Parcel reply = Parcel.obtain();
5660 data.writeInterfaceToken(IActivityManager.descriptor);
5661 data.writeStrongBinder(activityContainer.asBinder());
5662 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5663 reply.readException();
5664 data.recycle();
5665 reply.recycle();
5666 }
5667
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005668 public boolean startBinderTracking() throws RemoteException {
5669 Parcel data = Parcel.obtain();
5670 Parcel reply = Parcel.obtain();
5671 data.writeInterfaceToken(IActivityManager.descriptor);
5672 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5673 reply.readException();
5674 boolean res = reply.readInt() != 0;
5675 reply.recycle();
5676 data.recycle();
5677 return res;
5678 }
5679
5680 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5681 Parcel data = Parcel.obtain();
5682 Parcel reply = Parcel.obtain();
5683 data.writeInterfaceToken(IActivityManager.descriptor);
5684 if (fd != null) {
5685 data.writeInt(1);
5686 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5687 } else {
5688 data.writeInt(0);
5689 }
5690 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5691 reply.readException();
5692 boolean res = reply.readInt() != 0;
5693 reply.recycle();
5694 data.recycle();
5695 return res;
5696 }
5697
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005698 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005699 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5700 Parcel data = Parcel.obtain();
5701 Parcel reply = Parcel.obtain();
5702 data.writeInterfaceToken(IActivityManager.descriptor);
5703 data.writeInt(displayId);
5704 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5705 reply.readException();
5706 final int result = reply.readInt();
5707 final IActivityContainer res;
5708 if (result == 1) {
5709 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5710 } else {
5711 res = null;
5712 }
5713 data.recycle();
5714 reply.recycle();
5715 return res;
5716 }
5717
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005718 @Override
5719 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005720 throws RemoteException {
5721 Parcel data = Parcel.obtain();
5722 Parcel reply = Parcel.obtain();
5723 data.writeInterfaceToken(IActivityManager.descriptor);
5724 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005725 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005726 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005727 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005728 data.recycle();
5729 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005730 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005731 }
5732
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005733 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005734 public void startLockTaskMode(int taskId) throws RemoteException {
5735 Parcel data = Parcel.obtain();
5736 Parcel reply = Parcel.obtain();
5737 data.writeInterfaceToken(IActivityManager.descriptor);
5738 data.writeInt(taskId);
5739 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5740 reply.readException();
5741 data.recycle();
5742 reply.recycle();
5743 }
5744
5745 @Override
5746 public void startLockTaskMode(IBinder token) throws RemoteException {
5747 Parcel data = Parcel.obtain();
5748 Parcel reply = Parcel.obtain();
5749 data.writeInterfaceToken(IActivityManager.descriptor);
5750 data.writeStrongBinder(token);
5751 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5752 reply.readException();
5753 data.recycle();
5754 reply.recycle();
5755 }
5756
5757 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005758 public void startLockTaskModeOnCurrent() throws RemoteException {
5759 Parcel data = Parcel.obtain();
5760 Parcel reply = Parcel.obtain();
5761 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005762 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005763 reply.readException();
5764 data.recycle();
5765 reply.recycle();
5766 }
5767
5768 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005769 public void stopLockTaskMode() throws RemoteException {
5770 Parcel data = Parcel.obtain();
5771 Parcel reply = Parcel.obtain();
5772 data.writeInterfaceToken(IActivityManager.descriptor);
5773 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5774 reply.readException();
5775 data.recycle();
5776 reply.recycle();
5777 }
5778
5779 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005780 public void stopLockTaskModeOnCurrent() throws RemoteException {
5781 Parcel data = Parcel.obtain();
5782 Parcel reply = Parcel.obtain();
5783 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005784 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005785 reply.readException();
5786 data.recycle();
5787 reply.recycle();
5788 }
5789
5790 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005791 public boolean isInLockTaskMode() throws RemoteException {
5792 Parcel data = Parcel.obtain();
5793 Parcel reply = Parcel.obtain();
5794 data.writeInterfaceToken(IActivityManager.descriptor);
5795 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5796 reply.readException();
5797 boolean isInLockTaskMode = reply.readInt() == 1;
5798 data.recycle();
5799 reply.recycle();
5800 return isInLockTaskMode;
5801 }
5802
Craig Mautner688b5102014-03-27 16:55:03 -07005803 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005804 public int getLockTaskModeState() throws RemoteException {
5805 Parcel data = Parcel.obtain();
5806 Parcel reply = Parcel.obtain();
5807 data.writeInterfaceToken(IActivityManager.descriptor);
5808 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5809 reply.readException();
5810 int lockTaskModeState = reply.readInt();
5811 data.recycle();
5812 reply.recycle();
5813 return lockTaskModeState;
5814 }
5815
5816 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005817 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5818 Parcel data = Parcel.obtain();
5819 Parcel reply = Parcel.obtain();
5820 data.writeInterfaceToken(IActivityManager.descriptor);
5821 data.writeStrongBinder(token);
5822 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5823 IBinder.FLAG_ONEWAY);
5824 reply.readException();
5825 data.recycle();
5826 reply.recycle();
5827 }
5828
5829 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005830 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005831 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005832 Parcel data = Parcel.obtain();
5833 Parcel reply = Parcel.obtain();
5834 data.writeInterfaceToken(IActivityManager.descriptor);
5835 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005836 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005837 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005838 reply.readException();
5839 data.recycle();
5840 reply.recycle();
5841 }
5842
Craig Mautneree2e45a2014-06-27 12:10:03 -07005843 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005844 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5845 Parcel data = Parcel.obtain();
5846 Parcel reply = Parcel.obtain();
5847 data.writeInterfaceToken(IActivityManager.descriptor);
5848 data.writeInt(taskId);
5849 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005850 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005851 reply.readException();
5852 data.recycle();
5853 reply.recycle();
5854 }
5855
5856 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005857 public void resizeTask(int taskId, Rect r) throws RemoteException
5858 {
5859 Parcel data = Parcel.obtain();
5860 Parcel reply = Parcel.obtain();
5861 data.writeInterfaceToken(IActivityManager.descriptor);
5862 data.writeInt(taskId);
5863 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005864 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005865 reply.readException();
5866 data.recycle();
5867 reply.recycle();
5868 }
5869
5870 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07005871 public Rect getTaskBounds(int taskId) throws RemoteException
5872 {
5873 Parcel data = Parcel.obtain();
5874 Parcel reply = Parcel.obtain();
5875 data.writeInterfaceToken(IActivityManager.descriptor);
5876 data.writeInt(taskId);
5877 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
5878 reply.readException();
5879 Rect rect = Rect.CREATOR.createFromParcel(reply);
5880 data.recycle();
5881 reply.recycle();
5882 return rect;
5883 }
5884
5885 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005886 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5887 Parcel data = Parcel.obtain();
5888 Parcel reply = Parcel.obtain();
5889 data.writeInterfaceToken(IActivityManager.descriptor);
5890 data.writeString(filename);
5891 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5892 reply.readException();
5893 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5894 data.recycle();
5895 reply.recycle();
5896 return icon;
5897 }
5898
5899 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005900 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5901 throws RemoteException {
5902 Parcel data = Parcel.obtain();
5903 Parcel reply = Parcel.obtain();
5904 data.writeInterfaceToken(IActivityManager.descriptor);
5905 if (options == null) {
5906 data.writeInt(0);
5907 } else {
5908 data.writeInt(1);
5909 data.writeBundle(options.toBundle());
5910 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005911 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005912 reply.readException();
5913 data.recycle();
5914 reply.recycle();
5915 }
5916
5917 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005918 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005919 Parcel data = Parcel.obtain();
5920 Parcel reply = Parcel.obtain();
5921 data.writeInterfaceToken(IActivityManager.descriptor);
5922 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005923 data.writeInt(visible ? 1 : 0);
5924 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005925 reply.readException();
5926 boolean success = reply.readInt() > 0;
5927 data.recycle();
5928 reply.recycle();
5929 return success;
5930 }
5931
5932 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005933 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005934 Parcel data = Parcel.obtain();
5935 Parcel reply = Parcel.obtain();
5936 data.writeInterfaceToken(IActivityManager.descriptor);
5937 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005938 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005939 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005940 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005941 data.recycle();
5942 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005943 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005944 }
5945
5946 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005947 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005948 Parcel data = Parcel.obtain();
5949 Parcel reply = Parcel.obtain();
5950 data.writeInterfaceToken(IActivityManager.descriptor);
5951 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005952 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005953 reply.readException();
5954 data.recycle();
5955 reply.recycle();
5956 }
5957
5958 @Override
5959 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5960 Parcel data = Parcel.obtain();
5961 Parcel reply = Parcel.obtain();
5962 data.writeInterfaceToken(IActivityManager.descriptor);
5963 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005964 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005965 reply.readException();
5966 data.recycle();
5967 reply.recycle();
5968 }
5969
Craig Mautner8746a472014-07-24 15:12:54 -07005970 @Override
5971 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5972 Parcel data = Parcel.obtain();
5973 Parcel reply = Parcel.obtain();
5974 data.writeInterfaceToken(IActivityManager.descriptor);
5975 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005976 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005977 reply.readException();
5978 data.recycle();
5979 reply.recycle();
5980 }
5981
Craig Mautner6e2f3952014-09-09 14:26:41 -07005982 @Override
5983 public void bootAnimationComplete() throws RemoteException {
5984 Parcel data = Parcel.obtain();
5985 Parcel reply = Parcel.obtain();
5986 data.writeInterfaceToken(IActivityManager.descriptor);
5987 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5988 reply.readException();
5989 data.recycle();
5990 reply.recycle();
5991 }
5992
Wale Ogunwale18795a22014-12-03 11:38:33 -08005993 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005994 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5995 Parcel data = Parcel.obtain();
5996 Parcel reply = Parcel.obtain();
5997 data.writeInterfaceToken(IActivityManager.descriptor);
5998 data.writeInt(uid);
5999 data.writeByteArray(firstPacket);
6000 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6001 reply.readException();
6002 data.recycle();
6003 reply.recycle();
6004 }
6005
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006006 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006007 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6008 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006009 Parcel data = Parcel.obtain();
6010 Parcel reply = Parcel.obtain();
6011 data.writeInterfaceToken(IActivityManager.descriptor);
6012 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006013 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006014 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006015 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006016 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6017 reply.readException();
6018 data.recycle();
6019 reply.recycle();
6020 }
6021
6022 @Override
6023 public void dumpHeapFinished(String path) throws RemoteException {
6024 Parcel data = Parcel.obtain();
6025 Parcel reply = Parcel.obtain();
6026 data.writeInterfaceToken(IActivityManager.descriptor);
6027 data.writeString(path);
6028 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6029 reply.readException();
6030 data.recycle();
6031 reply.recycle();
6032 }
6033
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006034 @Override
6035 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6036 throws RemoteException {
6037 Parcel data = Parcel.obtain();
6038 Parcel reply = Parcel.obtain();
6039 data.writeInterfaceToken(IActivityManager.descriptor);
6040 data.writeStrongBinder(session.asBinder());
6041 data.writeInt(keepAwake ? 1 : 0);
6042 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6043 reply.readException();
6044 data.recycle();
6045 reply.recycle();
6046 }
6047
Craig Mautnere5600772015-04-03 21:36:37 -07006048 @Override
6049 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6050 Parcel data = Parcel.obtain();
6051 Parcel reply = Parcel.obtain();
6052 data.writeInterfaceToken(IActivityManager.descriptor);
6053 data.writeInt(userId);
6054 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006055 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006056 reply.readException();
6057 data.recycle();
6058 reply.recycle();
6059 }
6060
Dianne Hackborn1e383822015-04-10 14:02:33 -07006061 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07006062 public void updateDeviceOwner(String packageName) throws RemoteException {
6063 Parcel data = Parcel.obtain();
6064 Parcel reply = Parcel.obtain();
6065 data.writeInterfaceToken(IActivityManager.descriptor);
6066 data.writeString(packageName);
6067 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6068 reply.readException();
6069 data.recycle();
6070 reply.recycle();
6071 }
6072
6073 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006074 public int getPackageProcessState(String packageName, String callingPackage)
6075 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006076 Parcel data = Parcel.obtain();
6077 Parcel reply = Parcel.obtain();
6078 data.writeInterfaceToken(IActivityManager.descriptor);
6079 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006080 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006081 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6082 reply.readException();
6083 int res = reply.readInt();
6084 data.recycle();
6085 reply.recycle();
6086 return res;
6087 }
6088
Stefan Kuhne16045c22015-06-05 07:18:06 -07006089 @Override
6090 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6091 throws RemoteException {
6092 Parcel data = Parcel.obtain();
6093 Parcel reply = Parcel.obtain();
6094 data.writeInterfaceToken(IActivityManager.descriptor);
6095 data.writeString(process);
6096 data.writeInt(userId);
6097 data.writeInt(level);
6098 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6099 reply.readException();
6100 int res = reply.readInt();
6101 data.recycle();
6102 reply.recycle();
6103 return res != 0;
6104 }
6105
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006106 @Override
6107 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6108 Parcel data = Parcel.obtain();
6109 Parcel reply = Parcel.obtain();
6110 data.writeInterfaceToken(IActivityManager.descriptor);
6111 data.writeStrongBinder(token);
6112 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6113 reply.readException();
6114 int res = reply.readInt();
6115 data.recycle();
6116 reply.recycle();
6117 return res != 0;
6118 }
6119
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006120 @Override
6121 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6122 Parcel data = Parcel.obtain();
6123 Parcel reply = Parcel.obtain();
6124 data.writeInterfaceToken(IActivityManager.descriptor);
6125 data.writeStrongBinder(token);
6126 data.writeInt(stackId);
6127 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6128 reply.readException();
6129 data.recycle();
6130 reply.recycle();
6131 }
6132
6133 @Override
6134 public int getActivityStackId(IBinder token) throws RemoteException {
6135 Parcel data = Parcel.obtain();
6136 Parcel reply = Parcel.obtain();
6137 data.writeInterfaceToken(IActivityManager.descriptor);
6138 data.writeStrongBinder(token);
6139 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6140 reply.readException();
6141 int stackId = reply.readInt();
6142 data.recycle();
6143 reply.recycle();
6144 return stackId;
6145 }
6146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006147 private IBinder mRemote;
6148}