blob: fa108936a4048f6c19213cf733bed1db6c376b2a [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;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080054import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056import java.util.ArrayList;
57import java.util.List;
58
59/** {@hide} */
60public abstract class ActivityManagerNative extends Binder implements IActivityManager
61{
62 /**
63 * Cast a Binder object into an activity manager interface, generating
64 * a proxy if needed.
65 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080066 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 if (obj == null) {
68 return null;
69 }
70 IActivityManager in =
71 (IActivityManager)obj.queryLocalInterface(descriptor);
72 if (in != null) {
73 return in;
74 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 return new ActivityManagerProxy(obj);
77 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080078
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079 /**
80 * Retrieve the system's default/global activity manager.
81 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080082 static public IActivityManager getDefault() {
83 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084 }
85
86 /**
87 * Convenience for checking whether the system is ready. For internal use only.
88 */
89 static public boolean isSystemReady() {
90 if (!sSystemReady) {
91 sSystemReady = getDefault().testIsSystemReady();
92 }
93 return sSystemReady;
94 }
95 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080096
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 /**
98 * Convenience for sending a sticky broadcast. For internal use only.
99 * If you don't care about permission, use null.
100 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -0700101 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 try {
103 getDefault().broadcastIntent(
104 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800105 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 } catch (RemoteException ex) {
107 }
108 }
109
Dianne Hackborn099bc622014-01-22 13:39:16 -0800110 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800112 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113 } catch (RemoteException ex) {
114 }
115 }
116
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800117 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 attachInterface(this, descriptor);
119 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700120
121 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
123 throws RemoteException {
124 switch (code) {
125 case START_ACTIVITY_TRANSACTION:
126 {
127 data.enforceInterface(IActivityManager.descriptor);
128 IBinder b = data.readStrongBinder();
129 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800130 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 Intent intent = Intent.CREATOR.createFromParcel(data);
132 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800134 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700136 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700137 ProfilerInfo profilerInfo = data.readInt() != 0
138 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700139 Bundle options = data.readInt() != 0
140 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800141 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700142 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 reply.writeNoException();
144 reply.writeInt(result);
145 return true;
146 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700147
Amith Yamasani82644082012-08-03 13:09:11 -0700148 case START_ACTIVITY_AS_USER_TRANSACTION:
149 {
150 data.enforceInterface(IActivityManager.descriptor);
151 IBinder b = data.readStrongBinder();
152 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800153 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700154 Intent intent = Intent.CREATOR.createFromParcel(data);
155 String resolvedType = data.readString();
156 IBinder resultTo = data.readStrongBinder();
157 String resultWho = data.readString();
158 int requestCode = data.readInt();
159 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700160 ProfilerInfo profilerInfo = data.readInt() != 0
161 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700162 Bundle options = data.readInt() != 0
163 ? Bundle.CREATOR.createFromParcel(data) : null;
164 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800165 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700166 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700167 reply.writeNoException();
168 reply.writeInt(result);
169 return true;
170 }
171
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700172 case START_ACTIVITY_AS_CALLER_TRANSACTION:
173 {
174 data.enforceInterface(IActivityManager.descriptor);
175 IBinder b = data.readStrongBinder();
176 IApplicationThread app = ApplicationThreadNative.asInterface(b);
177 String callingPackage = data.readString();
178 Intent intent = Intent.CREATOR.createFromParcel(data);
179 String resolvedType = data.readString();
180 IBinder resultTo = data.readStrongBinder();
181 String resultWho = data.readString();
182 int requestCode = data.readInt();
183 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700184 ProfilerInfo profilerInfo = data.readInt() != 0
185 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700186 Bundle options = data.readInt() != 0
187 ? Bundle.CREATOR.createFromParcel(data) : null;
Jeff Sharkey97978802014-10-14 10:48:18 -0700188 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700189 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Sharkey97978802014-10-14 10:48:18 -0700190 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700191 reply.writeNoException();
192 reply.writeInt(result);
193 return true;
194 }
195
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800196 case START_ACTIVITY_AND_WAIT_TRANSACTION:
197 {
198 data.enforceInterface(IActivityManager.descriptor);
199 IBinder b = data.readStrongBinder();
200 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800201 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800202 Intent intent = Intent.CREATOR.createFromParcel(data);
203 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800204 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800205 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800206 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700207 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700208 ProfilerInfo profilerInfo = data.readInt() != 0
209 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700210 Bundle options = data.readInt() != 0
211 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700212 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800213 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700214 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800215 reply.writeNoException();
216 result.writeToParcel(reply, 0);
217 return true;
218 }
219
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700220 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800225 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700228 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700229 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700230 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700232 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700233 Bundle options = data.readInt() != 0
234 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700235 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800236 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700237 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700238 reply.writeNoException();
239 reply.writeInt(result);
240 return true;
241 }
242
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700243 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700244 {
245 data.enforceInterface(IActivityManager.descriptor);
246 IBinder b = data.readStrongBinder();
247 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700248 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700249 Intent fillInIntent = null;
250 if (data.readInt() != 0) {
251 fillInIntent = Intent.CREATOR.createFromParcel(data);
252 }
253 String resolvedType = data.readString();
254 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700255 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700256 int requestCode = data.readInt();
257 int flagsMask = data.readInt();
258 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700259 Bundle options = data.readInt() != 0
260 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700261 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700262 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700263 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700264 reply.writeNoException();
265 reply.writeInt(result);
266 return true;
267 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700268
Dianne Hackborn91097de2014-04-04 18:02:06 -0700269 case START_VOICE_ACTIVITY_TRANSACTION:
270 {
271 data.enforceInterface(IActivityManager.descriptor);
272 String callingPackage = data.readString();
273 int callingPid = data.readInt();
274 int callingUid = data.readInt();
275 Intent intent = Intent.CREATOR.createFromParcel(data);
276 String resolvedType = data.readString();
277 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
278 data.readStrongBinder());
279 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
280 data.readStrongBinder());
281 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700282 ProfilerInfo profilerInfo = data.readInt() != 0
283 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700284 Bundle options = data.readInt() != 0
285 ? Bundle.CREATOR.createFromParcel(data) : null;
286 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700287 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
288 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700289 reply.writeNoException();
290 reply.writeInt(result);
291 return true;
292 }
293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800294 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
295 {
296 data.enforceInterface(IActivityManager.descriptor);
297 IBinder callingActivity = data.readStrongBinder();
298 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700299 Bundle options = data.readInt() != 0
300 ? Bundle.CREATOR.createFromParcel(data) : null;
301 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800302 reply.writeNoException();
303 reply.writeInt(result ? 1 : 0);
304 return true;
305 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700306
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700307 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
308 {
309 data.enforceInterface(IActivityManager.descriptor);
310 int taskId = data.readInt();
311 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
312 int result = startActivityFromRecents(taskId, options);
313 reply.writeNoException();
314 reply.writeInt(result);
315 return true;
316 }
317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 case FINISH_ACTIVITY_TRANSACTION: {
319 data.enforceInterface(IActivityManager.descriptor);
320 IBinder token = data.readStrongBinder();
321 Intent resultData = null;
322 int resultCode = data.readInt();
323 if (data.readInt() != 0) {
324 resultData = Intent.CREATOR.createFromParcel(data);
325 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700326 boolean finishTask = (data.readInt() != 0);
327 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800328 reply.writeNoException();
329 reply.writeInt(res ? 1 : 0);
330 return true;
331 }
332
333 case FINISH_SUB_ACTIVITY_TRANSACTION: {
334 data.enforceInterface(IActivityManager.descriptor);
335 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700336 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800337 int requestCode = data.readInt();
338 finishSubActivity(token, resultWho, requestCode);
339 reply.writeNoException();
340 return true;
341 }
342
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700343 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
344 data.enforceInterface(IActivityManager.descriptor);
345 IBinder token = data.readStrongBinder();
346 boolean res = finishActivityAffinity(token);
347 reply.writeNoException();
348 reply.writeInt(res ? 1 : 0);
349 return true;
350 }
351
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700352 case FINISH_VOICE_TASK_TRANSACTION: {
353 data.enforceInterface(IActivityManager.descriptor);
354 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
355 data.readStrongBinder());
356 finishVoiceTask(session);
357 reply.writeNoException();
358 return true;
359 }
360
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700361 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
362 data.enforceInterface(IActivityManager.descriptor);
363 IBinder token = data.readStrongBinder();
364 boolean res = releaseActivityInstance(token);
365 reply.writeNoException();
366 reply.writeInt(res ? 1 : 0);
367 return true;
368 }
369
370 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
371 data.enforceInterface(IActivityManager.descriptor);
372 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
373 releaseSomeActivities(app);
374 reply.writeNoException();
375 return true;
376 }
377
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800378 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IBinder token = data.readStrongBinder();
381 boolean res = willActivityBeVisible(token);
382 reply.writeNoException();
383 reply.writeInt(res ? 1 : 0);
384 return true;
385 }
386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 case REGISTER_RECEIVER_TRANSACTION:
388 {
389 data.enforceInterface(IActivityManager.descriptor);
390 IBinder b = data.readStrongBinder();
391 IApplicationThread app =
392 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700393 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 b = data.readStrongBinder();
395 IIntentReceiver rec
396 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
397 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
398 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700399 int userId = data.readInt();
400 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800401 reply.writeNoException();
402 if (intent != null) {
403 reply.writeInt(1);
404 intent.writeToParcel(reply, 0);
405 } else {
406 reply.writeInt(0);
407 }
408 return true;
409 }
410
411 case UNREGISTER_RECEIVER_TRANSACTION:
412 {
413 data.enforceInterface(IActivityManager.descriptor);
414 IBinder b = data.readStrongBinder();
415 if (b == null) {
416 return true;
417 }
418 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
419 unregisterReceiver(rec);
420 reply.writeNoException();
421 return true;
422 }
423
424 case BROADCAST_INTENT_TRANSACTION:
425 {
426 data.enforceInterface(IActivityManager.descriptor);
427 IBinder b = data.readStrongBinder();
428 IApplicationThread app =
429 b != null ? ApplicationThreadNative.asInterface(b) : null;
430 Intent intent = Intent.CREATOR.createFromParcel(data);
431 String resolvedType = data.readString();
432 b = data.readStrongBinder();
433 IIntentReceiver resultTo =
434 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
435 int resultCode = data.readInt();
436 String resultData = data.readString();
437 Bundle resultExtras = data.readBundle();
438 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800439 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 boolean serialized = data.readInt() != 0;
441 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700442 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800443 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800444 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700445 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800446 reply.writeNoException();
447 reply.writeInt(res);
448 return true;
449 }
450
451 case UNBROADCAST_INTENT_TRANSACTION:
452 {
453 data.enforceInterface(IActivityManager.descriptor);
454 IBinder b = data.readStrongBinder();
455 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
456 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700457 int userId = data.readInt();
458 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 reply.writeNoException();
460 return true;
461 }
462
463 case FINISH_RECEIVER_TRANSACTION: {
464 data.enforceInterface(IActivityManager.descriptor);
465 IBinder who = data.readStrongBinder();
466 int resultCode = data.readInt();
467 String resultData = data.readString();
468 Bundle resultExtras = data.readBundle();
469 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800470 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800472 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 }
474 reply.writeNoException();
475 return true;
476 }
477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 case ATTACH_APPLICATION_TRANSACTION: {
479 data.enforceInterface(IActivityManager.descriptor);
480 IApplicationThread app = ApplicationThreadNative.asInterface(
481 data.readStrongBinder());
482 if (app != null) {
483 attachApplication(app);
484 }
485 reply.writeNoException();
486 return true;
487 }
488
489 case ACTIVITY_IDLE_TRANSACTION: {
490 data.enforceInterface(IActivityManager.descriptor);
491 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700492 Configuration config = null;
493 if (data.readInt() != 0) {
494 config = Configuration.CREATOR.createFromParcel(data);
495 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700496 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700498 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 }
500 reply.writeNoException();
501 return true;
502 }
503
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700504 case ACTIVITY_RESUMED_TRANSACTION: {
505 data.enforceInterface(IActivityManager.descriptor);
506 IBinder token = data.readStrongBinder();
507 activityResumed(token);
508 reply.writeNoException();
509 return true;
510 }
511
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800512 case ACTIVITY_PAUSED_TRANSACTION: {
513 data.enforceInterface(IActivityManager.descriptor);
514 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700515 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800516 reply.writeNoException();
517 return true;
518 }
519
520 case ACTIVITY_STOPPED_TRANSACTION: {
521 data.enforceInterface(IActivityManager.descriptor);
522 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800523 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700524 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700526 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527 reply.writeNoException();
528 return true;
529 }
530
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800531 case ACTIVITY_SLEPT_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 IBinder token = data.readStrongBinder();
534 activitySlept(token);
535 reply.writeNoException();
536 return true;
537 }
538
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 case ACTIVITY_DESTROYED_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 IBinder token = data.readStrongBinder();
542 activityDestroyed(token);
543 reply.writeNoException();
544 return true;
545 }
546
547 case GET_CALLING_PACKAGE_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 IBinder token = data.readStrongBinder();
550 String res = token != null ? getCallingPackage(token) : null;
551 reply.writeNoException();
552 reply.writeString(res);
553 return true;
554 }
555
556 case GET_CALLING_ACTIVITY_TRANSACTION: {
557 data.enforceInterface(IActivityManager.descriptor);
558 IBinder token = data.readStrongBinder();
559 ComponentName cn = getCallingActivity(token);
560 reply.writeNoException();
561 ComponentName.writeToParcel(cn, reply);
562 return true;
563 }
564
Winson Chung1147c402014-05-14 11:05:00 -0700565 case GET_APP_TASKS_TRANSACTION: {
566 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700567 String callingPackage = data.readString();
568 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700569 reply.writeNoException();
570 int N = list != null ? list.size() : -1;
571 reply.writeInt(N);
572 int i;
573 for (i=0; i<N; i++) {
574 IAppTask task = list.get(i);
575 reply.writeStrongBinder(task.asBinder());
576 }
577 return true;
578 }
579
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700580 case ADD_APP_TASK_TRANSACTION: {
581 data.enforceInterface(IActivityManager.descriptor);
582 IBinder activityToken = data.readStrongBinder();
583 Intent intent = Intent.CREATOR.createFromParcel(data);
584 ActivityManager.TaskDescription descr
585 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
586 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
587 int res = addAppTask(activityToken, intent, descr, thumbnail);
588 reply.writeNoException();
589 reply.writeInt(res);
590 return true;
591 }
592
593 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
594 data.enforceInterface(IActivityManager.descriptor);
595 Point size = getAppTaskThumbnailSize();
596 reply.writeNoException();
597 size.writeToParcel(reply, 0);
598 return true;
599 }
600
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800601 case GET_TASKS_TRANSACTION: {
602 data.enforceInterface(IActivityManager.descriptor);
603 int maxNum = data.readInt();
604 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700605 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800606 reply.writeNoException();
607 int N = list != null ? list.size() : -1;
608 reply.writeInt(N);
609 int i;
610 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700611 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 info.writeToParcel(reply, 0);
613 }
614 return true;
615 }
616
617 case GET_RECENT_TASKS_TRANSACTION: {
618 data.enforceInterface(IActivityManager.descriptor);
619 int maxNum = data.readInt();
620 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700621 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700623 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800624 reply.writeNoException();
625 reply.writeTypedList(list);
626 return true;
627 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700628
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700629 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800630 data.enforceInterface(IActivityManager.descriptor);
631 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700632 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800633 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700634 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800635 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700636 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700637 } else {
638 reply.writeInt(0);
639 }
640 return true;
641 }
642
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 case GET_SERVICES_TRANSACTION: {
644 data.enforceInterface(IActivityManager.descriptor);
645 int maxNum = data.readInt();
646 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700647 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 reply.writeNoException();
649 int N = list != null ? list.size() : -1;
650 reply.writeInt(N);
651 int i;
652 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700653 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800654 info.writeToParcel(reply, 0);
655 }
656 return true;
657 }
658
659 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
660 data.enforceInterface(IActivityManager.descriptor);
661 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
662 reply.writeNoException();
663 reply.writeTypedList(list);
664 return true;
665 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700666
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
668 data.enforceInterface(IActivityManager.descriptor);
669 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
670 reply.writeNoException();
671 reply.writeTypedList(list);
672 return true;
673 }
674
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700675 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
676 data.enforceInterface(IActivityManager.descriptor);
677 List<ApplicationInfo> list = getRunningExternalApplications();
678 reply.writeNoException();
679 reply.writeTypedList(list);
680 return true;
681 }
682
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800683 case MOVE_TASK_TO_FRONT_TRANSACTION: {
684 data.enforceInterface(IActivityManager.descriptor);
685 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800686 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700687 Bundle options = data.readInt() != 0
688 ? Bundle.CREATOR.createFromParcel(data) : null;
689 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800690 reply.writeNoException();
691 return true;
692 }
693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 IBinder token = data.readStrongBinder();
697 boolean nonRoot = data.readInt() != 0;
698 boolean res = moveActivityTaskToBack(token, nonRoot);
699 reply.writeNoException();
700 reply.writeInt(res ? 1 : 0);
701 return true;
702 }
703
704 case MOVE_TASK_BACKWARDS_TRANSACTION: {
705 data.enforceInterface(IActivityManager.descriptor);
706 int task = data.readInt();
707 moveTaskBackwards(task);
708 reply.writeNoException();
709 return true;
710 }
711
Craig Mautnerc00204b2013-03-05 15:02:14 -0800712 case MOVE_TASK_TO_STACK_TRANSACTION: {
713 data.enforceInterface(IActivityManager.descriptor);
714 int taskId = data.readInt();
715 int stackId = data.readInt();
716 boolean toTop = data.readInt() != 0;
717 moveTaskToStack(taskId, stackId, toTop);
718 reply.writeNoException();
719 return true;
720 }
721
722 case RESIZE_STACK_TRANSACTION: {
723 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800724 int stackId = data.readInt();
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 Chungd16c5652015-01-26 16:11:07 -0800770 case GET_FOCUSED_STACK_ID_TRANSACTION: {
771 data.enforceInterface(IActivityManager.descriptor);
772 int focusedStackId = getFocusedStackId();
773 reply.writeNoException();
774 reply.writeInt(focusedStackId);
775 return true;
776 }
777
Winson Chung740c3ac2014-11-12 16:14:38 -0800778 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
779 data.enforceInterface(IActivityManager.descriptor);
780 IBinder token = data.readStrongBinder();
781 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
782 reply.writeNoException();
783 return true;
784 }
785
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 IBinder token = data.readStrongBinder();
789 boolean onlyRoot = data.readInt() != 0;
790 int res = token != null
791 ? getTaskForActivity(token, onlyRoot) : -1;
792 reply.writeNoException();
793 reply.writeInt(res);
794 return true;
795 }
796
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800797 case GET_CONTENT_PROVIDER_TRANSACTION: {
798 data.enforceInterface(IActivityManager.descriptor);
799 IBinder b = data.readStrongBinder();
800 IApplicationThread app = ApplicationThreadNative.asInterface(b);
801 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700802 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700803 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700804 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800805 reply.writeNoException();
806 if (cph != null) {
807 reply.writeInt(1);
808 cph.writeToParcel(reply, 0);
809 } else {
810 reply.writeInt(0);
811 }
812 return true;
813 }
814
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800815 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
816 data.enforceInterface(IActivityManager.descriptor);
817 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700818 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800819 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700820 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800821 reply.writeNoException();
822 if (cph != null) {
823 reply.writeInt(1);
824 cph.writeToParcel(reply, 0);
825 } else {
826 reply.writeInt(0);
827 }
828 return true;
829 }
830
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800831 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
832 data.enforceInterface(IActivityManager.descriptor);
833 IBinder b = data.readStrongBinder();
834 IApplicationThread app = ApplicationThreadNative.asInterface(b);
835 ArrayList<ContentProviderHolder> providers =
836 data.createTypedArrayList(ContentProviderHolder.CREATOR);
837 publishContentProviders(app, providers);
838 reply.writeNoException();
839 return true;
840 }
841
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700842 case REF_CONTENT_PROVIDER_TRANSACTION: {
843 data.enforceInterface(IActivityManager.descriptor);
844 IBinder b = data.readStrongBinder();
845 int stable = data.readInt();
846 int unstable = data.readInt();
847 boolean res = refContentProvider(b, stable, unstable);
848 reply.writeNoException();
849 reply.writeInt(res ? 1 : 0);
850 return true;
851 }
852
853 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
854 data.enforceInterface(IActivityManager.descriptor);
855 IBinder b = data.readStrongBinder();
856 unstableProviderDied(b);
857 reply.writeNoException();
858 return true;
859 }
860
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700861 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
862 data.enforceInterface(IActivityManager.descriptor);
863 IBinder b = data.readStrongBinder();
864 appNotRespondingViaProvider(b);
865 reply.writeNoException();
866 return true;
867 }
868
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800869 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
870 data.enforceInterface(IActivityManager.descriptor);
871 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700872 boolean stable = data.readInt() != 0;
873 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800874 reply.writeNoException();
875 return true;
876 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800877
878 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
879 data.enforceInterface(IActivityManager.descriptor);
880 String name = data.readString();
881 IBinder token = data.readStrongBinder();
882 removeContentProviderExternal(name, token);
883 reply.writeNoException();
884 return true;
885 }
886
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700887 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
888 data.enforceInterface(IActivityManager.descriptor);
889 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
890 PendingIntent pi = getRunningServiceControlPanel(comp);
891 reply.writeNoException();
892 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
893 return true;
894 }
895
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800896 case START_SERVICE_TRANSACTION: {
897 data.enforceInterface(IActivityManager.descriptor);
898 IBinder b = data.readStrongBinder();
899 IApplicationThread app = ApplicationThreadNative.asInterface(b);
900 Intent service = Intent.CREATOR.createFromParcel(data);
901 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700902 int userId = data.readInt();
903 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800904 reply.writeNoException();
905 ComponentName.writeToParcel(cn, reply);
906 return true;
907 }
908
909 case STOP_SERVICE_TRANSACTION: {
910 data.enforceInterface(IActivityManager.descriptor);
911 IBinder b = data.readStrongBinder();
912 IApplicationThread app = ApplicationThreadNative.asInterface(b);
913 Intent service = Intent.CREATOR.createFromParcel(data);
914 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700915 int userId = data.readInt();
916 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 reply.writeNoException();
918 reply.writeInt(res);
919 return true;
920 }
921
922 case STOP_SERVICE_TOKEN_TRANSACTION: {
923 data.enforceInterface(IActivityManager.descriptor);
924 ComponentName className = ComponentName.readFromParcel(data);
925 IBinder token = data.readStrongBinder();
926 int startId = data.readInt();
927 boolean res = stopServiceToken(className, token, startId);
928 reply.writeNoException();
929 reply.writeInt(res ? 1 : 0);
930 return true;
931 }
932
933 case SET_SERVICE_FOREGROUND_TRANSACTION: {
934 data.enforceInterface(IActivityManager.descriptor);
935 ComponentName className = ComponentName.readFromParcel(data);
936 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700937 int id = data.readInt();
938 Notification notification = null;
939 if (data.readInt() != 0) {
940 notification = Notification.CREATOR.createFromParcel(data);
941 }
942 boolean removeNotification = data.readInt() != 0;
943 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800944 reply.writeNoException();
945 return true;
946 }
947
948 case BIND_SERVICE_TRANSACTION: {
949 data.enforceInterface(IActivityManager.descriptor);
950 IBinder b = data.readStrongBinder();
951 IApplicationThread app = ApplicationThreadNative.asInterface(b);
952 IBinder token = data.readStrongBinder();
953 Intent service = Intent.CREATOR.createFromParcel(data);
954 String resolvedType = data.readString();
955 b = data.readStrongBinder();
956 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800957 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800958 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800959 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800960 reply.writeNoException();
961 reply.writeInt(res);
962 return true;
963 }
964
965 case UNBIND_SERVICE_TRANSACTION: {
966 data.enforceInterface(IActivityManager.descriptor);
967 IBinder b = data.readStrongBinder();
968 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
969 boolean res = unbindService(conn);
970 reply.writeNoException();
971 reply.writeInt(res ? 1 : 0);
972 return true;
973 }
974
975 case PUBLISH_SERVICE_TRANSACTION: {
976 data.enforceInterface(IActivityManager.descriptor);
977 IBinder token = data.readStrongBinder();
978 Intent intent = Intent.CREATOR.createFromParcel(data);
979 IBinder service = data.readStrongBinder();
980 publishService(token, intent, service);
981 reply.writeNoException();
982 return true;
983 }
984
985 case UNBIND_FINISHED_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 IBinder token = data.readStrongBinder();
988 Intent intent = Intent.CREATOR.createFromParcel(data);
989 boolean doRebind = data.readInt() != 0;
990 unbindFinished(token, intent, doRebind);
991 reply.writeNoException();
992 return true;
993 }
994
995 case SERVICE_DONE_EXECUTING_TRANSACTION: {
996 data.enforceInterface(IActivityManager.descriptor);
997 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700998 int type = data.readInt();
999 int startId = data.readInt();
1000 int res = data.readInt();
1001 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001002 reply.writeNoException();
1003 return true;
1004 }
1005
1006 case START_INSTRUMENTATION_TRANSACTION: {
1007 data.enforceInterface(IActivityManager.descriptor);
1008 ComponentName className = ComponentName.readFromParcel(data);
1009 String profileFile = data.readString();
1010 int fl = data.readInt();
1011 Bundle arguments = data.readBundle();
1012 IBinder b = data.readStrongBinder();
1013 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001014 b = data.readStrongBinder();
1015 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001016 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001017 String abiOverride = data.readString();
1018 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1019 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001020 reply.writeNoException();
1021 reply.writeInt(res ? 1 : 0);
1022 return true;
1023 }
1024
1025
1026 case FINISH_INSTRUMENTATION_TRANSACTION: {
1027 data.enforceInterface(IActivityManager.descriptor);
1028 IBinder b = data.readStrongBinder();
1029 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1030 int resultCode = data.readInt();
1031 Bundle results = data.readBundle();
1032 finishInstrumentation(app, resultCode, results);
1033 reply.writeNoException();
1034 return true;
1035 }
1036
1037 case GET_CONFIGURATION_TRANSACTION: {
1038 data.enforceInterface(IActivityManager.descriptor);
1039 Configuration config = getConfiguration();
1040 reply.writeNoException();
1041 config.writeToParcel(reply, 0);
1042 return true;
1043 }
1044
1045 case UPDATE_CONFIGURATION_TRANSACTION: {
1046 data.enforceInterface(IActivityManager.descriptor);
1047 Configuration config = Configuration.CREATOR.createFromParcel(data);
1048 updateConfiguration(config);
1049 reply.writeNoException();
1050 return true;
1051 }
1052
1053 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1054 data.enforceInterface(IActivityManager.descriptor);
1055 IBinder token = data.readStrongBinder();
1056 int requestedOrientation = data.readInt();
1057 setRequestedOrientation(token, requestedOrientation);
1058 reply.writeNoException();
1059 return true;
1060 }
1061
1062 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1063 data.enforceInterface(IActivityManager.descriptor);
1064 IBinder token = data.readStrongBinder();
1065 int req = getRequestedOrientation(token);
1066 reply.writeNoException();
1067 reply.writeInt(req);
1068 return true;
1069 }
1070
1071 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 IBinder token = data.readStrongBinder();
1074 ComponentName cn = getActivityClassForToken(token);
1075 reply.writeNoException();
1076 ComponentName.writeToParcel(cn, reply);
1077 return true;
1078 }
1079
1080 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 IBinder token = data.readStrongBinder();
1083 reply.writeNoException();
1084 reply.writeString(getPackageForToken(token));
1085 return true;
1086 }
1087
1088 case GET_INTENT_SENDER_TRANSACTION: {
1089 data.enforceInterface(IActivityManager.descriptor);
1090 int type = data.readInt();
1091 String packageName = data.readString();
1092 IBinder token = data.readStrongBinder();
1093 String resultWho = data.readString();
1094 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001095 Intent[] requestIntents;
1096 String[] requestResolvedTypes;
1097 if (data.readInt() != 0) {
1098 requestIntents = data.createTypedArray(Intent.CREATOR);
1099 requestResolvedTypes = data.createStringArray();
1100 } else {
1101 requestIntents = null;
1102 requestResolvedTypes = null;
1103 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001104 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001105 Bundle options = data.readInt() != 0
1106 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001107 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001108 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001109 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001110 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001111 reply.writeNoException();
1112 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1113 return true;
1114 }
1115
1116 case CANCEL_INTENT_SENDER_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 IIntentSender r = IIntentSender.Stub.asInterface(
1119 data.readStrongBinder());
1120 cancelIntentSender(r);
1121 reply.writeNoException();
1122 return true;
1123 }
1124
1125 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 IIntentSender r = IIntentSender.Stub.asInterface(
1128 data.readStrongBinder());
1129 String res = getPackageForIntentSender(r);
1130 reply.writeNoException();
1131 reply.writeString(res);
1132 return true;
1133 }
1134
Christopher Tatec4a07d12012-04-06 14:19:13 -07001135 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 IIntentSender r = IIntentSender.Stub.asInterface(
1138 data.readStrongBinder());
1139 int res = getUidForIntentSender(r);
1140 reply.writeNoException();
1141 reply.writeInt(res);
1142 return true;
1143 }
1144
Dianne Hackborn41203752012-08-31 14:05:51 -07001145 case HANDLE_INCOMING_USER_TRANSACTION: {
1146 data.enforceInterface(IActivityManager.descriptor);
1147 int callingPid = data.readInt();
1148 int callingUid = data.readInt();
1149 int userId = data.readInt();
1150 boolean allowAll = data.readInt() != 0 ;
1151 boolean requireFull = data.readInt() != 0;
1152 String name = data.readString();
1153 String callerPackage = data.readString();
1154 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1155 requireFull, name, callerPackage);
1156 reply.writeNoException();
1157 reply.writeInt(res);
1158 return true;
1159 }
1160
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 case SET_PROCESS_LIMIT_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 int max = data.readInt();
1164 setProcessLimit(max);
1165 reply.writeNoException();
1166 return true;
1167 }
1168
1169 case GET_PROCESS_LIMIT_TRANSACTION: {
1170 data.enforceInterface(IActivityManager.descriptor);
1171 int limit = getProcessLimit();
1172 reply.writeNoException();
1173 reply.writeInt(limit);
1174 return true;
1175 }
1176
1177 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1178 data.enforceInterface(IActivityManager.descriptor);
1179 IBinder token = data.readStrongBinder();
1180 int pid = data.readInt();
1181 boolean isForeground = data.readInt() != 0;
1182 setProcessForeground(token, pid, isForeground);
1183 reply.writeNoException();
1184 return true;
1185 }
1186
1187 case CHECK_PERMISSION_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 String perm = data.readString();
1190 int pid = data.readInt();
1191 int uid = data.readInt();
1192 int res = checkPermission(perm, pid, uid);
1193 reply.writeNoException();
1194 reply.writeInt(res);
1195 return true;
1196 }
1197
Dianne Hackbornff170242014-11-19 10:59:01 -08001198 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1199 data.enforceInterface(IActivityManager.descriptor);
1200 String perm = data.readString();
1201 int pid = data.readInt();
1202 int uid = data.readInt();
1203 IBinder token = data.readStrongBinder();
1204 int res = checkPermissionWithToken(perm, pid, uid, token);
1205 reply.writeNoException();
1206 reply.writeInt(res);
1207 return true;
1208 }
1209
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001210 case CHECK_URI_PERMISSION_TRANSACTION: {
1211 data.enforceInterface(IActivityManager.descriptor);
1212 Uri uri = Uri.CREATOR.createFromParcel(data);
1213 int pid = data.readInt();
1214 int uid = data.readInt();
1215 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001216 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001217 IBinder callerToken = data.readStrongBinder();
1218 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001219 reply.writeNoException();
1220 reply.writeInt(res);
1221 return true;
1222 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001223
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001225 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001226 String packageName = data.readString();
1227 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1228 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001229 int userId = data.readInt();
1230 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 reply.writeNoException();
1232 reply.writeInt(res ? 1 : 0);
1233 return true;
1234 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001235
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001236 case GRANT_URI_PERMISSION_TRANSACTION: {
1237 data.enforceInterface(IActivityManager.descriptor);
1238 IBinder b = data.readStrongBinder();
1239 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1240 String targetPkg = data.readString();
1241 Uri uri = Uri.CREATOR.createFromParcel(data);
1242 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001243 int userId = data.readInt();
1244 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 reply.writeNoException();
1246 return true;
1247 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 case REVOKE_URI_PERMISSION_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 IBinder b = data.readStrongBinder();
1252 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1253 Uri uri = Uri.CREATOR.createFromParcel(data);
1254 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001255 int userId = data.readInt();
1256 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 reply.writeNoException();
1258 return true;
1259 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001260
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001261 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 Uri uri = Uri.CREATOR.createFromParcel(data);
1264 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001265 int userId = data.readInt();
1266 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001267 reply.writeNoException();
1268 return true;
1269 }
1270
1271 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
1273 Uri uri = Uri.CREATOR.createFromParcel(data);
1274 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001275 int userId = data.readInt();
1276 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001277 reply.writeNoException();
1278 return true;
1279 }
1280
1281 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1282 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001283 final String packageName = data.readString();
1284 final boolean incoming = data.readInt() != 0;
1285 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1286 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001287 reply.writeNoException();
1288 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1289 return true;
1290 }
1291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001292 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1293 data.enforceInterface(IActivityManager.descriptor);
1294 IBinder b = data.readStrongBinder();
1295 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1296 boolean waiting = data.readInt() != 0;
1297 showWaitingForDebugger(app, waiting);
1298 reply.writeNoException();
1299 return true;
1300 }
1301
1302 case GET_MEMORY_INFO_TRANSACTION: {
1303 data.enforceInterface(IActivityManager.descriptor);
1304 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1305 getMemoryInfo(mi);
1306 reply.writeNoException();
1307 mi.writeToParcel(reply, 0);
1308 return true;
1309 }
1310
1311 case UNHANDLED_BACK_TRANSACTION: {
1312 data.enforceInterface(IActivityManager.descriptor);
1313 unhandledBack();
1314 reply.writeNoException();
1315 return true;
1316 }
1317
1318 case OPEN_CONTENT_URI_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 Uri uri = Uri.parse(data.readString());
1321 ParcelFileDescriptor pfd = openContentUri(uri);
1322 reply.writeNoException();
1323 if (pfd != null) {
1324 reply.writeInt(1);
1325 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1326 } else {
1327 reply.writeInt(0);
1328 }
1329 return true;
1330 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001331
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001332 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1333 data.enforceInterface(IActivityManager.descriptor);
1334 setLockScreenShown(data.readInt() != 0);
1335 reply.writeNoException();
1336 return true;
1337 }
1338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001339 case SET_DEBUG_APP_TRANSACTION: {
1340 data.enforceInterface(IActivityManager.descriptor);
1341 String pn = data.readString();
1342 boolean wfd = data.readInt() != 0;
1343 boolean per = data.readInt() != 0;
1344 setDebugApp(pn, wfd, per);
1345 reply.writeNoException();
1346 return true;
1347 }
1348
1349 case SET_ALWAYS_FINISH_TRANSACTION: {
1350 data.enforceInterface(IActivityManager.descriptor);
1351 boolean enabled = data.readInt() != 0;
1352 setAlwaysFinish(enabled);
1353 reply.writeNoException();
1354 return true;
1355 }
1356
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001357 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001359 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001360 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001361 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001362 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001363 return true;
1364 }
1365
1366 case ENTER_SAFE_MODE_TRANSACTION: {
1367 data.enforceInterface(IActivityManager.descriptor);
1368 enterSafeMode();
1369 reply.writeNoException();
1370 return true;
1371 }
1372
1373 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
1375 IIntentSender is = IIntentSender.Stub.asInterface(
1376 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001377 int sourceUid = data.readInt();
1378 String sourcePkg = data.readString();
1379 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 reply.writeNoException();
1381 return true;
1382 }
1383
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001384 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 data.enforceInterface(IActivityManager.descriptor);
1386 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001387 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001388 boolean secure = data.readInt() != 0;
1389 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001390 reply.writeNoException();
1391 reply.writeInt(res ? 1 : 0);
1392 return true;
1393 }
1394
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001395 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 String reason = data.readString();
1398 boolean res = killProcessesBelowForeground(reason);
1399 reply.writeNoException();
1400 reply.writeInt(res ? 1 : 0);
1401 return true;
1402 }
1403
Dan Egnor60d87622009-12-16 16:32:58 -08001404 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
1406 IBinder app = data.readStrongBinder();
1407 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1408 handleApplicationCrash(app, ci);
1409 reply.writeNoException();
1410 return true;
1411 }
1412
1413 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001414 data.enforceInterface(IActivityManager.descriptor);
1415 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001416 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001417 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001418 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001419 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001420 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001421 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 return true;
1423 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001424
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001425 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1426 data.enforceInterface(IActivityManager.descriptor);
1427 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001428 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001429 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1430 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001431 reply.writeNoException();
1432 return true;
1433 }
1434
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001435 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1436 data.enforceInterface(IActivityManager.descriptor);
1437 int sig = data.readInt();
1438 signalPersistentProcesses(sig);
1439 reply.writeNoException();
1440 return true;
1441 }
1442
Dianne Hackborn03abb812010-01-04 18:43:19 -08001443 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1444 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001445 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001446 int userId = data.readInt();
1447 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001448 reply.writeNoException();
1449 return true;
1450 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001451
1452 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 killAllBackgroundProcesses();
1455 reply.writeNoException();
1456 return true;
1457 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001458
Dianne Hackborn03abb812010-01-04 18:43:19 -08001459 case FORCE_STOP_PACKAGE_TRANSACTION: {
1460 data.enforceInterface(IActivityManager.descriptor);
1461 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001462 int userId = data.readInt();
1463 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001464 reply.writeNoException();
1465 return true;
1466 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001467
1468 case GET_MY_MEMORY_STATE_TRANSACTION: {
1469 data.enforceInterface(IActivityManager.descriptor);
1470 ActivityManager.RunningAppProcessInfo info =
1471 new ActivityManager.RunningAppProcessInfo();
1472 getMyMemoryState(info);
1473 reply.writeNoException();
1474 info.writeToParcel(reply, 0);
1475 return true;
1476 }
1477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001478 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 ConfigurationInfo config = getDeviceConfigurationInfo();
1481 reply.writeNoException();
1482 config.writeToParcel(reply, 0);
1483 return true;
1484 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001485
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001486 case PROFILE_CONTROL_TRANSACTION: {
1487 data.enforceInterface(IActivityManager.descriptor);
1488 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001489 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001490 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001491 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001492 ProfilerInfo profilerInfo = data.readInt() != 0
1493 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1494 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001495 reply.writeNoException();
1496 reply.writeInt(res ? 1 : 0);
1497 return true;
1498 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001499
Dianne Hackborn55280a92009-05-07 15:53:46 -07001500 case SHUTDOWN_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 boolean res = shutdown(data.readInt());
1503 reply.writeNoException();
1504 reply.writeInt(res ? 1 : 0);
1505 return true;
1506 }
1507
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001508 case STOP_APP_SWITCHES_TRANSACTION: {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 stopAppSwitches();
1511 reply.writeNoException();
1512 return true;
1513 }
1514
1515 case RESUME_APP_SWITCHES_TRANSACTION: {
1516 data.enforceInterface(IActivityManager.descriptor);
1517 resumeAppSwitches();
1518 reply.writeNoException();
1519 return true;
1520 }
1521
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001522 case PEEK_SERVICE_TRANSACTION: {
1523 data.enforceInterface(IActivityManager.descriptor);
1524 Intent service = Intent.CREATOR.createFromParcel(data);
1525 String resolvedType = data.readString();
1526 IBinder binder = peekService(service, resolvedType);
1527 reply.writeNoException();
1528 reply.writeStrongBinder(binder);
1529 return true;
1530 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001531
1532 case START_BACKUP_AGENT_TRANSACTION: {
1533 data.enforceInterface(IActivityManager.descriptor);
1534 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1535 int backupRestoreMode = data.readInt();
1536 boolean success = bindBackupAgent(info, backupRestoreMode);
1537 reply.writeNoException();
1538 reply.writeInt(success ? 1 : 0);
1539 return true;
1540 }
1541
1542 case BACKUP_AGENT_CREATED_TRANSACTION: {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 String packageName = data.readString();
1545 IBinder agent = data.readStrongBinder();
1546 backupAgentCreated(packageName, agent);
1547 reply.writeNoException();
1548 return true;
1549 }
1550
1551 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1554 unbindBackupAgent(info);
1555 reply.writeNoException();
1556 return true;
1557 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001558
1559 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1560 data.enforceInterface(IActivityManager.descriptor);
1561 String packageName = data.readString();
1562 addPackageDependency(packageName);
1563 reply.writeNoException();
1564 return true;
1565 }
1566
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001567 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001568 data.enforceInterface(IActivityManager.descriptor);
1569 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001570 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001571 String reason = data.readString();
1572 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001573 reply.writeNoException();
1574 return true;
1575 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001576
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001577 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 String reason = data.readString();
1580 closeSystemDialogs(reason);
1581 reply.writeNoException();
1582 return true;
1583 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001584
1585 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1586 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001587 int[] pids = data.createIntArray();
1588 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001589 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001590 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001591 return true;
1592 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001593
1594 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1595 data.enforceInterface(IActivityManager.descriptor);
1596 String processName = data.readString();
1597 int uid = data.readInt();
1598 killApplicationProcess(processName, uid);
1599 reply.writeNoException();
1600 return true;
1601 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001602
1603 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1604 data.enforceInterface(IActivityManager.descriptor);
1605 IBinder token = data.readStrongBinder();
1606 String packageName = data.readString();
1607 int enterAnim = data.readInt();
1608 int exitAnim = data.readInt();
1609 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001610 reply.writeNoException();
1611 return true;
1612 }
1613
1614 case IS_USER_A_MONKEY_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001616 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001617 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001618 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001619 return true;
1620 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001621
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001622 case SET_USER_IS_MONKEY_TRANSACTION: {
1623 data.enforceInterface(IActivityManager.descriptor);
1624 final boolean monkey = (data.readInt() == 1);
1625 setUserIsMonkey(monkey);
1626 reply.writeNoException();
1627 return true;
1628 }
1629
Dianne Hackborn860755f2010-06-03 18:47:52 -07001630 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
1632 finishHeavyWeightApp();
1633 reply.writeNoException();
1634 return true;
1635 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001636
1637 case IS_IMMERSIVE_TRANSACTION: {
1638 data.enforceInterface(IActivityManager.descriptor);
1639 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001640 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001641 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001642 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001643 return true;
1644 }
1645
Craig Mautnerd61dc202014-07-07 11:09:11 -07001646 case IS_TOP_OF_TASK_TRANSACTION: {
1647 data.enforceInterface(IActivityManager.descriptor);
1648 IBinder token = data.readStrongBinder();
1649 final boolean isTopOfTask = isTopOfTask(token);
1650 reply.writeNoException();
1651 reply.writeInt(isTopOfTask ? 1 : 0);
1652 return true;
1653 }
1654
Craig Mautner5eda9b32013-07-02 11:58:16 -07001655 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001656 data.enforceInterface(IActivityManager.descriptor);
1657 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001658 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001659 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001660 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001661 return true;
1662 }
1663
1664 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1665 data.enforceInterface(IActivityManager.descriptor);
1666 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001667 final Bundle bundle;
1668 if (data.readInt() == 0) {
1669 bundle = null;
1670 } else {
1671 bundle = data.readBundle();
1672 }
1673 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1674 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001675 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001676 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001677 return true;
1678 }
1679
Craig Mautner233ceee2014-05-09 17:05:11 -07001680 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1681 data.enforceInterface(IActivityManager.descriptor);
1682 IBinder token = data.readStrongBinder();
1683 final ActivityOptions options = getActivityOptions(token);
1684 reply.writeNoException();
1685 reply.writeBundle(options == null ? null : options.toBundle());
1686 return true;
1687 }
1688
Daniel Sandler69a48172010-06-23 16:29:36 -04001689 case SET_IMMERSIVE_TRANSACTION: {
1690 data.enforceInterface(IActivityManager.descriptor);
1691 IBinder token = data.readStrongBinder();
1692 boolean imm = data.readInt() == 1;
1693 setImmersive(token, imm);
1694 reply.writeNoException();
1695 return true;
1696 }
1697
1698 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1699 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001700 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001701 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001702 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001703 return true;
1704 }
1705
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001706 case CRASH_APPLICATION_TRANSACTION: {
1707 data.enforceInterface(IActivityManager.descriptor);
1708 int uid = data.readInt();
1709 int initialPid = data.readInt();
1710 String packageName = data.readString();
1711 String message = data.readString();
1712 crashApplication(uid, initialPid, packageName, message);
1713 reply.writeNoException();
1714 return true;
1715 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001716
1717 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1718 data.enforceInterface(IActivityManager.descriptor);
1719 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001720 int userId = data.readInt();
1721 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001722 reply.writeNoException();
1723 reply.writeString(type);
1724 return true;
1725 }
1726
Dianne Hackborn7e269642010-08-25 19:50:20 -07001727 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1728 data.enforceInterface(IActivityManager.descriptor);
1729 String name = data.readString();
1730 IBinder perm = newUriPermissionOwner(name);
1731 reply.writeNoException();
1732 reply.writeStrongBinder(perm);
1733 return true;
1734 }
1735
1736 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1737 data.enforceInterface(IActivityManager.descriptor);
1738 IBinder owner = data.readStrongBinder();
1739 int fromUid = data.readInt();
1740 String targetPkg = data.readString();
1741 Uri uri = Uri.CREATOR.createFromParcel(data);
1742 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001743 int sourceUserId = data.readInt();
1744 int targetUserId = data.readInt();
1745 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1746 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001747 reply.writeNoException();
1748 return true;
1749 }
1750
1751 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 IBinder owner = data.readStrongBinder();
1754 Uri uri = null;
1755 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001756 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001757 }
1758 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001759 int userId = data.readInt();
1760 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001761 reply.writeNoException();
1762 return true;
1763 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001764
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001765 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1766 data.enforceInterface(IActivityManager.descriptor);
1767 int callingUid = data.readInt();
1768 String targetPkg = data.readString();
1769 Uri uri = Uri.CREATOR.createFromParcel(data);
1770 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001771 int userId = data.readInt();
1772 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001773 reply.writeNoException();
1774 reply.writeInt(res);
1775 return true;
1776 }
1777
Andy McFadden824c5102010-07-09 16:26:57 -07001778 case DUMP_HEAP_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001781 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001782 boolean managed = data.readInt() != 0;
1783 String path = data.readString();
1784 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001785 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001786 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001787 reply.writeNoException();
1788 reply.writeInt(res ? 1 : 0);
1789 return true;
1790 }
1791
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001792 case START_ACTIVITIES_TRANSACTION:
1793 {
1794 data.enforceInterface(IActivityManager.descriptor);
1795 IBinder b = data.readStrongBinder();
1796 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001797 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001798 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1799 String[] resolvedTypes = data.createStringArray();
1800 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001801 Bundle options = data.readInt() != 0
1802 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001803 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001804 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001805 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001806 reply.writeNoException();
1807 reply.writeInt(result);
1808 return true;
1809 }
1810
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001811 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1812 {
1813 data.enforceInterface(IActivityManager.descriptor);
1814 int mode = getFrontActivityScreenCompatMode();
1815 reply.writeNoException();
1816 reply.writeInt(mode);
1817 return true;
1818 }
1819
1820 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1821 {
1822 data.enforceInterface(IActivityManager.descriptor);
1823 int mode = data.readInt();
1824 setFrontActivityScreenCompatMode(mode);
1825 reply.writeNoException();
1826 reply.writeInt(mode);
1827 return true;
1828 }
1829
1830 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1831 {
1832 data.enforceInterface(IActivityManager.descriptor);
1833 String pkg = data.readString();
1834 int mode = getPackageScreenCompatMode(pkg);
1835 reply.writeNoException();
1836 reply.writeInt(mode);
1837 return true;
1838 }
1839
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001840 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1841 {
1842 data.enforceInterface(IActivityManager.descriptor);
1843 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001844 int mode = data.readInt();
1845 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001846 reply.writeNoException();
1847 return true;
1848 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001849
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001850 case SWITCH_USER_TRANSACTION: {
1851 data.enforceInterface(IActivityManager.descriptor);
1852 int userid = data.readInt();
1853 boolean result = switchUser(userid);
1854 reply.writeNoException();
1855 reply.writeInt(result ? 1 : 0);
1856 return true;
1857 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001858
Kenny Guy08488bf2014-02-21 17:40:37 +00001859 case START_USER_IN_BACKGROUND_TRANSACTION: {
1860 data.enforceInterface(IActivityManager.descriptor);
1861 int userid = data.readInt();
1862 boolean result = startUserInBackground(userid);
1863 reply.writeNoException();
1864 reply.writeInt(result ? 1 : 0);
1865 return true;
1866 }
1867
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001868 case STOP_USER_TRANSACTION: {
1869 data.enforceInterface(IActivityManager.descriptor);
1870 int userid = data.readInt();
1871 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1872 data.readStrongBinder());
1873 int result = stopUser(userid, callback);
1874 reply.writeNoException();
1875 reply.writeInt(result);
1876 return true;
1877 }
1878
Amith Yamasani52f1d752012-03-28 18:19:29 -07001879 case GET_CURRENT_USER_TRANSACTION: {
1880 data.enforceInterface(IActivityManager.descriptor);
1881 UserInfo userInfo = getCurrentUser();
1882 reply.writeNoException();
1883 userInfo.writeToParcel(reply, 0);
1884 return true;
1885 }
1886
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001887 case IS_USER_RUNNING_TRANSACTION: {
1888 data.enforceInterface(IActivityManager.descriptor);
1889 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001890 boolean orStopping = data.readInt() != 0;
1891 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001892 reply.writeNoException();
1893 reply.writeInt(result ? 1 : 0);
1894 return true;
1895 }
1896
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001897 case GET_RUNNING_USER_IDS_TRANSACTION: {
1898 data.enforceInterface(IActivityManager.descriptor);
1899 int[] result = getRunningUserIds();
1900 reply.writeNoException();
1901 reply.writeIntArray(result);
1902 return true;
1903 }
1904
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001905 case REMOVE_TASK_TRANSACTION:
1906 {
1907 data.enforceInterface(IActivityManager.descriptor);
1908 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001909 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001910 reply.writeNoException();
1911 reply.writeInt(result ? 1 : 0);
1912 return true;
1913 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001914
Jeff Sharkeya4620792011-05-20 15:29:23 -07001915 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1916 data.enforceInterface(IActivityManager.descriptor);
1917 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1918 data.readStrongBinder());
1919 registerProcessObserver(observer);
1920 return true;
1921 }
1922
1923 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1924 data.enforceInterface(IActivityManager.descriptor);
1925 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1926 data.readStrongBinder());
1927 unregisterProcessObserver(observer);
1928 return true;
1929 }
1930
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001931 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1932 {
1933 data.enforceInterface(IActivityManager.descriptor);
1934 String pkg = data.readString();
1935 boolean ask = getPackageAskScreenCompat(pkg);
1936 reply.writeNoException();
1937 reply.writeInt(ask ? 1 : 0);
1938 return true;
1939 }
1940
1941 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1942 {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 String pkg = data.readString();
1945 boolean ask = data.readInt() != 0;
1946 setPackageAskScreenCompat(pkg, ask);
1947 reply.writeNoException();
1948 return true;
1949 }
1950
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001951 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1952 data.enforceInterface(IActivityManager.descriptor);
1953 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001954 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001955 boolean res = isIntentSenderTargetedToPackage(r);
1956 reply.writeNoException();
1957 reply.writeInt(res ? 1 : 0);
1958 return true;
1959 }
1960
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001961 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1962 data.enforceInterface(IActivityManager.descriptor);
1963 IIntentSender r = IIntentSender.Stub.asInterface(
1964 data.readStrongBinder());
1965 boolean res = isIntentSenderAnActivity(r);
1966 reply.writeNoException();
1967 reply.writeInt(res ? 1 : 0);
1968 return true;
1969 }
1970
Dianne Hackborn81038902012-11-26 17:04:09 -08001971 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1972 data.enforceInterface(IActivityManager.descriptor);
1973 IIntentSender r = IIntentSender.Stub.asInterface(
1974 data.readStrongBinder());
1975 Intent intent = getIntentForIntentSender(r);
1976 reply.writeNoException();
1977 if (intent != null) {
1978 reply.writeInt(1);
1979 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1980 } else {
1981 reply.writeInt(0);
1982 }
1983 return true;
1984 }
1985
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001986 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1987 data.enforceInterface(IActivityManager.descriptor);
1988 IIntentSender r = IIntentSender.Stub.asInterface(
1989 data.readStrongBinder());
1990 String prefix = data.readString();
1991 String tag = getTagForIntentSender(r, prefix);
1992 reply.writeNoException();
1993 reply.writeString(tag);
1994 return true;
1995 }
1996
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001997 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1998 data.enforceInterface(IActivityManager.descriptor);
1999 Configuration config = Configuration.CREATOR.createFromParcel(data);
2000 updatePersistentConfiguration(config);
2001 reply.writeNoException();
2002 return true;
2003 }
2004
Dianne Hackbornb437e092011-08-05 17:50:29 -07002005 case GET_PROCESS_PSS_TRANSACTION: {
2006 data.enforceInterface(IActivityManager.descriptor);
2007 int[] pids = data.createIntArray();
2008 long[] pss = getProcessPss(pids);
2009 reply.writeNoException();
2010 reply.writeLongArray(pss);
2011 return true;
2012 }
2013
Dianne Hackborn661cd522011-08-22 00:26:20 -07002014 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2015 data.enforceInterface(IActivityManager.descriptor);
2016 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2017 boolean always = data.readInt() != 0;
2018 showBootMessage(msg, always);
2019 reply.writeNoException();
2020 return true;
2021 }
2022
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002023 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002024 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002025 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002026 reply.writeNoException();
2027 return true;
2028 }
2029
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002030 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002031 data.enforceInterface(IActivityManager.descriptor);
2032 IBinder token = data.readStrongBinder();
2033 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002034 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002035 reply.writeNoException();
2036 reply.writeInt(res ? 1 : 0);
2037 return true;
2038 }
2039
2040 case NAVIGATE_UP_TO_TRANSACTION: {
2041 data.enforceInterface(IActivityManager.descriptor);
2042 IBinder token = data.readStrongBinder();
2043 Intent target = Intent.CREATOR.createFromParcel(data);
2044 int resultCode = data.readInt();
2045 Intent resultData = null;
2046 if (data.readInt() != 0) {
2047 resultData = Intent.CREATOR.createFromParcel(data);
2048 }
2049 boolean res = navigateUpTo(token, target, resultCode, resultData);
2050 reply.writeNoException();
2051 reply.writeInt(res ? 1 : 0);
2052 return true;
2053 }
2054
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002055 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2056 data.enforceInterface(IActivityManager.descriptor);
2057 IBinder token = data.readStrongBinder();
2058 int res = getLaunchedFromUid(token);
2059 reply.writeNoException();
2060 reply.writeInt(res);
2061 return true;
2062 }
2063
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002064 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2065 data.enforceInterface(IActivityManager.descriptor);
2066 IBinder token = data.readStrongBinder();
2067 String res = getLaunchedFromPackage(token);
2068 reply.writeNoException();
2069 reply.writeString(res);
2070 return true;
2071 }
2072
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002073 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2074 data.enforceInterface(IActivityManager.descriptor);
2075 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2076 data.readStrongBinder());
2077 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002078 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002079 return true;
2080 }
2081
2082 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2083 data.enforceInterface(IActivityManager.descriptor);
2084 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2085 data.readStrongBinder());
2086 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002087 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002088 return true;
2089 }
2090
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002091 case REQUEST_BUG_REPORT_TRANSACTION: {
2092 data.enforceInterface(IActivityManager.descriptor);
2093 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002094 reply.writeNoException();
2095 return true;
2096 }
2097
2098 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2099 data.enforceInterface(IActivityManager.descriptor);
2100 int pid = data.readInt();
2101 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002102 String reason = data.readString();
2103 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002104 reply.writeNoException();
2105 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002106 return true;
2107 }
2108
Adam Skorydfc7fd72013-08-05 19:23:41 -07002109 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002110 data.enforceInterface(IActivityManager.descriptor);
2111 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002112 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002113 reply.writeNoException();
2114 reply.writeBundle(res);
2115 return true;
2116 }
2117
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002118 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2119 data.enforceInterface(IActivityManager.descriptor);
2120 int requestType = data.readInt();
2121 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
2122 requestAssistContextExtras(requestType, receiver);
2123 reply.writeNoException();
2124 return true;
2125 }
2126
Adam Skorydfc7fd72013-08-05 19:23:41 -07002127 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002128 data.enforceInterface(IActivityManager.descriptor);
2129 IBinder token = data.readStrongBinder();
2130 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002131 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002132 reply.writeNoException();
2133 return true;
2134 }
2135
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002136 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2137 data.enforceInterface(IActivityManager.descriptor);
2138 Intent intent = Intent.CREATOR.createFromParcel(data);
2139 int requestType = data.readInt();
2140 String hint = data.readString();
2141 int userHandle = data.readInt();
2142 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2143 reply.writeNoException();
2144 reply.writeInt(res ? 1 : 0);
2145 return true;
2146 }
2147
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002148 case KILL_UID_TRANSACTION: {
2149 data.enforceInterface(IActivityManager.descriptor);
2150 int uid = data.readInt();
2151 String reason = data.readString();
2152 killUid(uid, reason);
2153 reply.writeNoException();
2154 return true;
2155 }
2156
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002157 case HANG_TRANSACTION: {
2158 data.enforceInterface(IActivityManager.descriptor);
2159 IBinder who = data.readStrongBinder();
2160 boolean allowRestart = data.readInt() != 0;
2161 hang(who, allowRestart);
2162 reply.writeNoException();
2163 return true;
2164 }
2165
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002166 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2167 data.enforceInterface(IActivityManager.descriptor);
2168 IBinder token = data.readStrongBinder();
2169 reportActivityFullyDrawn(token);
2170 reply.writeNoException();
2171 return true;
2172 }
2173
Craig Mautner5eda9b32013-07-02 11:58:16 -07002174 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2175 data.enforceInterface(IActivityManager.descriptor);
2176 IBinder token = data.readStrongBinder();
2177 notifyActivityDrawn(token);
2178 reply.writeNoException();
2179 return true;
2180 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002181
2182 case RESTART_TRANSACTION: {
2183 data.enforceInterface(IActivityManager.descriptor);
2184 restart();
2185 reply.writeNoException();
2186 return true;
2187 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002188
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002189 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2190 data.enforceInterface(IActivityManager.descriptor);
2191 performIdleMaintenance();
2192 reply.writeNoException();
2193 return true;
2194 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002195
Todd Kennedyca4d8422015-01-15 15:19:22 -08002196 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002197 data.enforceInterface(IActivityManager.descriptor);
2198 IBinder parentActivityToken = data.readStrongBinder();
2199 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002200 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002201 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002202 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002203 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002204 if (activityContainer != null) {
2205 reply.writeInt(1);
2206 reply.writeStrongBinder(activityContainer.asBinder());
2207 } else {
2208 reply.writeInt(0);
2209 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002210 return true;
2211 }
2212
Craig Mautner95da1082014-02-24 17:54:35 -08002213 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2214 data.enforceInterface(IActivityManager.descriptor);
2215 IActivityContainer activityContainer =
2216 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2217 deleteActivityContainer(activityContainer);
2218 reply.writeNoException();
2219 return true;
2220 }
2221
Todd Kennedy4900bf92015-01-16 16:05:14 -08002222 case CREATE_STACK_ON_DISPLAY: {
2223 data.enforceInterface(IActivityManager.descriptor);
2224 int displayId = data.readInt();
2225 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2226 reply.writeNoException();
2227 if (activityContainer != null) {
2228 reply.writeInt(1);
2229 reply.writeStrongBinder(activityContainer.asBinder());
2230 } else {
2231 reply.writeInt(0);
2232 }
2233 return true;
2234 }
2235
Craig Mautnere0a38842013-12-16 16:14:02 -08002236 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 IBinder activityToken = data.readStrongBinder();
2239 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2240 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002241 if (activityContainer != null) {
2242 reply.writeInt(1);
2243 reply.writeStrongBinder(activityContainer.asBinder());
2244 } else {
2245 reply.writeInt(0);
2246 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002247 return true;
2248 }
2249
Craig Mautner4a1cb222013-12-04 16:14:06 -08002250 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2251 data.enforceInterface(IActivityManager.descriptor);
2252 IBinder homeActivityToken = getHomeActivityToken();
2253 reply.writeNoException();
2254 reply.writeStrongBinder(homeActivityToken);
2255 return true;
2256 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002257
2258 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2259 data.enforceInterface(IActivityManager.descriptor);
2260 final int taskId = data.readInt();
2261 startLockTaskMode(taskId);
2262 reply.writeNoException();
2263 return true;
2264 }
2265
2266 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2267 data.enforceInterface(IActivityManager.descriptor);
2268 IBinder token = data.readStrongBinder();
2269 startLockTaskMode(token);
2270 reply.writeNoException();
2271 return true;
2272 }
2273
Craig Mautnerd61dc202014-07-07 11:09:11 -07002274 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002275 data.enforceInterface(IActivityManager.descriptor);
2276 startLockTaskModeOnCurrent();
2277 reply.writeNoException();
2278 return true;
2279 }
2280
Craig Mautneraea74a52014-03-08 14:23:10 -08002281 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2282 data.enforceInterface(IActivityManager.descriptor);
2283 stopLockTaskMode();
2284 reply.writeNoException();
2285 return true;
2286 }
2287
Craig Mautnerd61dc202014-07-07 11:09:11 -07002288 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002289 data.enforceInterface(IActivityManager.descriptor);
2290 stopLockTaskModeOnCurrent();
2291 reply.writeNoException();
2292 return true;
2293 }
2294
Craig Mautneraea74a52014-03-08 14:23:10 -08002295 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2296 data.enforceInterface(IActivityManager.descriptor);
2297 final boolean isInLockTaskMode = isInLockTaskMode();
2298 reply.writeNoException();
2299 reply.writeInt(isInLockTaskMode ? 1 : 0);
2300 return true;
2301 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002302
Winson Chunga449dc02014-05-16 11:15:04 -07002303 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002304 data.enforceInterface(IActivityManager.descriptor);
2305 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002306 ActivityManager.TaskDescription values =
2307 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2308 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002309 reply.writeNoException();
2310 return true;
2311 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002312
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002313 case SET_TASK_RESIZEABLE_TRANSACTION: {
2314 data.enforceInterface(IActivityManager.descriptor);
2315 int taskId = data.readInt();
2316 boolean resizeable = (data.readInt() == 1) ? true : false;
2317 setTaskResizeable(taskId, resizeable);
2318 reply.writeNoException();
2319 return true;
2320 }
2321
Craig Mautner648f69b2014-09-18 14:16:26 -07002322 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2323 data.enforceInterface(IActivityManager.descriptor);
2324 String filename = data.readString();
2325 Bitmap icon = getTaskDescriptionIcon(filename);
2326 reply.writeNoException();
2327 if (icon == null) {
2328 reply.writeInt(0);
2329 } else {
2330 reply.writeInt(1);
2331 icon.writeToParcel(reply, 0);
2332 }
2333 return true;
2334 }
2335
Winson Chung044d5292014-11-06 11:05:19 -08002336 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2337 data.enforceInterface(IActivityManager.descriptor);
2338 final Bundle bundle;
2339 if (data.readInt() == 0) {
2340 bundle = null;
2341 } else {
2342 bundle = data.readBundle();
2343 }
2344 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2345 startInPlaceAnimationOnFrontMostApplication(options);
2346 reply.writeNoException();
2347 return true;
2348 }
2349
Jose Lima4b6c6692014-08-12 17:41:12 -07002350 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002351 data.enforceInterface(IActivityManager.descriptor);
2352 IBinder token = data.readStrongBinder();
2353 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002354 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002355 reply.writeNoException();
2356 reply.writeInt(success ? 1 : 0);
2357 return true;
2358 }
2359
Jose Lima4b6c6692014-08-12 17:41:12 -07002360 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002361 data.enforceInterface(IActivityManager.descriptor);
2362 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002363 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002364 reply.writeNoException();
2365 reply.writeInt(enabled ? 1 : 0);
2366 return true;
2367 }
2368
Jose Lima4b6c6692014-08-12 17:41:12 -07002369 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002370 data.enforceInterface(IActivityManager.descriptor);
2371 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002372 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002373 reply.writeNoException();
2374 return true;
2375 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002376
2377 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2378 data.enforceInterface(IActivityManager.descriptor);
2379 IBinder token = data.readStrongBinder();
2380 notifyLaunchTaskBehindComplete(token);
2381 reply.writeNoException();
2382 return true;
2383 }
Craig Mautner8746a472014-07-24 15:12:54 -07002384
2385 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2386 data.enforceInterface(IActivityManager.descriptor);
2387 IBinder token = data.readStrongBinder();
2388 notifyEnterAnimationComplete(token);
2389 reply.writeNoException();
2390 return true;
2391 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002392
2393 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2394 data.enforceInterface(IActivityManager.descriptor);
2395 bootAnimationComplete();
2396 reply.writeNoException();
2397 return true;
2398 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002399
2400 case SYSTEM_BACKUP_RESTORED: {
2401 data.enforceInterface(IActivityManager.descriptor);
2402 systemBackupRestored();
2403 reply.writeNoException();
2404 return true;
2405 }
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08002406
Jeff Sharkey605eb792014-11-04 13:34:06 -08002407 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2408 data.enforceInterface(IActivityManager.descriptor);
2409 final int uid = data.readInt();
2410 final byte[] firstPacket = data.createByteArray();
2411 notifyCleartextNetwork(uid, firstPacket);
2412 reply.writeNoException();
2413 return true;
2414 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002415 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002416
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002417 return super.onTransact(code, data, reply, flags);
2418 }
2419
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002420 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002421 return this;
2422 }
2423
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002424 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2425 protected IActivityManager create() {
2426 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002427 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002428 Log.v("ActivityManager", "default service binder = " + b);
2429 }
2430 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002431 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002432 Log.v("ActivityManager", "default service = " + am);
2433 }
2434 return am;
2435 }
2436 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002437}
2438
2439class ActivityManagerProxy implements IActivityManager
2440{
2441 public ActivityManagerProxy(IBinder remote)
2442 {
2443 mRemote = remote;
2444 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002445
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002446 public IBinder asBinder()
2447 {
2448 return mRemote;
2449 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002450
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002451 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002452 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002453 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002454 Parcel data = Parcel.obtain();
2455 Parcel reply = Parcel.obtain();
2456 data.writeInterfaceToken(IActivityManager.descriptor);
2457 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002458 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002459 intent.writeToParcel(data, 0);
2460 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002461 data.writeStrongBinder(resultTo);
2462 data.writeString(resultWho);
2463 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002464 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002465 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002466 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002467 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002468 } else {
2469 data.writeInt(0);
2470 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002471 if (options != null) {
2472 data.writeInt(1);
2473 options.writeToParcel(data, 0);
2474 } else {
2475 data.writeInt(0);
2476 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002477 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2478 reply.readException();
2479 int result = reply.readInt();
2480 reply.recycle();
2481 data.recycle();
2482 return result;
2483 }
Amith Yamasani82644082012-08-03 13:09:11 -07002484
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002485 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002486 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002487 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2488 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002489 Parcel data = Parcel.obtain();
2490 Parcel reply = Parcel.obtain();
2491 data.writeInterfaceToken(IActivityManager.descriptor);
2492 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002493 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002494 intent.writeToParcel(data, 0);
2495 data.writeString(resolvedType);
2496 data.writeStrongBinder(resultTo);
2497 data.writeString(resultWho);
2498 data.writeInt(requestCode);
2499 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002500 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002501 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002502 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002503 } else {
2504 data.writeInt(0);
2505 }
2506 if (options != null) {
2507 data.writeInt(1);
2508 options.writeToParcel(data, 0);
2509 } else {
2510 data.writeInt(0);
2511 }
2512 data.writeInt(userId);
2513 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2514 reply.readException();
2515 int result = reply.readInt();
2516 reply.recycle();
2517 data.recycle();
2518 return result;
2519 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002520 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2521 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002522 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002523 Parcel data = Parcel.obtain();
2524 Parcel reply = Parcel.obtain();
2525 data.writeInterfaceToken(IActivityManager.descriptor);
2526 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2527 data.writeString(callingPackage);
2528 intent.writeToParcel(data, 0);
2529 data.writeString(resolvedType);
2530 data.writeStrongBinder(resultTo);
2531 data.writeString(resultWho);
2532 data.writeInt(requestCode);
2533 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002534 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002535 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002536 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002537 } else {
2538 data.writeInt(0);
2539 }
2540 if (options != null) {
2541 data.writeInt(1);
2542 options.writeToParcel(data, 0);
2543 } else {
2544 data.writeInt(0);
2545 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002546 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002547 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2548 reply.readException();
2549 int result = reply.readInt();
2550 reply.recycle();
2551 data.recycle();
2552 return result;
2553 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002554 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2555 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002556 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2557 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002558 Parcel data = Parcel.obtain();
2559 Parcel reply = Parcel.obtain();
2560 data.writeInterfaceToken(IActivityManager.descriptor);
2561 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002562 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002563 intent.writeToParcel(data, 0);
2564 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002565 data.writeStrongBinder(resultTo);
2566 data.writeString(resultWho);
2567 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002568 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002569 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002570 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002571 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002572 } else {
2573 data.writeInt(0);
2574 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002575 if (options != null) {
2576 data.writeInt(1);
2577 options.writeToParcel(data, 0);
2578 } else {
2579 data.writeInt(0);
2580 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002581 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002582 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2583 reply.readException();
2584 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2585 reply.recycle();
2586 data.recycle();
2587 return result;
2588 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002589 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2590 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002591 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002592 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002597 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002598 intent.writeToParcel(data, 0);
2599 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002600 data.writeStrongBinder(resultTo);
2601 data.writeString(resultWho);
2602 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002603 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002604 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002605 if (options != null) {
2606 data.writeInt(1);
2607 options.writeToParcel(data, 0);
2608 } else {
2609 data.writeInt(0);
2610 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002611 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002612 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2613 reply.readException();
2614 int result = reply.readInt();
2615 reply.recycle();
2616 data.recycle();
2617 return result;
2618 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002619 public int startActivityIntentSender(IApplicationThread caller,
2620 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002621 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002622 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002623 Parcel data = Parcel.obtain();
2624 Parcel reply = Parcel.obtain();
2625 data.writeInterfaceToken(IActivityManager.descriptor);
2626 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2627 intent.writeToParcel(data, 0);
2628 if (fillInIntent != null) {
2629 data.writeInt(1);
2630 fillInIntent.writeToParcel(data, 0);
2631 } else {
2632 data.writeInt(0);
2633 }
2634 data.writeString(resolvedType);
2635 data.writeStrongBinder(resultTo);
2636 data.writeString(resultWho);
2637 data.writeInt(requestCode);
2638 data.writeInt(flagsMask);
2639 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002640 if (options != null) {
2641 data.writeInt(1);
2642 options.writeToParcel(data, 0);
2643 } else {
2644 data.writeInt(0);
2645 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002646 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002647 reply.readException();
2648 int result = reply.readInt();
2649 reply.recycle();
2650 data.recycle();
2651 return result;
2652 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002653 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2654 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002655 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2656 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002657 Parcel data = Parcel.obtain();
2658 Parcel reply = Parcel.obtain();
2659 data.writeInterfaceToken(IActivityManager.descriptor);
2660 data.writeString(callingPackage);
2661 data.writeInt(callingPid);
2662 data.writeInt(callingUid);
2663 intent.writeToParcel(data, 0);
2664 data.writeString(resolvedType);
2665 data.writeStrongBinder(session.asBinder());
2666 data.writeStrongBinder(interactor.asBinder());
2667 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002668 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002669 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002670 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002671 } else {
2672 data.writeInt(0);
2673 }
2674 if (options != null) {
2675 data.writeInt(1);
2676 options.writeToParcel(data, 0);
2677 } else {
2678 data.writeInt(0);
2679 }
2680 data.writeInt(userId);
2681 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2682 reply.readException();
2683 int result = reply.readInt();
2684 reply.recycle();
2685 data.recycle();
2686 return result;
2687 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002688 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002689 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
2692 data.writeInterfaceToken(IActivityManager.descriptor);
2693 data.writeStrongBinder(callingActivity);
2694 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002695 if (options != null) {
2696 data.writeInt(1);
2697 options.writeToParcel(data, 0);
2698 } else {
2699 data.writeInt(0);
2700 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002701 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2702 reply.readException();
2703 int result = reply.readInt();
2704 reply.recycle();
2705 data.recycle();
2706 return result != 0;
2707 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002708 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2709 Parcel data = Parcel.obtain();
2710 Parcel reply = Parcel.obtain();
2711 data.writeInterfaceToken(IActivityManager.descriptor);
2712 data.writeInt(taskId);
2713 if (options == null) {
2714 data.writeInt(0);
2715 } else {
2716 data.writeInt(1);
2717 options.writeToParcel(data, 0);
2718 }
2719 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2720 reply.readException();
2721 int result = reply.readInt();
2722 reply.recycle();
2723 data.recycle();
2724 return result;
2725 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002726 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002727 throws RemoteException {
2728 Parcel data = Parcel.obtain();
2729 Parcel reply = Parcel.obtain();
2730 data.writeInterfaceToken(IActivityManager.descriptor);
2731 data.writeStrongBinder(token);
2732 data.writeInt(resultCode);
2733 if (resultData != null) {
2734 data.writeInt(1);
2735 resultData.writeToParcel(data, 0);
2736 } else {
2737 data.writeInt(0);
2738 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002739 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2741 reply.readException();
2742 boolean res = reply.readInt() != 0;
2743 data.recycle();
2744 reply.recycle();
2745 return res;
2746 }
2747 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2748 {
2749 Parcel data = Parcel.obtain();
2750 Parcel reply = Parcel.obtain();
2751 data.writeInterfaceToken(IActivityManager.descriptor);
2752 data.writeStrongBinder(token);
2753 data.writeString(resultWho);
2754 data.writeInt(requestCode);
2755 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2756 reply.readException();
2757 data.recycle();
2758 reply.recycle();
2759 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002760 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2761 Parcel data = Parcel.obtain();
2762 Parcel reply = Parcel.obtain();
2763 data.writeInterfaceToken(IActivityManager.descriptor);
2764 data.writeStrongBinder(token);
2765 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2766 reply.readException();
2767 boolean res = reply.readInt() != 0;
2768 data.recycle();
2769 reply.recycle();
2770 return res;
2771 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002772 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2773 Parcel data = Parcel.obtain();
2774 Parcel reply = Parcel.obtain();
2775 data.writeInterfaceToken(IActivityManager.descriptor);
2776 data.writeStrongBinder(session.asBinder());
2777 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2778 reply.readException();
2779 data.recycle();
2780 reply.recycle();
2781 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002782 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2783 Parcel data = Parcel.obtain();
2784 Parcel reply = Parcel.obtain();
2785 data.writeInterfaceToken(IActivityManager.descriptor);
2786 data.writeStrongBinder(token);
2787 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2788 reply.readException();
2789 boolean res = reply.readInt() != 0;
2790 data.recycle();
2791 reply.recycle();
2792 return res;
2793 }
2794 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2795 Parcel data = Parcel.obtain();
2796 Parcel reply = Parcel.obtain();
2797 data.writeInterfaceToken(IActivityManager.descriptor);
2798 data.writeStrongBinder(app.asBinder());
2799 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2800 reply.readException();
2801 data.recycle();
2802 reply.recycle();
2803 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002804 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2805 Parcel data = Parcel.obtain();
2806 Parcel reply = Parcel.obtain();
2807 data.writeInterfaceToken(IActivityManager.descriptor);
2808 data.writeStrongBinder(token);
2809 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2810 reply.readException();
2811 boolean res = reply.readInt() != 0;
2812 data.recycle();
2813 reply.recycle();
2814 return res;
2815 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002816 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002817 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002818 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002819 {
2820 Parcel data = Parcel.obtain();
2821 Parcel reply = Parcel.obtain();
2822 data.writeInterfaceToken(IActivityManager.descriptor);
2823 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002824 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002825 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2826 filter.writeToParcel(data, 0);
2827 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002828 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002829 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2830 reply.readException();
2831 Intent intent = null;
2832 int haveIntent = reply.readInt();
2833 if (haveIntent != 0) {
2834 intent = Intent.CREATOR.createFromParcel(reply);
2835 }
2836 reply.recycle();
2837 data.recycle();
2838 return intent;
2839 }
2840 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2841 {
2842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 data.writeStrongBinder(receiver.asBinder());
2846 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2847 reply.readException();
2848 data.recycle();
2849 reply.recycle();
2850 }
2851 public int broadcastIntent(IApplicationThread caller,
2852 Intent intent, String resolvedType, IIntentReceiver resultTo,
2853 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002854 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002855 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002856 {
2857 Parcel data = Parcel.obtain();
2858 Parcel reply = Parcel.obtain();
2859 data.writeInterfaceToken(IActivityManager.descriptor);
2860 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2861 intent.writeToParcel(data, 0);
2862 data.writeString(resolvedType);
2863 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2864 data.writeInt(resultCode);
2865 data.writeString(resultData);
2866 data.writeBundle(map);
2867 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002868 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 data.writeInt(serialized ? 1 : 0);
2870 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002871 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002872 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2873 reply.readException();
2874 int res = reply.readInt();
2875 reply.recycle();
2876 data.recycle();
2877 return res;
2878 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002879 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2880 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002881 {
2882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
2884 data.writeInterfaceToken(IActivityManager.descriptor);
2885 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2886 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002887 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002888 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2889 reply.readException();
2890 data.recycle();
2891 reply.recycle();
2892 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002893 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
2894 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002895 {
2896 Parcel data = Parcel.obtain();
2897 Parcel reply = Parcel.obtain();
2898 data.writeInterfaceToken(IActivityManager.descriptor);
2899 data.writeStrongBinder(who);
2900 data.writeInt(resultCode);
2901 data.writeString(resultData);
2902 data.writeBundle(map);
2903 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002904 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002905 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2906 reply.readException();
2907 data.recycle();
2908 reply.recycle();
2909 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002910 public void attachApplication(IApplicationThread app) throws RemoteException
2911 {
2912 Parcel data = Parcel.obtain();
2913 Parcel reply = Parcel.obtain();
2914 data.writeInterfaceToken(IActivityManager.descriptor);
2915 data.writeStrongBinder(app.asBinder());
2916 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2917 reply.readException();
2918 data.recycle();
2919 reply.recycle();
2920 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002921 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2922 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002923 {
2924 Parcel data = Parcel.obtain();
2925 Parcel reply = Parcel.obtain();
2926 data.writeInterfaceToken(IActivityManager.descriptor);
2927 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002928 if (config != null) {
2929 data.writeInt(1);
2930 config.writeToParcel(data, 0);
2931 } else {
2932 data.writeInt(0);
2933 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002934 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2936 reply.readException();
2937 data.recycle();
2938 reply.recycle();
2939 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002940 public void activityResumed(IBinder token) throws RemoteException
2941 {
2942 Parcel data = Parcel.obtain();
2943 Parcel reply = Parcel.obtain();
2944 data.writeInterfaceToken(IActivityManager.descriptor);
2945 data.writeStrongBinder(token);
2946 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 data.recycle();
2949 reply.recycle();
2950 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002951 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002952 {
2953 Parcel data = Parcel.obtain();
2954 Parcel reply = Parcel.obtain();
2955 data.writeInterfaceToken(IActivityManager.descriptor);
2956 data.writeStrongBinder(token);
2957 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2958 reply.readException();
2959 data.recycle();
2960 reply.recycle();
2961 }
2962 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002963 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002964 {
2965 Parcel data = Parcel.obtain();
2966 Parcel reply = Parcel.obtain();
2967 data.writeInterfaceToken(IActivityManager.descriptor);
2968 data.writeStrongBinder(token);
2969 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002970 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 TextUtils.writeToParcel(description, data, 0);
2972 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2973 reply.readException();
2974 data.recycle();
2975 reply.recycle();
2976 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002977 public void activitySlept(IBinder token) throws RemoteException
2978 {
2979 Parcel data = Parcel.obtain();
2980 Parcel reply = Parcel.obtain();
2981 data.writeInterfaceToken(IActivityManager.descriptor);
2982 data.writeStrongBinder(token);
2983 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2984 reply.readException();
2985 data.recycle();
2986 reply.recycle();
2987 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002988 public void activityDestroyed(IBinder token) throws RemoteException
2989 {
2990 Parcel data = Parcel.obtain();
2991 Parcel reply = Parcel.obtain();
2992 data.writeInterfaceToken(IActivityManager.descriptor);
2993 data.writeStrongBinder(token);
2994 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2995 reply.readException();
2996 data.recycle();
2997 reply.recycle();
2998 }
2999 public String getCallingPackage(IBinder token) throws RemoteException
3000 {
3001 Parcel data = Parcel.obtain();
3002 Parcel reply = Parcel.obtain();
3003 data.writeInterfaceToken(IActivityManager.descriptor);
3004 data.writeStrongBinder(token);
3005 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3006 reply.readException();
3007 String res = reply.readString();
3008 data.recycle();
3009 reply.recycle();
3010 return res;
3011 }
3012 public ComponentName getCallingActivity(IBinder token)
3013 throws RemoteException {
3014 Parcel data = Parcel.obtain();
3015 Parcel reply = Parcel.obtain();
3016 data.writeInterfaceToken(IActivityManager.descriptor);
3017 data.writeStrongBinder(token);
3018 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3019 reply.readException();
3020 ComponentName res = ComponentName.readFromParcel(reply);
3021 data.recycle();
3022 reply.recycle();
3023 return res;
3024 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003025 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003026 Parcel data = Parcel.obtain();
3027 Parcel reply = Parcel.obtain();
3028 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003029 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003030 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3031 reply.readException();
3032 ArrayList<IAppTask> list = null;
3033 int N = reply.readInt();
3034 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003035 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003036 while (N > 0) {
3037 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3038 list.add(task);
3039 N--;
3040 }
3041 }
3042 data.recycle();
3043 reply.recycle();
3044 return list;
3045 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003046 public int addAppTask(IBinder activityToken, Intent intent,
3047 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3048 Parcel data = Parcel.obtain();
3049 Parcel reply = Parcel.obtain();
3050 data.writeInterfaceToken(IActivityManager.descriptor);
3051 data.writeStrongBinder(activityToken);
3052 intent.writeToParcel(data, 0);
3053 description.writeToParcel(data, 0);
3054 thumbnail.writeToParcel(data, 0);
3055 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 int res = reply.readInt();
3058 data.recycle();
3059 reply.recycle();
3060 return res;
3061 }
3062 public Point getAppTaskThumbnailSize() throws RemoteException {
3063 Parcel data = Parcel.obtain();
3064 Parcel reply = Parcel.obtain();
3065 data.writeInterfaceToken(IActivityManager.descriptor);
3066 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3067 reply.readException();
3068 Point size = Point.CREATOR.createFromParcel(reply);
3069 data.recycle();
3070 reply.recycle();
3071 return size;
3072 }
Todd Kennedye635f662015-01-20 10:36:49 -08003073 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3074 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 data.writeInt(maxNum);
3079 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003080 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3081 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003082 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003083 int N = reply.readInt();
3084 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003085 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003086 while (N > 0) {
3087 ActivityManager.RunningTaskInfo info =
3088 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003089 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003090 list.add(info);
3091 N--;
3092 }
3093 }
3094 data.recycle();
3095 reply.recycle();
3096 return list;
3097 }
3098 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003099 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 data.writeInt(maxNum);
3104 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003105 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003106 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3107 reply.readException();
3108 ArrayList<ActivityManager.RecentTaskInfo> list
3109 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3110 data.recycle();
3111 reply.recycle();
3112 return list;
3113 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003114 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003115 Parcel data = Parcel.obtain();
3116 Parcel reply = Parcel.obtain();
3117 data.writeInterfaceToken(IActivityManager.descriptor);
3118 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003119 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003120 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003121 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003122 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003123 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003124 }
3125 data.recycle();
3126 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003127 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003128 }
Todd Kennedye635f662015-01-20 10:36:49 -08003129 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3130 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003131 Parcel data = Parcel.obtain();
3132 Parcel reply = Parcel.obtain();
3133 data.writeInterfaceToken(IActivityManager.descriptor);
3134 data.writeInt(maxNum);
3135 data.writeInt(flags);
3136 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3137 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003138 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003139 int N = reply.readInt();
3140 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003141 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003142 while (N > 0) {
3143 ActivityManager.RunningServiceInfo info =
3144 ActivityManager.RunningServiceInfo.CREATOR
3145 .createFromParcel(reply);
3146 list.add(info);
3147 N--;
3148 }
3149 }
3150 data.recycle();
3151 reply.recycle();
3152 return list;
3153 }
3154 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3155 throws RemoteException {
3156 Parcel data = Parcel.obtain();
3157 Parcel reply = Parcel.obtain();
3158 data.writeInterfaceToken(IActivityManager.descriptor);
3159 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3160 reply.readException();
3161 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3162 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3163 data.recycle();
3164 reply.recycle();
3165 return list;
3166 }
3167 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3168 throws RemoteException {
3169 Parcel data = Parcel.obtain();
3170 Parcel reply = Parcel.obtain();
3171 data.writeInterfaceToken(IActivityManager.descriptor);
3172 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3173 reply.readException();
3174 ArrayList<ActivityManager.RunningAppProcessInfo> list
3175 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3176 data.recycle();
3177 reply.recycle();
3178 return list;
3179 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003180 public List<ApplicationInfo> getRunningExternalApplications()
3181 throws RemoteException {
3182 Parcel data = Parcel.obtain();
3183 Parcel reply = Parcel.obtain();
3184 data.writeInterfaceToken(IActivityManager.descriptor);
3185 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3186 reply.readException();
3187 ArrayList<ApplicationInfo> list
3188 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3189 data.recycle();
3190 reply.recycle();
3191 return list;
3192 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003193 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003194 {
3195 Parcel data = Parcel.obtain();
3196 Parcel reply = Parcel.obtain();
3197 data.writeInterfaceToken(IActivityManager.descriptor);
3198 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003199 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003200 if (options != null) {
3201 data.writeInt(1);
3202 options.writeToParcel(data, 0);
3203 } else {
3204 data.writeInt(0);
3205 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003206 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3207 reply.readException();
3208 data.recycle();
3209 reply.recycle();
3210 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003211 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3212 throws RemoteException {
3213 Parcel data = Parcel.obtain();
3214 Parcel reply = Parcel.obtain();
3215 data.writeInterfaceToken(IActivityManager.descriptor);
3216 data.writeStrongBinder(token);
3217 data.writeInt(nonRoot ? 1 : 0);
3218 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3219 reply.readException();
3220 boolean res = reply.readInt() != 0;
3221 data.recycle();
3222 reply.recycle();
3223 return res;
3224 }
3225 public void moveTaskBackwards(int task) throws RemoteException
3226 {
3227 Parcel data = Parcel.obtain();
3228 Parcel reply = Parcel.obtain();
3229 data.writeInterfaceToken(IActivityManager.descriptor);
3230 data.writeInt(task);
3231 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3232 reply.readException();
3233 data.recycle();
3234 reply.recycle();
3235 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003236 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003237 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3238 {
3239 Parcel data = Parcel.obtain();
3240 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003241 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003242 data.writeInt(taskId);
3243 data.writeInt(stackId);
3244 data.writeInt(toTop ? 1 : 0);
3245 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 data.recycle();
3248 reply.recycle();
3249 }
3250 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003251 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003252 {
3253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003255 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003256 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003257 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003258 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003259 reply.readException();
3260 data.recycle();
3261 reply.recycle();
3262 }
Craig Mautner967212c2013-04-13 21:10:58 -07003263 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003264 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003265 {
3266 Parcel data = Parcel.obtain();
3267 Parcel reply = Parcel.obtain();
3268 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003269 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003270 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003271 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003272 data.recycle();
3273 reply.recycle();
3274 return list;
3275 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003276 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003277 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003278 {
3279 Parcel data = Parcel.obtain();
3280 Parcel reply = Parcel.obtain();
3281 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003282 data.writeInt(stackId);
3283 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003284 reply.readException();
3285 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003286 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003287 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003288 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003289 }
3290 data.recycle();
3291 reply.recycle();
3292 return info;
3293 }
3294 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003295 public boolean isInHomeStack(int taskId) throws RemoteException {
3296 Parcel data = Parcel.obtain();
3297 Parcel reply = Parcel.obtain();
3298 data.writeInterfaceToken(IActivityManager.descriptor);
3299 data.writeInt(taskId);
3300 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3301 reply.readException();
3302 boolean isInHomeStack = reply.readInt() > 0;
3303 data.recycle();
3304 reply.recycle();
3305 return isInHomeStack;
3306 }
3307 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003308 public void setFocusedStack(int stackId) throws RemoteException
3309 {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeInt(stackId);
3314 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3315 reply.readException();
3316 data.recycle();
3317 reply.recycle();
3318 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003319 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003320 public int getFocusedStackId() throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3325 reply.readException();
3326 int focusedStackId = reply.readInt();
3327 data.recycle();
3328 reply.recycle();
3329 return focusedStackId;
3330 }
3331 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003332 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3333 {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 data.writeStrongBinder(listener.asBinder());
3338 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3339 reply.readException();
3340 data.recycle();
3341 reply.recycle();
3342 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003343 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3344 {
3345 Parcel data = Parcel.obtain();
3346 Parcel reply = Parcel.obtain();
3347 data.writeInterfaceToken(IActivityManager.descriptor);
3348 data.writeStrongBinder(token);
3349 data.writeInt(onlyRoot ? 1 : 0);
3350 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3351 reply.readException();
3352 int res = reply.readInt();
3353 data.recycle();
3354 reply.recycle();
3355 return res;
3356 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003357 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003358 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003359 Parcel data = Parcel.obtain();
3360 Parcel reply = Parcel.obtain();
3361 data.writeInterfaceToken(IActivityManager.descriptor);
3362 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3363 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003364 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003365 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003366 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3367 reply.readException();
3368 int res = reply.readInt();
3369 ContentProviderHolder cph = null;
3370 if (res != 0) {
3371 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3372 }
3373 data.recycle();
3374 reply.recycle();
3375 return cph;
3376 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003377 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3378 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003379 Parcel data = Parcel.obtain();
3380 Parcel reply = Parcel.obtain();
3381 data.writeInterfaceToken(IActivityManager.descriptor);
3382 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003383 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003384 data.writeStrongBinder(token);
3385 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3386 reply.readException();
3387 int res = reply.readInt();
3388 ContentProviderHolder cph = null;
3389 if (res != 0) {
3390 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3391 }
3392 data.recycle();
3393 reply.recycle();
3394 return cph;
3395 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003396 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003397 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003398 {
3399 Parcel data = Parcel.obtain();
3400 Parcel reply = Parcel.obtain();
3401 data.writeInterfaceToken(IActivityManager.descriptor);
3402 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3403 data.writeTypedList(providers);
3404 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3405 reply.readException();
3406 data.recycle();
3407 reply.recycle();
3408 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003409 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3410 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003411 Parcel data = Parcel.obtain();
3412 Parcel reply = Parcel.obtain();
3413 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003414 data.writeStrongBinder(connection);
3415 data.writeInt(stable);
3416 data.writeInt(unstable);
3417 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3418 reply.readException();
3419 boolean res = reply.readInt() != 0;
3420 data.recycle();
3421 reply.recycle();
3422 return res;
3423 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003424
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003425 public void unstableProviderDied(IBinder connection) throws RemoteException {
3426 Parcel data = Parcel.obtain();
3427 Parcel reply = Parcel.obtain();
3428 data.writeInterfaceToken(IActivityManager.descriptor);
3429 data.writeStrongBinder(connection);
3430 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3431 reply.readException();
3432 data.recycle();
3433 reply.recycle();
3434 }
3435
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003436 @Override
3437 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3438 Parcel data = Parcel.obtain();
3439 Parcel reply = Parcel.obtain();
3440 data.writeInterfaceToken(IActivityManager.descriptor);
3441 data.writeStrongBinder(connection);
3442 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3443 reply.readException();
3444 data.recycle();
3445 reply.recycle();
3446 }
3447
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003448 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
3452 data.writeStrongBinder(connection);
3453 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003454 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3455 reply.readException();
3456 data.recycle();
3457 reply.recycle();
3458 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003459
3460 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3461 Parcel data = Parcel.obtain();
3462 Parcel reply = Parcel.obtain();
3463 data.writeInterfaceToken(IActivityManager.descriptor);
3464 data.writeString(name);
3465 data.writeStrongBinder(token);
3466 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3467 reply.readException();
3468 data.recycle();
3469 reply.recycle();
3470 }
3471
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003472 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3473 throws RemoteException
3474 {
3475 Parcel data = Parcel.obtain();
3476 Parcel reply = Parcel.obtain();
3477 data.writeInterfaceToken(IActivityManager.descriptor);
3478 service.writeToParcel(data, 0);
3479 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3480 reply.readException();
3481 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3482 data.recycle();
3483 reply.recycle();
3484 return res;
3485 }
3486
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003487 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003488 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003489 {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3494 service.writeToParcel(data, 0);
3495 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003496 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003497 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3498 reply.readException();
3499 ComponentName res = ComponentName.readFromParcel(reply);
3500 data.recycle();
3501 reply.recycle();
3502 return res;
3503 }
3504 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003505 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003506 {
3507 Parcel data = Parcel.obtain();
3508 Parcel reply = Parcel.obtain();
3509 data.writeInterfaceToken(IActivityManager.descriptor);
3510 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3511 service.writeToParcel(data, 0);
3512 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003513 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003514 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3515 reply.readException();
3516 int res = reply.readInt();
3517 reply.recycle();
3518 data.recycle();
3519 return res;
3520 }
3521 public boolean stopServiceToken(ComponentName className, IBinder token,
3522 int startId) throws RemoteException {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 ComponentName.writeToParcel(className, data);
3527 data.writeStrongBinder(token);
3528 data.writeInt(startId);
3529 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3530 reply.readException();
3531 boolean res = reply.readInt() != 0;
3532 data.recycle();
3533 reply.recycle();
3534 return res;
3535 }
3536 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003537 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 ComponentName.writeToParcel(className, data);
3542 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003543 data.writeInt(id);
3544 if (notification != null) {
3545 data.writeInt(1);
3546 notification.writeToParcel(data, 0);
3547 } else {
3548 data.writeInt(0);
3549 }
3550 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003551 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3552 reply.readException();
3553 data.recycle();
3554 reply.recycle();
3555 }
3556 public int bindService(IApplicationThread caller, IBinder token,
3557 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003558 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003559 Parcel data = Parcel.obtain();
3560 Parcel reply = Parcel.obtain();
3561 data.writeInterfaceToken(IActivityManager.descriptor);
3562 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3563 data.writeStrongBinder(token);
3564 service.writeToParcel(data, 0);
3565 data.writeString(resolvedType);
3566 data.writeStrongBinder(connection.asBinder());
3567 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003568 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003569 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3570 reply.readException();
3571 int res = reply.readInt();
3572 data.recycle();
3573 reply.recycle();
3574 return res;
3575 }
3576 public boolean unbindService(IServiceConnection connection) throws RemoteException
3577 {
3578 Parcel data = Parcel.obtain();
3579 Parcel reply = Parcel.obtain();
3580 data.writeInterfaceToken(IActivityManager.descriptor);
3581 data.writeStrongBinder(connection.asBinder());
3582 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3583 reply.readException();
3584 boolean res = reply.readInt() != 0;
3585 data.recycle();
3586 reply.recycle();
3587 return res;
3588 }
3589
3590 public void publishService(IBinder token,
3591 Intent intent, IBinder service) throws RemoteException {
3592 Parcel data = Parcel.obtain();
3593 Parcel reply = Parcel.obtain();
3594 data.writeInterfaceToken(IActivityManager.descriptor);
3595 data.writeStrongBinder(token);
3596 intent.writeToParcel(data, 0);
3597 data.writeStrongBinder(service);
3598 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3599 reply.readException();
3600 data.recycle();
3601 reply.recycle();
3602 }
3603
3604 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3605 throws RemoteException {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeStrongBinder(token);
3610 intent.writeToParcel(data, 0);
3611 data.writeInt(doRebind ? 1 : 0);
3612 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3613 reply.readException();
3614 data.recycle();
3615 reply.recycle();
3616 }
3617
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003618 public void serviceDoneExecuting(IBinder token, int type, int startId,
3619 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003624 data.writeInt(type);
3625 data.writeInt(startId);
3626 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003627 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3628 reply.readException();
3629 data.recycle();
3630 reply.recycle();
3631 }
3632
3633 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3634 Parcel data = Parcel.obtain();
3635 Parcel reply = Parcel.obtain();
3636 data.writeInterfaceToken(IActivityManager.descriptor);
3637 service.writeToParcel(data, 0);
3638 data.writeString(resolvedType);
3639 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3640 reply.readException();
3641 IBinder binder = reply.readStrongBinder();
3642 reply.recycle();
3643 data.recycle();
3644 return binder;
3645 }
3646
Christopher Tate181fafa2009-05-14 11:12:14 -07003647 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3648 throws RemoteException {
3649 Parcel data = Parcel.obtain();
3650 Parcel reply = Parcel.obtain();
3651 data.writeInterfaceToken(IActivityManager.descriptor);
3652 app.writeToParcel(data, 0);
3653 data.writeInt(backupRestoreMode);
3654 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3655 reply.readException();
3656 boolean success = reply.readInt() != 0;
3657 reply.recycle();
3658 data.recycle();
3659 return success;
3660 }
3661
Christopher Tate346acb12012-10-15 19:20:25 -07003662 public void clearPendingBackup() throws RemoteException {
3663 Parcel data = Parcel.obtain();
3664 Parcel reply = Parcel.obtain();
3665 data.writeInterfaceToken(IActivityManager.descriptor);
3666 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3667 reply.recycle();
3668 data.recycle();
3669 }
3670
Christopher Tate181fafa2009-05-14 11:12:14 -07003671 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 data.writeString(packageName);
3676 data.writeStrongBinder(agent);
3677 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3678 reply.recycle();
3679 data.recycle();
3680 }
3681
3682 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3683 Parcel data = Parcel.obtain();
3684 Parcel reply = Parcel.obtain();
3685 data.writeInterfaceToken(IActivityManager.descriptor);
3686 app.writeToParcel(data, 0);
3687 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3688 reply.readException();
3689 reply.recycle();
3690 data.recycle();
3691 }
3692
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003693 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003694 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003695 IUiAutomationConnection connection, int userId, String instructionSet)
3696 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003697 Parcel data = Parcel.obtain();
3698 Parcel reply = Parcel.obtain();
3699 data.writeInterfaceToken(IActivityManager.descriptor);
3700 ComponentName.writeToParcel(className, data);
3701 data.writeString(profileFile);
3702 data.writeInt(flags);
3703 data.writeBundle(arguments);
3704 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003705 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003706 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003707 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003708 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 boolean res = reply.readInt() != 0;
3711 reply.recycle();
3712 data.recycle();
3713 return res;
3714 }
3715
3716 public void finishInstrumentation(IApplicationThread target,
3717 int resultCode, Bundle results) throws RemoteException {
3718 Parcel data = Parcel.obtain();
3719 Parcel reply = Parcel.obtain();
3720 data.writeInterfaceToken(IActivityManager.descriptor);
3721 data.writeStrongBinder(target != null ? target.asBinder() : null);
3722 data.writeInt(resultCode);
3723 data.writeBundle(results);
3724 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3725 reply.readException();
3726 data.recycle();
3727 reply.recycle();
3728 }
3729 public Configuration getConfiguration() throws RemoteException
3730 {
3731 Parcel data = Parcel.obtain();
3732 Parcel reply = Parcel.obtain();
3733 data.writeInterfaceToken(IActivityManager.descriptor);
3734 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3735 reply.readException();
3736 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3737 reply.recycle();
3738 data.recycle();
3739 return res;
3740 }
3741 public void updateConfiguration(Configuration values) throws RemoteException
3742 {
3743 Parcel data = Parcel.obtain();
3744 Parcel reply = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 values.writeToParcel(data, 0);
3747 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3748 reply.readException();
3749 data.recycle();
3750 reply.recycle();
3751 }
3752 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3753 throws RemoteException {
3754 Parcel data = Parcel.obtain();
3755 Parcel reply = Parcel.obtain();
3756 data.writeInterfaceToken(IActivityManager.descriptor);
3757 data.writeStrongBinder(token);
3758 data.writeInt(requestedOrientation);
3759 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3760 reply.readException();
3761 data.recycle();
3762 reply.recycle();
3763 }
3764 public int getRequestedOrientation(IBinder token) throws RemoteException {
3765 Parcel data = Parcel.obtain();
3766 Parcel reply = Parcel.obtain();
3767 data.writeInterfaceToken(IActivityManager.descriptor);
3768 data.writeStrongBinder(token);
3769 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3770 reply.readException();
3771 int res = reply.readInt();
3772 data.recycle();
3773 reply.recycle();
3774 return res;
3775 }
3776 public ComponentName getActivityClassForToken(IBinder token)
3777 throws RemoteException {
3778 Parcel data = Parcel.obtain();
3779 Parcel reply = Parcel.obtain();
3780 data.writeInterfaceToken(IActivityManager.descriptor);
3781 data.writeStrongBinder(token);
3782 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3783 reply.readException();
3784 ComponentName res = ComponentName.readFromParcel(reply);
3785 data.recycle();
3786 reply.recycle();
3787 return res;
3788 }
3789 public String getPackageForToken(IBinder token) throws RemoteException
3790 {
3791 Parcel data = Parcel.obtain();
3792 Parcel reply = Parcel.obtain();
3793 data.writeInterfaceToken(IActivityManager.descriptor);
3794 data.writeStrongBinder(token);
3795 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3796 reply.readException();
3797 String res = reply.readString();
3798 data.recycle();
3799 reply.recycle();
3800 return res;
3801 }
3802 public IIntentSender getIntentSender(int type,
3803 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003804 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003805 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003806 Parcel data = Parcel.obtain();
3807 Parcel reply = Parcel.obtain();
3808 data.writeInterfaceToken(IActivityManager.descriptor);
3809 data.writeInt(type);
3810 data.writeString(packageName);
3811 data.writeStrongBinder(token);
3812 data.writeString(resultWho);
3813 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003814 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003815 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003816 data.writeTypedArray(intents, 0);
3817 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003818 } else {
3819 data.writeInt(0);
3820 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003821 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003822 if (options != null) {
3823 data.writeInt(1);
3824 options.writeToParcel(data, 0);
3825 } else {
3826 data.writeInt(0);
3827 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003828 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003829 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3830 reply.readException();
3831 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003832 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003833 data.recycle();
3834 reply.recycle();
3835 return res;
3836 }
3837 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3838 Parcel data = Parcel.obtain();
3839 Parcel reply = Parcel.obtain();
3840 data.writeInterfaceToken(IActivityManager.descriptor);
3841 data.writeStrongBinder(sender.asBinder());
3842 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3843 reply.readException();
3844 data.recycle();
3845 reply.recycle();
3846 }
3847 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3848 Parcel data = Parcel.obtain();
3849 Parcel reply = Parcel.obtain();
3850 data.writeInterfaceToken(IActivityManager.descriptor);
3851 data.writeStrongBinder(sender.asBinder());
3852 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3853 reply.readException();
3854 String res = reply.readString();
3855 data.recycle();
3856 reply.recycle();
3857 return res;
3858 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003859 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 data.writeStrongBinder(sender.asBinder());
3864 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 int res = reply.readInt();
3867 data.recycle();
3868 reply.recycle();
3869 return res;
3870 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003871 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3872 boolean requireFull, String name, String callerPackage) throws RemoteException {
3873 Parcel data = Parcel.obtain();
3874 Parcel reply = Parcel.obtain();
3875 data.writeInterfaceToken(IActivityManager.descriptor);
3876 data.writeInt(callingPid);
3877 data.writeInt(callingUid);
3878 data.writeInt(userId);
3879 data.writeInt(allowAll ? 1 : 0);
3880 data.writeInt(requireFull ? 1 : 0);
3881 data.writeString(name);
3882 data.writeString(callerPackage);
3883 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3884 reply.readException();
3885 int res = reply.readInt();
3886 data.recycle();
3887 reply.recycle();
3888 return res;
3889 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003890 public void setProcessLimit(int max) throws RemoteException
3891 {
3892 Parcel data = Parcel.obtain();
3893 Parcel reply = Parcel.obtain();
3894 data.writeInterfaceToken(IActivityManager.descriptor);
3895 data.writeInt(max);
3896 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3897 reply.readException();
3898 data.recycle();
3899 reply.recycle();
3900 }
3901 public int getProcessLimit() throws RemoteException
3902 {
3903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
3906 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3907 reply.readException();
3908 int res = reply.readInt();
3909 data.recycle();
3910 reply.recycle();
3911 return res;
3912 }
3913 public void setProcessForeground(IBinder token, int pid,
3914 boolean isForeground) throws RemoteException {
3915 Parcel data = Parcel.obtain();
3916 Parcel reply = Parcel.obtain();
3917 data.writeInterfaceToken(IActivityManager.descriptor);
3918 data.writeStrongBinder(token);
3919 data.writeInt(pid);
3920 data.writeInt(isForeground ? 1 : 0);
3921 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 data.recycle();
3924 reply.recycle();
3925 }
3926 public int checkPermission(String permission, int pid, int uid)
3927 throws RemoteException {
3928 Parcel data = Parcel.obtain();
3929 Parcel reply = Parcel.obtain();
3930 data.writeInterfaceToken(IActivityManager.descriptor);
3931 data.writeString(permission);
3932 data.writeInt(pid);
3933 data.writeInt(uid);
3934 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3935 reply.readException();
3936 int res = reply.readInt();
3937 data.recycle();
3938 reply.recycle();
3939 return res;
3940 }
Dianne Hackbornff170242014-11-19 10:59:01 -08003941 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
3942 throws RemoteException {
3943 Parcel data = Parcel.obtain();
3944 Parcel reply = Parcel.obtain();
3945 data.writeInterfaceToken(IActivityManager.descriptor);
3946 data.writeString(permission);
3947 data.writeInt(pid);
3948 data.writeInt(uid);
3949 data.writeStrongBinder(callerToken);
3950 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
3951 reply.readException();
3952 int res = reply.readInt();
3953 data.recycle();
3954 reply.recycle();
3955 return res;
3956 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003957 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003958 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003959 Parcel data = Parcel.obtain();
3960 Parcel reply = Parcel.obtain();
3961 data.writeInterfaceToken(IActivityManager.descriptor);
3962 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003963 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003964 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003965 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 boolean res = reply.readInt() != 0;
3968 data.recycle();
3969 reply.recycle();
3970 return res;
3971 }
Dianne Hackbornff170242014-11-19 10:59:01 -08003972 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
3973 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003974 Parcel data = Parcel.obtain();
3975 Parcel reply = Parcel.obtain();
3976 data.writeInterfaceToken(IActivityManager.descriptor);
3977 uri.writeToParcel(data, 0);
3978 data.writeInt(pid);
3979 data.writeInt(uid);
3980 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003981 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08003982 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003983 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3984 reply.readException();
3985 int res = reply.readInt();
3986 data.recycle();
3987 reply.recycle();
3988 return res;
3989 }
3990 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003991 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
3995 data.writeStrongBinder(caller.asBinder());
3996 data.writeString(targetPkg);
3997 uri.writeToParcel(data, 0);
3998 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003999 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004000 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4001 reply.readException();
4002 data.recycle();
4003 reply.recycle();
4004 }
4005 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004006 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004007 Parcel data = Parcel.obtain();
4008 Parcel reply = Parcel.obtain();
4009 data.writeInterfaceToken(IActivityManager.descriptor);
4010 data.writeStrongBinder(caller.asBinder());
4011 uri.writeToParcel(data, 0);
4012 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004013 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004014 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4015 reply.readException();
4016 data.recycle();
4017 reply.recycle();
4018 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004019
4020 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004021 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4022 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004023 Parcel data = Parcel.obtain();
4024 Parcel reply = Parcel.obtain();
4025 data.writeInterfaceToken(IActivityManager.descriptor);
4026 uri.writeToParcel(data, 0);
4027 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004028 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004029 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4030 reply.readException();
4031 data.recycle();
4032 reply.recycle();
4033 }
4034
4035 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004036 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4037 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004038 Parcel data = Parcel.obtain();
4039 Parcel reply = Parcel.obtain();
4040 data.writeInterfaceToken(IActivityManager.descriptor);
4041 uri.writeToParcel(data, 0);
4042 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004043 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004044 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4045 reply.readException();
4046 data.recycle();
4047 reply.recycle();
4048 }
4049
4050 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004051 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4052 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004053 Parcel data = Parcel.obtain();
4054 Parcel reply = Parcel.obtain();
4055 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004056 data.writeString(packageName);
4057 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004058 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4059 reply.readException();
4060 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4061 reply);
4062 data.recycle();
4063 reply.recycle();
4064 return perms;
4065 }
4066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004067 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4068 throws RemoteException {
4069 Parcel data = Parcel.obtain();
4070 Parcel reply = Parcel.obtain();
4071 data.writeInterfaceToken(IActivityManager.descriptor);
4072 data.writeStrongBinder(who.asBinder());
4073 data.writeInt(waiting ? 1 : 0);
4074 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4075 reply.readException();
4076 data.recycle();
4077 reply.recycle();
4078 }
4079 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4080 Parcel data = Parcel.obtain();
4081 Parcel reply = Parcel.obtain();
4082 data.writeInterfaceToken(IActivityManager.descriptor);
4083 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4084 reply.readException();
4085 outInfo.readFromParcel(reply);
4086 data.recycle();
4087 reply.recycle();
4088 }
4089 public void unhandledBack() throws RemoteException
4090 {
4091 Parcel data = Parcel.obtain();
4092 Parcel reply = Parcel.obtain();
4093 data.writeInterfaceToken(IActivityManager.descriptor);
4094 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 data.recycle();
4097 reply.recycle();
4098 }
4099 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4100 {
4101 Parcel data = Parcel.obtain();
4102 Parcel reply = Parcel.obtain();
4103 data.writeInterfaceToken(IActivityManager.descriptor);
4104 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4105 reply.readException();
4106 ParcelFileDescriptor pfd = null;
4107 if (reply.readInt() != 0) {
4108 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4109 }
4110 data.recycle();
4111 reply.recycle();
4112 return pfd;
4113 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004114 public void setLockScreenShown(boolean shown) throws RemoteException
4115 {
4116 Parcel data = Parcel.obtain();
4117 Parcel reply = Parcel.obtain();
4118 data.writeInterfaceToken(IActivityManager.descriptor);
4119 data.writeInt(shown ? 1 : 0);
4120 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4121 reply.readException();
4122 data.recycle();
4123 reply.recycle();
4124 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004125 public void setDebugApp(
4126 String packageName, boolean waitForDebugger, boolean persistent)
4127 throws RemoteException
4128 {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 data.writeString(packageName);
4133 data.writeInt(waitForDebugger ? 1 : 0);
4134 data.writeInt(persistent ? 1 : 0);
4135 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4136 reply.readException();
4137 data.recycle();
4138 reply.recycle();
4139 }
4140 public void setAlwaysFinish(boolean enabled) throws RemoteException
4141 {
4142 Parcel data = Parcel.obtain();
4143 Parcel reply = Parcel.obtain();
4144 data.writeInterfaceToken(IActivityManager.descriptor);
4145 data.writeInt(enabled ? 1 : 0);
4146 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 data.recycle();
4149 reply.recycle();
4150 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004151 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004152 {
4153 Parcel data = Parcel.obtain();
4154 Parcel reply = Parcel.obtain();
4155 data.writeInterfaceToken(IActivityManager.descriptor);
4156 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004157 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004158 reply.readException();
4159 data.recycle();
4160 reply.recycle();
4161 }
4162 public void enterSafeMode() throws RemoteException {
4163 Parcel data = Parcel.obtain();
4164 data.writeInterfaceToken(IActivityManager.descriptor);
4165 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4166 data.recycle();
4167 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004168 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4169 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004170 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004171 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004172 data.writeStrongBinder(sender.asBinder());
4173 data.writeInt(sourceUid);
4174 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004175 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4176 data.recycle();
4177 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004178 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004179 Parcel data = Parcel.obtain();
4180 Parcel reply = Parcel.obtain();
4181 data.writeInterfaceToken(IActivityManager.descriptor);
4182 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004183 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004184 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004185 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004186 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004187 boolean res = reply.readInt() != 0;
4188 data.recycle();
4189 reply.recycle();
4190 return res;
4191 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004192 @Override
4193 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4194 Parcel data = Parcel.obtain();
4195 Parcel reply = Parcel.obtain();
4196 data.writeInterfaceToken(IActivityManager.descriptor);
4197 data.writeString(reason);
4198 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4199 boolean res = reply.readInt() != 0;
4200 data.recycle();
4201 reply.recycle();
4202 return res;
4203 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004204 public boolean testIsSystemReady()
4205 {
4206 /* this base class version is never called */
4207 return true;
4208 }
Dan Egnor60d87622009-12-16 16:32:58 -08004209 public void handleApplicationCrash(IBinder app,
4210 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4211 {
4212 Parcel data = Parcel.obtain();
4213 Parcel reply = Parcel.obtain();
4214 data.writeInterfaceToken(IActivityManager.descriptor);
4215 data.writeStrongBinder(app);
4216 crashInfo.writeToParcel(data, 0);
4217 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4218 reply.readException();
4219 reply.recycle();
4220 data.recycle();
4221 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004222
Dianne Hackborn52322712014-08-26 22:47:26 -07004223 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004224 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004225 {
4226 Parcel data = Parcel.obtain();
4227 Parcel reply = Parcel.obtain();
4228 data.writeInterfaceToken(IActivityManager.descriptor);
4229 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004230 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004231 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004232 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004233 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004234 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004235 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004236 reply.recycle();
4237 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004238 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004239 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004240
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004241 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004242 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004243 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004244 {
4245 Parcel data = Parcel.obtain();
4246 Parcel reply = Parcel.obtain();
4247 data.writeInterfaceToken(IActivityManager.descriptor);
4248 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004249 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004250 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004251 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4252 reply.readException();
4253 reply.recycle();
4254 data.recycle();
4255 }
4256
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004257 public void signalPersistentProcesses(int sig) throws RemoteException {
4258 Parcel data = Parcel.obtain();
4259 Parcel reply = Parcel.obtain();
4260 data.writeInterfaceToken(IActivityManager.descriptor);
4261 data.writeInt(sig);
4262 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4263 reply.readException();
4264 data.recycle();
4265 reply.recycle();
4266 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004267
Dianne Hackborn1676c852012-09-10 14:52:30 -07004268 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004269 Parcel data = Parcel.obtain();
4270 Parcel reply = Parcel.obtain();
4271 data.writeInterfaceToken(IActivityManager.descriptor);
4272 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004273 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004274 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4275 reply.readException();
4276 data.recycle();
4277 reply.recycle();
4278 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004279
4280 public void killAllBackgroundProcesses() throws RemoteException {
4281 Parcel data = Parcel.obtain();
4282 Parcel reply = Parcel.obtain();
4283 data.writeInterfaceToken(IActivityManager.descriptor);
4284 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4285 reply.readException();
4286 data.recycle();
4287 reply.recycle();
4288 }
4289
Dianne Hackborn1676c852012-09-10 14:52:30 -07004290 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004291 Parcel data = Parcel.obtain();
4292 Parcel reply = Parcel.obtain();
4293 data.writeInterfaceToken(IActivityManager.descriptor);
4294 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004295 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004296 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004297 reply.readException();
4298 data.recycle();
4299 reply.recycle();
4300 }
4301
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004302 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4303 throws RemoteException
4304 {
4305 Parcel data = Parcel.obtain();
4306 Parcel reply = Parcel.obtain();
4307 data.writeInterfaceToken(IActivityManager.descriptor);
4308 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4309 reply.readException();
4310 outInfo.readFromParcel(reply);
4311 reply.recycle();
4312 data.recycle();
4313 }
4314
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004315 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4316 {
4317 Parcel data = Parcel.obtain();
4318 Parcel reply = Parcel.obtain();
4319 data.writeInterfaceToken(IActivityManager.descriptor);
4320 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4321 reply.readException();
4322 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4323 reply.recycle();
4324 data.recycle();
4325 return res;
4326 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004327
Dianne Hackborn1676c852012-09-10 14:52:30 -07004328 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004329 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004330 {
4331 Parcel data = Parcel.obtain();
4332 Parcel reply = Parcel.obtain();
4333 data.writeInterfaceToken(IActivityManager.descriptor);
4334 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004335 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004336 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004337 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004338 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004339 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004340 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004341 } else {
4342 data.writeInt(0);
4343 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004344 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4345 reply.readException();
4346 boolean res = reply.readInt() != 0;
4347 reply.recycle();
4348 data.recycle();
4349 return res;
4350 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004351
Dianne Hackborn55280a92009-05-07 15:53:46 -07004352 public boolean shutdown(int timeout) throws RemoteException
4353 {
4354 Parcel data = Parcel.obtain();
4355 Parcel reply = Parcel.obtain();
4356 data.writeInterfaceToken(IActivityManager.descriptor);
4357 data.writeInt(timeout);
4358 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4359 reply.readException();
4360 boolean res = reply.readInt() != 0;
4361 reply.recycle();
4362 data.recycle();
4363 return res;
4364 }
4365
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004366 public void stopAppSwitches() throws RemoteException {
4367 Parcel data = Parcel.obtain();
4368 Parcel reply = Parcel.obtain();
4369 data.writeInterfaceToken(IActivityManager.descriptor);
4370 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4371 reply.readException();
4372 reply.recycle();
4373 data.recycle();
4374 }
4375
4376 public void resumeAppSwitches() throws RemoteException {
4377 Parcel data = Parcel.obtain();
4378 Parcel reply = Parcel.obtain();
4379 data.writeInterfaceToken(IActivityManager.descriptor);
4380 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4381 reply.readException();
4382 reply.recycle();
4383 data.recycle();
4384 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004385
4386 public void addPackageDependency(String packageName) throws RemoteException {
4387 Parcel data = Parcel.obtain();
4388 Parcel reply = Parcel.obtain();
4389 data.writeInterfaceToken(IActivityManager.descriptor);
4390 data.writeString(packageName);
4391 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4392 reply.readException();
4393 data.recycle();
4394 reply.recycle();
4395 }
4396
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004397 public void killApplicationWithAppId(String pkg, int appid, String reason)
4398 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004399 Parcel data = Parcel.obtain();
4400 Parcel reply = Parcel.obtain();
4401 data.writeInterfaceToken(IActivityManager.descriptor);
4402 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004403 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004404 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004405 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004406 reply.readException();
4407 data.recycle();
4408 reply.recycle();
4409 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004410
4411 public void closeSystemDialogs(String reason) throws RemoteException {
4412 Parcel data = Parcel.obtain();
4413 Parcel reply = Parcel.obtain();
4414 data.writeInterfaceToken(IActivityManager.descriptor);
4415 data.writeString(reason);
4416 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4417 reply.readException();
4418 data.recycle();
4419 reply.recycle();
4420 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004421
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004422 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004423 throws RemoteException {
4424 Parcel data = Parcel.obtain();
4425 Parcel reply = Parcel.obtain();
4426 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004427 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004428 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4429 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004430 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004431 data.recycle();
4432 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004433 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004434 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004435
4436 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4437 Parcel data = Parcel.obtain();
4438 Parcel reply = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 data.writeString(processName);
4441 data.writeInt(uid);
4442 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4443 reply.readException();
4444 data.recycle();
4445 reply.recycle();
4446 }
4447
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004448 public void overridePendingTransition(IBinder token, String packageName,
4449 int enterAnim, int exitAnim) throws RemoteException {
4450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 data.writeStrongBinder(token);
4454 data.writeString(packageName);
4455 data.writeInt(enterAnim);
4456 data.writeInt(exitAnim);
4457 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4458 reply.readException();
4459 data.recycle();
4460 reply.recycle();
4461 }
4462
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004463 public boolean isUserAMonkey() throws RemoteException {
4464 Parcel data = Parcel.obtain();
4465 Parcel reply = Parcel.obtain();
4466 data.writeInterfaceToken(IActivityManager.descriptor);
4467 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4468 reply.readException();
4469 boolean res = reply.readInt() != 0;
4470 data.recycle();
4471 reply.recycle();
4472 return res;
4473 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004474
4475 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4476 Parcel data = Parcel.obtain();
4477 Parcel reply = Parcel.obtain();
4478 data.writeInterfaceToken(IActivityManager.descriptor);
4479 data.writeInt(monkey ? 1 : 0);
4480 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4481 reply.readException();
4482 data.recycle();
4483 reply.recycle();
4484 }
4485
Dianne Hackborn860755f2010-06-03 18:47:52 -07004486 public void finishHeavyWeightApp() throws RemoteException {
4487 Parcel data = Parcel.obtain();
4488 Parcel reply = Parcel.obtain();
4489 data.writeInterfaceToken(IActivityManager.descriptor);
4490 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4491 reply.readException();
4492 data.recycle();
4493 reply.recycle();
4494 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004495
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004496 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004497 throws RemoteException {
4498 Parcel data = Parcel.obtain();
4499 Parcel reply = Parcel.obtain();
4500 data.writeInterfaceToken(IActivityManager.descriptor);
4501 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004502 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4503 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004504 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004505 data.recycle();
4506 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004507 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004508 }
4509
Craig Mautner233ceee2014-05-09 17:05:11 -07004510 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004511 throws RemoteException {
4512 Parcel data = Parcel.obtain();
4513 Parcel reply = Parcel.obtain();
4514 data.writeInterfaceToken(IActivityManager.descriptor);
4515 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004516 if (options == null) {
4517 data.writeInt(0);
4518 } else {
4519 data.writeInt(1);
4520 data.writeBundle(options.toBundle());
4521 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004522 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004523 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004524 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004525 data.recycle();
4526 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004527 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004528 }
4529
Craig Mautner233ceee2014-05-09 17:05:11 -07004530 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4531 Parcel data = Parcel.obtain();
4532 Parcel reply = Parcel.obtain();
4533 data.writeInterfaceToken(IActivityManager.descriptor);
4534 data.writeStrongBinder(token);
4535 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4536 reply.readException();
4537 Bundle bundle = reply.readBundle();
4538 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4539 data.recycle();
4540 reply.recycle();
4541 return options;
4542 }
4543
Daniel Sandler69a48172010-06-23 16:29:36 -04004544 public void setImmersive(IBinder token, boolean immersive)
4545 throws RemoteException {
4546 Parcel data = Parcel.obtain();
4547 Parcel reply = Parcel.obtain();
4548 data.writeInterfaceToken(IActivityManager.descriptor);
4549 data.writeStrongBinder(token);
4550 data.writeInt(immersive ? 1 : 0);
4551 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4552 reply.readException();
4553 data.recycle();
4554 reply.recycle();
4555 }
4556
4557 public boolean isImmersive(IBinder token)
4558 throws RemoteException {
4559 Parcel data = Parcel.obtain();
4560 Parcel reply = Parcel.obtain();
4561 data.writeInterfaceToken(IActivityManager.descriptor);
4562 data.writeStrongBinder(token);
4563 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004564 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004565 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004566 data.recycle();
4567 reply.recycle();
4568 return res;
4569 }
4570
Craig Mautnerd61dc202014-07-07 11:09:11 -07004571 public boolean isTopOfTask(IBinder token) throws RemoteException {
4572 Parcel data = Parcel.obtain();
4573 Parcel reply = Parcel.obtain();
4574 data.writeInterfaceToken(IActivityManager.descriptor);
4575 data.writeStrongBinder(token);
4576 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4577 reply.readException();
4578 boolean res = reply.readInt() == 1;
4579 data.recycle();
4580 reply.recycle();
4581 return res;
4582 }
4583
Daniel Sandler69a48172010-06-23 16:29:36 -04004584 public boolean isTopActivityImmersive()
4585 throws RemoteException {
4586 Parcel data = Parcel.obtain();
4587 Parcel reply = Parcel.obtain();
4588 data.writeInterfaceToken(IActivityManager.descriptor);
4589 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004590 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004591 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004592 data.recycle();
4593 reply.recycle();
4594 return res;
4595 }
4596
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004597 public void crashApplication(int uid, int initialPid, String packageName,
4598 String message) throws RemoteException {
4599 Parcel data = Parcel.obtain();
4600 Parcel reply = Parcel.obtain();
4601 data.writeInterfaceToken(IActivityManager.descriptor);
4602 data.writeInt(uid);
4603 data.writeInt(initialPid);
4604 data.writeString(packageName);
4605 data.writeString(message);
4606 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4607 reply.readException();
4608 data.recycle();
4609 reply.recycle();
4610 }
Andy McFadden824c5102010-07-09 16:26:57 -07004611
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004612 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004613 Parcel data = Parcel.obtain();
4614 Parcel reply = Parcel.obtain();
4615 data.writeInterfaceToken(IActivityManager.descriptor);
4616 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004617 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004618 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4619 reply.readException();
4620 String res = reply.readString();
4621 data.recycle();
4622 reply.recycle();
4623 return res;
4624 }
4625
Dianne Hackborn7e269642010-08-25 19:50:20 -07004626 public IBinder newUriPermissionOwner(String name)
4627 throws RemoteException {
4628 Parcel data = Parcel.obtain();
4629 Parcel reply = Parcel.obtain();
4630 data.writeInterfaceToken(IActivityManager.descriptor);
4631 data.writeString(name);
4632 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4633 reply.readException();
4634 IBinder res = reply.readStrongBinder();
4635 data.recycle();
4636 reply.recycle();
4637 return res;
4638 }
4639
4640 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004641 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004642 Parcel data = Parcel.obtain();
4643 Parcel reply = Parcel.obtain();
4644 data.writeInterfaceToken(IActivityManager.descriptor);
4645 data.writeStrongBinder(owner);
4646 data.writeInt(fromUid);
4647 data.writeString(targetPkg);
4648 uri.writeToParcel(data, 0);
4649 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004650 data.writeInt(sourceUserId);
4651 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004652 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4653 reply.readException();
4654 data.recycle();
4655 reply.recycle();
4656 }
4657
4658 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004659 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004660 Parcel data = Parcel.obtain();
4661 Parcel reply = Parcel.obtain();
4662 data.writeInterfaceToken(IActivityManager.descriptor);
4663 data.writeStrongBinder(owner);
4664 if (uri != null) {
4665 data.writeInt(1);
4666 uri.writeToParcel(data, 0);
4667 } else {
4668 data.writeInt(0);
4669 }
4670 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004671 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004672 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4673 reply.readException();
4674 data.recycle();
4675 reply.recycle();
4676 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004677
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004678 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004679 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004680 Parcel data = Parcel.obtain();
4681 Parcel reply = Parcel.obtain();
4682 data.writeInterfaceToken(IActivityManager.descriptor);
4683 data.writeInt(callingUid);
4684 data.writeString(targetPkg);
4685 uri.writeToParcel(data, 0);
4686 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004687 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004688 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4689 reply.readException();
4690 int res = reply.readInt();
4691 data.recycle();
4692 reply.recycle();
4693 return res;
4694 }
4695
Dianne Hackborn1676c852012-09-10 14:52:30 -07004696 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004697 String path, ParcelFileDescriptor fd) throws RemoteException {
4698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004702 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004703 data.writeInt(managed ? 1 : 0);
4704 data.writeString(path);
4705 if (fd != null) {
4706 data.writeInt(1);
4707 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4708 } else {
4709 data.writeInt(0);
4710 }
4711 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4712 reply.readException();
4713 boolean res = reply.readInt() != 0;
4714 reply.recycle();
4715 data.recycle();
4716 return res;
4717 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004718
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004719 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004720 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004721 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004722 Parcel data = Parcel.obtain();
4723 Parcel reply = Parcel.obtain();
4724 data.writeInterfaceToken(IActivityManager.descriptor);
4725 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004726 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004727 data.writeTypedArray(intents, 0);
4728 data.writeStringArray(resolvedTypes);
4729 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004730 if (options != null) {
4731 data.writeInt(1);
4732 options.writeToParcel(data, 0);
4733 } else {
4734 data.writeInt(0);
4735 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004736 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004737 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4738 reply.readException();
4739 int result = reply.readInt();
4740 reply.recycle();
4741 data.recycle();
4742 return result;
4743 }
4744
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004745 public int getFrontActivityScreenCompatMode() throws RemoteException {
4746 Parcel data = Parcel.obtain();
4747 Parcel reply = Parcel.obtain();
4748 data.writeInterfaceToken(IActivityManager.descriptor);
4749 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4750 reply.readException();
4751 int mode = reply.readInt();
4752 reply.recycle();
4753 data.recycle();
4754 return mode;
4755 }
4756
4757 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4758 Parcel data = Parcel.obtain();
4759 Parcel reply = Parcel.obtain();
4760 data.writeInterfaceToken(IActivityManager.descriptor);
4761 data.writeInt(mode);
4762 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4763 reply.readException();
4764 reply.recycle();
4765 data.recycle();
4766 }
4767
4768 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4769 Parcel data = Parcel.obtain();
4770 Parcel reply = Parcel.obtain();
4771 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004772 data.writeString(packageName);
4773 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004774 reply.readException();
4775 int mode = reply.readInt();
4776 reply.recycle();
4777 data.recycle();
4778 return mode;
4779 }
4780
4781 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004782 throws RemoteException {
4783 Parcel data = Parcel.obtain();
4784 Parcel reply = Parcel.obtain();
4785 data.writeInterfaceToken(IActivityManager.descriptor);
4786 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004787 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004788 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4789 reply.readException();
4790 reply.recycle();
4791 data.recycle();
4792 }
4793
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004794 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4795 Parcel data = Parcel.obtain();
4796 Parcel reply = Parcel.obtain();
4797 data.writeInterfaceToken(IActivityManager.descriptor);
4798 data.writeString(packageName);
4799 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4800 reply.readException();
4801 boolean ask = reply.readInt() != 0;
4802 reply.recycle();
4803 data.recycle();
4804 return ask;
4805 }
4806
4807 public void setPackageAskScreenCompat(String packageName, boolean ask)
4808 throws RemoteException {
4809 Parcel data = Parcel.obtain();
4810 Parcel reply = Parcel.obtain();
4811 data.writeInterfaceToken(IActivityManager.descriptor);
4812 data.writeString(packageName);
4813 data.writeInt(ask ? 1 : 0);
4814 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4815 reply.readException();
4816 reply.recycle();
4817 data.recycle();
4818 }
4819
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004820 public boolean switchUser(int userid) throws RemoteException {
4821 Parcel data = Parcel.obtain();
4822 Parcel reply = Parcel.obtain();
4823 data.writeInterfaceToken(IActivityManager.descriptor);
4824 data.writeInt(userid);
4825 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4826 reply.readException();
4827 boolean result = reply.readInt() != 0;
4828 reply.recycle();
4829 data.recycle();
4830 return result;
4831 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004832
Kenny Guy08488bf2014-02-21 17:40:37 +00004833 public boolean startUserInBackground(int userid) throws RemoteException {
4834 Parcel data = Parcel.obtain();
4835 Parcel reply = Parcel.obtain();
4836 data.writeInterfaceToken(IActivityManager.descriptor);
4837 data.writeInt(userid);
4838 mRemote.transact(START_USER_IN_BACKGROUND_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 Hackborn80a4af22012-08-27 19:18:31 -07004846 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 data.writeInt(userid);
4851 data.writeStrongInterface(callback);
4852 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4853 reply.readException();
4854 int result = reply.readInt();
4855 reply.recycle();
4856 data.recycle();
4857 return result;
4858 }
4859
Amith Yamasani52f1d752012-03-28 18:19:29 -07004860 public UserInfo getCurrentUser() throws RemoteException {
4861 Parcel data = Parcel.obtain();
4862 Parcel reply = Parcel.obtain();
4863 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004864 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004865 reply.readException();
4866 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4867 reply.recycle();
4868 data.recycle();
4869 return userInfo;
4870 }
4871
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004872 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004873 Parcel data = Parcel.obtain();
4874 Parcel reply = Parcel.obtain();
4875 data.writeInterfaceToken(IActivityManager.descriptor);
4876 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004877 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004878 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4879 reply.readException();
4880 boolean result = reply.readInt() != 0;
4881 reply.recycle();
4882 data.recycle();
4883 return result;
4884 }
4885
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004886 public int[] getRunningUserIds() throws RemoteException {
4887 Parcel data = Parcel.obtain();
4888 Parcel reply = Parcel.obtain();
4889 data.writeInterfaceToken(IActivityManager.descriptor);
4890 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4891 reply.readException();
4892 int[] result = reply.createIntArray();
4893 reply.recycle();
4894 data.recycle();
4895 return result;
4896 }
4897
Wale Ogunwaled54b5782014-10-23 15:55:23 -07004898 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004899 Parcel data = Parcel.obtain();
4900 Parcel reply = Parcel.obtain();
4901 data.writeInterfaceToken(IActivityManager.descriptor);
4902 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004903 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4904 reply.readException();
4905 boolean result = reply.readInt() != 0;
4906 reply.recycle();
4907 data.recycle();
4908 return result;
4909 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004910
Jeff Sharkeya4620792011-05-20 15:29:23 -07004911 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4912 Parcel data = Parcel.obtain();
4913 Parcel reply = Parcel.obtain();
4914 data.writeInterfaceToken(IActivityManager.descriptor);
4915 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4916 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4917 reply.readException();
4918 data.recycle();
4919 reply.recycle();
4920 }
4921
4922 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4923 Parcel data = Parcel.obtain();
4924 Parcel reply = Parcel.obtain();
4925 data.writeInterfaceToken(IActivityManager.descriptor);
4926 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4927 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4928 reply.readException();
4929 data.recycle();
4930 reply.recycle();
4931 }
4932
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004933 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4934 Parcel data = Parcel.obtain();
4935 Parcel reply = Parcel.obtain();
4936 data.writeInterfaceToken(IActivityManager.descriptor);
4937 data.writeStrongBinder(sender.asBinder());
4938 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4939 reply.readException();
4940 boolean res = reply.readInt() != 0;
4941 data.recycle();
4942 reply.recycle();
4943 return res;
4944 }
4945
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004946 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4947 Parcel data = Parcel.obtain();
4948 Parcel reply = Parcel.obtain();
4949 data.writeInterfaceToken(IActivityManager.descriptor);
4950 data.writeStrongBinder(sender.asBinder());
4951 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4952 reply.readException();
4953 boolean res = reply.readInt() != 0;
4954 data.recycle();
4955 reply.recycle();
4956 return res;
4957 }
4958
Dianne Hackborn81038902012-11-26 17:04:09 -08004959 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4960 Parcel data = Parcel.obtain();
4961 Parcel reply = Parcel.obtain();
4962 data.writeInterfaceToken(IActivityManager.descriptor);
4963 data.writeStrongBinder(sender.asBinder());
4964 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4965 reply.readException();
4966 Intent res = reply.readInt() != 0
4967 ? Intent.CREATOR.createFromParcel(reply) : null;
4968 data.recycle();
4969 reply.recycle();
4970 return res;
4971 }
4972
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004973 public String getTagForIntentSender(IIntentSender sender, String prefix)
4974 throws RemoteException {
4975 Parcel data = Parcel.obtain();
4976 Parcel reply = Parcel.obtain();
4977 data.writeInterfaceToken(IActivityManager.descriptor);
4978 data.writeStrongBinder(sender.asBinder());
4979 data.writeString(prefix);
4980 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4981 reply.readException();
4982 String res = reply.readString();
4983 data.recycle();
4984 reply.recycle();
4985 return res;
4986 }
4987
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004988 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4989 {
4990 Parcel data = Parcel.obtain();
4991 Parcel reply = Parcel.obtain();
4992 data.writeInterfaceToken(IActivityManager.descriptor);
4993 values.writeToParcel(data, 0);
4994 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4995 reply.readException();
4996 data.recycle();
4997 reply.recycle();
4998 }
4999
Dianne Hackbornb437e092011-08-05 17:50:29 -07005000 public long[] getProcessPss(int[] pids) throws RemoteException {
5001 Parcel data = Parcel.obtain();
5002 Parcel reply = Parcel.obtain();
5003 data.writeInterfaceToken(IActivityManager.descriptor);
5004 data.writeIntArray(pids);
5005 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5006 reply.readException();
5007 long[] res = reply.createLongArray();
5008 data.recycle();
5009 reply.recycle();
5010 return res;
5011 }
5012
Dianne Hackborn661cd522011-08-22 00:26:20 -07005013 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5014 Parcel data = Parcel.obtain();
5015 Parcel reply = Parcel.obtain();
5016 data.writeInterfaceToken(IActivityManager.descriptor);
5017 TextUtils.writeToParcel(msg, data, 0);
5018 data.writeInt(always ? 1 : 0);
5019 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5020 reply.readException();
5021 data.recycle();
5022 reply.recycle();
5023 }
5024
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005025 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005026 Parcel data = Parcel.obtain();
5027 Parcel reply = Parcel.obtain();
5028 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005029 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005030 reply.readException();
5031 data.recycle();
5032 reply.recycle();
5033 }
5034
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005035 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005036 throws RemoteException {
5037 Parcel data = Parcel.obtain();
5038 Parcel reply = Parcel.obtain();
5039 data.writeInterfaceToken(IActivityManager.descriptor);
5040 data.writeStrongBinder(token);
5041 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005042 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005043 reply.readException();
5044 boolean result = reply.readInt() != 0;
5045 data.recycle();
5046 reply.recycle();
5047 return result;
5048 }
5049
5050 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5051 throws RemoteException {
5052 Parcel data = Parcel.obtain();
5053 Parcel reply = Parcel.obtain();
5054 data.writeInterfaceToken(IActivityManager.descriptor);
5055 data.writeStrongBinder(token);
5056 target.writeToParcel(data, 0);
5057 data.writeInt(resultCode);
5058 if (resultData != null) {
5059 data.writeInt(1);
5060 resultData.writeToParcel(data, 0);
5061 } else {
5062 data.writeInt(0);
5063 }
5064 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5065 reply.readException();
5066 boolean result = reply.readInt() != 0;
5067 data.recycle();
5068 reply.recycle();
5069 return result;
5070 }
5071
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005072 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5073 Parcel data = Parcel.obtain();
5074 Parcel reply = Parcel.obtain();
5075 data.writeInterfaceToken(IActivityManager.descriptor);
5076 data.writeStrongBinder(activityToken);
5077 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5078 reply.readException();
5079 int result = reply.readInt();
5080 data.recycle();
5081 reply.recycle();
5082 return result;
5083 }
5084
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005085 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5086 Parcel data = Parcel.obtain();
5087 Parcel reply = Parcel.obtain();
5088 data.writeInterfaceToken(IActivityManager.descriptor);
5089 data.writeStrongBinder(activityToken);
5090 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5091 reply.readException();
5092 String result = reply.readString();
5093 data.recycle();
5094 reply.recycle();
5095 return result;
5096 }
5097
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005098 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5099 Parcel data = Parcel.obtain();
5100 Parcel reply = Parcel.obtain();
5101 data.writeInterfaceToken(IActivityManager.descriptor);
5102 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5103 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5104 reply.readException();
5105 data.recycle();
5106 reply.recycle();
5107 }
5108
5109 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5110 Parcel data = Parcel.obtain();
5111 Parcel reply = Parcel.obtain();
5112 data.writeInterfaceToken(IActivityManager.descriptor);
5113 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5114 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5115 reply.readException();
5116 data.recycle();
5117 reply.recycle();
5118 }
5119
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005120 public void requestBugReport() throws RemoteException {
5121 Parcel data = Parcel.obtain();
5122 Parcel reply = Parcel.obtain();
5123 data.writeInterfaceToken(IActivityManager.descriptor);
5124 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5125 reply.readException();
5126 data.recycle();
5127 reply.recycle();
5128 }
5129
Jeff Brownbd181bb2013-09-10 16:44:24 -07005130 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5131 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005132 Parcel data = Parcel.obtain();
5133 Parcel reply = Parcel.obtain();
5134 data.writeInterfaceToken(IActivityManager.descriptor);
5135 data.writeInt(pid);
5136 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005137 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005138 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5139 reply.readException();
5140 long res = reply.readInt();
5141 data.recycle();
5142 reply.recycle();
5143 return res;
5144 }
5145
Adam Skorydfc7fd72013-08-05 19:23:41 -07005146 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005147 Parcel data = Parcel.obtain();
5148 Parcel reply = Parcel.obtain();
5149 data.writeInterfaceToken(IActivityManager.descriptor);
5150 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005151 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005152 reply.readException();
5153 Bundle res = reply.readBundle();
5154 data.recycle();
5155 reply.recycle();
5156 return res;
5157 }
5158
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005159 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5160 throws RemoteException {
5161 Parcel data = Parcel.obtain();
5162 Parcel reply = Parcel.obtain();
5163 data.writeInterfaceToken(IActivityManager.descriptor);
5164 data.writeInt(requestType);
5165 data.writeStrongBinder(receiver.asBinder());
5166 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5167 reply.readException();
5168 data.recycle();
5169 reply.recycle();
5170 }
5171
Adam Skory7140a252013-09-11 12:04:58 +01005172 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005173 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005174 Parcel data = Parcel.obtain();
5175 Parcel reply = Parcel.obtain();
5176 data.writeInterfaceToken(IActivityManager.descriptor);
5177 data.writeStrongBinder(token);
5178 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005179 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005180 reply.readException();
5181 data.recycle();
5182 reply.recycle();
5183 }
5184
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005185 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5186 throws RemoteException {
5187 Parcel data = Parcel.obtain();
5188 Parcel reply = Parcel.obtain();
5189 data.writeInterfaceToken(IActivityManager.descriptor);
5190 intent.writeToParcel(data, 0);
5191 data.writeInt(requestType);
5192 data.writeString(hint);
5193 data.writeInt(userHandle);
5194 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5195 reply.readException();
5196 boolean res = reply.readInt() != 0;
5197 data.recycle();
5198 reply.recycle();
5199 return res;
5200 }
5201
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005202 public void killUid(int uid, String reason) throws RemoteException {
5203 Parcel data = Parcel.obtain();
5204 Parcel reply = Parcel.obtain();
5205 data.writeInterfaceToken(IActivityManager.descriptor);
5206 data.writeInt(uid);
5207 data.writeString(reason);
5208 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5209 reply.readException();
5210 data.recycle();
5211 reply.recycle();
5212 }
5213
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005214 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5215 Parcel data = Parcel.obtain();
5216 Parcel reply = Parcel.obtain();
5217 data.writeInterfaceToken(IActivityManager.descriptor);
5218 data.writeStrongBinder(who);
5219 data.writeInt(allowRestart ? 1 : 0);
5220 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5221 reply.readException();
5222 data.recycle();
5223 reply.recycle();
5224 }
5225
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005226 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5227 Parcel data = Parcel.obtain();
5228 Parcel reply = Parcel.obtain();
5229 data.writeInterfaceToken(IActivityManager.descriptor);
5230 data.writeStrongBinder(token);
5231 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5232 reply.readException();
5233 data.recycle();
5234 reply.recycle();
5235 }
5236
Craig Mautner5eda9b32013-07-02 11:58:16 -07005237 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5238 Parcel data = Parcel.obtain();
5239 Parcel reply = Parcel.obtain();
5240 data.writeInterfaceToken(IActivityManager.descriptor);
5241 data.writeStrongBinder(token);
5242 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5243 reply.readException();
5244 data.recycle();
5245 reply.recycle();
5246 }
5247
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005248 public void restart() throws RemoteException {
5249 Parcel data = Parcel.obtain();
5250 Parcel reply = Parcel.obtain();
5251 data.writeInterfaceToken(IActivityManager.descriptor);
5252 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5253 reply.readException();
5254 data.recycle();
5255 reply.recycle();
5256 }
5257
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005258 public void performIdleMaintenance() throws RemoteException {
5259 Parcel data = Parcel.obtain();
5260 Parcel reply = Parcel.obtain();
5261 data.writeInterfaceToken(IActivityManager.descriptor);
5262 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5263 reply.readException();
5264 data.recycle();
5265 reply.recycle();
5266 }
5267
Todd Kennedyca4d8422015-01-15 15:19:22 -08005268 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005269 IActivityContainerCallback callback) throws RemoteException {
5270 Parcel data = Parcel.obtain();
5271 Parcel reply = Parcel.obtain();
5272 data.writeInterfaceToken(IActivityManager.descriptor);
5273 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005274 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005275 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005276 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005277 final int result = reply.readInt();
5278 final IActivityContainer res;
5279 if (result == 1) {
5280 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5281 } else {
5282 res = null;
5283 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005284 data.recycle();
5285 reply.recycle();
5286 return res;
5287 }
5288
Craig Mautner95da1082014-02-24 17:54:35 -08005289 public void deleteActivityContainer(IActivityContainer activityContainer)
5290 throws RemoteException {
5291 Parcel data = Parcel.obtain();
5292 Parcel reply = Parcel.obtain();
5293 data.writeInterfaceToken(IActivityManager.descriptor);
5294 data.writeStrongBinder(activityContainer.asBinder());
5295 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5296 reply.readException();
5297 data.recycle();
5298 reply.recycle();
5299 }
5300
Todd Kennedy4900bf92015-01-16 16:05:14 -08005301 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 data.writeInt(displayId);
5306 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5307 reply.readException();
5308 final int result = reply.readInt();
5309 final IActivityContainer res;
5310 if (result == 1) {
5311 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5312 } else {
5313 res = null;
5314 }
5315 data.recycle();
5316 reply.recycle();
5317 return res;
5318 }
5319
Craig Mautnere0a38842013-12-16 16:14:02 -08005320 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5321 throws RemoteException {
5322 Parcel data = Parcel.obtain();
5323 Parcel reply = Parcel.obtain();
5324 data.writeInterfaceToken(IActivityManager.descriptor);
5325 data.writeStrongBinder(activityToken);
5326 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5327 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005328 final int result = reply.readInt();
5329 final IActivityContainer res;
5330 if (result == 1) {
5331 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5332 } else {
5333 res = null;
5334 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005335 data.recycle();
5336 reply.recycle();
5337 return res;
5338 }
5339
Craig Mautner4a1cb222013-12-04 16:14:06 -08005340 public IBinder getHomeActivityToken() throws RemoteException {
5341 Parcel data = Parcel.obtain();
5342 Parcel reply = Parcel.obtain();
5343 data.writeInterfaceToken(IActivityManager.descriptor);
5344 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5345 reply.readException();
5346 IBinder res = reply.readStrongBinder();
5347 data.recycle();
5348 reply.recycle();
5349 return res;
5350 }
5351
Craig Mautneraea74a52014-03-08 14:23:10 -08005352 @Override
5353 public void startLockTaskMode(int taskId) throws RemoteException {
5354 Parcel data = Parcel.obtain();
5355 Parcel reply = Parcel.obtain();
5356 data.writeInterfaceToken(IActivityManager.descriptor);
5357 data.writeInt(taskId);
5358 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5359 reply.readException();
5360 data.recycle();
5361 reply.recycle();
5362 }
5363
5364 @Override
5365 public void startLockTaskMode(IBinder token) throws RemoteException {
5366 Parcel data = Parcel.obtain();
5367 Parcel reply = Parcel.obtain();
5368 data.writeInterfaceToken(IActivityManager.descriptor);
5369 data.writeStrongBinder(token);
5370 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5371 reply.readException();
5372 data.recycle();
5373 reply.recycle();
5374 }
5375
5376 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005377 public void startLockTaskModeOnCurrent() throws RemoteException {
5378 Parcel data = Parcel.obtain();
5379 Parcel reply = Parcel.obtain();
5380 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005381 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005382 reply.readException();
5383 data.recycle();
5384 reply.recycle();
5385 }
5386
5387 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005388 public void stopLockTaskMode() throws RemoteException {
5389 Parcel data = Parcel.obtain();
5390 Parcel reply = Parcel.obtain();
5391 data.writeInterfaceToken(IActivityManager.descriptor);
5392 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5393 reply.readException();
5394 data.recycle();
5395 reply.recycle();
5396 }
5397
5398 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005399 public void stopLockTaskModeOnCurrent() throws RemoteException {
5400 Parcel data = Parcel.obtain();
5401 Parcel reply = Parcel.obtain();
5402 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005403 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005404 reply.readException();
5405 data.recycle();
5406 reply.recycle();
5407 }
5408
5409 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005410 public boolean isInLockTaskMode() throws RemoteException {
5411 Parcel data = Parcel.obtain();
5412 Parcel reply = Parcel.obtain();
5413 data.writeInterfaceToken(IActivityManager.descriptor);
5414 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5415 reply.readException();
5416 boolean isInLockTaskMode = reply.readInt() == 1;
5417 data.recycle();
5418 reply.recycle();
5419 return isInLockTaskMode;
5420 }
5421
Craig Mautner688b5102014-03-27 16:55:03 -07005422 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005423 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005424 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005425 Parcel data = Parcel.obtain();
5426 Parcel reply = Parcel.obtain();
5427 data.writeInterfaceToken(IActivityManager.descriptor);
5428 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005429 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005430 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005431 reply.readException();
5432 data.recycle();
5433 reply.recycle();
5434 }
5435
Craig Mautneree2e45a2014-06-27 12:10:03 -07005436 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005437 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5438 Parcel data = Parcel.obtain();
5439 Parcel reply = Parcel.obtain();
5440 data.writeInterfaceToken(IActivityManager.descriptor);
5441 data.writeInt(taskId);
5442 data.writeInt(resizeable ? 1 : 0);
5443 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5444 reply.readException();
5445 data.recycle();
5446 reply.recycle();
5447 }
5448
5449 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005450 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5451 Parcel data = Parcel.obtain();
5452 Parcel reply = Parcel.obtain();
5453 data.writeInterfaceToken(IActivityManager.descriptor);
5454 data.writeString(filename);
5455 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5456 reply.readException();
5457 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5458 data.recycle();
5459 reply.recycle();
5460 return icon;
5461 }
5462
5463 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005464 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5465 throws RemoteException {
5466 Parcel data = Parcel.obtain();
5467 Parcel reply = Parcel.obtain();
5468 data.writeInterfaceToken(IActivityManager.descriptor);
5469 if (options == null) {
5470 data.writeInt(0);
5471 } else {
5472 data.writeInt(1);
5473 data.writeBundle(options.toBundle());
5474 }
5475 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5476 reply.readException();
5477 data.recycle();
5478 reply.recycle();
5479 }
5480
5481 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005482 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005483 Parcel data = Parcel.obtain();
5484 Parcel reply = Parcel.obtain();
5485 data.writeInterfaceToken(IActivityManager.descriptor);
5486 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005487 data.writeInt(visible ? 1 : 0);
5488 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005489 reply.readException();
5490 boolean success = reply.readInt() > 0;
5491 data.recycle();
5492 reply.recycle();
5493 return success;
5494 }
5495
5496 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005497 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005498 Parcel data = Parcel.obtain();
5499 Parcel reply = Parcel.obtain();
5500 data.writeInterfaceToken(IActivityManager.descriptor);
5501 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005502 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005503 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005504 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005505 data.recycle();
5506 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005507 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005508 }
5509
5510 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005511 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005512 Parcel data = Parcel.obtain();
5513 Parcel reply = Parcel.obtain();
5514 data.writeInterfaceToken(IActivityManager.descriptor);
5515 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005516 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5517 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005518 reply.readException();
5519 data.recycle();
5520 reply.recycle();
5521 }
5522
5523 @Override
5524 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5525 Parcel data = Parcel.obtain();
5526 Parcel reply = Parcel.obtain();
5527 data.writeInterfaceToken(IActivityManager.descriptor);
5528 data.writeStrongBinder(token);
5529 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5530 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005531 reply.readException();
5532 data.recycle();
5533 reply.recycle();
5534 }
5535
Craig Mautner8746a472014-07-24 15:12:54 -07005536 @Override
5537 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5538 Parcel data = Parcel.obtain();
5539 Parcel reply = Parcel.obtain();
5540 data.writeInterfaceToken(IActivityManager.descriptor);
5541 data.writeStrongBinder(token);
5542 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5543 IBinder.FLAG_ONEWAY);
5544 reply.readException();
5545 data.recycle();
5546 reply.recycle();
5547 }
5548
Craig Mautner6e2f3952014-09-09 14:26:41 -07005549 @Override
5550 public void bootAnimationComplete() throws RemoteException {
5551 Parcel data = Parcel.obtain();
5552 Parcel reply = Parcel.obtain();
5553 data.writeInterfaceToken(IActivityManager.descriptor);
5554 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5555 reply.readException();
5556 data.recycle();
5557 reply.recycle();
5558 }
5559
Wale Ogunwale18795a22014-12-03 11:38:33 -08005560 @Override
5561 public void systemBackupRestored() throws RemoteException {
5562 Parcel data = Parcel.obtain();
5563 Parcel reply = Parcel.obtain();
5564 data.writeInterfaceToken(IActivityManager.descriptor);
5565 mRemote.transact(SYSTEM_BACKUP_RESTORED, data, reply, 0);
5566 reply.readException();
5567 data.recycle();
5568 reply.recycle();
5569 }
5570
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08005571 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005572 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5573 Parcel data = Parcel.obtain();
5574 Parcel reply = Parcel.obtain();
5575 data.writeInterfaceToken(IActivityManager.descriptor);
5576 data.writeInt(uid);
5577 data.writeByteArray(firstPacket);
5578 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5579 reply.readException();
5580 data.recycle();
5581 reply.recycle();
5582 }
5583
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005584 private IBinder mRemote;
5585}