blob: 88dbbd95a733828f1f19b2d39dc511742abbb083 [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;
Jeff Hao1b012d32014-08-20 10:35:34 -070020import android.app.ProfilerInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070022import android.content.IIntentReceiver;
23import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.Intent;
25import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070026import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070027import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070028import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.ConfigurationInfo;
30import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070031import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070032import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070034import android.graphics.Bitmap;
35import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080036import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.net.Uri;
38import android.os.Binder;
39import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070040import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.IBinder;
42import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070043import android.os.ParcelFileDescriptor;
44import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070045import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070046import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070048import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070049import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080052import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070053import com.android.internal.app.IVoiceInteractor;
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 Hackborn099bc622014-01-22 13:39:16 -0800109 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800111 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800116 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 attachInterface(this, descriptor);
118 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700119
120 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
122 throws RemoteException {
123 switch (code) {
124 case START_ACTIVITY_TRANSACTION:
125 {
126 data.enforceInterface(IActivityManager.descriptor);
127 IBinder b = data.readStrongBinder();
128 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800129 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 Intent intent = Intent.CREATOR.createFromParcel(data);
131 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800133 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700135 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700136 ProfilerInfo profilerInfo = data.readInt() != 0
137 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700138 Bundle options = data.readInt() != 0
139 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800140 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700141 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700165 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700166 reply.writeNoException();
167 reply.writeInt(result);
168 return true;
169 }
170
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700171 case START_ACTIVITY_AS_CALLER_TRANSACTION:
172 {
173 data.enforceInterface(IActivityManager.descriptor);
174 IBinder b = data.readStrongBinder();
175 IApplicationThread app = ApplicationThreadNative.asInterface(b);
176 String callingPackage = data.readString();
177 Intent intent = Intent.CREATOR.createFromParcel(data);
178 String resolvedType = data.readString();
179 IBinder resultTo = data.readStrongBinder();
180 String resultWho = data.readString();
181 int requestCode = data.readInt();
182 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700183 ProfilerInfo profilerInfo = data.readInt() != 0
184 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
Jeff Sharkey97978802014-10-14 10:48:18 -0700187 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700188 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Sharkey97978802014-10-14 10:48:18 -0700189 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700190 reply.writeNoException();
191 reply.writeInt(result);
192 return true;
193 }
194
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800195 case START_ACTIVITY_AND_WAIT_TRANSACTION:
196 {
197 data.enforceInterface(IActivityManager.descriptor);
198 IBinder b = data.readStrongBinder();
199 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800200 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800201 Intent intent = Intent.CREATOR.createFromParcel(data);
202 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800203 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800204 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800205 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700206 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700207 ProfilerInfo profilerInfo = data.readInt() != 0
208 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700209 Bundle options = data.readInt() != 0
210 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700211 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800212 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800214 reply.writeNoException();
215 result.writeToParcel(reply, 0);
216 return true;
217 }
218
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700219 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
220 {
221 data.enforceInterface(IActivityManager.descriptor);
222 IBinder b = data.readStrongBinder();
223 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800224 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700225 Intent intent = Intent.CREATOR.createFromParcel(data);
226 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700227 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700228 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700229 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700231 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700232 Bundle options = data.readInt() != 0
233 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700234 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800235 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700236 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700237 reply.writeNoException();
238 reply.writeInt(result);
239 return true;
240 }
241
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700242 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700243 {
244 data.enforceInterface(IActivityManager.descriptor);
245 IBinder b = data.readStrongBinder();
246 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700247 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700248 Intent fillInIntent = null;
249 if (data.readInt() != 0) {
250 fillInIntent = Intent.CREATOR.createFromParcel(data);
251 }
252 String resolvedType = data.readString();
253 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700254 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700255 int requestCode = data.readInt();
256 int flagsMask = data.readInt();
257 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700258 Bundle options = data.readInt() != 0
259 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700260 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700261 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700262 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700263 reply.writeNoException();
264 reply.writeInt(result);
265 return true;
266 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700267
Dianne Hackborn91097de2014-04-04 18:02:06 -0700268 case START_VOICE_ACTIVITY_TRANSACTION:
269 {
270 data.enforceInterface(IActivityManager.descriptor);
271 String callingPackage = data.readString();
272 int callingPid = data.readInt();
273 int callingUid = data.readInt();
274 Intent intent = Intent.CREATOR.createFromParcel(data);
275 String resolvedType = data.readString();
276 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
277 data.readStrongBinder());
278 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
279 data.readStrongBinder());
280 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700281 ProfilerInfo profilerInfo = data.readInt() != 0
282 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
285 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700286 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
287 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
292
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 IBinder callingActivity = data.readStrongBinder();
297 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700298 Bundle options = data.readInt() != 0
299 ? Bundle.CREATOR.createFromParcel(data) : null;
300 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 reply.writeNoException();
302 reply.writeInt(result ? 1 : 0);
303 return true;
304 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700305
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700306 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
307 {
308 data.enforceInterface(IActivityManager.descriptor);
309 int taskId = data.readInt();
310 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
311 int result = startActivityFromRecents(taskId, options);
312 reply.writeNoException();
313 reply.writeInt(result);
314 return true;
315 }
316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 case FINISH_ACTIVITY_TRANSACTION: {
318 data.enforceInterface(IActivityManager.descriptor);
319 IBinder token = data.readStrongBinder();
320 Intent resultData = null;
321 int resultCode = data.readInt();
322 if (data.readInt() != 0) {
323 resultData = Intent.CREATOR.createFromParcel(data);
324 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700325 boolean finishTask = (data.readInt() != 0);
326 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 reply.writeNoException();
328 reply.writeInt(res ? 1 : 0);
329 return true;
330 }
331
332 case FINISH_SUB_ACTIVITY_TRANSACTION: {
333 data.enforceInterface(IActivityManager.descriptor);
334 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700335 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336 int requestCode = data.readInt();
337 finishSubActivity(token, resultWho, requestCode);
338 reply.writeNoException();
339 return true;
340 }
341
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700342 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
343 data.enforceInterface(IActivityManager.descriptor);
344 IBinder token = data.readStrongBinder();
345 boolean res = finishActivityAffinity(token);
346 reply.writeNoException();
347 reply.writeInt(res ? 1 : 0);
348 return true;
349 }
350
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700351 case FINISH_VOICE_TASK_TRANSACTION: {
352 data.enforceInterface(IActivityManager.descriptor);
353 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
354 data.readStrongBinder());
355 finishVoiceTask(session);
356 reply.writeNoException();
357 return true;
358 }
359
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700360 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
361 data.enforceInterface(IActivityManager.descriptor);
362 IBinder token = data.readStrongBinder();
363 boolean res = releaseActivityInstance(token);
364 reply.writeNoException();
365 reply.writeInt(res ? 1 : 0);
366 return true;
367 }
368
369 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
372 releaseSomeActivities(app);
373 reply.writeNoException();
374 return true;
375 }
376
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800377 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
378 data.enforceInterface(IActivityManager.descriptor);
379 IBinder token = data.readStrongBinder();
380 boolean res = willActivityBeVisible(token);
381 reply.writeNoException();
382 reply.writeInt(res ? 1 : 0);
383 return true;
384 }
385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 case REGISTER_RECEIVER_TRANSACTION:
387 {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder b = data.readStrongBinder();
390 IApplicationThread app =
391 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700392 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 b = data.readStrongBinder();
394 IIntentReceiver rec
395 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
396 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
397 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700398 int userId = data.readInt();
399 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 reply.writeNoException();
401 if (intent != null) {
402 reply.writeInt(1);
403 intent.writeToParcel(reply, 0);
404 } else {
405 reply.writeInt(0);
406 }
407 return true;
408 }
409
410 case UNREGISTER_RECEIVER_TRANSACTION:
411 {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder b = data.readStrongBinder();
414 if (b == null) {
415 return true;
416 }
417 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
418 unregisterReceiver(rec);
419 reply.writeNoException();
420 return true;
421 }
422
423 case BROADCAST_INTENT_TRANSACTION:
424 {
425 data.enforceInterface(IActivityManager.descriptor);
426 IBinder b = data.readStrongBinder();
427 IApplicationThread app =
428 b != null ? ApplicationThreadNative.asInterface(b) : null;
429 Intent intent = Intent.CREATOR.createFromParcel(data);
430 String resolvedType = data.readString();
431 b = data.readStrongBinder();
432 IIntentReceiver resultTo =
433 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
434 int resultCode = data.readInt();
435 String resultData = data.readString();
436 Bundle resultExtras = data.readBundle();
437 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800438 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 boolean serialized = data.readInt() != 0;
440 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700441 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800443 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700444 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800445 reply.writeNoException();
446 reply.writeInt(res);
447 return true;
448 }
449
450 case UNBROADCAST_INTENT_TRANSACTION:
451 {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder b = data.readStrongBinder();
454 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
455 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700456 int userId = data.readInt();
457 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 reply.writeNoException();
459 return true;
460 }
461
462 case FINISH_RECEIVER_TRANSACTION: {
463 data.enforceInterface(IActivityManager.descriptor);
464 IBinder who = data.readStrongBinder();
465 int resultCode = data.readInt();
466 String resultData = data.readString();
467 Bundle resultExtras = data.readBundle();
468 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800469 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800471 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 }
473 reply.writeNoException();
474 return true;
475 }
476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 case ATTACH_APPLICATION_TRANSACTION: {
478 data.enforceInterface(IActivityManager.descriptor);
479 IApplicationThread app = ApplicationThreadNative.asInterface(
480 data.readStrongBinder());
481 if (app != null) {
482 attachApplication(app);
483 }
484 reply.writeNoException();
485 return true;
486 }
487
488 case ACTIVITY_IDLE_TRANSACTION: {
489 data.enforceInterface(IActivityManager.descriptor);
490 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700491 Configuration config = null;
492 if (data.readInt() != 0) {
493 config = Configuration.CREATOR.createFromParcel(data);
494 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700495 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700497 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 }
499 reply.writeNoException();
500 return true;
501 }
502
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700503 case ACTIVITY_RESUMED_TRANSACTION: {
504 data.enforceInterface(IActivityManager.descriptor);
505 IBinder token = data.readStrongBinder();
506 activityResumed(token);
507 reply.writeNoException();
508 return true;
509 }
510
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 case ACTIVITY_PAUSED_TRANSACTION: {
512 data.enforceInterface(IActivityManager.descriptor);
513 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700514 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800515 reply.writeNoException();
516 return true;
517 }
518
519 case ACTIVITY_STOPPED_TRANSACTION: {
520 data.enforceInterface(IActivityManager.descriptor);
521 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800522 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700523 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700525 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 reply.writeNoException();
527 return true;
528 }
529
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800530 case ACTIVITY_SLEPT_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 IBinder token = data.readStrongBinder();
533 activitySlept(token);
534 reply.writeNoException();
535 return true;
536 }
537
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 case ACTIVITY_DESTROYED_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 IBinder token = data.readStrongBinder();
541 activityDestroyed(token);
542 reply.writeNoException();
543 return true;
544 }
545
546 case GET_CALLING_PACKAGE_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
549 String res = token != null ? getCallingPackage(token) : null;
550 reply.writeNoException();
551 reply.writeString(res);
552 return true;
553 }
554
555 case GET_CALLING_ACTIVITY_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 ComponentName cn = getCallingActivity(token);
559 reply.writeNoException();
560 ComponentName.writeToParcel(cn, reply);
561 return true;
562 }
563
Winson Chung1147c402014-05-14 11:05:00 -0700564 case GET_APP_TASKS_TRANSACTION: {
565 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700566 String callingPackage = data.readString();
567 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700568 reply.writeNoException();
569 int N = list != null ? list.size() : -1;
570 reply.writeInt(N);
571 int i;
572 for (i=0; i<N; i++) {
573 IAppTask task = list.get(i);
574 reply.writeStrongBinder(task.asBinder());
575 }
576 return true;
577 }
578
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700579 case ADD_APP_TASK_TRANSACTION: {
580 data.enforceInterface(IActivityManager.descriptor);
581 IBinder activityToken = data.readStrongBinder();
582 Intent intent = Intent.CREATOR.createFromParcel(data);
583 ActivityManager.TaskDescription descr
584 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
585 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
586 int res = addAppTask(activityToken, intent, descr, thumbnail);
587 reply.writeNoException();
588 reply.writeInt(res);
589 return true;
590 }
591
592 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
594 Point size = getAppTaskThumbnailSize();
595 reply.writeNoException();
596 size.writeToParcel(reply, 0);
597 return true;
598 }
599
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800600 case GET_TASKS_TRANSACTION: {
601 data.enforceInterface(IActivityManager.descriptor);
602 int maxNum = data.readInt();
603 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700604 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 reply.writeNoException();
606 int N = list != null ? list.size() : -1;
607 reply.writeInt(N);
608 int i;
609 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700610 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 info.writeToParcel(reply, 0);
612 }
613 return true;
614 }
615
616 case GET_RECENT_TASKS_TRANSACTION: {
617 data.enforceInterface(IActivityManager.descriptor);
618 int maxNum = data.readInt();
619 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700620 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700622 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 reply.writeNoException();
624 reply.writeTypedList(list);
625 return true;
626 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700627
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700628 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800629 data.enforceInterface(IActivityManager.descriptor);
630 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700631 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800632 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700633 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800634 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700635 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700636 } else {
637 reply.writeInt(0);
638 }
639 return true;
640 }
641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 case GET_SERVICES_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 int maxNum = data.readInt();
645 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700646 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800647 reply.writeNoException();
648 int N = list != null ? list.size() : -1;
649 reply.writeInt(N);
650 int i;
651 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700652 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800653 info.writeToParcel(reply, 0);
654 }
655 return true;
656 }
657
658 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
659 data.enforceInterface(IActivityManager.descriptor);
660 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
661 reply.writeNoException();
662 reply.writeTypedList(list);
663 return true;
664 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700665
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800666 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
667 data.enforceInterface(IActivityManager.descriptor);
668 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
669 reply.writeNoException();
670 reply.writeTypedList(list);
671 return true;
672 }
673
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700674 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
675 data.enforceInterface(IActivityManager.descriptor);
676 List<ApplicationInfo> list = getRunningExternalApplications();
677 reply.writeNoException();
678 reply.writeTypedList(list);
679 return true;
680 }
681
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 case MOVE_TASK_TO_FRONT_TRANSACTION: {
683 data.enforceInterface(IActivityManager.descriptor);
684 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800685 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700686 Bundle options = data.readInt() != 0
687 ? Bundle.CREATOR.createFromParcel(data) : null;
688 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 reply.writeNoException();
690 return true;
691 }
692
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800693 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 IBinder token = data.readStrongBinder();
696 boolean nonRoot = data.readInt() != 0;
697 boolean res = moveActivityTaskToBack(token, nonRoot);
698 reply.writeNoException();
699 reply.writeInt(res ? 1 : 0);
700 return true;
701 }
702
703 case MOVE_TASK_BACKWARDS_TRANSACTION: {
704 data.enforceInterface(IActivityManager.descriptor);
705 int task = data.readInt();
706 moveTaskBackwards(task);
707 reply.writeNoException();
708 return true;
709 }
710
Craig Mautnerc00204b2013-03-05 15:02:14 -0800711 case MOVE_TASK_TO_STACK_TRANSACTION: {
712 data.enforceInterface(IActivityManager.descriptor);
713 int taskId = data.readInt();
714 int stackId = data.readInt();
715 boolean toTop = data.readInt() != 0;
716 moveTaskToStack(taskId, stackId, toTop);
717 reply.writeNoException();
718 return true;
719 }
720
721 case RESIZE_STACK_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800723 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800724 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800725 Rect r = Rect.CREATOR.createFromParcel(data);
726 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800727 reply.writeNoException();
728 return true;
729 }
730
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800731 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700732 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800733 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700734 reply.writeNoException();
735 reply.writeTypedList(list);
736 return true;
737 }
738
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800739 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700740 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800741 int stackId = data.readInt();
742 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700743 reply.writeNoException();
744 if (info != null) {
745 reply.writeInt(1);
746 info.writeToParcel(reply, 0);
747 } else {
748 reply.writeInt(0);
749 }
750 return true;
751 }
752
Winson Chung303e1ff2014-03-07 15:06:19 -0800753 case IS_IN_HOME_STACK_TRANSACTION: {
754 data.enforceInterface(IActivityManager.descriptor);
755 int taskId = data.readInt();
756 boolean isInHomeStack = isInHomeStack(taskId);
757 reply.writeNoException();
758 reply.writeInt(isInHomeStack ? 1 : 0);
759 return true;
760 }
761
Craig Mautnercf910b02013-04-23 11:23:27 -0700762 case SET_FOCUSED_STACK_TRANSACTION: {
763 data.enforceInterface(IActivityManager.descriptor);
764 int stackId = data.readInt();
765 setFocusedStack(stackId);
766 reply.writeNoException();
767 return true;
768 }
769
Winson Chung740c3ac2014-11-12 16:14:38 -0800770 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
771 data.enforceInterface(IActivityManager.descriptor);
772 IBinder token = data.readStrongBinder();
773 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
774 reply.writeNoException();
775 return true;
776 }
777
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800778 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
779 data.enforceInterface(IActivityManager.descriptor);
780 IBinder token = data.readStrongBinder();
781 boolean onlyRoot = data.readInt() != 0;
782 int res = token != null
783 ? getTaskForActivity(token, onlyRoot) : -1;
784 reply.writeNoException();
785 reply.writeInt(res);
786 return true;
787 }
788
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 case GET_CONTENT_PROVIDER_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 IBinder b = data.readStrongBinder();
792 IApplicationThread app = ApplicationThreadNative.asInterface(b);
793 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700794 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700795 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700796 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800797 reply.writeNoException();
798 if (cph != null) {
799 reply.writeInt(1);
800 cph.writeToParcel(reply, 0);
801 } else {
802 reply.writeInt(0);
803 }
804 return true;
805 }
806
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800807 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700810 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800811 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700812 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800813 reply.writeNoException();
814 if (cph != null) {
815 reply.writeInt(1);
816 cph.writeToParcel(reply, 0);
817 } else {
818 reply.writeInt(0);
819 }
820 return true;
821 }
822
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800823 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 IBinder b = data.readStrongBinder();
826 IApplicationThread app = ApplicationThreadNative.asInterface(b);
827 ArrayList<ContentProviderHolder> providers =
828 data.createTypedArrayList(ContentProviderHolder.CREATOR);
829 publishContentProviders(app, providers);
830 reply.writeNoException();
831 return true;
832 }
833
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700834 case REF_CONTENT_PROVIDER_TRANSACTION: {
835 data.enforceInterface(IActivityManager.descriptor);
836 IBinder b = data.readStrongBinder();
837 int stable = data.readInt();
838 int unstable = data.readInt();
839 boolean res = refContentProvider(b, stable, unstable);
840 reply.writeNoException();
841 reply.writeInt(res ? 1 : 0);
842 return true;
843 }
844
845 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
846 data.enforceInterface(IActivityManager.descriptor);
847 IBinder b = data.readStrongBinder();
848 unstableProviderDied(b);
849 reply.writeNoException();
850 return true;
851 }
852
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700853 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
854 data.enforceInterface(IActivityManager.descriptor);
855 IBinder b = data.readStrongBinder();
856 appNotRespondingViaProvider(b);
857 reply.writeNoException();
858 return true;
859 }
860
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800861 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
862 data.enforceInterface(IActivityManager.descriptor);
863 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700864 boolean stable = data.readInt() != 0;
865 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800866 reply.writeNoException();
867 return true;
868 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800869
870 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
871 data.enforceInterface(IActivityManager.descriptor);
872 String name = data.readString();
873 IBinder token = data.readStrongBinder();
874 removeContentProviderExternal(name, token);
875 reply.writeNoException();
876 return true;
877 }
878
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700879 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
880 data.enforceInterface(IActivityManager.descriptor);
881 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
882 PendingIntent pi = getRunningServiceControlPanel(comp);
883 reply.writeNoException();
884 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
885 return true;
886 }
887
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800888 case START_SERVICE_TRANSACTION: {
889 data.enforceInterface(IActivityManager.descriptor);
890 IBinder b = data.readStrongBinder();
891 IApplicationThread app = ApplicationThreadNative.asInterface(b);
892 Intent service = Intent.CREATOR.createFromParcel(data);
893 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700894 int userId = data.readInt();
895 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800896 reply.writeNoException();
897 ComponentName.writeToParcel(cn, reply);
898 return true;
899 }
900
901 case STOP_SERVICE_TRANSACTION: {
902 data.enforceInterface(IActivityManager.descriptor);
903 IBinder b = data.readStrongBinder();
904 IApplicationThread app = ApplicationThreadNative.asInterface(b);
905 Intent service = Intent.CREATOR.createFromParcel(data);
906 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700907 int userId = data.readInt();
908 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800909 reply.writeNoException();
910 reply.writeInt(res);
911 return true;
912 }
913
914 case STOP_SERVICE_TOKEN_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 ComponentName className = ComponentName.readFromParcel(data);
917 IBinder token = data.readStrongBinder();
918 int startId = data.readInt();
919 boolean res = stopServiceToken(className, token, startId);
920 reply.writeNoException();
921 reply.writeInt(res ? 1 : 0);
922 return true;
923 }
924
925 case SET_SERVICE_FOREGROUND_TRANSACTION: {
926 data.enforceInterface(IActivityManager.descriptor);
927 ComponentName className = ComponentName.readFromParcel(data);
928 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700929 int id = data.readInt();
930 Notification notification = null;
931 if (data.readInt() != 0) {
932 notification = Notification.CREATOR.createFromParcel(data);
933 }
934 boolean removeNotification = data.readInt() != 0;
935 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 reply.writeNoException();
937 return true;
938 }
939
940 case BIND_SERVICE_TRANSACTION: {
941 data.enforceInterface(IActivityManager.descriptor);
942 IBinder b = data.readStrongBinder();
943 IApplicationThread app = ApplicationThreadNative.asInterface(b);
944 IBinder token = data.readStrongBinder();
945 Intent service = Intent.CREATOR.createFromParcel(data);
946 String resolvedType = data.readString();
947 b = data.readStrongBinder();
948 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800949 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800951 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800952 reply.writeNoException();
953 reply.writeInt(res);
954 return true;
955 }
956
957 case UNBIND_SERVICE_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 IBinder b = data.readStrongBinder();
960 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
961 boolean res = unbindService(conn);
962 reply.writeNoException();
963 reply.writeInt(res ? 1 : 0);
964 return true;
965 }
966
967 case PUBLISH_SERVICE_TRANSACTION: {
968 data.enforceInterface(IActivityManager.descriptor);
969 IBinder token = data.readStrongBinder();
970 Intent intent = Intent.CREATOR.createFromParcel(data);
971 IBinder service = data.readStrongBinder();
972 publishService(token, intent, service);
973 reply.writeNoException();
974 return true;
975 }
976
977 case UNBIND_FINISHED_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder token = data.readStrongBinder();
980 Intent intent = Intent.CREATOR.createFromParcel(data);
981 boolean doRebind = data.readInt() != 0;
982 unbindFinished(token, intent, doRebind);
983 reply.writeNoException();
984 return true;
985 }
986
987 case SERVICE_DONE_EXECUTING_TRANSACTION: {
988 data.enforceInterface(IActivityManager.descriptor);
989 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700990 int type = data.readInt();
991 int startId = data.readInt();
992 int res = data.readInt();
993 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 reply.writeNoException();
995 return true;
996 }
997
998 case START_INSTRUMENTATION_TRANSACTION: {
999 data.enforceInterface(IActivityManager.descriptor);
1000 ComponentName className = ComponentName.readFromParcel(data);
1001 String profileFile = data.readString();
1002 int fl = data.readInt();
1003 Bundle arguments = data.readBundle();
1004 IBinder b = data.readStrongBinder();
1005 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001006 b = data.readStrongBinder();
1007 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001008 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001009 String abiOverride = data.readString();
1010 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1011 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001012 reply.writeNoException();
1013 reply.writeInt(res ? 1 : 0);
1014 return true;
1015 }
1016
1017
1018 case FINISH_INSTRUMENTATION_TRANSACTION: {
1019 data.enforceInterface(IActivityManager.descriptor);
1020 IBinder b = data.readStrongBinder();
1021 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1022 int resultCode = data.readInt();
1023 Bundle results = data.readBundle();
1024 finishInstrumentation(app, resultCode, results);
1025 reply.writeNoException();
1026 return true;
1027 }
1028
1029 case GET_CONFIGURATION_TRANSACTION: {
1030 data.enforceInterface(IActivityManager.descriptor);
1031 Configuration config = getConfiguration();
1032 reply.writeNoException();
1033 config.writeToParcel(reply, 0);
1034 return true;
1035 }
1036
1037 case UPDATE_CONFIGURATION_TRANSACTION: {
1038 data.enforceInterface(IActivityManager.descriptor);
1039 Configuration config = Configuration.CREATOR.createFromParcel(data);
1040 updateConfiguration(config);
1041 reply.writeNoException();
1042 return true;
1043 }
1044
1045 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1046 data.enforceInterface(IActivityManager.descriptor);
1047 IBinder token = data.readStrongBinder();
1048 int requestedOrientation = data.readInt();
1049 setRequestedOrientation(token, requestedOrientation);
1050 reply.writeNoException();
1051 return true;
1052 }
1053
1054 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1055 data.enforceInterface(IActivityManager.descriptor);
1056 IBinder token = data.readStrongBinder();
1057 int req = getRequestedOrientation(token);
1058 reply.writeNoException();
1059 reply.writeInt(req);
1060 return true;
1061 }
1062
1063 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1064 data.enforceInterface(IActivityManager.descriptor);
1065 IBinder token = data.readStrongBinder();
1066 ComponentName cn = getActivityClassForToken(token);
1067 reply.writeNoException();
1068 ComponentName.writeToParcel(cn, reply);
1069 return true;
1070 }
1071
1072 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1073 data.enforceInterface(IActivityManager.descriptor);
1074 IBinder token = data.readStrongBinder();
1075 reply.writeNoException();
1076 reply.writeString(getPackageForToken(token));
1077 return true;
1078 }
1079
1080 case GET_INTENT_SENDER_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 int type = data.readInt();
1083 String packageName = data.readString();
1084 IBinder token = data.readStrongBinder();
1085 String resultWho = data.readString();
1086 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001087 Intent[] requestIntents;
1088 String[] requestResolvedTypes;
1089 if (data.readInt() != 0) {
1090 requestIntents = data.createTypedArray(Intent.CREATOR);
1091 requestResolvedTypes = data.createStringArray();
1092 } else {
1093 requestIntents = null;
1094 requestResolvedTypes = null;
1095 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001096 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001097 Bundle options = data.readInt() != 0
1098 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001099 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001101 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001102 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001103 reply.writeNoException();
1104 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1105 return true;
1106 }
1107
1108 case CANCEL_INTENT_SENDER_TRANSACTION: {
1109 data.enforceInterface(IActivityManager.descriptor);
1110 IIntentSender r = IIntentSender.Stub.asInterface(
1111 data.readStrongBinder());
1112 cancelIntentSender(r);
1113 reply.writeNoException();
1114 return true;
1115 }
1116
1117 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1118 data.enforceInterface(IActivityManager.descriptor);
1119 IIntentSender r = IIntentSender.Stub.asInterface(
1120 data.readStrongBinder());
1121 String res = getPackageForIntentSender(r);
1122 reply.writeNoException();
1123 reply.writeString(res);
1124 return true;
1125 }
1126
Christopher Tatec4a07d12012-04-06 14:19:13 -07001127 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 IIntentSender r = IIntentSender.Stub.asInterface(
1130 data.readStrongBinder());
1131 int res = getUidForIntentSender(r);
1132 reply.writeNoException();
1133 reply.writeInt(res);
1134 return true;
1135 }
1136
Dianne Hackborn41203752012-08-31 14:05:51 -07001137 case HANDLE_INCOMING_USER_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 int callingPid = data.readInt();
1140 int callingUid = data.readInt();
1141 int userId = data.readInt();
1142 boolean allowAll = data.readInt() != 0 ;
1143 boolean requireFull = data.readInt() != 0;
1144 String name = data.readString();
1145 String callerPackage = data.readString();
1146 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1147 requireFull, name, callerPackage);
1148 reply.writeNoException();
1149 reply.writeInt(res);
1150 return true;
1151 }
1152
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001153 case SET_PROCESS_LIMIT_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 int max = data.readInt();
1156 setProcessLimit(max);
1157 reply.writeNoException();
1158 return true;
1159 }
1160
1161 case GET_PROCESS_LIMIT_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 int limit = getProcessLimit();
1164 reply.writeNoException();
1165 reply.writeInt(limit);
1166 return true;
1167 }
1168
1169 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1170 data.enforceInterface(IActivityManager.descriptor);
1171 IBinder token = data.readStrongBinder();
1172 int pid = data.readInt();
1173 boolean isForeground = data.readInt() != 0;
1174 setProcessForeground(token, pid, isForeground);
1175 reply.writeNoException();
1176 return true;
1177 }
1178
1179 case CHECK_PERMISSION_TRANSACTION: {
1180 data.enforceInterface(IActivityManager.descriptor);
1181 String perm = data.readString();
1182 int pid = data.readInt();
1183 int uid = data.readInt();
1184 int res = checkPermission(perm, pid, uid);
1185 reply.writeNoException();
1186 reply.writeInt(res);
1187 return true;
1188 }
1189
Dianne Hackbornff170242014-11-19 10:59:01 -08001190 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 String perm = data.readString();
1193 int pid = data.readInt();
1194 int uid = data.readInt();
1195 IBinder token = data.readStrongBinder();
1196 int res = checkPermissionWithToken(perm, pid, uid, token);
1197 reply.writeNoException();
1198 reply.writeInt(res);
1199 return true;
1200 }
1201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 case CHECK_URI_PERMISSION_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 Uri uri = Uri.CREATOR.createFromParcel(data);
1205 int pid = data.readInt();
1206 int uid = data.readInt();
1207 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001208 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001209 IBinder callerToken = data.readStrongBinder();
1210 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211 reply.writeNoException();
1212 reply.writeInt(res);
1213 return true;
1214 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001215
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001217 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 String packageName = data.readString();
1219 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1220 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001221 int userId = data.readInt();
1222 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 reply.writeNoException();
1224 reply.writeInt(res ? 1 : 0);
1225 return true;
1226 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001227
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001228 case GRANT_URI_PERMISSION_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 IBinder b = data.readStrongBinder();
1231 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1232 String targetPkg = data.readString();
1233 Uri uri = Uri.CREATOR.createFromParcel(data);
1234 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001235 int userId = data.readInt();
1236 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001237 reply.writeNoException();
1238 return true;
1239 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001240
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 case REVOKE_URI_PERMISSION_TRANSACTION: {
1242 data.enforceInterface(IActivityManager.descriptor);
1243 IBinder b = data.readStrongBinder();
1244 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1245 Uri uri = Uri.CREATOR.createFromParcel(data);
1246 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001247 int userId = data.readInt();
1248 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 reply.writeNoException();
1250 return true;
1251 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001252
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001253 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
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 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001259 reply.writeNoException();
1260 return true;
1261 }
1262
1263 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1264 data.enforceInterface(IActivityManager.descriptor);
1265 Uri uri = Uri.CREATOR.createFromParcel(data);
1266 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001267 int userId = data.readInt();
1268 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001269 reply.writeNoException();
1270 return true;
1271 }
1272
1273 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1274 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001275 final String packageName = data.readString();
1276 final boolean incoming = data.readInt() != 0;
1277 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1278 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001279 reply.writeNoException();
1280 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1281 return true;
1282 }
1283
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1285 data.enforceInterface(IActivityManager.descriptor);
1286 IBinder b = data.readStrongBinder();
1287 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1288 boolean waiting = data.readInt() != 0;
1289 showWaitingForDebugger(app, waiting);
1290 reply.writeNoException();
1291 return true;
1292 }
1293
1294 case GET_MEMORY_INFO_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1297 getMemoryInfo(mi);
1298 reply.writeNoException();
1299 mi.writeToParcel(reply, 0);
1300 return true;
1301 }
1302
1303 case UNHANDLED_BACK_TRANSACTION: {
1304 data.enforceInterface(IActivityManager.descriptor);
1305 unhandledBack();
1306 reply.writeNoException();
1307 return true;
1308 }
1309
1310 case OPEN_CONTENT_URI_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 Uri uri = Uri.parse(data.readString());
1313 ParcelFileDescriptor pfd = openContentUri(uri);
1314 reply.writeNoException();
1315 if (pfd != null) {
1316 reply.writeInt(1);
1317 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1318 } else {
1319 reply.writeInt(0);
1320 }
1321 return true;
1322 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001323
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001324 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1325 data.enforceInterface(IActivityManager.descriptor);
1326 setLockScreenShown(data.readInt() != 0);
1327 reply.writeNoException();
1328 return true;
1329 }
1330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001331 case SET_DEBUG_APP_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
1333 String pn = data.readString();
1334 boolean wfd = data.readInt() != 0;
1335 boolean per = data.readInt() != 0;
1336 setDebugApp(pn, wfd, per);
1337 reply.writeNoException();
1338 return true;
1339 }
1340
1341 case SET_ALWAYS_FINISH_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
1343 boolean enabled = data.readInt() != 0;
1344 setAlwaysFinish(enabled);
1345 reply.writeNoException();
1346 return true;
1347 }
1348
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001349 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001350 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001351 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001352 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001353 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001354 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001355 return true;
1356 }
1357
1358 case ENTER_SAFE_MODE_TRANSACTION: {
1359 data.enforceInterface(IActivityManager.descriptor);
1360 enterSafeMode();
1361 reply.writeNoException();
1362 return true;
1363 }
1364
1365 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 IIntentSender is = IIntentSender.Stub.asInterface(
1368 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001369 int sourceUid = data.readInt();
1370 String sourcePkg = data.readString();
1371 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001372 reply.writeNoException();
1373 return true;
1374 }
1375
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001376 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001377 data.enforceInterface(IActivityManager.descriptor);
1378 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001379 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001380 boolean secure = data.readInt() != 0;
1381 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001382 reply.writeNoException();
1383 reply.writeInt(res ? 1 : 0);
1384 return true;
1385 }
1386
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001387 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 String reason = data.readString();
1390 boolean res = killProcessesBelowForeground(reason);
1391 reply.writeNoException();
1392 reply.writeInt(res ? 1 : 0);
1393 return true;
1394 }
1395
Dan Egnor60d87622009-12-16 16:32:58 -08001396 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1397 data.enforceInterface(IActivityManager.descriptor);
1398 IBinder app = data.readStrongBinder();
1399 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1400 handleApplicationCrash(app, ci);
1401 reply.writeNoException();
1402 return true;
1403 }
1404
1405 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001406 data.enforceInterface(IActivityManager.descriptor);
1407 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001408 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001409 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001410 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001411 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001413 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001414 return true;
1415 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001416
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001417 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
1419 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001420 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001421 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1422 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001423 reply.writeNoException();
1424 return true;
1425 }
1426
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001427 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1428 data.enforceInterface(IActivityManager.descriptor);
1429 int sig = data.readInt();
1430 signalPersistentProcesses(sig);
1431 reply.writeNoException();
1432 return true;
1433 }
1434
Dianne Hackborn03abb812010-01-04 18:43:19 -08001435 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1436 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001437 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001438 int userId = data.readInt();
1439 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001440 reply.writeNoException();
1441 return true;
1442 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001443
1444 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1445 data.enforceInterface(IActivityManager.descriptor);
1446 killAllBackgroundProcesses();
1447 reply.writeNoException();
1448 return true;
1449 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001450
Dianne Hackborn03abb812010-01-04 18:43:19 -08001451 case FORCE_STOP_PACKAGE_TRANSACTION: {
1452 data.enforceInterface(IActivityManager.descriptor);
1453 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001454 int userId = data.readInt();
1455 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001456 reply.writeNoException();
1457 return true;
1458 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001459
1460 case GET_MY_MEMORY_STATE_TRANSACTION: {
1461 data.enforceInterface(IActivityManager.descriptor);
1462 ActivityManager.RunningAppProcessInfo info =
1463 new ActivityManager.RunningAppProcessInfo();
1464 getMyMemoryState(info);
1465 reply.writeNoException();
1466 info.writeToParcel(reply, 0);
1467 return true;
1468 }
1469
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001470 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1471 data.enforceInterface(IActivityManager.descriptor);
1472 ConfigurationInfo config = getDeviceConfigurationInfo();
1473 reply.writeNoException();
1474 config.writeToParcel(reply, 0);
1475 return true;
1476 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001477
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001478 case PROFILE_CONTROL_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001481 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001482 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001483 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001484 ProfilerInfo profilerInfo = data.readInt() != 0
1485 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1486 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001487 reply.writeNoException();
1488 reply.writeInt(res ? 1 : 0);
1489 return true;
1490 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001491
Dianne Hackborn55280a92009-05-07 15:53:46 -07001492 case SHUTDOWN_TRANSACTION: {
1493 data.enforceInterface(IActivityManager.descriptor);
1494 boolean res = shutdown(data.readInt());
1495 reply.writeNoException();
1496 reply.writeInt(res ? 1 : 0);
1497 return true;
1498 }
1499
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001500 case STOP_APP_SWITCHES_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 stopAppSwitches();
1503 reply.writeNoException();
1504 return true;
1505 }
1506
1507 case RESUME_APP_SWITCHES_TRANSACTION: {
1508 data.enforceInterface(IActivityManager.descriptor);
1509 resumeAppSwitches();
1510 reply.writeNoException();
1511 return true;
1512 }
1513
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001514 case PEEK_SERVICE_TRANSACTION: {
1515 data.enforceInterface(IActivityManager.descriptor);
1516 Intent service = Intent.CREATOR.createFromParcel(data);
1517 String resolvedType = data.readString();
1518 IBinder binder = peekService(service, resolvedType);
1519 reply.writeNoException();
1520 reply.writeStrongBinder(binder);
1521 return true;
1522 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001523
1524 case START_BACKUP_AGENT_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1527 int backupRestoreMode = data.readInt();
1528 boolean success = bindBackupAgent(info, backupRestoreMode);
1529 reply.writeNoException();
1530 reply.writeInt(success ? 1 : 0);
1531 return true;
1532 }
1533
1534 case BACKUP_AGENT_CREATED_TRANSACTION: {
1535 data.enforceInterface(IActivityManager.descriptor);
1536 String packageName = data.readString();
1537 IBinder agent = data.readStrongBinder();
1538 backupAgentCreated(packageName, agent);
1539 reply.writeNoException();
1540 return true;
1541 }
1542
1543 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1544 data.enforceInterface(IActivityManager.descriptor);
1545 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1546 unbindBackupAgent(info);
1547 reply.writeNoException();
1548 return true;
1549 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001550
1551 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 String packageName = data.readString();
1554 addPackageDependency(packageName);
1555 reply.writeNoException();
1556 return true;
1557 }
1558
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001559 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001560 data.enforceInterface(IActivityManager.descriptor);
1561 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001562 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001563 String reason = data.readString();
1564 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001565 reply.writeNoException();
1566 return true;
1567 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001568
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001569 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1570 data.enforceInterface(IActivityManager.descriptor);
1571 String reason = data.readString();
1572 closeSystemDialogs(reason);
1573 reply.writeNoException();
1574 return true;
1575 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001576
1577 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001579 int[] pids = data.createIntArray();
1580 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001581 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001582 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001583 return true;
1584 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001585
1586 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1587 data.enforceInterface(IActivityManager.descriptor);
1588 String processName = data.readString();
1589 int uid = data.readInt();
1590 killApplicationProcess(processName, uid);
1591 reply.writeNoException();
1592 return true;
1593 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001594
1595 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1596 data.enforceInterface(IActivityManager.descriptor);
1597 IBinder token = data.readStrongBinder();
1598 String packageName = data.readString();
1599 int enterAnim = data.readInt();
1600 int exitAnim = data.readInt();
1601 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001602 reply.writeNoException();
1603 return true;
1604 }
1605
1606 case IS_USER_A_MONKEY_TRANSACTION: {
1607 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001608 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001609 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001610 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001611 return true;
1612 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001613
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001614 case SET_USER_IS_MONKEY_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 final boolean monkey = (data.readInt() == 1);
1617 setUserIsMonkey(monkey);
1618 reply.writeNoException();
1619 return true;
1620 }
1621
Dianne Hackborn860755f2010-06-03 18:47:52 -07001622 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1623 data.enforceInterface(IActivityManager.descriptor);
1624 finishHeavyWeightApp();
1625 reply.writeNoException();
1626 return true;
1627 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001628
1629 case IS_IMMERSIVE_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001632 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001633 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001634 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001635 return true;
1636 }
1637
Craig Mautnerd61dc202014-07-07 11:09:11 -07001638 case IS_TOP_OF_TASK_TRANSACTION: {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 IBinder token = data.readStrongBinder();
1641 final boolean isTopOfTask = isTopOfTask(token);
1642 reply.writeNoException();
1643 reply.writeInt(isTopOfTask ? 1 : 0);
1644 return true;
1645 }
1646
Craig Mautner5eda9b32013-07-02 11:58:16 -07001647 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001648 data.enforceInterface(IActivityManager.descriptor);
1649 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001650 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001651 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001652 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001653 return true;
1654 }
1655
1656 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1657 data.enforceInterface(IActivityManager.descriptor);
1658 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001659 final Bundle bundle;
1660 if (data.readInt() == 0) {
1661 bundle = null;
1662 } else {
1663 bundle = data.readBundle();
1664 }
1665 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1666 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001667 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001668 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001669 return true;
1670 }
1671
Craig Mautner233ceee2014-05-09 17:05:11 -07001672 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 IBinder token = data.readStrongBinder();
1675 final ActivityOptions options = getActivityOptions(token);
1676 reply.writeNoException();
1677 reply.writeBundle(options == null ? null : options.toBundle());
1678 return true;
1679 }
1680
Daniel Sandler69a48172010-06-23 16:29:36 -04001681 case SET_IMMERSIVE_TRANSACTION: {
1682 data.enforceInterface(IActivityManager.descriptor);
1683 IBinder token = data.readStrongBinder();
1684 boolean imm = data.readInt() == 1;
1685 setImmersive(token, imm);
1686 reply.writeNoException();
1687 return true;
1688 }
1689
1690 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1691 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001692 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001693 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001694 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001695 return true;
1696 }
1697
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001698 case CRASH_APPLICATION_TRANSACTION: {
1699 data.enforceInterface(IActivityManager.descriptor);
1700 int uid = data.readInt();
1701 int initialPid = data.readInt();
1702 String packageName = data.readString();
1703 String message = data.readString();
1704 crashApplication(uid, initialPid, packageName, message);
1705 reply.writeNoException();
1706 return true;
1707 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001708
1709 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1710 data.enforceInterface(IActivityManager.descriptor);
1711 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001712 int userId = data.readInt();
1713 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001714 reply.writeNoException();
1715 reply.writeString(type);
1716 return true;
1717 }
1718
Dianne Hackborn7e269642010-08-25 19:50:20 -07001719 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1720 data.enforceInterface(IActivityManager.descriptor);
1721 String name = data.readString();
1722 IBinder perm = newUriPermissionOwner(name);
1723 reply.writeNoException();
1724 reply.writeStrongBinder(perm);
1725 return true;
1726 }
1727
1728 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 IBinder owner = data.readStrongBinder();
1731 int fromUid = data.readInt();
1732 String targetPkg = data.readString();
1733 Uri uri = Uri.CREATOR.createFromParcel(data);
1734 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001735 int sourceUserId = data.readInt();
1736 int targetUserId = data.readInt();
1737 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1738 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001739 reply.writeNoException();
1740 return true;
1741 }
1742
1743 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 IBinder owner = data.readStrongBinder();
1746 Uri uri = null;
1747 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001748 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001749 }
1750 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001751 int userId = data.readInt();
1752 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001753 reply.writeNoException();
1754 return true;
1755 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001756
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001757 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1758 data.enforceInterface(IActivityManager.descriptor);
1759 int callingUid = data.readInt();
1760 String targetPkg = data.readString();
1761 Uri uri = Uri.CREATOR.createFromParcel(data);
1762 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001763 int userId = data.readInt();
1764 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001765 reply.writeNoException();
1766 reply.writeInt(res);
1767 return true;
1768 }
1769
Andy McFadden824c5102010-07-09 16:26:57 -07001770 case DUMP_HEAP_TRANSACTION: {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001773 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001774 boolean managed = data.readInt() != 0;
1775 String path = data.readString();
1776 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001777 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001778 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001779 reply.writeNoException();
1780 reply.writeInt(res ? 1 : 0);
1781 return true;
1782 }
1783
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001784 case START_ACTIVITIES_TRANSACTION:
1785 {
1786 data.enforceInterface(IActivityManager.descriptor);
1787 IBinder b = data.readStrongBinder();
1788 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001789 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001790 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1791 String[] resolvedTypes = data.createStringArray();
1792 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001793 Bundle options = data.readInt() != 0
1794 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001795 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001796 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001797 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001798 reply.writeNoException();
1799 reply.writeInt(result);
1800 return true;
1801 }
1802
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001803 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1804 {
1805 data.enforceInterface(IActivityManager.descriptor);
1806 int mode = getFrontActivityScreenCompatMode();
1807 reply.writeNoException();
1808 reply.writeInt(mode);
1809 return true;
1810 }
1811
1812 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1813 {
1814 data.enforceInterface(IActivityManager.descriptor);
1815 int mode = data.readInt();
1816 setFrontActivityScreenCompatMode(mode);
1817 reply.writeNoException();
1818 reply.writeInt(mode);
1819 return true;
1820 }
1821
1822 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1823 {
1824 data.enforceInterface(IActivityManager.descriptor);
1825 String pkg = data.readString();
1826 int mode = getPackageScreenCompatMode(pkg);
1827 reply.writeNoException();
1828 reply.writeInt(mode);
1829 return true;
1830 }
1831
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001832 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1833 {
1834 data.enforceInterface(IActivityManager.descriptor);
1835 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001836 int mode = data.readInt();
1837 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001838 reply.writeNoException();
1839 return true;
1840 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001841
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001842 case SWITCH_USER_TRANSACTION: {
1843 data.enforceInterface(IActivityManager.descriptor);
1844 int userid = data.readInt();
1845 boolean result = switchUser(userid);
1846 reply.writeNoException();
1847 reply.writeInt(result ? 1 : 0);
1848 return true;
1849 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001850
Kenny Guy08488bf2014-02-21 17:40:37 +00001851 case START_USER_IN_BACKGROUND_TRANSACTION: {
1852 data.enforceInterface(IActivityManager.descriptor);
1853 int userid = data.readInt();
1854 boolean result = startUserInBackground(userid);
1855 reply.writeNoException();
1856 reply.writeInt(result ? 1 : 0);
1857 return true;
1858 }
1859
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001860 case STOP_USER_TRANSACTION: {
1861 data.enforceInterface(IActivityManager.descriptor);
1862 int userid = data.readInt();
1863 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1864 data.readStrongBinder());
1865 int result = stopUser(userid, callback);
1866 reply.writeNoException();
1867 reply.writeInt(result);
1868 return true;
1869 }
1870
Amith Yamasani52f1d752012-03-28 18:19:29 -07001871 case GET_CURRENT_USER_TRANSACTION: {
1872 data.enforceInterface(IActivityManager.descriptor);
1873 UserInfo userInfo = getCurrentUser();
1874 reply.writeNoException();
1875 userInfo.writeToParcel(reply, 0);
1876 return true;
1877 }
1878
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001879 case IS_USER_RUNNING_TRANSACTION: {
1880 data.enforceInterface(IActivityManager.descriptor);
1881 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001882 boolean orStopping = data.readInt() != 0;
1883 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001884 reply.writeNoException();
1885 reply.writeInt(result ? 1 : 0);
1886 return true;
1887 }
1888
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001889 case GET_RUNNING_USER_IDS_TRANSACTION: {
1890 data.enforceInterface(IActivityManager.descriptor);
1891 int[] result = getRunningUserIds();
1892 reply.writeNoException();
1893 reply.writeIntArray(result);
1894 return true;
1895 }
1896
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001897 case REMOVE_TASK_TRANSACTION:
1898 {
1899 data.enforceInterface(IActivityManager.descriptor);
1900 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001901 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001902 reply.writeNoException();
1903 reply.writeInt(result ? 1 : 0);
1904 return true;
1905 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001906
Jeff Sharkeya4620792011-05-20 15:29:23 -07001907 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1908 data.enforceInterface(IActivityManager.descriptor);
1909 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1910 data.readStrongBinder());
1911 registerProcessObserver(observer);
1912 return true;
1913 }
1914
1915 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1916 data.enforceInterface(IActivityManager.descriptor);
1917 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1918 data.readStrongBinder());
1919 unregisterProcessObserver(observer);
1920 return true;
1921 }
1922
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001923 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1924 {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 String pkg = data.readString();
1927 boolean ask = getPackageAskScreenCompat(pkg);
1928 reply.writeNoException();
1929 reply.writeInt(ask ? 1 : 0);
1930 return true;
1931 }
1932
1933 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1934 {
1935 data.enforceInterface(IActivityManager.descriptor);
1936 String pkg = data.readString();
1937 boolean ask = data.readInt() != 0;
1938 setPackageAskScreenCompat(pkg, ask);
1939 reply.writeNoException();
1940 return true;
1941 }
1942
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001943 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1944 data.enforceInterface(IActivityManager.descriptor);
1945 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001946 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001947 boolean res = isIntentSenderTargetedToPackage(r);
1948 reply.writeNoException();
1949 reply.writeInt(res ? 1 : 0);
1950 return true;
1951 }
1952
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001953 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1954 data.enforceInterface(IActivityManager.descriptor);
1955 IIntentSender r = IIntentSender.Stub.asInterface(
1956 data.readStrongBinder());
1957 boolean res = isIntentSenderAnActivity(r);
1958 reply.writeNoException();
1959 reply.writeInt(res ? 1 : 0);
1960 return true;
1961 }
1962
Dianne Hackborn81038902012-11-26 17:04:09 -08001963 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1964 data.enforceInterface(IActivityManager.descriptor);
1965 IIntentSender r = IIntentSender.Stub.asInterface(
1966 data.readStrongBinder());
1967 Intent intent = getIntentForIntentSender(r);
1968 reply.writeNoException();
1969 if (intent != null) {
1970 reply.writeInt(1);
1971 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1972 } else {
1973 reply.writeInt(0);
1974 }
1975 return true;
1976 }
1977
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001978 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1979 data.enforceInterface(IActivityManager.descriptor);
1980 IIntentSender r = IIntentSender.Stub.asInterface(
1981 data.readStrongBinder());
1982 String prefix = data.readString();
1983 String tag = getTagForIntentSender(r, prefix);
1984 reply.writeNoException();
1985 reply.writeString(tag);
1986 return true;
1987 }
1988
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001989 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1990 data.enforceInterface(IActivityManager.descriptor);
1991 Configuration config = Configuration.CREATOR.createFromParcel(data);
1992 updatePersistentConfiguration(config);
1993 reply.writeNoException();
1994 return true;
1995 }
1996
Dianne Hackbornb437e092011-08-05 17:50:29 -07001997 case GET_PROCESS_PSS_TRANSACTION: {
1998 data.enforceInterface(IActivityManager.descriptor);
1999 int[] pids = data.createIntArray();
2000 long[] pss = getProcessPss(pids);
2001 reply.writeNoException();
2002 reply.writeLongArray(pss);
2003 return true;
2004 }
2005
Dianne Hackborn661cd522011-08-22 00:26:20 -07002006 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2007 data.enforceInterface(IActivityManager.descriptor);
2008 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2009 boolean always = data.readInt() != 0;
2010 showBootMessage(msg, always);
2011 reply.writeNoException();
2012 return true;
2013 }
2014
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002015 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002016 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002017 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002018 reply.writeNoException();
2019 return true;
2020 }
2021
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002022 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002023 data.enforceInterface(IActivityManager.descriptor);
2024 IBinder token = data.readStrongBinder();
2025 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002026 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002027 reply.writeNoException();
2028 reply.writeInt(res ? 1 : 0);
2029 return true;
2030 }
2031
2032 case NAVIGATE_UP_TO_TRANSACTION: {
2033 data.enforceInterface(IActivityManager.descriptor);
2034 IBinder token = data.readStrongBinder();
2035 Intent target = Intent.CREATOR.createFromParcel(data);
2036 int resultCode = data.readInt();
2037 Intent resultData = null;
2038 if (data.readInt() != 0) {
2039 resultData = Intent.CREATOR.createFromParcel(data);
2040 }
2041 boolean res = navigateUpTo(token, target, resultCode, resultData);
2042 reply.writeNoException();
2043 reply.writeInt(res ? 1 : 0);
2044 return true;
2045 }
2046
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002047 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2048 data.enforceInterface(IActivityManager.descriptor);
2049 IBinder token = data.readStrongBinder();
2050 int res = getLaunchedFromUid(token);
2051 reply.writeNoException();
2052 reply.writeInt(res);
2053 return true;
2054 }
2055
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002056 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2057 data.enforceInterface(IActivityManager.descriptor);
2058 IBinder token = data.readStrongBinder();
2059 String res = getLaunchedFromPackage(token);
2060 reply.writeNoException();
2061 reply.writeString(res);
2062 return true;
2063 }
2064
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002065 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2066 data.enforceInterface(IActivityManager.descriptor);
2067 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2068 data.readStrongBinder());
2069 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002070 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002071 return true;
2072 }
2073
2074 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2075 data.enforceInterface(IActivityManager.descriptor);
2076 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2077 data.readStrongBinder());
2078 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002079 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002080 return true;
2081 }
2082
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002083 case REQUEST_BUG_REPORT_TRANSACTION: {
2084 data.enforceInterface(IActivityManager.descriptor);
2085 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002086 reply.writeNoException();
2087 return true;
2088 }
2089
2090 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 int pid = data.readInt();
2093 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002094 String reason = data.readString();
2095 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002096 reply.writeNoException();
2097 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002098 return true;
2099 }
2100
Adam Skorydfc7fd72013-08-05 19:23:41 -07002101 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002102 data.enforceInterface(IActivityManager.descriptor);
2103 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002104 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002105 reply.writeNoException();
2106 reply.writeBundle(res);
2107 return true;
2108 }
2109
Adam Skorydfc7fd72013-08-05 19:23:41 -07002110 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002111 data.enforceInterface(IActivityManager.descriptor);
2112 IBinder token = data.readStrongBinder();
2113 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002114 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002115 reply.writeNoException();
2116 return true;
2117 }
2118
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002119 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2120 data.enforceInterface(IActivityManager.descriptor);
2121 Intent intent = Intent.CREATOR.createFromParcel(data);
2122 int requestType = data.readInt();
2123 String hint = data.readString();
2124 int userHandle = data.readInt();
2125 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2126 reply.writeNoException();
2127 reply.writeInt(res ? 1 : 0);
2128 return true;
2129 }
2130
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002131 case KILL_UID_TRANSACTION: {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 int uid = data.readInt();
2134 String reason = data.readString();
2135 killUid(uid, reason);
2136 reply.writeNoException();
2137 return true;
2138 }
2139
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002140 case HANG_TRANSACTION: {
2141 data.enforceInterface(IActivityManager.descriptor);
2142 IBinder who = data.readStrongBinder();
2143 boolean allowRestart = data.readInt() != 0;
2144 hang(who, allowRestart);
2145 reply.writeNoException();
2146 return true;
2147 }
2148
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002149 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2150 data.enforceInterface(IActivityManager.descriptor);
2151 IBinder token = data.readStrongBinder();
2152 reportActivityFullyDrawn(token);
2153 reply.writeNoException();
2154 return true;
2155 }
2156
Craig Mautner5eda9b32013-07-02 11:58:16 -07002157 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2158 data.enforceInterface(IActivityManager.descriptor);
2159 IBinder token = data.readStrongBinder();
2160 notifyActivityDrawn(token);
2161 reply.writeNoException();
2162 return true;
2163 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002164
2165 case RESTART_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 restart();
2168 reply.writeNoException();
2169 return true;
2170 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002171
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002172 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2173 data.enforceInterface(IActivityManager.descriptor);
2174 performIdleMaintenance();
2175 reply.writeNoException();
2176 return true;
2177 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002178
Todd Kennedyca4d8422015-01-15 15:19:22 -08002179 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002180 data.enforceInterface(IActivityManager.descriptor);
2181 IBinder parentActivityToken = data.readStrongBinder();
2182 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002183 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002184 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002185 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002186 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002187 if (activityContainer != null) {
2188 reply.writeInt(1);
2189 reply.writeStrongBinder(activityContainer.asBinder());
2190 } else {
2191 reply.writeInt(0);
2192 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002193 return true;
2194 }
2195
Craig Mautner95da1082014-02-24 17:54:35 -08002196 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2197 data.enforceInterface(IActivityManager.descriptor);
2198 IActivityContainer activityContainer =
2199 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2200 deleteActivityContainer(activityContainer);
2201 reply.writeNoException();
2202 return true;
2203 }
2204
Todd Kennedy4900bf92015-01-16 16:05:14 -08002205 case CREATE_STACK_ON_DISPLAY: {
2206 data.enforceInterface(IActivityManager.descriptor);
2207 int displayId = data.readInt();
2208 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2209 reply.writeNoException();
2210 if (activityContainer != null) {
2211 reply.writeInt(1);
2212 reply.writeStrongBinder(activityContainer.asBinder());
2213 } else {
2214 reply.writeInt(0);
2215 }
2216 return true;
2217 }
2218
Craig Mautnere0a38842013-12-16 16:14:02 -08002219 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2220 data.enforceInterface(IActivityManager.descriptor);
2221 IBinder activityToken = data.readStrongBinder();
2222 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2223 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002224 if (activityContainer != null) {
2225 reply.writeInt(1);
2226 reply.writeStrongBinder(activityContainer.asBinder());
2227 } else {
2228 reply.writeInt(0);
2229 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002230 return true;
2231 }
2232
Craig Mautner4a1cb222013-12-04 16:14:06 -08002233 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2234 data.enforceInterface(IActivityManager.descriptor);
2235 IBinder homeActivityToken = getHomeActivityToken();
2236 reply.writeNoException();
2237 reply.writeStrongBinder(homeActivityToken);
2238 return true;
2239 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002240
2241 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2242 data.enforceInterface(IActivityManager.descriptor);
2243 final int taskId = data.readInt();
2244 startLockTaskMode(taskId);
2245 reply.writeNoException();
2246 return true;
2247 }
2248
2249 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2250 data.enforceInterface(IActivityManager.descriptor);
2251 IBinder token = data.readStrongBinder();
2252 startLockTaskMode(token);
2253 reply.writeNoException();
2254 return true;
2255 }
2256
Craig Mautnerd61dc202014-07-07 11:09:11 -07002257 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002258 data.enforceInterface(IActivityManager.descriptor);
2259 startLockTaskModeOnCurrent();
2260 reply.writeNoException();
2261 return true;
2262 }
2263
Craig Mautneraea74a52014-03-08 14:23:10 -08002264 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2265 data.enforceInterface(IActivityManager.descriptor);
2266 stopLockTaskMode();
2267 reply.writeNoException();
2268 return true;
2269 }
2270
Craig Mautnerd61dc202014-07-07 11:09:11 -07002271 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002272 data.enforceInterface(IActivityManager.descriptor);
2273 stopLockTaskModeOnCurrent();
2274 reply.writeNoException();
2275 return true;
2276 }
2277
Craig Mautneraea74a52014-03-08 14:23:10 -08002278 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2279 data.enforceInterface(IActivityManager.descriptor);
2280 final boolean isInLockTaskMode = isInLockTaskMode();
2281 reply.writeNoException();
2282 reply.writeInt(isInLockTaskMode ? 1 : 0);
2283 return true;
2284 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002285
Winson Chunga449dc02014-05-16 11:15:04 -07002286 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002287 data.enforceInterface(IActivityManager.descriptor);
2288 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002289 ActivityManager.TaskDescription values =
2290 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2291 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002292 reply.writeNoException();
2293 return true;
2294 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002295
Craig Mautner648f69b2014-09-18 14:16:26 -07002296 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2297 data.enforceInterface(IActivityManager.descriptor);
2298 String filename = data.readString();
2299 Bitmap icon = getTaskDescriptionIcon(filename);
2300 reply.writeNoException();
2301 if (icon == null) {
2302 reply.writeInt(0);
2303 } else {
2304 reply.writeInt(1);
2305 icon.writeToParcel(reply, 0);
2306 }
2307 return true;
2308 }
2309
Winson Chung044d5292014-11-06 11:05:19 -08002310 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2311 data.enforceInterface(IActivityManager.descriptor);
2312 final Bundle bundle;
2313 if (data.readInt() == 0) {
2314 bundle = null;
2315 } else {
2316 bundle = data.readBundle();
2317 }
2318 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2319 startInPlaceAnimationOnFrontMostApplication(options);
2320 reply.writeNoException();
2321 return true;
2322 }
2323
Jose Lima4b6c6692014-08-12 17:41:12 -07002324 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002325 data.enforceInterface(IActivityManager.descriptor);
2326 IBinder token = data.readStrongBinder();
2327 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002328 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002329 reply.writeNoException();
2330 reply.writeInt(success ? 1 : 0);
2331 return true;
2332 }
2333
Jose Lima4b6c6692014-08-12 17:41:12 -07002334 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002335 data.enforceInterface(IActivityManager.descriptor);
2336 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002337 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002338 reply.writeNoException();
2339 reply.writeInt(enabled ? 1 : 0);
2340 return true;
2341 }
2342
Jose Lima4b6c6692014-08-12 17:41:12 -07002343 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002344 data.enforceInterface(IActivityManager.descriptor);
2345 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002346 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002347 reply.writeNoException();
2348 return true;
2349 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002350
2351 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2352 data.enforceInterface(IActivityManager.descriptor);
2353 IBinder token = data.readStrongBinder();
2354 notifyLaunchTaskBehindComplete(token);
2355 reply.writeNoException();
2356 return true;
2357 }
Craig Mautner8746a472014-07-24 15:12:54 -07002358
2359 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2360 data.enforceInterface(IActivityManager.descriptor);
2361 IBinder token = data.readStrongBinder();
2362 notifyEnterAnimationComplete(token);
2363 reply.writeNoException();
2364 return true;
2365 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002366
2367 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2368 data.enforceInterface(IActivityManager.descriptor);
2369 bootAnimationComplete();
2370 reply.writeNoException();
2371 return true;
2372 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002373
2374 case SYSTEM_BACKUP_RESTORED: {
2375 data.enforceInterface(IActivityManager.descriptor);
2376 systemBackupRestored();
2377 reply.writeNoException();
2378 return true;
2379 }
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08002380
Jeff Sharkey605eb792014-11-04 13:34:06 -08002381 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2382 data.enforceInterface(IActivityManager.descriptor);
2383 final int uid = data.readInt();
2384 final byte[] firstPacket = data.createByteArray();
2385 notifyCleartextNetwork(uid, firstPacket);
2386 reply.writeNoException();
2387 return true;
2388 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002389 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002390
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002391 return super.onTransact(code, data, reply, flags);
2392 }
2393
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002394 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002395 return this;
2396 }
2397
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002398 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2399 protected IActivityManager create() {
2400 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002401 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002402 Log.v("ActivityManager", "default service binder = " + b);
2403 }
2404 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002405 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002406 Log.v("ActivityManager", "default service = " + am);
2407 }
2408 return am;
2409 }
2410 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002411}
2412
2413class ActivityManagerProxy implements IActivityManager
2414{
2415 public ActivityManagerProxy(IBinder remote)
2416 {
2417 mRemote = remote;
2418 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002419
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002420 public IBinder asBinder()
2421 {
2422 return mRemote;
2423 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002424
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002425 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002426 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002427 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002428 Parcel data = Parcel.obtain();
2429 Parcel reply = Parcel.obtain();
2430 data.writeInterfaceToken(IActivityManager.descriptor);
2431 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002432 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002433 intent.writeToParcel(data, 0);
2434 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002435 data.writeStrongBinder(resultTo);
2436 data.writeString(resultWho);
2437 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002438 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002439 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002440 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002441 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002442 } else {
2443 data.writeInt(0);
2444 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002445 if (options != null) {
2446 data.writeInt(1);
2447 options.writeToParcel(data, 0);
2448 } else {
2449 data.writeInt(0);
2450 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002451 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2452 reply.readException();
2453 int result = reply.readInt();
2454 reply.recycle();
2455 data.recycle();
2456 return result;
2457 }
Amith Yamasani82644082012-08-03 13:09:11 -07002458
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002459 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002460 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002461 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2462 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002463 Parcel data = Parcel.obtain();
2464 Parcel reply = Parcel.obtain();
2465 data.writeInterfaceToken(IActivityManager.descriptor);
2466 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002467 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002468 intent.writeToParcel(data, 0);
2469 data.writeString(resolvedType);
2470 data.writeStrongBinder(resultTo);
2471 data.writeString(resultWho);
2472 data.writeInt(requestCode);
2473 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002474 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002475 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002476 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002477 } else {
2478 data.writeInt(0);
2479 }
2480 if (options != null) {
2481 data.writeInt(1);
2482 options.writeToParcel(data, 0);
2483 } else {
2484 data.writeInt(0);
2485 }
2486 data.writeInt(userId);
2487 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2488 reply.readException();
2489 int result = reply.readInt();
2490 reply.recycle();
2491 data.recycle();
2492 return result;
2493 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002494 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2495 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002496 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002497 Parcel data = Parcel.obtain();
2498 Parcel reply = Parcel.obtain();
2499 data.writeInterfaceToken(IActivityManager.descriptor);
2500 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2501 data.writeString(callingPackage);
2502 intent.writeToParcel(data, 0);
2503 data.writeString(resolvedType);
2504 data.writeStrongBinder(resultTo);
2505 data.writeString(resultWho);
2506 data.writeInt(requestCode);
2507 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002508 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002509 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002510 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002511 } else {
2512 data.writeInt(0);
2513 }
2514 if (options != null) {
2515 data.writeInt(1);
2516 options.writeToParcel(data, 0);
2517 } else {
2518 data.writeInt(0);
2519 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002520 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002521 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2522 reply.readException();
2523 int result = reply.readInt();
2524 reply.recycle();
2525 data.recycle();
2526 return result;
2527 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002528 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2529 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002530 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2531 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002532 Parcel data = Parcel.obtain();
2533 Parcel reply = Parcel.obtain();
2534 data.writeInterfaceToken(IActivityManager.descriptor);
2535 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002536 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002537 intent.writeToParcel(data, 0);
2538 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002539 data.writeStrongBinder(resultTo);
2540 data.writeString(resultWho);
2541 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002542 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002543 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002544 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002545 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002546 } else {
2547 data.writeInt(0);
2548 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002549 if (options != null) {
2550 data.writeInt(1);
2551 options.writeToParcel(data, 0);
2552 } else {
2553 data.writeInt(0);
2554 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002555 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002556 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2557 reply.readException();
2558 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2559 reply.recycle();
2560 data.recycle();
2561 return result;
2562 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002563 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2564 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002565 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002566 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002567 Parcel data = Parcel.obtain();
2568 Parcel reply = Parcel.obtain();
2569 data.writeInterfaceToken(IActivityManager.descriptor);
2570 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002571 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002572 intent.writeToParcel(data, 0);
2573 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002574 data.writeStrongBinder(resultTo);
2575 data.writeString(resultWho);
2576 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002577 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002578 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002579 if (options != null) {
2580 data.writeInt(1);
2581 options.writeToParcel(data, 0);
2582 } else {
2583 data.writeInt(0);
2584 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002585 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002586 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2587 reply.readException();
2588 int result = reply.readInt();
2589 reply.recycle();
2590 data.recycle();
2591 return result;
2592 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002593 public int startActivityIntentSender(IApplicationThread caller,
2594 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002595 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002596 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002597 Parcel data = Parcel.obtain();
2598 Parcel reply = Parcel.obtain();
2599 data.writeInterfaceToken(IActivityManager.descriptor);
2600 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2601 intent.writeToParcel(data, 0);
2602 if (fillInIntent != null) {
2603 data.writeInt(1);
2604 fillInIntent.writeToParcel(data, 0);
2605 } else {
2606 data.writeInt(0);
2607 }
2608 data.writeString(resolvedType);
2609 data.writeStrongBinder(resultTo);
2610 data.writeString(resultWho);
2611 data.writeInt(requestCode);
2612 data.writeInt(flagsMask);
2613 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002614 if (options != null) {
2615 data.writeInt(1);
2616 options.writeToParcel(data, 0);
2617 } else {
2618 data.writeInt(0);
2619 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002620 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002621 reply.readException();
2622 int result = reply.readInt();
2623 reply.recycle();
2624 data.recycle();
2625 return result;
2626 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002627 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2628 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002629 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2630 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002631 Parcel data = Parcel.obtain();
2632 Parcel reply = Parcel.obtain();
2633 data.writeInterfaceToken(IActivityManager.descriptor);
2634 data.writeString(callingPackage);
2635 data.writeInt(callingPid);
2636 data.writeInt(callingUid);
2637 intent.writeToParcel(data, 0);
2638 data.writeString(resolvedType);
2639 data.writeStrongBinder(session.asBinder());
2640 data.writeStrongBinder(interactor.asBinder());
2641 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002642 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002643 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002644 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002645 } else {
2646 data.writeInt(0);
2647 }
2648 if (options != null) {
2649 data.writeInt(1);
2650 options.writeToParcel(data, 0);
2651 } else {
2652 data.writeInt(0);
2653 }
2654 data.writeInt(userId);
2655 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2656 reply.readException();
2657 int result = reply.readInt();
2658 reply.recycle();
2659 data.recycle();
2660 return result;
2661 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002662 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002663 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002664 Parcel data = Parcel.obtain();
2665 Parcel reply = Parcel.obtain();
2666 data.writeInterfaceToken(IActivityManager.descriptor);
2667 data.writeStrongBinder(callingActivity);
2668 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002669 if (options != null) {
2670 data.writeInt(1);
2671 options.writeToParcel(data, 0);
2672 } else {
2673 data.writeInt(0);
2674 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002675 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2676 reply.readException();
2677 int result = reply.readInt();
2678 reply.recycle();
2679 data.recycle();
2680 return result != 0;
2681 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002682 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2683 Parcel data = Parcel.obtain();
2684 Parcel reply = Parcel.obtain();
2685 data.writeInterfaceToken(IActivityManager.descriptor);
2686 data.writeInt(taskId);
2687 if (options == null) {
2688 data.writeInt(0);
2689 } else {
2690 data.writeInt(1);
2691 options.writeToParcel(data, 0);
2692 }
2693 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2694 reply.readException();
2695 int result = reply.readInt();
2696 reply.recycle();
2697 data.recycle();
2698 return result;
2699 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002700 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002701 throws RemoteException {
2702 Parcel data = Parcel.obtain();
2703 Parcel reply = Parcel.obtain();
2704 data.writeInterfaceToken(IActivityManager.descriptor);
2705 data.writeStrongBinder(token);
2706 data.writeInt(resultCode);
2707 if (resultData != null) {
2708 data.writeInt(1);
2709 resultData.writeToParcel(data, 0);
2710 } else {
2711 data.writeInt(0);
2712 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002713 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002714 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2715 reply.readException();
2716 boolean res = reply.readInt() != 0;
2717 data.recycle();
2718 reply.recycle();
2719 return res;
2720 }
2721 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2722 {
2723 Parcel data = Parcel.obtain();
2724 Parcel reply = Parcel.obtain();
2725 data.writeInterfaceToken(IActivityManager.descriptor);
2726 data.writeStrongBinder(token);
2727 data.writeString(resultWho);
2728 data.writeInt(requestCode);
2729 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2730 reply.readException();
2731 data.recycle();
2732 reply.recycle();
2733 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002734 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2735 Parcel data = Parcel.obtain();
2736 Parcel reply = Parcel.obtain();
2737 data.writeInterfaceToken(IActivityManager.descriptor);
2738 data.writeStrongBinder(token);
2739 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2740 reply.readException();
2741 boolean res = reply.readInt() != 0;
2742 data.recycle();
2743 reply.recycle();
2744 return res;
2745 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002746 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2747 Parcel data = Parcel.obtain();
2748 Parcel reply = Parcel.obtain();
2749 data.writeInterfaceToken(IActivityManager.descriptor);
2750 data.writeStrongBinder(session.asBinder());
2751 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2752 reply.readException();
2753 data.recycle();
2754 reply.recycle();
2755 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002756 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2757 Parcel data = Parcel.obtain();
2758 Parcel reply = Parcel.obtain();
2759 data.writeInterfaceToken(IActivityManager.descriptor);
2760 data.writeStrongBinder(token);
2761 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2762 reply.readException();
2763 boolean res = reply.readInt() != 0;
2764 data.recycle();
2765 reply.recycle();
2766 return res;
2767 }
2768 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2769 Parcel data = Parcel.obtain();
2770 Parcel reply = Parcel.obtain();
2771 data.writeInterfaceToken(IActivityManager.descriptor);
2772 data.writeStrongBinder(app.asBinder());
2773 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2774 reply.readException();
2775 data.recycle();
2776 reply.recycle();
2777 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002778 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2779 Parcel data = Parcel.obtain();
2780 Parcel reply = Parcel.obtain();
2781 data.writeInterfaceToken(IActivityManager.descriptor);
2782 data.writeStrongBinder(token);
2783 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2784 reply.readException();
2785 boolean res = reply.readInt() != 0;
2786 data.recycle();
2787 reply.recycle();
2788 return res;
2789 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002790 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002791 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002792 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002793 {
2794 Parcel data = Parcel.obtain();
2795 Parcel reply = Parcel.obtain();
2796 data.writeInterfaceToken(IActivityManager.descriptor);
2797 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002798 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002799 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2800 filter.writeToParcel(data, 0);
2801 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002802 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002803 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2804 reply.readException();
2805 Intent intent = null;
2806 int haveIntent = reply.readInt();
2807 if (haveIntent != 0) {
2808 intent = Intent.CREATOR.createFromParcel(reply);
2809 }
2810 reply.recycle();
2811 data.recycle();
2812 return intent;
2813 }
2814 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2815 {
2816 Parcel data = Parcel.obtain();
2817 Parcel reply = Parcel.obtain();
2818 data.writeInterfaceToken(IActivityManager.descriptor);
2819 data.writeStrongBinder(receiver.asBinder());
2820 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2821 reply.readException();
2822 data.recycle();
2823 reply.recycle();
2824 }
2825 public int broadcastIntent(IApplicationThread caller,
2826 Intent intent, String resolvedType, IIntentReceiver resultTo,
2827 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002828 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002829 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002830 {
2831 Parcel data = Parcel.obtain();
2832 Parcel reply = Parcel.obtain();
2833 data.writeInterfaceToken(IActivityManager.descriptor);
2834 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2835 intent.writeToParcel(data, 0);
2836 data.writeString(resolvedType);
2837 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2838 data.writeInt(resultCode);
2839 data.writeString(resultData);
2840 data.writeBundle(map);
2841 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002842 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002843 data.writeInt(serialized ? 1 : 0);
2844 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002845 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002846 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2847 reply.readException();
2848 int res = reply.readInt();
2849 reply.recycle();
2850 data.recycle();
2851 return res;
2852 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002853 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2854 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002855 {
2856 Parcel data = Parcel.obtain();
2857 Parcel reply = Parcel.obtain();
2858 data.writeInterfaceToken(IActivityManager.descriptor);
2859 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2860 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002861 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2863 reply.readException();
2864 data.recycle();
2865 reply.recycle();
2866 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002867 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
2868 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 {
2870 Parcel data = Parcel.obtain();
2871 Parcel reply = Parcel.obtain();
2872 data.writeInterfaceToken(IActivityManager.descriptor);
2873 data.writeStrongBinder(who);
2874 data.writeInt(resultCode);
2875 data.writeString(resultData);
2876 data.writeBundle(map);
2877 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002878 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002879 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2880 reply.readException();
2881 data.recycle();
2882 reply.recycle();
2883 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002884 public void attachApplication(IApplicationThread app) throws RemoteException
2885 {
2886 Parcel data = Parcel.obtain();
2887 Parcel reply = Parcel.obtain();
2888 data.writeInterfaceToken(IActivityManager.descriptor);
2889 data.writeStrongBinder(app.asBinder());
2890 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2891 reply.readException();
2892 data.recycle();
2893 reply.recycle();
2894 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002895 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2896 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002897 {
2898 Parcel data = Parcel.obtain();
2899 Parcel reply = Parcel.obtain();
2900 data.writeInterfaceToken(IActivityManager.descriptor);
2901 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002902 if (config != null) {
2903 data.writeInt(1);
2904 config.writeToParcel(data, 0);
2905 } else {
2906 data.writeInt(0);
2907 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002908 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002909 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2910 reply.readException();
2911 data.recycle();
2912 reply.recycle();
2913 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002914 public void activityResumed(IBinder token) throws RemoteException
2915 {
2916 Parcel data = Parcel.obtain();
2917 Parcel reply = Parcel.obtain();
2918 data.writeInterfaceToken(IActivityManager.descriptor);
2919 data.writeStrongBinder(token);
2920 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2921 reply.readException();
2922 data.recycle();
2923 reply.recycle();
2924 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002925 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002926 {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 data.writeStrongBinder(token);
2931 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2932 reply.readException();
2933 data.recycle();
2934 reply.recycle();
2935 }
2936 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002937 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002938 {
2939 Parcel data = Parcel.obtain();
2940 Parcel reply = Parcel.obtain();
2941 data.writeInterfaceToken(IActivityManager.descriptor);
2942 data.writeStrongBinder(token);
2943 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002944 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002945 TextUtils.writeToParcel(description, data, 0);
2946 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2947 reply.readException();
2948 data.recycle();
2949 reply.recycle();
2950 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002951 public void activitySlept(IBinder token) throws RemoteException
2952 {
2953 Parcel data = Parcel.obtain();
2954 Parcel reply = Parcel.obtain();
2955 data.writeInterfaceToken(IActivityManager.descriptor);
2956 data.writeStrongBinder(token);
2957 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2958 reply.readException();
2959 data.recycle();
2960 reply.recycle();
2961 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002962 public void activityDestroyed(IBinder token) throws RemoteException
2963 {
2964 Parcel data = Parcel.obtain();
2965 Parcel reply = Parcel.obtain();
2966 data.writeInterfaceToken(IActivityManager.descriptor);
2967 data.writeStrongBinder(token);
2968 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2969 reply.readException();
2970 data.recycle();
2971 reply.recycle();
2972 }
2973 public String getCallingPackage(IBinder token) throws RemoteException
2974 {
2975 Parcel data = Parcel.obtain();
2976 Parcel reply = Parcel.obtain();
2977 data.writeInterfaceToken(IActivityManager.descriptor);
2978 data.writeStrongBinder(token);
2979 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2980 reply.readException();
2981 String res = reply.readString();
2982 data.recycle();
2983 reply.recycle();
2984 return res;
2985 }
2986 public ComponentName getCallingActivity(IBinder token)
2987 throws RemoteException {
2988 Parcel data = Parcel.obtain();
2989 Parcel reply = Parcel.obtain();
2990 data.writeInterfaceToken(IActivityManager.descriptor);
2991 data.writeStrongBinder(token);
2992 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2993 reply.readException();
2994 ComponentName res = ComponentName.readFromParcel(reply);
2995 data.recycle();
2996 reply.recycle();
2997 return res;
2998 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002999 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003000 Parcel data = Parcel.obtain();
3001 Parcel reply = Parcel.obtain();
3002 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003003 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003004 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3005 reply.readException();
3006 ArrayList<IAppTask> list = null;
3007 int N = reply.readInt();
3008 if (N >= 0) {
3009 list = new ArrayList<IAppTask>();
3010 while (N > 0) {
3011 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3012 list.add(task);
3013 N--;
3014 }
3015 }
3016 data.recycle();
3017 reply.recycle();
3018 return list;
3019 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003020 public int addAppTask(IBinder activityToken, Intent intent,
3021 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3022 Parcel data = Parcel.obtain();
3023 Parcel reply = Parcel.obtain();
3024 data.writeInterfaceToken(IActivityManager.descriptor);
3025 data.writeStrongBinder(activityToken);
3026 intent.writeToParcel(data, 0);
3027 description.writeToParcel(data, 0);
3028 thumbnail.writeToParcel(data, 0);
3029 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3030 reply.readException();
3031 int res = reply.readInt();
3032 data.recycle();
3033 reply.recycle();
3034 return res;
3035 }
3036 public Point getAppTaskThumbnailSize() throws RemoteException {
3037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3041 reply.readException();
3042 Point size = Point.CREATOR.createFromParcel(reply);
3043 data.recycle();
3044 reply.recycle();
3045 return size;
3046 }
Dianne Hackborn09233282014-04-30 11:33:59 -07003047 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003048 Parcel data = Parcel.obtain();
3049 Parcel reply = Parcel.obtain();
3050 data.writeInterfaceToken(IActivityManager.descriptor);
3051 data.writeInt(maxNum);
3052 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003053 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3054 reply.readException();
3055 ArrayList list = null;
3056 int N = reply.readInt();
3057 if (N >= 0) {
3058 list = new ArrayList();
3059 while (N > 0) {
3060 ActivityManager.RunningTaskInfo info =
3061 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003062 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003063 list.add(info);
3064 N--;
3065 }
3066 }
3067 data.recycle();
3068 reply.recycle();
3069 return list;
3070 }
3071 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003072 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003073 Parcel data = Parcel.obtain();
3074 Parcel reply = Parcel.obtain();
3075 data.writeInterfaceToken(IActivityManager.descriptor);
3076 data.writeInt(maxNum);
3077 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003078 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003079 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3080 reply.readException();
3081 ArrayList<ActivityManager.RecentTaskInfo> list
3082 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3083 data.recycle();
3084 reply.recycle();
3085 return list;
3086 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003087 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003088 Parcel data = Parcel.obtain();
3089 Parcel reply = Parcel.obtain();
3090 data.writeInterfaceToken(IActivityManager.descriptor);
3091 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003092 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003093 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003094 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003095 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003096 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003097 }
3098 data.recycle();
3099 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003100 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003101 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003102 public List getServices(int maxNum, int flags) throws RemoteException {
3103 Parcel data = Parcel.obtain();
3104 Parcel reply = Parcel.obtain();
3105 data.writeInterfaceToken(IActivityManager.descriptor);
3106 data.writeInt(maxNum);
3107 data.writeInt(flags);
3108 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3109 reply.readException();
3110 ArrayList list = null;
3111 int N = reply.readInt();
3112 if (N >= 0) {
3113 list = new ArrayList();
3114 while (N > 0) {
3115 ActivityManager.RunningServiceInfo info =
3116 ActivityManager.RunningServiceInfo.CREATOR
3117 .createFromParcel(reply);
3118 list.add(info);
3119 N--;
3120 }
3121 }
3122 data.recycle();
3123 reply.recycle();
3124 return list;
3125 }
3126 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3127 throws RemoteException {
3128 Parcel data = Parcel.obtain();
3129 Parcel reply = Parcel.obtain();
3130 data.writeInterfaceToken(IActivityManager.descriptor);
3131 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3132 reply.readException();
3133 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3134 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3135 data.recycle();
3136 reply.recycle();
3137 return list;
3138 }
3139 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3140 throws RemoteException {
3141 Parcel data = Parcel.obtain();
3142 Parcel reply = Parcel.obtain();
3143 data.writeInterfaceToken(IActivityManager.descriptor);
3144 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 ArrayList<ActivityManager.RunningAppProcessInfo> list
3147 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3148 data.recycle();
3149 reply.recycle();
3150 return list;
3151 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003152 public List<ApplicationInfo> getRunningExternalApplications()
3153 throws RemoteException {
3154 Parcel data = Parcel.obtain();
3155 Parcel reply = Parcel.obtain();
3156 data.writeInterfaceToken(IActivityManager.descriptor);
3157 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3158 reply.readException();
3159 ArrayList<ApplicationInfo> list
3160 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3161 data.recycle();
3162 reply.recycle();
3163 return list;
3164 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003165 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003166 {
3167 Parcel data = Parcel.obtain();
3168 Parcel reply = Parcel.obtain();
3169 data.writeInterfaceToken(IActivityManager.descriptor);
3170 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003171 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003172 if (options != null) {
3173 data.writeInt(1);
3174 options.writeToParcel(data, 0);
3175 } else {
3176 data.writeInt(0);
3177 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003178 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3179 reply.readException();
3180 data.recycle();
3181 reply.recycle();
3182 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003183 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3184 throws RemoteException {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeStrongBinder(token);
3189 data.writeInt(nonRoot ? 1 : 0);
3190 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 boolean res = reply.readInt() != 0;
3193 data.recycle();
3194 reply.recycle();
3195 return res;
3196 }
3197 public void moveTaskBackwards(int task) throws RemoteException
3198 {
3199 Parcel data = Parcel.obtain();
3200 Parcel reply = Parcel.obtain();
3201 data.writeInterfaceToken(IActivityManager.descriptor);
3202 data.writeInt(task);
3203 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3204 reply.readException();
3205 data.recycle();
3206 reply.recycle();
3207 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003208 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003209 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3210 {
3211 Parcel data = Parcel.obtain();
3212 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003213 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003214 data.writeInt(taskId);
3215 data.writeInt(stackId);
3216 data.writeInt(toTop ? 1 : 0);
3217 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3218 reply.readException();
3219 data.recycle();
3220 reply.recycle();
3221 }
3222 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003223 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003224 {
3225 Parcel data = Parcel.obtain();
3226 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003227 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003228 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003229 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003230 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003231 reply.readException();
3232 data.recycle();
3233 reply.recycle();
3234 }
Craig Mautner967212c2013-04-13 21:10:58 -07003235 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003236 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003237 {
3238 Parcel data = Parcel.obtain();
3239 Parcel reply = Parcel.obtain();
3240 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003241 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003242 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003243 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003244 data.recycle();
3245 reply.recycle();
3246 return list;
3247 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003248 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003249 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003250 {
3251 Parcel data = Parcel.obtain();
3252 Parcel reply = Parcel.obtain();
3253 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003254 data.writeInt(stackId);
3255 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003256 reply.readException();
3257 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003258 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003259 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003260 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003261 }
3262 data.recycle();
3263 reply.recycle();
3264 return info;
3265 }
3266 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003267 public boolean isInHomeStack(int taskId) throws RemoteException {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 data.writeInt(taskId);
3272 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3273 reply.readException();
3274 boolean isInHomeStack = reply.readInt() > 0;
3275 data.recycle();
3276 reply.recycle();
3277 return isInHomeStack;
3278 }
3279 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003280 public void setFocusedStack(int stackId) throws RemoteException
3281 {
3282 Parcel data = Parcel.obtain();
3283 Parcel reply = Parcel.obtain();
3284 data.writeInterfaceToken(IActivityManager.descriptor);
3285 data.writeInt(stackId);
3286 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3287 reply.readException();
3288 data.recycle();
3289 reply.recycle();
3290 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003291 @Override
3292 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3293 {
3294 Parcel data = Parcel.obtain();
3295 Parcel reply = Parcel.obtain();
3296 data.writeInterfaceToken(IActivityManager.descriptor);
3297 data.writeStrongBinder(listener.asBinder());
3298 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3299 reply.readException();
3300 data.recycle();
3301 reply.recycle();
3302 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003303 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3304 {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeStrongBinder(token);
3309 data.writeInt(onlyRoot ? 1 : 0);
3310 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3311 reply.readException();
3312 int res = reply.readInt();
3313 data.recycle();
3314 reply.recycle();
3315 return res;
3316 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003317 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003318 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003319 Parcel data = Parcel.obtain();
3320 Parcel reply = Parcel.obtain();
3321 data.writeInterfaceToken(IActivityManager.descriptor);
3322 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3323 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003324 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003325 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003326 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3327 reply.readException();
3328 int res = reply.readInt();
3329 ContentProviderHolder cph = null;
3330 if (res != 0) {
3331 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3332 }
3333 data.recycle();
3334 reply.recycle();
3335 return cph;
3336 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003337 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3338 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003343 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003344 data.writeStrongBinder(token);
3345 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 int res = reply.readInt();
3348 ContentProviderHolder cph = null;
3349 if (res != 0) {
3350 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3351 }
3352 data.recycle();
3353 reply.recycle();
3354 return cph;
3355 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003356 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003357 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003358 {
3359 Parcel data = Parcel.obtain();
3360 Parcel reply = Parcel.obtain();
3361 data.writeInterfaceToken(IActivityManager.descriptor);
3362 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3363 data.writeTypedList(providers);
3364 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3365 reply.readException();
3366 data.recycle();
3367 reply.recycle();
3368 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003369 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3370 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003371 Parcel data = Parcel.obtain();
3372 Parcel reply = Parcel.obtain();
3373 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003374 data.writeStrongBinder(connection);
3375 data.writeInt(stable);
3376 data.writeInt(unstable);
3377 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3378 reply.readException();
3379 boolean res = reply.readInt() != 0;
3380 data.recycle();
3381 reply.recycle();
3382 return res;
3383 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003384
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003385 public void unstableProviderDied(IBinder connection) throws RemoteException {
3386 Parcel data = Parcel.obtain();
3387 Parcel reply = Parcel.obtain();
3388 data.writeInterfaceToken(IActivityManager.descriptor);
3389 data.writeStrongBinder(connection);
3390 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3391 reply.readException();
3392 data.recycle();
3393 reply.recycle();
3394 }
3395
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003396 @Override
3397 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3398 Parcel data = Parcel.obtain();
3399 Parcel reply = Parcel.obtain();
3400 data.writeInterfaceToken(IActivityManager.descriptor);
3401 data.writeStrongBinder(connection);
3402 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3403 reply.readException();
3404 data.recycle();
3405 reply.recycle();
3406 }
3407
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003408 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3409 Parcel data = Parcel.obtain();
3410 Parcel reply = Parcel.obtain();
3411 data.writeInterfaceToken(IActivityManager.descriptor);
3412 data.writeStrongBinder(connection);
3413 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003414 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3415 reply.readException();
3416 data.recycle();
3417 reply.recycle();
3418 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003419
3420 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3421 Parcel data = Parcel.obtain();
3422 Parcel reply = Parcel.obtain();
3423 data.writeInterfaceToken(IActivityManager.descriptor);
3424 data.writeString(name);
3425 data.writeStrongBinder(token);
3426 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3427 reply.readException();
3428 data.recycle();
3429 reply.recycle();
3430 }
3431
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003432 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3433 throws RemoteException
3434 {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 service.writeToParcel(data, 0);
3439 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3440 reply.readException();
3441 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3442 data.recycle();
3443 reply.recycle();
3444 return res;
3445 }
3446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003447 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003448 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003449 {
3450 Parcel data = Parcel.obtain();
3451 Parcel reply = Parcel.obtain();
3452 data.writeInterfaceToken(IActivityManager.descriptor);
3453 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3454 service.writeToParcel(data, 0);
3455 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003456 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003457 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3458 reply.readException();
3459 ComponentName res = ComponentName.readFromParcel(reply);
3460 data.recycle();
3461 reply.recycle();
3462 return res;
3463 }
3464 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003465 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003466 {
3467 Parcel data = Parcel.obtain();
3468 Parcel reply = Parcel.obtain();
3469 data.writeInterfaceToken(IActivityManager.descriptor);
3470 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3471 service.writeToParcel(data, 0);
3472 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003473 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003474 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3475 reply.readException();
3476 int res = reply.readInt();
3477 reply.recycle();
3478 data.recycle();
3479 return res;
3480 }
3481 public boolean stopServiceToken(ComponentName className, IBinder token,
3482 int startId) throws RemoteException {
3483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 ComponentName.writeToParcel(className, data);
3487 data.writeStrongBinder(token);
3488 data.writeInt(startId);
3489 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3490 reply.readException();
3491 boolean res = reply.readInt() != 0;
3492 data.recycle();
3493 reply.recycle();
3494 return res;
3495 }
3496 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003497 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003498 Parcel data = Parcel.obtain();
3499 Parcel reply = Parcel.obtain();
3500 data.writeInterfaceToken(IActivityManager.descriptor);
3501 ComponentName.writeToParcel(className, data);
3502 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003503 data.writeInt(id);
3504 if (notification != null) {
3505 data.writeInt(1);
3506 notification.writeToParcel(data, 0);
3507 } else {
3508 data.writeInt(0);
3509 }
3510 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003511 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 data.recycle();
3514 reply.recycle();
3515 }
3516 public int bindService(IApplicationThread caller, IBinder token,
3517 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003518 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003519 Parcel data = Parcel.obtain();
3520 Parcel reply = Parcel.obtain();
3521 data.writeInterfaceToken(IActivityManager.descriptor);
3522 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3523 data.writeStrongBinder(token);
3524 service.writeToParcel(data, 0);
3525 data.writeString(resolvedType);
3526 data.writeStrongBinder(connection.asBinder());
3527 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003528 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003529 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3530 reply.readException();
3531 int res = reply.readInt();
3532 data.recycle();
3533 reply.recycle();
3534 return res;
3535 }
3536 public boolean unbindService(IServiceConnection connection) throws RemoteException
3537 {
3538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeStrongBinder(connection.asBinder());
3542 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3543 reply.readException();
3544 boolean res = reply.readInt() != 0;
3545 data.recycle();
3546 reply.recycle();
3547 return res;
3548 }
3549
3550 public void publishService(IBinder token,
3551 Intent intent, IBinder service) throws RemoteException {
3552 Parcel data = Parcel.obtain();
3553 Parcel reply = Parcel.obtain();
3554 data.writeInterfaceToken(IActivityManager.descriptor);
3555 data.writeStrongBinder(token);
3556 intent.writeToParcel(data, 0);
3557 data.writeStrongBinder(service);
3558 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3559 reply.readException();
3560 data.recycle();
3561 reply.recycle();
3562 }
3563
3564 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3565 throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeStrongBinder(token);
3570 intent.writeToParcel(data, 0);
3571 data.writeInt(doRebind ? 1 : 0);
3572 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3573 reply.readException();
3574 data.recycle();
3575 reply.recycle();
3576 }
3577
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003578 public void serviceDoneExecuting(IBinder token, int type, int startId,
3579 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003580 Parcel data = Parcel.obtain();
3581 Parcel reply = Parcel.obtain();
3582 data.writeInterfaceToken(IActivityManager.descriptor);
3583 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003584 data.writeInt(type);
3585 data.writeInt(startId);
3586 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003587 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3588 reply.readException();
3589 data.recycle();
3590 reply.recycle();
3591 }
3592
3593 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 service.writeToParcel(data, 0);
3598 data.writeString(resolvedType);
3599 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 IBinder binder = reply.readStrongBinder();
3602 reply.recycle();
3603 data.recycle();
3604 return binder;
3605 }
3606
Christopher Tate181fafa2009-05-14 11:12:14 -07003607 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3608 throws RemoteException {
3609 Parcel data = Parcel.obtain();
3610 Parcel reply = Parcel.obtain();
3611 data.writeInterfaceToken(IActivityManager.descriptor);
3612 app.writeToParcel(data, 0);
3613 data.writeInt(backupRestoreMode);
3614 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3615 reply.readException();
3616 boolean success = reply.readInt() != 0;
3617 reply.recycle();
3618 data.recycle();
3619 return success;
3620 }
3621
Christopher Tate346acb12012-10-15 19:20:25 -07003622 public void clearPendingBackup() throws RemoteException {
3623 Parcel data = Parcel.obtain();
3624 Parcel reply = Parcel.obtain();
3625 data.writeInterfaceToken(IActivityManager.descriptor);
3626 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3627 reply.recycle();
3628 data.recycle();
3629 }
3630
Christopher Tate181fafa2009-05-14 11:12:14 -07003631 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeString(packageName);
3636 data.writeStrongBinder(agent);
3637 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3638 reply.recycle();
3639 data.recycle();
3640 }
3641
3642 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 app.writeToParcel(data, 0);
3647 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3648 reply.readException();
3649 reply.recycle();
3650 data.recycle();
3651 }
3652
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003653 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003654 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003655 IUiAutomationConnection connection, int userId, String instructionSet)
3656 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003657 Parcel data = Parcel.obtain();
3658 Parcel reply = Parcel.obtain();
3659 data.writeInterfaceToken(IActivityManager.descriptor);
3660 ComponentName.writeToParcel(className, data);
3661 data.writeString(profileFile);
3662 data.writeInt(flags);
3663 data.writeBundle(arguments);
3664 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003665 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003666 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003667 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003668 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3669 reply.readException();
3670 boolean res = reply.readInt() != 0;
3671 reply.recycle();
3672 data.recycle();
3673 return res;
3674 }
3675
3676 public void finishInstrumentation(IApplicationThread target,
3677 int resultCode, Bundle results) throws RemoteException {
3678 Parcel data = Parcel.obtain();
3679 Parcel reply = Parcel.obtain();
3680 data.writeInterfaceToken(IActivityManager.descriptor);
3681 data.writeStrongBinder(target != null ? target.asBinder() : null);
3682 data.writeInt(resultCode);
3683 data.writeBundle(results);
3684 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3685 reply.readException();
3686 data.recycle();
3687 reply.recycle();
3688 }
3689 public Configuration getConfiguration() throws RemoteException
3690 {
3691 Parcel data = Parcel.obtain();
3692 Parcel reply = Parcel.obtain();
3693 data.writeInterfaceToken(IActivityManager.descriptor);
3694 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3697 reply.recycle();
3698 data.recycle();
3699 return res;
3700 }
3701 public void updateConfiguration(Configuration values) throws RemoteException
3702 {
3703 Parcel data = Parcel.obtain();
3704 Parcel reply = Parcel.obtain();
3705 data.writeInterfaceToken(IActivityManager.descriptor);
3706 values.writeToParcel(data, 0);
3707 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3708 reply.readException();
3709 data.recycle();
3710 reply.recycle();
3711 }
3712 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3713 throws RemoteException {
3714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 data.writeStrongBinder(token);
3718 data.writeInt(requestedOrientation);
3719 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3720 reply.readException();
3721 data.recycle();
3722 reply.recycle();
3723 }
3724 public int getRequestedOrientation(IBinder token) throws RemoteException {
3725 Parcel data = Parcel.obtain();
3726 Parcel reply = Parcel.obtain();
3727 data.writeInterfaceToken(IActivityManager.descriptor);
3728 data.writeStrongBinder(token);
3729 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3730 reply.readException();
3731 int res = reply.readInt();
3732 data.recycle();
3733 reply.recycle();
3734 return res;
3735 }
3736 public ComponentName getActivityClassForToken(IBinder token)
3737 throws RemoteException {
3738 Parcel data = Parcel.obtain();
3739 Parcel reply = Parcel.obtain();
3740 data.writeInterfaceToken(IActivityManager.descriptor);
3741 data.writeStrongBinder(token);
3742 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3743 reply.readException();
3744 ComponentName res = ComponentName.readFromParcel(reply);
3745 data.recycle();
3746 reply.recycle();
3747 return res;
3748 }
3749 public String getPackageForToken(IBinder token) throws RemoteException
3750 {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeStrongBinder(token);
3755 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3756 reply.readException();
3757 String res = reply.readString();
3758 data.recycle();
3759 reply.recycle();
3760 return res;
3761 }
3762 public IIntentSender getIntentSender(int type,
3763 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003764 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003765 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003766 Parcel data = Parcel.obtain();
3767 Parcel reply = Parcel.obtain();
3768 data.writeInterfaceToken(IActivityManager.descriptor);
3769 data.writeInt(type);
3770 data.writeString(packageName);
3771 data.writeStrongBinder(token);
3772 data.writeString(resultWho);
3773 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003774 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003775 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003776 data.writeTypedArray(intents, 0);
3777 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003778 } else {
3779 data.writeInt(0);
3780 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003781 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003782 if (options != null) {
3783 data.writeInt(1);
3784 options.writeToParcel(data, 0);
3785 } else {
3786 data.writeInt(0);
3787 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003788 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003789 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3790 reply.readException();
3791 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003792 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 data.recycle();
3794 reply.recycle();
3795 return res;
3796 }
3797 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3798 Parcel data = Parcel.obtain();
3799 Parcel reply = Parcel.obtain();
3800 data.writeInterfaceToken(IActivityManager.descriptor);
3801 data.writeStrongBinder(sender.asBinder());
3802 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3803 reply.readException();
3804 data.recycle();
3805 reply.recycle();
3806 }
3807 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3808 Parcel data = Parcel.obtain();
3809 Parcel reply = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 data.writeStrongBinder(sender.asBinder());
3812 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3813 reply.readException();
3814 String res = reply.readString();
3815 data.recycle();
3816 reply.recycle();
3817 return res;
3818 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003819 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3820 Parcel data = Parcel.obtain();
3821 Parcel reply = Parcel.obtain();
3822 data.writeInterfaceToken(IActivityManager.descriptor);
3823 data.writeStrongBinder(sender.asBinder());
3824 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3825 reply.readException();
3826 int res = reply.readInt();
3827 data.recycle();
3828 reply.recycle();
3829 return res;
3830 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003831 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3832 boolean requireFull, String name, String callerPackage) throws RemoteException {
3833 Parcel data = Parcel.obtain();
3834 Parcel reply = Parcel.obtain();
3835 data.writeInterfaceToken(IActivityManager.descriptor);
3836 data.writeInt(callingPid);
3837 data.writeInt(callingUid);
3838 data.writeInt(userId);
3839 data.writeInt(allowAll ? 1 : 0);
3840 data.writeInt(requireFull ? 1 : 0);
3841 data.writeString(name);
3842 data.writeString(callerPackage);
3843 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3844 reply.readException();
3845 int res = reply.readInt();
3846 data.recycle();
3847 reply.recycle();
3848 return res;
3849 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003850 public void setProcessLimit(int max) throws RemoteException
3851 {
3852 Parcel data = Parcel.obtain();
3853 Parcel reply = Parcel.obtain();
3854 data.writeInterfaceToken(IActivityManager.descriptor);
3855 data.writeInt(max);
3856 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3857 reply.readException();
3858 data.recycle();
3859 reply.recycle();
3860 }
3861 public int getProcessLimit() throws RemoteException
3862 {
3863 Parcel data = Parcel.obtain();
3864 Parcel reply = Parcel.obtain();
3865 data.writeInterfaceToken(IActivityManager.descriptor);
3866 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3867 reply.readException();
3868 int res = reply.readInt();
3869 data.recycle();
3870 reply.recycle();
3871 return res;
3872 }
3873 public void setProcessForeground(IBinder token, int pid,
3874 boolean isForeground) throws RemoteException {
3875 Parcel data = Parcel.obtain();
3876 Parcel reply = Parcel.obtain();
3877 data.writeInterfaceToken(IActivityManager.descriptor);
3878 data.writeStrongBinder(token);
3879 data.writeInt(pid);
3880 data.writeInt(isForeground ? 1 : 0);
3881 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3882 reply.readException();
3883 data.recycle();
3884 reply.recycle();
3885 }
3886 public int checkPermission(String permission, int pid, int uid)
3887 throws RemoteException {
3888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 data.writeString(permission);
3892 data.writeInt(pid);
3893 data.writeInt(uid);
3894 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3895 reply.readException();
3896 int res = reply.readInt();
3897 data.recycle();
3898 reply.recycle();
3899 return res;
3900 }
Dianne Hackbornff170242014-11-19 10:59:01 -08003901 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
3902 throws RemoteException {
3903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
3906 data.writeString(permission);
3907 data.writeInt(pid);
3908 data.writeInt(uid);
3909 data.writeStrongBinder(callerToken);
3910 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 int res = reply.readInt();
3913 data.recycle();
3914 reply.recycle();
3915 return res;
3916 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003917 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003918 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003923 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003924 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003925 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3926 reply.readException();
3927 boolean res = reply.readInt() != 0;
3928 data.recycle();
3929 reply.recycle();
3930 return res;
3931 }
Dianne Hackbornff170242014-11-19 10:59:01 -08003932 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
3933 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003934 Parcel data = Parcel.obtain();
3935 Parcel reply = Parcel.obtain();
3936 data.writeInterfaceToken(IActivityManager.descriptor);
3937 uri.writeToParcel(data, 0);
3938 data.writeInt(pid);
3939 data.writeInt(uid);
3940 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003941 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08003942 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003943 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3944 reply.readException();
3945 int res = reply.readInt();
3946 data.recycle();
3947 reply.recycle();
3948 return res;
3949 }
3950 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003951 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003952 Parcel data = Parcel.obtain();
3953 Parcel reply = Parcel.obtain();
3954 data.writeInterfaceToken(IActivityManager.descriptor);
3955 data.writeStrongBinder(caller.asBinder());
3956 data.writeString(targetPkg);
3957 uri.writeToParcel(data, 0);
3958 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003959 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003960 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3961 reply.readException();
3962 data.recycle();
3963 reply.recycle();
3964 }
3965 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003966 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003967 Parcel data = Parcel.obtain();
3968 Parcel reply = Parcel.obtain();
3969 data.writeInterfaceToken(IActivityManager.descriptor);
3970 data.writeStrongBinder(caller.asBinder());
3971 uri.writeToParcel(data, 0);
3972 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003973 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003974 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3975 reply.readException();
3976 data.recycle();
3977 reply.recycle();
3978 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003979
3980 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003981 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3982 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003983 Parcel data = Parcel.obtain();
3984 Parcel reply = Parcel.obtain();
3985 data.writeInterfaceToken(IActivityManager.descriptor);
3986 uri.writeToParcel(data, 0);
3987 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003988 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003989 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3990 reply.readException();
3991 data.recycle();
3992 reply.recycle();
3993 }
3994
3995 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003996 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3997 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003998 Parcel data = Parcel.obtain();
3999 Parcel reply = Parcel.obtain();
4000 data.writeInterfaceToken(IActivityManager.descriptor);
4001 uri.writeToParcel(data, 0);
4002 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004003 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004004 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4005 reply.readException();
4006 data.recycle();
4007 reply.recycle();
4008 }
4009
4010 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004011 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4012 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004013 Parcel data = Parcel.obtain();
4014 Parcel reply = Parcel.obtain();
4015 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004016 data.writeString(packageName);
4017 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004018 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4019 reply.readException();
4020 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4021 reply);
4022 data.recycle();
4023 reply.recycle();
4024 return perms;
4025 }
4026
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004027 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4028 throws RemoteException {
4029 Parcel data = Parcel.obtain();
4030 Parcel reply = Parcel.obtain();
4031 data.writeInterfaceToken(IActivityManager.descriptor);
4032 data.writeStrongBinder(who.asBinder());
4033 data.writeInt(waiting ? 1 : 0);
4034 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4035 reply.readException();
4036 data.recycle();
4037 reply.recycle();
4038 }
4039 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4040 Parcel data = Parcel.obtain();
4041 Parcel reply = Parcel.obtain();
4042 data.writeInterfaceToken(IActivityManager.descriptor);
4043 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4044 reply.readException();
4045 outInfo.readFromParcel(reply);
4046 data.recycle();
4047 reply.recycle();
4048 }
4049 public void unhandledBack() throws RemoteException
4050 {
4051 Parcel data = Parcel.obtain();
4052 Parcel reply = Parcel.obtain();
4053 data.writeInterfaceToken(IActivityManager.descriptor);
4054 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4055 reply.readException();
4056 data.recycle();
4057 reply.recycle();
4058 }
4059 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4060 {
4061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4065 reply.readException();
4066 ParcelFileDescriptor pfd = null;
4067 if (reply.readInt() != 0) {
4068 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4069 }
4070 data.recycle();
4071 reply.recycle();
4072 return pfd;
4073 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004074 public void setLockScreenShown(boolean shown) throws RemoteException
4075 {
4076 Parcel data = Parcel.obtain();
4077 Parcel reply = Parcel.obtain();
4078 data.writeInterfaceToken(IActivityManager.descriptor);
4079 data.writeInt(shown ? 1 : 0);
4080 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4081 reply.readException();
4082 data.recycle();
4083 reply.recycle();
4084 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004085 public void setDebugApp(
4086 String packageName, boolean waitForDebugger, boolean persistent)
4087 throws RemoteException
4088 {
4089 Parcel data = Parcel.obtain();
4090 Parcel reply = Parcel.obtain();
4091 data.writeInterfaceToken(IActivityManager.descriptor);
4092 data.writeString(packageName);
4093 data.writeInt(waitForDebugger ? 1 : 0);
4094 data.writeInt(persistent ? 1 : 0);
4095 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4096 reply.readException();
4097 data.recycle();
4098 reply.recycle();
4099 }
4100 public void setAlwaysFinish(boolean enabled) throws RemoteException
4101 {
4102 Parcel data = Parcel.obtain();
4103 Parcel reply = Parcel.obtain();
4104 data.writeInterfaceToken(IActivityManager.descriptor);
4105 data.writeInt(enabled ? 1 : 0);
4106 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4107 reply.readException();
4108 data.recycle();
4109 reply.recycle();
4110 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004111 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004112 {
4113 Parcel data = Parcel.obtain();
4114 Parcel reply = Parcel.obtain();
4115 data.writeInterfaceToken(IActivityManager.descriptor);
4116 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004117 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004118 reply.readException();
4119 data.recycle();
4120 reply.recycle();
4121 }
4122 public void enterSafeMode() throws RemoteException {
4123 Parcel data = Parcel.obtain();
4124 data.writeInterfaceToken(IActivityManager.descriptor);
4125 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4126 data.recycle();
4127 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004128 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4129 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004130 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004131 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004132 data.writeStrongBinder(sender.asBinder());
4133 data.writeInt(sourceUid);
4134 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004135 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4136 data.recycle();
4137 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004138 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004139 Parcel data = Parcel.obtain();
4140 Parcel reply = Parcel.obtain();
4141 data.writeInterfaceToken(IActivityManager.descriptor);
4142 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004143 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004144 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004145 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004146 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004147 boolean res = reply.readInt() != 0;
4148 data.recycle();
4149 reply.recycle();
4150 return res;
4151 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004152 @Override
4153 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4154 Parcel data = Parcel.obtain();
4155 Parcel reply = Parcel.obtain();
4156 data.writeInterfaceToken(IActivityManager.descriptor);
4157 data.writeString(reason);
4158 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4159 boolean res = reply.readInt() != 0;
4160 data.recycle();
4161 reply.recycle();
4162 return res;
4163 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004164 public boolean testIsSystemReady()
4165 {
4166 /* this base class version is never called */
4167 return true;
4168 }
Dan Egnor60d87622009-12-16 16:32:58 -08004169 public void handleApplicationCrash(IBinder app,
4170 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4171 {
4172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 data.writeStrongBinder(app);
4176 crashInfo.writeToParcel(data, 0);
4177 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4178 reply.readException();
4179 reply.recycle();
4180 data.recycle();
4181 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004182
Dianne Hackborn52322712014-08-26 22:47:26 -07004183 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004184 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004185 {
4186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004190 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004191 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004192 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004193 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004194 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004195 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004196 reply.recycle();
4197 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004198 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004199 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004200
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004201 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004202 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004203 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004204 {
4205 Parcel data = Parcel.obtain();
4206 Parcel reply = Parcel.obtain();
4207 data.writeInterfaceToken(IActivityManager.descriptor);
4208 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004209 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004210 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004211 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4212 reply.readException();
4213 reply.recycle();
4214 data.recycle();
4215 }
4216
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004217 public void signalPersistentProcesses(int sig) throws RemoteException {
4218 Parcel data = Parcel.obtain();
4219 Parcel reply = Parcel.obtain();
4220 data.writeInterfaceToken(IActivityManager.descriptor);
4221 data.writeInt(sig);
4222 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4223 reply.readException();
4224 data.recycle();
4225 reply.recycle();
4226 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004227
Dianne Hackborn1676c852012-09-10 14:52:30 -07004228 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004229 Parcel data = Parcel.obtain();
4230 Parcel reply = Parcel.obtain();
4231 data.writeInterfaceToken(IActivityManager.descriptor);
4232 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004233 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004234 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4235 reply.readException();
4236 data.recycle();
4237 reply.recycle();
4238 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004239
4240 public void killAllBackgroundProcesses() throws RemoteException {
4241 Parcel data = Parcel.obtain();
4242 Parcel reply = Parcel.obtain();
4243 data.writeInterfaceToken(IActivityManager.descriptor);
4244 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4245 reply.readException();
4246 data.recycle();
4247 reply.recycle();
4248 }
4249
Dianne Hackborn1676c852012-09-10 14:52:30 -07004250 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004251 Parcel data = Parcel.obtain();
4252 Parcel reply = Parcel.obtain();
4253 data.writeInterfaceToken(IActivityManager.descriptor);
4254 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004255 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004256 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004257 reply.readException();
4258 data.recycle();
4259 reply.recycle();
4260 }
4261
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004262 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4263 throws RemoteException
4264 {
4265 Parcel data = Parcel.obtain();
4266 Parcel reply = Parcel.obtain();
4267 data.writeInterfaceToken(IActivityManager.descriptor);
4268 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4269 reply.readException();
4270 outInfo.readFromParcel(reply);
4271 reply.recycle();
4272 data.recycle();
4273 }
4274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004275 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4276 {
4277 Parcel data = Parcel.obtain();
4278 Parcel reply = Parcel.obtain();
4279 data.writeInterfaceToken(IActivityManager.descriptor);
4280 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4281 reply.readException();
4282 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4283 reply.recycle();
4284 data.recycle();
4285 return res;
4286 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004287
Dianne Hackborn1676c852012-09-10 14:52:30 -07004288 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004289 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004290 {
4291 Parcel data = Parcel.obtain();
4292 Parcel reply = Parcel.obtain();
4293 data.writeInterfaceToken(IActivityManager.descriptor);
4294 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004295 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004296 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004297 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004298 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004299 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004300 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004301 } else {
4302 data.writeInt(0);
4303 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004304 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4305 reply.readException();
4306 boolean res = reply.readInt() != 0;
4307 reply.recycle();
4308 data.recycle();
4309 return res;
4310 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004311
Dianne Hackborn55280a92009-05-07 15:53:46 -07004312 public boolean shutdown(int timeout) throws RemoteException
4313 {
4314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 data.writeInt(timeout);
4318 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4319 reply.readException();
4320 boolean res = reply.readInt() != 0;
4321 reply.recycle();
4322 data.recycle();
4323 return res;
4324 }
4325
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004326 public void stopAppSwitches() throws RemoteException {
4327 Parcel data = Parcel.obtain();
4328 Parcel reply = Parcel.obtain();
4329 data.writeInterfaceToken(IActivityManager.descriptor);
4330 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4331 reply.readException();
4332 reply.recycle();
4333 data.recycle();
4334 }
4335
4336 public void resumeAppSwitches() throws RemoteException {
4337 Parcel data = Parcel.obtain();
4338 Parcel reply = Parcel.obtain();
4339 data.writeInterfaceToken(IActivityManager.descriptor);
4340 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4341 reply.readException();
4342 reply.recycle();
4343 data.recycle();
4344 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004345
4346 public void addPackageDependency(String packageName) throws RemoteException {
4347 Parcel data = Parcel.obtain();
4348 Parcel reply = Parcel.obtain();
4349 data.writeInterfaceToken(IActivityManager.descriptor);
4350 data.writeString(packageName);
4351 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4352 reply.readException();
4353 data.recycle();
4354 reply.recycle();
4355 }
4356
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004357 public void killApplicationWithAppId(String pkg, int appid, String reason)
4358 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004359 Parcel data = Parcel.obtain();
4360 Parcel reply = Parcel.obtain();
4361 data.writeInterfaceToken(IActivityManager.descriptor);
4362 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004363 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004364 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004365 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004366 reply.readException();
4367 data.recycle();
4368 reply.recycle();
4369 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004370
4371 public void closeSystemDialogs(String reason) throws RemoteException {
4372 Parcel data = Parcel.obtain();
4373 Parcel reply = Parcel.obtain();
4374 data.writeInterfaceToken(IActivityManager.descriptor);
4375 data.writeString(reason);
4376 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 data.recycle();
4379 reply.recycle();
4380 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004381
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004382 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004383 throws RemoteException {
4384 Parcel data = Parcel.obtain();
4385 Parcel reply = Parcel.obtain();
4386 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004387 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004388 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4389 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004390 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004391 data.recycle();
4392 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004393 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004394 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004395
4396 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4397 Parcel data = Parcel.obtain();
4398 Parcel reply = Parcel.obtain();
4399 data.writeInterfaceToken(IActivityManager.descriptor);
4400 data.writeString(processName);
4401 data.writeInt(uid);
4402 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4403 reply.readException();
4404 data.recycle();
4405 reply.recycle();
4406 }
4407
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004408 public void overridePendingTransition(IBinder token, String packageName,
4409 int enterAnim, int exitAnim) throws RemoteException {
4410 Parcel data = Parcel.obtain();
4411 Parcel reply = Parcel.obtain();
4412 data.writeInterfaceToken(IActivityManager.descriptor);
4413 data.writeStrongBinder(token);
4414 data.writeString(packageName);
4415 data.writeInt(enterAnim);
4416 data.writeInt(exitAnim);
4417 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4418 reply.readException();
4419 data.recycle();
4420 reply.recycle();
4421 }
4422
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004423 public boolean isUserAMonkey() throws RemoteException {
4424 Parcel data = Parcel.obtain();
4425 Parcel reply = Parcel.obtain();
4426 data.writeInterfaceToken(IActivityManager.descriptor);
4427 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4428 reply.readException();
4429 boolean res = reply.readInt() != 0;
4430 data.recycle();
4431 reply.recycle();
4432 return res;
4433 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004434
4435 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4436 Parcel data = Parcel.obtain();
4437 Parcel reply = Parcel.obtain();
4438 data.writeInterfaceToken(IActivityManager.descriptor);
4439 data.writeInt(monkey ? 1 : 0);
4440 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4441 reply.readException();
4442 data.recycle();
4443 reply.recycle();
4444 }
4445
Dianne Hackborn860755f2010-06-03 18:47:52 -07004446 public void finishHeavyWeightApp() throws RemoteException {
4447 Parcel data = Parcel.obtain();
4448 Parcel reply = Parcel.obtain();
4449 data.writeInterfaceToken(IActivityManager.descriptor);
4450 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4451 reply.readException();
4452 data.recycle();
4453 reply.recycle();
4454 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004455
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004456 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004457 throws RemoteException {
4458 Parcel data = Parcel.obtain();
4459 Parcel reply = Parcel.obtain();
4460 data.writeInterfaceToken(IActivityManager.descriptor);
4461 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004462 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4463 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004464 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004465 data.recycle();
4466 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004467 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004468 }
4469
Craig Mautner233ceee2014-05-09 17:05:11 -07004470 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004471 throws RemoteException {
4472 Parcel data = Parcel.obtain();
4473 Parcel reply = Parcel.obtain();
4474 data.writeInterfaceToken(IActivityManager.descriptor);
4475 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004476 if (options == null) {
4477 data.writeInt(0);
4478 } else {
4479 data.writeInt(1);
4480 data.writeBundle(options.toBundle());
4481 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004482 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004483 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004484 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004485 data.recycle();
4486 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004487 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004488 }
4489
Craig Mautner233ceee2014-05-09 17:05:11 -07004490 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4491 Parcel data = Parcel.obtain();
4492 Parcel reply = Parcel.obtain();
4493 data.writeInterfaceToken(IActivityManager.descriptor);
4494 data.writeStrongBinder(token);
4495 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4496 reply.readException();
4497 Bundle bundle = reply.readBundle();
4498 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4499 data.recycle();
4500 reply.recycle();
4501 return options;
4502 }
4503
Daniel Sandler69a48172010-06-23 16:29:36 -04004504 public void setImmersive(IBinder token, boolean immersive)
4505 throws RemoteException {
4506 Parcel data = Parcel.obtain();
4507 Parcel reply = Parcel.obtain();
4508 data.writeInterfaceToken(IActivityManager.descriptor);
4509 data.writeStrongBinder(token);
4510 data.writeInt(immersive ? 1 : 0);
4511 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4512 reply.readException();
4513 data.recycle();
4514 reply.recycle();
4515 }
4516
4517 public boolean isImmersive(IBinder token)
4518 throws RemoteException {
4519 Parcel data = Parcel.obtain();
4520 Parcel reply = Parcel.obtain();
4521 data.writeInterfaceToken(IActivityManager.descriptor);
4522 data.writeStrongBinder(token);
4523 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004524 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004525 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004526 data.recycle();
4527 reply.recycle();
4528 return res;
4529 }
4530
Craig Mautnerd61dc202014-07-07 11:09:11 -07004531 public boolean isTopOfTask(IBinder token) throws RemoteException {
4532 Parcel data = Parcel.obtain();
4533 Parcel reply = Parcel.obtain();
4534 data.writeInterfaceToken(IActivityManager.descriptor);
4535 data.writeStrongBinder(token);
4536 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4537 reply.readException();
4538 boolean res = reply.readInt() == 1;
4539 data.recycle();
4540 reply.recycle();
4541 return res;
4542 }
4543
Daniel Sandler69a48172010-06-23 16:29:36 -04004544 public boolean isTopActivityImmersive()
4545 throws RemoteException {
4546 Parcel data = Parcel.obtain();
4547 Parcel reply = Parcel.obtain();
4548 data.writeInterfaceToken(IActivityManager.descriptor);
4549 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004550 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004551 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004552 data.recycle();
4553 reply.recycle();
4554 return res;
4555 }
4556
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004557 public void crashApplication(int uid, int initialPid, String packageName,
4558 String message) throws RemoteException {
4559 Parcel data = Parcel.obtain();
4560 Parcel reply = Parcel.obtain();
4561 data.writeInterfaceToken(IActivityManager.descriptor);
4562 data.writeInt(uid);
4563 data.writeInt(initialPid);
4564 data.writeString(packageName);
4565 data.writeString(message);
4566 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4567 reply.readException();
4568 data.recycle();
4569 reply.recycle();
4570 }
Andy McFadden824c5102010-07-09 16:26:57 -07004571
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004572 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004573 Parcel data = Parcel.obtain();
4574 Parcel reply = Parcel.obtain();
4575 data.writeInterfaceToken(IActivityManager.descriptor);
4576 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004577 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004578 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4579 reply.readException();
4580 String res = reply.readString();
4581 data.recycle();
4582 reply.recycle();
4583 return res;
4584 }
4585
Dianne Hackborn7e269642010-08-25 19:50:20 -07004586 public IBinder newUriPermissionOwner(String name)
4587 throws RemoteException {
4588 Parcel data = Parcel.obtain();
4589 Parcel reply = Parcel.obtain();
4590 data.writeInterfaceToken(IActivityManager.descriptor);
4591 data.writeString(name);
4592 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4593 reply.readException();
4594 IBinder res = reply.readStrongBinder();
4595 data.recycle();
4596 reply.recycle();
4597 return res;
4598 }
4599
4600 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004601 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004602 Parcel data = Parcel.obtain();
4603 Parcel reply = Parcel.obtain();
4604 data.writeInterfaceToken(IActivityManager.descriptor);
4605 data.writeStrongBinder(owner);
4606 data.writeInt(fromUid);
4607 data.writeString(targetPkg);
4608 uri.writeToParcel(data, 0);
4609 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004610 data.writeInt(sourceUserId);
4611 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004612 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4613 reply.readException();
4614 data.recycle();
4615 reply.recycle();
4616 }
4617
4618 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004619 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004620 Parcel data = Parcel.obtain();
4621 Parcel reply = Parcel.obtain();
4622 data.writeInterfaceToken(IActivityManager.descriptor);
4623 data.writeStrongBinder(owner);
4624 if (uri != null) {
4625 data.writeInt(1);
4626 uri.writeToParcel(data, 0);
4627 } else {
4628 data.writeInt(0);
4629 }
4630 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004631 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004632 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4633 reply.readException();
4634 data.recycle();
4635 reply.recycle();
4636 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004637
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004638 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004639 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004640 Parcel data = Parcel.obtain();
4641 Parcel reply = Parcel.obtain();
4642 data.writeInterfaceToken(IActivityManager.descriptor);
4643 data.writeInt(callingUid);
4644 data.writeString(targetPkg);
4645 uri.writeToParcel(data, 0);
4646 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004647 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004648 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4649 reply.readException();
4650 int res = reply.readInt();
4651 data.recycle();
4652 reply.recycle();
4653 return res;
4654 }
4655
Dianne Hackborn1676c852012-09-10 14:52:30 -07004656 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004657 String path, ParcelFileDescriptor fd) throws RemoteException {
4658 Parcel data = Parcel.obtain();
4659 Parcel reply = Parcel.obtain();
4660 data.writeInterfaceToken(IActivityManager.descriptor);
4661 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004662 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004663 data.writeInt(managed ? 1 : 0);
4664 data.writeString(path);
4665 if (fd != null) {
4666 data.writeInt(1);
4667 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4668 } else {
4669 data.writeInt(0);
4670 }
4671 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4672 reply.readException();
4673 boolean res = reply.readInt() != 0;
4674 reply.recycle();
4675 data.recycle();
4676 return res;
4677 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004678
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004679 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004680 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004681 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004682 Parcel data = Parcel.obtain();
4683 Parcel reply = Parcel.obtain();
4684 data.writeInterfaceToken(IActivityManager.descriptor);
4685 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004686 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004687 data.writeTypedArray(intents, 0);
4688 data.writeStringArray(resolvedTypes);
4689 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004690 if (options != null) {
4691 data.writeInt(1);
4692 options.writeToParcel(data, 0);
4693 } else {
4694 data.writeInt(0);
4695 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004696 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004697 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4698 reply.readException();
4699 int result = reply.readInt();
4700 reply.recycle();
4701 data.recycle();
4702 return result;
4703 }
4704
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004705 public int getFrontActivityScreenCompatMode() throws RemoteException {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4710 reply.readException();
4711 int mode = reply.readInt();
4712 reply.recycle();
4713 data.recycle();
4714 return mode;
4715 }
4716
4717 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4718 Parcel data = Parcel.obtain();
4719 Parcel reply = Parcel.obtain();
4720 data.writeInterfaceToken(IActivityManager.descriptor);
4721 data.writeInt(mode);
4722 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4723 reply.readException();
4724 reply.recycle();
4725 data.recycle();
4726 }
4727
4728 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4729 Parcel data = Parcel.obtain();
4730 Parcel reply = Parcel.obtain();
4731 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004732 data.writeString(packageName);
4733 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004734 reply.readException();
4735 int mode = reply.readInt();
4736 reply.recycle();
4737 data.recycle();
4738 return mode;
4739 }
4740
4741 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004742 throws RemoteException {
4743 Parcel data = Parcel.obtain();
4744 Parcel reply = Parcel.obtain();
4745 data.writeInterfaceToken(IActivityManager.descriptor);
4746 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004747 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004748 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4749 reply.readException();
4750 reply.recycle();
4751 data.recycle();
4752 }
4753
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004754 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4755 Parcel data = Parcel.obtain();
4756 Parcel reply = Parcel.obtain();
4757 data.writeInterfaceToken(IActivityManager.descriptor);
4758 data.writeString(packageName);
4759 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4760 reply.readException();
4761 boolean ask = reply.readInt() != 0;
4762 reply.recycle();
4763 data.recycle();
4764 return ask;
4765 }
4766
4767 public void setPackageAskScreenCompat(String packageName, boolean ask)
4768 throws RemoteException {
4769 Parcel data = Parcel.obtain();
4770 Parcel reply = Parcel.obtain();
4771 data.writeInterfaceToken(IActivityManager.descriptor);
4772 data.writeString(packageName);
4773 data.writeInt(ask ? 1 : 0);
4774 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4775 reply.readException();
4776 reply.recycle();
4777 data.recycle();
4778 }
4779
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004780 public boolean switchUser(int userid) throws RemoteException {
4781 Parcel data = Parcel.obtain();
4782 Parcel reply = Parcel.obtain();
4783 data.writeInterfaceToken(IActivityManager.descriptor);
4784 data.writeInt(userid);
4785 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4786 reply.readException();
4787 boolean result = reply.readInt() != 0;
4788 reply.recycle();
4789 data.recycle();
4790 return result;
4791 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004792
Kenny Guy08488bf2014-02-21 17:40:37 +00004793 public boolean startUserInBackground(int userid) throws RemoteException {
4794 Parcel data = Parcel.obtain();
4795 Parcel reply = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 data.writeInt(userid);
4798 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4799 reply.readException();
4800 boolean result = reply.readInt() != 0;
4801 reply.recycle();
4802 data.recycle();
4803 return result;
4804 }
4805
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004806 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4807 Parcel data = Parcel.obtain();
4808 Parcel reply = Parcel.obtain();
4809 data.writeInterfaceToken(IActivityManager.descriptor);
4810 data.writeInt(userid);
4811 data.writeStrongInterface(callback);
4812 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4813 reply.readException();
4814 int result = reply.readInt();
4815 reply.recycle();
4816 data.recycle();
4817 return result;
4818 }
4819
Amith Yamasani52f1d752012-03-28 18:19:29 -07004820 public UserInfo getCurrentUser() throws RemoteException {
4821 Parcel data = Parcel.obtain();
4822 Parcel reply = Parcel.obtain();
4823 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004824 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004825 reply.readException();
4826 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4827 reply.recycle();
4828 data.recycle();
4829 return userInfo;
4830 }
4831
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004832 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004833 Parcel data = Parcel.obtain();
4834 Parcel reply = Parcel.obtain();
4835 data.writeInterfaceToken(IActivityManager.descriptor);
4836 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004837 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004838 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4839 reply.readException();
4840 boolean result = reply.readInt() != 0;
4841 reply.recycle();
4842 data.recycle();
4843 return result;
4844 }
4845
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004846 public int[] getRunningUserIds() throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4851 reply.readException();
4852 int[] result = reply.createIntArray();
4853 reply.recycle();
4854 data.recycle();
4855 return result;
4856 }
4857
Wale Ogunwaled54b5782014-10-23 15:55:23 -07004858 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004859 Parcel data = Parcel.obtain();
4860 Parcel reply = Parcel.obtain();
4861 data.writeInterfaceToken(IActivityManager.descriptor);
4862 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004863 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4864 reply.readException();
4865 boolean result = reply.readInt() != 0;
4866 reply.recycle();
4867 data.recycle();
4868 return result;
4869 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004870
Jeff Sharkeya4620792011-05-20 15:29:23 -07004871 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4872 Parcel data = Parcel.obtain();
4873 Parcel reply = Parcel.obtain();
4874 data.writeInterfaceToken(IActivityManager.descriptor);
4875 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4876 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4877 reply.readException();
4878 data.recycle();
4879 reply.recycle();
4880 }
4881
4882 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4883 Parcel data = Parcel.obtain();
4884 Parcel reply = Parcel.obtain();
4885 data.writeInterfaceToken(IActivityManager.descriptor);
4886 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4887 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4888 reply.readException();
4889 data.recycle();
4890 reply.recycle();
4891 }
4892
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004893 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4894 Parcel data = Parcel.obtain();
4895 Parcel reply = Parcel.obtain();
4896 data.writeInterfaceToken(IActivityManager.descriptor);
4897 data.writeStrongBinder(sender.asBinder());
4898 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4899 reply.readException();
4900 boolean res = reply.readInt() != 0;
4901 data.recycle();
4902 reply.recycle();
4903 return res;
4904 }
4905
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004906 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4907 Parcel data = Parcel.obtain();
4908 Parcel reply = Parcel.obtain();
4909 data.writeInterfaceToken(IActivityManager.descriptor);
4910 data.writeStrongBinder(sender.asBinder());
4911 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4912 reply.readException();
4913 boolean res = reply.readInt() != 0;
4914 data.recycle();
4915 reply.recycle();
4916 return res;
4917 }
4918
Dianne Hackborn81038902012-11-26 17:04:09 -08004919 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4920 Parcel data = Parcel.obtain();
4921 Parcel reply = Parcel.obtain();
4922 data.writeInterfaceToken(IActivityManager.descriptor);
4923 data.writeStrongBinder(sender.asBinder());
4924 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4925 reply.readException();
4926 Intent res = reply.readInt() != 0
4927 ? Intent.CREATOR.createFromParcel(reply) : null;
4928 data.recycle();
4929 reply.recycle();
4930 return res;
4931 }
4932
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004933 public String getTagForIntentSender(IIntentSender sender, String prefix)
4934 throws RemoteException {
4935 Parcel data = Parcel.obtain();
4936 Parcel reply = Parcel.obtain();
4937 data.writeInterfaceToken(IActivityManager.descriptor);
4938 data.writeStrongBinder(sender.asBinder());
4939 data.writeString(prefix);
4940 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4941 reply.readException();
4942 String res = reply.readString();
4943 data.recycle();
4944 reply.recycle();
4945 return res;
4946 }
4947
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004948 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4949 {
4950 Parcel data = Parcel.obtain();
4951 Parcel reply = Parcel.obtain();
4952 data.writeInterfaceToken(IActivityManager.descriptor);
4953 values.writeToParcel(data, 0);
4954 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4955 reply.readException();
4956 data.recycle();
4957 reply.recycle();
4958 }
4959
Dianne Hackbornb437e092011-08-05 17:50:29 -07004960 public long[] getProcessPss(int[] pids) throws RemoteException {
4961 Parcel data = Parcel.obtain();
4962 Parcel reply = Parcel.obtain();
4963 data.writeInterfaceToken(IActivityManager.descriptor);
4964 data.writeIntArray(pids);
4965 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4966 reply.readException();
4967 long[] res = reply.createLongArray();
4968 data.recycle();
4969 reply.recycle();
4970 return res;
4971 }
4972
Dianne Hackborn661cd522011-08-22 00:26:20 -07004973 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4974 Parcel data = Parcel.obtain();
4975 Parcel reply = Parcel.obtain();
4976 data.writeInterfaceToken(IActivityManager.descriptor);
4977 TextUtils.writeToParcel(msg, data, 0);
4978 data.writeInt(always ? 1 : 0);
4979 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4980 reply.readException();
4981 data.recycle();
4982 reply.recycle();
4983 }
4984
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004985 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004986 Parcel data = Parcel.obtain();
4987 Parcel reply = Parcel.obtain();
4988 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004989 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004990 reply.readException();
4991 data.recycle();
4992 reply.recycle();
4993 }
4994
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004995 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004996 throws RemoteException {
4997 Parcel data = Parcel.obtain();
4998 Parcel reply = Parcel.obtain();
4999 data.writeInterfaceToken(IActivityManager.descriptor);
5000 data.writeStrongBinder(token);
5001 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005002 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005003 reply.readException();
5004 boolean result = reply.readInt() != 0;
5005 data.recycle();
5006 reply.recycle();
5007 return result;
5008 }
5009
5010 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5011 throws RemoteException {
5012 Parcel data = Parcel.obtain();
5013 Parcel reply = Parcel.obtain();
5014 data.writeInterfaceToken(IActivityManager.descriptor);
5015 data.writeStrongBinder(token);
5016 target.writeToParcel(data, 0);
5017 data.writeInt(resultCode);
5018 if (resultData != null) {
5019 data.writeInt(1);
5020 resultData.writeToParcel(data, 0);
5021 } else {
5022 data.writeInt(0);
5023 }
5024 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5025 reply.readException();
5026 boolean result = reply.readInt() != 0;
5027 data.recycle();
5028 reply.recycle();
5029 return result;
5030 }
5031
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005032 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5033 Parcel data = Parcel.obtain();
5034 Parcel reply = Parcel.obtain();
5035 data.writeInterfaceToken(IActivityManager.descriptor);
5036 data.writeStrongBinder(activityToken);
5037 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5038 reply.readException();
5039 int result = reply.readInt();
5040 data.recycle();
5041 reply.recycle();
5042 return result;
5043 }
5044
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005045 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5046 Parcel data = Parcel.obtain();
5047 Parcel reply = Parcel.obtain();
5048 data.writeInterfaceToken(IActivityManager.descriptor);
5049 data.writeStrongBinder(activityToken);
5050 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5051 reply.readException();
5052 String result = reply.readString();
5053 data.recycle();
5054 reply.recycle();
5055 return result;
5056 }
5057
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005058 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5059 Parcel data = Parcel.obtain();
5060 Parcel reply = Parcel.obtain();
5061 data.writeInterfaceToken(IActivityManager.descriptor);
5062 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5063 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5064 reply.readException();
5065 data.recycle();
5066 reply.recycle();
5067 }
5068
5069 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5070 Parcel data = Parcel.obtain();
5071 Parcel reply = Parcel.obtain();
5072 data.writeInterfaceToken(IActivityManager.descriptor);
5073 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5074 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5075 reply.readException();
5076 data.recycle();
5077 reply.recycle();
5078 }
5079
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005080 public void requestBugReport() throws RemoteException {
5081 Parcel data = Parcel.obtain();
5082 Parcel reply = Parcel.obtain();
5083 data.writeInterfaceToken(IActivityManager.descriptor);
5084 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5085 reply.readException();
5086 data.recycle();
5087 reply.recycle();
5088 }
5089
Jeff Brownbd181bb2013-09-10 16:44:24 -07005090 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5091 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005092 Parcel data = Parcel.obtain();
5093 Parcel reply = Parcel.obtain();
5094 data.writeInterfaceToken(IActivityManager.descriptor);
5095 data.writeInt(pid);
5096 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005097 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005098 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5099 reply.readException();
5100 long res = reply.readInt();
5101 data.recycle();
5102 reply.recycle();
5103 return res;
5104 }
5105
Adam Skorydfc7fd72013-08-05 19:23:41 -07005106 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005107 Parcel data = Parcel.obtain();
5108 Parcel reply = Parcel.obtain();
5109 data.writeInterfaceToken(IActivityManager.descriptor);
5110 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005111 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005112 reply.readException();
5113 Bundle res = reply.readBundle();
5114 data.recycle();
5115 reply.recycle();
5116 return res;
5117 }
5118
Adam Skory7140a252013-09-11 12:04:58 +01005119 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005120 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005121 Parcel data = Parcel.obtain();
5122 Parcel reply = Parcel.obtain();
5123 data.writeInterfaceToken(IActivityManager.descriptor);
5124 data.writeStrongBinder(token);
5125 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005126 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005127 reply.readException();
5128 data.recycle();
5129 reply.recycle();
5130 }
5131
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005132 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5133 throws RemoteException {
5134 Parcel data = Parcel.obtain();
5135 Parcel reply = Parcel.obtain();
5136 data.writeInterfaceToken(IActivityManager.descriptor);
5137 intent.writeToParcel(data, 0);
5138 data.writeInt(requestType);
5139 data.writeString(hint);
5140 data.writeInt(userHandle);
5141 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5142 reply.readException();
5143 boolean res = reply.readInt() != 0;
5144 data.recycle();
5145 reply.recycle();
5146 return res;
5147 }
5148
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005149 public void killUid(int uid, String reason) throws RemoteException {
5150 Parcel data = Parcel.obtain();
5151 Parcel reply = Parcel.obtain();
5152 data.writeInterfaceToken(IActivityManager.descriptor);
5153 data.writeInt(uid);
5154 data.writeString(reason);
5155 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5156 reply.readException();
5157 data.recycle();
5158 reply.recycle();
5159 }
5160
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005161 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5162 Parcel data = Parcel.obtain();
5163 Parcel reply = Parcel.obtain();
5164 data.writeInterfaceToken(IActivityManager.descriptor);
5165 data.writeStrongBinder(who);
5166 data.writeInt(allowRestart ? 1 : 0);
5167 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5168 reply.readException();
5169 data.recycle();
5170 reply.recycle();
5171 }
5172
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005173 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5174 Parcel data = Parcel.obtain();
5175 Parcel reply = Parcel.obtain();
5176 data.writeInterfaceToken(IActivityManager.descriptor);
5177 data.writeStrongBinder(token);
5178 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5179 reply.readException();
5180 data.recycle();
5181 reply.recycle();
5182 }
5183
Craig Mautner5eda9b32013-07-02 11:58:16 -07005184 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5185 Parcel data = Parcel.obtain();
5186 Parcel reply = Parcel.obtain();
5187 data.writeInterfaceToken(IActivityManager.descriptor);
5188 data.writeStrongBinder(token);
5189 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5190 reply.readException();
5191 data.recycle();
5192 reply.recycle();
5193 }
5194
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005195 public void restart() throws RemoteException {
5196 Parcel data = Parcel.obtain();
5197 Parcel reply = Parcel.obtain();
5198 data.writeInterfaceToken(IActivityManager.descriptor);
5199 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5200 reply.readException();
5201 data.recycle();
5202 reply.recycle();
5203 }
5204
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005205 public void performIdleMaintenance() throws RemoteException {
5206 Parcel data = Parcel.obtain();
5207 Parcel reply = Parcel.obtain();
5208 data.writeInterfaceToken(IActivityManager.descriptor);
5209 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5210 reply.readException();
5211 data.recycle();
5212 reply.recycle();
5213 }
5214
Todd Kennedyca4d8422015-01-15 15:19:22 -08005215 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005216 IActivityContainerCallback callback) throws RemoteException {
5217 Parcel data = Parcel.obtain();
5218 Parcel reply = Parcel.obtain();
5219 data.writeInterfaceToken(IActivityManager.descriptor);
5220 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005221 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005222 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005223 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005224 final int result = reply.readInt();
5225 final IActivityContainer res;
5226 if (result == 1) {
5227 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5228 } else {
5229 res = null;
5230 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005231 data.recycle();
5232 reply.recycle();
5233 return res;
5234 }
5235
Craig Mautner95da1082014-02-24 17:54:35 -08005236 public void deleteActivityContainer(IActivityContainer activityContainer)
5237 throws RemoteException {
5238 Parcel data = Parcel.obtain();
5239 Parcel reply = Parcel.obtain();
5240 data.writeInterfaceToken(IActivityManager.descriptor);
5241 data.writeStrongBinder(activityContainer.asBinder());
5242 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5243 reply.readException();
5244 data.recycle();
5245 reply.recycle();
5246 }
5247
Todd Kennedy4900bf92015-01-16 16:05:14 -08005248 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5249 Parcel data = Parcel.obtain();
5250 Parcel reply = Parcel.obtain();
5251 data.writeInterfaceToken(IActivityManager.descriptor);
5252 data.writeInt(displayId);
5253 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5254 reply.readException();
5255 final int result = reply.readInt();
5256 final IActivityContainer res;
5257 if (result == 1) {
5258 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5259 } else {
5260 res = null;
5261 }
5262 data.recycle();
5263 reply.recycle();
5264 return res;
5265 }
5266
Craig Mautnere0a38842013-12-16 16:14:02 -08005267 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5268 throws RemoteException {
5269 Parcel data = Parcel.obtain();
5270 Parcel reply = Parcel.obtain();
5271 data.writeInterfaceToken(IActivityManager.descriptor);
5272 data.writeStrongBinder(activityToken);
5273 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5274 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005275 final int result = reply.readInt();
5276 final IActivityContainer res;
5277 if (result == 1) {
5278 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5279 } else {
5280 res = null;
5281 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005282 data.recycle();
5283 reply.recycle();
5284 return res;
5285 }
5286
Craig Mautner4a1cb222013-12-04 16:14:06 -08005287 public IBinder getHomeActivityToken() throws RemoteException {
5288 Parcel data = Parcel.obtain();
5289 Parcel reply = Parcel.obtain();
5290 data.writeInterfaceToken(IActivityManager.descriptor);
5291 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5292 reply.readException();
5293 IBinder res = reply.readStrongBinder();
5294 data.recycle();
5295 reply.recycle();
5296 return res;
5297 }
5298
Craig Mautneraea74a52014-03-08 14:23:10 -08005299 @Override
5300 public void startLockTaskMode(int taskId) throws RemoteException {
5301 Parcel data = Parcel.obtain();
5302 Parcel reply = Parcel.obtain();
5303 data.writeInterfaceToken(IActivityManager.descriptor);
5304 data.writeInt(taskId);
5305 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5306 reply.readException();
5307 data.recycle();
5308 reply.recycle();
5309 }
5310
5311 @Override
5312 public void startLockTaskMode(IBinder token) throws RemoteException {
5313 Parcel data = Parcel.obtain();
5314 Parcel reply = Parcel.obtain();
5315 data.writeInterfaceToken(IActivityManager.descriptor);
5316 data.writeStrongBinder(token);
5317 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5318 reply.readException();
5319 data.recycle();
5320 reply.recycle();
5321 }
5322
5323 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005324 public void startLockTaskModeOnCurrent() throws RemoteException {
5325 Parcel data = Parcel.obtain();
5326 Parcel reply = Parcel.obtain();
5327 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005328 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005329 reply.readException();
5330 data.recycle();
5331 reply.recycle();
5332 }
5333
5334 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005335 public void stopLockTaskMode() throws RemoteException {
5336 Parcel data = Parcel.obtain();
5337 Parcel reply = Parcel.obtain();
5338 data.writeInterfaceToken(IActivityManager.descriptor);
5339 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5340 reply.readException();
5341 data.recycle();
5342 reply.recycle();
5343 }
5344
5345 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005346 public void stopLockTaskModeOnCurrent() throws RemoteException {
5347 Parcel data = Parcel.obtain();
5348 Parcel reply = Parcel.obtain();
5349 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005350 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005351 reply.readException();
5352 data.recycle();
5353 reply.recycle();
5354 }
5355
5356 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005357 public boolean isInLockTaskMode() throws RemoteException {
5358 Parcel data = Parcel.obtain();
5359 Parcel reply = Parcel.obtain();
5360 data.writeInterfaceToken(IActivityManager.descriptor);
5361 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5362 reply.readException();
5363 boolean isInLockTaskMode = reply.readInt() == 1;
5364 data.recycle();
5365 reply.recycle();
5366 return isInLockTaskMode;
5367 }
5368
Craig Mautner688b5102014-03-27 16:55:03 -07005369 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005370 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005371 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005372 Parcel data = Parcel.obtain();
5373 Parcel reply = Parcel.obtain();
5374 data.writeInterfaceToken(IActivityManager.descriptor);
5375 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005376 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005377 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005378 reply.readException();
5379 data.recycle();
5380 reply.recycle();
5381 }
5382
Craig Mautneree2e45a2014-06-27 12:10:03 -07005383 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005384 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5385 Parcel data = Parcel.obtain();
5386 Parcel reply = Parcel.obtain();
5387 data.writeInterfaceToken(IActivityManager.descriptor);
5388 data.writeString(filename);
5389 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5390 reply.readException();
5391 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5392 data.recycle();
5393 reply.recycle();
5394 return icon;
5395 }
5396
5397 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005398 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5399 throws RemoteException {
5400 Parcel data = Parcel.obtain();
5401 Parcel reply = Parcel.obtain();
5402 data.writeInterfaceToken(IActivityManager.descriptor);
5403 if (options == null) {
5404 data.writeInt(0);
5405 } else {
5406 data.writeInt(1);
5407 data.writeBundle(options.toBundle());
5408 }
5409 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5410 reply.readException();
5411 data.recycle();
5412 reply.recycle();
5413 }
5414
5415 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005416 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005417 Parcel data = Parcel.obtain();
5418 Parcel reply = Parcel.obtain();
5419 data.writeInterfaceToken(IActivityManager.descriptor);
5420 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005421 data.writeInt(visible ? 1 : 0);
5422 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005423 reply.readException();
5424 boolean success = reply.readInt() > 0;
5425 data.recycle();
5426 reply.recycle();
5427 return success;
5428 }
5429
5430 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005431 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005432 Parcel data = Parcel.obtain();
5433 Parcel reply = Parcel.obtain();
5434 data.writeInterfaceToken(IActivityManager.descriptor);
5435 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005436 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005437 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005438 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005439 data.recycle();
5440 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005441 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005442 }
5443
5444 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005445 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005446 Parcel data = Parcel.obtain();
5447 Parcel reply = Parcel.obtain();
5448 data.writeInterfaceToken(IActivityManager.descriptor);
5449 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005450 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5451 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005452 reply.readException();
5453 data.recycle();
5454 reply.recycle();
5455 }
5456
5457 @Override
5458 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5459 Parcel data = Parcel.obtain();
5460 Parcel reply = Parcel.obtain();
5461 data.writeInterfaceToken(IActivityManager.descriptor);
5462 data.writeStrongBinder(token);
5463 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5464 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005465 reply.readException();
5466 data.recycle();
5467 reply.recycle();
5468 }
5469
Craig Mautner8746a472014-07-24 15:12:54 -07005470 @Override
5471 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5472 Parcel data = Parcel.obtain();
5473 Parcel reply = Parcel.obtain();
5474 data.writeInterfaceToken(IActivityManager.descriptor);
5475 data.writeStrongBinder(token);
5476 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5477 IBinder.FLAG_ONEWAY);
5478 reply.readException();
5479 data.recycle();
5480 reply.recycle();
5481 }
5482
Craig Mautner6e2f3952014-09-09 14:26:41 -07005483 @Override
5484 public void bootAnimationComplete() throws RemoteException {
5485 Parcel data = Parcel.obtain();
5486 Parcel reply = Parcel.obtain();
5487 data.writeInterfaceToken(IActivityManager.descriptor);
5488 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5489 reply.readException();
5490 data.recycle();
5491 reply.recycle();
5492 }
5493
Wale Ogunwale18795a22014-12-03 11:38:33 -08005494 @Override
5495 public void systemBackupRestored() throws RemoteException {
5496 Parcel data = Parcel.obtain();
5497 Parcel reply = Parcel.obtain();
5498 data.writeInterfaceToken(IActivityManager.descriptor);
5499 mRemote.transact(SYSTEM_BACKUP_RESTORED, data, reply, 0);
5500 reply.readException();
5501 data.recycle();
5502 reply.recycle();
5503 }
5504
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08005505 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005506 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5507 Parcel data = Parcel.obtain();
5508 Parcel reply = Parcel.obtain();
5509 data.writeInterfaceToken(IActivityManager.descriptor);
5510 data.writeInt(uid);
5511 data.writeByteArray(firstPacket);
5512 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5513 reply.readException();
5514 data.recycle();
5515 reply.recycle();
5516 }
5517
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005518 private IBinder mRemote;
5519}