blob: 9112f12e008e3657af081ee6d7ceda41021306b4 [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,
Svet Ganov16a16892015-04-16 10:32:04 -0700111 null /*permission*/, appOp, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Dianne Hackborn1e383822015-04-10 14:02:33 -0700119 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg, tag);
120 } catch (RemoteException ex) {
121 }
122 }
123
124 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
125 try {
126 getDefault().noteAlarmStart(ps.getTarget(), sourceUid, tag);
127 } catch (RemoteException ex) {
128 }
129 }
130
131 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
132 try {
133 getDefault().noteAlarmFinish(ps.getTarget(), sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 } catch (RemoteException ex) {
135 }
136 }
137
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800138 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 attachInterface(this, descriptor);
140 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700141
142 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
144 throws RemoteException {
145 switch (code) {
146 case START_ACTIVITY_TRANSACTION:
147 {
148 data.enforceInterface(IActivityManager.descriptor);
149 IBinder b = data.readStrongBinder();
150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800151 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 Intent intent = Intent.CREATOR.createFromParcel(data);
153 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800155 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700157 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700158 ProfilerInfo profilerInfo = data.readInt() != 0
159 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700160 Bundle options = data.readInt() != 0
161 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800162 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700163 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 reply.writeNoException();
165 reply.writeInt(result);
166 return true;
167 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700168
Amith Yamasani82644082012-08-03 13:09:11 -0700169 case START_ACTIVITY_AS_USER_TRANSACTION:
170 {
171 data.enforceInterface(IActivityManager.descriptor);
172 IBinder b = data.readStrongBinder();
173 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800174 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700175 Intent intent = Intent.CREATOR.createFromParcel(data);
176 String resolvedType = data.readString();
177 IBinder resultTo = data.readStrongBinder();
178 String resultWho = data.readString();
179 int requestCode = data.readInt();
180 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700181 ProfilerInfo profilerInfo = data.readInt() != 0
182 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700183 Bundle options = data.readInt() != 0
184 ? Bundle.CREATOR.createFromParcel(data) : null;
185 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800186 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700187 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700188 reply.writeNoException();
189 reply.writeInt(result);
190 return true;
191 }
192
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700193 case START_ACTIVITY_AS_CALLER_TRANSACTION:
194 {
195 data.enforceInterface(IActivityManager.descriptor);
196 IBinder b = data.readStrongBinder();
197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
198 String callingPackage = data.readString();
199 Intent intent = Intent.CREATOR.createFromParcel(data);
200 String resolvedType = data.readString();
201 IBinder resultTo = data.readStrongBinder();
202 String resultWho = data.readString();
203 int requestCode = data.readInt();
204 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700205 ProfilerInfo profilerInfo = data.readInt() != 0
206 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700207 Bundle options = data.readInt() != 0
208 ? Bundle.CREATOR.createFromParcel(data) : null;
Jeff Sharkey97978802014-10-14 10:48:18 -0700209 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700210 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 reply.writeNoException();
213 reply.writeInt(result);
214 return true;
215 }
216
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800217 case START_ACTIVITY_AND_WAIT_TRANSACTION:
218 {
219 data.enforceInterface(IActivityManager.descriptor);
220 IBinder b = data.readStrongBinder();
221 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800222 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800223 Intent intent = Intent.CREATOR.createFromParcel(data);
224 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800225 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800226 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800227 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700228 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700229 ProfilerInfo profilerInfo = data.readInt() != 0
230 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 Bundle options = data.readInt() != 0
232 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700233 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800234 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700235 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800236 reply.writeNoException();
237 result.writeToParcel(reply, 0);
238 return true;
239 }
240
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700241 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
242 {
243 data.enforceInterface(IActivityManager.descriptor);
244 IBinder b = data.readStrongBinder();
245 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800246 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700247 Intent intent = Intent.CREATOR.createFromParcel(data);
248 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700249 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700250 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700251 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700252 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700253 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700254 Bundle options = data.readInt() != 0
255 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700256 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800257 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700258 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700259 reply.writeNoException();
260 reply.writeInt(result);
261 return true;
262 }
263
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700264 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700265 {
266 data.enforceInterface(IActivityManager.descriptor);
267 IBinder b = data.readStrongBinder();
268 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700269 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700270 Intent fillInIntent = null;
271 if (data.readInt() != 0) {
272 fillInIntent = Intent.CREATOR.createFromParcel(data);
273 }
274 String resolvedType = data.readString();
275 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700276 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700277 int requestCode = data.readInt();
278 int flagsMask = data.readInt();
279 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700280 Bundle options = data.readInt() != 0
281 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700282 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700283 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700284 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700285 reply.writeNoException();
286 reply.writeInt(result);
287 return true;
288 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700289
Dianne Hackborn91097de2014-04-04 18:02:06 -0700290 case START_VOICE_ACTIVITY_TRANSACTION:
291 {
292 data.enforceInterface(IActivityManager.descriptor);
293 String callingPackage = data.readString();
294 int callingPid = data.readInt();
295 int callingUid = data.readInt();
296 Intent intent = Intent.CREATOR.createFromParcel(data);
297 String resolvedType = data.readString();
298 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
299 data.readStrongBinder());
300 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
301 data.readStrongBinder());
302 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700303 ProfilerInfo profilerInfo = data.readInt() != 0
304 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700305 Bundle options = data.readInt() != 0
306 ? Bundle.CREATOR.createFromParcel(data) : null;
307 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700308 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
309 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700310 reply.writeNoException();
311 reply.writeInt(result);
312 return true;
313 }
314
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800315 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
316 {
317 data.enforceInterface(IActivityManager.descriptor);
318 IBinder callingActivity = data.readStrongBinder();
319 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700320 Bundle options = data.readInt() != 0
321 ? Bundle.CREATOR.createFromParcel(data) : null;
322 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800323 reply.writeNoException();
324 reply.writeInt(result ? 1 : 0);
325 return true;
326 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700327
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700328 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
329 {
330 data.enforceInterface(IActivityManager.descriptor);
331 int taskId = data.readInt();
332 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
333 int result = startActivityFromRecents(taskId, options);
334 reply.writeNoException();
335 reply.writeInt(result);
336 return true;
337 }
338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800339 case FINISH_ACTIVITY_TRANSACTION: {
340 data.enforceInterface(IActivityManager.descriptor);
341 IBinder token = data.readStrongBinder();
342 Intent resultData = null;
343 int resultCode = data.readInt();
344 if (data.readInt() != 0) {
345 resultData = Intent.CREATOR.createFromParcel(data);
346 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700347 boolean finishTask = (data.readInt() != 0);
348 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800349 reply.writeNoException();
350 reply.writeInt(res ? 1 : 0);
351 return true;
352 }
353
354 case FINISH_SUB_ACTIVITY_TRANSACTION: {
355 data.enforceInterface(IActivityManager.descriptor);
356 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700357 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 int requestCode = data.readInt();
359 finishSubActivity(token, resultWho, requestCode);
360 reply.writeNoException();
361 return true;
362 }
363
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700364 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
365 data.enforceInterface(IActivityManager.descriptor);
366 IBinder token = data.readStrongBinder();
367 boolean res = finishActivityAffinity(token);
368 reply.writeNoException();
369 reply.writeInt(res ? 1 : 0);
370 return true;
371 }
372
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700373 case FINISH_VOICE_TASK_TRANSACTION: {
374 data.enforceInterface(IActivityManager.descriptor);
375 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
376 data.readStrongBinder());
377 finishVoiceTask(session);
378 reply.writeNoException();
379 return true;
380 }
381
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700382 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
383 data.enforceInterface(IActivityManager.descriptor);
384 IBinder token = data.readStrongBinder();
385 boolean res = releaseActivityInstance(token);
386 reply.writeNoException();
387 reply.writeInt(res ? 1 : 0);
388 return true;
389 }
390
391 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
392 data.enforceInterface(IActivityManager.descriptor);
393 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
394 releaseSomeActivities(app);
395 reply.writeNoException();
396 return true;
397 }
398
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800399 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
400 data.enforceInterface(IActivityManager.descriptor);
401 IBinder token = data.readStrongBinder();
402 boolean res = willActivityBeVisible(token);
403 reply.writeNoException();
404 reply.writeInt(res ? 1 : 0);
405 return true;
406 }
407
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800408 case REGISTER_RECEIVER_TRANSACTION:
409 {
410 data.enforceInterface(IActivityManager.descriptor);
411 IBinder b = data.readStrongBinder();
412 IApplicationThread app =
413 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700414 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 b = data.readStrongBinder();
416 IIntentReceiver rec
417 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
418 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
419 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700420 int userId = data.readInt();
421 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800422 reply.writeNoException();
423 if (intent != null) {
424 reply.writeInt(1);
425 intent.writeToParcel(reply, 0);
426 } else {
427 reply.writeInt(0);
428 }
429 return true;
430 }
431
432 case UNREGISTER_RECEIVER_TRANSACTION:
433 {
434 data.enforceInterface(IActivityManager.descriptor);
435 IBinder b = data.readStrongBinder();
436 if (b == null) {
437 return true;
438 }
439 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
440 unregisterReceiver(rec);
441 reply.writeNoException();
442 return true;
443 }
444
445 case BROADCAST_INTENT_TRANSACTION:
446 {
447 data.enforceInterface(IActivityManager.descriptor);
448 IBinder b = data.readStrongBinder();
449 IApplicationThread app =
450 b != null ? ApplicationThreadNative.asInterface(b) : null;
451 Intent intent = Intent.CREATOR.createFromParcel(data);
452 String resolvedType = data.readString();
453 b = data.readStrongBinder();
454 IIntentReceiver resultTo =
455 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
456 int resultCode = data.readInt();
457 String resultData = data.readString();
458 Bundle resultExtras = data.readBundle();
459 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800460 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800461 boolean serialized = data.readInt() != 0;
462 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700463 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800464 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800465 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700466 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 reply.writeNoException();
468 reply.writeInt(res);
469 return true;
470 }
471
472 case UNBROADCAST_INTENT_TRANSACTION:
473 {
474 data.enforceInterface(IActivityManager.descriptor);
475 IBinder b = data.readStrongBinder();
476 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
477 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700478 int userId = data.readInt();
479 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800480 reply.writeNoException();
481 return true;
482 }
483
484 case FINISH_RECEIVER_TRANSACTION: {
485 data.enforceInterface(IActivityManager.descriptor);
486 IBinder who = data.readStrongBinder();
487 int resultCode = data.readInt();
488 String resultData = data.readString();
489 Bundle resultExtras = data.readBundle();
490 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800491 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800493 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 }
495 reply.writeNoException();
496 return true;
497 }
498
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 case ATTACH_APPLICATION_TRANSACTION: {
500 data.enforceInterface(IActivityManager.descriptor);
501 IApplicationThread app = ApplicationThreadNative.asInterface(
502 data.readStrongBinder());
503 if (app != null) {
504 attachApplication(app);
505 }
506 reply.writeNoException();
507 return true;
508 }
509
510 case ACTIVITY_IDLE_TRANSACTION: {
511 data.enforceInterface(IActivityManager.descriptor);
512 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700513 Configuration config = null;
514 if (data.readInt() != 0) {
515 config = Configuration.CREATOR.createFromParcel(data);
516 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700517 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800518 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700519 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800520 }
521 reply.writeNoException();
522 return true;
523 }
524
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700525 case ACTIVITY_RESUMED_TRANSACTION: {
526 data.enforceInterface(IActivityManager.descriptor);
527 IBinder token = data.readStrongBinder();
528 activityResumed(token);
529 reply.writeNoException();
530 return true;
531 }
532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800533 case ACTIVITY_PAUSED_TRANSACTION: {
534 data.enforceInterface(IActivityManager.descriptor);
535 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700536 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 reply.writeNoException();
538 return true;
539 }
540
541 case ACTIVITY_STOPPED_TRANSACTION: {
542 data.enforceInterface(IActivityManager.descriptor);
543 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800544 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700545 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700547 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800548 reply.writeNoException();
549 return true;
550 }
551
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800552 case ACTIVITY_SLEPT_TRANSACTION: {
553 data.enforceInterface(IActivityManager.descriptor);
554 IBinder token = data.readStrongBinder();
555 activitySlept(token);
556 reply.writeNoException();
557 return true;
558 }
559
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800560 case ACTIVITY_DESTROYED_TRANSACTION: {
561 data.enforceInterface(IActivityManager.descriptor);
562 IBinder token = data.readStrongBinder();
563 activityDestroyed(token);
564 reply.writeNoException();
565 return true;
566 }
567
568 case GET_CALLING_PACKAGE_TRANSACTION: {
569 data.enforceInterface(IActivityManager.descriptor);
570 IBinder token = data.readStrongBinder();
571 String res = token != null ? getCallingPackage(token) : null;
572 reply.writeNoException();
573 reply.writeString(res);
574 return true;
575 }
576
577 case GET_CALLING_ACTIVITY_TRANSACTION: {
578 data.enforceInterface(IActivityManager.descriptor);
579 IBinder token = data.readStrongBinder();
580 ComponentName cn = getCallingActivity(token);
581 reply.writeNoException();
582 ComponentName.writeToParcel(cn, reply);
583 return true;
584 }
585
Winson Chung1147c402014-05-14 11:05:00 -0700586 case GET_APP_TASKS_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700588 String callingPackage = data.readString();
589 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700590 reply.writeNoException();
591 int N = list != null ? list.size() : -1;
592 reply.writeInt(N);
593 int i;
594 for (i=0; i<N; i++) {
595 IAppTask task = list.get(i);
596 reply.writeStrongBinder(task.asBinder());
597 }
598 return true;
599 }
600
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700601 case ADD_APP_TASK_TRANSACTION: {
602 data.enforceInterface(IActivityManager.descriptor);
603 IBinder activityToken = data.readStrongBinder();
604 Intent intent = Intent.CREATOR.createFromParcel(data);
605 ActivityManager.TaskDescription descr
606 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
607 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
608 int res = addAppTask(activityToken, intent, descr, thumbnail);
609 reply.writeNoException();
610 reply.writeInt(res);
611 return true;
612 }
613
614 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 Point size = getAppTaskThumbnailSize();
617 reply.writeNoException();
618 size.writeToParcel(reply, 0);
619 return true;
620 }
621
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 case GET_TASKS_TRANSACTION: {
623 data.enforceInterface(IActivityManager.descriptor);
624 int maxNum = data.readInt();
625 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700626 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800627 reply.writeNoException();
628 int N = list != null ? list.size() : -1;
629 reply.writeInt(N);
630 int i;
631 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700632 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 info.writeToParcel(reply, 0);
634 }
635 return true;
636 }
637
638 case GET_RECENT_TASKS_TRANSACTION: {
639 data.enforceInterface(IActivityManager.descriptor);
640 int maxNum = data.readInt();
641 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700642 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700644 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800645 reply.writeNoException();
646 reply.writeTypedList(list);
647 return true;
648 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700649
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700650 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800651 data.enforceInterface(IActivityManager.descriptor);
652 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700653 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800654 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700655 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800656 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700657 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700658 } else {
659 reply.writeInt(0);
660 }
661 return true;
662 }
663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 case GET_SERVICES_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 int maxNum = data.readInt();
667 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700668 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800669 reply.writeNoException();
670 int N = list != null ? list.size() : -1;
671 reply.writeInt(N);
672 int i;
673 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700674 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 info.writeToParcel(reply, 0);
676 }
677 return true;
678 }
679
680 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
681 data.enforceInterface(IActivityManager.descriptor);
682 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
683 reply.writeNoException();
684 reply.writeTypedList(list);
685 return true;
686 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700687
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
689 data.enforceInterface(IActivityManager.descriptor);
690 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
691 reply.writeNoException();
692 reply.writeTypedList(list);
693 return true;
694 }
695
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700696 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
697 data.enforceInterface(IActivityManager.descriptor);
698 List<ApplicationInfo> list = getRunningExternalApplications();
699 reply.writeNoException();
700 reply.writeTypedList(list);
701 return true;
702 }
703
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 case MOVE_TASK_TO_FRONT_TRANSACTION: {
705 data.enforceInterface(IActivityManager.descriptor);
706 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800707 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700708 Bundle options = data.readInt() != 0
709 ? Bundle.CREATOR.createFromParcel(data) : null;
710 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 reply.writeNoException();
712 return true;
713 }
714
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
716 data.enforceInterface(IActivityManager.descriptor);
717 IBinder token = data.readStrongBinder();
718 boolean nonRoot = data.readInt() != 0;
719 boolean res = moveActivityTaskToBack(token, nonRoot);
720 reply.writeNoException();
721 reply.writeInt(res ? 1 : 0);
722 return true;
723 }
724
725 case MOVE_TASK_BACKWARDS_TRANSACTION: {
726 data.enforceInterface(IActivityManager.descriptor);
727 int task = data.readInt();
728 moveTaskBackwards(task);
729 reply.writeNoException();
730 return true;
731 }
732
Craig Mautnerc00204b2013-03-05 15:02:14 -0800733 case MOVE_TASK_TO_STACK_TRANSACTION: {
734 data.enforceInterface(IActivityManager.descriptor);
735 int taskId = data.readInt();
736 int stackId = data.readInt();
737 boolean toTop = data.readInt() != 0;
738 moveTaskToStack(taskId, stackId, toTop);
739 reply.writeNoException();
740 return true;
741 }
742
743 case RESIZE_STACK_TRANSACTION: {
744 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800745 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800746 Rect r = Rect.CREATOR.createFromParcel(data);
747 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800748 reply.writeNoException();
749 return true;
750 }
751
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800752 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700753 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800754 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700755 reply.writeNoException();
756 reply.writeTypedList(list);
757 return true;
758 }
759
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800760 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700761 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800762 int stackId = data.readInt();
763 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700764 reply.writeNoException();
765 if (info != null) {
766 reply.writeInt(1);
767 info.writeToParcel(reply, 0);
768 } else {
769 reply.writeInt(0);
770 }
771 return true;
772 }
773
Winson Chung303e1ff2014-03-07 15:06:19 -0800774 case IS_IN_HOME_STACK_TRANSACTION: {
775 data.enforceInterface(IActivityManager.descriptor);
776 int taskId = data.readInt();
777 boolean isInHomeStack = isInHomeStack(taskId);
778 reply.writeNoException();
779 reply.writeInt(isInHomeStack ? 1 : 0);
780 return true;
781 }
782
Craig Mautnercf910b02013-04-23 11:23:27 -0700783 case SET_FOCUSED_STACK_TRANSACTION: {
784 data.enforceInterface(IActivityManager.descriptor);
785 int stackId = data.readInt();
786 setFocusedStack(stackId);
787 reply.writeNoException();
788 return true;
789 }
790
Winson Chungd16c5652015-01-26 16:11:07 -0800791 case GET_FOCUSED_STACK_ID_TRANSACTION: {
792 data.enforceInterface(IActivityManager.descriptor);
793 int focusedStackId = getFocusedStackId();
794 reply.writeNoException();
795 reply.writeInt(focusedStackId);
796 return true;
797 }
798
Winson Chung740c3ac2014-11-12 16:14:38 -0800799 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
800 data.enforceInterface(IActivityManager.descriptor);
801 IBinder token = data.readStrongBinder();
802 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
803 reply.writeNoException();
804 return true;
805 }
806
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800807 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 IBinder token = data.readStrongBinder();
810 boolean onlyRoot = data.readInt() != 0;
811 int res = token != null
812 ? getTaskForActivity(token, onlyRoot) : -1;
813 reply.writeNoException();
814 reply.writeInt(res);
815 return true;
816 }
817
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800818 case GET_CONTENT_PROVIDER_TRANSACTION: {
819 data.enforceInterface(IActivityManager.descriptor);
820 IBinder b = data.readStrongBinder();
821 IApplicationThread app = ApplicationThreadNative.asInterface(b);
822 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700823 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700824 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700825 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800826 reply.writeNoException();
827 if (cph != null) {
828 reply.writeInt(1);
829 cph.writeToParcel(reply, 0);
830 } else {
831 reply.writeInt(0);
832 }
833 return true;
834 }
835
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800836 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
837 data.enforceInterface(IActivityManager.descriptor);
838 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700839 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800840 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700841 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800842 reply.writeNoException();
843 if (cph != null) {
844 reply.writeInt(1);
845 cph.writeToParcel(reply, 0);
846 } else {
847 reply.writeInt(0);
848 }
849 return true;
850 }
851
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800852 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder b = data.readStrongBinder();
855 IApplicationThread app = ApplicationThreadNative.asInterface(b);
856 ArrayList<ContentProviderHolder> providers =
857 data.createTypedArrayList(ContentProviderHolder.CREATOR);
858 publishContentProviders(app, providers);
859 reply.writeNoException();
860 return true;
861 }
862
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700863 case REF_CONTENT_PROVIDER_TRANSACTION: {
864 data.enforceInterface(IActivityManager.descriptor);
865 IBinder b = data.readStrongBinder();
866 int stable = data.readInt();
867 int unstable = data.readInt();
868 boolean res = refContentProvider(b, stable, unstable);
869 reply.writeNoException();
870 reply.writeInt(res ? 1 : 0);
871 return true;
872 }
873
874 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
875 data.enforceInterface(IActivityManager.descriptor);
876 IBinder b = data.readStrongBinder();
877 unstableProviderDied(b);
878 reply.writeNoException();
879 return true;
880 }
881
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700882 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
883 data.enforceInterface(IActivityManager.descriptor);
884 IBinder b = data.readStrongBinder();
885 appNotRespondingViaProvider(b);
886 reply.writeNoException();
887 return true;
888 }
889
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800890 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
891 data.enforceInterface(IActivityManager.descriptor);
892 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700893 boolean stable = data.readInt() != 0;
894 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800895 reply.writeNoException();
896 return true;
897 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800898
899 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 String name = data.readString();
902 IBinder token = data.readStrongBinder();
903 removeContentProviderExternal(name, token);
904 reply.writeNoException();
905 return true;
906 }
907
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700908 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
911 PendingIntent pi = getRunningServiceControlPanel(comp);
912 reply.writeNoException();
913 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
914 return true;
915 }
916
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 case START_SERVICE_TRANSACTION: {
918 data.enforceInterface(IActivityManager.descriptor);
919 IBinder b = data.readStrongBinder();
920 IApplicationThread app = ApplicationThreadNative.asInterface(b);
921 Intent service = Intent.CREATOR.createFromParcel(data);
922 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700923 int userId = data.readInt();
924 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 reply.writeNoException();
926 ComponentName.writeToParcel(cn, reply);
927 return true;
928 }
929
930 case STOP_SERVICE_TRANSACTION: {
931 data.enforceInterface(IActivityManager.descriptor);
932 IBinder b = data.readStrongBinder();
933 IApplicationThread app = ApplicationThreadNative.asInterface(b);
934 Intent service = Intent.CREATOR.createFromParcel(data);
935 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700936 int userId = data.readInt();
937 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 reply.writeNoException();
939 reply.writeInt(res);
940 return true;
941 }
942
943 case STOP_SERVICE_TOKEN_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 ComponentName className = ComponentName.readFromParcel(data);
946 IBinder token = data.readStrongBinder();
947 int startId = data.readInt();
948 boolean res = stopServiceToken(className, token, startId);
949 reply.writeNoException();
950 reply.writeInt(res ? 1 : 0);
951 return true;
952 }
953
954 case SET_SERVICE_FOREGROUND_TRANSACTION: {
955 data.enforceInterface(IActivityManager.descriptor);
956 ComponentName className = ComponentName.readFromParcel(data);
957 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700958 int id = data.readInt();
959 Notification notification = null;
960 if (data.readInt() != 0) {
961 notification = Notification.CREATOR.createFromParcel(data);
962 }
963 boolean removeNotification = data.readInt() != 0;
964 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800965 reply.writeNoException();
966 return true;
967 }
968
969 case BIND_SERVICE_TRANSACTION: {
970 data.enforceInterface(IActivityManager.descriptor);
971 IBinder b = data.readStrongBinder();
972 IApplicationThread app = ApplicationThreadNative.asInterface(b);
973 IBinder token = data.readStrongBinder();
974 Intent service = Intent.CREATOR.createFromParcel(data);
975 String resolvedType = data.readString();
976 b = data.readStrongBinder();
977 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800978 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800979 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800980 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800981 reply.writeNoException();
982 reply.writeInt(res);
983 return true;
984 }
985
986 case UNBIND_SERVICE_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder b = data.readStrongBinder();
989 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
990 boolean res = unbindService(conn);
991 reply.writeNoException();
992 reply.writeInt(res ? 1 : 0);
993 return true;
994 }
995
996 case PUBLISH_SERVICE_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 IBinder token = data.readStrongBinder();
999 Intent intent = Intent.CREATOR.createFromParcel(data);
1000 IBinder service = data.readStrongBinder();
1001 publishService(token, intent, service);
1002 reply.writeNoException();
1003 return true;
1004 }
1005
1006 case UNBIND_FINISHED_TRANSACTION: {
1007 data.enforceInterface(IActivityManager.descriptor);
1008 IBinder token = data.readStrongBinder();
1009 Intent intent = Intent.CREATOR.createFromParcel(data);
1010 boolean doRebind = data.readInt() != 0;
1011 unbindFinished(token, intent, doRebind);
1012 reply.writeNoException();
1013 return true;
1014 }
1015
1016 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1017 data.enforceInterface(IActivityManager.descriptor);
1018 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001019 int type = data.readInt();
1020 int startId = data.readInt();
1021 int res = data.readInt();
1022 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001023 reply.writeNoException();
1024 return true;
1025 }
1026
1027 case START_INSTRUMENTATION_TRANSACTION: {
1028 data.enforceInterface(IActivityManager.descriptor);
1029 ComponentName className = ComponentName.readFromParcel(data);
1030 String profileFile = data.readString();
1031 int fl = data.readInt();
1032 Bundle arguments = data.readBundle();
1033 IBinder b = data.readStrongBinder();
1034 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001035 b = data.readStrongBinder();
1036 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001037 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001038 String abiOverride = data.readString();
1039 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1040 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001041 reply.writeNoException();
1042 reply.writeInt(res ? 1 : 0);
1043 return true;
1044 }
1045
1046
1047 case FINISH_INSTRUMENTATION_TRANSACTION: {
1048 data.enforceInterface(IActivityManager.descriptor);
1049 IBinder b = data.readStrongBinder();
1050 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1051 int resultCode = data.readInt();
1052 Bundle results = data.readBundle();
1053 finishInstrumentation(app, resultCode, results);
1054 reply.writeNoException();
1055 return true;
1056 }
1057
1058 case GET_CONFIGURATION_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 Configuration config = getConfiguration();
1061 reply.writeNoException();
1062 config.writeToParcel(reply, 0);
1063 return true;
1064 }
1065
1066 case UPDATE_CONFIGURATION_TRANSACTION: {
1067 data.enforceInterface(IActivityManager.descriptor);
1068 Configuration config = Configuration.CREATOR.createFromParcel(data);
1069 updateConfiguration(config);
1070 reply.writeNoException();
1071 return true;
1072 }
1073
1074 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 IBinder token = data.readStrongBinder();
1077 int requestedOrientation = data.readInt();
1078 setRequestedOrientation(token, requestedOrientation);
1079 reply.writeNoException();
1080 return true;
1081 }
1082
1083 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1084 data.enforceInterface(IActivityManager.descriptor);
1085 IBinder token = data.readStrongBinder();
1086 int req = getRequestedOrientation(token);
1087 reply.writeNoException();
1088 reply.writeInt(req);
1089 return true;
1090 }
1091
1092 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1093 data.enforceInterface(IActivityManager.descriptor);
1094 IBinder token = data.readStrongBinder();
1095 ComponentName cn = getActivityClassForToken(token);
1096 reply.writeNoException();
1097 ComponentName.writeToParcel(cn, reply);
1098 return true;
1099 }
1100
1101 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1102 data.enforceInterface(IActivityManager.descriptor);
1103 IBinder token = data.readStrongBinder();
1104 reply.writeNoException();
1105 reply.writeString(getPackageForToken(token));
1106 return true;
1107 }
1108
1109 case GET_INTENT_SENDER_TRANSACTION: {
1110 data.enforceInterface(IActivityManager.descriptor);
1111 int type = data.readInt();
1112 String packageName = data.readString();
1113 IBinder token = data.readStrongBinder();
1114 String resultWho = data.readString();
1115 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001116 Intent[] requestIntents;
1117 String[] requestResolvedTypes;
1118 if (data.readInt() != 0) {
1119 requestIntents = data.createTypedArray(Intent.CREATOR);
1120 requestResolvedTypes = data.createStringArray();
1121 } else {
1122 requestIntents = null;
1123 requestResolvedTypes = null;
1124 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001126 Bundle options = data.readInt() != 0
1127 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001128 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001129 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001130 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001131 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001132 reply.writeNoException();
1133 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1134 return true;
1135 }
1136
1137 case CANCEL_INTENT_SENDER_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 IIntentSender r = IIntentSender.Stub.asInterface(
1140 data.readStrongBinder());
1141 cancelIntentSender(r);
1142 reply.writeNoException();
1143 return true;
1144 }
1145
1146 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1147 data.enforceInterface(IActivityManager.descriptor);
1148 IIntentSender r = IIntentSender.Stub.asInterface(
1149 data.readStrongBinder());
1150 String res = getPackageForIntentSender(r);
1151 reply.writeNoException();
1152 reply.writeString(res);
1153 return true;
1154 }
1155
Christopher Tatec4a07d12012-04-06 14:19:13 -07001156 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1157 data.enforceInterface(IActivityManager.descriptor);
1158 IIntentSender r = IIntentSender.Stub.asInterface(
1159 data.readStrongBinder());
1160 int res = getUidForIntentSender(r);
1161 reply.writeNoException();
1162 reply.writeInt(res);
1163 return true;
1164 }
1165
Dianne Hackborn41203752012-08-31 14:05:51 -07001166 case HANDLE_INCOMING_USER_TRANSACTION: {
1167 data.enforceInterface(IActivityManager.descriptor);
1168 int callingPid = data.readInt();
1169 int callingUid = data.readInt();
1170 int userId = data.readInt();
1171 boolean allowAll = data.readInt() != 0 ;
1172 boolean requireFull = data.readInt() != 0;
1173 String name = data.readString();
1174 String callerPackage = data.readString();
1175 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1176 requireFull, name, callerPackage);
1177 reply.writeNoException();
1178 reply.writeInt(res);
1179 return true;
1180 }
1181
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 case SET_PROCESS_LIMIT_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 int max = data.readInt();
1185 setProcessLimit(max);
1186 reply.writeNoException();
1187 return true;
1188 }
1189
1190 case GET_PROCESS_LIMIT_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 int limit = getProcessLimit();
1193 reply.writeNoException();
1194 reply.writeInt(limit);
1195 return true;
1196 }
1197
1198 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1199 data.enforceInterface(IActivityManager.descriptor);
1200 IBinder token = data.readStrongBinder();
1201 int pid = data.readInt();
1202 boolean isForeground = data.readInt() != 0;
1203 setProcessForeground(token, pid, isForeground);
1204 reply.writeNoException();
1205 return true;
1206 }
1207
1208 case CHECK_PERMISSION_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 String perm = data.readString();
1211 int pid = data.readInt();
1212 int uid = data.readInt();
1213 int res = checkPermission(perm, pid, uid);
1214 reply.writeNoException();
1215 reply.writeInt(res);
1216 return true;
1217 }
1218
Dianne Hackbornff170242014-11-19 10:59:01 -08001219 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1220 data.enforceInterface(IActivityManager.descriptor);
1221 String perm = data.readString();
1222 int pid = data.readInt();
1223 int uid = data.readInt();
1224 IBinder token = data.readStrongBinder();
1225 int res = checkPermissionWithToken(perm, pid, uid, token);
1226 reply.writeNoException();
1227 reply.writeInt(res);
1228 return true;
1229 }
1230
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 case CHECK_URI_PERMISSION_TRANSACTION: {
1232 data.enforceInterface(IActivityManager.descriptor);
1233 Uri uri = Uri.CREATOR.createFromParcel(data);
1234 int pid = data.readInt();
1235 int uid = data.readInt();
1236 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001237 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001238 IBinder callerToken = data.readStrongBinder();
1239 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 reply.writeNoException();
1241 reply.writeInt(res);
1242 return true;
1243 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001246 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 String packageName = data.readString();
1248 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1249 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001250 int userId = data.readInt();
1251 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001252 reply.writeNoException();
1253 reply.writeInt(res ? 1 : 0);
1254 return true;
1255 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001256
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 case GRANT_URI_PERMISSION_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 IBinder b = data.readStrongBinder();
1260 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1261 String targetPkg = data.readString();
1262 Uri uri = Uri.CREATOR.createFromParcel(data);
1263 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001264 int userId = data.readInt();
1265 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001266 reply.writeNoException();
1267 return true;
1268 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001269
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 case REVOKE_URI_PERMISSION_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 IBinder b = data.readStrongBinder();
1273 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1274 Uri uri = Uri.CREATOR.createFromParcel(data);
1275 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001276 int userId = data.readInt();
1277 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 reply.writeNoException();
1279 return true;
1280 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001281
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001282 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1283 data.enforceInterface(IActivityManager.descriptor);
1284 Uri uri = Uri.CREATOR.createFromParcel(data);
1285 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001286 int userId = data.readInt();
1287 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001288 reply.writeNoException();
1289 return true;
1290 }
1291
1292 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1293 data.enforceInterface(IActivityManager.descriptor);
1294 Uri uri = Uri.CREATOR.createFromParcel(data);
1295 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001296 int userId = data.readInt();
1297 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001298 reply.writeNoException();
1299 return true;
1300 }
1301
1302 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1303 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001304 final String packageName = data.readString();
1305 final boolean incoming = data.readInt() != 0;
1306 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1307 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001308 reply.writeNoException();
1309 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1310 return true;
1311 }
1312
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001313 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1314 data.enforceInterface(IActivityManager.descriptor);
1315 IBinder b = data.readStrongBinder();
1316 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1317 boolean waiting = data.readInt() != 0;
1318 showWaitingForDebugger(app, waiting);
1319 reply.writeNoException();
1320 return true;
1321 }
1322
1323 case GET_MEMORY_INFO_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1326 getMemoryInfo(mi);
1327 reply.writeNoException();
1328 mi.writeToParcel(reply, 0);
1329 return true;
1330 }
1331
1332 case UNHANDLED_BACK_TRANSACTION: {
1333 data.enforceInterface(IActivityManager.descriptor);
1334 unhandledBack();
1335 reply.writeNoException();
1336 return true;
1337 }
1338
1339 case OPEN_CONTENT_URI_TRANSACTION: {
1340 data.enforceInterface(IActivityManager.descriptor);
1341 Uri uri = Uri.parse(data.readString());
1342 ParcelFileDescriptor pfd = openContentUri(uri);
1343 reply.writeNoException();
1344 if (pfd != null) {
1345 reply.writeInt(1);
1346 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1347 } else {
1348 reply.writeInt(0);
1349 }
1350 return true;
1351 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001352
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001353 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
1355 setLockScreenShown(data.readInt() != 0);
1356 reply.writeNoException();
1357 return true;
1358 }
1359
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001360 case SET_DEBUG_APP_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
1362 String pn = data.readString();
1363 boolean wfd = data.readInt() != 0;
1364 boolean per = data.readInt() != 0;
1365 setDebugApp(pn, wfd, per);
1366 reply.writeNoException();
1367 return true;
1368 }
1369
1370 case SET_ALWAYS_FINISH_TRANSACTION: {
1371 data.enforceInterface(IActivityManager.descriptor);
1372 boolean enabled = data.readInt() != 0;
1373 setAlwaysFinish(enabled);
1374 reply.writeNoException();
1375 return true;
1376 }
1377
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001378 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001379 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001380 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001381 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001382 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001383 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 return true;
1385 }
1386
1387 case ENTER_SAFE_MODE_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 enterSafeMode();
1390 reply.writeNoException();
1391 return true;
1392 }
1393
1394 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1395 data.enforceInterface(IActivityManager.descriptor);
1396 IIntentSender is = IIntentSender.Stub.asInterface(
1397 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001398 int sourceUid = data.readInt();
1399 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001400 String tag = data.readString();
1401 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1402 reply.writeNoException();
1403 return true;
1404 }
1405
1406 case NOTE_ALARM_START_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
1408 IIntentSender is = IIntentSender.Stub.asInterface(
1409 data.readStrongBinder());
1410 int sourceUid = data.readInt();
1411 String tag = data.readString();
1412 noteAlarmStart(is, sourceUid, tag);
1413 reply.writeNoException();
1414 return true;
1415 }
1416
1417 case NOTE_ALARM_FINISH_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
1419 IIntentSender is = IIntentSender.Stub.asInterface(
1420 data.readStrongBinder());
1421 int sourceUid = data.readInt();
1422 String tag = data.readString();
1423 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001424 reply.writeNoException();
1425 return true;
1426 }
1427
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001428 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001429 data.enforceInterface(IActivityManager.descriptor);
1430 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001431 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001432 boolean secure = data.readInt() != 0;
1433 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001434 reply.writeNoException();
1435 reply.writeInt(res ? 1 : 0);
1436 return true;
1437 }
1438
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001439 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1440 data.enforceInterface(IActivityManager.descriptor);
1441 String reason = data.readString();
1442 boolean res = killProcessesBelowForeground(reason);
1443 reply.writeNoException();
1444 reply.writeInt(res ? 1 : 0);
1445 return true;
1446 }
1447
Dan Egnor60d87622009-12-16 16:32:58 -08001448 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1449 data.enforceInterface(IActivityManager.descriptor);
1450 IBinder app = data.readStrongBinder();
1451 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1452 handleApplicationCrash(app, ci);
1453 reply.writeNoException();
1454 return true;
1455 }
1456
1457 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 data.enforceInterface(IActivityManager.descriptor);
1459 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001460 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001461 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001462 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001463 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001464 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001465 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001466 return true;
1467 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001468
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001469 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001472 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001473 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1474 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001475 reply.writeNoException();
1476 return true;
1477 }
1478
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001479 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1480 data.enforceInterface(IActivityManager.descriptor);
1481 int sig = data.readInt();
1482 signalPersistentProcesses(sig);
1483 reply.writeNoException();
1484 return true;
1485 }
1486
Dianne Hackborn03abb812010-01-04 18:43:19 -08001487 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001489 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001490 int userId = data.readInt();
1491 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001492 reply.writeNoException();
1493 return true;
1494 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001495
1496 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1497 data.enforceInterface(IActivityManager.descriptor);
1498 killAllBackgroundProcesses();
1499 reply.writeNoException();
1500 return true;
1501 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001502
Dianne Hackborn03abb812010-01-04 18:43:19 -08001503 case FORCE_STOP_PACKAGE_TRANSACTION: {
1504 data.enforceInterface(IActivityManager.descriptor);
1505 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001506 int userId = data.readInt();
1507 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001508 reply.writeNoException();
1509 return true;
1510 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001511
1512 case GET_MY_MEMORY_STATE_TRANSACTION: {
1513 data.enforceInterface(IActivityManager.descriptor);
1514 ActivityManager.RunningAppProcessInfo info =
1515 new ActivityManager.RunningAppProcessInfo();
1516 getMyMemoryState(info);
1517 reply.writeNoException();
1518 info.writeToParcel(reply, 0);
1519 return true;
1520 }
1521
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001522 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1523 data.enforceInterface(IActivityManager.descriptor);
1524 ConfigurationInfo config = getDeviceConfigurationInfo();
1525 reply.writeNoException();
1526 config.writeToParcel(reply, 0);
1527 return true;
1528 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001529
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001530 case PROFILE_CONTROL_TRANSACTION: {
1531 data.enforceInterface(IActivityManager.descriptor);
1532 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001533 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001534 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001535 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001536 ProfilerInfo profilerInfo = data.readInt() != 0
1537 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1538 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001539 reply.writeNoException();
1540 reply.writeInt(res ? 1 : 0);
1541 return true;
1542 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001543
Dianne Hackborn55280a92009-05-07 15:53:46 -07001544 case SHUTDOWN_TRANSACTION: {
1545 data.enforceInterface(IActivityManager.descriptor);
1546 boolean res = shutdown(data.readInt());
1547 reply.writeNoException();
1548 reply.writeInt(res ? 1 : 0);
1549 return true;
1550 }
1551
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001552 case STOP_APP_SWITCHES_TRANSACTION: {
1553 data.enforceInterface(IActivityManager.descriptor);
1554 stopAppSwitches();
1555 reply.writeNoException();
1556 return true;
1557 }
1558
1559 case RESUME_APP_SWITCHES_TRANSACTION: {
1560 data.enforceInterface(IActivityManager.descriptor);
1561 resumeAppSwitches();
1562 reply.writeNoException();
1563 return true;
1564 }
1565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001566 case PEEK_SERVICE_TRANSACTION: {
1567 data.enforceInterface(IActivityManager.descriptor);
1568 Intent service = Intent.CREATOR.createFromParcel(data);
1569 String resolvedType = data.readString();
1570 IBinder binder = peekService(service, resolvedType);
1571 reply.writeNoException();
1572 reply.writeStrongBinder(binder);
1573 return true;
1574 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001575
1576 case START_BACKUP_AGENT_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1579 int backupRestoreMode = data.readInt();
1580 boolean success = bindBackupAgent(info, backupRestoreMode);
1581 reply.writeNoException();
1582 reply.writeInt(success ? 1 : 0);
1583 return true;
1584 }
1585
1586 case BACKUP_AGENT_CREATED_TRANSACTION: {
1587 data.enforceInterface(IActivityManager.descriptor);
1588 String packageName = data.readString();
1589 IBinder agent = data.readStrongBinder();
1590 backupAgentCreated(packageName, agent);
1591 reply.writeNoException();
1592 return true;
1593 }
1594
1595 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1596 data.enforceInterface(IActivityManager.descriptor);
1597 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1598 unbindBackupAgent(info);
1599 reply.writeNoException();
1600 return true;
1601 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001602
1603 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1604 data.enforceInterface(IActivityManager.descriptor);
1605 String packageName = data.readString();
1606 addPackageDependency(packageName);
1607 reply.writeNoException();
1608 return true;
1609 }
1610
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001611 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001612 data.enforceInterface(IActivityManager.descriptor);
1613 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001614 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001615 String reason = data.readString();
1616 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001617 reply.writeNoException();
1618 return true;
1619 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001620
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001621 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1622 data.enforceInterface(IActivityManager.descriptor);
1623 String reason = data.readString();
1624 closeSystemDialogs(reason);
1625 reply.writeNoException();
1626 return true;
1627 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001628
1629 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001631 int[] pids = data.createIntArray();
1632 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001633 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001634 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001635 return true;
1636 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001637
1638 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 String processName = data.readString();
1641 int uid = data.readInt();
1642 killApplicationProcess(processName, uid);
1643 reply.writeNoException();
1644 return true;
1645 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001646
1647 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1648 data.enforceInterface(IActivityManager.descriptor);
1649 IBinder token = data.readStrongBinder();
1650 String packageName = data.readString();
1651 int enterAnim = data.readInt();
1652 int exitAnim = data.readInt();
1653 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001654 reply.writeNoException();
1655 return true;
1656 }
1657
1658 case IS_USER_A_MONKEY_TRANSACTION: {
1659 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001660 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001661 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001662 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001663 return true;
1664 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001665
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001666 case SET_USER_IS_MONKEY_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 final boolean monkey = (data.readInt() == 1);
1669 setUserIsMonkey(monkey);
1670 reply.writeNoException();
1671 return true;
1672 }
1673
Dianne Hackborn860755f2010-06-03 18:47:52 -07001674 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1675 data.enforceInterface(IActivityManager.descriptor);
1676 finishHeavyWeightApp();
1677 reply.writeNoException();
1678 return true;
1679 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001680
1681 case IS_IMMERSIVE_TRANSACTION: {
1682 data.enforceInterface(IActivityManager.descriptor);
1683 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001684 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001685 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001686 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001687 return true;
1688 }
1689
Craig Mautnerd61dc202014-07-07 11:09:11 -07001690 case IS_TOP_OF_TASK_TRANSACTION: {
1691 data.enforceInterface(IActivityManager.descriptor);
1692 IBinder token = data.readStrongBinder();
1693 final boolean isTopOfTask = isTopOfTask(token);
1694 reply.writeNoException();
1695 reply.writeInt(isTopOfTask ? 1 : 0);
1696 return true;
1697 }
1698
Craig Mautner5eda9b32013-07-02 11:58:16 -07001699 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001700 data.enforceInterface(IActivityManager.descriptor);
1701 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001702 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001703 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001704 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001705 return true;
1706 }
1707
1708 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1709 data.enforceInterface(IActivityManager.descriptor);
1710 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001711 final Bundle bundle;
1712 if (data.readInt() == 0) {
1713 bundle = null;
1714 } else {
1715 bundle = data.readBundle();
1716 }
1717 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1718 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001719 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001720 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001721 return true;
1722 }
1723
Craig Mautner233ceee2014-05-09 17:05:11 -07001724 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1725 data.enforceInterface(IActivityManager.descriptor);
1726 IBinder token = data.readStrongBinder();
1727 final ActivityOptions options = getActivityOptions(token);
1728 reply.writeNoException();
1729 reply.writeBundle(options == null ? null : options.toBundle());
1730 return true;
1731 }
1732
Daniel Sandler69a48172010-06-23 16:29:36 -04001733 case SET_IMMERSIVE_TRANSACTION: {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 IBinder token = data.readStrongBinder();
1736 boolean imm = data.readInt() == 1;
1737 setImmersive(token, imm);
1738 reply.writeNoException();
1739 return true;
1740 }
1741
1742 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001744 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001745 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001746 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001747 return true;
1748 }
1749
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001750 case CRASH_APPLICATION_TRANSACTION: {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 int uid = data.readInt();
1753 int initialPid = data.readInt();
1754 String packageName = data.readString();
1755 String message = data.readString();
1756 crashApplication(uid, initialPid, packageName, message);
1757 reply.writeNoException();
1758 return true;
1759 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001760
1761 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001764 int userId = data.readInt();
1765 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001766 reply.writeNoException();
1767 reply.writeString(type);
1768 return true;
1769 }
1770
Dianne Hackborn7e269642010-08-25 19:50:20 -07001771 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1772 data.enforceInterface(IActivityManager.descriptor);
1773 String name = data.readString();
1774 IBinder perm = newUriPermissionOwner(name);
1775 reply.writeNoException();
1776 reply.writeStrongBinder(perm);
1777 return true;
1778 }
1779
1780 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 IBinder owner = data.readStrongBinder();
1783 int fromUid = data.readInt();
1784 String targetPkg = data.readString();
1785 Uri uri = Uri.CREATOR.createFromParcel(data);
1786 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001787 int sourceUserId = data.readInt();
1788 int targetUserId = data.readInt();
1789 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1790 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001791 reply.writeNoException();
1792 return true;
1793 }
1794
1795 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1796 data.enforceInterface(IActivityManager.descriptor);
1797 IBinder owner = data.readStrongBinder();
1798 Uri uri = null;
1799 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001800 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001801 }
1802 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001803 int userId = data.readInt();
1804 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001805 reply.writeNoException();
1806 return true;
1807 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001808
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001809 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1810 data.enforceInterface(IActivityManager.descriptor);
1811 int callingUid = data.readInt();
1812 String targetPkg = data.readString();
1813 Uri uri = Uri.CREATOR.createFromParcel(data);
1814 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001815 int userId = data.readInt();
1816 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001817 reply.writeNoException();
1818 reply.writeInt(res);
1819 return true;
1820 }
1821
Andy McFadden824c5102010-07-09 16:26:57 -07001822 case DUMP_HEAP_TRANSACTION: {
1823 data.enforceInterface(IActivityManager.descriptor);
1824 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001825 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001826 boolean managed = data.readInt() != 0;
1827 String path = data.readString();
1828 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001829 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001830 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001831 reply.writeNoException();
1832 reply.writeInt(res ? 1 : 0);
1833 return true;
1834 }
1835
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001836 case START_ACTIVITIES_TRANSACTION:
1837 {
1838 data.enforceInterface(IActivityManager.descriptor);
1839 IBinder b = data.readStrongBinder();
1840 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001841 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001842 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1843 String[] resolvedTypes = data.createStringArray();
1844 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001845 Bundle options = data.readInt() != 0
1846 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001847 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001848 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001849 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001850 reply.writeNoException();
1851 reply.writeInt(result);
1852 return true;
1853 }
1854
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001855 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1856 {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 int mode = getFrontActivityScreenCompatMode();
1859 reply.writeNoException();
1860 reply.writeInt(mode);
1861 return true;
1862 }
1863
1864 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1865 {
1866 data.enforceInterface(IActivityManager.descriptor);
1867 int mode = data.readInt();
1868 setFrontActivityScreenCompatMode(mode);
1869 reply.writeNoException();
1870 reply.writeInt(mode);
1871 return true;
1872 }
1873
1874 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1875 {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 String pkg = data.readString();
1878 int mode = getPackageScreenCompatMode(pkg);
1879 reply.writeNoException();
1880 reply.writeInt(mode);
1881 return true;
1882 }
1883
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001884 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1885 {
1886 data.enforceInterface(IActivityManager.descriptor);
1887 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001888 int mode = data.readInt();
1889 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001890 reply.writeNoException();
1891 return true;
1892 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001893
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001894 case SWITCH_USER_TRANSACTION: {
1895 data.enforceInterface(IActivityManager.descriptor);
1896 int userid = data.readInt();
1897 boolean result = switchUser(userid);
1898 reply.writeNoException();
1899 reply.writeInt(result ? 1 : 0);
1900 return true;
1901 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001902
Kenny Guy08488bf2014-02-21 17:40:37 +00001903 case START_USER_IN_BACKGROUND_TRANSACTION: {
1904 data.enforceInterface(IActivityManager.descriptor);
1905 int userid = data.readInt();
1906 boolean result = startUserInBackground(userid);
1907 reply.writeNoException();
1908 reply.writeInt(result ? 1 : 0);
1909 return true;
1910 }
1911
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001912 case STOP_USER_TRANSACTION: {
1913 data.enforceInterface(IActivityManager.descriptor);
1914 int userid = data.readInt();
1915 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1916 data.readStrongBinder());
1917 int result = stopUser(userid, callback);
1918 reply.writeNoException();
1919 reply.writeInt(result);
1920 return true;
1921 }
1922
Amith Yamasani52f1d752012-03-28 18:19:29 -07001923 case GET_CURRENT_USER_TRANSACTION: {
1924 data.enforceInterface(IActivityManager.descriptor);
1925 UserInfo userInfo = getCurrentUser();
1926 reply.writeNoException();
1927 userInfo.writeToParcel(reply, 0);
1928 return true;
1929 }
1930
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001931 case IS_USER_RUNNING_TRANSACTION: {
1932 data.enforceInterface(IActivityManager.descriptor);
1933 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001934 boolean orStopping = data.readInt() != 0;
1935 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001936 reply.writeNoException();
1937 reply.writeInt(result ? 1 : 0);
1938 return true;
1939 }
1940
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001941 case GET_RUNNING_USER_IDS_TRANSACTION: {
1942 data.enforceInterface(IActivityManager.descriptor);
1943 int[] result = getRunningUserIds();
1944 reply.writeNoException();
1945 reply.writeIntArray(result);
1946 return true;
1947 }
1948
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001949 case REMOVE_TASK_TRANSACTION:
1950 {
1951 data.enforceInterface(IActivityManager.descriptor);
1952 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001953 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001954 reply.writeNoException();
1955 reply.writeInt(result ? 1 : 0);
1956 return true;
1957 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001958
Jeff Sharkeya4620792011-05-20 15:29:23 -07001959 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1960 data.enforceInterface(IActivityManager.descriptor);
1961 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1962 data.readStrongBinder());
1963 registerProcessObserver(observer);
1964 return true;
1965 }
1966
1967 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1968 data.enforceInterface(IActivityManager.descriptor);
1969 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1970 data.readStrongBinder());
1971 unregisterProcessObserver(observer);
1972 return true;
1973 }
1974
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07001975 case REGISTER_UID_OBSERVER_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 IUidObserver observer = IUidObserver.Stub.asInterface(
1978 data.readStrongBinder());
1979 registerUidObserver(observer);
1980 return true;
1981 }
1982
1983 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
1984 data.enforceInterface(IActivityManager.descriptor);
1985 IUidObserver observer = IUidObserver.Stub.asInterface(
1986 data.readStrongBinder());
1987 unregisterUidObserver(observer);
1988 return true;
1989 }
1990
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001991 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1992 {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 String pkg = data.readString();
1995 boolean ask = getPackageAskScreenCompat(pkg);
1996 reply.writeNoException();
1997 reply.writeInt(ask ? 1 : 0);
1998 return true;
1999 }
2000
2001 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2002 {
2003 data.enforceInterface(IActivityManager.descriptor);
2004 String pkg = data.readString();
2005 boolean ask = data.readInt() != 0;
2006 setPackageAskScreenCompat(pkg, ask);
2007 reply.writeNoException();
2008 return true;
2009 }
2010
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002011 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2012 data.enforceInterface(IActivityManager.descriptor);
2013 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002014 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002015 boolean res = isIntentSenderTargetedToPackage(r);
2016 reply.writeNoException();
2017 reply.writeInt(res ? 1 : 0);
2018 return true;
2019 }
2020
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002021 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2022 data.enforceInterface(IActivityManager.descriptor);
2023 IIntentSender r = IIntentSender.Stub.asInterface(
2024 data.readStrongBinder());
2025 boolean res = isIntentSenderAnActivity(r);
2026 reply.writeNoException();
2027 reply.writeInt(res ? 1 : 0);
2028 return true;
2029 }
2030
Dianne Hackborn81038902012-11-26 17:04:09 -08002031 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2032 data.enforceInterface(IActivityManager.descriptor);
2033 IIntentSender r = IIntentSender.Stub.asInterface(
2034 data.readStrongBinder());
2035 Intent intent = getIntentForIntentSender(r);
2036 reply.writeNoException();
2037 if (intent != null) {
2038 reply.writeInt(1);
2039 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2040 } else {
2041 reply.writeInt(0);
2042 }
2043 return true;
2044 }
2045
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002046 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 IIntentSender r = IIntentSender.Stub.asInterface(
2049 data.readStrongBinder());
2050 String prefix = data.readString();
2051 String tag = getTagForIntentSender(r, prefix);
2052 reply.writeNoException();
2053 reply.writeString(tag);
2054 return true;
2055 }
2056
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002057 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2058 data.enforceInterface(IActivityManager.descriptor);
2059 Configuration config = Configuration.CREATOR.createFromParcel(data);
2060 updatePersistentConfiguration(config);
2061 reply.writeNoException();
2062 return true;
2063 }
2064
Dianne Hackbornb437e092011-08-05 17:50:29 -07002065 case GET_PROCESS_PSS_TRANSACTION: {
2066 data.enforceInterface(IActivityManager.descriptor);
2067 int[] pids = data.createIntArray();
2068 long[] pss = getProcessPss(pids);
2069 reply.writeNoException();
2070 reply.writeLongArray(pss);
2071 return true;
2072 }
2073
Dianne Hackborn661cd522011-08-22 00:26:20 -07002074 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2075 data.enforceInterface(IActivityManager.descriptor);
2076 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2077 boolean always = data.readInt() != 0;
2078 showBootMessage(msg, always);
2079 reply.writeNoException();
2080 return true;
2081 }
2082
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002083 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002084 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002085 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002086 reply.writeNoException();
2087 return true;
2088 }
2089
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002090 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2093 reply.writeNoException();
2094 return true;
2095 }
2096
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002097 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002098 data.enforceInterface(IActivityManager.descriptor);
2099 IBinder token = data.readStrongBinder();
2100 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002101 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002102 reply.writeNoException();
2103 reply.writeInt(res ? 1 : 0);
2104 return true;
2105 }
2106
2107 case NAVIGATE_UP_TO_TRANSACTION: {
2108 data.enforceInterface(IActivityManager.descriptor);
2109 IBinder token = data.readStrongBinder();
2110 Intent target = Intent.CREATOR.createFromParcel(data);
2111 int resultCode = data.readInt();
2112 Intent resultData = null;
2113 if (data.readInt() != 0) {
2114 resultData = Intent.CREATOR.createFromParcel(data);
2115 }
2116 boolean res = navigateUpTo(token, target, resultCode, resultData);
2117 reply.writeNoException();
2118 reply.writeInt(res ? 1 : 0);
2119 return true;
2120 }
2121
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002122 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2123 data.enforceInterface(IActivityManager.descriptor);
2124 IBinder token = data.readStrongBinder();
2125 int res = getLaunchedFromUid(token);
2126 reply.writeNoException();
2127 reply.writeInt(res);
2128 return true;
2129 }
2130
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002131 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 IBinder token = data.readStrongBinder();
2134 String res = getLaunchedFromPackage(token);
2135 reply.writeNoException();
2136 reply.writeString(res);
2137 return true;
2138 }
2139
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002140 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2141 data.enforceInterface(IActivityManager.descriptor);
2142 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2143 data.readStrongBinder());
2144 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002145 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002146 return true;
2147 }
2148
2149 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2150 data.enforceInterface(IActivityManager.descriptor);
2151 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2152 data.readStrongBinder());
2153 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002154 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002155 return true;
2156 }
2157
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002158 case REQUEST_BUG_REPORT_TRANSACTION: {
2159 data.enforceInterface(IActivityManager.descriptor);
2160 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002161 reply.writeNoException();
2162 return true;
2163 }
2164
2165 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 int pid = data.readInt();
2168 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002169 String reason = data.readString();
2170 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002171 reply.writeNoException();
2172 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002173 return true;
2174 }
2175
Adam Skorydfc7fd72013-08-05 19:23:41 -07002176 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002177 data.enforceInterface(IActivityManager.descriptor);
2178 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002179 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002180 reply.writeNoException();
2181 reply.writeBundle(res);
2182 return true;
2183 }
2184
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002185 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2186 data.enforceInterface(IActivityManager.descriptor);
2187 int requestType = data.readInt();
2188 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
2189 requestAssistContextExtras(requestType, receiver);
2190 reply.writeNoException();
2191 return true;
2192 }
2193
Adam Skorydfc7fd72013-08-05 19:23:41 -07002194 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002195 data.enforceInterface(IActivityManager.descriptor);
2196 IBinder token = data.readStrongBinder();
2197 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002198 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2199 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
2200 reportAssistContextExtras(token, extras, structure, content);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002201 reply.writeNoException();
2202 return true;
2203 }
2204
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002205 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2206 data.enforceInterface(IActivityManager.descriptor);
2207 Intent intent = Intent.CREATOR.createFromParcel(data);
2208 int requestType = data.readInt();
2209 String hint = data.readString();
2210 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002211 Bundle args = data.readBundle();
2212 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002213 reply.writeNoException();
2214 reply.writeInt(res ? 1 : 0);
2215 return true;
2216 }
2217
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002218 case KILL_UID_TRANSACTION: {
2219 data.enforceInterface(IActivityManager.descriptor);
2220 int uid = data.readInt();
2221 String reason = data.readString();
2222 killUid(uid, reason);
2223 reply.writeNoException();
2224 return true;
2225 }
2226
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002227 case HANG_TRANSACTION: {
2228 data.enforceInterface(IActivityManager.descriptor);
2229 IBinder who = data.readStrongBinder();
2230 boolean allowRestart = data.readInt() != 0;
2231 hang(who, allowRestart);
2232 reply.writeNoException();
2233 return true;
2234 }
2235
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002236 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 IBinder token = data.readStrongBinder();
2239 reportActivityFullyDrawn(token);
2240 reply.writeNoException();
2241 return true;
2242 }
2243
Craig Mautner5eda9b32013-07-02 11:58:16 -07002244 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2245 data.enforceInterface(IActivityManager.descriptor);
2246 IBinder token = data.readStrongBinder();
2247 notifyActivityDrawn(token);
2248 reply.writeNoException();
2249 return true;
2250 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002251
2252 case RESTART_TRANSACTION: {
2253 data.enforceInterface(IActivityManager.descriptor);
2254 restart();
2255 reply.writeNoException();
2256 return true;
2257 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002258
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002259 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2260 data.enforceInterface(IActivityManager.descriptor);
2261 performIdleMaintenance();
2262 reply.writeNoException();
2263 return true;
2264 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002265
Todd Kennedyca4d8422015-01-15 15:19:22 -08002266 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002267 data.enforceInterface(IActivityManager.descriptor);
2268 IBinder parentActivityToken = data.readStrongBinder();
2269 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002270 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002271 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002272 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002273 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002274 if (activityContainer != null) {
2275 reply.writeInt(1);
2276 reply.writeStrongBinder(activityContainer.asBinder());
2277 } else {
2278 reply.writeInt(0);
2279 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002280 return true;
2281 }
2282
Craig Mautner95da1082014-02-24 17:54:35 -08002283 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2284 data.enforceInterface(IActivityManager.descriptor);
2285 IActivityContainer activityContainer =
2286 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2287 deleteActivityContainer(activityContainer);
2288 reply.writeNoException();
2289 return true;
2290 }
2291
Todd Kennedy4900bf92015-01-16 16:05:14 -08002292 case CREATE_STACK_ON_DISPLAY: {
2293 data.enforceInterface(IActivityManager.descriptor);
2294 int displayId = data.readInt();
2295 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2296 reply.writeNoException();
2297 if (activityContainer != null) {
2298 reply.writeInt(1);
2299 reply.writeStrongBinder(activityContainer.asBinder());
2300 } else {
2301 reply.writeInt(0);
2302 }
2303 return true;
2304 }
2305
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002306 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002307 data.enforceInterface(IActivityManager.descriptor);
2308 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002309 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002310 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002311 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002312 return true;
2313 }
2314
Craig Mautneraea74a52014-03-08 14:23:10 -08002315 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2316 data.enforceInterface(IActivityManager.descriptor);
2317 final int taskId = data.readInt();
2318 startLockTaskMode(taskId);
2319 reply.writeNoException();
2320 return true;
2321 }
2322
2323 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2324 data.enforceInterface(IActivityManager.descriptor);
2325 IBinder token = data.readStrongBinder();
2326 startLockTaskMode(token);
2327 reply.writeNoException();
2328 return true;
2329 }
2330
Craig Mautnerd61dc202014-07-07 11:09:11 -07002331 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002332 data.enforceInterface(IActivityManager.descriptor);
2333 startLockTaskModeOnCurrent();
2334 reply.writeNoException();
2335 return true;
2336 }
2337
Craig Mautneraea74a52014-03-08 14:23:10 -08002338 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2339 data.enforceInterface(IActivityManager.descriptor);
2340 stopLockTaskMode();
2341 reply.writeNoException();
2342 return true;
2343 }
2344
Craig Mautnerd61dc202014-07-07 11:09:11 -07002345 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002346 data.enforceInterface(IActivityManager.descriptor);
2347 stopLockTaskModeOnCurrent();
2348 reply.writeNoException();
2349 return true;
2350 }
2351
Craig Mautneraea74a52014-03-08 14:23:10 -08002352 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2353 data.enforceInterface(IActivityManager.descriptor);
2354 final boolean isInLockTaskMode = isInLockTaskMode();
2355 reply.writeNoException();
2356 reply.writeInt(isInLockTaskMode ? 1 : 0);
2357 return true;
2358 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002359
Benjamin Franz43261142015-02-11 15:59:44 +00002360 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2361 data.enforceInterface(IActivityManager.descriptor);
2362 final int lockTaskModeState = getLockTaskModeState();
2363 reply.writeNoException();
2364 reply.writeInt(lockTaskModeState);
2365 return true;
2366 }
2367
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002368 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2369 data.enforceInterface(IActivityManager.descriptor);
2370 final IBinder token = data.readStrongBinder();
2371 showLockTaskEscapeMessage(token);
2372 reply.writeNoException();
2373 return true;
2374 }
2375
Winson Chunga449dc02014-05-16 11:15:04 -07002376 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002377 data.enforceInterface(IActivityManager.descriptor);
2378 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002379 ActivityManager.TaskDescription values =
2380 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2381 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002382 reply.writeNoException();
2383 return true;
2384 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002385
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002386 case SET_TASK_RESIZEABLE_TRANSACTION: {
2387 data.enforceInterface(IActivityManager.descriptor);
2388 int taskId = data.readInt();
2389 boolean resizeable = (data.readInt() == 1) ? true : false;
2390 setTaskResizeable(taskId, resizeable);
2391 reply.writeNoException();
2392 return true;
2393 }
2394
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002395 case RESIZE_TASK_TRANSACTION: {
2396 data.enforceInterface(IActivityManager.descriptor);
2397 int taskId = data.readInt();
2398 Rect r = Rect.CREATOR.createFromParcel(data);
2399 resizeTask(taskId, r);
2400 reply.writeNoException();
2401 return true;
2402 }
2403
Craig Mautner648f69b2014-09-18 14:16:26 -07002404 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2405 data.enforceInterface(IActivityManager.descriptor);
2406 String filename = data.readString();
2407 Bitmap icon = getTaskDescriptionIcon(filename);
2408 reply.writeNoException();
2409 if (icon == null) {
2410 reply.writeInt(0);
2411 } else {
2412 reply.writeInt(1);
2413 icon.writeToParcel(reply, 0);
2414 }
2415 return true;
2416 }
2417
Winson Chung044d5292014-11-06 11:05:19 -08002418 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2419 data.enforceInterface(IActivityManager.descriptor);
2420 final Bundle bundle;
2421 if (data.readInt() == 0) {
2422 bundle = null;
2423 } else {
2424 bundle = data.readBundle();
2425 }
2426 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2427 startInPlaceAnimationOnFrontMostApplication(options);
2428 reply.writeNoException();
2429 return true;
2430 }
2431
Jose Lima4b6c6692014-08-12 17:41:12 -07002432 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002433 data.enforceInterface(IActivityManager.descriptor);
2434 IBinder token = data.readStrongBinder();
2435 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002436 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002437 reply.writeNoException();
2438 reply.writeInt(success ? 1 : 0);
2439 return true;
2440 }
2441
Jose Lima4b6c6692014-08-12 17:41:12 -07002442 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002443 data.enforceInterface(IActivityManager.descriptor);
2444 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002445 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002446 reply.writeNoException();
2447 reply.writeInt(enabled ? 1 : 0);
2448 return true;
2449 }
2450
Jose Lima4b6c6692014-08-12 17:41:12 -07002451 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002452 data.enforceInterface(IActivityManager.descriptor);
2453 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002454 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002455 reply.writeNoException();
2456 return true;
2457 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002458
2459 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2460 data.enforceInterface(IActivityManager.descriptor);
2461 IBinder token = data.readStrongBinder();
2462 notifyLaunchTaskBehindComplete(token);
2463 reply.writeNoException();
2464 return true;
2465 }
Craig Mautner8746a472014-07-24 15:12:54 -07002466
2467 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2468 data.enforceInterface(IActivityManager.descriptor);
2469 IBinder token = data.readStrongBinder();
2470 notifyEnterAnimationComplete(token);
2471 reply.writeNoException();
2472 return true;
2473 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002474
2475 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2476 data.enforceInterface(IActivityManager.descriptor);
2477 bootAnimationComplete();
2478 reply.writeNoException();
2479 return true;
2480 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002481
Jeff Sharkey605eb792014-11-04 13:34:06 -08002482 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2483 data.enforceInterface(IActivityManager.descriptor);
2484 final int uid = data.readInt();
2485 final byte[] firstPacket = data.createByteArray();
2486 notifyCleartextNetwork(uid, firstPacket);
2487 reply.writeNoException();
2488 return true;
2489 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002490
2491 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2492 data.enforceInterface(IActivityManager.descriptor);
2493 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002494 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002495 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002496 String reportPackage = data.readString();
2497 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002498 reply.writeNoException();
2499 return true;
2500 }
2501
2502 case DUMP_HEAP_FINISHED_TRANSACTION: {
2503 data.enforceInterface(IActivityManager.descriptor);
2504 String path = data.readString();
2505 dumpHeapFinished(path);
2506 reply.writeNoException();
2507 return true;
2508 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002509
2510 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2511 data.enforceInterface(IActivityManager.descriptor);
2512 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2513 data.readStrongBinder());
2514 boolean keepAwake = data.readInt() != 0;
2515 setVoiceKeepAwake(session, keepAwake);
2516 reply.writeNoException();
2517 return true;
2518 }
Craig Mautnere5600772015-04-03 21:36:37 -07002519
2520 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2521 data.enforceInterface(IActivityManager.descriptor);
2522 int userId = data.readInt();
2523 String[] packages = data.readStringArray();
2524 updateLockTaskPackages(userId, packages);
2525 reply.writeNoException();
2526 return true;
2527 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002528
Craig Mautner015c5e52015-04-23 10:39:39 -07002529 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2530 data.enforceInterface(IActivityManager.descriptor);
2531 String packageName = data.readString();
2532 updateDeviceOwner(packageName);
2533 reply.writeNoException();
2534 return true;
2535 }
2536
Julia Reynolds13c58ba2015-04-20 16:42:54 -04002537 case UPDATE_PREFERRED_SETUP_ACTIVITY_TRANSACTION: {
2538 data.enforceInterface(IActivityManager.descriptor);
2539 ComponentName preferredActivity = ComponentName.readFromParcel(data);
2540 int userId = data.readInt();
2541 updatePreferredSetupActivity(preferredActivity, userId);
2542 reply.writeNoException();
2543 return true;
2544 }
2545
Dianne Hackborn1e383822015-04-10 14:02:33 -07002546 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2547 data.enforceInterface(IActivityManager.descriptor);
2548 String pkg = data.readString();
2549 int res = getPackageProcessState(pkg);
2550 reply.writeNoException();
2551 reply.writeInt(res);
2552 return true;
2553 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002554 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002555
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002556 return super.onTransact(code, data, reply, flags);
2557 }
2558
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002559 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002560 return this;
2561 }
2562
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002563 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2564 protected IActivityManager create() {
2565 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002566 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002567 Log.v("ActivityManager", "default service binder = " + b);
2568 }
2569 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002570 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002571 Log.v("ActivityManager", "default service = " + am);
2572 }
2573 return am;
2574 }
2575 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002576}
2577
2578class ActivityManagerProxy implements IActivityManager
2579{
2580 public ActivityManagerProxy(IBinder remote)
2581 {
2582 mRemote = remote;
2583 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002584
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002585 public IBinder asBinder()
2586 {
2587 return mRemote;
2588 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002589
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002590 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002591 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002592 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002597 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002598 intent.writeToParcel(data, 0);
2599 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002600 data.writeStrongBinder(resultTo);
2601 data.writeString(resultWho);
2602 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002603 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002604 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002605 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002606 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002607 } else {
2608 data.writeInt(0);
2609 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002610 if (options != null) {
2611 data.writeInt(1);
2612 options.writeToParcel(data, 0);
2613 } else {
2614 data.writeInt(0);
2615 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2617 reply.readException();
2618 int result = reply.readInt();
2619 reply.recycle();
2620 data.recycle();
2621 return result;
2622 }
Amith Yamasani82644082012-08-03 13:09:11 -07002623
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002624 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002625 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002626 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2627 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002628 Parcel data = Parcel.obtain();
2629 Parcel reply = Parcel.obtain();
2630 data.writeInterfaceToken(IActivityManager.descriptor);
2631 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002632 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002633 intent.writeToParcel(data, 0);
2634 data.writeString(resolvedType);
2635 data.writeStrongBinder(resultTo);
2636 data.writeString(resultWho);
2637 data.writeInt(requestCode);
2638 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002639 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002640 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002641 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002642 } else {
2643 data.writeInt(0);
2644 }
2645 if (options != null) {
2646 data.writeInt(1);
2647 options.writeToParcel(data, 0);
2648 } else {
2649 data.writeInt(0);
2650 }
2651 data.writeInt(userId);
2652 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2653 reply.readException();
2654 int result = reply.readInt();
2655 reply.recycle();
2656 data.recycle();
2657 return result;
2658 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002659 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2660 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002661 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002662 Parcel data = Parcel.obtain();
2663 Parcel reply = Parcel.obtain();
2664 data.writeInterfaceToken(IActivityManager.descriptor);
2665 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2666 data.writeString(callingPackage);
2667 intent.writeToParcel(data, 0);
2668 data.writeString(resolvedType);
2669 data.writeStrongBinder(resultTo);
2670 data.writeString(resultWho);
2671 data.writeInt(requestCode);
2672 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002673 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002674 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002675 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002676 } else {
2677 data.writeInt(0);
2678 }
2679 if (options != null) {
2680 data.writeInt(1);
2681 options.writeToParcel(data, 0);
2682 } else {
2683 data.writeInt(0);
2684 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002685 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002686 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2687 reply.readException();
2688 int result = reply.readInt();
2689 reply.recycle();
2690 data.recycle();
2691 return result;
2692 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002693 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2694 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002695 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2696 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002697 Parcel data = Parcel.obtain();
2698 Parcel reply = Parcel.obtain();
2699 data.writeInterfaceToken(IActivityManager.descriptor);
2700 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002701 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002702 intent.writeToParcel(data, 0);
2703 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002704 data.writeStrongBinder(resultTo);
2705 data.writeString(resultWho);
2706 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002707 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002708 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002709 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002710 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002711 } else {
2712 data.writeInt(0);
2713 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002714 if (options != null) {
2715 data.writeInt(1);
2716 options.writeToParcel(data, 0);
2717 } else {
2718 data.writeInt(0);
2719 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002720 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002721 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2722 reply.readException();
2723 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2724 reply.recycle();
2725 data.recycle();
2726 return result;
2727 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002728 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2729 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002730 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002731 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002732 Parcel data = Parcel.obtain();
2733 Parcel reply = Parcel.obtain();
2734 data.writeInterfaceToken(IActivityManager.descriptor);
2735 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002736 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002737 intent.writeToParcel(data, 0);
2738 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002739 data.writeStrongBinder(resultTo);
2740 data.writeString(resultWho);
2741 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002742 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002743 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002744 if (options != null) {
2745 data.writeInt(1);
2746 options.writeToParcel(data, 0);
2747 } else {
2748 data.writeInt(0);
2749 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002750 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002751 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2752 reply.readException();
2753 int result = reply.readInt();
2754 reply.recycle();
2755 data.recycle();
2756 return result;
2757 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002758 public int startActivityIntentSender(IApplicationThread caller,
2759 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002760 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002761 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002762 Parcel data = Parcel.obtain();
2763 Parcel reply = Parcel.obtain();
2764 data.writeInterfaceToken(IActivityManager.descriptor);
2765 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2766 intent.writeToParcel(data, 0);
2767 if (fillInIntent != null) {
2768 data.writeInt(1);
2769 fillInIntent.writeToParcel(data, 0);
2770 } else {
2771 data.writeInt(0);
2772 }
2773 data.writeString(resolvedType);
2774 data.writeStrongBinder(resultTo);
2775 data.writeString(resultWho);
2776 data.writeInt(requestCode);
2777 data.writeInt(flagsMask);
2778 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002779 if (options != null) {
2780 data.writeInt(1);
2781 options.writeToParcel(data, 0);
2782 } else {
2783 data.writeInt(0);
2784 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002785 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002786 reply.readException();
2787 int result = reply.readInt();
2788 reply.recycle();
2789 data.recycle();
2790 return result;
2791 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002792 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2793 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002794 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2795 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002796 Parcel data = Parcel.obtain();
2797 Parcel reply = Parcel.obtain();
2798 data.writeInterfaceToken(IActivityManager.descriptor);
2799 data.writeString(callingPackage);
2800 data.writeInt(callingPid);
2801 data.writeInt(callingUid);
2802 intent.writeToParcel(data, 0);
2803 data.writeString(resolvedType);
2804 data.writeStrongBinder(session.asBinder());
2805 data.writeStrongBinder(interactor.asBinder());
2806 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002807 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002808 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002809 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002810 } else {
2811 data.writeInt(0);
2812 }
2813 if (options != null) {
2814 data.writeInt(1);
2815 options.writeToParcel(data, 0);
2816 } else {
2817 data.writeInt(0);
2818 }
2819 data.writeInt(userId);
2820 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2821 reply.readException();
2822 int result = reply.readInt();
2823 reply.recycle();
2824 data.recycle();
2825 return result;
2826 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002827 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002828 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
2832 data.writeStrongBinder(callingActivity);
2833 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002834 if (options != null) {
2835 data.writeInt(1);
2836 options.writeToParcel(data, 0);
2837 } else {
2838 data.writeInt(0);
2839 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002840 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2841 reply.readException();
2842 int result = reply.readInt();
2843 reply.recycle();
2844 data.recycle();
2845 return result != 0;
2846 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002847 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2848 Parcel data = Parcel.obtain();
2849 Parcel reply = Parcel.obtain();
2850 data.writeInterfaceToken(IActivityManager.descriptor);
2851 data.writeInt(taskId);
2852 if (options == null) {
2853 data.writeInt(0);
2854 } else {
2855 data.writeInt(1);
2856 options.writeToParcel(data, 0);
2857 }
2858 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2859 reply.readException();
2860 int result = reply.readInt();
2861 reply.recycle();
2862 data.recycle();
2863 return result;
2864 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002865 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002866 throws RemoteException {
2867 Parcel data = Parcel.obtain();
2868 Parcel reply = Parcel.obtain();
2869 data.writeInterfaceToken(IActivityManager.descriptor);
2870 data.writeStrongBinder(token);
2871 data.writeInt(resultCode);
2872 if (resultData != null) {
2873 data.writeInt(1);
2874 resultData.writeToParcel(data, 0);
2875 } else {
2876 data.writeInt(0);
2877 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002878 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002879 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2880 reply.readException();
2881 boolean res = reply.readInt() != 0;
2882 data.recycle();
2883 reply.recycle();
2884 return res;
2885 }
2886 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2887 {
2888 Parcel data = Parcel.obtain();
2889 Parcel reply = Parcel.obtain();
2890 data.writeInterfaceToken(IActivityManager.descriptor);
2891 data.writeStrongBinder(token);
2892 data.writeString(resultWho);
2893 data.writeInt(requestCode);
2894 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2895 reply.readException();
2896 data.recycle();
2897 reply.recycle();
2898 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002899 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2900 Parcel data = Parcel.obtain();
2901 Parcel reply = Parcel.obtain();
2902 data.writeInterfaceToken(IActivityManager.descriptor);
2903 data.writeStrongBinder(token);
2904 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2905 reply.readException();
2906 boolean res = reply.readInt() != 0;
2907 data.recycle();
2908 reply.recycle();
2909 return res;
2910 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002911 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2912 Parcel data = Parcel.obtain();
2913 Parcel reply = Parcel.obtain();
2914 data.writeInterfaceToken(IActivityManager.descriptor);
2915 data.writeStrongBinder(session.asBinder());
2916 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2917 reply.readException();
2918 data.recycle();
2919 reply.recycle();
2920 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002921 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2922 Parcel data = Parcel.obtain();
2923 Parcel reply = Parcel.obtain();
2924 data.writeInterfaceToken(IActivityManager.descriptor);
2925 data.writeStrongBinder(token);
2926 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2927 reply.readException();
2928 boolean res = reply.readInt() != 0;
2929 data.recycle();
2930 reply.recycle();
2931 return res;
2932 }
2933 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2934 Parcel data = Parcel.obtain();
2935 Parcel reply = Parcel.obtain();
2936 data.writeInterfaceToken(IActivityManager.descriptor);
2937 data.writeStrongBinder(app.asBinder());
2938 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2939 reply.readException();
2940 data.recycle();
2941 reply.recycle();
2942 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002943 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
2947 data.writeStrongBinder(token);
2948 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2949 reply.readException();
2950 boolean res = reply.readInt() != 0;
2951 data.recycle();
2952 reply.recycle();
2953 return res;
2954 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002955 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002956 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002957 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002958 {
2959 Parcel data = Parcel.obtain();
2960 Parcel reply = Parcel.obtain();
2961 data.writeInterfaceToken(IActivityManager.descriptor);
2962 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002963 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002964 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2965 filter.writeToParcel(data, 0);
2966 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002967 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002968 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2969 reply.readException();
2970 Intent intent = null;
2971 int haveIntent = reply.readInt();
2972 if (haveIntent != 0) {
2973 intent = Intent.CREATOR.createFromParcel(reply);
2974 }
2975 reply.recycle();
2976 data.recycle();
2977 return intent;
2978 }
2979 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2980 {
2981 Parcel data = Parcel.obtain();
2982 Parcel reply = Parcel.obtain();
2983 data.writeInterfaceToken(IActivityManager.descriptor);
2984 data.writeStrongBinder(receiver.asBinder());
2985 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2986 reply.readException();
2987 data.recycle();
2988 reply.recycle();
2989 }
2990 public int broadcastIntent(IApplicationThread caller,
2991 Intent intent, String resolvedType, IIntentReceiver resultTo,
2992 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002993 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002994 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002995 {
2996 Parcel data = Parcel.obtain();
2997 Parcel reply = Parcel.obtain();
2998 data.writeInterfaceToken(IActivityManager.descriptor);
2999 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3000 intent.writeToParcel(data, 0);
3001 data.writeString(resolvedType);
3002 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3003 data.writeInt(resultCode);
3004 data.writeString(resultData);
3005 data.writeBundle(map);
3006 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003007 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003008 data.writeInt(serialized ? 1 : 0);
3009 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003010 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003011 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3012 reply.readException();
3013 int res = reply.readInt();
3014 reply.recycle();
3015 data.recycle();
3016 return res;
3017 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003018 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3019 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003020 {
3021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3025 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003026 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003027 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 data.recycle();
3030 reply.recycle();
3031 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003032 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3033 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003034 {
3035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 data.writeStrongBinder(who);
3039 data.writeInt(resultCode);
3040 data.writeString(resultData);
3041 data.writeBundle(map);
3042 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003043 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003044 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3045 reply.readException();
3046 data.recycle();
3047 reply.recycle();
3048 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003049 public void attachApplication(IApplicationThread app) throws RemoteException
3050 {
3051 Parcel data = Parcel.obtain();
3052 Parcel reply = Parcel.obtain();
3053 data.writeInterfaceToken(IActivityManager.descriptor);
3054 data.writeStrongBinder(app.asBinder());
3055 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 data.recycle();
3058 reply.recycle();
3059 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003060 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3061 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003062 {
3063 Parcel data = Parcel.obtain();
3064 Parcel reply = Parcel.obtain();
3065 data.writeInterfaceToken(IActivityManager.descriptor);
3066 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003067 if (config != null) {
3068 data.writeInt(1);
3069 config.writeToParcel(data, 0);
3070 } else {
3071 data.writeInt(0);
3072 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003073 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003074 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3075 reply.readException();
3076 data.recycle();
3077 reply.recycle();
3078 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003079 public void activityResumed(IBinder token) throws RemoteException
3080 {
3081 Parcel data = Parcel.obtain();
3082 Parcel reply = Parcel.obtain();
3083 data.writeInterfaceToken(IActivityManager.descriptor);
3084 data.writeStrongBinder(token);
3085 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3086 reply.readException();
3087 data.recycle();
3088 reply.recycle();
3089 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003090 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003091 {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeStrongBinder(token);
3096 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 data.recycle();
3099 reply.recycle();
3100 }
3101 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003102 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003103 {
3104 Parcel data = Parcel.obtain();
3105 Parcel reply = Parcel.obtain();
3106 data.writeInterfaceToken(IActivityManager.descriptor);
3107 data.writeStrongBinder(token);
3108 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003109 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003110 TextUtils.writeToParcel(description, data, 0);
3111 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3112 reply.readException();
3113 data.recycle();
3114 reply.recycle();
3115 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003116 public void activitySlept(IBinder token) throws RemoteException
3117 {
3118 Parcel data = Parcel.obtain();
3119 Parcel reply = Parcel.obtain();
3120 data.writeInterfaceToken(IActivityManager.descriptor);
3121 data.writeStrongBinder(token);
3122 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3123 reply.readException();
3124 data.recycle();
3125 reply.recycle();
3126 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003127 public void activityDestroyed(IBinder token) throws RemoteException
3128 {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 data.writeStrongBinder(token);
3133 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3134 reply.readException();
3135 data.recycle();
3136 reply.recycle();
3137 }
3138 public String getCallingPackage(IBinder token) throws RemoteException
3139 {
3140 Parcel data = Parcel.obtain();
3141 Parcel reply = Parcel.obtain();
3142 data.writeInterfaceToken(IActivityManager.descriptor);
3143 data.writeStrongBinder(token);
3144 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 String res = reply.readString();
3147 data.recycle();
3148 reply.recycle();
3149 return res;
3150 }
3151 public ComponentName getCallingActivity(IBinder token)
3152 throws RemoteException {
3153 Parcel data = Parcel.obtain();
3154 Parcel reply = Parcel.obtain();
3155 data.writeInterfaceToken(IActivityManager.descriptor);
3156 data.writeStrongBinder(token);
3157 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3158 reply.readException();
3159 ComponentName res = ComponentName.readFromParcel(reply);
3160 data.recycle();
3161 reply.recycle();
3162 return res;
3163 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003164 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003168 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003169 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3170 reply.readException();
3171 ArrayList<IAppTask> list = null;
3172 int N = reply.readInt();
3173 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003174 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003175 while (N > 0) {
3176 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3177 list.add(task);
3178 N--;
3179 }
3180 }
3181 data.recycle();
3182 reply.recycle();
3183 return list;
3184 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003185 public int addAppTask(IBinder activityToken, Intent intent,
3186 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 data.writeStrongBinder(activityToken);
3191 intent.writeToParcel(data, 0);
3192 description.writeToParcel(data, 0);
3193 thumbnail.writeToParcel(data, 0);
3194 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3195 reply.readException();
3196 int res = reply.readInt();
3197 data.recycle();
3198 reply.recycle();
3199 return res;
3200 }
3201 public Point getAppTaskThumbnailSize() throws RemoteException {
3202 Parcel data = Parcel.obtain();
3203 Parcel reply = Parcel.obtain();
3204 data.writeInterfaceToken(IActivityManager.descriptor);
3205 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3206 reply.readException();
3207 Point size = Point.CREATOR.createFromParcel(reply);
3208 data.recycle();
3209 reply.recycle();
3210 return size;
3211 }
Todd Kennedye635f662015-01-20 10:36:49 -08003212 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3213 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003214 Parcel data = Parcel.obtain();
3215 Parcel reply = Parcel.obtain();
3216 data.writeInterfaceToken(IActivityManager.descriptor);
3217 data.writeInt(maxNum);
3218 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003219 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3220 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003221 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003222 int N = reply.readInt();
3223 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003224 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 while (N > 0) {
3226 ActivityManager.RunningTaskInfo info =
3227 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003228 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 list.add(info);
3230 N--;
3231 }
3232 }
3233 data.recycle();
3234 reply.recycle();
3235 return list;
3236 }
3237 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003238 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003239 Parcel data = Parcel.obtain();
3240 Parcel reply = Parcel.obtain();
3241 data.writeInterfaceToken(IActivityManager.descriptor);
3242 data.writeInt(maxNum);
3243 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003244 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 ArrayList<ActivityManager.RecentTaskInfo> list
3248 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3249 data.recycle();
3250 reply.recycle();
3251 return list;
3252 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003253 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003254 Parcel data = Parcel.obtain();
3255 Parcel reply = Parcel.obtain();
3256 data.writeInterfaceToken(IActivityManager.descriptor);
3257 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003258 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003259 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003260 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003261 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003262 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003263 }
3264 data.recycle();
3265 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003266 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003267 }
Todd Kennedye635f662015-01-20 10:36:49 -08003268 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3269 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003270 Parcel data = Parcel.obtain();
3271 Parcel reply = Parcel.obtain();
3272 data.writeInterfaceToken(IActivityManager.descriptor);
3273 data.writeInt(maxNum);
3274 data.writeInt(flags);
3275 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3276 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003277 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003278 int N = reply.readInt();
3279 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003280 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003281 while (N > 0) {
3282 ActivityManager.RunningServiceInfo info =
3283 ActivityManager.RunningServiceInfo.CREATOR
3284 .createFromParcel(reply);
3285 list.add(info);
3286 N--;
3287 }
3288 }
3289 data.recycle();
3290 reply.recycle();
3291 return list;
3292 }
3293 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3294 throws RemoteException {
3295 Parcel data = Parcel.obtain();
3296 Parcel reply = Parcel.obtain();
3297 data.writeInterfaceToken(IActivityManager.descriptor);
3298 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3299 reply.readException();
3300 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3301 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3302 data.recycle();
3303 reply.recycle();
3304 return list;
3305 }
3306 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3307 throws RemoteException {
3308 Parcel data = Parcel.obtain();
3309 Parcel reply = Parcel.obtain();
3310 data.writeInterfaceToken(IActivityManager.descriptor);
3311 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3312 reply.readException();
3313 ArrayList<ActivityManager.RunningAppProcessInfo> list
3314 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3315 data.recycle();
3316 reply.recycle();
3317 return list;
3318 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003319 public List<ApplicationInfo> getRunningExternalApplications()
3320 throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3325 reply.readException();
3326 ArrayList<ApplicationInfo> list
3327 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3328 data.recycle();
3329 reply.recycle();
3330 return list;
3331 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003332 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003338 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003339 if (options != null) {
3340 data.writeInt(1);
3341 options.writeToParcel(data, 0);
3342 } else {
3343 data.writeInt(0);
3344 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003345 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 data.recycle();
3348 reply.recycle();
3349 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3351 throws RemoteException {
3352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 data.writeStrongBinder(token);
3356 data.writeInt(nonRoot ? 1 : 0);
3357 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3358 reply.readException();
3359 boolean res = reply.readInt() != 0;
3360 data.recycle();
3361 reply.recycle();
3362 return res;
3363 }
3364 public void moveTaskBackwards(int task) throws RemoteException
3365 {
3366 Parcel data = Parcel.obtain();
3367 Parcel reply = Parcel.obtain();
3368 data.writeInterfaceToken(IActivityManager.descriptor);
3369 data.writeInt(task);
3370 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3371 reply.readException();
3372 data.recycle();
3373 reply.recycle();
3374 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003375 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003376 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3377 {
3378 Parcel data = Parcel.obtain();
3379 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003380 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003381 data.writeInt(taskId);
3382 data.writeInt(stackId);
3383 data.writeInt(toTop ? 1 : 0);
3384 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3385 reply.readException();
3386 data.recycle();
3387 reply.recycle();
3388 }
3389 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003390 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003391 {
3392 Parcel data = Parcel.obtain();
3393 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003394 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003395 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003396 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003397 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003398 reply.readException();
3399 data.recycle();
3400 reply.recycle();
3401 }
Craig Mautner967212c2013-04-13 21:10:58 -07003402 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003403 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003404 {
3405 Parcel data = Parcel.obtain();
3406 Parcel reply = Parcel.obtain();
3407 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003408 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003409 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003410 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003411 data.recycle();
3412 reply.recycle();
3413 return list;
3414 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003415 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003416 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003417 {
3418 Parcel data = Parcel.obtain();
3419 Parcel reply = Parcel.obtain();
3420 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003421 data.writeInt(stackId);
3422 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003423 reply.readException();
3424 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003425 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003426 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003427 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003428 }
3429 data.recycle();
3430 reply.recycle();
3431 return info;
3432 }
3433 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003434 public boolean isInHomeStack(int taskId) throws RemoteException {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 data.writeInt(taskId);
3439 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3440 reply.readException();
3441 boolean isInHomeStack = reply.readInt() > 0;
3442 data.recycle();
3443 reply.recycle();
3444 return isInHomeStack;
3445 }
3446 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003447 public void setFocusedStack(int stackId) throws RemoteException
3448 {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
3452 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003453 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003454 reply.readException();
3455 data.recycle();
3456 reply.recycle();
3457 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003458 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003459 public int getFocusedStackId() throws RemoteException {
3460 Parcel data = Parcel.obtain();
3461 Parcel reply = Parcel.obtain();
3462 data.writeInterfaceToken(IActivityManager.descriptor);
3463 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3464 reply.readException();
3465 int focusedStackId = reply.readInt();
3466 data.recycle();
3467 reply.recycle();
3468 return focusedStackId;
3469 }
3470 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003471 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3472 {
3473 Parcel data = Parcel.obtain();
3474 Parcel reply = Parcel.obtain();
3475 data.writeInterfaceToken(IActivityManager.descriptor);
3476 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003477 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003478 reply.readException();
3479 data.recycle();
3480 reply.recycle();
3481 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003482 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3483 {
3484 Parcel data = Parcel.obtain();
3485 Parcel reply = Parcel.obtain();
3486 data.writeInterfaceToken(IActivityManager.descriptor);
3487 data.writeStrongBinder(token);
3488 data.writeInt(onlyRoot ? 1 : 0);
3489 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3490 reply.readException();
3491 int res = reply.readInt();
3492 data.recycle();
3493 reply.recycle();
3494 return res;
3495 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003496 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003497 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003498 Parcel data = Parcel.obtain();
3499 Parcel reply = Parcel.obtain();
3500 data.writeInterfaceToken(IActivityManager.descriptor);
3501 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3502 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003503 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003504 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003505 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3506 reply.readException();
3507 int res = reply.readInt();
3508 ContentProviderHolder cph = null;
3509 if (res != 0) {
3510 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3511 }
3512 data.recycle();
3513 reply.recycle();
3514 return cph;
3515 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003516 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3517 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003522 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003523 data.writeStrongBinder(token);
3524 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3525 reply.readException();
3526 int res = reply.readInt();
3527 ContentProviderHolder cph = null;
3528 if (res != 0) {
3529 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3530 }
3531 data.recycle();
3532 reply.recycle();
3533 return cph;
3534 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003535 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003536 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003537 {
3538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3542 data.writeTypedList(providers);
3543 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3544 reply.readException();
3545 data.recycle();
3546 reply.recycle();
3547 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003548 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3549 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003550 Parcel data = Parcel.obtain();
3551 Parcel reply = Parcel.obtain();
3552 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003553 data.writeStrongBinder(connection);
3554 data.writeInt(stable);
3555 data.writeInt(unstable);
3556 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3557 reply.readException();
3558 boolean res = reply.readInt() != 0;
3559 data.recycle();
3560 reply.recycle();
3561 return res;
3562 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003563
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003564 public void unstableProviderDied(IBinder connection) throws RemoteException {
3565 Parcel data = Parcel.obtain();
3566 Parcel reply = Parcel.obtain();
3567 data.writeInterfaceToken(IActivityManager.descriptor);
3568 data.writeStrongBinder(connection);
3569 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3570 reply.readException();
3571 data.recycle();
3572 reply.recycle();
3573 }
3574
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003575 @Override
3576 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3577 Parcel data = Parcel.obtain();
3578 Parcel reply = Parcel.obtain();
3579 data.writeInterfaceToken(IActivityManager.descriptor);
3580 data.writeStrongBinder(connection);
3581 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3582 reply.readException();
3583 data.recycle();
3584 reply.recycle();
3585 }
3586
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003587 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3588 Parcel data = Parcel.obtain();
3589 Parcel reply = Parcel.obtain();
3590 data.writeInterfaceToken(IActivityManager.descriptor);
3591 data.writeStrongBinder(connection);
3592 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003593 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3594 reply.readException();
3595 data.recycle();
3596 reply.recycle();
3597 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003598
3599 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3600 Parcel data = Parcel.obtain();
3601 Parcel reply = Parcel.obtain();
3602 data.writeInterfaceToken(IActivityManager.descriptor);
3603 data.writeString(name);
3604 data.writeStrongBinder(token);
3605 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3606 reply.readException();
3607 data.recycle();
3608 reply.recycle();
3609 }
3610
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003611 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3612 throws RemoteException
3613 {
3614 Parcel data = Parcel.obtain();
3615 Parcel reply = Parcel.obtain();
3616 data.writeInterfaceToken(IActivityManager.descriptor);
3617 service.writeToParcel(data, 0);
3618 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3619 reply.readException();
3620 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3621 data.recycle();
3622 reply.recycle();
3623 return res;
3624 }
3625
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003626 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003627 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003628 {
3629 Parcel data = Parcel.obtain();
3630 Parcel reply = Parcel.obtain();
3631 data.writeInterfaceToken(IActivityManager.descriptor);
3632 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3633 service.writeToParcel(data, 0);
3634 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003635 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003636 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3637 reply.readException();
3638 ComponentName res = ComponentName.readFromParcel(reply);
3639 data.recycle();
3640 reply.recycle();
3641 return res;
3642 }
3643 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003644 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003645 {
3646 Parcel data = Parcel.obtain();
3647 Parcel reply = Parcel.obtain();
3648 data.writeInterfaceToken(IActivityManager.descriptor);
3649 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3650 service.writeToParcel(data, 0);
3651 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003652 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003653 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3654 reply.readException();
3655 int res = reply.readInt();
3656 reply.recycle();
3657 data.recycle();
3658 return res;
3659 }
3660 public boolean stopServiceToken(ComponentName className, IBinder token,
3661 int startId) throws RemoteException {
3662 Parcel data = Parcel.obtain();
3663 Parcel reply = Parcel.obtain();
3664 data.writeInterfaceToken(IActivityManager.descriptor);
3665 ComponentName.writeToParcel(className, data);
3666 data.writeStrongBinder(token);
3667 data.writeInt(startId);
3668 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3669 reply.readException();
3670 boolean res = reply.readInt() != 0;
3671 data.recycle();
3672 reply.recycle();
3673 return res;
3674 }
3675 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003676 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 ComponentName.writeToParcel(className, data);
3681 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003682 data.writeInt(id);
3683 if (notification != null) {
3684 data.writeInt(1);
3685 notification.writeToParcel(data, 0);
3686 } else {
3687 data.writeInt(0);
3688 }
3689 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003690 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3691 reply.readException();
3692 data.recycle();
3693 reply.recycle();
3694 }
3695 public int bindService(IApplicationThread caller, IBinder token,
3696 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003697 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003698 Parcel data = Parcel.obtain();
3699 Parcel reply = Parcel.obtain();
3700 data.writeInterfaceToken(IActivityManager.descriptor);
3701 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3702 data.writeStrongBinder(token);
3703 service.writeToParcel(data, 0);
3704 data.writeString(resolvedType);
3705 data.writeStrongBinder(connection.asBinder());
3706 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003707 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003708 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 int res = reply.readInt();
3711 data.recycle();
3712 reply.recycle();
3713 return res;
3714 }
3715 public boolean unbindService(IServiceConnection connection) throws RemoteException
3716 {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 data.writeStrongBinder(connection.asBinder());
3721 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3722 reply.readException();
3723 boolean res = reply.readInt() != 0;
3724 data.recycle();
3725 reply.recycle();
3726 return res;
3727 }
3728
3729 public void publishService(IBinder token,
3730 Intent intent, IBinder service) throws RemoteException {
3731 Parcel data = Parcel.obtain();
3732 Parcel reply = Parcel.obtain();
3733 data.writeInterfaceToken(IActivityManager.descriptor);
3734 data.writeStrongBinder(token);
3735 intent.writeToParcel(data, 0);
3736 data.writeStrongBinder(service);
3737 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3738 reply.readException();
3739 data.recycle();
3740 reply.recycle();
3741 }
3742
3743 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3744 throws RemoteException {
3745 Parcel data = Parcel.obtain();
3746 Parcel reply = Parcel.obtain();
3747 data.writeInterfaceToken(IActivityManager.descriptor);
3748 data.writeStrongBinder(token);
3749 intent.writeToParcel(data, 0);
3750 data.writeInt(doRebind ? 1 : 0);
3751 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3752 reply.readException();
3753 data.recycle();
3754 reply.recycle();
3755 }
3756
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003757 public void serviceDoneExecuting(IBinder token, int type, int startId,
3758 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003763 data.writeInt(type);
3764 data.writeInt(startId);
3765 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003766 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3767 reply.readException();
3768 data.recycle();
3769 reply.recycle();
3770 }
3771
3772 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3773 Parcel data = Parcel.obtain();
3774 Parcel reply = Parcel.obtain();
3775 data.writeInterfaceToken(IActivityManager.descriptor);
3776 service.writeToParcel(data, 0);
3777 data.writeString(resolvedType);
3778 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3779 reply.readException();
3780 IBinder binder = reply.readStrongBinder();
3781 reply.recycle();
3782 data.recycle();
3783 return binder;
3784 }
3785
Christopher Tate181fafa2009-05-14 11:12:14 -07003786 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3787 throws RemoteException {
3788 Parcel data = Parcel.obtain();
3789 Parcel reply = Parcel.obtain();
3790 data.writeInterfaceToken(IActivityManager.descriptor);
3791 app.writeToParcel(data, 0);
3792 data.writeInt(backupRestoreMode);
3793 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3794 reply.readException();
3795 boolean success = reply.readInt() != 0;
3796 reply.recycle();
3797 data.recycle();
3798 return success;
3799 }
3800
Christopher Tate346acb12012-10-15 19:20:25 -07003801 public void clearPendingBackup() throws RemoteException {
3802 Parcel data = Parcel.obtain();
3803 Parcel reply = Parcel.obtain();
3804 data.writeInterfaceToken(IActivityManager.descriptor);
3805 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3806 reply.recycle();
3807 data.recycle();
3808 }
3809
Christopher Tate181fafa2009-05-14 11:12:14 -07003810 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3811 Parcel data = Parcel.obtain();
3812 Parcel reply = Parcel.obtain();
3813 data.writeInterfaceToken(IActivityManager.descriptor);
3814 data.writeString(packageName);
3815 data.writeStrongBinder(agent);
3816 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3817 reply.recycle();
3818 data.recycle();
3819 }
3820
3821 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3822 Parcel data = Parcel.obtain();
3823 Parcel reply = Parcel.obtain();
3824 data.writeInterfaceToken(IActivityManager.descriptor);
3825 app.writeToParcel(data, 0);
3826 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3827 reply.readException();
3828 reply.recycle();
3829 data.recycle();
3830 }
3831
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003832 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003833 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003834 IUiAutomationConnection connection, int userId, String instructionSet)
3835 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
3839 ComponentName.writeToParcel(className, data);
3840 data.writeString(profileFile);
3841 data.writeInt(flags);
3842 data.writeBundle(arguments);
3843 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003844 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003845 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003846 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003847 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3848 reply.readException();
3849 boolean res = reply.readInt() != 0;
3850 reply.recycle();
3851 data.recycle();
3852 return res;
3853 }
3854
3855 public void finishInstrumentation(IApplicationThread target,
3856 int resultCode, Bundle results) throws RemoteException {
3857 Parcel data = Parcel.obtain();
3858 Parcel reply = Parcel.obtain();
3859 data.writeInterfaceToken(IActivityManager.descriptor);
3860 data.writeStrongBinder(target != null ? target.asBinder() : null);
3861 data.writeInt(resultCode);
3862 data.writeBundle(results);
3863 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3864 reply.readException();
3865 data.recycle();
3866 reply.recycle();
3867 }
3868 public Configuration getConfiguration() throws RemoteException
3869 {
3870 Parcel data = Parcel.obtain();
3871 Parcel reply = Parcel.obtain();
3872 data.writeInterfaceToken(IActivityManager.descriptor);
3873 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3874 reply.readException();
3875 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3876 reply.recycle();
3877 data.recycle();
3878 return res;
3879 }
3880 public void updateConfiguration(Configuration values) throws RemoteException
3881 {
3882 Parcel data = Parcel.obtain();
3883 Parcel reply = Parcel.obtain();
3884 data.writeInterfaceToken(IActivityManager.descriptor);
3885 values.writeToParcel(data, 0);
3886 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3887 reply.readException();
3888 data.recycle();
3889 reply.recycle();
3890 }
3891 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3892 throws RemoteException {
3893 Parcel data = Parcel.obtain();
3894 Parcel reply = Parcel.obtain();
3895 data.writeInterfaceToken(IActivityManager.descriptor);
3896 data.writeStrongBinder(token);
3897 data.writeInt(requestedOrientation);
3898 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3899 reply.readException();
3900 data.recycle();
3901 reply.recycle();
3902 }
3903 public int getRequestedOrientation(IBinder token) throws RemoteException {
3904 Parcel data = Parcel.obtain();
3905 Parcel reply = Parcel.obtain();
3906 data.writeInterfaceToken(IActivityManager.descriptor);
3907 data.writeStrongBinder(token);
3908 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3909 reply.readException();
3910 int res = reply.readInt();
3911 data.recycle();
3912 reply.recycle();
3913 return res;
3914 }
3915 public ComponentName getActivityClassForToken(IBinder token)
3916 throws RemoteException {
3917 Parcel data = Parcel.obtain();
3918 Parcel reply = Parcel.obtain();
3919 data.writeInterfaceToken(IActivityManager.descriptor);
3920 data.writeStrongBinder(token);
3921 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 ComponentName res = ComponentName.readFromParcel(reply);
3924 data.recycle();
3925 reply.recycle();
3926 return res;
3927 }
3928 public String getPackageForToken(IBinder token) throws RemoteException
3929 {
3930 Parcel data = Parcel.obtain();
3931 Parcel reply = Parcel.obtain();
3932 data.writeInterfaceToken(IActivityManager.descriptor);
3933 data.writeStrongBinder(token);
3934 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3935 reply.readException();
3936 String res = reply.readString();
3937 data.recycle();
3938 reply.recycle();
3939 return res;
3940 }
3941 public IIntentSender getIntentSender(int type,
3942 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003943 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003944 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003945 Parcel data = Parcel.obtain();
3946 Parcel reply = Parcel.obtain();
3947 data.writeInterfaceToken(IActivityManager.descriptor);
3948 data.writeInt(type);
3949 data.writeString(packageName);
3950 data.writeStrongBinder(token);
3951 data.writeString(resultWho);
3952 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003953 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003954 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003955 data.writeTypedArray(intents, 0);
3956 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003957 } else {
3958 data.writeInt(0);
3959 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003960 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003961 if (options != null) {
3962 data.writeInt(1);
3963 options.writeToParcel(data, 0);
3964 } else {
3965 data.writeInt(0);
3966 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003967 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003968 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3969 reply.readException();
3970 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003971 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003972 data.recycle();
3973 reply.recycle();
3974 return res;
3975 }
3976 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 data.writeStrongBinder(sender.asBinder());
3981 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3982 reply.readException();
3983 data.recycle();
3984 reply.recycle();
3985 }
3986 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3987 Parcel data = Parcel.obtain();
3988 Parcel reply = Parcel.obtain();
3989 data.writeInterfaceToken(IActivityManager.descriptor);
3990 data.writeStrongBinder(sender.asBinder());
3991 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3992 reply.readException();
3993 String res = reply.readString();
3994 data.recycle();
3995 reply.recycle();
3996 return res;
3997 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003998 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3999 Parcel data = Parcel.obtain();
4000 Parcel reply = Parcel.obtain();
4001 data.writeInterfaceToken(IActivityManager.descriptor);
4002 data.writeStrongBinder(sender.asBinder());
4003 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4004 reply.readException();
4005 int res = reply.readInt();
4006 data.recycle();
4007 reply.recycle();
4008 return res;
4009 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004010 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4011 boolean requireFull, String name, String callerPackage) throws RemoteException {
4012 Parcel data = Parcel.obtain();
4013 Parcel reply = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
4015 data.writeInt(callingPid);
4016 data.writeInt(callingUid);
4017 data.writeInt(userId);
4018 data.writeInt(allowAll ? 1 : 0);
4019 data.writeInt(requireFull ? 1 : 0);
4020 data.writeString(name);
4021 data.writeString(callerPackage);
4022 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4023 reply.readException();
4024 int res = reply.readInt();
4025 data.recycle();
4026 reply.recycle();
4027 return res;
4028 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004029 public void setProcessLimit(int max) throws RemoteException
4030 {
4031 Parcel data = Parcel.obtain();
4032 Parcel reply = Parcel.obtain();
4033 data.writeInterfaceToken(IActivityManager.descriptor);
4034 data.writeInt(max);
4035 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4036 reply.readException();
4037 data.recycle();
4038 reply.recycle();
4039 }
4040 public int getProcessLimit() throws RemoteException
4041 {
4042 Parcel data = Parcel.obtain();
4043 Parcel reply = Parcel.obtain();
4044 data.writeInterfaceToken(IActivityManager.descriptor);
4045 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4046 reply.readException();
4047 int res = reply.readInt();
4048 data.recycle();
4049 reply.recycle();
4050 return res;
4051 }
4052 public void setProcessForeground(IBinder token, int pid,
4053 boolean isForeground) throws RemoteException {
4054 Parcel data = Parcel.obtain();
4055 Parcel reply = Parcel.obtain();
4056 data.writeInterfaceToken(IActivityManager.descriptor);
4057 data.writeStrongBinder(token);
4058 data.writeInt(pid);
4059 data.writeInt(isForeground ? 1 : 0);
4060 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4061 reply.readException();
4062 data.recycle();
4063 reply.recycle();
4064 }
4065 public int checkPermission(String permission, int pid, int uid)
4066 throws RemoteException {
4067 Parcel data = Parcel.obtain();
4068 Parcel reply = Parcel.obtain();
4069 data.writeInterfaceToken(IActivityManager.descriptor);
4070 data.writeString(permission);
4071 data.writeInt(pid);
4072 data.writeInt(uid);
4073 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4074 reply.readException();
4075 int res = reply.readInt();
4076 data.recycle();
4077 reply.recycle();
4078 return res;
4079 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004080 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4081 throws RemoteException {
4082 Parcel data = Parcel.obtain();
4083 Parcel reply = Parcel.obtain();
4084 data.writeInterfaceToken(IActivityManager.descriptor);
4085 data.writeString(permission);
4086 data.writeInt(pid);
4087 data.writeInt(uid);
4088 data.writeStrongBinder(callerToken);
4089 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4090 reply.readException();
4091 int res = reply.readInt();
4092 data.recycle();
4093 reply.recycle();
4094 return res;
4095 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004096 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004097 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004098 Parcel data = Parcel.obtain();
4099 Parcel reply = Parcel.obtain();
4100 data.writeInterfaceToken(IActivityManager.descriptor);
4101 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004102 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004103 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004104 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4105 reply.readException();
4106 boolean res = reply.readInt() != 0;
4107 data.recycle();
4108 reply.recycle();
4109 return res;
4110 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004111 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4112 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004113 Parcel data = Parcel.obtain();
4114 Parcel reply = Parcel.obtain();
4115 data.writeInterfaceToken(IActivityManager.descriptor);
4116 uri.writeToParcel(data, 0);
4117 data.writeInt(pid);
4118 data.writeInt(uid);
4119 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004120 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004121 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004122 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4123 reply.readException();
4124 int res = reply.readInt();
4125 data.recycle();
4126 reply.recycle();
4127 return res;
4128 }
4129 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004130 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 data.writeStrongBinder(caller.asBinder());
4135 data.writeString(targetPkg);
4136 uri.writeToParcel(data, 0);
4137 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004138 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004139 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4140 reply.readException();
4141 data.recycle();
4142 reply.recycle();
4143 }
4144 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004145 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004146 Parcel data = Parcel.obtain();
4147 Parcel reply = Parcel.obtain();
4148 data.writeInterfaceToken(IActivityManager.descriptor);
4149 data.writeStrongBinder(caller.asBinder());
4150 uri.writeToParcel(data, 0);
4151 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004152 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004153 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4154 reply.readException();
4155 data.recycle();
4156 reply.recycle();
4157 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004158
4159 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004160 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4161 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004162 Parcel data = Parcel.obtain();
4163 Parcel reply = Parcel.obtain();
4164 data.writeInterfaceToken(IActivityManager.descriptor);
4165 uri.writeToParcel(data, 0);
4166 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004167 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004168 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4169 reply.readException();
4170 data.recycle();
4171 reply.recycle();
4172 }
4173
4174 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004175 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4176 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004177 Parcel data = Parcel.obtain();
4178 Parcel reply = Parcel.obtain();
4179 data.writeInterfaceToken(IActivityManager.descriptor);
4180 uri.writeToParcel(data, 0);
4181 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004182 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004183 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4184 reply.readException();
4185 data.recycle();
4186 reply.recycle();
4187 }
4188
4189 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004190 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4191 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004192 Parcel data = Parcel.obtain();
4193 Parcel reply = Parcel.obtain();
4194 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004195 data.writeString(packageName);
4196 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004197 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4198 reply.readException();
4199 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4200 reply);
4201 data.recycle();
4202 reply.recycle();
4203 return perms;
4204 }
4205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004206 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4207 throws RemoteException {
4208 Parcel data = Parcel.obtain();
4209 Parcel reply = Parcel.obtain();
4210 data.writeInterfaceToken(IActivityManager.descriptor);
4211 data.writeStrongBinder(who.asBinder());
4212 data.writeInt(waiting ? 1 : 0);
4213 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4214 reply.readException();
4215 data.recycle();
4216 reply.recycle();
4217 }
4218 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4219 Parcel data = Parcel.obtain();
4220 Parcel reply = Parcel.obtain();
4221 data.writeInterfaceToken(IActivityManager.descriptor);
4222 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4223 reply.readException();
4224 outInfo.readFromParcel(reply);
4225 data.recycle();
4226 reply.recycle();
4227 }
4228 public void unhandledBack() throws RemoteException
4229 {
4230 Parcel data = Parcel.obtain();
4231 Parcel reply = Parcel.obtain();
4232 data.writeInterfaceToken(IActivityManager.descriptor);
4233 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4234 reply.readException();
4235 data.recycle();
4236 reply.recycle();
4237 }
4238 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4239 {
4240 Parcel data = Parcel.obtain();
4241 Parcel reply = Parcel.obtain();
4242 data.writeInterfaceToken(IActivityManager.descriptor);
4243 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4244 reply.readException();
4245 ParcelFileDescriptor pfd = null;
4246 if (reply.readInt() != 0) {
4247 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4248 }
4249 data.recycle();
4250 reply.recycle();
4251 return pfd;
4252 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004253 public void setLockScreenShown(boolean shown) throws RemoteException
4254 {
4255 Parcel data = Parcel.obtain();
4256 Parcel reply = Parcel.obtain();
4257 data.writeInterfaceToken(IActivityManager.descriptor);
4258 data.writeInt(shown ? 1 : 0);
4259 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4260 reply.readException();
4261 data.recycle();
4262 reply.recycle();
4263 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004264 public void setDebugApp(
4265 String packageName, boolean waitForDebugger, boolean persistent)
4266 throws RemoteException
4267 {
4268 Parcel data = Parcel.obtain();
4269 Parcel reply = Parcel.obtain();
4270 data.writeInterfaceToken(IActivityManager.descriptor);
4271 data.writeString(packageName);
4272 data.writeInt(waitForDebugger ? 1 : 0);
4273 data.writeInt(persistent ? 1 : 0);
4274 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4275 reply.readException();
4276 data.recycle();
4277 reply.recycle();
4278 }
4279 public void setAlwaysFinish(boolean enabled) throws RemoteException
4280 {
4281 Parcel data = Parcel.obtain();
4282 Parcel reply = Parcel.obtain();
4283 data.writeInterfaceToken(IActivityManager.descriptor);
4284 data.writeInt(enabled ? 1 : 0);
4285 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4286 reply.readException();
4287 data.recycle();
4288 reply.recycle();
4289 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004290 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004291 {
4292 Parcel data = Parcel.obtain();
4293 Parcel reply = Parcel.obtain();
4294 data.writeInterfaceToken(IActivityManager.descriptor);
4295 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004296 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004297 reply.readException();
4298 data.recycle();
4299 reply.recycle();
4300 }
4301 public void enterSafeMode() throws RemoteException {
4302 Parcel data = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4305 data.recycle();
4306 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004307 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004308 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004309 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004310 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004311 data.writeStrongBinder(sender.asBinder());
4312 data.writeInt(sourceUid);
4313 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004314 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004315 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4316 data.recycle();
4317 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004318 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4319 throws RemoteException {
4320 Parcel data = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
4322 data.writeStrongBinder(sender.asBinder());
4323 data.writeInt(sourceUid);
4324 data.writeString(tag);
4325 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4326 data.recycle();
4327 }
4328 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4329 throws RemoteException {
4330 Parcel data = Parcel.obtain();
4331 data.writeInterfaceToken(IActivityManager.descriptor);
4332 data.writeStrongBinder(sender.asBinder());
4333 data.writeInt(sourceUid);
4334 data.writeString(tag);
4335 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4336 data.recycle();
4337 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004338 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004339 Parcel data = Parcel.obtain();
4340 Parcel reply = Parcel.obtain();
4341 data.writeInterfaceToken(IActivityManager.descriptor);
4342 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004343 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004344 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004345 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004346 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004347 boolean res = reply.readInt() != 0;
4348 data.recycle();
4349 reply.recycle();
4350 return res;
4351 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004352 @Override
4353 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4354 Parcel data = Parcel.obtain();
4355 Parcel reply = Parcel.obtain();
4356 data.writeInterfaceToken(IActivityManager.descriptor);
4357 data.writeString(reason);
4358 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4359 boolean res = reply.readInt() != 0;
4360 data.recycle();
4361 reply.recycle();
4362 return res;
4363 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004364 public boolean testIsSystemReady()
4365 {
4366 /* this base class version is never called */
4367 return true;
4368 }
Dan Egnor60d87622009-12-16 16:32:58 -08004369 public void handleApplicationCrash(IBinder app,
4370 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4371 {
4372 Parcel data = Parcel.obtain();
4373 Parcel reply = Parcel.obtain();
4374 data.writeInterfaceToken(IActivityManager.descriptor);
4375 data.writeStrongBinder(app);
4376 crashInfo.writeToParcel(data, 0);
4377 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4378 reply.readException();
4379 reply.recycle();
4380 data.recycle();
4381 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004382
Dianne Hackborn52322712014-08-26 22:47:26 -07004383 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004384 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004385 {
4386 Parcel data = Parcel.obtain();
4387 Parcel reply = Parcel.obtain();
4388 data.writeInterfaceToken(IActivityManager.descriptor);
4389 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004390 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004391 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004392 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004393 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004394 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004395 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004396 reply.recycle();
4397 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004398 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004399 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004400
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004401 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004402 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004403 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004404 {
4405 Parcel data = Parcel.obtain();
4406 Parcel reply = Parcel.obtain();
4407 data.writeInterfaceToken(IActivityManager.descriptor);
4408 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004409 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004410 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004411 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4412 reply.readException();
4413 reply.recycle();
4414 data.recycle();
4415 }
4416
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004417 public void signalPersistentProcesses(int sig) throws RemoteException {
4418 Parcel data = Parcel.obtain();
4419 Parcel reply = Parcel.obtain();
4420 data.writeInterfaceToken(IActivityManager.descriptor);
4421 data.writeInt(sig);
4422 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4423 reply.readException();
4424 data.recycle();
4425 reply.recycle();
4426 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004427
Dianne Hackborn1676c852012-09-10 14:52:30 -07004428 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004429 Parcel data = Parcel.obtain();
4430 Parcel reply = Parcel.obtain();
4431 data.writeInterfaceToken(IActivityManager.descriptor);
4432 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004433 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004434 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4435 reply.readException();
4436 data.recycle();
4437 reply.recycle();
4438 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004439
4440 public void killAllBackgroundProcesses() throws RemoteException {
4441 Parcel data = Parcel.obtain();
4442 Parcel reply = Parcel.obtain();
4443 data.writeInterfaceToken(IActivityManager.descriptor);
4444 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4445 reply.readException();
4446 data.recycle();
4447 reply.recycle();
4448 }
4449
Dianne Hackborn1676c852012-09-10 14:52:30 -07004450 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004451 Parcel data = Parcel.obtain();
4452 Parcel reply = Parcel.obtain();
4453 data.writeInterfaceToken(IActivityManager.descriptor);
4454 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004455 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004456 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004457 reply.readException();
4458 data.recycle();
4459 reply.recycle();
4460 }
4461
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004462 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4463 throws RemoteException
4464 {
4465 Parcel data = Parcel.obtain();
4466 Parcel reply = Parcel.obtain();
4467 data.writeInterfaceToken(IActivityManager.descriptor);
4468 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4469 reply.readException();
4470 outInfo.readFromParcel(reply);
4471 reply.recycle();
4472 data.recycle();
4473 }
4474
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004475 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4476 {
4477 Parcel data = Parcel.obtain();
4478 Parcel reply = Parcel.obtain();
4479 data.writeInterfaceToken(IActivityManager.descriptor);
4480 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4481 reply.readException();
4482 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4483 reply.recycle();
4484 data.recycle();
4485 return res;
4486 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004487
Dianne Hackborn1676c852012-09-10 14:52:30 -07004488 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004489 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004490 {
4491 Parcel data = Parcel.obtain();
4492 Parcel reply = Parcel.obtain();
4493 data.writeInterfaceToken(IActivityManager.descriptor);
4494 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004495 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004496 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004497 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004498 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004499 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004500 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004501 } else {
4502 data.writeInt(0);
4503 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004504 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4505 reply.readException();
4506 boolean res = reply.readInt() != 0;
4507 reply.recycle();
4508 data.recycle();
4509 return res;
4510 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004511
Dianne Hackborn55280a92009-05-07 15:53:46 -07004512 public boolean shutdown(int timeout) throws RemoteException
4513 {
4514 Parcel data = Parcel.obtain();
4515 Parcel reply = Parcel.obtain();
4516 data.writeInterfaceToken(IActivityManager.descriptor);
4517 data.writeInt(timeout);
4518 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4519 reply.readException();
4520 boolean res = reply.readInt() != 0;
4521 reply.recycle();
4522 data.recycle();
4523 return res;
4524 }
4525
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004526 public void stopAppSwitches() throws RemoteException {
4527 Parcel data = Parcel.obtain();
4528 Parcel reply = Parcel.obtain();
4529 data.writeInterfaceToken(IActivityManager.descriptor);
4530 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4531 reply.readException();
4532 reply.recycle();
4533 data.recycle();
4534 }
4535
4536 public void resumeAppSwitches() throws RemoteException {
4537 Parcel data = Parcel.obtain();
4538 Parcel reply = Parcel.obtain();
4539 data.writeInterfaceToken(IActivityManager.descriptor);
4540 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4541 reply.readException();
4542 reply.recycle();
4543 data.recycle();
4544 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004545
4546 public void addPackageDependency(String packageName) throws RemoteException {
4547 Parcel data = Parcel.obtain();
4548 Parcel reply = Parcel.obtain();
4549 data.writeInterfaceToken(IActivityManager.descriptor);
4550 data.writeString(packageName);
4551 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4552 reply.readException();
4553 data.recycle();
4554 reply.recycle();
4555 }
4556
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004557 public void killApplicationWithAppId(String pkg, int appid, String reason)
4558 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004559 Parcel data = Parcel.obtain();
4560 Parcel reply = Parcel.obtain();
4561 data.writeInterfaceToken(IActivityManager.descriptor);
4562 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004563 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004564 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004565 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004566 reply.readException();
4567 data.recycle();
4568 reply.recycle();
4569 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004570
4571 public void closeSystemDialogs(String reason) throws RemoteException {
4572 Parcel data = Parcel.obtain();
4573 Parcel reply = Parcel.obtain();
4574 data.writeInterfaceToken(IActivityManager.descriptor);
4575 data.writeString(reason);
4576 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4577 reply.readException();
4578 data.recycle();
4579 reply.recycle();
4580 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004581
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004582 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004583 throws RemoteException {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004587 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004588 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4589 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004590 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004591 data.recycle();
4592 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004593 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004594 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004595
4596 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4597 Parcel data = Parcel.obtain();
4598 Parcel reply = Parcel.obtain();
4599 data.writeInterfaceToken(IActivityManager.descriptor);
4600 data.writeString(processName);
4601 data.writeInt(uid);
4602 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4603 reply.readException();
4604 data.recycle();
4605 reply.recycle();
4606 }
4607
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004608 public void overridePendingTransition(IBinder token, String packageName,
4609 int enterAnim, int exitAnim) throws RemoteException {
4610 Parcel data = Parcel.obtain();
4611 Parcel reply = Parcel.obtain();
4612 data.writeInterfaceToken(IActivityManager.descriptor);
4613 data.writeStrongBinder(token);
4614 data.writeString(packageName);
4615 data.writeInt(enterAnim);
4616 data.writeInt(exitAnim);
4617 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4618 reply.readException();
4619 data.recycle();
4620 reply.recycle();
4621 }
4622
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004623 public boolean isUserAMonkey() throws RemoteException {
4624 Parcel data = Parcel.obtain();
4625 Parcel reply = Parcel.obtain();
4626 data.writeInterfaceToken(IActivityManager.descriptor);
4627 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4628 reply.readException();
4629 boolean res = reply.readInt() != 0;
4630 data.recycle();
4631 reply.recycle();
4632 return res;
4633 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004634
4635 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4636 Parcel data = Parcel.obtain();
4637 Parcel reply = Parcel.obtain();
4638 data.writeInterfaceToken(IActivityManager.descriptor);
4639 data.writeInt(monkey ? 1 : 0);
4640 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4641 reply.readException();
4642 data.recycle();
4643 reply.recycle();
4644 }
4645
Dianne Hackborn860755f2010-06-03 18:47:52 -07004646 public void finishHeavyWeightApp() throws RemoteException {
4647 Parcel data = Parcel.obtain();
4648 Parcel reply = Parcel.obtain();
4649 data.writeInterfaceToken(IActivityManager.descriptor);
4650 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4651 reply.readException();
4652 data.recycle();
4653 reply.recycle();
4654 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004655
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004656 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004657 throws RemoteException {
4658 Parcel data = Parcel.obtain();
4659 Parcel reply = Parcel.obtain();
4660 data.writeInterfaceToken(IActivityManager.descriptor);
4661 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004662 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4663 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004664 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004665 data.recycle();
4666 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004667 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004668 }
4669
Craig Mautner233ceee2014-05-09 17:05:11 -07004670 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004671 throws RemoteException {
4672 Parcel data = Parcel.obtain();
4673 Parcel reply = Parcel.obtain();
4674 data.writeInterfaceToken(IActivityManager.descriptor);
4675 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004676 if (options == null) {
4677 data.writeInt(0);
4678 } else {
4679 data.writeInt(1);
4680 data.writeBundle(options.toBundle());
4681 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004682 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004683 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004684 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004685 data.recycle();
4686 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004687 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004688 }
4689
Craig Mautner233ceee2014-05-09 17:05:11 -07004690 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4691 Parcel data = Parcel.obtain();
4692 Parcel reply = Parcel.obtain();
4693 data.writeInterfaceToken(IActivityManager.descriptor);
4694 data.writeStrongBinder(token);
4695 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4696 reply.readException();
4697 Bundle bundle = reply.readBundle();
4698 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4699 data.recycle();
4700 reply.recycle();
4701 return options;
4702 }
4703
Daniel Sandler69a48172010-06-23 16:29:36 -04004704 public void setImmersive(IBinder token, boolean immersive)
4705 throws RemoteException {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 data.writeStrongBinder(token);
4710 data.writeInt(immersive ? 1 : 0);
4711 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4712 reply.readException();
4713 data.recycle();
4714 reply.recycle();
4715 }
4716
4717 public boolean isImmersive(IBinder token)
4718 throws RemoteException {
4719 Parcel data = Parcel.obtain();
4720 Parcel reply = Parcel.obtain();
4721 data.writeInterfaceToken(IActivityManager.descriptor);
4722 data.writeStrongBinder(token);
4723 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004724 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004725 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004726 data.recycle();
4727 reply.recycle();
4728 return res;
4729 }
4730
Craig Mautnerd61dc202014-07-07 11:09:11 -07004731 public boolean isTopOfTask(IBinder token) throws RemoteException {
4732 Parcel data = Parcel.obtain();
4733 Parcel reply = Parcel.obtain();
4734 data.writeInterfaceToken(IActivityManager.descriptor);
4735 data.writeStrongBinder(token);
4736 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4737 reply.readException();
4738 boolean res = reply.readInt() == 1;
4739 data.recycle();
4740 reply.recycle();
4741 return res;
4742 }
4743
Daniel Sandler69a48172010-06-23 16:29:36 -04004744 public boolean isTopActivityImmersive()
4745 throws RemoteException {
4746 Parcel data = Parcel.obtain();
4747 Parcel reply = Parcel.obtain();
4748 data.writeInterfaceToken(IActivityManager.descriptor);
4749 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004750 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004751 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004752 data.recycle();
4753 reply.recycle();
4754 return res;
4755 }
4756
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004757 public void crashApplication(int uid, int initialPid, String packageName,
4758 String message) throws RemoteException {
4759 Parcel data = Parcel.obtain();
4760 Parcel reply = Parcel.obtain();
4761 data.writeInterfaceToken(IActivityManager.descriptor);
4762 data.writeInt(uid);
4763 data.writeInt(initialPid);
4764 data.writeString(packageName);
4765 data.writeString(message);
4766 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4767 reply.readException();
4768 data.recycle();
4769 reply.recycle();
4770 }
Andy McFadden824c5102010-07-09 16:26:57 -07004771
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004772 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004773 Parcel data = Parcel.obtain();
4774 Parcel reply = Parcel.obtain();
4775 data.writeInterfaceToken(IActivityManager.descriptor);
4776 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004777 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004778 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4779 reply.readException();
4780 String res = reply.readString();
4781 data.recycle();
4782 reply.recycle();
4783 return res;
4784 }
4785
Dianne Hackborn7e269642010-08-25 19:50:20 -07004786 public IBinder newUriPermissionOwner(String name)
4787 throws RemoteException {
4788 Parcel data = Parcel.obtain();
4789 Parcel reply = Parcel.obtain();
4790 data.writeInterfaceToken(IActivityManager.descriptor);
4791 data.writeString(name);
4792 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4793 reply.readException();
4794 IBinder res = reply.readStrongBinder();
4795 data.recycle();
4796 reply.recycle();
4797 return res;
4798 }
4799
4800 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004801 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004802 Parcel data = Parcel.obtain();
4803 Parcel reply = Parcel.obtain();
4804 data.writeInterfaceToken(IActivityManager.descriptor);
4805 data.writeStrongBinder(owner);
4806 data.writeInt(fromUid);
4807 data.writeString(targetPkg);
4808 uri.writeToParcel(data, 0);
4809 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004810 data.writeInt(sourceUserId);
4811 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004812 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4813 reply.readException();
4814 data.recycle();
4815 reply.recycle();
4816 }
4817
4818 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004819 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004820 Parcel data = Parcel.obtain();
4821 Parcel reply = Parcel.obtain();
4822 data.writeInterfaceToken(IActivityManager.descriptor);
4823 data.writeStrongBinder(owner);
4824 if (uri != null) {
4825 data.writeInt(1);
4826 uri.writeToParcel(data, 0);
4827 } else {
4828 data.writeInt(0);
4829 }
4830 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004831 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004832 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4833 reply.readException();
4834 data.recycle();
4835 reply.recycle();
4836 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004837
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004838 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004839 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004840 Parcel data = Parcel.obtain();
4841 Parcel reply = Parcel.obtain();
4842 data.writeInterfaceToken(IActivityManager.descriptor);
4843 data.writeInt(callingUid);
4844 data.writeString(targetPkg);
4845 uri.writeToParcel(data, 0);
4846 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004847 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004848 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4849 reply.readException();
4850 int res = reply.readInt();
4851 data.recycle();
4852 reply.recycle();
4853 return res;
4854 }
4855
Dianne Hackborn1676c852012-09-10 14:52:30 -07004856 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004857 String path, ParcelFileDescriptor fd) throws RemoteException {
4858 Parcel data = Parcel.obtain();
4859 Parcel reply = Parcel.obtain();
4860 data.writeInterfaceToken(IActivityManager.descriptor);
4861 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004862 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004863 data.writeInt(managed ? 1 : 0);
4864 data.writeString(path);
4865 if (fd != null) {
4866 data.writeInt(1);
4867 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4868 } else {
4869 data.writeInt(0);
4870 }
4871 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4872 reply.readException();
4873 boolean res = reply.readInt() != 0;
4874 reply.recycle();
4875 data.recycle();
4876 return res;
4877 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004878
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004879 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004880 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004881 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004882 Parcel data = Parcel.obtain();
4883 Parcel reply = Parcel.obtain();
4884 data.writeInterfaceToken(IActivityManager.descriptor);
4885 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004886 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004887 data.writeTypedArray(intents, 0);
4888 data.writeStringArray(resolvedTypes);
4889 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004890 if (options != null) {
4891 data.writeInt(1);
4892 options.writeToParcel(data, 0);
4893 } else {
4894 data.writeInt(0);
4895 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004896 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004897 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4898 reply.readException();
4899 int result = reply.readInt();
4900 reply.recycle();
4901 data.recycle();
4902 return result;
4903 }
4904
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004905 public int getFrontActivityScreenCompatMode() throws RemoteException {
4906 Parcel data = Parcel.obtain();
4907 Parcel reply = Parcel.obtain();
4908 data.writeInterfaceToken(IActivityManager.descriptor);
4909 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4910 reply.readException();
4911 int mode = reply.readInt();
4912 reply.recycle();
4913 data.recycle();
4914 return mode;
4915 }
4916
4917 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4918 Parcel data = Parcel.obtain();
4919 Parcel reply = Parcel.obtain();
4920 data.writeInterfaceToken(IActivityManager.descriptor);
4921 data.writeInt(mode);
4922 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4923 reply.readException();
4924 reply.recycle();
4925 data.recycle();
4926 }
4927
4928 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4929 Parcel data = Parcel.obtain();
4930 Parcel reply = Parcel.obtain();
4931 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004932 data.writeString(packageName);
4933 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004934 reply.readException();
4935 int mode = reply.readInt();
4936 reply.recycle();
4937 data.recycle();
4938 return mode;
4939 }
4940
4941 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004942 throws RemoteException {
4943 Parcel data = Parcel.obtain();
4944 Parcel reply = Parcel.obtain();
4945 data.writeInterfaceToken(IActivityManager.descriptor);
4946 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004947 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004948 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4949 reply.readException();
4950 reply.recycle();
4951 data.recycle();
4952 }
4953
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004954 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4955 Parcel data = Parcel.obtain();
4956 Parcel reply = Parcel.obtain();
4957 data.writeInterfaceToken(IActivityManager.descriptor);
4958 data.writeString(packageName);
4959 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4960 reply.readException();
4961 boolean ask = reply.readInt() != 0;
4962 reply.recycle();
4963 data.recycle();
4964 return ask;
4965 }
4966
4967 public void setPackageAskScreenCompat(String packageName, boolean ask)
4968 throws RemoteException {
4969 Parcel data = Parcel.obtain();
4970 Parcel reply = Parcel.obtain();
4971 data.writeInterfaceToken(IActivityManager.descriptor);
4972 data.writeString(packageName);
4973 data.writeInt(ask ? 1 : 0);
4974 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4975 reply.readException();
4976 reply.recycle();
4977 data.recycle();
4978 }
4979
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004980 public boolean switchUser(int userid) throws RemoteException {
4981 Parcel data = Parcel.obtain();
4982 Parcel reply = Parcel.obtain();
4983 data.writeInterfaceToken(IActivityManager.descriptor);
4984 data.writeInt(userid);
4985 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4986 reply.readException();
4987 boolean result = reply.readInt() != 0;
4988 reply.recycle();
4989 data.recycle();
4990 return result;
4991 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004992
Kenny Guy08488bf2014-02-21 17:40:37 +00004993 public boolean startUserInBackground(int userid) throws RemoteException {
4994 Parcel data = Parcel.obtain();
4995 Parcel reply = Parcel.obtain();
4996 data.writeInterfaceToken(IActivityManager.descriptor);
4997 data.writeInt(userid);
4998 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4999 reply.readException();
5000 boolean result = reply.readInt() != 0;
5001 reply.recycle();
5002 data.recycle();
5003 return result;
5004 }
5005
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005006 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5007 Parcel data = Parcel.obtain();
5008 Parcel reply = Parcel.obtain();
5009 data.writeInterfaceToken(IActivityManager.descriptor);
5010 data.writeInt(userid);
5011 data.writeStrongInterface(callback);
5012 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5013 reply.readException();
5014 int result = reply.readInt();
5015 reply.recycle();
5016 data.recycle();
5017 return result;
5018 }
5019
Amith Yamasani52f1d752012-03-28 18:19:29 -07005020 public UserInfo getCurrentUser() throws RemoteException {
5021 Parcel data = Parcel.obtain();
5022 Parcel reply = Parcel.obtain();
5023 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005024 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005025 reply.readException();
5026 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5027 reply.recycle();
5028 data.recycle();
5029 return userInfo;
5030 }
5031
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005032 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005033 Parcel data = Parcel.obtain();
5034 Parcel reply = Parcel.obtain();
5035 data.writeInterfaceToken(IActivityManager.descriptor);
5036 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005037 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005038 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5039 reply.readException();
5040 boolean result = reply.readInt() != 0;
5041 reply.recycle();
5042 data.recycle();
5043 return result;
5044 }
5045
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005046 public int[] getRunningUserIds() throws RemoteException {
5047 Parcel data = Parcel.obtain();
5048 Parcel reply = Parcel.obtain();
5049 data.writeInterfaceToken(IActivityManager.descriptor);
5050 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5051 reply.readException();
5052 int[] result = reply.createIntArray();
5053 reply.recycle();
5054 data.recycle();
5055 return result;
5056 }
5057
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005058 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005059 Parcel data = Parcel.obtain();
5060 Parcel reply = Parcel.obtain();
5061 data.writeInterfaceToken(IActivityManager.descriptor);
5062 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005063 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5064 reply.readException();
5065 boolean result = reply.readInt() != 0;
5066 reply.recycle();
5067 data.recycle();
5068 return result;
5069 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005070
Jeff Sharkeya4620792011-05-20 15:29:23 -07005071 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5072 Parcel data = Parcel.obtain();
5073 Parcel reply = Parcel.obtain();
5074 data.writeInterfaceToken(IActivityManager.descriptor);
5075 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5076 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5077 reply.readException();
5078 data.recycle();
5079 reply.recycle();
5080 }
5081
5082 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5083 Parcel data = Parcel.obtain();
5084 Parcel reply = Parcel.obtain();
5085 data.writeInterfaceToken(IActivityManager.descriptor);
5086 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5087 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5088 reply.readException();
5089 data.recycle();
5090 reply.recycle();
5091 }
5092
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005093 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5094 Parcel data = Parcel.obtain();
5095 Parcel reply = Parcel.obtain();
5096 data.writeInterfaceToken(IActivityManager.descriptor);
5097 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5098 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5099 reply.readException();
5100 data.recycle();
5101 reply.recycle();
5102 }
5103
5104 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5105 Parcel data = Parcel.obtain();
5106 Parcel reply = Parcel.obtain();
5107 data.writeInterfaceToken(IActivityManager.descriptor);
5108 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5109 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5110 reply.readException();
5111 data.recycle();
5112 reply.recycle();
5113 }
5114
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005115 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5116 Parcel data = Parcel.obtain();
5117 Parcel reply = Parcel.obtain();
5118 data.writeInterfaceToken(IActivityManager.descriptor);
5119 data.writeStrongBinder(sender.asBinder());
5120 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5121 reply.readException();
5122 boolean res = reply.readInt() != 0;
5123 data.recycle();
5124 reply.recycle();
5125 return res;
5126 }
5127
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005128 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5129 Parcel data = Parcel.obtain();
5130 Parcel reply = Parcel.obtain();
5131 data.writeInterfaceToken(IActivityManager.descriptor);
5132 data.writeStrongBinder(sender.asBinder());
5133 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5134 reply.readException();
5135 boolean res = reply.readInt() != 0;
5136 data.recycle();
5137 reply.recycle();
5138 return res;
5139 }
5140
Dianne Hackborn81038902012-11-26 17:04:09 -08005141 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5142 Parcel data = Parcel.obtain();
5143 Parcel reply = Parcel.obtain();
5144 data.writeInterfaceToken(IActivityManager.descriptor);
5145 data.writeStrongBinder(sender.asBinder());
5146 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5147 reply.readException();
5148 Intent res = reply.readInt() != 0
5149 ? Intent.CREATOR.createFromParcel(reply) : null;
5150 data.recycle();
5151 reply.recycle();
5152 return res;
5153 }
5154
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005155 public String getTagForIntentSender(IIntentSender sender, String prefix)
5156 throws RemoteException {
5157 Parcel data = Parcel.obtain();
5158 Parcel reply = Parcel.obtain();
5159 data.writeInterfaceToken(IActivityManager.descriptor);
5160 data.writeStrongBinder(sender.asBinder());
5161 data.writeString(prefix);
5162 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5163 reply.readException();
5164 String res = reply.readString();
5165 data.recycle();
5166 reply.recycle();
5167 return res;
5168 }
5169
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005170 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5171 {
5172 Parcel data = Parcel.obtain();
5173 Parcel reply = Parcel.obtain();
5174 data.writeInterfaceToken(IActivityManager.descriptor);
5175 values.writeToParcel(data, 0);
5176 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5177 reply.readException();
5178 data.recycle();
5179 reply.recycle();
5180 }
5181
Dianne Hackbornb437e092011-08-05 17:50:29 -07005182 public long[] getProcessPss(int[] pids) throws RemoteException {
5183 Parcel data = Parcel.obtain();
5184 Parcel reply = Parcel.obtain();
5185 data.writeInterfaceToken(IActivityManager.descriptor);
5186 data.writeIntArray(pids);
5187 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5188 reply.readException();
5189 long[] res = reply.createLongArray();
5190 data.recycle();
5191 reply.recycle();
5192 return res;
5193 }
5194
Dianne Hackborn661cd522011-08-22 00:26:20 -07005195 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5196 Parcel data = Parcel.obtain();
5197 Parcel reply = Parcel.obtain();
5198 data.writeInterfaceToken(IActivityManager.descriptor);
5199 TextUtils.writeToParcel(msg, data, 0);
5200 data.writeInt(always ? 1 : 0);
5201 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5202 reply.readException();
5203 data.recycle();
5204 reply.recycle();
5205 }
5206
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005207 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005208 Parcel data = Parcel.obtain();
5209 Parcel reply = Parcel.obtain();
5210 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005211 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005212 reply.readException();
5213 data.recycle();
5214 reply.recycle();
5215 }
5216
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005217 public void keyguardGoingAway(boolean disableWindowAnimations,
5218 boolean keyguardGoingToNotificationShade) throws RemoteException {
5219 Parcel data = Parcel.obtain();
5220 Parcel reply = Parcel.obtain();
5221 data.writeInterfaceToken(IActivityManager.descriptor);
5222 data.writeInt(disableWindowAnimations ? 1 : 0);
5223 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5224 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5225 reply.readException();
5226 data.recycle();
5227 reply.recycle();
5228 }
5229
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005230 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005231 throws RemoteException {
5232 Parcel data = Parcel.obtain();
5233 Parcel reply = Parcel.obtain();
5234 data.writeInterfaceToken(IActivityManager.descriptor);
5235 data.writeStrongBinder(token);
5236 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005237 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005238 reply.readException();
5239 boolean result = reply.readInt() != 0;
5240 data.recycle();
5241 reply.recycle();
5242 return result;
5243 }
5244
5245 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5246 throws RemoteException {
5247 Parcel data = Parcel.obtain();
5248 Parcel reply = Parcel.obtain();
5249 data.writeInterfaceToken(IActivityManager.descriptor);
5250 data.writeStrongBinder(token);
5251 target.writeToParcel(data, 0);
5252 data.writeInt(resultCode);
5253 if (resultData != null) {
5254 data.writeInt(1);
5255 resultData.writeToParcel(data, 0);
5256 } else {
5257 data.writeInt(0);
5258 }
5259 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5260 reply.readException();
5261 boolean result = reply.readInt() != 0;
5262 data.recycle();
5263 reply.recycle();
5264 return result;
5265 }
5266
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005267 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5268 Parcel data = Parcel.obtain();
5269 Parcel reply = Parcel.obtain();
5270 data.writeInterfaceToken(IActivityManager.descriptor);
5271 data.writeStrongBinder(activityToken);
5272 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5273 reply.readException();
5274 int result = reply.readInt();
5275 data.recycle();
5276 reply.recycle();
5277 return result;
5278 }
5279
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005280 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5281 Parcel data = Parcel.obtain();
5282 Parcel reply = Parcel.obtain();
5283 data.writeInterfaceToken(IActivityManager.descriptor);
5284 data.writeStrongBinder(activityToken);
5285 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5286 reply.readException();
5287 String result = reply.readString();
5288 data.recycle();
5289 reply.recycle();
5290 return result;
5291 }
5292
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005293 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5294 Parcel data = Parcel.obtain();
5295 Parcel reply = Parcel.obtain();
5296 data.writeInterfaceToken(IActivityManager.descriptor);
5297 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5298 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5299 reply.readException();
5300 data.recycle();
5301 reply.recycle();
5302 }
5303
5304 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5305 Parcel data = Parcel.obtain();
5306 Parcel reply = Parcel.obtain();
5307 data.writeInterfaceToken(IActivityManager.descriptor);
5308 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5309 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5310 reply.readException();
5311 data.recycle();
5312 reply.recycle();
5313 }
5314
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005315 public void requestBugReport() throws RemoteException {
5316 Parcel data = Parcel.obtain();
5317 Parcel reply = Parcel.obtain();
5318 data.writeInterfaceToken(IActivityManager.descriptor);
5319 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5320 reply.readException();
5321 data.recycle();
5322 reply.recycle();
5323 }
5324
Jeff Brownbd181bb2013-09-10 16:44:24 -07005325 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5326 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005327 Parcel data = Parcel.obtain();
5328 Parcel reply = Parcel.obtain();
5329 data.writeInterfaceToken(IActivityManager.descriptor);
5330 data.writeInt(pid);
5331 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005332 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005333 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5334 reply.readException();
5335 long res = reply.readInt();
5336 data.recycle();
5337 reply.recycle();
5338 return res;
5339 }
5340
Adam Skorydfc7fd72013-08-05 19:23:41 -07005341 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005342 Parcel data = Parcel.obtain();
5343 Parcel reply = Parcel.obtain();
5344 data.writeInterfaceToken(IActivityManager.descriptor);
5345 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005346 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005347 reply.readException();
5348 Bundle res = reply.readBundle();
5349 data.recycle();
5350 reply.recycle();
5351 return res;
5352 }
5353
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005354 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5355 throws RemoteException {
5356 Parcel data = Parcel.obtain();
5357 Parcel reply = Parcel.obtain();
5358 data.writeInterfaceToken(IActivityManager.descriptor);
5359 data.writeInt(requestType);
5360 data.writeStrongBinder(receiver.asBinder());
5361 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5362 reply.readException();
5363 data.recycle();
5364 reply.recycle();
5365 }
5366
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005367 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
5368 AssistContent content) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005369 Parcel data = Parcel.obtain();
5370 Parcel reply = Parcel.obtain();
5371 data.writeInterfaceToken(IActivityManager.descriptor);
5372 data.writeStrongBinder(token);
5373 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005374 structure.writeToParcel(data, 0);
5375 content.writeToParcel(data, 0);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005376 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005377 reply.readException();
5378 data.recycle();
5379 reply.recycle();
5380 }
5381
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005382 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5383 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005384 Parcel data = Parcel.obtain();
5385 Parcel reply = Parcel.obtain();
5386 data.writeInterfaceToken(IActivityManager.descriptor);
5387 intent.writeToParcel(data, 0);
5388 data.writeInt(requestType);
5389 data.writeString(hint);
5390 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005391 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005392 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5393 reply.readException();
5394 boolean res = reply.readInt() != 0;
5395 data.recycle();
5396 reply.recycle();
5397 return res;
5398 }
5399
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005400 public void killUid(int uid, String reason) throws RemoteException {
5401 Parcel data = Parcel.obtain();
5402 Parcel reply = Parcel.obtain();
5403 data.writeInterfaceToken(IActivityManager.descriptor);
5404 data.writeInt(uid);
5405 data.writeString(reason);
5406 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5407 reply.readException();
5408 data.recycle();
5409 reply.recycle();
5410 }
5411
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005412 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5413 Parcel data = Parcel.obtain();
5414 Parcel reply = Parcel.obtain();
5415 data.writeInterfaceToken(IActivityManager.descriptor);
5416 data.writeStrongBinder(who);
5417 data.writeInt(allowRestart ? 1 : 0);
5418 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5419 reply.readException();
5420 data.recycle();
5421 reply.recycle();
5422 }
5423
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005424 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5425 Parcel data = Parcel.obtain();
5426 Parcel reply = Parcel.obtain();
5427 data.writeInterfaceToken(IActivityManager.descriptor);
5428 data.writeStrongBinder(token);
5429 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5430 reply.readException();
5431 data.recycle();
5432 reply.recycle();
5433 }
5434
Craig Mautner5eda9b32013-07-02 11:58:16 -07005435 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5436 Parcel data = Parcel.obtain();
5437 Parcel reply = Parcel.obtain();
5438 data.writeInterfaceToken(IActivityManager.descriptor);
5439 data.writeStrongBinder(token);
5440 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5441 reply.readException();
5442 data.recycle();
5443 reply.recycle();
5444 }
5445
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005446 public void restart() throws RemoteException {
5447 Parcel data = Parcel.obtain();
5448 Parcel reply = Parcel.obtain();
5449 data.writeInterfaceToken(IActivityManager.descriptor);
5450 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5451 reply.readException();
5452 data.recycle();
5453 reply.recycle();
5454 }
5455
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005456 public void performIdleMaintenance() throws RemoteException {
5457 Parcel data = Parcel.obtain();
5458 Parcel reply = Parcel.obtain();
5459 data.writeInterfaceToken(IActivityManager.descriptor);
5460 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5461 reply.readException();
5462 data.recycle();
5463 reply.recycle();
5464 }
5465
Todd Kennedyca4d8422015-01-15 15:19:22 -08005466 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005467 IActivityContainerCallback callback) throws RemoteException {
5468 Parcel data = Parcel.obtain();
5469 Parcel reply = Parcel.obtain();
5470 data.writeInterfaceToken(IActivityManager.descriptor);
5471 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005472 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005473 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005474 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005475 final int result = reply.readInt();
5476 final IActivityContainer res;
5477 if (result == 1) {
5478 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5479 } else {
5480 res = null;
5481 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005482 data.recycle();
5483 reply.recycle();
5484 return res;
5485 }
5486
Craig Mautner95da1082014-02-24 17:54:35 -08005487 public void deleteActivityContainer(IActivityContainer activityContainer)
5488 throws RemoteException {
5489 Parcel data = Parcel.obtain();
5490 Parcel reply = Parcel.obtain();
5491 data.writeInterfaceToken(IActivityManager.descriptor);
5492 data.writeStrongBinder(activityContainer.asBinder());
5493 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5494 reply.readException();
5495 data.recycle();
5496 reply.recycle();
5497 }
5498
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005499 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005500 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5501 Parcel data = Parcel.obtain();
5502 Parcel reply = Parcel.obtain();
5503 data.writeInterfaceToken(IActivityManager.descriptor);
5504 data.writeInt(displayId);
5505 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5506 reply.readException();
5507 final int result = reply.readInt();
5508 final IActivityContainer res;
5509 if (result == 1) {
5510 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5511 } else {
5512 res = null;
5513 }
5514 data.recycle();
5515 reply.recycle();
5516 return res;
5517 }
5518
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005519 @Override
5520 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005521 throws RemoteException {
5522 Parcel data = Parcel.obtain();
5523 Parcel reply = Parcel.obtain();
5524 data.writeInterfaceToken(IActivityManager.descriptor);
5525 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005526 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005527 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005528 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005529 data.recycle();
5530 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005531 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005532 }
5533
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005534 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005535 public void startLockTaskMode(int taskId) throws RemoteException {
5536 Parcel data = Parcel.obtain();
5537 Parcel reply = Parcel.obtain();
5538 data.writeInterfaceToken(IActivityManager.descriptor);
5539 data.writeInt(taskId);
5540 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5541 reply.readException();
5542 data.recycle();
5543 reply.recycle();
5544 }
5545
5546 @Override
5547 public void startLockTaskMode(IBinder token) throws RemoteException {
5548 Parcel data = Parcel.obtain();
5549 Parcel reply = Parcel.obtain();
5550 data.writeInterfaceToken(IActivityManager.descriptor);
5551 data.writeStrongBinder(token);
5552 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5553 reply.readException();
5554 data.recycle();
5555 reply.recycle();
5556 }
5557
5558 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005559 public void startLockTaskModeOnCurrent() throws RemoteException {
5560 Parcel data = Parcel.obtain();
5561 Parcel reply = Parcel.obtain();
5562 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005563 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005564 reply.readException();
5565 data.recycle();
5566 reply.recycle();
5567 }
5568
5569 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005570 public void stopLockTaskMode() throws RemoteException {
5571 Parcel data = Parcel.obtain();
5572 Parcel reply = Parcel.obtain();
5573 data.writeInterfaceToken(IActivityManager.descriptor);
5574 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5575 reply.readException();
5576 data.recycle();
5577 reply.recycle();
5578 }
5579
5580 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005581 public void stopLockTaskModeOnCurrent() throws RemoteException {
5582 Parcel data = Parcel.obtain();
5583 Parcel reply = Parcel.obtain();
5584 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005585 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005586 reply.readException();
5587 data.recycle();
5588 reply.recycle();
5589 }
5590
5591 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005592 public boolean isInLockTaskMode() throws RemoteException {
5593 Parcel data = Parcel.obtain();
5594 Parcel reply = Parcel.obtain();
5595 data.writeInterfaceToken(IActivityManager.descriptor);
5596 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5597 reply.readException();
5598 boolean isInLockTaskMode = reply.readInt() == 1;
5599 data.recycle();
5600 reply.recycle();
5601 return isInLockTaskMode;
5602 }
5603
Craig Mautner688b5102014-03-27 16:55:03 -07005604 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005605 public int getLockTaskModeState() throws RemoteException {
5606 Parcel data = Parcel.obtain();
5607 Parcel reply = Parcel.obtain();
5608 data.writeInterfaceToken(IActivityManager.descriptor);
5609 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5610 reply.readException();
5611 int lockTaskModeState = reply.readInt();
5612 data.recycle();
5613 reply.recycle();
5614 return lockTaskModeState;
5615 }
5616
5617 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005618 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5619 Parcel data = Parcel.obtain();
5620 Parcel reply = Parcel.obtain();
5621 data.writeInterfaceToken(IActivityManager.descriptor);
5622 data.writeStrongBinder(token);
5623 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5624 IBinder.FLAG_ONEWAY);
5625 reply.readException();
5626 data.recycle();
5627 reply.recycle();
5628 }
5629
5630 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005631 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005632 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005633 Parcel data = Parcel.obtain();
5634 Parcel reply = Parcel.obtain();
5635 data.writeInterfaceToken(IActivityManager.descriptor);
5636 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005637 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005638 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005639 reply.readException();
5640 data.recycle();
5641 reply.recycle();
5642 }
5643
Craig Mautneree2e45a2014-06-27 12:10:03 -07005644 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005645 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5646 Parcel data = Parcel.obtain();
5647 Parcel reply = Parcel.obtain();
5648 data.writeInterfaceToken(IActivityManager.descriptor);
5649 data.writeInt(taskId);
5650 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005651 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005652 reply.readException();
5653 data.recycle();
5654 reply.recycle();
5655 }
5656
5657 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005658 public void resizeTask(int taskId, Rect r) throws RemoteException
5659 {
5660 Parcel data = Parcel.obtain();
5661 Parcel reply = Parcel.obtain();
5662 data.writeInterfaceToken(IActivityManager.descriptor);
5663 data.writeInt(taskId);
5664 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005665 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005666 reply.readException();
5667 data.recycle();
5668 reply.recycle();
5669 }
5670
5671 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005672 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5673 Parcel data = Parcel.obtain();
5674 Parcel reply = Parcel.obtain();
5675 data.writeInterfaceToken(IActivityManager.descriptor);
5676 data.writeString(filename);
5677 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5678 reply.readException();
5679 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5680 data.recycle();
5681 reply.recycle();
5682 return icon;
5683 }
5684
5685 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005686 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5687 throws RemoteException {
5688 Parcel data = Parcel.obtain();
5689 Parcel reply = Parcel.obtain();
5690 data.writeInterfaceToken(IActivityManager.descriptor);
5691 if (options == null) {
5692 data.writeInt(0);
5693 } else {
5694 data.writeInt(1);
5695 data.writeBundle(options.toBundle());
5696 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005697 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005698 reply.readException();
5699 data.recycle();
5700 reply.recycle();
5701 }
5702
5703 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005704 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005705 Parcel data = Parcel.obtain();
5706 Parcel reply = Parcel.obtain();
5707 data.writeInterfaceToken(IActivityManager.descriptor);
5708 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005709 data.writeInt(visible ? 1 : 0);
5710 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005711 reply.readException();
5712 boolean success = reply.readInt() > 0;
5713 data.recycle();
5714 reply.recycle();
5715 return success;
5716 }
5717
5718 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005719 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005720 Parcel data = Parcel.obtain();
5721 Parcel reply = Parcel.obtain();
5722 data.writeInterfaceToken(IActivityManager.descriptor);
5723 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005724 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005725 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005726 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005727 data.recycle();
5728 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005729 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005730 }
5731
5732 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005733 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005734 Parcel data = Parcel.obtain();
5735 Parcel reply = Parcel.obtain();
5736 data.writeInterfaceToken(IActivityManager.descriptor);
5737 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005738 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005739 reply.readException();
5740 data.recycle();
5741 reply.recycle();
5742 }
5743
5744 @Override
5745 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5746 Parcel data = Parcel.obtain();
5747 Parcel reply = Parcel.obtain();
5748 data.writeInterfaceToken(IActivityManager.descriptor);
5749 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005750 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005751 reply.readException();
5752 data.recycle();
5753 reply.recycle();
5754 }
5755
Craig Mautner8746a472014-07-24 15:12:54 -07005756 @Override
5757 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5758 Parcel data = Parcel.obtain();
5759 Parcel reply = Parcel.obtain();
5760 data.writeInterfaceToken(IActivityManager.descriptor);
5761 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005762 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005763 reply.readException();
5764 data.recycle();
5765 reply.recycle();
5766 }
5767
Craig Mautner6e2f3952014-09-09 14:26:41 -07005768 @Override
5769 public void bootAnimationComplete() throws RemoteException {
5770 Parcel data = Parcel.obtain();
5771 Parcel reply = Parcel.obtain();
5772 data.writeInterfaceToken(IActivityManager.descriptor);
5773 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5774 reply.readException();
5775 data.recycle();
5776 reply.recycle();
5777 }
5778
Wale Ogunwale18795a22014-12-03 11:38:33 -08005779 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005780 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5781 Parcel data = Parcel.obtain();
5782 Parcel reply = Parcel.obtain();
5783 data.writeInterfaceToken(IActivityManager.descriptor);
5784 data.writeInt(uid);
5785 data.writeByteArray(firstPacket);
5786 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5787 reply.readException();
5788 data.recycle();
5789 reply.recycle();
5790 }
5791
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005792 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005793 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5794 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005795 Parcel data = Parcel.obtain();
5796 Parcel reply = Parcel.obtain();
5797 data.writeInterfaceToken(IActivityManager.descriptor);
5798 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005799 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005800 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005801 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005802 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5803 reply.readException();
5804 data.recycle();
5805 reply.recycle();
5806 }
5807
5808 @Override
5809 public void dumpHeapFinished(String path) throws RemoteException {
5810 Parcel data = Parcel.obtain();
5811 Parcel reply = Parcel.obtain();
5812 data.writeInterfaceToken(IActivityManager.descriptor);
5813 data.writeString(path);
5814 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5815 reply.readException();
5816 data.recycle();
5817 reply.recycle();
5818 }
5819
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005820 @Override
5821 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5822 throws RemoteException {
5823 Parcel data = Parcel.obtain();
5824 Parcel reply = Parcel.obtain();
5825 data.writeInterfaceToken(IActivityManager.descriptor);
5826 data.writeStrongBinder(session.asBinder());
5827 data.writeInt(keepAwake ? 1 : 0);
5828 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5829 reply.readException();
5830 data.recycle();
5831 reply.recycle();
5832 }
5833
Craig Mautnere5600772015-04-03 21:36:37 -07005834 @Override
5835 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5836 Parcel data = Parcel.obtain();
5837 Parcel reply = Parcel.obtain();
5838 data.writeInterfaceToken(IActivityManager.descriptor);
5839 data.writeInt(userId);
5840 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005841 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005842 reply.readException();
5843 data.recycle();
5844 reply.recycle();
5845 }
5846
Dianne Hackborn1e383822015-04-10 14:02:33 -07005847 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07005848 public void updateDeviceOwner(String packageName) throws RemoteException {
5849 Parcel data = Parcel.obtain();
5850 Parcel reply = Parcel.obtain();
5851 data.writeInterfaceToken(IActivityManager.descriptor);
5852 data.writeString(packageName);
5853 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
5854 reply.readException();
5855 data.recycle();
5856 reply.recycle();
5857 }
5858
5859 @Override
Julia Reynolds13c58ba2015-04-20 16:42:54 -04005860 public void updatePreferredSetupActivity(ComponentName preferredActivity, int userId)
5861 throws RemoteException {
5862 Parcel data = Parcel.obtain();
5863 Parcel reply = Parcel.obtain();
5864 data.writeInterfaceToken(IActivityManager.descriptor);
5865 ComponentName.writeToParcel(preferredActivity, data);
5866 data.writeInt(userId);
5867 mRemote.transact(UPDATE_PREFERRED_SETUP_ACTIVITY_TRANSACTION, data, reply, 0);
5868 reply.readException();
5869 data.recycle();
5870 reply.recycle();
5871 }
5872
5873 @Override
Dianne Hackborn1e383822015-04-10 14:02:33 -07005874 public int getPackageProcessState(String packageName) throws RemoteException {
5875 Parcel data = Parcel.obtain();
5876 Parcel reply = Parcel.obtain();
5877 data.writeInterfaceToken(IActivityManager.descriptor);
5878 data.writeString(packageName);
5879 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5880 reply.readException();
5881 int res = reply.readInt();
5882 data.recycle();
5883 reply.recycle();
5884 return res;
5885 }
5886
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005887 private IBinder mRemote;
5888}