blob: 256d87dbf61d121f4000acb51e1e0b6b86f8b44e [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;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070033import android.graphics.Bitmap;
34import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080035import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.net.Uri;
37import android.os.Binder;
38import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070039import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.IBinder;
41import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070042import android.os.ParcelFileDescriptor;
43import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070044import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070045import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070047import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070048import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080051import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070052import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080053import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055import java.util.ArrayList;
56import java.util.List;
57
58/** {@hide} */
59public abstract class ActivityManagerNative extends Binder implements IActivityManager
60{
61 /**
62 * Cast a Binder object into an activity manager interface, generating
63 * a proxy if needed.
64 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 if (obj == null) {
67 return null;
68 }
69 IActivityManager in =
70 (IActivityManager)obj.queryLocalInterface(descriptor);
71 if (in != null) {
72 return in;
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 return new ActivityManagerProxy(obj);
76 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 /**
79 * Retrieve the system's default/global activity manager.
80 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080081 static public IActivityManager getDefault() {
82 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 }
84
85 /**
86 * Convenience for checking whether the system is ready. For internal use only.
87 */
88 static public boolean isSystemReady() {
89 if (!sSystemReady) {
90 sSystemReady = getDefault().testIsSystemReady();
91 }
92 return sSystemReady;
93 }
94 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080095
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 /**
97 * Convenience for sending a sticky broadcast. For internal use only.
98 * If you don't care about permission, use null.
99 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -0700100 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 try {
102 getDefault().broadcastIntent(
103 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800104 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 } catch (RemoteException ex) {
106 }
107 }
108
Dianne Hackborn1e383822015-04-10 14:02:33 -0700109 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
110 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111 try {
Dianne Hackborn1e383822015-04-10 14:02:33 -0700112 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg, tag);
113 } catch (RemoteException ex) {
114 }
115 }
116
117 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
118 try {
119 getDefault().noteAlarmStart(ps.getTarget(), sourceUid, tag);
120 } catch (RemoteException ex) {
121 }
122 }
123
124 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
125 try {
126 getDefault().noteAlarmFinish(ps.getTarget(), sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 } catch (RemoteException ex) {
128 }
129 }
130
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800131 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 attachInterface(this, descriptor);
133 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700134
135 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
137 throws RemoteException {
138 switch (code) {
139 case START_ACTIVITY_TRANSACTION:
140 {
141 data.enforceInterface(IActivityManager.descriptor);
142 IBinder b = data.readStrongBinder();
143 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800144 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800145 Intent intent = Intent.CREATOR.createFromParcel(data);
146 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800147 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800148 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700150 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700151 ProfilerInfo profilerInfo = data.readInt() != 0
152 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700153 Bundle options = data.readInt() != 0
154 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800155 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700156 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 reply.writeNoException();
158 reply.writeInt(result);
159 return true;
160 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700161
Amith Yamasani82644082012-08-03 13:09:11 -0700162 case START_ACTIVITY_AS_USER_TRANSACTION:
163 {
164 data.enforceInterface(IActivityManager.descriptor);
165 IBinder b = data.readStrongBinder();
166 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800167 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700168 Intent intent = Intent.CREATOR.createFromParcel(data);
169 String resolvedType = data.readString();
170 IBinder resultTo = data.readStrongBinder();
171 String resultWho = data.readString();
172 int requestCode = data.readInt();
173 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700174 ProfilerInfo profilerInfo = data.readInt() != 0
175 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700176 Bundle options = data.readInt() != 0
177 ? Bundle.CREATOR.createFromParcel(data) : null;
178 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800179 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700180 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700181 reply.writeNoException();
182 reply.writeInt(result);
183 return true;
184 }
185
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700186 case START_ACTIVITY_AS_CALLER_TRANSACTION:
187 {
188 data.enforceInterface(IActivityManager.descriptor);
189 IBinder b = data.readStrongBinder();
190 IApplicationThread app = ApplicationThreadNative.asInterface(b);
191 String callingPackage = data.readString();
192 Intent intent = Intent.CREATOR.createFromParcel(data);
193 String resolvedType = data.readString();
194 IBinder resultTo = data.readStrongBinder();
195 String resultWho = data.readString();
196 int requestCode = data.readInt();
197 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700198 ProfilerInfo profilerInfo = data.readInt() != 0
199 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700200 Bundle options = data.readInt() != 0
201 ? Bundle.CREATOR.createFromParcel(data) : null;
Jeff Sharkey97978802014-10-14 10:48:18 -0700202 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700203 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Sharkey97978802014-10-14 10:48:18 -0700204 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700205 reply.writeNoException();
206 reply.writeInt(result);
207 return true;
208 }
209
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800210 case START_ACTIVITY_AND_WAIT_TRANSACTION:
211 {
212 data.enforceInterface(IActivityManager.descriptor);
213 IBinder b = data.readStrongBinder();
214 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800215 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800216 Intent intent = Intent.CREATOR.createFromParcel(data);
217 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800218 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800219 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700221 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700222 ProfilerInfo profilerInfo = data.readInt() != 0
223 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700224 Bundle options = data.readInt() != 0
225 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700226 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800227 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700228 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800229 reply.writeNoException();
230 result.writeToParcel(reply, 0);
231 return true;
232 }
233
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700234 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
235 {
236 data.enforceInterface(IActivityManager.descriptor);
237 IBinder b = data.readStrongBinder();
238 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800239 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700240 Intent intent = Intent.CREATOR.createFromParcel(data);
241 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700242 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700243 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700244 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700245 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700246 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700247 Bundle options = data.readInt() != 0
248 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700249 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800250 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700251 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 reply.writeNoException();
253 reply.writeInt(result);
254 return true;
255 }
256
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700257 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700258 {
259 data.enforceInterface(IActivityManager.descriptor);
260 IBinder b = data.readStrongBinder();
261 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700262 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700263 Intent fillInIntent = null;
264 if (data.readInt() != 0) {
265 fillInIntent = Intent.CREATOR.createFromParcel(data);
266 }
267 String resolvedType = data.readString();
268 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700269 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700270 int requestCode = data.readInt();
271 int flagsMask = data.readInt();
272 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700273 Bundle options = data.readInt() != 0
274 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700275 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700276 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700277 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700278 reply.writeNoException();
279 reply.writeInt(result);
280 return true;
281 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700282
Dianne Hackborn91097de2014-04-04 18:02:06 -0700283 case START_VOICE_ACTIVITY_TRANSACTION:
284 {
285 data.enforceInterface(IActivityManager.descriptor);
286 String callingPackage = data.readString();
287 int callingPid = data.readInt();
288 int callingUid = data.readInt();
289 Intent intent = Intent.CREATOR.createFromParcel(data);
290 String resolvedType = data.readString();
291 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
292 data.readStrongBinder());
293 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
294 data.readStrongBinder());
295 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700296 ProfilerInfo profilerInfo = data.readInt() != 0
297 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700298 Bundle options = data.readInt() != 0
299 ? Bundle.CREATOR.createFromParcel(data) : null;
300 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700301 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
302 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700303 reply.writeNoException();
304 reply.writeInt(result);
305 return true;
306 }
307
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
309 {
310 data.enforceInterface(IActivityManager.descriptor);
311 IBinder callingActivity = data.readStrongBinder();
312 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700313 Bundle options = data.readInt() != 0
314 ? Bundle.CREATOR.createFromParcel(data) : null;
315 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 reply.writeNoException();
317 reply.writeInt(result ? 1 : 0);
318 return true;
319 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700320
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700321 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
322 {
323 data.enforceInterface(IActivityManager.descriptor);
324 int taskId = data.readInt();
325 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
326 int result = startActivityFromRecents(taskId, options);
327 reply.writeNoException();
328 reply.writeInt(result);
329 return true;
330 }
331
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800332 case FINISH_ACTIVITY_TRANSACTION: {
333 data.enforceInterface(IActivityManager.descriptor);
334 IBinder token = data.readStrongBinder();
335 Intent resultData = null;
336 int resultCode = data.readInt();
337 if (data.readInt() != 0) {
338 resultData = Intent.CREATOR.createFromParcel(data);
339 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700340 boolean finishTask = (data.readInt() != 0);
341 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800342 reply.writeNoException();
343 reply.writeInt(res ? 1 : 0);
344 return true;
345 }
346
347 case FINISH_SUB_ACTIVITY_TRANSACTION: {
348 data.enforceInterface(IActivityManager.descriptor);
349 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700350 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 int requestCode = data.readInt();
352 finishSubActivity(token, resultWho, requestCode);
353 reply.writeNoException();
354 return true;
355 }
356
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700357 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
358 data.enforceInterface(IActivityManager.descriptor);
359 IBinder token = data.readStrongBinder();
360 boolean res = finishActivityAffinity(token);
361 reply.writeNoException();
362 reply.writeInt(res ? 1 : 0);
363 return true;
364 }
365
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700366 case FINISH_VOICE_TASK_TRANSACTION: {
367 data.enforceInterface(IActivityManager.descriptor);
368 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
369 data.readStrongBinder());
370 finishVoiceTask(session);
371 reply.writeNoException();
372 return true;
373 }
374
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700375 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
376 data.enforceInterface(IActivityManager.descriptor);
377 IBinder token = data.readStrongBinder();
378 boolean res = releaseActivityInstance(token);
379 reply.writeNoException();
380 reply.writeInt(res ? 1 : 0);
381 return true;
382 }
383
384 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
385 data.enforceInterface(IActivityManager.descriptor);
386 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
387 releaseSomeActivities(app);
388 reply.writeNoException();
389 return true;
390 }
391
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800392 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
393 data.enforceInterface(IActivityManager.descriptor);
394 IBinder token = data.readStrongBinder();
395 boolean res = willActivityBeVisible(token);
396 reply.writeNoException();
397 reply.writeInt(res ? 1 : 0);
398 return true;
399 }
400
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800401 case REGISTER_RECEIVER_TRANSACTION:
402 {
403 data.enforceInterface(IActivityManager.descriptor);
404 IBinder b = data.readStrongBinder();
405 IApplicationThread app =
406 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700407 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800408 b = data.readStrongBinder();
409 IIntentReceiver rec
410 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
411 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
412 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700413 int userId = data.readInt();
414 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 reply.writeNoException();
416 if (intent != null) {
417 reply.writeInt(1);
418 intent.writeToParcel(reply, 0);
419 } else {
420 reply.writeInt(0);
421 }
422 return true;
423 }
424
425 case UNREGISTER_RECEIVER_TRANSACTION:
426 {
427 data.enforceInterface(IActivityManager.descriptor);
428 IBinder b = data.readStrongBinder();
429 if (b == null) {
430 return true;
431 }
432 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
433 unregisterReceiver(rec);
434 reply.writeNoException();
435 return true;
436 }
437
438 case BROADCAST_INTENT_TRANSACTION:
439 {
440 data.enforceInterface(IActivityManager.descriptor);
441 IBinder b = data.readStrongBinder();
442 IApplicationThread app =
443 b != null ? ApplicationThreadNative.asInterface(b) : null;
444 Intent intent = Intent.CREATOR.createFromParcel(data);
445 String resolvedType = data.readString();
446 b = data.readStrongBinder();
447 IIntentReceiver resultTo =
448 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
449 int resultCode = data.readInt();
450 String resultData = data.readString();
451 Bundle resultExtras = data.readBundle();
452 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800453 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800454 boolean serialized = data.readInt() != 0;
455 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700456 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800457 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800458 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700459 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800460 reply.writeNoException();
461 reply.writeInt(res);
462 return true;
463 }
464
465 case UNBROADCAST_INTENT_TRANSACTION:
466 {
467 data.enforceInterface(IActivityManager.descriptor);
468 IBinder b = data.readStrongBinder();
469 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
470 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700471 int userId = data.readInt();
472 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 reply.writeNoException();
474 return true;
475 }
476
477 case FINISH_RECEIVER_TRANSACTION: {
478 data.enforceInterface(IActivityManager.descriptor);
479 IBinder who = data.readStrongBinder();
480 int resultCode = data.readInt();
481 String resultData = data.readString();
482 Bundle resultExtras = data.readBundle();
483 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800484 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800485 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800486 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800487 }
488 reply.writeNoException();
489 return true;
490 }
491
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492 case ATTACH_APPLICATION_TRANSACTION: {
493 data.enforceInterface(IActivityManager.descriptor);
494 IApplicationThread app = ApplicationThreadNative.asInterface(
495 data.readStrongBinder());
496 if (app != null) {
497 attachApplication(app);
498 }
499 reply.writeNoException();
500 return true;
501 }
502
503 case ACTIVITY_IDLE_TRANSACTION: {
504 data.enforceInterface(IActivityManager.descriptor);
505 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700506 Configuration config = null;
507 if (data.readInt() != 0) {
508 config = Configuration.CREATOR.createFromParcel(data);
509 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700510 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700512 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 }
514 reply.writeNoException();
515 return true;
516 }
517
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700518 case ACTIVITY_RESUMED_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 IBinder token = data.readStrongBinder();
521 activityResumed(token);
522 reply.writeNoException();
523 return true;
524 }
525
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 case ACTIVITY_PAUSED_TRANSACTION: {
527 data.enforceInterface(IActivityManager.descriptor);
528 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700529 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 reply.writeNoException();
531 return true;
532 }
533
534 case ACTIVITY_STOPPED_TRANSACTION: {
535 data.enforceInterface(IActivityManager.descriptor);
536 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800537 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700538 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700540 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800541 reply.writeNoException();
542 return true;
543 }
544
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800545 case ACTIVITY_SLEPT_TRANSACTION: {
546 data.enforceInterface(IActivityManager.descriptor);
547 IBinder token = data.readStrongBinder();
548 activitySlept(token);
549 reply.writeNoException();
550 return true;
551 }
552
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 case ACTIVITY_DESTROYED_TRANSACTION: {
554 data.enforceInterface(IActivityManager.descriptor);
555 IBinder token = data.readStrongBinder();
556 activityDestroyed(token);
557 reply.writeNoException();
558 return true;
559 }
560
561 case GET_CALLING_PACKAGE_TRANSACTION: {
562 data.enforceInterface(IActivityManager.descriptor);
563 IBinder token = data.readStrongBinder();
564 String res = token != null ? getCallingPackage(token) : null;
565 reply.writeNoException();
566 reply.writeString(res);
567 return true;
568 }
569
570 case GET_CALLING_ACTIVITY_TRANSACTION: {
571 data.enforceInterface(IActivityManager.descriptor);
572 IBinder token = data.readStrongBinder();
573 ComponentName cn = getCallingActivity(token);
574 reply.writeNoException();
575 ComponentName.writeToParcel(cn, reply);
576 return true;
577 }
578
Winson Chung1147c402014-05-14 11:05:00 -0700579 case GET_APP_TASKS_TRANSACTION: {
580 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700581 String callingPackage = data.readString();
582 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700583 reply.writeNoException();
584 int N = list != null ? list.size() : -1;
585 reply.writeInt(N);
586 int i;
587 for (i=0; i<N; i++) {
588 IAppTask task = list.get(i);
589 reply.writeStrongBinder(task.asBinder());
590 }
591 return true;
592 }
593
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700594 case ADD_APP_TASK_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder activityToken = data.readStrongBinder();
597 Intent intent = Intent.CREATOR.createFromParcel(data);
598 ActivityManager.TaskDescription descr
599 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
600 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
601 int res = addAppTask(activityToken, intent, descr, thumbnail);
602 reply.writeNoException();
603 reply.writeInt(res);
604 return true;
605 }
606
607 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 Point size = getAppTaskThumbnailSize();
610 reply.writeNoException();
611 size.writeToParcel(reply, 0);
612 return true;
613 }
614
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800615 case GET_TASKS_TRANSACTION: {
616 data.enforceInterface(IActivityManager.descriptor);
617 int maxNum = data.readInt();
618 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700619 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 reply.writeNoException();
621 int N = list != null ? list.size() : -1;
622 reply.writeInt(N);
623 int i;
624 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700625 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800626 info.writeToParcel(reply, 0);
627 }
628 return true;
629 }
630
631 case GET_RECENT_TASKS_TRANSACTION: {
632 data.enforceInterface(IActivityManager.descriptor);
633 int maxNum = data.readInt();
634 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700635 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700637 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 reply.writeNoException();
639 reply.writeTypedList(list);
640 return true;
641 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700642
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700643 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800644 data.enforceInterface(IActivityManager.descriptor);
645 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700646 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800647 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700648 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800649 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700650 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700651 } else {
652 reply.writeInt(0);
653 }
654 return true;
655 }
656
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800657 case GET_SERVICES_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 int maxNum = data.readInt();
660 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700661 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800662 reply.writeNoException();
663 int N = list != null ? list.size() : -1;
664 reply.writeInt(N);
665 int i;
666 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700667 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 info.writeToParcel(reply, 0);
669 }
670 return true;
671 }
672
673 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
676 reply.writeNoException();
677 reply.writeTypedList(list);
678 return true;
679 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700680
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
682 data.enforceInterface(IActivityManager.descriptor);
683 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
684 reply.writeNoException();
685 reply.writeTypedList(list);
686 return true;
687 }
688
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700689 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
690 data.enforceInterface(IActivityManager.descriptor);
691 List<ApplicationInfo> list = getRunningExternalApplications();
692 reply.writeNoException();
693 reply.writeTypedList(list);
694 return true;
695 }
696
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 case MOVE_TASK_TO_FRONT_TRANSACTION: {
698 data.enforceInterface(IActivityManager.descriptor);
699 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800700 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700701 Bundle options = data.readInt() != 0
702 ? Bundle.CREATOR.createFromParcel(data) : null;
703 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 reply.writeNoException();
705 return true;
706 }
707
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800708 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
709 data.enforceInterface(IActivityManager.descriptor);
710 IBinder token = data.readStrongBinder();
711 boolean nonRoot = data.readInt() != 0;
712 boolean res = moveActivityTaskToBack(token, nonRoot);
713 reply.writeNoException();
714 reply.writeInt(res ? 1 : 0);
715 return true;
716 }
717
718 case MOVE_TASK_BACKWARDS_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 int task = data.readInt();
721 moveTaskBackwards(task);
722 reply.writeNoException();
723 return true;
724 }
725
Craig Mautnerc00204b2013-03-05 15:02:14 -0800726 case MOVE_TASK_TO_STACK_TRANSACTION: {
727 data.enforceInterface(IActivityManager.descriptor);
728 int taskId = data.readInt();
729 int stackId = data.readInt();
730 boolean toTop = data.readInt() != 0;
731 moveTaskToStack(taskId, stackId, toTop);
732 reply.writeNoException();
733 return true;
734 }
735
736 case RESIZE_STACK_TRANSACTION: {
737 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800738 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800739 Rect r = Rect.CREATOR.createFromParcel(data);
740 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800741 reply.writeNoException();
742 return true;
743 }
744
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800745 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700746 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800747 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700748 reply.writeNoException();
749 reply.writeTypedList(list);
750 return true;
751 }
752
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800753 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700754 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800755 int stackId = data.readInt();
756 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700757 reply.writeNoException();
758 if (info != null) {
759 reply.writeInt(1);
760 info.writeToParcel(reply, 0);
761 } else {
762 reply.writeInt(0);
763 }
764 return true;
765 }
766
Winson Chung303e1ff2014-03-07 15:06:19 -0800767 case IS_IN_HOME_STACK_TRANSACTION: {
768 data.enforceInterface(IActivityManager.descriptor);
769 int taskId = data.readInt();
770 boolean isInHomeStack = isInHomeStack(taskId);
771 reply.writeNoException();
772 reply.writeInt(isInHomeStack ? 1 : 0);
773 return true;
774 }
775
Craig Mautnercf910b02013-04-23 11:23:27 -0700776 case SET_FOCUSED_STACK_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 int stackId = data.readInt();
779 setFocusedStack(stackId);
780 reply.writeNoException();
781 return true;
782 }
783
Winson Chungd16c5652015-01-26 16:11:07 -0800784 case GET_FOCUSED_STACK_ID_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 int focusedStackId = getFocusedStackId();
787 reply.writeNoException();
788 reply.writeInt(focusedStackId);
789 return true;
790 }
791
Winson Chung740c3ac2014-11-12 16:14:38 -0800792 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
793 data.enforceInterface(IActivityManager.descriptor);
794 IBinder token = data.readStrongBinder();
795 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
796 reply.writeNoException();
797 return true;
798 }
799
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800800 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
801 data.enforceInterface(IActivityManager.descriptor);
802 IBinder token = data.readStrongBinder();
803 boolean onlyRoot = data.readInt() != 0;
804 int res = token != null
805 ? getTaskForActivity(token, onlyRoot) : -1;
806 reply.writeNoException();
807 reply.writeInt(res);
808 return true;
809 }
810
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 case GET_CONTENT_PROVIDER_TRANSACTION: {
812 data.enforceInterface(IActivityManager.descriptor);
813 IBinder b = data.readStrongBinder();
814 IApplicationThread app = ApplicationThreadNative.asInterface(b);
815 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700816 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700817 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700818 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 reply.writeNoException();
820 if (cph != null) {
821 reply.writeInt(1);
822 cph.writeToParcel(reply, 0);
823 } else {
824 reply.writeInt(0);
825 }
826 return true;
827 }
828
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800829 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
830 data.enforceInterface(IActivityManager.descriptor);
831 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700832 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800833 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700834 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800835 reply.writeNoException();
836 if (cph != null) {
837 reply.writeInt(1);
838 cph.writeToParcel(reply, 0);
839 } else {
840 reply.writeInt(0);
841 }
842 return true;
843 }
844
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800845 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
846 data.enforceInterface(IActivityManager.descriptor);
847 IBinder b = data.readStrongBinder();
848 IApplicationThread app = ApplicationThreadNative.asInterface(b);
849 ArrayList<ContentProviderHolder> providers =
850 data.createTypedArrayList(ContentProviderHolder.CREATOR);
851 publishContentProviders(app, providers);
852 reply.writeNoException();
853 return true;
854 }
855
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700856 case REF_CONTENT_PROVIDER_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 IBinder b = data.readStrongBinder();
859 int stable = data.readInt();
860 int unstable = data.readInt();
861 boolean res = refContentProvider(b, stable, unstable);
862 reply.writeNoException();
863 reply.writeInt(res ? 1 : 0);
864 return true;
865 }
866
867 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 IBinder b = data.readStrongBinder();
870 unstableProviderDied(b);
871 reply.writeNoException();
872 return true;
873 }
874
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700875 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 IBinder b = data.readStrongBinder();
878 appNotRespondingViaProvider(b);
879 reply.writeNoException();
880 return true;
881 }
882
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800883 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700886 boolean stable = data.readInt() != 0;
887 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800888 reply.writeNoException();
889 return true;
890 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800891
892 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
893 data.enforceInterface(IActivityManager.descriptor);
894 String name = data.readString();
895 IBinder token = data.readStrongBinder();
896 removeContentProviderExternal(name, token);
897 reply.writeNoException();
898 return true;
899 }
900
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700901 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
902 data.enforceInterface(IActivityManager.descriptor);
903 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
904 PendingIntent pi = getRunningServiceControlPanel(comp);
905 reply.writeNoException();
906 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
907 return true;
908 }
909
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800910 case START_SERVICE_TRANSACTION: {
911 data.enforceInterface(IActivityManager.descriptor);
912 IBinder b = data.readStrongBinder();
913 IApplicationThread app = ApplicationThreadNative.asInterface(b);
914 Intent service = Intent.CREATOR.createFromParcel(data);
915 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700916 int userId = data.readInt();
917 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800918 reply.writeNoException();
919 ComponentName.writeToParcel(cn, reply);
920 return true;
921 }
922
923 case STOP_SERVICE_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 IBinder b = data.readStrongBinder();
926 IApplicationThread app = ApplicationThreadNative.asInterface(b);
927 Intent service = Intent.CREATOR.createFromParcel(data);
928 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700929 int userId = data.readInt();
930 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 reply.writeNoException();
932 reply.writeInt(res);
933 return true;
934 }
935
936 case STOP_SERVICE_TOKEN_TRANSACTION: {
937 data.enforceInterface(IActivityManager.descriptor);
938 ComponentName className = ComponentName.readFromParcel(data);
939 IBinder token = data.readStrongBinder();
940 int startId = data.readInt();
941 boolean res = stopServiceToken(className, token, startId);
942 reply.writeNoException();
943 reply.writeInt(res ? 1 : 0);
944 return true;
945 }
946
947 case SET_SERVICE_FOREGROUND_TRANSACTION: {
948 data.enforceInterface(IActivityManager.descriptor);
949 ComponentName className = ComponentName.readFromParcel(data);
950 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700951 int id = data.readInt();
952 Notification notification = null;
953 if (data.readInt() != 0) {
954 notification = Notification.CREATOR.createFromParcel(data);
955 }
956 boolean removeNotification = data.readInt() != 0;
957 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800958 reply.writeNoException();
959 return true;
960 }
961
962 case BIND_SERVICE_TRANSACTION: {
963 data.enforceInterface(IActivityManager.descriptor);
964 IBinder b = data.readStrongBinder();
965 IApplicationThread app = ApplicationThreadNative.asInterface(b);
966 IBinder token = data.readStrongBinder();
967 Intent service = Intent.CREATOR.createFromParcel(data);
968 String resolvedType = data.readString();
969 b = data.readStrongBinder();
970 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800971 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800972 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800973 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800974 reply.writeNoException();
975 reply.writeInt(res);
976 return true;
977 }
978
979 case UNBIND_SERVICE_TRANSACTION: {
980 data.enforceInterface(IActivityManager.descriptor);
981 IBinder b = data.readStrongBinder();
982 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
983 boolean res = unbindService(conn);
984 reply.writeNoException();
985 reply.writeInt(res ? 1 : 0);
986 return true;
987 }
988
989 case PUBLISH_SERVICE_TRANSACTION: {
990 data.enforceInterface(IActivityManager.descriptor);
991 IBinder token = data.readStrongBinder();
992 Intent intent = Intent.CREATOR.createFromParcel(data);
993 IBinder service = data.readStrongBinder();
994 publishService(token, intent, service);
995 reply.writeNoException();
996 return true;
997 }
998
999 case UNBIND_FINISHED_TRANSACTION: {
1000 data.enforceInterface(IActivityManager.descriptor);
1001 IBinder token = data.readStrongBinder();
1002 Intent intent = Intent.CREATOR.createFromParcel(data);
1003 boolean doRebind = data.readInt() != 0;
1004 unbindFinished(token, intent, doRebind);
1005 reply.writeNoException();
1006 return true;
1007 }
1008
1009 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1010 data.enforceInterface(IActivityManager.descriptor);
1011 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001012 int type = data.readInt();
1013 int startId = data.readInt();
1014 int res = data.readInt();
1015 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001016 reply.writeNoException();
1017 return true;
1018 }
1019
1020 case START_INSTRUMENTATION_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 ComponentName className = ComponentName.readFromParcel(data);
1023 String profileFile = data.readString();
1024 int fl = data.readInt();
1025 Bundle arguments = data.readBundle();
1026 IBinder b = data.readStrongBinder();
1027 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001028 b = data.readStrongBinder();
1029 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001030 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001031 String abiOverride = data.readString();
1032 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1033 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 reply.writeNoException();
1035 reply.writeInt(res ? 1 : 0);
1036 return true;
1037 }
1038
1039
1040 case FINISH_INSTRUMENTATION_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IBinder b = data.readStrongBinder();
1043 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1044 int resultCode = data.readInt();
1045 Bundle results = data.readBundle();
1046 finishInstrumentation(app, resultCode, results);
1047 reply.writeNoException();
1048 return true;
1049 }
1050
1051 case GET_CONFIGURATION_TRANSACTION: {
1052 data.enforceInterface(IActivityManager.descriptor);
1053 Configuration config = getConfiguration();
1054 reply.writeNoException();
1055 config.writeToParcel(reply, 0);
1056 return true;
1057 }
1058
1059 case UPDATE_CONFIGURATION_TRANSACTION: {
1060 data.enforceInterface(IActivityManager.descriptor);
1061 Configuration config = Configuration.CREATOR.createFromParcel(data);
1062 updateConfiguration(config);
1063 reply.writeNoException();
1064 return true;
1065 }
1066
1067 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1068 data.enforceInterface(IActivityManager.descriptor);
1069 IBinder token = data.readStrongBinder();
1070 int requestedOrientation = data.readInt();
1071 setRequestedOrientation(token, requestedOrientation);
1072 reply.writeNoException();
1073 return true;
1074 }
1075
1076 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1077 data.enforceInterface(IActivityManager.descriptor);
1078 IBinder token = data.readStrongBinder();
1079 int req = getRequestedOrientation(token);
1080 reply.writeNoException();
1081 reply.writeInt(req);
1082 return true;
1083 }
1084
1085 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1086 data.enforceInterface(IActivityManager.descriptor);
1087 IBinder token = data.readStrongBinder();
1088 ComponentName cn = getActivityClassForToken(token);
1089 reply.writeNoException();
1090 ComponentName.writeToParcel(cn, reply);
1091 return true;
1092 }
1093
1094 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1095 data.enforceInterface(IActivityManager.descriptor);
1096 IBinder token = data.readStrongBinder();
1097 reply.writeNoException();
1098 reply.writeString(getPackageForToken(token));
1099 return true;
1100 }
1101
1102 case GET_INTENT_SENDER_TRANSACTION: {
1103 data.enforceInterface(IActivityManager.descriptor);
1104 int type = data.readInt();
1105 String packageName = data.readString();
1106 IBinder token = data.readStrongBinder();
1107 String resultWho = data.readString();
1108 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001109 Intent[] requestIntents;
1110 String[] requestResolvedTypes;
1111 if (data.readInt() != 0) {
1112 requestIntents = data.createTypedArray(Intent.CREATOR);
1113 requestResolvedTypes = data.createStringArray();
1114 } else {
1115 requestIntents = null;
1116 requestResolvedTypes = null;
1117 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001118 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001119 Bundle options = data.readInt() != 0
1120 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001121 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001123 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001124 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125 reply.writeNoException();
1126 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1127 return true;
1128 }
1129
1130 case CANCEL_INTENT_SENDER_TRANSACTION: {
1131 data.enforceInterface(IActivityManager.descriptor);
1132 IIntentSender r = IIntentSender.Stub.asInterface(
1133 data.readStrongBinder());
1134 cancelIntentSender(r);
1135 reply.writeNoException();
1136 return true;
1137 }
1138
1139 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1140 data.enforceInterface(IActivityManager.descriptor);
1141 IIntentSender r = IIntentSender.Stub.asInterface(
1142 data.readStrongBinder());
1143 String res = getPackageForIntentSender(r);
1144 reply.writeNoException();
1145 reply.writeString(res);
1146 return true;
1147 }
1148
Christopher Tatec4a07d12012-04-06 14:19:13 -07001149 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1150 data.enforceInterface(IActivityManager.descriptor);
1151 IIntentSender r = IIntentSender.Stub.asInterface(
1152 data.readStrongBinder());
1153 int res = getUidForIntentSender(r);
1154 reply.writeNoException();
1155 reply.writeInt(res);
1156 return true;
1157 }
1158
Dianne Hackborn41203752012-08-31 14:05:51 -07001159 case HANDLE_INCOMING_USER_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 int callingPid = data.readInt();
1162 int callingUid = data.readInt();
1163 int userId = data.readInt();
1164 boolean allowAll = data.readInt() != 0 ;
1165 boolean requireFull = data.readInt() != 0;
1166 String name = data.readString();
1167 String callerPackage = data.readString();
1168 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1169 requireFull, name, callerPackage);
1170 reply.writeNoException();
1171 reply.writeInt(res);
1172 return true;
1173 }
1174
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175 case SET_PROCESS_LIMIT_TRANSACTION: {
1176 data.enforceInterface(IActivityManager.descriptor);
1177 int max = data.readInt();
1178 setProcessLimit(max);
1179 reply.writeNoException();
1180 return true;
1181 }
1182
1183 case GET_PROCESS_LIMIT_TRANSACTION: {
1184 data.enforceInterface(IActivityManager.descriptor);
1185 int limit = getProcessLimit();
1186 reply.writeNoException();
1187 reply.writeInt(limit);
1188 return true;
1189 }
1190
1191 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1192 data.enforceInterface(IActivityManager.descriptor);
1193 IBinder token = data.readStrongBinder();
1194 int pid = data.readInt();
1195 boolean isForeground = data.readInt() != 0;
1196 setProcessForeground(token, pid, isForeground);
1197 reply.writeNoException();
1198 return true;
1199 }
1200
1201 case CHECK_PERMISSION_TRANSACTION: {
1202 data.enforceInterface(IActivityManager.descriptor);
1203 String perm = data.readString();
1204 int pid = data.readInt();
1205 int uid = data.readInt();
1206 int res = checkPermission(perm, pid, uid);
1207 reply.writeNoException();
1208 reply.writeInt(res);
1209 return true;
1210 }
1211
Dianne Hackbornff170242014-11-19 10:59:01 -08001212 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1213 data.enforceInterface(IActivityManager.descriptor);
1214 String perm = data.readString();
1215 int pid = data.readInt();
1216 int uid = data.readInt();
1217 IBinder token = data.readStrongBinder();
1218 int res = checkPermissionWithToken(perm, pid, uid, token);
1219 reply.writeNoException();
1220 reply.writeInt(res);
1221 return true;
1222 }
1223
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 case CHECK_URI_PERMISSION_TRANSACTION: {
1225 data.enforceInterface(IActivityManager.descriptor);
1226 Uri uri = Uri.CREATOR.createFromParcel(data);
1227 int pid = data.readInt();
1228 int uid = data.readInt();
1229 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001230 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001231 IBinder callerToken = data.readStrongBinder();
1232 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001233 reply.writeNoException();
1234 reply.writeInt(res);
1235 return true;
1236 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001237
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001239 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 String packageName = data.readString();
1241 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1242 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001243 int userId = data.readInt();
1244 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 reply.writeNoException();
1246 reply.writeInt(res ? 1 : 0);
1247 return true;
1248 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001249
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001250 case GRANT_URI_PERMISSION_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 IBinder b = data.readStrongBinder();
1253 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1254 String targetPkg = data.readString();
1255 Uri uri = Uri.CREATOR.createFromParcel(data);
1256 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001257 int userId = data.readInt();
1258 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001259 reply.writeNoException();
1260 return true;
1261 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001262
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001263 case REVOKE_URI_PERMISSION_TRANSACTION: {
1264 data.enforceInterface(IActivityManager.descriptor);
1265 IBinder b = data.readStrongBinder();
1266 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1267 Uri uri = Uri.CREATOR.createFromParcel(data);
1268 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001269 int userId = data.readInt();
1270 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 reply.writeNoException();
1272 return true;
1273 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001274
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001275 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1276 data.enforceInterface(IActivityManager.descriptor);
1277 Uri uri = Uri.CREATOR.createFromParcel(data);
1278 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001279 int userId = data.readInt();
1280 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001281 reply.writeNoException();
1282 return true;
1283 }
1284
1285 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1286 data.enforceInterface(IActivityManager.descriptor);
1287 Uri uri = Uri.CREATOR.createFromParcel(data);
1288 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001289 int userId = data.readInt();
1290 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001291 reply.writeNoException();
1292 return true;
1293 }
1294
1295 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001297 final String packageName = data.readString();
1298 final boolean incoming = data.readInt() != 0;
1299 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1300 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001301 reply.writeNoException();
1302 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1303 return true;
1304 }
1305
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001306 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 IBinder b = data.readStrongBinder();
1309 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1310 boolean waiting = data.readInt() != 0;
1311 showWaitingForDebugger(app, waiting);
1312 reply.writeNoException();
1313 return true;
1314 }
1315
1316 case GET_MEMORY_INFO_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1319 getMemoryInfo(mi);
1320 reply.writeNoException();
1321 mi.writeToParcel(reply, 0);
1322 return true;
1323 }
1324
1325 case UNHANDLED_BACK_TRANSACTION: {
1326 data.enforceInterface(IActivityManager.descriptor);
1327 unhandledBack();
1328 reply.writeNoException();
1329 return true;
1330 }
1331
1332 case OPEN_CONTENT_URI_TRANSACTION: {
1333 data.enforceInterface(IActivityManager.descriptor);
1334 Uri uri = Uri.parse(data.readString());
1335 ParcelFileDescriptor pfd = openContentUri(uri);
1336 reply.writeNoException();
1337 if (pfd != null) {
1338 reply.writeInt(1);
1339 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1340 } else {
1341 reply.writeInt(0);
1342 }
1343 return true;
1344 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001345
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001346 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1347 data.enforceInterface(IActivityManager.descriptor);
1348 setLockScreenShown(data.readInt() != 0);
1349 reply.writeNoException();
1350 return true;
1351 }
1352
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001353 case SET_DEBUG_APP_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
1355 String pn = data.readString();
1356 boolean wfd = data.readInt() != 0;
1357 boolean per = data.readInt() != 0;
1358 setDebugApp(pn, wfd, per);
1359 reply.writeNoException();
1360 return true;
1361 }
1362
1363 case SET_ALWAYS_FINISH_TRANSACTION: {
1364 data.enforceInterface(IActivityManager.descriptor);
1365 boolean enabled = data.readInt() != 0;
1366 setAlwaysFinish(enabled);
1367 reply.writeNoException();
1368 return true;
1369 }
1370
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001371 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001372 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001373 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001374 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001375 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001376 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001377 return true;
1378 }
1379
1380 case ENTER_SAFE_MODE_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 enterSafeMode();
1383 reply.writeNoException();
1384 return true;
1385 }
1386
1387 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 IIntentSender is = IIntentSender.Stub.asInterface(
1390 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001391 int sourceUid = data.readInt();
1392 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001393 String tag = data.readString();
1394 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1395 reply.writeNoException();
1396 return true;
1397 }
1398
1399 case NOTE_ALARM_START_TRANSACTION: {
1400 data.enforceInterface(IActivityManager.descriptor);
1401 IIntentSender is = IIntentSender.Stub.asInterface(
1402 data.readStrongBinder());
1403 int sourceUid = data.readInt();
1404 String tag = data.readString();
1405 noteAlarmStart(is, sourceUid, tag);
1406 reply.writeNoException();
1407 return true;
1408 }
1409
1410 case NOTE_ALARM_FINISH_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 IIntentSender is = IIntentSender.Stub.asInterface(
1413 data.readStrongBinder());
1414 int sourceUid = data.readInt();
1415 String tag = data.readString();
1416 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001417 reply.writeNoException();
1418 return true;
1419 }
1420
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001421 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 data.enforceInterface(IActivityManager.descriptor);
1423 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001424 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001425 boolean secure = data.readInt() != 0;
1426 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001427 reply.writeNoException();
1428 reply.writeInt(res ? 1 : 0);
1429 return true;
1430 }
1431
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001432 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1433 data.enforceInterface(IActivityManager.descriptor);
1434 String reason = data.readString();
1435 boolean res = killProcessesBelowForeground(reason);
1436 reply.writeNoException();
1437 reply.writeInt(res ? 1 : 0);
1438 return true;
1439 }
1440
Dan Egnor60d87622009-12-16 16:32:58 -08001441 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 IBinder app = data.readStrongBinder();
1444 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1445 handleApplicationCrash(app, ci);
1446 reply.writeNoException();
1447 return true;
1448 }
1449
1450 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001451 data.enforceInterface(IActivityManager.descriptor);
1452 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001453 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001454 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001455 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001456 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001457 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001458 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001459 return true;
1460 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001461
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001462 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1463 data.enforceInterface(IActivityManager.descriptor);
1464 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001465 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001466 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1467 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001468 reply.writeNoException();
1469 return true;
1470 }
1471
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001472 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1473 data.enforceInterface(IActivityManager.descriptor);
1474 int sig = data.readInt();
1475 signalPersistentProcesses(sig);
1476 reply.writeNoException();
1477 return true;
1478 }
1479
Dianne Hackborn03abb812010-01-04 18:43:19 -08001480 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1481 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001482 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001483 int userId = data.readInt();
1484 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001485 reply.writeNoException();
1486 return true;
1487 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001488
1489 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1490 data.enforceInterface(IActivityManager.descriptor);
1491 killAllBackgroundProcesses();
1492 reply.writeNoException();
1493 return true;
1494 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001495
Dianne Hackborn03abb812010-01-04 18:43:19 -08001496 case FORCE_STOP_PACKAGE_TRANSACTION: {
1497 data.enforceInterface(IActivityManager.descriptor);
1498 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001499 int userId = data.readInt();
1500 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001501 reply.writeNoException();
1502 return true;
1503 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001504
1505 case GET_MY_MEMORY_STATE_TRANSACTION: {
1506 data.enforceInterface(IActivityManager.descriptor);
1507 ActivityManager.RunningAppProcessInfo info =
1508 new ActivityManager.RunningAppProcessInfo();
1509 getMyMemoryState(info);
1510 reply.writeNoException();
1511 info.writeToParcel(reply, 0);
1512 return true;
1513 }
1514
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001515 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1516 data.enforceInterface(IActivityManager.descriptor);
1517 ConfigurationInfo config = getDeviceConfigurationInfo();
1518 reply.writeNoException();
1519 config.writeToParcel(reply, 0);
1520 return true;
1521 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001522
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001523 case PROFILE_CONTROL_TRANSACTION: {
1524 data.enforceInterface(IActivityManager.descriptor);
1525 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001526 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001527 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001528 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001529 ProfilerInfo profilerInfo = data.readInt() != 0
1530 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1531 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001532 reply.writeNoException();
1533 reply.writeInt(res ? 1 : 0);
1534 return true;
1535 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001536
Dianne Hackborn55280a92009-05-07 15:53:46 -07001537 case SHUTDOWN_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 boolean res = shutdown(data.readInt());
1540 reply.writeNoException();
1541 reply.writeInt(res ? 1 : 0);
1542 return true;
1543 }
1544
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001545 case STOP_APP_SWITCHES_TRANSACTION: {
1546 data.enforceInterface(IActivityManager.descriptor);
1547 stopAppSwitches();
1548 reply.writeNoException();
1549 return true;
1550 }
1551
1552 case RESUME_APP_SWITCHES_TRANSACTION: {
1553 data.enforceInterface(IActivityManager.descriptor);
1554 resumeAppSwitches();
1555 reply.writeNoException();
1556 return true;
1557 }
1558
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001559 case PEEK_SERVICE_TRANSACTION: {
1560 data.enforceInterface(IActivityManager.descriptor);
1561 Intent service = Intent.CREATOR.createFromParcel(data);
1562 String resolvedType = data.readString();
1563 IBinder binder = peekService(service, resolvedType);
1564 reply.writeNoException();
1565 reply.writeStrongBinder(binder);
1566 return true;
1567 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001568
1569 case START_BACKUP_AGENT_TRANSACTION: {
1570 data.enforceInterface(IActivityManager.descriptor);
1571 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1572 int backupRestoreMode = data.readInt();
1573 boolean success = bindBackupAgent(info, backupRestoreMode);
1574 reply.writeNoException();
1575 reply.writeInt(success ? 1 : 0);
1576 return true;
1577 }
1578
1579 case BACKUP_AGENT_CREATED_TRANSACTION: {
1580 data.enforceInterface(IActivityManager.descriptor);
1581 String packageName = data.readString();
1582 IBinder agent = data.readStrongBinder();
1583 backupAgentCreated(packageName, agent);
1584 reply.writeNoException();
1585 return true;
1586 }
1587
1588 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1589 data.enforceInterface(IActivityManager.descriptor);
1590 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1591 unbindBackupAgent(info);
1592 reply.writeNoException();
1593 return true;
1594 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001595
1596 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 String packageName = data.readString();
1599 addPackageDependency(packageName);
1600 reply.writeNoException();
1601 return true;
1602 }
1603
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001604 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001605 data.enforceInterface(IActivityManager.descriptor);
1606 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001607 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001608 String reason = data.readString();
1609 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001610 reply.writeNoException();
1611 return true;
1612 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001613
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001614 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 String reason = data.readString();
1617 closeSystemDialogs(reason);
1618 reply.writeNoException();
1619 return true;
1620 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001621
1622 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1623 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001624 int[] pids = data.createIntArray();
1625 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001626 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001627 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001628 return true;
1629 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001630
1631 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1632 data.enforceInterface(IActivityManager.descriptor);
1633 String processName = data.readString();
1634 int uid = data.readInt();
1635 killApplicationProcess(processName, uid);
1636 reply.writeNoException();
1637 return true;
1638 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001639
1640 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1641 data.enforceInterface(IActivityManager.descriptor);
1642 IBinder token = data.readStrongBinder();
1643 String packageName = data.readString();
1644 int enterAnim = data.readInt();
1645 int exitAnim = data.readInt();
1646 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001647 reply.writeNoException();
1648 return true;
1649 }
1650
1651 case IS_USER_A_MONKEY_TRANSACTION: {
1652 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001653 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001654 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001655 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001656 return true;
1657 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001658
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001659 case SET_USER_IS_MONKEY_TRANSACTION: {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 final boolean monkey = (data.readInt() == 1);
1662 setUserIsMonkey(monkey);
1663 reply.writeNoException();
1664 return true;
1665 }
1666
Dianne Hackborn860755f2010-06-03 18:47:52 -07001667 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1668 data.enforceInterface(IActivityManager.descriptor);
1669 finishHeavyWeightApp();
1670 reply.writeNoException();
1671 return true;
1672 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001673
1674 case IS_IMMERSIVE_TRANSACTION: {
1675 data.enforceInterface(IActivityManager.descriptor);
1676 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001677 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001678 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001679 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001680 return true;
1681 }
1682
Craig Mautnerd61dc202014-07-07 11:09:11 -07001683 case IS_TOP_OF_TASK_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
1685 IBinder token = data.readStrongBinder();
1686 final boolean isTopOfTask = isTopOfTask(token);
1687 reply.writeNoException();
1688 reply.writeInt(isTopOfTask ? 1 : 0);
1689 return true;
1690 }
1691
Craig Mautner5eda9b32013-07-02 11:58:16 -07001692 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001693 data.enforceInterface(IActivityManager.descriptor);
1694 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001695 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001696 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001697 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001698 return true;
1699 }
1700
1701 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1702 data.enforceInterface(IActivityManager.descriptor);
1703 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001704 final Bundle bundle;
1705 if (data.readInt() == 0) {
1706 bundle = null;
1707 } else {
1708 bundle = data.readBundle();
1709 }
1710 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1711 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001712 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001713 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001714 return true;
1715 }
1716
Craig Mautner233ceee2014-05-09 17:05:11 -07001717 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1718 data.enforceInterface(IActivityManager.descriptor);
1719 IBinder token = data.readStrongBinder();
1720 final ActivityOptions options = getActivityOptions(token);
1721 reply.writeNoException();
1722 reply.writeBundle(options == null ? null : options.toBundle());
1723 return true;
1724 }
1725
Daniel Sandler69a48172010-06-23 16:29:36 -04001726 case SET_IMMERSIVE_TRANSACTION: {
1727 data.enforceInterface(IActivityManager.descriptor);
1728 IBinder token = data.readStrongBinder();
1729 boolean imm = data.readInt() == 1;
1730 setImmersive(token, imm);
1731 reply.writeNoException();
1732 return true;
1733 }
1734
1735 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001737 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001738 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001739 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001740 return true;
1741 }
1742
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001743 case CRASH_APPLICATION_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 int uid = data.readInt();
1746 int initialPid = data.readInt();
1747 String packageName = data.readString();
1748 String message = data.readString();
1749 crashApplication(uid, initialPid, packageName, message);
1750 reply.writeNoException();
1751 return true;
1752 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001753
1754 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1755 data.enforceInterface(IActivityManager.descriptor);
1756 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001757 int userId = data.readInt();
1758 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001759 reply.writeNoException();
1760 reply.writeString(type);
1761 return true;
1762 }
1763
Dianne Hackborn7e269642010-08-25 19:50:20 -07001764 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1765 data.enforceInterface(IActivityManager.descriptor);
1766 String name = data.readString();
1767 IBinder perm = newUriPermissionOwner(name);
1768 reply.writeNoException();
1769 reply.writeStrongBinder(perm);
1770 return true;
1771 }
1772
1773 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1774 data.enforceInterface(IActivityManager.descriptor);
1775 IBinder owner = data.readStrongBinder();
1776 int fromUid = data.readInt();
1777 String targetPkg = data.readString();
1778 Uri uri = Uri.CREATOR.createFromParcel(data);
1779 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001780 int sourceUserId = data.readInt();
1781 int targetUserId = data.readInt();
1782 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1783 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001784 reply.writeNoException();
1785 return true;
1786 }
1787
1788 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1789 data.enforceInterface(IActivityManager.descriptor);
1790 IBinder owner = data.readStrongBinder();
1791 Uri uri = null;
1792 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001793 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001794 }
1795 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001796 int userId = data.readInt();
1797 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001798 reply.writeNoException();
1799 return true;
1800 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001801
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001802 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1803 data.enforceInterface(IActivityManager.descriptor);
1804 int callingUid = data.readInt();
1805 String targetPkg = data.readString();
1806 Uri uri = Uri.CREATOR.createFromParcel(data);
1807 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001808 int userId = data.readInt();
1809 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001810 reply.writeNoException();
1811 reply.writeInt(res);
1812 return true;
1813 }
1814
Andy McFadden824c5102010-07-09 16:26:57 -07001815 case DUMP_HEAP_TRANSACTION: {
1816 data.enforceInterface(IActivityManager.descriptor);
1817 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001818 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001819 boolean managed = data.readInt() != 0;
1820 String path = data.readString();
1821 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001822 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001823 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001824 reply.writeNoException();
1825 reply.writeInt(res ? 1 : 0);
1826 return true;
1827 }
1828
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001829 case START_ACTIVITIES_TRANSACTION:
1830 {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 IBinder b = data.readStrongBinder();
1833 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001834 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001835 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1836 String[] resolvedTypes = data.createStringArray();
1837 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001838 Bundle options = data.readInt() != 0
1839 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001840 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001841 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001842 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001843 reply.writeNoException();
1844 reply.writeInt(result);
1845 return true;
1846 }
1847
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001848 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1849 {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 int mode = getFrontActivityScreenCompatMode();
1852 reply.writeNoException();
1853 reply.writeInt(mode);
1854 return true;
1855 }
1856
1857 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1858 {
1859 data.enforceInterface(IActivityManager.descriptor);
1860 int mode = data.readInt();
1861 setFrontActivityScreenCompatMode(mode);
1862 reply.writeNoException();
1863 reply.writeInt(mode);
1864 return true;
1865 }
1866
1867 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1868 {
1869 data.enforceInterface(IActivityManager.descriptor);
1870 String pkg = data.readString();
1871 int mode = getPackageScreenCompatMode(pkg);
1872 reply.writeNoException();
1873 reply.writeInt(mode);
1874 return true;
1875 }
1876
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001877 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1878 {
1879 data.enforceInterface(IActivityManager.descriptor);
1880 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001881 int mode = data.readInt();
1882 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001883 reply.writeNoException();
1884 return true;
1885 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001886
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001887 case SWITCH_USER_TRANSACTION: {
1888 data.enforceInterface(IActivityManager.descriptor);
1889 int userid = data.readInt();
1890 boolean result = switchUser(userid);
1891 reply.writeNoException();
1892 reply.writeInt(result ? 1 : 0);
1893 return true;
1894 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001895
Kenny Guy08488bf2014-02-21 17:40:37 +00001896 case START_USER_IN_BACKGROUND_TRANSACTION: {
1897 data.enforceInterface(IActivityManager.descriptor);
1898 int userid = data.readInt();
1899 boolean result = startUserInBackground(userid);
1900 reply.writeNoException();
1901 reply.writeInt(result ? 1 : 0);
1902 return true;
1903 }
1904
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001905 case STOP_USER_TRANSACTION: {
1906 data.enforceInterface(IActivityManager.descriptor);
1907 int userid = data.readInt();
1908 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1909 data.readStrongBinder());
1910 int result = stopUser(userid, callback);
1911 reply.writeNoException();
1912 reply.writeInt(result);
1913 return true;
1914 }
1915
Amith Yamasani52f1d752012-03-28 18:19:29 -07001916 case GET_CURRENT_USER_TRANSACTION: {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 UserInfo userInfo = getCurrentUser();
1919 reply.writeNoException();
1920 userInfo.writeToParcel(reply, 0);
1921 return true;
1922 }
1923
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001924 case IS_USER_RUNNING_TRANSACTION: {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001927 boolean orStopping = data.readInt() != 0;
1928 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001929 reply.writeNoException();
1930 reply.writeInt(result ? 1 : 0);
1931 return true;
1932 }
1933
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001934 case GET_RUNNING_USER_IDS_TRANSACTION: {
1935 data.enforceInterface(IActivityManager.descriptor);
1936 int[] result = getRunningUserIds();
1937 reply.writeNoException();
1938 reply.writeIntArray(result);
1939 return true;
1940 }
1941
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001942 case REMOVE_TASK_TRANSACTION:
1943 {
1944 data.enforceInterface(IActivityManager.descriptor);
1945 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001946 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001947 reply.writeNoException();
1948 reply.writeInt(result ? 1 : 0);
1949 return true;
1950 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001951
Jeff Sharkeya4620792011-05-20 15:29:23 -07001952 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1953 data.enforceInterface(IActivityManager.descriptor);
1954 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1955 data.readStrongBinder());
1956 registerProcessObserver(observer);
1957 return true;
1958 }
1959
1960 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1963 data.readStrongBinder());
1964 unregisterProcessObserver(observer);
1965 return true;
1966 }
1967
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001968 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1969 {
1970 data.enforceInterface(IActivityManager.descriptor);
1971 String pkg = data.readString();
1972 boolean ask = getPackageAskScreenCompat(pkg);
1973 reply.writeNoException();
1974 reply.writeInt(ask ? 1 : 0);
1975 return true;
1976 }
1977
1978 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1979 {
1980 data.enforceInterface(IActivityManager.descriptor);
1981 String pkg = data.readString();
1982 boolean ask = data.readInt() != 0;
1983 setPackageAskScreenCompat(pkg, ask);
1984 reply.writeNoException();
1985 return true;
1986 }
1987
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001988 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1989 data.enforceInterface(IActivityManager.descriptor);
1990 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001991 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001992 boolean res = isIntentSenderTargetedToPackage(r);
1993 reply.writeNoException();
1994 reply.writeInt(res ? 1 : 0);
1995 return true;
1996 }
1997
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001998 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1999 data.enforceInterface(IActivityManager.descriptor);
2000 IIntentSender r = IIntentSender.Stub.asInterface(
2001 data.readStrongBinder());
2002 boolean res = isIntentSenderAnActivity(r);
2003 reply.writeNoException();
2004 reply.writeInt(res ? 1 : 0);
2005 return true;
2006 }
2007
Dianne Hackborn81038902012-11-26 17:04:09 -08002008 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2009 data.enforceInterface(IActivityManager.descriptor);
2010 IIntentSender r = IIntentSender.Stub.asInterface(
2011 data.readStrongBinder());
2012 Intent intent = getIntentForIntentSender(r);
2013 reply.writeNoException();
2014 if (intent != null) {
2015 reply.writeInt(1);
2016 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2017 } else {
2018 reply.writeInt(0);
2019 }
2020 return true;
2021 }
2022
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002023 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2024 data.enforceInterface(IActivityManager.descriptor);
2025 IIntentSender r = IIntentSender.Stub.asInterface(
2026 data.readStrongBinder());
2027 String prefix = data.readString();
2028 String tag = getTagForIntentSender(r, prefix);
2029 reply.writeNoException();
2030 reply.writeString(tag);
2031 return true;
2032 }
2033
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002034 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2035 data.enforceInterface(IActivityManager.descriptor);
2036 Configuration config = Configuration.CREATOR.createFromParcel(data);
2037 updatePersistentConfiguration(config);
2038 reply.writeNoException();
2039 return true;
2040 }
2041
Dianne Hackbornb437e092011-08-05 17:50:29 -07002042 case GET_PROCESS_PSS_TRANSACTION: {
2043 data.enforceInterface(IActivityManager.descriptor);
2044 int[] pids = data.createIntArray();
2045 long[] pss = getProcessPss(pids);
2046 reply.writeNoException();
2047 reply.writeLongArray(pss);
2048 return true;
2049 }
2050
Dianne Hackborn661cd522011-08-22 00:26:20 -07002051 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2052 data.enforceInterface(IActivityManager.descriptor);
2053 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2054 boolean always = data.readInt() != 0;
2055 showBootMessage(msg, always);
2056 reply.writeNoException();
2057 return true;
2058 }
2059
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002060 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002061 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002062 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002063 reply.writeNoException();
2064 return true;
2065 }
2066
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002067 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002068 data.enforceInterface(IActivityManager.descriptor);
2069 IBinder token = data.readStrongBinder();
2070 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002071 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002072 reply.writeNoException();
2073 reply.writeInt(res ? 1 : 0);
2074 return true;
2075 }
2076
2077 case NAVIGATE_UP_TO_TRANSACTION: {
2078 data.enforceInterface(IActivityManager.descriptor);
2079 IBinder token = data.readStrongBinder();
2080 Intent target = Intent.CREATOR.createFromParcel(data);
2081 int resultCode = data.readInt();
2082 Intent resultData = null;
2083 if (data.readInt() != 0) {
2084 resultData = Intent.CREATOR.createFromParcel(data);
2085 }
2086 boolean res = navigateUpTo(token, target, resultCode, resultData);
2087 reply.writeNoException();
2088 reply.writeInt(res ? 1 : 0);
2089 return true;
2090 }
2091
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002092 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2093 data.enforceInterface(IActivityManager.descriptor);
2094 IBinder token = data.readStrongBinder();
2095 int res = getLaunchedFromUid(token);
2096 reply.writeNoException();
2097 reply.writeInt(res);
2098 return true;
2099 }
2100
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002101 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2102 data.enforceInterface(IActivityManager.descriptor);
2103 IBinder token = data.readStrongBinder();
2104 String res = getLaunchedFromPackage(token);
2105 reply.writeNoException();
2106 reply.writeString(res);
2107 return true;
2108 }
2109
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002110 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2111 data.enforceInterface(IActivityManager.descriptor);
2112 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2113 data.readStrongBinder());
2114 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002115 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002116 return true;
2117 }
2118
2119 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2120 data.enforceInterface(IActivityManager.descriptor);
2121 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2122 data.readStrongBinder());
2123 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002124 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002125 return true;
2126 }
2127
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002128 case REQUEST_BUG_REPORT_TRANSACTION: {
2129 data.enforceInterface(IActivityManager.descriptor);
2130 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002131 reply.writeNoException();
2132 return true;
2133 }
2134
2135 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2136 data.enforceInterface(IActivityManager.descriptor);
2137 int pid = data.readInt();
2138 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002139 String reason = data.readString();
2140 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002141 reply.writeNoException();
2142 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002143 return true;
2144 }
2145
Adam Skorydfc7fd72013-08-05 19:23:41 -07002146 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002147 data.enforceInterface(IActivityManager.descriptor);
2148 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002149 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002150 reply.writeNoException();
2151 reply.writeBundle(res);
2152 return true;
2153 }
2154
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002155 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2156 data.enforceInterface(IActivityManager.descriptor);
2157 int requestType = data.readInt();
2158 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
2159 requestAssistContextExtras(requestType, receiver);
2160 reply.writeNoException();
2161 return true;
2162 }
2163
Adam Skorydfc7fd72013-08-05 19:23:41 -07002164 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002165 data.enforceInterface(IActivityManager.descriptor);
2166 IBinder token = data.readStrongBinder();
2167 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002168 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002169 reply.writeNoException();
2170 return true;
2171 }
2172
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002173 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2174 data.enforceInterface(IActivityManager.descriptor);
2175 Intent intent = Intent.CREATOR.createFromParcel(data);
2176 int requestType = data.readInt();
2177 String hint = data.readString();
2178 int userHandle = data.readInt();
2179 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2180 reply.writeNoException();
2181 reply.writeInt(res ? 1 : 0);
2182 return true;
2183 }
2184
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002185 case KILL_UID_TRANSACTION: {
2186 data.enforceInterface(IActivityManager.descriptor);
2187 int uid = data.readInt();
2188 String reason = data.readString();
2189 killUid(uid, reason);
2190 reply.writeNoException();
2191 return true;
2192 }
2193
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002194 case HANG_TRANSACTION: {
2195 data.enforceInterface(IActivityManager.descriptor);
2196 IBinder who = data.readStrongBinder();
2197 boolean allowRestart = data.readInt() != 0;
2198 hang(who, allowRestart);
2199 reply.writeNoException();
2200 return true;
2201 }
2202
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002203 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2204 data.enforceInterface(IActivityManager.descriptor);
2205 IBinder token = data.readStrongBinder();
2206 reportActivityFullyDrawn(token);
2207 reply.writeNoException();
2208 return true;
2209 }
2210
Craig Mautner5eda9b32013-07-02 11:58:16 -07002211 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2212 data.enforceInterface(IActivityManager.descriptor);
2213 IBinder token = data.readStrongBinder();
2214 notifyActivityDrawn(token);
2215 reply.writeNoException();
2216 return true;
2217 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002218
2219 case RESTART_TRANSACTION: {
2220 data.enforceInterface(IActivityManager.descriptor);
2221 restart();
2222 reply.writeNoException();
2223 return true;
2224 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002225
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002226 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2227 data.enforceInterface(IActivityManager.descriptor);
2228 performIdleMaintenance();
2229 reply.writeNoException();
2230 return true;
2231 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002232
Todd Kennedyca4d8422015-01-15 15:19:22 -08002233 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002234 data.enforceInterface(IActivityManager.descriptor);
2235 IBinder parentActivityToken = data.readStrongBinder();
2236 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002237 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002238 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002239 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002240 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002241 if (activityContainer != null) {
2242 reply.writeInt(1);
2243 reply.writeStrongBinder(activityContainer.asBinder());
2244 } else {
2245 reply.writeInt(0);
2246 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002247 return true;
2248 }
2249
Craig Mautner95da1082014-02-24 17:54:35 -08002250 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2251 data.enforceInterface(IActivityManager.descriptor);
2252 IActivityContainer activityContainer =
2253 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2254 deleteActivityContainer(activityContainer);
2255 reply.writeNoException();
2256 return true;
2257 }
2258
Todd Kennedy4900bf92015-01-16 16:05:14 -08002259 case CREATE_STACK_ON_DISPLAY: {
2260 data.enforceInterface(IActivityManager.descriptor);
2261 int displayId = data.readInt();
2262 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2263 reply.writeNoException();
2264 if (activityContainer != null) {
2265 reply.writeInt(1);
2266 reply.writeStrongBinder(activityContainer.asBinder());
2267 } else {
2268 reply.writeInt(0);
2269 }
2270 return true;
2271 }
2272
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002273 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002274 data.enforceInterface(IActivityManager.descriptor);
2275 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002276 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002277 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002278 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002279 return true;
2280 }
2281
Craig Mautner4a1cb222013-12-04 16:14:06 -08002282 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2283 data.enforceInterface(IActivityManager.descriptor);
2284 IBinder homeActivityToken = getHomeActivityToken();
2285 reply.writeNoException();
2286 reply.writeStrongBinder(homeActivityToken);
2287 return true;
2288 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002289
2290 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2291 data.enforceInterface(IActivityManager.descriptor);
2292 final int taskId = data.readInt();
2293 startLockTaskMode(taskId);
2294 reply.writeNoException();
2295 return true;
2296 }
2297
2298 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2299 data.enforceInterface(IActivityManager.descriptor);
2300 IBinder token = data.readStrongBinder();
2301 startLockTaskMode(token);
2302 reply.writeNoException();
2303 return true;
2304 }
2305
Craig Mautnerd61dc202014-07-07 11:09:11 -07002306 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002307 data.enforceInterface(IActivityManager.descriptor);
2308 startLockTaskModeOnCurrent();
2309 reply.writeNoException();
2310 return true;
2311 }
2312
Craig Mautneraea74a52014-03-08 14:23:10 -08002313 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2314 data.enforceInterface(IActivityManager.descriptor);
2315 stopLockTaskMode();
2316 reply.writeNoException();
2317 return true;
2318 }
2319
Craig Mautnerd61dc202014-07-07 11:09:11 -07002320 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002321 data.enforceInterface(IActivityManager.descriptor);
2322 stopLockTaskModeOnCurrent();
2323 reply.writeNoException();
2324 return true;
2325 }
2326
Craig Mautneraea74a52014-03-08 14:23:10 -08002327 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2328 data.enforceInterface(IActivityManager.descriptor);
2329 final boolean isInLockTaskMode = isInLockTaskMode();
2330 reply.writeNoException();
2331 reply.writeInt(isInLockTaskMode ? 1 : 0);
2332 return true;
2333 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002334
Benjamin Franz43261142015-02-11 15:59:44 +00002335 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2336 data.enforceInterface(IActivityManager.descriptor);
2337 final int lockTaskModeState = getLockTaskModeState();
2338 reply.writeNoException();
2339 reply.writeInt(lockTaskModeState);
2340 return true;
2341 }
2342
Winson Chunga449dc02014-05-16 11:15:04 -07002343 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002344 data.enforceInterface(IActivityManager.descriptor);
2345 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002346 ActivityManager.TaskDescription values =
2347 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2348 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002349 reply.writeNoException();
2350 return true;
2351 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002352
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002353 case SET_TASK_RESIZEABLE_TRANSACTION: {
2354 data.enforceInterface(IActivityManager.descriptor);
2355 int taskId = data.readInt();
2356 boolean resizeable = (data.readInt() == 1) ? true : false;
2357 setTaskResizeable(taskId, resizeable);
2358 reply.writeNoException();
2359 return true;
2360 }
2361
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002362 case RESIZE_TASK_TRANSACTION: {
2363 data.enforceInterface(IActivityManager.descriptor);
2364 int taskId = data.readInt();
2365 Rect r = Rect.CREATOR.createFromParcel(data);
2366 resizeTask(taskId, r);
2367 reply.writeNoException();
2368 return true;
2369 }
2370
Craig Mautner648f69b2014-09-18 14:16:26 -07002371 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2372 data.enforceInterface(IActivityManager.descriptor);
2373 String filename = data.readString();
2374 Bitmap icon = getTaskDescriptionIcon(filename);
2375 reply.writeNoException();
2376 if (icon == null) {
2377 reply.writeInt(0);
2378 } else {
2379 reply.writeInt(1);
2380 icon.writeToParcel(reply, 0);
2381 }
2382 return true;
2383 }
2384
Winson Chung044d5292014-11-06 11:05:19 -08002385 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2386 data.enforceInterface(IActivityManager.descriptor);
2387 final Bundle bundle;
2388 if (data.readInt() == 0) {
2389 bundle = null;
2390 } else {
2391 bundle = data.readBundle();
2392 }
2393 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2394 startInPlaceAnimationOnFrontMostApplication(options);
2395 reply.writeNoException();
2396 return true;
2397 }
2398
Jose Lima4b6c6692014-08-12 17:41:12 -07002399 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002400 data.enforceInterface(IActivityManager.descriptor);
2401 IBinder token = data.readStrongBinder();
2402 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002403 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002404 reply.writeNoException();
2405 reply.writeInt(success ? 1 : 0);
2406 return true;
2407 }
2408
Jose Lima4b6c6692014-08-12 17:41:12 -07002409 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002410 data.enforceInterface(IActivityManager.descriptor);
2411 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002412 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002413 reply.writeNoException();
2414 reply.writeInt(enabled ? 1 : 0);
2415 return true;
2416 }
2417
Jose Lima4b6c6692014-08-12 17:41:12 -07002418 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002419 data.enforceInterface(IActivityManager.descriptor);
2420 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002421 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002422 reply.writeNoException();
2423 return true;
2424 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002425
2426 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2427 data.enforceInterface(IActivityManager.descriptor);
2428 IBinder token = data.readStrongBinder();
2429 notifyLaunchTaskBehindComplete(token);
2430 reply.writeNoException();
2431 return true;
2432 }
Craig Mautner8746a472014-07-24 15:12:54 -07002433
2434 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2435 data.enforceInterface(IActivityManager.descriptor);
2436 IBinder token = data.readStrongBinder();
2437 notifyEnterAnimationComplete(token);
2438 reply.writeNoException();
2439 return true;
2440 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002441
2442 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2443 data.enforceInterface(IActivityManager.descriptor);
2444 bootAnimationComplete();
2445 reply.writeNoException();
2446 return true;
2447 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002448
2449 case SYSTEM_BACKUP_RESTORED: {
2450 data.enforceInterface(IActivityManager.descriptor);
2451 systemBackupRestored();
2452 reply.writeNoException();
2453 return true;
2454 }
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08002455
Jeff Sharkey605eb792014-11-04 13:34:06 -08002456 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2457 data.enforceInterface(IActivityManager.descriptor);
2458 final int uid = data.readInt();
2459 final byte[] firstPacket = data.createByteArray();
2460 notifyCleartextNetwork(uid, firstPacket);
2461 reply.writeNoException();
2462 return true;
2463 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002464
2465 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2466 data.enforceInterface(IActivityManager.descriptor);
2467 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002468 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002469 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002470 String reportPackage = data.readString();
2471 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002472 reply.writeNoException();
2473 return true;
2474 }
2475
2476 case DUMP_HEAP_FINISHED_TRANSACTION: {
2477 data.enforceInterface(IActivityManager.descriptor);
2478 String path = data.readString();
2479 dumpHeapFinished(path);
2480 reply.writeNoException();
2481 return true;
2482 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002483
2484 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2485 data.enforceInterface(IActivityManager.descriptor);
2486 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2487 data.readStrongBinder());
2488 boolean keepAwake = data.readInt() != 0;
2489 setVoiceKeepAwake(session, keepAwake);
2490 reply.writeNoException();
2491 return true;
2492 }
Craig Mautnere5600772015-04-03 21:36:37 -07002493
2494 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2495 data.enforceInterface(IActivityManager.descriptor);
2496 int userId = data.readInt();
2497 String[] packages = data.readStringArray();
2498 updateLockTaskPackages(userId, packages);
2499 reply.writeNoException();
2500 return true;
2501 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002502
2503 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2504 data.enforceInterface(IActivityManager.descriptor);
2505 String pkg = data.readString();
2506 int res = getPackageProcessState(pkg);
2507 reply.writeNoException();
2508 reply.writeInt(res);
2509 return true;
2510 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002511 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002512
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002513 return super.onTransact(code, data, reply, flags);
2514 }
2515
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002516 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002517 return this;
2518 }
2519
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002520 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2521 protected IActivityManager create() {
2522 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002523 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002524 Log.v("ActivityManager", "default service binder = " + b);
2525 }
2526 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002527 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002528 Log.v("ActivityManager", "default service = " + am);
2529 }
2530 return am;
2531 }
2532 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002533}
2534
2535class ActivityManagerProxy implements IActivityManager
2536{
2537 public ActivityManagerProxy(IBinder remote)
2538 {
2539 mRemote = remote;
2540 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002541
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002542 public IBinder asBinder()
2543 {
2544 return mRemote;
2545 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002546
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002547 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002548 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002549 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002550 Parcel data = Parcel.obtain();
2551 Parcel reply = Parcel.obtain();
2552 data.writeInterfaceToken(IActivityManager.descriptor);
2553 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002554 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002555 intent.writeToParcel(data, 0);
2556 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002557 data.writeStrongBinder(resultTo);
2558 data.writeString(resultWho);
2559 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002560 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002561 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002562 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002563 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002564 } else {
2565 data.writeInt(0);
2566 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002567 if (options != null) {
2568 data.writeInt(1);
2569 options.writeToParcel(data, 0);
2570 } else {
2571 data.writeInt(0);
2572 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002573 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2574 reply.readException();
2575 int result = reply.readInt();
2576 reply.recycle();
2577 data.recycle();
2578 return result;
2579 }
Amith Yamasani82644082012-08-03 13:09:11 -07002580
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002581 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002582 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002583 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2584 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002585 Parcel data = Parcel.obtain();
2586 Parcel reply = Parcel.obtain();
2587 data.writeInterfaceToken(IActivityManager.descriptor);
2588 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002589 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002590 intent.writeToParcel(data, 0);
2591 data.writeString(resolvedType);
2592 data.writeStrongBinder(resultTo);
2593 data.writeString(resultWho);
2594 data.writeInt(requestCode);
2595 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002596 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002597 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002598 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002599 } else {
2600 data.writeInt(0);
2601 }
2602 if (options != null) {
2603 data.writeInt(1);
2604 options.writeToParcel(data, 0);
2605 } else {
2606 data.writeInt(0);
2607 }
2608 data.writeInt(userId);
2609 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2610 reply.readException();
2611 int result = reply.readInt();
2612 reply.recycle();
2613 data.recycle();
2614 return result;
2615 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002616 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2617 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002618 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002619 Parcel data = Parcel.obtain();
2620 Parcel reply = Parcel.obtain();
2621 data.writeInterfaceToken(IActivityManager.descriptor);
2622 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2623 data.writeString(callingPackage);
2624 intent.writeToParcel(data, 0);
2625 data.writeString(resolvedType);
2626 data.writeStrongBinder(resultTo);
2627 data.writeString(resultWho);
2628 data.writeInt(requestCode);
2629 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002630 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002631 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002632 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002633 } else {
2634 data.writeInt(0);
2635 }
2636 if (options != null) {
2637 data.writeInt(1);
2638 options.writeToParcel(data, 0);
2639 } else {
2640 data.writeInt(0);
2641 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002642 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002643 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2644 reply.readException();
2645 int result = reply.readInt();
2646 reply.recycle();
2647 data.recycle();
2648 return result;
2649 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002650 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2651 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002652 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2653 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002654 Parcel data = Parcel.obtain();
2655 Parcel reply = Parcel.obtain();
2656 data.writeInterfaceToken(IActivityManager.descriptor);
2657 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002658 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002659 intent.writeToParcel(data, 0);
2660 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002661 data.writeStrongBinder(resultTo);
2662 data.writeString(resultWho);
2663 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002664 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002665 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002666 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002667 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002668 } else {
2669 data.writeInt(0);
2670 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002671 if (options != null) {
2672 data.writeInt(1);
2673 options.writeToParcel(data, 0);
2674 } else {
2675 data.writeInt(0);
2676 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002677 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002678 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2679 reply.readException();
2680 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2681 reply.recycle();
2682 data.recycle();
2683 return result;
2684 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002685 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2686 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002687 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002688 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002689 Parcel data = Parcel.obtain();
2690 Parcel reply = Parcel.obtain();
2691 data.writeInterfaceToken(IActivityManager.descriptor);
2692 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002693 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002694 intent.writeToParcel(data, 0);
2695 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002696 data.writeStrongBinder(resultTo);
2697 data.writeString(resultWho);
2698 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002699 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002700 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002701 if (options != null) {
2702 data.writeInt(1);
2703 options.writeToParcel(data, 0);
2704 } else {
2705 data.writeInt(0);
2706 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002707 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002708 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2709 reply.readException();
2710 int result = reply.readInt();
2711 reply.recycle();
2712 data.recycle();
2713 return result;
2714 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002715 public int startActivityIntentSender(IApplicationThread caller,
2716 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002717 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002718 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002719 Parcel data = Parcel.obtain();
2720 Parcel reply = Parcel.obtain();
2721 data.writeInterfaceToken(IActivityManager.descriptor);
2722 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2723 intent.writeToParcel(data, 0);
2724 if (fillInIntent != null) {
2725 data.writeInt(1);
2726 fillInIntent.writeToParcel(data, 0);
2727 } else {
2728 data.writeInt(0);
2729 }
2730 data.writeString(resolvedType);
2731 data.writeStrongBinder(resultTo);
2732 data.writeString(resultWho);
2733 data.writeInt(requestCode);
2734 data.writeInt(flagsMask);
2735 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002736 if (options != null) {
2737 data.writeInt(1);
2738 options.writeToParcel(data, 0);
2739 } else {
2740 data.writeInt(0);
2741 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002742 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002743 reply.readException();
2744 int result = reply.readInt();
2745 reply.recycle();
2746 data.recycle();
2747 return result;
2748 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002749 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2750 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002751 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2752 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002753 Parcel data = Parcel.obtain();
2754 Parcel reply = Parcel.obtain();
2755 data.writeInterfaceToken(IActivityManager.descriptor);
2756 data.writeString(callingPackage);
2757 data.writeInt(callingPid);
2758 data.writeInt(callingUid);
2759 intent.writeToParcel(data, 0);
2760 data.writeString(resolvedType);
2761 data.writeStrongBinder(session.asBinder());
2762 data.writeStrongBinder(interactor.asBinder());
2763 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002764 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002765 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002766 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002767 } else {
2768 data.writeInt(0);
2769 }
2770 if (options != null) {
2771 data.writeInt(1);
2772 options.writeToParcel(data, 0);
2773 } else {
2774 data.writeInt(0);
2775 }
2776 data.writeInt(userId);
2777 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2778 reply.readException();
2779 int result = reply.readInt();
2780 reply.recycle();
2781 data.recycle();
2782 return result;
2783 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002785 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002786 Parcel data = Parcel.obtain();
2787 Parcel reply = Parcel.obtain();
2788 data.writeInterfaceToken(IActivityManager.descriptor);
2789 data.writeStrongBinder(callingActivity);
2790 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002791 if (options != null) {
2792 data.writeInt(1);
2793 options.writeToParcel(data, 0);
2794 } else {
2795 data.writeInt(0);
2796 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002797 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2798 reply.readException();
2799 int result = reply.readInt();
2800 reply.recycle();
2801 data.recycle();
2802 return result != 0;
2803 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002804 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2805 Parcel data = Parcel.obtain();
2806 Parcel reply = Parcel.obtain();
2807 data.writeInterfaceToken(IActivityManager.descriptor);
2808 data.writeInt(taskId);
2809 if (options == null) {
2810 data.writeInt(0);
2811 } else {
2812 data.writeInt(1);
2813 options.writeToParcel(data, 0);
2814 }
2815 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2816 reply.readException();
2817 int result = reply.readInt();
2818 reply.recycle();
2819 data.recycle();
2820 return result;
2821 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002822 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002823 throws RemoteException {
2824 Parcel data = Parcel.obtain();
2825 Parcel reply = Parcel.obtain();
2826 data.writeInterfaceToken(IActivityManager.descriptor);
2827 data.writeStrongBinder(token);
2828 data.writeInt(resultCode);
2829 if (resultData != null) {
2830 data.writeInt(1);
2831 resultData.writeToParcel(data, 0);
2832 } else {
2833 data.writeInt(0);
2834 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002835 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2837 reply.readException();
2838 boolean res = reply.readInt() != 0;
2839 data.recycle();
2840 reply.recycle();
2841 return res;
2842 }
2843 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2844 {
2845 Parcel data = Parcel.obtain();
2846 Parcel reply = Parcel.obtain();
2847 data.writeInterfaceToken(IActivityManager.descriptor);
2848 data.writeStrongBinder(token);
2849 data.writeString(resultWho);
2850 data.writeInt(requestCode);
2851 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2852 reply.readException();
2853 data.recycle();
2854 reply.recycle();
2855 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002856 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2857 Parcel data = Parcel.obtain();
2858 Parcel reply = Parcel.obtain();
2859 data.writeInterfaceToken(IActivityManager.descriptor);
2860 data.writeStrongBinder(token);
2861 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2862 reply.readException();
2863 boolean res = reply.readInt() != 0;
2864 data.recycle();
2865 reply.recycle();
2866 return res;
2867 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002868 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2869 Parcel data = Parcel.obtain();
2870 Parcel reply = Parcel.obtain();
2871 data.writeInterfaceToken(IActivityManager.descriptor);
2872 data.writeStrongBinder(session.asBinder());
2873 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2874 reply.readException();
2875 data.recycle();
2876 reply.recycle();
2877 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002878 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2879 Parcel data = Parcel.obtain();
2880 Parcel reply = Parcel.obtain();
2881 data.writeInterfaceToken(IActivityManager.descriptor);
2882 data.writeStrongBinder(token);
2883 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2884 reply.readException();
2885 boolean res = reply.readInt() != 0;
2886 data.recycle();
2887 reply.recycle();
2888 return res;
2889 }
2890 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2891 Parcel data = Parcel.obtain();
2892 Parcel reply = Parcel.obtain();
2893 data.writeInterfaceToken(IActivityManager.descriptor);
2894 data.writeStrongBinder(app.asBinder());
2895 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2896 reply.readException();
2897 data.recycle();
2898 reply.recycle();
2899 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002900 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2901 Parcel data = Parcel.obtain();
2902 Parcel reply = Parcel.obtain();
2903 data.writeInterfaceToken(IActivityManager.descriptor);
2904 data.writeStrongBinder(token);
2905 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2906 reply.readException();
2907 boolean res = reply.readInt() != 0;
2908 data.recycle();
2909 reply.recycle();
2910 return res;
2911 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002912 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002913 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002914 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002915 {
2916 Parcel data = Parcel.obtain();
2917 Parcel reply = Parcel.obtain();
2918 data.writeInterfaceToken(IActivityManager.descriptor);
2919 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002920 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002921 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2922 filter.writeToParcel(data, 0);
2923 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002924 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002925 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2926 reply.readException();
2927 Intent intent = null;
2928 int haveIntent = reply.readInt();
2929 if (haveIntent != 0) {
2930 intent = Intent.CREATOR.createFromParcel(reply);
2931 }
2932 reply.recycle();
2933 data.recycle();
2934 return intent;
2935 }
2936 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2937 {
2938 Parcel data = Parcel.obtain();
2939 Parcel reply = Parcel.obtain();
2940 data.writeInterfaceToken(IActivityManager.descriptor);
2941 data.writeStrongBinder(receiver.asBinder());
2942 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2943 reply.readException();
2944 data.recycle();
2945 reply.recycle();
2946 }
2947 public int broadcastIntent(IApplicationThread caller,
2948 Intent intent, String resolvedType, IIntentReceiver resultTo,
2949 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002950 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002951 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002952 {
2953 Parcel data = Parcel.obtain();
2954 Parcel reply = Parcel.obtain();
2955 data.writeInterfaceToken(IActivityManager.descriptor);
2956 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2957 intent.writeToParcel(data, 0);
2958 data.writeString(resolvedType);
2959 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2960 data.writeInt(resultCode);
2961 data.writeString(resultData);
2962 data.writeBundle(map);
2963 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002964 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002965 data.writeInt(serialized ? 1 : 0);
2966 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002967 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002968 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2969 reply.readException();
2970 int res = reply.readInt();
2971 reply.recycle();
2972 data.recycle();
2973 return res;
2974 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002975 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2976 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002977 {
2978 Parcel data = Parcel.obtain();
2979 Parcel reply = Parcel.obtain();
2980 data.writeInterfaceToken(IActivityManager.descriptor);
2981 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2982 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002983 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002984 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2985 reply.readException();
2986 data.recycle();
2987 reply.recycle();
2988 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002989 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
2990 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002991 {
2992 Parcel data = Parcel.obtain();
2993 Parcel reply = Parcel.obtain();
2994 data.writeInterfaceToken(IActivityManager.descriptor);
2995 data.writeStrongBinder(who);
2996 data.writeInt(resultCode);
2997 data.writeString(resultData);
2998 data.writeBundle(map);
2999 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003000 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003001 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3002 reply.readException();
3003 data.recycle();
3004 reply.recycle();
3005 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 public void attachApplication(IApplicationThread app) throws RemoteException
3007 {
3008 Parcel data = Parcel.obtain();
3009 Parcel reply = Parcel.obtain();
3010 data.writeInterfaceToken(IActivityManager.descriptor);
3011 data.writeStrongBinder(app.asBinder());
3012 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3013 reply.readException();
3014 data.recycle();
3015 reply.recycle();
3016 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003017 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3018 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003019 {
3020 Parcel data = Parcel.obtain();
3021 Parcel reply = Parcel.obtain();
3022 data.writeInterfaceToken(IActivityManager.descriptor);
3023 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003024 if (config != null) {
3025 data.writeInt(1);
3026 config.writeToParcel(data, 0);
3027 } else {
3028 data.writeInt(0);
3029 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003030 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003031 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3032 reply.readException();
3033 data.recycle();
3034 reply.recycle();
3035 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003036 public void activityResumed(IBinder token) throws RemoteException
3037 {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 data.writeStrongBinder(token);
3042 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3043 reply.readException();
3044 data.recycle();
3045 reply.recycle();
3046 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003047 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003048 {
3049 Parcel data = Parcel.obtain();
3050 Parcel reply = Parcel.obtain();
3051 data.writeInterfaceToken(IActivityManager.descriptor);
3052 data.writeStrongBinder(token);
3053 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3054 reply.readException();
3055 data.recycle();
3056 reply.recycle();
3057 }
3058 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003059 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003060 {
3061 Parcel data = Parcel.obtain();
3062 Parcel reply = Parcel.obtain();
3063 data.writeInterfaceToken(IActivityManager.descriptor);
3064 data.writeStrongBinder(token);
3065 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003066 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 TextUtils.writeToParcel(description, data, 0);
3068 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3069 reply.readException();
3070 data.recycle();
3071 reply.recycle();
3072 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003073 public void activitySlept(IBinder token) throws RemoteException
3074 {
3075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 data.writeStrongBinder(token);
3079 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3080 reply.readException();
3081 data.recycle();
3082 reply.recycle();
3083 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003084 public void activityDestroyed(IBinder token) throws RemoteException
3085 {
3086 Parcel data = Parcel.obtain();
3087 Parcel reply = Parcel.obtain();
3088 data.writeInterfaceToken(IActivityManager.descriptor);
3089 data.writeStrongBinder(token);
3090 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3091 reply.readException();
3092 data.recycle();
3093 reply.recycle();
3094 }
3095 public String getCallingPackage(IBinder token) throws RemoteException
3096 {
3097 Parcel data = Parcel.obtain();
3098 Parcel reply = Parcel.obtain();
3099 data.writeInterfaceToken(IActivityManager.descriptor);
3100 data.writeStrongBinder(token);
3101 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3102 reply.readException();
3103 String res = reply.readString();
3104 data.recycle();
3105 reply.recycle();
3106 return res;
3107 }
3108 public ComponentName getCallingActivity(IBinder token)
3109 throws RemoteException {
3110 Parcel data = Parcel.obtain();
3111 Parcel reply = Parcel.obtain();
3112 data.writeInterfaceToken(IActivityManager.descriptor);
3113 data.writeStrongBinder(token);
3114 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3115 reply.readException();
3116 ComponentName res = ComponentName.readFromParcel(reply);
3117 data.recycle();
3118 reply.recycle();
3119 return res;
3120 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003121 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003122 Parcel data = Parcel.obtain();
3123 Parcel reply = Parcel.obtain();
3124 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003125 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003126 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 ArrayList<IAppTask> list = null;
3129 int N = reply.readInt();
3130 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003131 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003132 while (N > 0) {
3133 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3134 list.add(task);
3135 N--;
3136 }
3137 }
3138 data.recycle();
3139 reply.recycle();
3140 return list;
3141 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003142 public int addAppTask(IBinder activityToken, Intent intent,
3143 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3144 Parcel data = Parcel.obtain();
3145 Parcel reply = Parcel.obtain();
3146 data.writeInterfaceToken(IActivityManager.descriptor);
3147 data.writeStrongBinder(activityToken);
3148 intent.writeToParcel(data, 0);
3149 description.writeToParcel(data, 0);
3150 thumbnail.writeToParcel(data, 0);
3151 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3152 reply.readException();
3153 int res = reply.readInt();
3154 data.recycle();
3155 reply.recycle();
3156 return res;
3157 }
3158 public Point getAppTaskThumbnailSize() throws RemoteException {
3159 Parcel data = Parcel.obtain();
3160 Parcel reply = Parcel.obtain();
3161 data.writeInterfaceToken(IActivityManager.descriptor);
3162 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 Point size = Point.CREATOR.createFromParcel(reply);
3165 data.recycle();
3166 reply.recycle();
3167 return size;
3168 }
Todd Kennedye635f662015-01-20 10:36:49 -08003169 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3170 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
3174 data.writeInt(maxNum);
3175 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003176 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3177 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003178 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003179 int N = reply.readInt();
3180 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003181 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003182 while (N > 0) {
3183 ActivityManager.RunningTaskInfo info =
3184 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003185 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003186 list.add(info);
3187 N--;
3188 }
3189 }
3190 data.recycle();
3191 reply.recycle();
3192 return list;
3193 }
3194 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003195 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 data.writeInt(maxNum);
3200 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003201 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003202 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3203 reply.readException();
3204 ArrayList<ActivityManager.RecentTaskInfo> list
3205 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3206 data.recycle();
3207 reply.recycle();
3208 return list;
3209 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003210 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003211 Parcel data = Parcel.obtain();
3212 Parcel reply = Parcel.obtain();
3213 data.writeInterfaceToken(IActivityManager.descriptor);
3214 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003215 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003216 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003217 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003218 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003219 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003220 }
3221 data.recycle();
3222 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003223 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003224 }
Todd Kennedye635f662015-01-20 10:36:49 -08003225 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3226 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003227 Parcel data = Parcel.obtain();
3228 Parcel reply = Parcel.obtain();
3229 data.writeInterfaceToken(IActivityManager.descriptor);
3230 data.writeInt(maxNum);
3231 data.writeInt(flags);
3232 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3233 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003234 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003235 int N = reply.readInt();
3236 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003237 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 while (N > 0) {
3239 ActivityManager.RunningServiceInfo info =
3240 ActivityManager.RunningServiceInfo.CREATOR
3241 .createFromParcel(reply);
3242 list.add(info);
3243 N--;
3244 }
3245 }
3246 data.recycle();
3247 reply.recycle();
3248 return list;
3249 }
3250 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3251 throws RemoteException {
3252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3256 reply.readException();
3257 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3258 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3259 data.recycle();
3260 reply.recycle();
3261 return list;
3262 }
3263 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3264 throws RemoteException {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3269 reply.readException();
3270 ArrayList<ActivityManager.RunningAppProcessInfo> list
3271 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3272 data.recycle();
3273 reply.recycle();
3274 return list;
3275 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003276 public List<ApplicationInfo> getRunningExternalApplications()
3277 throws RemoteException {
3278 Parcel data = Parcel.obtain();
3279 Parcel reply = Parcel.obtain();
3280 data.writeInterfaceToken(IActivityManager.descriptor);
3281 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3282 reply.readException();
3283 ArrayList<ApplicationInfo> list
3284 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3285 data.recycle();
3286 reply.recycle();
3287 return list;
3288 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003289 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003290 {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003295 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003296 if (options != null) {
3297 data.writeInt(1);
3298 options.writeToParcel(data, 0);
3299 } else {
3300 data.writeInt(0);
3301 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003302 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3303 reply.readException();
3304 data.recycle();
3305 reply.recycle();
3306 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003307 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3308 throws RemoteException {
3309 Parcel data = Parcel.obtain();
3310 Parcel reply = Parcel.obtain();
3311 data.writeInterfaceToken(IActivityManager.descriptor);
3312 data.writeStrongBinder(token);
3313 data.writeInt(nonRoot ? 1 : 0);
3314 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3315 reply.readException();
3316 boolean res = reply.readInt() != 0;
3317 data.recycle();
3318 reply.recycle();
3319 return res;
3320 }
3321 public void moveTaskBackwards(int task) throws RemoteException
3322 {
3323 Parcel data = Parcel.obtain();
3324 Parcel reply = Parcel.obtain();
3325 data.writeInterfaceToken(IActivityManager.descriptor);
3326 data.writeInt(task);
3327 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3328 reply.readException();
3329 data.recycle();
3330 reply.recycle();
3331 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003332 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003333 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3334 {
3335 Parcel data = Parcel.obtain();
3336 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003337 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003338 data.writeInt(taskId);
3339 data.writeInt(stackId);
3340 data.writeInt(toTop ? 1 : 0);
3341 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 data.recycle();
3344 reply.recycle();
3345 }
3346 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003347 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003348 {
3349 Parcel data = Parcel.obtain();
3350 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003351 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003352 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003353 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003354 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003355 reply.readException();
3356 data.recycle();
3357 reply.recycle();
3358 }
Craig Mautner967212c2013-04-13 21:10:58 -07003359 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003360 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003361 {
3362 Parcel data = Parcel.obtain();
3363 Parcel reply = Parcel.obtain();
3364 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003365 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003366 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003367 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003368 data.recycle();
3369 reply.recycle();
3370 return list;
3371 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003372 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003373 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003374 {
3375 Parcel data = Parcel.obtain();
3376 Parcel reply = Parcel.obtain();
3377 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003378 data.writeInt(stackId);
3379 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003380 reply.readException();
3381 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003382 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003383 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003384 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003385 }
3386 data.recycle();
3387 reply.recycle();
3388 return info;
3389 }
3390 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003391 public boolean isInHomeStack(int taskId) throws RemoteException {
3392 Parcel data = Parcel.obtain();
3393 Parcel reply = Parcel.obtain();
3394 data.writeInterfaceToken(IActivityManager.descriptor);
3395 data.writeInt(taskId);
3396 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3397 reply.readException();
3398 boolean isInHomeStack = reply.readInt() > 0;
3399 data.recycle();
3400 reply.recycle();
3401 return isInHomeStack;
3402 }
3403 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003404 public void setFocusedStack(int stackId) throws RemoteException
3405 {
3406 Parcel data = Parcel.obtain();
3407 Parcel reply = Parcel.obtain();
3408 data.writeInterfaceToken(IActivityManager.descriptor);
3409 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003410 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003411 reply.readException();
3412 data.recycle();
3413 reply.recycle();
3414 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003415 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003416 public int getFocusedStackId() throws RemoteException {
3417 Parcel data = Parcel.obtain();
3418 Parcel reply = Parcel.obtain();
3419 data.writeInterfaceToken(IActivityManager.descriptor);
3420 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3421 reply.readException();
3422 int focusedStackId = reply.readInt();
3423 data.recycle();
3424 reply.recycle();
3425 return focusedStackId;
3426 }
3427 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003428 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3429 {
3430 Parcel data = Parcel.obtain();
3431 Parcel reply = Parcel.obtain();
3432 data.writeInterfaceToken(IActivityManager.descriptor);
3433 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003434 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003435 reply.readException();
3436 data.recycle();
3437 reply.recycle();
3438 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003439 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3440 {
3441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
3444 data.writeStrongBinder(token);
3445 data.writeInt(onlyRoot ? 1 : 0);
3446 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3447 reply.readException();
3448 int res = reply.readInt();
3449 data.recycle();
3450 reply.recycle();
3451 return res;
3452 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003453 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003454 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3459 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003460 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003461 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003462 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3463 reply.readException();
3464 int res = reply.readInt();
3465 ContentProviderHolder cph = null;
3466 if (res != 0) {
3467 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3468 }
3469 data.recycle();
3470 reply.recycle();
3471 return cph;
3472 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003473 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3474 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003475 Parcel data = Parcel.obtain();
3476 Parcel reply = Parcel.obtain();
3477 data.writeInterfaceToken(IActivityManager.descriptor);
3478 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003479 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003480 data.writeStrongBinder(token);
3481 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3482 reply.readException();
3483 int res = reply.readInt();
3484 ContentProviderHolder cph = null;
3485 if (res != 0) {
3486 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3487 }
3488 data.recycle();
3489 reply.recycle();
3490 return cph;
3491 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003493 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003494 {
3495 Parcel data = Parcel.obtain();
3496 Parcel reply = Parcel.obtain();
3497 data.writeInterfaceToken(IActivityManager.descriptor);
3498 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3499 data.writeTypedList(providers);
3500 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3501 reply.readException();
3502 data.recycle();
3503 reply.recycle();
3504 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003505 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3506 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003507 Parcel data = Parcel.obtain();
3508 Parcel reply = Parcel.obtain();
3509 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003510 data.writeStrongBinder(connection);
3511 data.writeInt(stable);
3512 data.writeInt(unstable);
3513 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3514 reply.readException();
3515 boolean res = reply.readInt() != 0;
3516 data.recycle();
3517 reply.recycle();
3518 return res;
3519 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003520
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003521 public void unstableProviderDied(IBinder connection) throws RemoteException {
3522 Parcel data = Parcel.obtain();
3523 Parcel reply = Parcel.obtain();
3524 data.writeInterfaceToken(IActivityManager.descriptor);
3525 data.writeStrongBinder(connection);
3526 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3527 reply.readException();
3528 data.recycle();
3529 reply.recycle();
3530 }
3531
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003532 @Override
3533 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3534 Parcel data = Parcel.obtain();
3535 Parcel reply = Parcel.obtain();
3536 data.writeInterfaceToken(IActivityManager.descriptor);
3537 data.writeStrongBinder(connection);
3538 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3539 reply.readException();
3540 data.recycle();
3541 reply.recycle();
3542 }
3543
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003544 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3545 Parcel data = Parcel.obtain();
3546 Parcel reply = Parcel.obtain();
3547 data.writeInterfaceToken(IActivityManager.descriptor);
3548 data.writeStrongBinder(connection);
3549 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003550 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3551 reply.readException();
3552 data.recycle();
3553 reply.recycle();
3554 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003555
3556 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3557 Parcel data = Parcel.obtain();
3558 Parcel reply = Parcel.obtain();
3559 data.writeInterfaceToken(IActivityManager.descriptor);
3560 data.writeString(name);
3561 data.writeStrongBinder(token);
3562 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3563 reply.readException();
3564 data.recycle();
3565 reply.recycle();
3566 }
3567
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003568 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3569 throws RemoteException
3570 {
3571 Parcel data = Parcel.obtain();
3572 Parcel reply = Parcel.obtain();
3573 data.writeInterfaceToken(IActivityManager.descriptor);
3574 service.writeToParcel(data, 0);
3575 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3576 reply.readException();
3577 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3578 data.recycle();
3579 reply.recycle();
3580 return res;
3581 }
3582
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003583 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003584 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003585 {
3586 Parcel data = Parcel.obtain();
3587 Parcel reply = Parcel.obtain();
3588 data.writeInterfaceToken(IActivityManager.descriptor);
3589 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3590 service.writeToParcel(data, 0);
3591 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003592 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003593 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3594 reply.readException();
3595 ComponentName res = ComponentName.readFromParcel(reply);
3596 data.recycle();
3597 reply.recycle();
3598 return res;
3599 }
3600 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003601 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003602 {
3603 Parcel data = Parcel.obtain();
3604 Parcel reply = Parcel.obtain();
3605 data.writeInterfaceToken(IActivityManager.descriptor);
3606 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3607 service.writeToParcel(data, 0);
3608 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003609 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003610 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3611 reply.readException();
3612 int res = reply.readInt();
3613 reply.recycle();
3614 data.recycle();
3615 return res;
3616 }
3617 public boolean stopServiceToken(ComponentName className, IBinder token,
3618 int startId) throws RemoteException {
3619 Parcel data = Parcel.obtain();
3620 Parcel reply = Parcel.obtain();
3621 data.writeInterfaceToken(IActivityManager.descriptor);
3622 ComponentName.writeToParcel(className, data);
3623 data.writeStrongBinder(token);
3624 data.writeInt(startId);
3625 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3626 reply.readException();
3627 boolean res = reply.readInt() != 0;
3628 data.recycle();
3629 reply.recycle();
3630 return res;
3631 }
3632 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003633 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003634 Parcel data = Parcel.obtain();
3635 Parcel reply = Parcel.obtain();
3636 data.writeInterfaceToken(IActivityManager.descriptor);
3637 ComponentName.writeToParcel(className, data);
3638 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003639 data.writeInt(id);
3640 if (notification != null) {
3641 data.writeInt(1);
3642 notification.writeToParcel(data, 0);
3643 } else {
3644 data.writeInt(0);
3645 }
3646 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003647 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3648 reply.readException();
3649 data.recycle();
3650 reply.recycle();
3651 }
3652 public int bindService(IApplicationThread caller, IBinder token,
3653 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003654 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003655 Parcel data = Parcel.obtain();
3656 Parcel reply = Parcel.obtain();
3657 data.writeInterfaceToken(IActivityManager.descriptor);
3658 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3659 data.writeStrongBinder(token);
3660 service.writeToParcel(data, 0);
3661 data.writeString(resolvedType);
3662 data.writeStrongBinder(connection.asBinder());
3663 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003664 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003665 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3666 reply.readException();
3667 int res = reply.readInt();
3668 data.recycle();
3669 reply.recycle();
3670 return res;
3671 }
3672 public boolean unbindService(IServiceConnection connection) throws RemoteException
3673 {
3674 Parcel data = Parcel.obtain();
3675 Parcel reply = Parcel.obtain();
3676 data.writeInterfaceToken(IActivityManager.descriptor);
3677 data.writeStrongBinder(connection.asBinder());
3678 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3679 reply.readException();
3680 boolean res = reply.readInt() != 0;
3681 data.recycle();
3682 reply.recycle();
3683 return res;
3684 }
3685
3686 public void publishService(IBinder token,
3687 Intent intent, IBinder service) throws RemoteException {
3688 Parcel data = Parcel.obtain();
3689 Parcel reply = Parcel.obtain();
3690 data.writeInterfaceToken(IActivityManager.descriptor);
3691 data.writeStrongBinder(token);
3692 intent.writeToParcel(data, 0);
3693 data.writeStrongBinder(service);
3694 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 data.recycle();
3697 reply.recycle();
3698 }
3699
3700 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3701 throws RemoteException {
3702 Parcel data = Parcel.obtain();
3703 Parcel reply = Parcel.obtain();
3704 data.writeInterfaceToken(IActivityManager.descriptor);
3705 data.writeStrongBinder(token);
3706 intent.writeToParcel(data, 0);
3707 data.writeInt(doRebind ? 1 : 0);
3708 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 data.recycle();
3711 reply.recycle();
3712 }
3713
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003714 public void serviceDoneExecuting(IBinder token, int type, int startId,
3715 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003716 Parcel data = Parcel.obtain();
3717 Parcel reply = Parcel.obtain();
3718 data.writeInterfaceToken(IActivityManager.descriptor);
3719 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003720 data.writeInt(type);
3721 data.writeInt(startId);
3722 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003723 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3724 reply.readException();
3725 data.recycle();
3726 reply.recycle();
3727 }
3728
3729 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3730 Parcel data = Parcel.obtain();
3731 Parcel reply = Parcel.obtain();
3732 data.writeInterfaceToken(IActivityManager.descriptor);
3733 service.writeToParcel(data, 0);
3734 data.writeString(resolvedType);
3735 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3736 reply.readException();
3737 IBinder binder = reply.readStrongBinder();
3738 reply.recycle();
3739 data.recycle();
3740 return binder;
3741 }
3742
Christopher Tate181fafa2009-05-14 11:12:14 -07003743 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3744 throws RemoteException {
3745 Parcel data = Parcel.obtain();
3746 Parcel reply = Parcel.obtain();
3747 data.writeInterfaceToken(IActivityManager.descriptor);
3748 app.writeToParcel(data, 0);
3749 data.writeInt(backupRestoreMode);
3750 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 boolean success = reply.readInt() != 0;
3753 reply.recycle();
3754 data.recycle();
3755 return success;
3756 }
3757
Christopher Tate346acb12012-10-15 19:20:25 -07003758 public void clearPendingBackup() throws RemoteException {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3763 reply.recycle();
3764 data.recycle();
3765 }
3766
Christopher Tate181fafa2009-05-14 11:12:14 -07003767 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3768 Parcel data = Parcel.obtain();
3769 Parcel reply = Parcel.obtain();
3770 data.writeInterfaceToken(IActivityManager.descriptor);
3771 data.writeString(packageName);
3772 data.writeStrongBinder(agent);
3773 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3774 reply.recycle();
3775 data.recycle();
3776 }
3777
3778 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3779 Parcel data = Parcel.obtain();
3780 Parcel reply = Parcel.obtain();
3781 data.writeInterfaceToken(IActivityManager.descriptor);
3782 app.writeToParcel(data, 0);
3783 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 reply.recycle();
3786 data.recycle();
3787 }
3788
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003789 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003790 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003791 IUiAutomationConnection connection, int userId, String instructionSet)
3792 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 Parcel data = Parcel.obtain();
3794 Parcel reply = Parcel.obtain();
3795 data.writeInterfaceToken(IActivityManager.descriptor);
3796 ComponentName.writeToParcel(className, data);
3797 data.writeString(profileFile);
3798 data.writeInt(flags);
3799 data.writeBundle(arguments);
3800 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003801 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003802 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003803 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003804 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3805 reply.readException();
3806 boolean res = reply.readInt() != 0;
3807 reply.recycle();
3808 data.recycle();
3809 return res;
3810 }
3811
3812 public void finishInstrumentation(IApplicationThread target,
3813 int resultCode, Bundle results) throws RemoteException {
3814 Parcel data = Parcel.obtain();
3815 Parcel reply = Parcel.obtain();
3816 data.writeInterfaceToken(IActivityManager.descriptor);
3817 data.writeStrongBinder(target != null ? target.asBinder() : null);
3818 data.writeInt(resultCode);
3819 data.writeBundle(results);
3820 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3821 reply.readException();
3822 data.recycle();
3823 reply.recycle();
3824 }
3825 public Configuration getConfiguration() throws RemoteException
3826 {
3827 Parcel data = Parcel.obtain();
3828 Parcel reply = Parcel.obtain();
3829 data.writeInterfaceToken(IActivityManager.descriptor);
3830 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3831 reply.readException();
3832 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3833 reply.recycle();
3834 data.recycle();
3835 return res;
3836 }
3837 public void updateConfiguration(Configuration values) throws RemoteException
3838 {
3839 Parcel data = Parcel.obtain();
3840 Parcel reply = Parcel.obtain();
3841 data.writeInterfaceToken(IActivityManager.descriptor);
3842 values.writeToParcel(data, 0);
3843 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3844 reply.readException();
3845 data.recycle();
3846 reply.recycle();
3847 }
3848 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3849 throws RemoteException {
3850 Parcel data = Parcel.obtain();
3851 Parcel reply = Parcel.obtain();
3852 data.writeInterfaceToken(IActivityManager.descriptor);
3853 data.writeStrongBinder(token);
3854 data.writeInt(requestedOrientation);
3855 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3856 reply.readException();
3857 data.recycle();
3858 reply.recycle();
3859 }
3860 public int getRequestedOrientation(IBinder token) throws RemoteException {
3861 Parcel data = Parcel.obtain();
3862 Parcel reply = Parcel.obtain();
3863 data.writeInterfaceToken(IActivityManager.descriptor);
3864 data.writeStrongBinder(token);
3865 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3866 reply.readException();
3867 int res = reply.readInt();
3868 data.recycle();
3869 reply.recycle();
3870 return res;
3871 }
3872 public ComponentName getActivityClassForToken(IBinder token)
3873 throws RemoteException {
3874 Parcel data = Parcel.obtain();
3875 Parcel reply = Parcel.obtain();
3876 data.writeInterfaceToken(IActivityManager.descriptor);
3877 data.writeStrongBinder(token);
3878 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 ComponentName res = ComponentName.readFromParcel(reply);
3881 data.recycle();
3882 reply.recycle();
3883 return res;
3884 }
3885 public String getPackageForToken(IBinder token) throws RemoteException
3886 {
3887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 data.writeStrongBinder(token);
3891 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3892 reply.readException();
3893 String res = reply.readString();
3894 data.recycle();
3895 reply.recycle();
3896 return res;
3897 }
3898 public IIntentSender getIntentSender(int type,
3899 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003900 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003901 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003902 Parcel data = Parcel.obtain();
3903 Parcel reply = Parcel.obtain();
3904 data.writeInterfaceToken(IActivityManager.descriptor);
3905 data.writeInt(type);
3906 data.writeString(packageName);
3907 data.writeStrongBinder(token);
3908 data.writeString(resultWho);
3909 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003910 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003911 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003912 data.writeTypedArray(intents, 0);
3913 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003914 } else {
3915 data.writeInt(0);
3916 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003917 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003918 if (options != null) {
3919 data.writeInt(1);
3920 options.writeToParcel(data, 0);
3921 } else {
3922 data.writeInt(0);
3923 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003924 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003925 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3926 reply.readException();
3927 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003928 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003929 data.recycle();
3930 reply.recycle();
3931 return res;
3932 }
3933 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3934 Parcel data = Parcel.obtain();
3935 Parcel reply = Parcel.obtain();
3936 data.writeInterfaceToken(IActivityManager.descriptor);
3937 data.writeStrongBinder(sender.asBinder());
3938 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3939 reply.readException();
3940 data.recycle();
3941 reply.recycle();
3942 }
3943 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3944 Parcel data = Parcel.obtain();
3945 Parcel reply = Parcel.obtain();
3946 data.writeInterfaceToken(IActivityManager.descriptor);
3947 data.writeStrongBinder(sender.asBinder());
3948 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3949 reply.readException();
3950 String res = reply.readString();
3951 data.recycle();
3952 reply.recycle();
3953 return res;
3954 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003955 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3956 Parcel data = Parcel.obtain();
3957 Parcel reply = Parcel.obtain();
3958 data.writeInterfaceToken(IActivityManager.descriptor);
3959 data.writeStrongBinder(sender.asBinder());
3960 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3961 reply.readException();
3962 int res = reply.readInt();
3963 data.recycle();
3964 reply.recycle();
3965 return res;
3966 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003967 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3968 boolean requireFull, String name, String callerPackage) throws RemoteException {
3969 Parcel data = Parcel.obtain();
3970 Parcel reply = Parcel.obtain();
3971 data.writeInterfaceToken(IActivityManager.descriptor);
3972 data.writeInt(callingPid);
3973 data.writeInt(callingUid);
3974 data.writeInt(userId);
3975 data.writeInt(allowAll ? 1 : 0);
3976 data.writeInt(requireFull ? 1 : 0);
3977 data.writeString(name);
3978 data.writeString(callerPackage);
3979 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3980 reply.readException();
3981 int res = reply.readInt();
3982 data.recycle();
3983 reply.recycle();
3984 return res;
3985 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003986 public void setProcessLimit(int max) throws RemoteException
3987 {
3988 Parcel data = Parcel.obtain();
3989 Parcel reply = Parcel.obtain();
3990 data.writeInterfaceToken(IActivityManager.descriptor);
3991 data.writeInt(max);
3992 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3993 reply.readException();
3994 data.recycle();
3995 reply.recycle();
3996 }
3997 public int getProcessLimit() throws RemoteException
3998 {
3999 Parcel data = Parcel.obtain();
4000 Parcel reply = Parcel.obtain();
4001 data.writeInterfaceToken(IActivityManager.descriptor);
4002 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4003 reply.readException();
4004 int res = reply.readInt();
4005 data.recycle();
4006 reply.recycle();
4007 return res;
4008 }
4009 public void setProcessForeground(IBinder token, int pid,
4010 boolean isForeground) throws RemoteException {
4011 Parcel data = Parcel.obtain();
4012 Parcel reply = Parcel.obtain();
4013 data.writeInterfaceToken(IActivityManager.descriptor);
4014 data.writeStrongBinder(token);
4015 data.writeInt(pid);
4016 data.writeInt(isForeground ? 1 : 0);
4017 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4018 reply.readException();
4019 data.recycle();
4020 reply.recycle();
4021 }
4022 public int checkPermission(String permission, int pid, int uid)
4023 throws RemoteException {
4024 Parcel data = Parcel.obtain();
4025 Parcel reply = Parcel.obtain();
4026 data.writeInterfaceToken(IActivityManager.descriptor);
4027 data.writeString(permission);
4028 data.writeInt(pid);
4029 data.writeInt(uid);
4030 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4031 reply.readException();
4032 int res = reply.readInt();
4033 data.recycle();
4034 reply.recycle();
4035 return res;
4036 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004037 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4038 throws RemoteException {
4039 Parcel data = Parcel.obtain();
4040 Parcel reply = Parcel.obtain();
4041 data.writeInterfaceToken(IActivityManager.descriptor);
4042 data.writeString(permission);
4043 data.writeInt(pid);
4044 data.writeInt(uid);
4045 data.writeStrongBinder(callerToken);
4046 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4047 reply.readException();
4048 int res = reply.readInt();
4049 data.recycle();
4050 reply.recycle();
4051 return res;
4052 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004053 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004054 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004055 Parcel data = Parcel.obtain();
4056 Parcel reply = Parcel.obtain();
4057 data.writeInterfaceToken(IActivityManager.descriptor);
4058 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004059 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004060 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004061 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4062 reply.readException();
4063 boolean res = reply.readInt() != 0;
4064 data.recycle();
4065 reply.recycle();
4066 return res;
4067 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004068 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4069 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004070 Parcel data = Parcel.obtain();
4071 Parcel reply = Parcel.obtain();
4072 data.writeInterfaceToken(IActivityManager.descriptor);
4073 uri.writeToParcel(data, 0);
4074 data.writeInt(pid);
4075 data.writeInt(uid);
4076 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004077 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004078 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004079 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4080 reply.readException();
4081 int res = reply.readInt();
4082 data.recycle();
4083 reply.recycle();
4084 return res;
4085 }
4086 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004087 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004088 Parcel data = Parcel.obtain();
4089 Parcel reply = Parcel.obtain();
4090 data.writeInterfaceToken(IActivityManager.descriptor);
4091 data.writeStrongBinder(caller.asBinder());
4092 data.writeString(targetPkg);
4093 uri.writeToParcel(data, 0);
4094 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004095 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004096 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4097 reply.readException();
4098 data.recycle();
4099 reply.recycle();
4100 }
4101 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004102 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004103 Parcel data = Parcel.obtain();
4104 Parcel reply = Parcel.obtain();
4105 data.writeInterfaceToken(IActivityManager.descriptor);
4106 data.writeStrongBinder(caller.asBinder());
4107 uri.writeToParcel(data, 0);
4108 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004109 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004110 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 data.recycle();
4113 reply.recycle();
4114 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004115
4116 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004117 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4118 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004119 Parcel data = Parcel.obtain();
4120 Parcel reply = Parcel.obtain();
4121 data.writeInterfaceToken(IActivityManager.descriptor);
4122 uri.writeToParcel(data, 0);
4123 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004124 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004125 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4126 reply.readException();
4127 data.recycle();
4128 reply.recycle();
4129 }
4130
4131 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004132 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4133 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004134 Parcel data = Parcel.obtain();
4135 Parcel reply = Parcel.obtain();
4136 data.writeInterfaceToken(IActivityManager.descriptor);
4137 uri.writeToParcel(data, 0);
4138 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004139 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004140 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4141 reply.readException();
4142 data.recycle();
4143 reply.recycle();
4144 }
4145
4146 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004147 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4148 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004149 Parcel data = Parcel.obtain();
4150 Parcel reply = Parcel.obtain();
4151 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004152 data.writeString(packageName);
4153 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004154 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4155 reply.readException();
4156 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4157 reply);
4158 data.recycle();
4159 reply.recycle();
4160 return perms;
4161 }
4162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004163 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4164 throws RemoteException {
4165 Parcel data = Parcel.obtain();
4166 Parcel reply = Parcel.obtain();
4167 data.writeInterfaceToken(IActivityManager.descriptor);
4168 data.writeStrongBinder(who.asBinder());
4169 data.writeInt(waiting ? 1 : 0);
4170 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4171 reply.readException();
4172 data.recycle();
4173 reply.recycle();
4174 }
4175 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4176 Parcel data = Parcel.obtain();
4177 Parcel reply = Parcel.obtain();
4178 data.writeInterfaceToken(IActivityManager.descriptor);
4179 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4180 reply.readException();
4181 outInfo.readFromParcel(reply);
4182 data.recycle();
4183 reply.recycle();
4184 }
4185 public void unhandledBack() throws RemoteException
4186 {
4187 Parcel data = Parcel.obtain();
4188 Parcel reply = Parcel.obtain();
4189 data.writeInterfaceToken(IActivityManager.descriptor);
4190 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4191 reply.readException();
4192 data.recycle();
4193 reply.recycle();
4194 }
4195 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4196 {
4197 Parcel data = Parcel.obtain();
4198 Parcel reply = Parcel.obtain();
4199 data.writeInterfaceToken(IActivityManager.descriptor);
4200 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4201 reply.readException();
4202 ParcelFileDescriptor pfd = null;
4203 if (reply.readInt() != 0) {
4204 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4205 }
4206 data.recycle();
4207 reply.recycle();
4208 return pfd;
4209 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004210 public void setLockScreenShown(boolean shown) throws RemoteException
4211 {
4212 Parcel data = Parcel.obtain();
4213 Parcel reply = Parcel.obtain();
4214 data.writeInterfaceToken(IActivityManager.descriptor);
4215 data.writeInt(shown ? 1 : 0);
4216 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4217 reply.readException();
4218 data.recycle();
4219 reply.recycle();
4220 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004221 public void setDebugApp(
4222 String packageName, boolean waitForDebugger, boolean persistent)
4223 throws RemoteException
4224 {
4225 Parcel data = Parcel.obtain();
4226 Parcel reply = Parcel.obtain();
4227 data.writeInterfaceToken(IActivityManager.descriptor);
4228 data.writeString(packageName);
4229 data.writeInt(waitForDebugger ? 1 : 0);
4230 data.writeInt(persistent ? 1 : 0);
4231 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4232 reply.readException();
4233 data.recycle();
4234 reply.recycle();
4235 }
4236 public void setAlwaysFinish(boolean enabled) throws RemoteException
4237 {
4238 Parcel data = Parcel.obtain();
4239 Parcel reply = Parcel.obtain();
4240 data.writeInterfaceToken(IActivityManager.descriptor);
4241 data.writeInt(enabled ? 1 : 0);
4242 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4243 reply.readException();
4244 data.recycle();
4245 reply.recycle();
4246 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004247 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004248 {
4249 Parcel data = Parcel.obtain();
4250 Parcel reply = Parcel.obtain();
4251 data.writeInterfaceToken(IActivityManager.descriptor);
4252 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004253 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004254 reply.readException();
4255 data.recycle();
4256 reply.recycle();
4257 }
4258 public void enterSafeMode() throws RemoteException {
4259 Parcel data = Parcel.obtain();
4260 data.writeInterfaceToken(IActivityManager.descriptor);
4261 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4262 data.recycle();
4263 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004264 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004265 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004266 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004267 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004268 data.writeStrongBinder(sender.asBinder());
4269 data.writeInt(sourceUid);
4270 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004271 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004272 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4273 data.recycle();
4274 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004275 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4276 throws RemoteException {
4277 Parcel data = Parcel.obtain();
4278 data.writeInterfaceToken(IActivityManager.descriptor);
4279 data.writeStrongBinder(sender.asBinder());
4280 data.writeInt(sourceUid);
4281 data.writeString(tag);
4282 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4283 data.recycle();
4284 }
4285 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4286 throws RemoteException {
4287 Parcel data = Parcel.obtain();
4288 data.writeInterfaceToken(IActivityManager.descriptor);
4289 data.writeStrongBinder(sender.asBinder());
4290 data.writeInt(sourceUid);
4291 data.writeString(tag);
4292 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4293 data.recycle();
4294 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004295 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004296 Parcel data = Parcel.obtain();
4297 Parcel reply = Parcel.obtain();
4298 data.writeInterfaceToken(IActivityManager.descriptor);
4299 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004300 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004301 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004302 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004303 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004304 boolean res = reply.readInt() != 0;
4305 data.recycle();
4306 reply.recycle();
4307 return res;
4308 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004309 @Override
4310 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4311 Parcel data = Parcel.obtain();
4312 Parcel reply = Parcel.obtain();
4313 data.writeInterfaceToken(IActivityManager.descriptor);
4314 data.writeString(reason);
4315 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4316 boolean res = reply.readInt() != 0;
4317 data.recycle();
4318 reply.recycle();
4319 return res;
4320 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004321 public boolean testIsSystemReady()
4322 {
4323 /* this base class version is never called */
4324 return true;
4325 }
Dan Egnor60d87622009-12-16 16:32:58 -08004326 public void handleApplicationCrash(IBinder app,
4327 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4328 {
4329 Parcel data = Parcel.obtain();
4330 Parcel reply = Parcel.obtain();
4331 data.writeInterfaceToken(IActivityManager.descriptor);
4332 data.writeStrongBinder(app);
4333 crashInfo.writeToParcel(data, 0);
4334 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4335 reply.readException();
4336 reply.recycle();
4337 data.recycle();
4338 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004339
Dianne Hackborn52322712014-08-26 22:47:26 -07004340 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004341 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004342 {
4343 Parcel data = Parcel.obtain();
4344 Parcel reply = Parcel.obtain();
4345 data.writeInterfaceToken(IActivityManager.descriptor);
4346 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004347 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004348 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004349 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004350 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004351 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004352 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004353 reply.recycle();
4354 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004355 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004356 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004357
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004358 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004359 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004360 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004361 {
4362 Parcel data = Parcel.obtain();
4363 Parcel reply = Parcel.obtain();
4364 data.writeInterfaceToken(IActivityManager.descriptor);
4365 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004366 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004367 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004368 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4369 reply.readException();
4370 reply.recycle();
4371 data.recycle();
4372 }
4373
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004374 public void signalPersistentProcesses(int sig) throws RemoteException {
4375 Parcel data = Parcel.obtain();
4376 Parcel reply = Parcel.obtain();
4377 data.writeInterfaceToken(IActivityManager.descriptor);
4378 data.writeInt(sig);
4379 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4380 reply.readException();
4381 data.recycle();
4382 reply.recycle();
4383 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004384
Dianne Hackborn1676c852012-09-10 14:52:30 -07004385 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004386 Parcel data = Parcel.obtain();
4387 Parcel reply = Parcel.obtain();
4388 data.writeInterfaceToken(IActivityManager.descriptor);
4389 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004390 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004391 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4392 reply.readException();
4393 data.recycle();
4394 reply.recycle();
4395 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004396
4397 public void killAllBackgroundProcesses() throws RemoteException {
4398 Parcel data = Parcel.obtain();
4399 Parcel reply = Parcel.obtain();
4400 data.writeInterfaceToken(IActivityManager.descriptor);
4401 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4402 reply.readException();
4403 data.recycle();
4404 reply.recycle();
4405 }
4406
Dianne Hackborn1676c852012-09-10 14:52:30 -07004407 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004408 Parcel data = Parcel.obtain();
4409 Parcel reply = Parcel.obtain();
4410 data.writeInterfaceToken(IActivityManager.descriptor);
4411 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004412 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004413 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004414 reply.readException();
4415 data.recycle();
4416 reply.recycle();
4417 }
4418
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004419 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4420 throws RemoteException
4421 {
4422 Parcel data = Parcel.obtain();
4423 Parcel reply = Parcel.obtain();
4424 data.writeInterfaceToken(IActivityManager.descriptor);
4425 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4426 reply.readException();
4427 outInfo.readFromParcel(reply);
4428 reply.recycle();
4429 data.recycle();
4430 }
4431
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004432 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4433 {
4434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4438 reply.readException();
4439 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4440 reply.recycle();
4441 data.recycle();
4442 return res;
4443 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004444
Dianne Hackborn1676c852012-09-10 14:52:30 -07004445 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004446 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004447 {
4448 Parcel data = Parcel.obtain();
4449 Parcel reply = Parcel.obtain();
4450 data.writeInterfaceToken(IActivityManager.descriptor);
4451 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004452 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004453 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004454 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004455 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004456 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004457 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004458 } else {
4459 data.writeInt(0);
4460 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004461 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4462 reply.readException();
4463 boolean res = reply.readInt() != 0;
4464 reply.recycle();
4465 data.recycle();
4466 return res;
4467 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004468
Dianne Hackborn55280a92009-05-07 15:53:46 -07004469 public boolean shutdown(int timeout) throws RemoteException
4470 {
4471 Parcel data = Parcel.obtain();
4472 Parcel reply = Parcel.obtain();
4473 data.writeInterfaceToken(IActivityManager.descriptor);
4474 data.writeInt(timeout);
4475 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4476 reply.readException();
4477 boolean res = reply.readInt() != 0;
4478 reply.recycle();
4479 data.recycle();
4480 return res;
4481 }
4482
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004483 public void stopAppSwitches() throws RemoteException {
4484 Parcel data = Parcel.obtain();
4485 Parcel reply = Parcel.obtain();
4486 data.writeInterfaceToken(IActivityManager.descriptor);
4487 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4488 reply.readException();
4489 reply.recycle();
4490 data.recycle();
4491 }
4492
4493 public void resumeAppSwitches() throws RemoteException {
4494 Parcel data = Parcel.obtain();
4495 Parcel reply = Parcel.obtain();
4496 data.writeInterfaceToken(IActivityManager.descriptor);
4497 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4498 reply.readException();
4499 reply.recycle();
4500 data.recycle();
4501 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004502
4503 public void addPackageDependency(String packageName) throws RemoteException {
4504 Parcel data = Parcel.obtain();
4505 Parcel reply = Parcel.obtain();
4506 data.writeInterfaceToken(IActivityManager.descriptor);
4507 data.writeString(packageName);
4508 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4509 reply.readException();
4510 data.recycle();
4511 reply.recycle();
4512 }
4513
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004514 public void killApplicationWithAppId(String pkg, int appid, String reason)
4515 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004516 Parcel data = Parcel.obtain();
4517 Parcel reply = Parcel.obtain();
4518 data.writeInterfaceToken(IActivityManager.descriptor);
4519 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004520 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004521 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004522 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004523 reply.readException();
4524 data.recycle();
4525 reply.recycle();
4526 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004527
4528 public void closeSystemDialogs(String reason) throws RemoteException {
4529 Parcel data = Parcel.obtain();
4530 Parcel reply = Parcel.obtain();
4531 data.writeInterfaceToken(IActivityManager.descriptor);
4532 data.writeString(reason);
4533 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4534 reply.readException();
4535 data.recycle();
4536 reply.recycle();
4537 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004538
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004539 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004540 throws RemoteException {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004544 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004545 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4546 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004547 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004548 data.recycle();
4549 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004550 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004551 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004552
4553 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4554 Parcel data = Parcel.obtain();
4555 Parcel reply = Parcel.obtain();
4556 data.writeInterfaceToken(IActivityManager.descriptor);
4557 data.writeString(processName);
4558 data.writeInt(uid);
4559 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4560 reply.readException();
4561 data.recycle();
4562 reply.recycle();
4563 }
4564
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004565 public void overridePendingTransition(IBinder token, String packageName,
4566 int enterAnim, int exitAnim) throws RemoteException {
4567 Parcel data = Parcel.obtain();
4568 Parcel reply = Parcel.obtain();
4569 data.writeInterfaceToken(IActivityManager.descriptor);
4570 data.writeStrongBinder(token);
4571 data.writeString(packageName);
4572 data.writeInt(enterAnim);
4573 data.writeInt(exitAnim);
4574 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4575 reply.readException();
4576 data.recycle();
4577 reply.recycle();
4578 }
4579
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004580 public boolean isUserAMonkey() throws RemoteException {
4581 Parcel data = Parcel.obtain();
4582 Parcel reply = Parcel.obtain();
4583 data.writeInterfaceToken(IActivityManager.descriptor);
4584 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4585 reply.readException();
4586 boolean res = reply.readInt() != 0;
4587 data.recycle();
4588 reply.recycle();
4589 return res;
4590 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004591
4592 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4593 Parcel data = Parcel.obtain();
4594 Parcel reply = Parcel.obtain();
4595 data.writeInterfaceToken(IActivityManager.descriptor);
4596 data.writeInt(monkey ? 1 : 0);
4597 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4598 reply.readException();
4599 data.recycle();
4600 reply.recycle();
4601 }
4602
Dianne Hackborn860755f2010-06-03 18:47:52 -07004603 public void finishHeavyWeightApp() throws RemoteException {
4604 Parcel data = Parcel.obtain();
4605 Parcel reply = Parcel.obtain();
4606 data.writeInterfaceToken(IActivityManager.descriptor);
4607 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4608 reply.readException();
4609 data.recycle();
4610 reply.recycle();
4611 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004612
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004613 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004614 throws RemoteException {
4615 Parcel data = Parcel.obtain();
4616 Parcel reply = Parcel.obtain();
4617 data.writeInterfaceToken(IActivityManager.descriptor);
4618 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004619 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4620 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004621 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004622 data.recycle();
4623 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004624 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004625 }
4626
Craig Mautner233ceee2014-05-09 17:05:11 -07004627 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004628 throws RemoteException {
4629 Parcel data = Parcel.obtain();
4630 Parcel reply = Parcel.obtain();
4631 data.writeInterfaceToken(IActivityManager.descriptor);
4632 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004633 if (options == null) {
4634 data.writeInt(0);
4635 } else {
4636 data.writeInt(1);
4637 data.writeBundle(options.toBundle());
4638 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004639 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004640 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004641 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004642 data.recycle();
4643 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004644 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004645 }
4646
Craig Mautner233ceee2014-05-09 17:05:11 -07004647 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4648 Parcel data = Parcel.obtain();
4649 Parcel reply = Parcel.obtain();
4650 data.writeInterfaceToken(IActivityManager.descriptor);
4651 data.writeStrongBinder(token);
4652 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4653 reply.readException();
4654 Bundle bundle = reply.readBundle();
4655 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4656 data.recycle();
4657 reply.recycle();
4658 return options;
4659 }
4660
Daniel Sandler69a48172010-06-23 16:29:36 -04004661 public void setImmersive(IBinder token, boolean immersive)
4662 throws RemoteException {
4663 Parcel data = Parcel.obtain();
4664 Parcel reply = Parcel.obtain();
4665 data.writeInterfaceToken(IActivityManager.descriptor);
4666 data.writeStrongBinder(token);
4667 data.writeInt(immersive ? 1 : 0);
4668 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4669 reply.readException();
4670 data.recycle();
4671 reply.recycle();
4672 }
4673
4674 public boolean isImmersive(IBinder token)
4675 throws RemoteException {
4676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 data.writeStrongBinder(token);
4680 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004681 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004682 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004683 data.recycle();
4684 reply.recycle();
4685 return res;
4686 }
4687
Craig Mautnerd61dc202014-07-07 11:09:11 -07004688 public boolean isTopOfTask(IBinder token) throws RemoteException {
4689 Parcel data = Parcel.obtain();
4690 Parcel reply = Parcel.obtain();
4691 data.writeInterfaceToken(IActivityManager.descriptor);
4692 data.writeStrongBinder(token);
4693 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4694 reply.readException();
4695 boolean res = reply.readInt() == 1;
4696 data.recycle();
4697 reply.recycle();
4698 return res;
4699 }
4700
Daniel Sandler69a48172010-06-23 16:29:36 -04004701 public boolean isTopActivityImmersive()
4702 throws RemoteException {
4703 Parcel data = Parcel.obtain();
4704 Parcel reply = Parcel.obtain();
4705 data.writeInterfaceToken(IActivityManager.descriptor);
4706 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004707 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004708 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004709 data.recycle();
4710 reply.recycle();
4711 return res;
4712 }
4713
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004714 public void crashApplication(int uid, int initialPid, String packageName,
4715 String message) throws RemoteException {
4716 Parcel data = Parcel.obtain();
4717 Parcel reply = Parcel.obtain();
4718 data.writeInterfaceToken(IActivityManager.descriptor);
4719 data.writeInt(uid);
4720 data.writeInt(initialPid);
4721 data.writeString(packageName);
4722 data.writeString(message);
4723 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4724 reply.readException();
4725 data.recycle();
4726 reply.recycle();
4727 }
Andy McFadden824c5102010-07-09 16:26:57 -07004728
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004729 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004730 Parcel data = Parcel.obtain();
4731 Parcel reply = Parcel.obtain();
4732 data.writeInterfaceToken(IActivityManager.descriptor);
4733 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004734 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004735 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4736 reply.readException();
4737 String res = reply.readString();
4738 data.recycle();
4739 reply.recycle();
4740 return res;
4741 }
4742
Dianne Hackborn7e269642010-08-25 19:50:20 -07004743 public IBinder newUriPermissionOwner(String name)
4744 throws RemoteException {
4745 Parcel data = Parcel.obtain();
4746 Parcel reply = Parcel.obtain();
4747 data.writeInterfaceToken(IActivityManager.descriptor);
4748 data.writeString(name);
4749 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4750 reply.readException();
4751 IBinder res = reply.readStrongBinder();
4752 data.recycle();
4753 reply.recycle();
4754 return res;
4755 }
4756
4757 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004758 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004759 Parcel data = Parcel.obtain();
4760 Parcel reply = Parcel.obtain();
4761 data.writeInterfaceToken(IActivityManager.descriptor);
4762 data.writeStrongBinder(owner);
4763 data.writeInt(fromUid);
4764 data.writeString(targetPkg);
4765 uri.writeToParcel(data, 0);
4766 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004767 data.writeInt(sourceUserId);
4768 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004769 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4770 reply.readException();
4771 data.recycle();
4772 reply.recycle();
4773 }
4774
4775 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004776 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004777 Parcel data = Parcel.obtain();
4778 Parcel reply = Parcel.obtain();
4779 data.writeInterfaceToken(IActivityManager.descriptor);
4780 data.writeStrongBinder(owner);
4781 if (uri != null) {
4782 data.writeInt(1);
4783 uri.writeToParcel(data, 0);
4784 } else {
4785 data.writeInt(0);
4786 }
4787 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004788 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004789 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4790 reply.readException();
4791 data.recycle();
4792 reply.recycle();
4793 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004794
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004795 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004796 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004797 Parcel data = Parcel.obtain();
4798 Parcel reply = Parcel.obtain();
4799 data.writeInterfaceToken(IActivityManager.descriptor);
4800 data.writeInt(callingUid);
4801 data.writeString(targetPkg);
4802 uri.writeToParcel(data, 0);
4803 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004804 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004805 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4806 reply.readException();
4807 int res = reply.readInt();
4808 data.recycle();
4809 reply.recycle();
4810 return res;
4811 }
4812
Dianne Hackborn1676c852012-09-10 14:52:30 -07004813 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004814 String path, ParcelFileDescriptor fd) throws RemoteException {
4815 Parcel data = Parcel.obtain();
4816 Parcel reply = Parcel.obtain();
4817 data.writeInterfaceToken(IActivityManager.descriptor);
4818 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004819 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004820 data.writeInt(managed ? 1 : 0);
4821 data.writeString(path);
4822 if (fd != null) {
4823 data.writeInt(1);
4824 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4825 } else {
4826 data.writeInt(0);
4827 }
4828 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4829 reply.readException();
4830 boolean res = reply.readInt() != 0;
4831 reply.recycle();
4832 data.recycle();
4833 return res;
4834 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004835
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004836 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004837 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004838 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004839 Parcel data = Parcel.obtain();
4840 Parcel reply = Parcel.obtain();
4841 data.writeInterfaceToken(IActivityManager.descriptor);
4842 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004843 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004844 data.writeTypedArray(intents, 0);
4845 data.writeStringArray(resolvedTypes);
4846 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004847 if (options != null) {
4848 data.writeInt(1);
4849 options.writeToParcel(data, 0);
4850 } else {
4851 data.writeInt(0);
4852 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004853 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004854 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4855 reply.readException();
4856 int result = reply.readInt();
4857 reply.recycle();
4858 data.recycle();
4859 return result;
4860 }
4861
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004862 public int getFrontActivityScreenCompatMode() throws RemoteException {
4863 Parcel data = Parcel.obtain();
4864 Parcel reply = Parcel.obtain();
4865 data.writeInterfaceToken(IActivityManager.descriptor);
4866 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4867 reply.readException();
4868 int mode = reply.readInt();
4869 reply.recycle();
4870 data.recycle();
4871 return mode;
4872 }
4873
4874 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4875 Parcel data = Parcel.obtain();
4876 Parcel reply = Parcel.obtain();
4877 data.writeInterfaceToken(IActivityManager.descriptor);
4878 data.writeInt(mode);
4879 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4880 reply.readException();
4881 reply.recycle();
4882 data.recycle();
4883 }
4884
4885 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4886 Parcel data = Parcel.obtain();
4887 Parcel reply = Parcel.obtain();
4888 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004889 data.writeString(packageName);
4890 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004891 reply.readException();
4892 int mode = reply.readInt();
4893 reply.recycle();
4894 data.recycle();
4895 return mode;
4896 }
4897
4898 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004899 throws RemoteException {
4900 Parcel data = Parcel.obtain();
4901 Parcel reply = Parcel.obtain();
4902 data.writeInterfaceToken(IActivityManager.descriptor);
4903 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004904 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004905 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4906 reply.readException();
4907 reply.recycle();
4908 data.recycle();
4909 }
4910
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004911 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4912 Parcel data = Parcel.obtain();
4913 Parcel reply = Parcel.obtain();
4914 data.writeInterfaceToken(IActivityManager.descriptor);
4915 data.writeString(packageName);
4916 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4917 reply.readException();
4918 boolean ask = reply.readInt() != 0;
4919 reply.recycle();
4920 data.recycle();
4921 return ask;
4922 }
4923
4924 public void setPackageAskScreenCompat(String packageName, boolean ask)
4925 throws RemoteException {
4926 Parcel data = Parcel.obtain();
4927 Parcel reply = Parcel.obtain();
4928 data.writeInterfaceToken(IActivityManager.descriptor);
4929 data.writeString(packageName);
4930 data.writeInt(ask ? 1 : 0);
4931 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4932 reply.readException();
4933 reply.recycle();
4934 data.recycle();
4935 }
4936
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004937 public boolean switchUser(int userid) throws RemoteException {
4938 Parcel data = Parcel.obtain();
4939 Parcel reply = Parcel.obtain();
4940 data.writeInterfaceToken(IActivityManager.descriptor);
4941 data.writeInt(userid);
4942 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4943 reply.readException();
4944 boolean result = reply.readInt() != 0;
4945 reply.recycle();
4946 data.recycle();
4947 return result;
4948 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004949
Kenny Guy08488bf2014-02-21 17:40:37 +00004950 public boolean startUserInBackground(int userid) throws RemoteException {
4951 Parcel data = Parcel.obtain();
4952 Parcel reply = Parcel.obtain();
4953 data.writeInterfaceToken(IActivityManager.descriptor);
4954 data.writeInt(userid);
4955 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4956 reply.readException();
4957 boolean result = reply.readInt() != 0;
4958 reply.recycle();
4959 data.recycle();
4960 return result;
4961 }
4962
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004963 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4964 Parcel data = Parcel.obtain();
4965 Parcel reply = Parcel.obtain();
4966 data.writeInterfaceToken(IActivityManager.descriptor);
4967 data.writeInt(userid);
4968 data.writeStrongInterface(callback);
4969 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4970 reply.readException();
4971 int result = reply.readInt();
4972 reply.recycle();
4973 data.recycle();
4974 return result;
4975 }
4976
Amith Yamasani52f1d752012-03-28 18:19:29 -07004977 public UserInfo getCurrentUser() throws RemoteException {
4978 Parcel data = Parcel.obtain();
4979 Parcel reply = Parcel.obtain();
4980 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004981 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004982 reply.readException();
4983 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4984 reply.recycle();
4985 data.recycle();
4986 return userInfo;
4987 }
4988
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004989 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004990 Parcel data = Parcel.obtain();
4991 Parcel reply = Parcel.obtain();
4992 data.writeInterfaceToken(IActivityManager.descriptor);
4993 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004994 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004995 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4996 reply.readException();
4997 boolean result = reply.readInt() != 0;
4998 reply.recycle();
4999 data.recycle();
5000 return result;
5001 }
5002
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005003 public int[] getRunningUserIds() throws RemoteException {
5004 Parcel data = Parcel.obtain();
5005 Parcel reply = Parcel.obtain();
5006 data.writeInterfaceToken(IActivityManager.descriptor);
5007 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5008 reply.readException();
5009 int[] result = reply.createIntArray();
5010 reply.recycle();
5011 data.recycle();
5012 return result;
5013 }
5014
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005015 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005016 Parcel data = Parcel.obtain();
5017 Parcel reply = Parcel.obtain();
5018 data.writeInterfaceToken(IActivityManager.descriptor);
5019 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005020 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5021 reply.readException();
5022 boolean result = reply.readInt() != 0;
5023 reply.recycle();
5024 data.recycle();
5025 return result;
5026 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005027
Jeff Sharkeya4620792011-05-20 15:29:23 -07005028 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5029 Parcel data = Parcel.obtain();
5030 Parcel reply = Parcel.obtain();
5031 data.writeInterfaceToken(IActivityManager.descriptor);
5032 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5033 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5034 reply.readException();
5035 data.recycle();
5036 reply.recycle();
5037 }
5038
5039 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5040 Parcel data = Parcel.obtain();
5041 Parcel reply = Parcel.obtain();
5042 data.writeInterfaceToken(IActivityManager.descriptor);
5043 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5044 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5045 reply.readException();
5046 data.recycle();
5047 reply.recycle();
5048 }
5049
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005050 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5051 Parcel data = Parcel.obtain();
5052 Parcel reply = Parcel.obtain();
5053 data.writeInterfaceToken(IActivityManager.descriptor);
5054 data.writeStrongBinder(sender.asBinder());
5055 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5056 reply.readException();
5057 boolean res = reply.readInt() != 0;
5058 data.recycle();
5059 reply.recycle();
5060 return res;
5061 }
5062
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005063 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5064 Parcel data = Parcel.obtain();
5065 Parcel reply = Parcel.obtain();
5066 data.writeInterfaceToken(IActivityManager.descriptor);
5067 data.writeStrongBinder(sender.asBinder());
5068 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5069 reply.readException();
5070 boolean res = reply.readInt() != 0;
5071 data.recycle();
5072 reply.recycle();
5073 return res;
5074 }
5075
Dianne Hackborn81038902012-11-26 17:04:09 -08005076 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5077 Parcel data = Parcel.obtain();
5078 Parcel reply = Parcel.obtain();
5079 data.writeInterfaceToken(IActivityManager.descriptor);
5080 data.writeStrongBinder(sender.asBinder());
5081 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5082 reply.readException();
5083 Intent res = reply.readInt() != 0
5084 ? Intent.CREATOR.createFromParcel(reply) : null;
5085 data.recycle();
5086 reply.recycle();
5087 return res;
5088 }
5089
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005090 public String getTagForIntentSender(IIntentSender sender, String prefix)
5091 throws RemoteException {
5092 Parcel data = Parcel.obtain();
5093 Parcel reply = Parcel.obtain();
5094 data.writeInterfaceToken(IActivityManager.descriptor);
5095 data.writeStrongBinder(sender.asBinder());
5096 data.writeString(prefix);
5097 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5098 reply.readException();
5099 String res = reply.readString();
5100 data.recycle();
5101 reply.recycle();
5102 return res;
5103 }
5104
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005105 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5106 {
5107 Parcel data = Parcel.obtain();
5108 Parcel reply = Parcel.obtain();
5109 data.writeInterfaceToken(IActivityManager.descriptor);
5110 values.writeToParcel(data, 0);
5111 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5112 reply.readException();
5113 data.recycle();
5114 reply.recycle();
5115 }
5116
Dianne Hackbornb437e092011-08-05 17:50:29 -07005117 public long[] getProcessPss(int[] pids) throws RemoteException {
5118 Parcel data = Parcel.obtain();
5119 Parcel reply = Parcel.obtain();
5120 data.writeInterfaceToken(IActivityManager.descriptor);
5121 data.writeIntArray(pids);
5122 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5123 reply.readException();
5124 long[] res = reply.createLongArray();
5125 data.recycle();
5126 reply.recycle();
5127 return res;
5128 }
5129
Dianne Hackborn661cd522011-08-22 00:26:20 -07005130 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5131 Parcel data = Parcel.obtain();
5132 Parcel reply = Parcel.obtain();
5133 data.writeInterfaceToken(IActivityManager.descriptor);
5134 TextUtils.writeToParcel(msg, data, 0);
5135 data.writeInt(always ? 1 : 0);
5136 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5137 reply.readException();
5138 data.recycle();
5139 reply.recycle();
5140 }
5141
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005142 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005143 Parcel data = Parcel.obtain();
5144 Parcel reply = Parcel.obtain();
5145 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005146 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005147 reply.readException();
5148 data.recycle();
5149 reply.recycle();
5150 }
5151
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005152 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005153 throws RemoteException {
5154 Parcel data = Parcel.obtain();
5155 Parcel reply = Parcel.obtain();
5156 data.writeInterfaceToken(IActivityManager.descriptor);
5157 data.writeStrongBinder(token);
5158 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005159 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005160 reply.readException();
5161 boolean result = reply.readInt() != 0;
5162 data.recycle();
5163 reply.recycle();
5164 return result;
5165 }
5166
5167 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5168 throws RemoteException {
5169 Parcel data = Parcel.obtain();
5170 Parcel reply = Parcel.obtain();
5171 data.writeInterfaceToken(IActivityManager.descriptor);
5172 data.writeStrongBinder(token);
5173 target.writeToParcel(data, 0);
5174 data.writeInt(resultCode);
5175 if (resultData != null) {
5176 data.writeInt(1);
5177 resultData.writeToParcel(data, 0);
5178 } else {
5179 data.writeInt(0);
5180 }
5181 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5182 reply.readException();
5183 boolean result = reply.readInt() != 0;
5184 data.recycle();
5185 reply.recycle();
5186 return result;
5187 }
5188
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005189 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5190 Parcel data = Parcel.obtain();
5191 Parcel reply = Parcel.obtain();
5192 data.writeInterfaceToken(IActivityManager.descriptor);
5193 data.writeStrongBinder(activityToken);
5194 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5195 reply.readException();
5196 int result = reply.readInt();
5197 data.recycle();
5198 reply.recycle();
5199 return result;
5200 }
5201
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005202 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5203 Parcel data = Parcel.obtain();
5204 Parcel reply = Parcel.obtain();
5205 data.writeInterfaceToken(IActivityManager.descriptor);
5206 data.writeStrongBinder(activityToken);
5207 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5208 reply.readException();
5209 String result = reply.readString();
5210 data.recycle();
5211 reply.recycle();
5212 return result;
5213 }
5214
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005215 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5216 Parcel data = Parcel.obtain();
5217 Parcel reply = Parcel.obtain();
5218 data.writeInterfaceToken(IActivityManager.descriptor);
5219 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5220 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5221 reply.readException();
5222 data.recycle();
5223 reply.recycle();
5224 }
5225
5226 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5227 Parcel data = Parcel.obtain();
5228 Parcel reply = Parcel.obtain();
5229 data.writeInterfaceToken(IActivityManager.descriptor);
5230 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5231 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5232 reply.readException();
5233 data.recycle();
5234 reply.recycle();
5235 }
5236
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005237 public void requestBugReport() throws RemoteException {
5238 Parcel data = Parcel.obtain();
5239 Parcel reply = Parcel.obtain();
5240 data.writeInterfaceToken(IActivityManager.descriptor);
5241 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5242 reply.readException();
5243 data.recycle();
5244 reply.recycle();
5245 }
5246
Jeff Brownbd181bb2013-09-10 16:44:24 -07005247 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5248 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005249 Parcel data = Parcel.obtain();
5250 Parcel reply = Parcel.obtain();
5251 data.writeInterfaceToken(IActivityManager.descriptor);
5252 data.writeInt(pid);
5253 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005254 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005255 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5256 reply.readException();
5257 long res = reply.readInt();
5258 data.recycle();
5259 reply.recycle();
5260 return res;
5261 }
5262
Adam Skorydfc7fd72013-08-05 19:23:41 -07005263 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005264 Parcel data = Parcel.obtain();
5265 Parcel reply = Parcel.obtain();
5266 data.writeInterfaceToken(IActivityManager.descriptor);
5267 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005268 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005269 reply.readException();
5270 Bundle res = reply.readBundle();
5271 data.recycle();
5272 reply.recycle();
5273 return res;
5274 }
5275
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005276 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5277 throws RemoteException {
5278 Parcel data = Parcel.obtain();
5279 Parcel reply = Parcel.obtain();
5280 data.writeInterfaceToken(IActivityManager.descriptor);
5281 data.writeInt(requestType);
5282 data.writeStrongBinder(receiver.asBinder());
5283 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5284 reply.readException();
5285 data.recycle();
5286 reply.recycle();
5287 }
5288
Adam Skory7140a252013-09-11 12:04:58 +01005289 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005290 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005291 Parcel data = Parcel.obtain();
5292 Parcel reply = Parcel.obtain();
5293 data.writeInterfaceToken(IActivityManager.descriptor);
5294 data.writeStrongBinder(token);
5295 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005296 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005297 reply.readException();
5298 data.recycle();
5299 reply.recycle();
5300 }
5301
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005302 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5303 throws RemoteException {
5304 Parcel data = Parcel.obtain();
5305 Parcel reply = Parcel.obtain();
5306 data.writeInterfaceToken(IActivityManager.descriptor);
5307 intent.writeToParcel(data, 0);
5308 data.writeInt(requestType);
5309 data.writeString(hint);
5310 data.writeInt(userHandle);
5311 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5312 reply.readException();
5313 boolean res = reply.readInt() != 0;
5314 data.recycle();
5315 reply.recycle();
5316 return res;
5317 }
5318
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005319 public void killUid(int uid, String reason) throws RemoteException {
5320 Parcel data = Parcel.obtain();
5321 Parcel reply = Parcel.obtain();
5322 data.writeInterfaceToken(IActivityManager.descriptor);
5323 data.writeInt(uid);
5324 data.writeString(reason);
5325 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5326 reply.readException();
5327 data.recycle();
5328 reply.recycle();
5329 }
5330
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005331 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5332 Parcel data = Parcel.obtain();
5333 Parcel reply = Parcel.obtain();
5334 data.writeInterfaceToken(IActivityManager.descriptor);
5335 data.writeStrongBinder(who);
5336 data.writeInt(allowRestart ? 1 : 0);
5337 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5338 reply.readException();
5339 data.recycle();
5340 reply.recycle();
5341 }
5342
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005343 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5344 Parcel data = Parcel.obtain();
5345 Parcel reply = Parcel.obtain();
5346 data.writeInterfaceToken(IActivityManager.descriptor);
5347 data.writeStrongBinder(token);
5348 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5349 reply.readException();
5350 data.recycle();
5351 reply.recycle();
5352 }
5353
Craig Mautner5eda9b32013-07-02 11:58:16 -07005354 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5355 Parcel data = Parcel.obtain();
5356 Parcel reply = Parcel.obtain();
5357 data.writeInterfaceToken(IActivityManager.descriptor);
5358 data.writeStrongBinder(token);
5359 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5360 reply.readException();
5361 data.recycle();
5362 reply.recycle();
5363 }
5364
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005365 public void restart() throws RemoteException {
5366 Parcel data = Parcel.obtain();
5367 Parcel reply = Parcel.obtain();
5368 data.writeInterfaceToken(IActivityManager.descriptor);
5369 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5370 reply.readException();
5371 data.recycle();
5372 reply.recycle();
5373 }
5374
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005375 public void performIdleMaintenance() throws RemoteException {
5376 Parcel data = Parcel.obtain();
5377 Parcel reply = Parcel.obtain();
5378 data.writeInterfaceToken(IActivityManager.descriptor);
5379 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5380 reply.readException();
5381 data.recycle();
5382 reply.recycle();
5383 }
5384
Todd Kennedyca4d8422015-01-15 15:19:22 -08005385 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005386 IActivityContainerCallback callback) throws RemoteException {
5387 Parcel data = Parcel.obtain();
5388 Parcel reply = Parcel.obtain();
5389 data.writeInterfaceToken(IActivityManager.descriptor);
5390 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005391 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005392 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005393 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005394 final int result = reply.readInt();
5395 final IActivityContainer res;
5396 if (result == 1) {
5397 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5398 } else {
5399 res = null;
5400 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005401 data.recycle();
5402 reply.recycle();
5403 return res;
5404 }
5405
Craig Mautner95da1082014-02-24 17:54:35 -08005406 public void deleteActivityContainer(IActivityContainer activityContainer)
5407 throws RemoteException {
5408 Parcel data = Parcel.obtain();
5409 Parcel reply = Parcel.obtain();
5410 data.writeInterfaceToken(IActivityManager.descriptor);
5411 data.writeStrongBinder(activityContainer.asBinder());
5412 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5413 reply.readException();
5414 data.recycle();
5415 reply.recycle();
5416 }
5417
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005418 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005419 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5420 Parcel data = Parcel.obtain();
5421 Parcel reply = Parcel.obtain();
5422 data.writeInterfaceToken(IActivityManager.descriptor);
5423 data.writeInt(displayId);
5424 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5425 reply.readException();
5426 final int result = reply.readInt();
5427 final IActivityContainer res;
5428 if (result == 1) {
5429 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5430 } else {
5431 res = null;
5432 }
5433 data.recycle();
5434 reply.recycle();
5435 return res;
5436 }
5437
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005438 @Override
5439 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005440 throws RemoteException {
5441 Parcel data = Parcel.obtain();
5442 Parcel reply = Parcel.obtain();
5443 data.writeInterfaceToken(IActivityManager.descriptor);
5444 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005445 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005446 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005447 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005448 data.recycle();
5449 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005450 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005451 }
5452
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005453 @Override
Craig Mautner4a1cb222013-12-04 16:14:06 -08005454 public IBinder getHomeActivityToken() throws RemoteException {
5455 Parcel data = Parcel.obtain();
5456 Parcel reply = Parcel.obtain();
5457 data.writeInterfaceToken(IActivityManager.descriptor);
5458 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5459 reply.readException();
5460 IBinder res = reply.readStrongBinder();
5461 data.recycle();
5462 reply.recycle();
5463 return res;
5464 }
5465
Craig Mautneraea74a52014-03-08 14:23:10 -08005466 @Override
5467 public void startLockTaskMode(int taskId) throws RemoteException {
5468 Parcel data = Parcel.obtain();
5469 Parcel reply = Parcel.obtain();
5470 data.writeInterfaceToken(IActivityManager.descriptor);
5471 data.writeInt(taskId);
5472 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5473 reply.readException();
5474 data.recycle();
5475 reply.recycle();
5476 }
5477
5478 @Override
5479 public void startLockTaskMode(IBinder token) throws RemoteException {
5480 Parcel data = Parcel.obtain();
5481 Parcel reply = Parcel.obtain();
5482 data.writeInterfaceToken(IActivityManager.descriptor);
5483 data.writeStrongBinder(token);
5484 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5485 reply.readException();
5486 data.recycle();
5487 reply.recycle();
5488 }
5489
5490 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005491 public void startLockTaskModeOnCurrent() throws RemoteException {
5492 Parcel data = Parcel.obtain();
5493 Parcel reply = Parcel.obtain();
5494 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005495 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005496 reply.readException();
5497 data.recycle();
5498 reply.recycle();
5499 }
5500
5501 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005502 public void stopLockTaskMode() throws RemoteException {
5503 Parcel data = Parcel.obtain();
5504 Parcel reply = Parcel.obtain();
5505 data.writeInterfaceToken(IActivityManager.descriptor);
5506 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5507 reply.readException();
5508 data.recycle();
5509 reply.recycle();
5510 }
5511
5512 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005513 public void stopLockTaskModeOnCurrent() throws RemoteException {
5514 Parcel data = Parcel.obtain();
5515 Parcel reply = Parcel.obtain();
5516 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005517 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005518 reply.readException();
5519 data.recycle();
5520 reply.recycle();
5521 }
5522
5523 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005524 public boolean isInLockTaskMode() throws RemoteException {
5525 Parcel data = Parcel.obtain();
5526 Parcel reply = Parcel.obtain();
5527 data.writeInterfaceToken(IActivityManager.descriptor);
5528 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5529 reply.readException();
5530 boolean isInLockTaskMode = reply.readInt() == 1;
5531 data.recycle();
5532 reply.recycle();
5533 return isInLockTaskMode;
5534 }
5535
Craig Mautner688b5102014-03-27 16:55:03 -07005536 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005537 public int getLockTaskModeState() throws RemoteException {
5538 Parcel data = Parcel.obtain();
5539 Parcel reply = Parcel.obtain();
5540 data.writeInterfaceToken(IActivityManager.descriptor);
5541 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5542 reply.readException();
5543 int lockTaskModeState = reply.readInt();
5544 data.recycle();
5545 reply.recycle();
5546 return lockTaskModeState;
5547 }
5548
5549 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005550 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005551 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005552 Parcel data = Parcel.obtain();
5553 Parcel reply = Parcel.obtain();
5554 data.writeInterfaceToken(IActivityManager.descriptor);
5555 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005556 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005557 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005558 reply.readException();
5559 data.recycle();
5560 reply.recycle();
5561 }
5562
Craig Mautneree2e45a2014-06-27 12:10:03 -07005563 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005564 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5565 Parcel data = Parcel.obtain();
5566 Parcel reply = Parcel.obtain();
5567 data.writeInterfaceToken(IActivityManager.descriptor);
5568 data.writeInt(taskId);
5569 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005570 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005571 reply.readException();
5572 data.recycle();
5573 reply.recycle();
5574 }
5575
5576 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005577 public void resizeTask(int taskId, Rect r) throws RemoteException
5578 {
5579 Parcel data = Parcel.obtain();
5580 Parcel reply = Parcel.obtain();
5581 data.writeInterfaceToken(IActivityManager.descriptor);
5582 data.writeInt(taskId);
5583 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005584 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005585 reply.readException();
5586 data.recycle();
5587 reply.recycle();
5588 }
5589
5590 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005591 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5592 Parcel data = Parcel.obtain();
5593 Parcel reply = Parcel.obtain();
5594 data.writeInterfaceToken(IActivityManager.descriptor);
5595 data.writeString(filename);
5596 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5597 reply.readException();
5598 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5599 data.recycle();
5600 reply.recycle();
5601 return icon;
5602 }
5603
5604 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005605 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5606 throws RemoteException {
5607 Parcel data = Parcel.obtain();
5608 Parcel reply = Parcel.obtain();
5609 data.writeInterfaceToken(IActivityManager.descriptor);
5610 if (options == null) {
5611 data.writeInt(0);
5612 } else {
5613 data.writeInt(1);
5614 data.writeBundle(options.toBundle());
5615 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005616 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005617 reply.readException();
5618 data.recycle();
5619 reply.recycle();
5620 }
5621
5622 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005623 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005624 Parcel data = Parcel.obtain();
5625 Parcel reply = Parcel.obtain();
5626 data.writeInterfaceToken(IActivityManager.descriptor);
5627 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005628 data.writeInt(visible ? 1 : 0);
5629 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005630 reply.readException();
5631 boolean success = reply.readInt() > 0;
5632 data.recycle();
5633 reply.recycle();
5634 return success;
5635 }
5636
5637 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005638 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005639 Parcel data = Parcel.obtain();
5640 Parcel reply = Parcel.obtain();
5641 data.writeInterfaceToken(IActivityManager.descriptor);
5642 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005643 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005644 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005645 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005646 data.recycle();
5647 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005648 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005649 }
5650
5651 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005652 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005653 Parcel data = Parcel.obtain();
5654 Parcel reply = Parcel.obtain();
5655 data.writeInterfaceToken(IActivityManager.descriptor);
5656 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005657 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005658 reply.readException();
5659 data.recycle();
5660 reply.recycle();
5661 }
5662
5663 @Override
5664 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5665 Parcel data = Parcel.obtain();
5666 Parcel reply = Parcel.obtain();
5667 data.writeInterfaceToken(IActivityManager.descriptor);
5668 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005669 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005670 reply.readException();
5671 data.recycle();
5672 reply.recycle();
5673 }
5674
Craig Mautner8746a472014-07-24 15:12:54 -07005675 @Override
5676 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5677 Parcel data = Parcel.obtain();
5678 Parcel reply = Parcel.obtain();
5679 data.writeInterfaceToken(IActivityManager.descriptor);
5680 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005681 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005682 reply.readException();
5683 data.recycle();
5684 reply.recycle();
5685 }
5686
Craig Mautner6e2f3952014-09-09 14:26:41 -07005687 @Override
5688 public void bootAnimationComplete() throws RemoteException {
5689 Parcel data = Parcel.obtain();
5690 Parcel reply = Parcel.obtain();
5691 data.writeInterfaceToken(IActivityManager.descriptor);
5692 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5693 reply.readException();
5694 data.recycle();
5695 reply.recycle();
5696 }
5697
Wale Ogunwale18795a22014-12-03 11:38:33 -08005698 @Override
5699 public void systemBackupRestored() throws RemoteException {
5700 Parcel data = Parcel.obtain();
5701 Parcel reply = Parcel.obtain();
5702 data.writeInterfaceToken(IActivityManager.descriptor);
5703 mRemote.transact(SYSTEM_BACKUP_RESTORED, data, reply, 0);
5704 reply.readException();
5705 data.recycle();
5706 reply.recycle();
5707 }
5708
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08005709 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005710 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5711 Parcel data = Parcel.obtain();
5712 Parcel reply = Parcel.obtain();
5713 data.writeInterfaceToken(IActivityManager.descriptor);
5714 data.writeInt(uid);
5715 data.writeByteArray(firstPacket);
5716 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5717 reply.readException();
5718 data.recycle();
5719 reply.recycle();
5720 }
5721
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005722 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005723 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5724 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005725 Parcel data = Parcel.obtain();
5726 Parcel reply = Parcel.obtain();
5727 data.writeInterfaceToken(IActivityManager.descriptor);
5728 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005729 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005730 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005731 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005732 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5733 reply.readException();
5734 data.recycle();
5735 reply.recycle();
5736 }
5737
5738 @Override
5739 public void dumpHeapFinished(String path) throws RemoteException {
5740 Parcel data = Parcel.obtain();
5741 Parcel reply = Parcel.obtain();
5742 data.writeInterfaceToken(IActivityManager.descriptor);
5743 data.writeString(path);
5744 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5745 reply.readException();
5746 data.recycle();
5747 reply.recycle();
5748 }
5749
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005750 @Override
5751 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5752 throws RemoteException {
5753 Parcel data = Parcel.obtain();
5754 Parcel reply = Parcel.obtain();
5755 data.writeInterfaceToken(IActivityManager.descriptor);
5756 data.writeStrongBinder(session.asBinder());
5757 data.writeInt(keepAwake ? 1 : 0);
5758 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5759 reply.readException();
5760 data.recycle();
5761 reply.recycle();
5762 }
5763
Craig Mautnere5600772015-04-03 21:36:37 -07005764 @Override
5765 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5766 Parcel data = Parcel.obtain();
5767 Parcel reply = Parcel.obtain();
5768 data.writeInterfaceToken(IActivityManager.descriptor);
5769 data.writeInt(userId);
5770 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005771 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005772 reply.readException();
5773 data.recycle();
5774 reply.recycle();
5775 }
5776
Dianne Hackborn1e383822015-04-10 14:02:33 -07005777 @Override
5778 public int getPackageProcessState(String packageName) throws RemoteException {
5779 Parcel data = Parcel.obtain();
5780 Parcel reply = Parcel.obtain();
5781 data.writeInterfaceToken(IActivityManager.descriptor);
5782 data.writeString(packageName);
5783 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5784 reply.readException();
5785 int res = reply.readInt();
5786 data.recycle();
5787 reply.recycle();
5788 return res;
5789 }
5790
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005791 private IBinder mRemote;
5792}