blob: 09d6c290eb06e64c4e123b90c362d48bbe7a2e28 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Jeff Hao1b012d32014-08-20 10:35:34 -070020import android.app.ProfilerInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070022import android.content.IIntentReceiver;
23import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.Intent;
25import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070026import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070027import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070028import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.ConfigurationInfo;
30import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070031import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070032import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070034import android.graphics.Bitmap;
35import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080036import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.net.Uri;
38import android.os.Binder;
39import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070040import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.IBinder;
42import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070043import android.os.ParcelFileDescriptor;
44import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070045import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070046import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070048import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070049import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080052import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070053import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055import java.util.ArrayList;
56import java.util.List;
57
58/** {@hide} */
59public abstract class ActivityManagerNative extends Binder implements IActivityManager
60{
61 /**
62 * Cast a Binder object into an activity manager interface, generating
63 * a proxy if needed.
64 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 if (obj == null) {
67 return null;
68 }
69 IActivityManager in =
70 (IActivityManager)obj.queryLocalInterface(descriptor);
71 if (in != null) {
72 return in;
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 return new ActivityManagerProxy(obj);
76 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 /**
79 * Retrieve the system's default/global activity manager.
80 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080081 static public IActivityManager getDefault() {
82 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 }
84
85 /**
86 * Convenience for checking whether the system is ready. For internal use only.
87 */
88 static public boolean isSystemReady() {
89 if (!sSystemReady) {
90 sSystemReady = getDefault().testIsSystemReady();
91 }
92 return sSystemReady;
93 }
94 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080095
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 /**
97 * Convenience for sending a sticky broadcast. For internal use only.
98 * If you don't care about permission, use null.
99 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -0700100 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 try {
102 getDefault().broadcastIntent(
103 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800104 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 } catch (RemoteException ex) {
106 }
107 }
108
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800111 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800116 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 attachInterface(this, descriptor);
118 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700119
120 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
122 throws RemoteException {
123 switch (code) {
124 case START_ACTIVITY_TRANSACTION:
125 {
126 data.enforceInterface(IActivityManager.descriptor);
127 IBinder b = data.readStrongBinder();
128 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800129 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 Intent intent = Intent.CREATOR.createFromParcel(data);
131 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800133 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700135 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700136 ProfilerInfo profilerInfo = data.readInt() != 0
137 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700138 Bundle options = data.readInt() != 0
139 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800140 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700141 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700165 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700166 reply.writeNoException();
167 reply.writeInt(result);
168 return true;
169 }
170
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700171 case START_ACTIVITY_AS_CALLER_TRANSACTION:
172 {
173 data.enforceInterface(IActivityManager.descriptor);
174 IBinder b = data.readStrongBinder();
175 IApplicationThread app = ApplicationThreadNative.asInterface(b);
176 String callingPackage = data.readString();
177 Intent intent = Intent.CREATOR.createFromParcel(data);
178 String resolvedType = data.readString();
179 IBinder resultTo = data.readStrongBinder();
180 String resultWho = data.readString();
181 int requestCode = data.readInt();
182 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700183 ProfilerInfo profilerInfo = data.readInt() != 0
184 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
Jeff Sharkey97978802014-10-14 10:48:18 -0700187 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700188 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Sharkey97978802014-10-14 10:48:18 -0700189 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700190 reply.writeNoException();
191 reply.writeInt(result);
192 return true;
193 }
194
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800195 case START_ACTIVITY_AND_WAIT_TRANSACTION:
196 {
197 data.enforceInterface(IActivityManager.descriptor);
198 IBinder b = data.readStrongBinder();
199 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800200 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800201 Intent intent = Intent.CREATOR.createFromParcel(data);
202 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800203 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800204 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800205 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700206 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700207 ProfilerInfo profilerInfo = data.readInt() != 0
208 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700209 Bundle options = data.readInt() != 0
210 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700211 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800212 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800214 reply.writeNoException();
215 result.writeToParcel(reply, 0);
216 return true;
217 }
218
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700219 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
220 {
221 data.enforceInterface(IActivityManager.descriptor);
222 IBinder b = data.readStrongBinder();
223 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800224 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700225 Intent intent = Intent.CREATOR.createFromParcel(data);
226 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700227 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700228 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700229 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700231 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700232 Bundle options = data.readInt() != 0
233 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700234 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800235 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700236 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700237 reply.writeNoException();
238 reply.writeInt(result);
239 return true;
240 }
241
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700242 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700243 {
244 data.enforceInterface(IActivityManager.descriptor);
245 IBinder b = data.readStrongBinder();
246 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700247 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700248 Intent fillInIntent = null;
249 if (data.readInt() != 0) {
250 fillInIntent = Intent.CREATOR.createFromParcel(data);
251 }
252 String resolvedType = data.readString();
253 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700254 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700255 int requestCode = data.readInt();
256 int flagsMask = data.readInt();
257 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700258 Bundle options = data.readInt() != 0
259 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700260 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700261 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700262 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700263 reply.writeNoException();
264 reply.writeInt(result);
265 return true;
266 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700267
Dianne Hackborn91097de2014-04-04 18:02:06 -0700268 case START_VOICE_ACTIVITY_TRANSACTION:
269 {
270 data.enforceInterface(IActivityManager.descriptor);
271 String callingPackage = data.readString();
272 int callingPid = data.readInt();
273 int callingUid = data.readInt();
274 Intent intent = Intent.CREATOR.createFromParcel(data);
275 String resolvedType = data.readString();
276 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
277 data.readStrongBinder());
278 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
279 data.readStrongBinder());
280 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700281 ProfilerInfo profilerInfo = data.readInt() != 0
282 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
285 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700286 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
287 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
292
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 IBinder callingActivity = data.readStrongBinder();
297 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700298 Bundle options = data.readInt() != 0
299 ? Bundle.CREATOR.createFromParcel(data) : null;
300 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 reply.writeNoException();
302 reply.writeInt(result ? 1 : 0);
303 return true;
304 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700305
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700306 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
307 {
308 data.enforceInterface(IActivityManager.descriptor);
309 int taskId = data.readInt();
310 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
311 int result = startActivityFromRecents(taskId, options);
312 reply.writeNoException();
313 reply.writeInt(result);
314 return true;
315 }
316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 case FINISH_ACTIVITY_TRANSACTION: {
318 data.enforceInterface(IActivityManager.descriptor);
319 IBinder token = data.readStrongBinder();
320 Intent resultData = null;
321 int resultCode = data.readInt();
322 if (data.readInt() != 0) {
323 resultData = Intent.CREATOR.createFromParcel(data);
324 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700325 boolean finishTask = (data.readInt() != 0);
326 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 reply.writeNoException();
328 reply.writeInt(res ? 1 : 0);
329 return true;
330 }
331
332 case FINISH_SUB_ACTIVITY_TRANSACTION: {
333 data.enforceInterface(IActivityManager.descriptor);
334 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700335 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336 int requestCode = data.readInt();
337 finishSubActivity(token, resultWho, requestCode);
338 reply.writeNoException();
339 return true;
340 }
341
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700342 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
343 data.enforceInterface(IActivityManager.descriptor);
344 IBinder token = data.readStrongBinder();
345 boolean res = finishActivityAffinity(token);
346 reply.writeNoException();
347 reply.writeInt(res ? 1 : 0);
348 return true;
349 }
350
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700351 case FINISH_VOICE_TASK_TRANSACTION: {
352 data.enforceInterface(IActivityManager.descriptor);
353 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
354 data.readStrongBinder());
355 finishVoiceTask(session);
356 reply.writeNoException();
357 return true;
358 }
359
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700360 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
361 data.enforceInterface(IActivityManager.descriptor);
362 IBinder token = data.readStrongBinder();
363 boolean res = releaseActivityInstance(token);
364 reply.writeNoException();
365 reply.writeInt(res ? 1 : 0);
366 return true;
367 }
368
369 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
372 releaseSomeActivities(app);
373 reply.writeNoException();
374 return true;
375 }
376
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800377 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
378 data.enforceInterface(IActivityManager.descriptor);
379 IBinder token = data.readStrongBinder();
380 boolean res = willActivityBeVisible(token);
381 reply.writeNoException();
382 reply.writeInt(res ? 1 : 0);
383 return true;
384 }
385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 case REGISTER_RECEIVER_TRANSACTION:
387 {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder b = data.readStrongBinder();
390 IApplicationThread app =
391 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700392 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 b = data.readStrongBinder();
394 IIntentReceiver rec
395 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
396 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
397 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700398 int userId = data.readInt();
399 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 reply.writeNoException();
401 if (intent != null) {
402 reply.writeInt(1);
403 intent.writeToParcel(reply, 0);
404 } else {
405 reply.writeInt(0);
406 }
407 return true;
408 }
409
410 case UNREGISTER_RECEIVER_TRANSACTION:
411 {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder b = data.readStrongBinder();
414 if (b == null) {
415 return true;
416 }
417 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
418 unregisterReceiver(rec);
419 reply.writeNoException();
420 return true;
421 }
422
423 case BROADCAST_INTENT_TRANSACTION:
424 {
425 data.enforceInterface(IActivityManager.descriptor);
426 IBinder b = data.readStrongBinder();
427 IApplicationThread app =
428 b != null ? ApplicationThreadNative.asInterface(b) : null;
429 Intent intent = Intent.CREATOR.createFromParcel(data);
430 String resolvedType = data.readString();
431 b = data.readStrongBinder();
432 IIntentReceiver resultTo =
433 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
434 int resultCode = data.readInt();
435 String resultData = data.readString();
436 Bundle resultExtras = data.readBundle();
437 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800438 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 boolean serialized = data.readInt() != 0;
440 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700441 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800443 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700444 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800445 reply.writeNoException();
446 reply.writeInt(res);
447 return true;
448 }
449
450 case UNBROADCAST_INTENT_TRANSACTION:
451 {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder b = data.readStrongBinder();
454 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
455 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700456 int userId = data.readInt();
457 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 reply.writeNoException();
459 return true;
460 }
461
462 case FINISH_RECEIVER_TRANSACTION: {
463 data.enforceInterface(IActivityManager.descriptor);
464 IBinder who = data.readStrongBinder();
465 int resultCode = data.readInt();
466 String resultData = data.readString();
467 Bundle resultExtras = data.readBundle();
468 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800469 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800471 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 }
473 reply.writeNoException();
474 return true;
475 }
476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 case ATTACH_APPLICATION_TRANSACTION: {
478 data.enforceInterface(IActivityManager.descriptor);
479 IApplicationThread app = ApplicationThreadNative.asInterface(
480 data.readStrongBinder());
481 if (app != null) {
482 attachApplication(app);
483 }
484 reply.writeNoException();
485 return true;
486 }
487
488 case ACTIVITY_IDLE_TRANSACTION: {
489 data.enforceInterface(IActivityManager.descriptor);
490 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700491 Configuration config = null;
492 if (data.readInt() != 0) {
493 config = Configuration.CREATOR.createFromParcel(data);
494 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700495 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700497 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 }
499 reply.writeNoException();
500 return true;
501 }
502
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700503 case ACTIVITY_RESUMED_TRANSACTION: {
504 data.enforceInterface(IActivityManager.descriptor);
505 IBinder token = data.readStrongBinder();
506 activityResumed(token);
507 reply.writeNoException();
508 return true;
509 }
510
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 case ACTIVITY_PAUSED_TRANSACTION: {
512 data.enforceInterface(IActivityManager.descriptor);
513 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700514 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800515 reply.writeNoException();
516 return true;
517 }
518
519 case ACTIVITY_STOPPED_TRANSACTION: {
520 data.enforceInterface(IActivityManager.descriptor);
521 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800522 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700523 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700525 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 reply.writeNoException();
527 return true;
528 }
529
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800530 case ACTIVITY_SLEPT_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 IBinder token = data.readStrongBinder();
533 activitySlept(token);
534 reply.writeNoException();
535 return true;
536 }
537
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 case ACTIVITY_DESTROYED_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 IBinder token = data.readStrongBinder();
541 activityDestroyed(token);
542 reply.writeNoException();
543 return true;
544 }
545
546 case GET_CALLING_PACKAGE_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
549 String res = token != null ? getCallingPackage(token) : null;
550 reply.writeNoException();
551 reply.writeString(res);
552 return true;
553 }
554
555 case GET_CALLING_ACTIVITY_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 ComponentName cn = getCallingActivity(token);
559 reply.writeNoException();
560 ComponentName.writeToParcel(cn, reply);
561 return true;
562 }
563
Winson Chung1147c402014-05-14 11:05:00 -0700564 case GET_APP_TASKS_TRANSACTION: {
565 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700566 String callingPackage = data.readString();
567 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700568 reply.writeNoException();
569 int N = list != null ? list.size() : -1;
570 reply.writeInt(N);
571 int i;
572 for (i=0; i<N; i++) {
573 IAppTask task = list.get(i);
574 reply.writeStrongBinder(task.asBinder());
575 }
576 return true;
577 }
578
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700579 case ADD_APP_TASK_TRANSACTION: {
580 data.enforceInterface(IActivityManager.descriptor);
581 IBinder activityToken = data.readStrongBinder();
582 Intent intent = Intent.CREATOR.createFromParcel(data);
583 ActivityManager.TaskDescription descr
584 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
585 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
586 int res = addAppTask(activityToken, intent, descr, thumbnail);
587 reply.writeNoException();
588 reply.writeInt(res);
589 return true;
590 }
591
592 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
594 Point size = getAppTaskThumbnailSize();
595 reply.writeNoException();
596 size.writeToParcel(reply, 0);
597 return true;
598 }
599
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800600 case GET_TASKS_TRANSACTION: {
601 data.enforceInterface(IActivityManager.descriptor);
602 int maxNum = data.readInt();
603 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700604 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 reply.writeNoException();
606 int N = list != null ? list.size() : -1;
607 reply.writeInt(N);
608 int i;
609 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700610 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 info.writeToParcel(reply, 0);
612 }
613 return true;
614 }
615
616 case GET_RECENT_TASKS_TRANSACTION: {
617 data.enforceInterface(IActivityManager.descriptor);
618 int maxNum = data.readInt();
619 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700620 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700622 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 reply.writeNoException();
624 reply.writeTypedList(list);
625 return true;
626 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700627
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700628 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800629 data.enforceInterface(IActivityManager.descriptor);
630 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700631 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800632 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700633 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800634 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700635 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700636 } else {
637 reply.writeInt(0);
638 }
639 return true;
640 }
641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 case GET_SERVICES_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 int maxNum = data.readInt();
645 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700646 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800647 reply.writeNoException();
648 int N = list != null ? list.size() : -1;
649 reply.writeInt(N);
650 int i;
651 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700652 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800653 info.writeToParcel(reply, 0);
654 }
655 return true;
656 }
657
658 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
659 data.enforceInterface(IActivityManager.descriptor);
660 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
661 reply.writeNoException();
662 reply.writeTypedList(list);
663 return true;
664 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700665
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800666 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
667 data.enforceInterface(IActivityManager.descriptor);
668 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
669 reply.writeNoException();
670 reply.writeTypedList(list);
671 return true;
672 }
673
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700674 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
675 data.enforceInterface(IActivityManager.descriptor);
676 List<ApplicationInfo> list = getRunningExternalApplications();
677 reply.writeNoException();
678 reply.writeTypedList(list);
679 return true;
680 }
681
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 case MOVE_TASK_TO_FRONT_TRANSACTION: {
683 data.enforceInterface(IActivityManager.descriptor);
684 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800685 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700686 Bundle options = data.readInt() != 0
687 ? Bundle.CREATOR.createFromParcel(data) : null;
688 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 reply.writeNoException();
690 return true;
691 }
692
693 case MOVE_TASK_TO_BACK_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 int task = data.readInt();
696 moveTaskToBack(task);
697 reply.writeNoException();
698 return true;
699 }
700
701 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 IBinder token = data.readStrongBinder();
704 boolean nonRoot = data.readInt() != 0;
705 boolean res = moveActivityTaskToBack(token, nonRoot);
706 reply.writeNoException();
707 reply.writeInt(res ? 1 : 0);
708 return true;
709 }
710
711 case MOVE_TASK_BACKWARDS_TRANSACTION: {
712 data.enforceInterface(IActivityManager.descriptor);
713 int task = data.readInt();
714 moveTaskBackwards(task);
715 reply.writeNoException();
716 return true;
717 }
718
Craig Mautnerc00204b2013-03-05 15:02:14 -0800719 case MOVE_TASK_TO_STACK_TRANSACTION: {
720 data.enforceInterface(IActivityManager.descriptor);
721 int taskId = data.readInt();
722 int stackId = data.readInt();
723 boolean toTop = data.readInt() != 0;
724 moveTaskToStack(taskId, stackId, toTop);
725 reply.writeNoException();
726 return true;
727 }
728
729 case RESIZE_STACK_TRANSACTION: {
730 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800731 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800732 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800733 Rect r = Rect.CREATOR.createFromParcel(data);
734 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800735 reply.writeNoException();
736 return true;
737 }
738
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800739 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700740 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800741 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700742 reply.writeNoException();
743 reply.writeTypedList(list);
744 return true;
745 }
746
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800747 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700748 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800749 int stackId = data.readInt();
750 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700751 reply.writeNoException();
752 if (info != null) {
753 reply.writeInt(1);
754 info.writeToParcel(reply, 0);
755 } else {
756 reply.writeInt(0);
757 }
758 return true;
759 }
760
Winson Chung303e1ff2014-03-07 15:06:19 -0800761 case IS_IN_HOME_STACK_TRANSACTION: {
762 data.enforceInterface(IActivityManager.descriptor);
763 int taskId = data.readInt();
764 boolean isInHomeStack = isInHomeStack(taskId);
765 reply.writeNoException();
766 reply.writeInt(isInHomeStack ? 1 : 0);
767 return true;
768 }
769
Craig Mautnercf910b02013-04-23 11:23:27 -0700770 case SET_FOCUSED_STACK_TRANSACTION: {
771 data.enforceInterface(IActivityManager.descriptor);
772 int stackId = data.readInt();
773 setFocusedStack(stackId);
774 reply.writeNoException();
775 return true;
776 }
777
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800778 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
779 data.enforceInterface(IActivityManager.descriptor);
780 IBinder token = data.readStrongBinder();
781 boolean onlyRoot = data.readInt() != 0;
782 int res = token != null
783 ? getTaskForActivity(token, onlyRoot) : -1;
784 reply.writeNoException();
785 reply.writeInt(res);
786 return true;
787 }
788
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 case GET_CONTENT_PROVIDER_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 IBinder b = data.readStrongBinder();
792 IApplicationThread app = ApplicationThreadNative.asInterface(b);
793 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700794 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700795 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700796 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800797 reply.writeNoException();
798 if (cph != null) {
799 reply.writeInt(1);
800 cph.writeToParcel(reply, 0);
801 } else {
802 reply.writeInt(0);
803 }
804 return true;
805 }
806
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800807 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700810 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800811 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700812 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800813 reply.writeNoException();
814 if (cph != null) {
815 reply.writeInt(1);
816 cph.writeToParcel(reply, 0);
817 } else {
818 reply.writeInt(0);
819 }
820 return true;
821 }
822
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800823 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 IBinder b = data.readStrongBinder();
826 IApplicationThread app = ApplicationThreadNative.asInterface(b);
827 ArrayList<ContentProviderHolder> providers =
828 data.createTypedArrayList(ContentProviderHolder.CREATOR);
829 publishContentProviders(app, providers);
830 reply.writeNoException();
831 return true;
832 }
833
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700834 case REF_CONTENT_PROVIDER_TRANSACTION: {
835 data.enforceInterface(IActivityManager.descriptor);
836 IBinder b = data.readStrongBinder();
837 int stable = data.readInt();
838 int unstable = data.readInt();
839 boolean res = refContentProvider(b, stable, unstable);
840 reply.writeNoException();
841 reply.writeInt(res ? 1 : 0);
842 return true;
843 }
844
845 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
846 data.enforceInterface(IActivityManager.descriptor);
847 IBinder b = data.readStrongBinder();
848 unstableProviderDied(b);
849 reply.writeNoException();
850 return true;
851 }
852
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700853 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
854 data.enforceInterface(IActivityManager.descriptor);
855 IBinder b = data.readStrongBinder();
856 appNotRespondingViaProvider(b);
857 reply.writeNoException();
858 return true;
859 }
860
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800861 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
862 data.enforceInterface(IActivityManager.descriptor);
863 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700864 boolean stable = data.readInt() != 0;
865 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800866 reply.writeNoException();
867 return true;
868 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800869
870 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
871 data.enforceInterface(IActivityManager.descriptor);
872 String name = data.readString();
873 IBinder token = data.readStrongBinder();
874 removeContentProviderExternal(name, token);
875 reply.writeNoException();
876 return true;
877 }
878
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700879 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
880 data.enforceInterface(IActivityManager.descriptor);
881 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
882 PendingIntent pi = getRunningServiceControlPanel(comp);
883 reply.writeNoException();
884 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
885 return true;
886 }
887
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800888 case START_SERVICE_TRANSACTION: {
889 data.enforceInterface(IActivityManager.descriptor);
890 IBinder b = data.readStrongBinder();
891 IApplicationThread app = ApplicationThreadNative.asInterface(b);
892 Intent service = Intent.CREATOR.createFromParcel(data);
893 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700894 int userId = data.readInt();
895 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800896 reply.writeNoException();
897 ComponentName.writeToParcel(cn, reply);
898 return true;
899 }
900
901 case STOP_SERVICE_TRANSACTION: {
902 data.enforceInterface(IActivityManager.descriptor);
903 IBinder b = data.readStrongBinder();
904 IApplicationThread app = ApplicationThreadNative.asInterface(b);
905 Intent service = Intent.CREATOR.createFromParcel(data);
906 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700907 int userId = data.readInt();
908 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800909 reply.writeNoException();
910 reply.writeInt(res);
911 return true;
912 }
913
914 case STOP_SERVICE_TOKEN_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 ComponentName className = ComponentName.readFromParcel(data);
917 IBinder token = data.readStrongBinder();
918 int startId = data.readInt();
919 boolean res = stopServiceToken(className, token, startId);
920 reply.writeNoException();
921 reply.writeInt(res ? 1 : 0);
922 return true;
923 }
924
925 case SET_SERVICE_FOREGROUND_TRANSACTION: {
926 data.enforceInterface(IActivityManager.descriptor);
927 ComponentName className = ComponentName.readFromParcel(data);
928 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700929 int id = data.readInt();
930 Notification notification = null;
931 if (data.readInt() != 0) {
932 notification = Notification.CREATOR.createFromParcel(data);
933 }
934 boolean removeNotification = data.readInt() != 0;
935 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 reply.writeNoException();
937 return true;
938 }
939
940 case BIND_SERVICE_TRANSACTION: {
941 data.enforceInterface(IActivityManager.descriptor);
942 IBinder b = data.readStrongBinder();
943 IApplicationThread app = ApplicationThreadNative.asInterface(b);
944 IBinder token = data.readStrongBinder();
945 Intent service = Intent.CREATOR.createFromParcel(data);
946 String resolvedType = data.readString();
947 b = data.readStrongBinder();
948 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800949 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800951 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800952 reply.writeNoException();
953 reply.writeInt(res);
954 return true;
955 }
956
957 case UNBIND_SERVICE_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 IBinder b = data.readStrongBinder();
960 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
961 boolean res = unbindService(conn);
962 reply.writeNoException();
963 reply.writeInt(res ? 1 : 0);
964 return true;
965 }
966
967 case PUBLISH_SERVICE_TRANSACTION: {
968 data.enforceInterface(IActivityManager.descriptor);
969 IBinder token = data.readStrongBinder();
970 Intent intent = Intent.CREATOR.createFromParcel(data);
971 IBinder service = data.readStrongBinder();
972 publishService(token, intent, service);
973 reply.writeNoException();
974 return true;
975 }
976
977 case UNBIND_FINISHED_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder token = data.readStrongBinder();
980 Intent intent = Intent.CREATOR.createFromParcel(data);
981 boolean doRebind = data.readInt() != 0;
982 unbindFinished(token, intent, doRebind);
983 reply.writeNoException();
984 return true;
985 }
986
987 case SERVICE_DONE_EXECUTING_TRANSACTION: {
988 data.enforceInterface(IActivityManager.descriptor);
989 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700990 int type = data.readInt();
991 int startId = data.readInt();
992 int res = data.readInt();
993 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 reply.writeNoException();
995 return true;
996 }
997
998 case START_INSTRUMENTATION_TRANSACTION: {
999 data.enforceInterface(IActivityManager.descriptor);
1000 ComponentName className = ComponentName.readFromParcel(data);
1001 String profileFile = data.readString();
1002 int fl = data.readInt();
1003 Bundle arguments = data.readBundle();
1004 IBinder b = data.readStrongBinder();
1005 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001006 b = data.readStrongBinder();
1007 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001008 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001009 String abiOverride = data.readString();
1010 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1011 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001012 reply.writeNoException();
1013 reply.writeInt(res ? 1 : 0);
1014 return true;
1015 }
1016
1017
1018 case FINISH_INSTRUMENTATION_TRANSACTION: {
1019 data.enforceInterface(IActivityManager.descriptor);
1020 IBinder b = data.readStrongBinder();
1021 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1022 int resultCode = data.readInt();
1023 Bundle results = data.readBundle();
1024 finishInstrumentation(app, resultCode, results);
1025 reply.writeNoException();
1026 return true;
1027 }
1028
1029 case GET_CONFIGURATION_TRANSACTION: {
1030 data.enforceInterface(IActivityManager.descriptor);
1031 Configuration config = getConfiguration();
1032 reply.writeNoException();
1033 config.writeToParcel(reply, 0);
1034 return true;
1035 }
1036
1037 case UPDATE_CONFIGURATION_TRANSACTION: {
1038 data.enforceInterface(IActivityManager.descriptor);
1039 Configuration config = Configuration.CREATOR.createFromParcel(data);
1040 updateConfiguration(config);
1041 reply.writeNoException();
1042 return true;
1043 }
1044
1045 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1046 data.enforceInterface(IActivityManager.descriptor);
1047 IBinder token = data.readStrongBinder();
1048 int requestedOrientation = data.readInt();
1049 setRequestedOrientation(token, requestedOrientation);
1050 reply.writeNoException();
1051 return true;
1052 }
1053
1054 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1055 data.enforceInterface(IActivityManager.descriptor);
1056 IBinder token = data.readStrongBinder();
1057 int req = getRequestedOrientation(token);
1058 reply.writeNoException();
1059 reply.writeInt(req);
1060 return true;
1061 }
1062
1063 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1064 data.enforceInterface(IActivityManager.descriptor);
1065 IBinder token = data.readStrongBinder();
1066 ComponentName cn = getActivityClassForToken(token);
1067 reply.writeNoException();
1068 ComponentName.writeToParcel(cn, reply);
1069 return true;
1070 }
1071
1072 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1073 data.enforceInterface(IActivityManager.descriptor);
1074 IBinder token = data.readStrongBinder();
1075 reply.writeNoException();
1076 reply.writeString(getPackageForToken(token));
1077 return true;
1078 }
1079
1080 case GET_INTENT_SENDER_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 int type = data.readInt();
1083 String packageName = data.readString();
1084 IBinder token = data.readStrongBinder();
1085 String resultWho = data.readString();
1086 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001087 Intent[] requestIntents;
1088 String[] requestResolvedTypes;
1089 if (data.readInt() != 0) {
1090 requestIntents = data.createTypedArray(Intent.CREATOR);
1091 requestResolvedTypes = data.createStringArray();
1092 } else {
1093 requestIntents = null;
1094 requestResolvedTypes = null;
1095 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001096 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001097 Bundle options = data.readInt() != 0
1098 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001099 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001101 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001102 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001103 reply.writeNoException();
1104 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1105 return true;
1106 }
1107
1108 case CANCEL_INTENT_SENDER_TRANSACTION: {
1109 data.enforceInterface(IActivityManager.descriptor);
1110 IIntentSender r = IIntentSender.Stub.asInterface(
1111 data.readStrongBinder());
1112 cancelIntentSender(r);
1113 reply.writeNoException();
1114 return true;
1115 }
1116
1117 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1118 data.enforceInterface(IActivityManager.descriptor);
1119 IIntentSender r = IIntentSender.Stub.asInterface(
1120 data.readStrongBinder());
1121 String res = getPackageForIntentSender(r);
1122 reply.writeNoException();
1123 reply.writeString(res);
1124 return true;
1125 }
1126
Christopher Tatec4a07d12012-04-06 14:19:13 -07001127 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 IIntentSender r = IIntentSender.Stub.asInterface(
1130 data.readStrongBinder());
1131 int res = getUidForIntentSender(r);
1132 reply.writeNoException();
1133 reply.writeInt(res);
1134 return true;
1135 }
1136
Dianne Hackborn41203752012-08-31 14:05:51 -07001137 case HANDLE_INCOMING_USER_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 int callingPid = data.readInt();
1140 int callingUid = data.readInt();
1141 int userId = data.readInt();
1142 boolean allowAll = data.readInt() != 0 ;
1143 boolean requireFull = data.readInt() != 0;
1144 String name = data.readString();
1145 String callerPackage = data.readString();
1146 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1147 requireFull, name, callerPackage);
1148 reply.writeNoException();
1149 reply.writeInt(res);
1150 return true;
1151 }
1152
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001153 case SET_PROCESS_LIMIT_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 int max = data.readInt();
1156 setProcessLimit(max);
1157 reply.writeNoException();
1158 return true;
1159 }
1160
1161 case GET_PROCESS_LIMIT_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 int limit = getProcessLimit();
1164 reply.writeNoException();
1165 reply.writeInt(limit);
1166 return true;
1167 }
1168
1169 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1170 data.enforceInterface(IActivityManager.descriptor);
1171 IBinder token = data.readStrongBinder();
1172 int pid = data.readInt();
1173 boolean isForeground = data.readInt() != 0;
1174 setProcessForeground(token, pid, isForeground);
1175 reply.writeNoException();
1176 return true;
1177 }
1178
1179 case CHECK_PERMISSION_TRANSACTION: {
1180 data.enforceInterface(IActivityManager.descriptor);
1181 String perm = data.readString();
1182 int pid = data.readInt();
1183 int uid = data.readInt();
1184 int res = checkPermission(perm, pid, uid);
1185 reply.writeNoException();
1186 reply.writeInt(res);
1187 return true;
1188 }
1189
1190 case CHECK_URI_PERMISSION_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 Uri uri = Uri.CREATOR.createFromParcel(data);
1193 int pid = data.readInt();
1194 int uid = data.readInt();
1195 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001196 int userId = data.readInt();
1197 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001198 reply.writeNoException();
1199 reply.writeInt(res);
1200 return true;
1201 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001202
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001204 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001205 String packageName = data.readString();
1206 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1207 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001208 int userId = data.readInt();
1209 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001210 reply.writeNoException();
1211 reply.writeInt(res ? 1 : 0);
1212 return true;
1213 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001214
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 case GRANT_URI_PERMISSION_TRANSACTION: {
1216 data.enforceInterface(IActivityManager.descriptor);
1217 IBinder b = data.readStrongBinder();
1218 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1219 String targetPkg = data.readString();
1220 Uri uri = Uri.CREATOR.createFromParcel(data);
1221 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001222 int userId = data.readInt();
1223 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 reply.writeNoException();
1225 return true;
1226 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001227
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001228 case REVOKE_URI_PERMISSION_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 IBinder b = data.readStrongBinder();
1231 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1232 Uri uri = Uri.CREATOR.createFromParcel(data);
1233 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001234 int userId = data.readInt();
1235 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001236 reply.writeNoException();
1237 return true;
1238 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001239
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001240 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1241 data.enforceInterface(IActivityManager.descriptor);
1242 Uri uri = Uri.CREATOR.createFromParcel(data);
1243 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001244 int userId = data.readInt();
1245 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001246 reply.writeNoException();
1247 return true;
1248 }
1249
1250 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 Uri uri = Uri.CREATOR.createFromParcel(data);
1253 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001254 int userId = data.readInt();
1255 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001256 reply.writeNoException();
1257 return true;
1258 }
1259
1260 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001262 final String packageName = data.readString();
1263 final boolean incoming = data.readInt() != 0;
1264 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1265 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001266 reply.writeNoException();
1267 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1268 return true;
1269 }
1270
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
1273 IBinder b = data.readStrongBinder();
1274 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1275 boolean waiting = data.readInt() != 0;
1276 showWaitingForDebugger(app, waiting);
1277 reply.writeNoException();
1278 return true;
1279 }
1280
1281 case GET_MEMORY_INFO_TRANSACTION: {
1282 data.enforceInterface(IActivityManager.descriptor);
1283 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1284 getMemoryInfo(mi);
1285 reply.writeNoException();
1286 mi.writeToParcel(reply, 0);
1287 return true;
1288 }
1289
1290 case UNHANDLED_BACK_TRANSACTION: {
1291 data.enforceInterface(IActivityManager.descriptor);
1292 unhandledBack();
1293 reply.writeNoException();
1294 return true;
1295 }
1296
1297 case OPEN_CONTENT_URI_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 Uri uri = Uri.parse(data.readString());
1300 ParcelFileDescriptor pfd = openContentUri(uri);
1301 reply.writeNoException();
1302 if (pfd != null) {
1303 reply.writeInt(1);
1304 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1305 } else {
1306 reply.writeInt(0);
1307 }
1308 return true;
1309 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001310
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001311 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1312 data.enforceInterface(IActivityManager.descriptor);
1313 setLockScreenShown(data.readInt() != 0);
1314 reply.writeNoException();
1315 return true;
1316 }
1317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 case SET_DEBUG_APP_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 String pn = data.readString();
1321 boolean wfd = data.readInt() != 0;
1322 boolean per = data.readInt() != 0;
1323 setDebugApp(pn, wfd, per);
1324 reply.writeNoException();
1325 return true;
1326 }
1327
1328 case SET_ALWAYS_FINISH_TRANSACTION: {
1329 data.enforceInterface(IActivityManager.descriptor);
1330 boolean enabled = data.readInt() != 0;
1331 setAlwaysFinish(enabled);
1332 reply.writeNoException();
1333 return true;
1334 }
1335
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001336 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001338 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001339 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001340 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001341 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001342 return true;
1343 }
1344
1345 case ENTER_SAFE_MODE_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 enterSafeMode();
1348 reply.writeNoException();
1349 return true;
1350 }
1351
1352 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1353 data.enforceInterface(IActivityManager.descriptor);
1354 IIntentSender is = IIntentSender.Stub.asInterface(
1355 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001356 int sourceUid = data.readInt();
1357 String sourcePkg = data.readString();
1358 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 reply.writeNoException();
1360 return true;
1361 }
1362
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001363 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001364 data.enforceInterface(IActivityManager.descriptor);
1365 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001366 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001367 boolean secure = data.readInt() != 0;
1368 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001369 reply.writeNoException();
1370 reply.writeInt(res ? 1 : 0);
1371 return true;
1372 }
1373
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001374 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1375 data.enforceInterface(IActivityManager.descriptor);
1376 String reason = data.readString();
1377 boolean res = killProcessesBelowForeground(reason);
1378 reply.writeNoException();
1379 reply.writeInt(res ? 1 : 0);
1380 return true;
1381 }
1382
Dan Egnor60d87622009-12-16 16:32:58 -08001383 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1384 data.enforceInterface(IActivityManager.descriptor);
1385 IBinder app = data.readStrongBinder();
1386 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1387 handleApplicationCrash(app, ci);
1388 reply.writeNoException();
1389 return true;
1390 }
1391
1392 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001393 data.enforceInterface(IActivityManager.descriptor);
1394 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001395 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001396 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001397 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001398 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001399 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001400 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001401 return true;
1402 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001403
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001404 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
1406 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001407 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001408 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1409 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001410 reply.writeNoException();
1411 return true;
1412 }
1413
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001414 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1415 data.enforceInterface(IActivityManager.descriptor);
1416 int sig = data.readInt();
1417 signalPersistentProcesses(sig);
1418 reply.writeNoException();
1419 return true;
1420 }
1421
Dianne Hackborn03abb812010-01-04 18:43:19 -08001422 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1423 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001424 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001425 int userId = data.readInt();
1426 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001427 reply.writeNoException();
1428 return true;
1429 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001430
1431 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 killAllBackgroundProcesses();
1434 reply.writeNoException();
1435 return true;
1436 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001437
Dianne Hackborn03abb812010-01-04 18:43:19 -08001438 case FORCE_STOP_PACKAGE_TRANSACTION: {
1439 data.enforceInterface(IActivityManager.descriptor);
1440 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001441 int userId = data.readInt();
1442 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001443 reply.writeNoException();
1444 return true;
1445 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001446
1447 case GET_MY_MEMORY_STATE_TRANSACTION: {
1448 data.enforceInterface(IActivityManager.descriptor);
1449 ActivityManager.RunningAppProcessInfo info =
1450 new ActivityManager.RunningAppProcessInfo();
1451 getMyMemoryState(info);
1452 reply.writeNoException();
1453 info.writeToParcel(reply, 0);
1454 return true;
1455 }
1456
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001457 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1458 data.enforceInterface(IActivityManager.descriptor);
1459 ConfigurationInfo config = getDeviceConfigurationInfo();
1460 reply.writeNoException();
1461 config.writeToParcel(reply, 0);
1462 return true;
1463 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001464
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001465 case PROFILE_CONTROL_TRANSACTION: {
1466 data.enforceInterface(IActivityManager.descriptor);
1467 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001468 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001469 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001470 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001471 ProfilerInfo profilerInfo = data.readInt() != 0
1472 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1473 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001474 reply.writeNoException();
1475 reply.writeInt(res ? 1 : 0);
1476 return true;
1477 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001478
Dianne Hackborn55280a92009-05-07 15:53:46 -07001479 case SHUTDOWN_TRANSACTION: {
1480 data.enforceInterface(IActivityManager.descriptor);
1481 boolean res = shutdown(data.readInt());
1482 reply.writeNoException();
1483 reply.writeInt(res ? 1 : 0);
1484 return true;
1485 }
1486
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001487 case STOP_APP_SWITCHES_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
1489 stopAppSwitches();
1490 reply.writeNoException();
1491 return true;
1492 }
1493
1494 case RESUME_APP_SWITCHES_TRANSACTION: {
1495 data.enforceInterface(IActivityManager.descriptor);
1496 resumeAppSwitches();
1497 reply.writeNoException();
1498 return true;
1499 }
1500
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001501 case PEEK_SERVICE_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
1503 Intent service = Intent.CREATOR.createFromParcel(data);
1504 String resolvedType = data.readString();
1505 IBinder binder = peekService(service, resolvedType);
1506 reply.writeNoException();
1507 reply.writeStrongBinder(binder);
1508 return true;
1509 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001510
1511 case START_BACKUP_AGENT_TRANSACTION: {
1512 data.enforceInterface(IActivityManager.descriptor);
1513 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1514 int backupRestoreMode = data.readInt();
1515 boolean success = bindBackupAgent(info, backupRestoreMode);
1516 reply.writeNoException();
1517 reply.writeInt(success ? 1 : 0);
1518 return true;
1519 }
1520
1521 case BACKUP_AGENT_CREATED_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 String packageName = data.readString();
1524 IBinder agent = data.readStrongBinder();
1525 backupAgentCreated(packageName, agent);
1526 reply.writeNoException();
1527 return true;
1528 }
1529
1530 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1531 data.enforceInterface(IActivityManager.descriptor);
1532 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1533 unbindBackupAgent(info);
1534 reply.writeNoException();
1535 return true;
1536 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001537
1538 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1539 data.enforceInterface(IActivityManager.descriptor);
1540 String packageName = data.readString();
1541 addPackageDependency(packageName);
1542 reply.writeNoException();
1543 return true;
1544 }
1545
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001546 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001547 data.enforceInterface(IActivityManager.descriptor);
1548 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001549 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001550 String reason = data.readString();
1551 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001552 reply.writeNoException();
1553 return true;
1554 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001555
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001556 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 String reason = data.readString();
1559 closeSystemDialogs(reason);
1560 reply.writeNoException();
1561 return true;
1562 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001563
1564 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001566 int[] pids = data.createIntArray();
1567 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001568 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001569 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001570 return true;
1571 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001572
1573 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1574 data.enforceInterface(IActivityManager.descriptor);
1575 String processName = data.readString();
1576 int uid = data.readInt();
1577 killApplicationProcess(processName, uid);
1578 reply.writeNoException();
1579 return true;
1580 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001581
1582 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 IBinder token = data.readStrongBinder();
1585 String packageName = data.readString();
1586 int enterAnim = data.readInt();
1587 int exitAnim = data.readInt();
1588 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001589 reply.writeNoException();
1590 return true;
1591 }
1592
1593 case IS_USER_A_MONKEY_TRANSACTION: {
1594 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001595 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001596 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001597 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001598 return true;
1599 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001600
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001601 case SET_USER_IS_MONKEY_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 final boolean monkey = (data.readInt() == 1);
1604 setUserIsMonkey(monkey);
1605 reply.writeNoException();
1606 return true;
1607 }
1608
Dianne Hackborn860755f2010-06-03 18:47:52 -07001609 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 finishHeavyWeightApp();
1612 reply.writeNoException();
1613 return true;
1614 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001615
1616 case IS_IMMERSIVE_TRANSACTION: {
1617 data.enforceInterface(IActivityManager.descriptor);
1618 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001619 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001620 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001621 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001622 return true;
1623 }
1624
Craig Mautnerd61dc202014-07-07 11:09:11 -07001625 case IS_TOP_OF_TASK_TRANSACTION: {
1626 data.enforceInterface(IActivityManager.descriptor);
1627 IBinder token = data.readStrongBinder();
1628 final boolean isTopOfTask = isTopOfTask(token);
1629 reply.writeNoException();
1630 reply.writeInt(isTopOfTask ? 1 : 0);
1631 return true;
1632 }
1633
Craig Mautner5eda9b32013-07-02 11:58:16 -07001634 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001635 data.enforceInterface(IActivityManager.descriptor);
1636 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001637 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001638 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001639 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001640 return true;
1641 }
1642
1643 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1644 data.enforceInterface(IActivityManager.descriptor);
1645 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001646 final Bundle bundle;
1647 if (data.readInt() == 0) {
1648 bundle = null;
1649 } else {
1650 bundle = data.readBundle();
1651 }
1652 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1653 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001654 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001655 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001656 return true;
1657 }
1658
Craig Mautner233ceee2014-05-09 17:05:11 -07001659 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 IBinder token = data.readStrongBinder();
1662 final ActivityOptions options = getActivityOptions(token);
1663 reply.writeNoException();
1664 reply.writeBundle(options == null ? null : options.toBundle());
1665 return true;
1666 }
1667
Daniel Sandler69a48172010-06-23 16:29:36 -04001668 case SET_IMMERSIVE_TRANSACTION: {
1669 data.enforceInterface(IActivityManager.descriptor);
1670 IBinder token = data.readStrongBinder();
1671 boolean imm = data.readInt() == 1;
1672 setImmersive(token, imm);
1673 reply.writeNoException();
1674 return true;
1675 }
1676
1677 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1678 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001679 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001680 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001681 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001682 return true;
1683 }
1684
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001685 case CRASH_APPLICATION_TRANSACTION: {
1686 data.enforceInterface(IActivityManager.descriptor);
1687 int uid = data.readInt();
1688 int initialPid = data.readInt();
1689 String packageName = data.readString();
1690 String message = data.readString();
1691 crashApplication(uid, initialPid, packageName, message);
1692 reply.writeNoException();
1693 return true;
1694 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001695
1696 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1697 data.enforceInterface(IActivityManager.descriptor);
1698 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001699 int userId = data.readInt();
1700 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001701 reply.writeNoException();
1702 reply.writeString(type);
1703 return true;
1704 }
1705
Dianne Hackborn7e269642010-08-25 19:50:20 -07001706 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1707 data.enforceInterface(IActivityManager.descriptor);
1708 String name = data.readString();
1709 IBinder perm = newUriPermissionOwner(name);
1710 reply.writeNoException();
1711 reply.writeStrongBinder(perm);
1712 return true;
1713 }
1714
1715 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1716 data.enforceInterface(IActivityManager.descriptor);
1717 IBinder owner = data.readStrongBinder();
1718 int fromUid = data.readInt();
1719 String targetPkg = data.readString();
1720 Uri uri = Uri.CREATOR.createFromParcel(data);
1721 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001722 int sourceUserId = data.readInt();
1723 int targetUserId = data.readInt();
1724 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1725 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001726 reply.writeNoException();
1727 return true;
1728 }
1729
1730 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1731 data.enforceInterface(IActivityManager.descriptor);
1732 IBinder owner = data.readStrongBinder();
1733 Uri uri = null;
1734 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001735 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001736 }
1737 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001738 int userId = data.readInt();
1739 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001740 reply.writeNoException();
1741 return true;
1742 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001743
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001744 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1745 data.enforceInterface(IActivityManager.descriptor);
1746 int callingUid = data.readInt();
1747 String targetPkg = data.readString();
1748 Uri uri = Uri.CREATOR.createFromParcel(data);
1749 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001750 int userId = data.readInt();
1751 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001752 reply.writeNoException();
1753 reply.writeInt(res);
1754 return true;
1755 }
1756
Andy McFadden824c5102010-07-09 16:26:57 -07001757 case DUMP_HEAP_TRANSACTION: {
1758 data.enforceInterface(IActivityManager.descriptor);
1759 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001760 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001761 boolean managed = data.readInt() != 0;
1762 String path = data.readString();
1763 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001764 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001765 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001766 reply.writeNoException();
1767 reply.writeInt(res ? 1 : 0);
1768 return true;
1769 }
1770
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001771 case START_ACTIVITIES_TRANSACTION:
1772 {
1773 data.enforceInterface(IActivityManager.descriptor);
1774 IBinder b = data.readStrongBinder();
1775 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001776 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001777 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1778 String[] resolvedTypes = data.createStringArray();
1779 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001780 Bundle options = data.readInt() != 0
1781 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001782 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001783 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001784 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001785 reply.writeNoException();
1786 reply.writeInt(result);
1787 return true;
1788 }
1789
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001790 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1791 {
1792 data.enforceInterface(IActivityManager.descriptor);
1793 int mode = getFrontActivityScreenCompatMode();
1794 reply.writeNoException();
1795 reply.writeInt(mode);
1796 return true;
1797 }
1798
1799 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1800 {
1801 data.enforceInterface(IActivityManager.descriptor);
1802 int mode = data.readInt();
1803 setFrontActivityScreenCompatMode(mode);
1804 reply.writeNoException();
1805 reply.writeInt(mode);
1806 return true;
1807 }
1808
1809 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1810 {
1811 data.enforceInterface(IActivityManager.descriptor);
1812 String pkg = data.readString();
1813 int mode = getPackageScreenCompatMode(pkg);
1814 reply.writeNoException();
1815 reply.writeInt(mode);
1816 return true;
1817 }
1818
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001819 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1820 {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001823 int mode = data.readInt();
1824 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001825 reply.writeNoException();
1826 return true;
1827 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001828
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001829 case SWITCH_USER_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 int userid = data.readInt();
1832 boolean result = switchUser(userid);
1833 reply.writeNoException();
1834 reply.writeInt(result ? 1 : 0);
1835 return true;
1836 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001837
Kenny Guy08488bf2014-02-21 17:40:37 +00001838 case START_USER_IN_BACKGROUND_TRANSACTION: {
1839 data.enforceInterface(IActivityManager.descriptor);
1840 int userid = data.readInt();
1841 boolean result = startUserInBackground(userid);
1842 reply.writeNoException();
1843 reply.writeInt(result ? 1 : 0);
1844 return true;
1845 }
1846
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001847 case STOP_USER_TRANSACTION: {
1848 data.enforceInterface(IActivityManager.descriptor);
1849 int userid = data.readInt();
1850 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1851 data.readStrongBinder());
1852 int result = stopUser(userid, callback);
1853 reply.writeNoException();
1854 reply.writeInt(result);
1855 return true;
1856 }
1857
Amith Yamasani52f1d752012-03-28 18:19:29 -07001858 case GET_CURRENT_USER_TRANSACTION: {
1859 data.enforceInterface(IActivityManager.descriptor);
1860 UserInfo userInfo = getCurrentUser();
1861 reply.writeNoException();
1862 userInfo.writeToParcel(reply, 0);
1863 return true;
1864 }
1865
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001866 case IS_USER_RUNNING_TRANSACTION: {
1867 data.enforceInterface(IActivityManager.descriptor);
1868 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001869 boolean orStopping = data.readInt() != 0;
1870 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001871 reply.writeNoException();
1872 reply.writeInt(result ? 1 : 0);
1873 return true;
1874 }
1875
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001876 case GET_RUNNING_USER_IDS_TRANSACTION: {
1877 data.enforceInterface(IActivityManager.descriptor);
1878 int[] result = getRunningUserIds();
1879 reply.writeNoException();
1880 reply.writeIntArray(result);
1881 return true;
1882 }
1883
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001884 case REMOVE_TASK_TRANSACTION:
1885 {
1886 data.enforceInterface(IActivityManager.descriptor);
1887 int taskId = data.readInt();
1888 int fl = data.readInt();
1889 boolean result = removeTask(taskId, fl);
1890 reply.writeNoException();
1891 reply.writeInt(result ? 1 : 0);
1892 return true;
1893 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001894
Jeff Sharkeya4620792011-05-20 15:29:23 -07001895 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1896 data.enforceInterface(IActivityManager.descriptor);
1897 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1898 data.readStrongBinder());
1899 registerProcessObserver(observer);
1900 return true;
1901 }
1902
1903 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1904 data.enforceInterface(IActivityManager.descriptor);
1905 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1906 data.readStrongBinder());
1907 unregisterProcessObserver(observer);
1908 return true;
1909 }
1910
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001911 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1912 {
1913 data.enforceInterface(IActivityManager.descriptor);
1914 String pkg = data.readString();
1915 boolean ask = getPackageAskScreenCompat(pkg);
1916 reply.writeNoException();
1917 reply.writeInt(ask ? 1 : 0);
1918 return true;
1919 }
1920
1921 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1922 {
1923 data.enforceInterface(IActivityManager.descriptor);
1924 String pkg = data.readString();
1925 boolean ask = data.readInt() != 0;
1926 setPackageAskScreenCompat(pkg, ask);
1927 reply.writeNoException();
1928 return true;
1929 }
1930
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001931 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1932 data.enforceInterface(IActivityManager.descriptor);
1933 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001934 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001935 boolean res = isIntentSenderTargetedToPackage(r);
1936 reply.writeNoException();
1937 reply.writeInt(res ? 1 : 0);
1938 return true;
1939 }
1940
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001941 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1942 data.enforceInterface(IActivityManager.descriptor);
1943 IIntentSender r = IIntentSender.Stub.asInterface(
1944 data.readStrongBinder());
1945 boolean res = isIntentSenderAnActivity(r);
1946 reply.writeNoException();
1947 reply.writeInt(res ? 1 : 0);
1948 return true;
1949 }
1950
Dianne Hackborn81038902012-11-26 17:04:09 -08001951 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1952 data.enforceInterface(IActivityManager.descriptor);
1953 IIntentSender r = IIntentSender.Stub.asInterface(
1954 data.readStrongBinder());
1955 Intent intent = getIntentForIntentSender(r);
1956 reply.writeNoException();
1957 if (intent != null) {
1958 reply.writeInt(1);
1959 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1960 } else {
1961 reply.writeInt(0);
1962 }
1963 return true;
1964 }
1965
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001966 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 IIntentSender r = IIntentSender.Stub.asInterface(
1969 data.readStrongBinder());
1970 String prefix = data.readString();
1971 String tag = getTagForIntentSender(r, prefix);
1972 reply.writeNoException();
1973 reply.writeString(tag);
1974 return true;
1975 }
1976
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001977 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1978 data.enforceInterface(IActivityManager.descriptor);
1979 Configuration config = Configuration.CREATOR.createFromParcel(data);
1980 updatePersistentConfiguration(config);
1981 reply.writeNoException();
1982 return true;
1983 }
1984
Dianne Hackbornb437e092011-08-05 17:50:29 -07001985 case GET_PROCESS_PSS_TRANSACTION: {
1986 data.enforceInterface(IActivityManager.descriptor);
1987 int[] pids = data.createIntArray();
1988 long[] pss = getProcessPss(pids);
1989 reply.writeNoException();
1990 reply.writeLongArray(pss);
1991 return true;
1992 }
1993
Dianne Hackborn661cd522011-08-22 00:26:20 -07001994 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1995 data.enforceInterface(IActivityManager.descriptor);
1996 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1997 boolean always = data.readInt() != 0;
1998 showBootMessage(msg, always);
1999 reply.writeNoException();
2000 return true;
2001 }
2002
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002003 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002004 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002005 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002006 reply.writeNoException();
2007 return true;
2008 }
2009
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002010 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002011 data.enforceInterface(IActivityManager.descriptor);
2012 IBinder token = data.readStrongBinder();
2013 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002014 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002015 reply.writeNoException();
2016 reply.writeInt(res ? 1 : 0);
2017 return true;
2018 }
2019
2020 case NAVIGATE_UP_TO_TRANSACTION: {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 IBinder token = data.readStrongBinder();
2023 Intent target = Intent.CREATOR.createFromParcel(data);
2024 int resultCode = data.readInt();
2025 Intent resultData = null;
2026 if (data.readInt() != 0) {
2027 resultData = Intent.CREATOR.createFromParcel(data);
2028 }
2029 boolean res = navigateUpTo(token, target, resultCode, resultData);
2030 reply.writeNoException();
2031 reply.writeInt(res ? 1 : 0);
2032 return true;
2033 }
2034
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002035 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2036 data.enforceInterface(IActivityManager.descriptor);
2037 IBinder token = data.readStrongBinder();
2038 int res = getLaunchedFromUid(token);
2039 reply.writeNoException();
2040 reply.writeInt(res);
2041 return true;
2042 }
2043
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002044 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2045 data.enforceInterface(IActivityManager.descriptor);
2046 IBinder token = data.readStrongBinder();
2047 String res = getLaunchedFromPackage(token);
2048 reply.writeNoException();
2049 reply.writeString(res);
2050 return true;
2051 }
2052
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002053 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2054 data.enforceInterface(IActivityManager.descriptor);
2055 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2056 data.readStrongBinder());
2057 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002058 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002059 return true;
2060 }
2061
2062 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2063 data.enforceInterface(IActivityManager.descriptor);
2064 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2065 data.readStrongBinder());
2066 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002067 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002068 return true;
2069 }
2070
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002071 case REQUEST_BUG_REPORT_TRANSACTION: {
2072 data.enforceInterface(IActivityManager.descriptor);
2073 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002074 reply.writeNoException();
2075 return true;
2076 }
2077
2078 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2079 data.enforceInterface(IActivityManager.descriptor);
2080 int pid = data.readInt();
2081 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002082 String reason = data.readString();
2083 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002084 reply.writeNoException();
2085 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002086 return true;
2087 }
2088
Adam Skorydfc7fd72013-08-05 19:23:41 -07002089 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002090 data.enforceInterface(IActivityManager.descriptor);
2091 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002092 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002093 reply.writeNoException();
2094 reply.writeBundle(res);
2095 return true;
2096 }
2097
Adam Skorydfc7fd72013-08-05 19:23:41 -07002098 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002099 data.enforceInterface(IActivityManager.descriptor);
2100 IBinder token = data.readStrongBinder();
2101 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002102 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002103 reply.writeNoException();
2104 return true;
2105 }
2106
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002107 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2108 data.enforceInterface(IActivityManager.descriptor);
2109 Intent intent = Intent.CREATOR.createFromParcel(data);
2110 int requestType = data.readInt();
2111 String hint = data.readString();
2112 int userHandle = data.readInt();
2113 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2114 reply.writeNoException();
2115 reply.writeInt(res ? 1 : 0);
2116 return true;
2117 }
2118
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002119 case KILL_UID_TRANSACTION: {
2120 data.enforceInterface(IActivityManager.descriptor);
2121 int uid = data.readInt();
2122 String reason = data.readString();
2123 killUid(uid, reason);
2124 reply.writeNoException();
2125 return true;
2126 }
2127
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002128 case HANG_TRANSACTION: {
2129 data.enforceInterface(IActivityManager.descriptor);
2130 IBinder who = data.readStrongBinder();
2131 boolean allowRestart = data.readInt() != 0;
2132 hang(who, allowRestart);
2133 reply.writeNoException();
2134 return true;
2135 }
2136
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002137 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2138 data.enforceInterface(IActivityManager.descriptor);
2139 IBinder token = data.readStrongBinder();
2140 reportActivityFullyDrawn(token);
2141 reply.writeNoException();
2142 return true;
2143 }
2144
Craig Mautner5eda9b32013-07-02 11:58:16 -07002145 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2146 data.enforceInterface(IActivityManager.descriptor);
2147 IBinder token = data.readStrongBinder();
2148 notifyActivityDrawn(token);
2149 reply.writeNoException();
2150 return true;
2151 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002152
2153 case RESTART_TRANSACTION: {
2154 data.enforceInterface(IActivityManager.descriptor);
2155 restart();
2156 reply.writeNoException();
2157 return true;
2158 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002159
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002160 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2161 data.enforceInterface(IActivityManager.descriptor);
2162 performIdleMaintenance();
2163 reply.writeNoException();
2164 return true;
2165 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002166
2167 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2168 data.enforceInterface(IActivityManager.descriptor);
2169 IBinder parentActivityToken = data.readStrongBinder();
2170 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002171 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002172 IActivityContainer activityContainer =
2173 createActivityContainer(parentActivityToken, callback);
2174 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002175 if (activityContainer != null) {
2176 reply.writeInt(1);
2177 reply.writeStrongBinder(activityContainer.asBinder());
2178 } else {
2179 reply.writeInt(0);
2180 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002181 return true;
2182 }
2183
Craig Mautner95da1082014-02-24 17:54:35 -08002184 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2185 data.enforceInterface(IActivityManager.descriptor);
2186 IActivityContainer activityContainer =
2187 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2188 deleteActivityContainer(activityContainer);
2189 reply.writeNoException();
2190 return true;
2191 }
2192
Craig Mautnere0a38842013-12-16 16:14:02 -08002193 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2194 data.enforceInterface(IActivityManager.descriptor);
2195 IBinder activityToken = data.readStrongBinder();
2196 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2197 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002198 if (activityContainer != null) {
2199 reply.writeInt(1);
2200 reply.writeStrongBinder(activityContainer.asBinder());
2201 } else {
2202 reply.writeInt(0);
2203 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002204 return true;
2205 }
2206
Craig Mautner4a1cb222013-12-04 16:14:06 -08002207 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2208 data.enforceInterface(IActivityManager.descriptor);
2209 IBinder homeActivityToken = getHomeActivityToken();
2210 reply.writeNoException();
2211 reply.writeStrongBinder(homeActivityToken);
2212 return true;
2213 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002214
2215 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2216 data.enforceInterface(IActivityManager.descriptor);
2217 final int taskId = data.readInt();
2218 startLockTaskMode(taskId);
2219 reply.writeNoException();
2220 return true;
2221 }
2222
2223 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2224 data.enforceInterface(IActivityManager.descriptor);
2225 IBinder token = data.readStrongBinder();
2226 startLockTaskMode(token);
2227 reply.writeNoException();
2228 return true;
2229 }
2230
Craig Mautnerd61dc202014-07-07 11:09:11 -07002231 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002232 data.enforceInterface(IActivityManager.descriptor);
2233 startLockTaskModeOnCurrent();
2234 reply.writeNoException();
2235 return true;
2236 }
2237
Craig Mautneraea74a52014-03-08 14:23:10 -08002238 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2239 data.enforceInterface(IActivityManager.descriptor);
2240 stopLockTaskMode();
2241 reply.writeNoException();
2242 return true;
2243 }
2244
Craig Mautnerd61dc202014-07-07 11:09:11 -07002245 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002246 data.enforceInterface(IActivityManager.descriptor);
2247 stopLockTaskModeOnCurrent();
2248 reply.writeNoException();
2249 return true;
2250 }
2251
Craig Mautneraea74a52014-03-08 14:23:10 -08002252 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2253 data.enforceInterface(IActivityManager.descriptor);
2254 final boolean isInLockTaskMode = isInLockTaskMode();
2255 reply.writeNoException();
2256 reply.writeInt(isInLockTaskMode ? 1 : 0);
2257 return true;
2258 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002259
Winson Chunga449dc02014-05-16 11:15:04 -07002260 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002261 data.enforceInterface(IActivityManager.descriptor);
2262 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002263 ActivityManager.TaskDescription values =
2264 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2265 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002266 reply.writeNoException();
2267 return true;
2268 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002269
Craig Mautner648f69b2014-09-18 14:16:26 -07002270 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2271 data.enforceInterface(IActivityManager.descriptor);
2272 String filename = data.readString();
2273 Bitmap icon = getTaskDescriptionIcon(filename);
2274 reply.writeNoException();
2275 if (icon == null) {
2276 reply.writeInt(0);
2277 } else {
2278 reply.writeInt(1);
2279 icon.writeToParcel(reply, 0);
2280 }
2281 return true;
2282 }
2283
Jose Lima4b6c6692014-08-12 17:41:12 -07002284 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002285 data.enforceInterface(IActivityManager.descriptor);
2286 IBinder token = data.readStrongBinder();
2287 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002288 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002289 reply.writeNoException();
2290 reply.writeInt(success ? 1 : 0);
2291 return true;
2292 }
2293
Jose Lima4b6c6692014-08-12 17:41:12 -07002294 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002295 data.enforceInterface(IActivityManager.descriptor);
2296 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002297 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002298 reply.writeNoException();
2299 reply.writeInt(enabled ? 1 : 0);
2300 return true;
2301 }
2302
Jose Lima4b6c6692014-08-12 17:41:12 -07002303 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002304 data.enforceInterface(IActivityManager.descriptor);
2305 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002306 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002307 reply.writeNoException();
2308 return true;
2309 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002310
2311 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2312 data.enforceInterface(IActivityManager.descriptor);
2313 IBinder token = data.readStrongBinder();
2314 notifyLaunchTaskBehindComplete(token);
2315 reply.writeNoException();
2316 return true;
2317 }
Craig Mautner8746a472014-07-24 15:12:54 -07002318
2319 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2320 data.enforceInterface(IActivityManager.descriptor);
2321 IBinder token = data.readStrongBinder();
2322 notifyEnterAnimationComplete(token);
2323 reply.writeNoException();
2324 return true;
2325 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002326
2327 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2328 data.enforceInterface(IActivityManager.descriptor);
2329 bootAnimationComplete();
2330 reply.writeNoException();
2331 return true;
2332 }
Jeff Sharkey605eb792014-11-04 13:34:06 -08002333
2334 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2335 data.enforceInterface(IActivityManager.descriptor);
2336 final int uid = data.readInt();
2337 final byte[] firstPacket = data.createByteArray();
2338 notifyCleartextNetwork(uid, firstPacket);
2339 reply.writeNoException();
2340 return true;
2341 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002344 return super.onTransact(code, data, reply, flags);
2345 }
2346
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002347 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002348 return this;
2349 }
2350
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002351 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2352 protected IActivityManager create() {
2353 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002354 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002355 Log.v("ActivityManager", "default service binder = " + b);
2356 }
2357 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002358 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002359 Log.v("ActivityManager", "default service = " + am);
2360 }
2361 return am;
2362 }
2363 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002364}
2365
2366class ActivityManagerProxy implements IActivityManager
2367{
2368 public ActivityManagerProxy(IBinder remote)
2369 {
2370 mRemote = remote;
2371 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002372
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002373 public IBinder asBinder()
2374 {
2375 return mRemote;
2376 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002377
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002378 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002379 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002380 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002381 Parcel data = Parcel.obtain();
2382 Parcel reply = Parcel.obtain();
2383 data.writeInterfaceToken(IActivityManager.descriptor);
2384 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002385 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002386 intent.writeToParcel(data, 0);
2387 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002388 data.writeStrongBinder(resultTo);
2389 data.writeString(resultWho);
2390 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002391 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002392 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002393 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002394 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002395 } else {
2396 data.writeInt(0);
2397 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002398 if (options != null) {
2399 data.writeInt(1);
2400 options.writeToParcel(data, 0);
2401 } else {
2402 data.writeInt(0);
2403 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002404 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2405 reply.readException();
2406 int result = reply.readInt();
2407 reply.recycle();
2408 data.recycle();
2409 return result;
2410 }
Amith Yamasani82644082012-08-03 13:09:11 -07002411
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002412 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002413 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002414 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2415 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002416 Parcel data = Parcel.obtain();
2417 Parcel reply = Parcel.obtain();
2418 data.writeInterfaceToken(IActivityManager.descriptor);
2419 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002420 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002421 intent.writeToParcel(data, 0);
2422 data.writeString(resolvedType);
2423 data.writeStrongBinder(resultTo);
2424 data.writeString(resultWho);
2425 data.writeInt(requestCode);
2426 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002427 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002428 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002429 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002430 } else {
2431 data.writeInt(0);
2432 }
2433 if (options != null) {
2434 data.writeInt(1);
2435 options.writeToParcel(data, 0);
2436 } else {
2437 data.writeInt(0);
2438 }
2439 data.writeInt(userId);
2440 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2441 reply.readException();
2442 int result = reply.readInt();
2443 reply.recycle();
2444 data.recycle();
2445 return result;
2446 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002447 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2448 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002449 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002450 Parcel data = Parcel.obtain();
2451 Parcel reply = Parcel.obtain();
2452 data.writeInterfaceToken(IActivityManager.descriptor);
2453 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2454 data.writeString(callingPackage);
2455 intent.writeToParcel(data, 0);
2456 data.writeString(resolvedType);
2457 data.writeStrongBinder(resultTo);
2458 data.writeString(resultWho);
2459 data.writeInt(requestCode);
2460 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002461 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002462 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002463 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002464 } else {
2465 data.writeInt(0);
2466 }
2467 if (options != null) {
2468 data.writeInt(1);
2469 options.writeToParcel(data, 0);
2470 } else {
2471 data.writeInt(0);
2472 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002473 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002474 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2475 reply.readException();
2476 int result = reply.readInt();
2477 reply.recycle();
2478 data.recycle();
2479 return result;
2480 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002481 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2482 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002483 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2484 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002485 Parcel data = Parcel.obtain();
2486 Parcel reply = Parcel.obtain();
2487 data.writeInterfaceToken(IActivityManager.descriptor);
2488 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002489 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002490 intent.writeToParcel(data, 0);
2491 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002492 data.writeStrongBinder(resultTo);
2493 data.writeString(resultWho);
2494 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002495 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002496 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002497 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002498 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002499 } else {
2500 data.writeInt(0);
2501 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002502 if (options != null) {
2503 data.writeInt(1);
2504 options.writeToParcel(data, 0);
2505 } else {
2506 data.writeInt(0);
2507 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002508 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002509 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2510 reply.readException();
2511 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2512 reply.recycle();
2513 data.recycle();
2514 return result;
2515 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002516 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2517 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002518 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002519 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002520 Parcel data = Parcel.obtain();
2521 Parcel reply = Parcel.obtain();
2522 data.writeInterfaceToken(IActivityManager.descriptor);
2523 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002524 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002525 intent.writeToParcel(data, 0);
2526 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002527 data.writeStrongBinder(resultTo);
2528 data.writeString(resultWho);
2529 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002530 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002531 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002532 if (options != null) {
2533 data.writeInt(1);
2534 options.writeToParcel(data, 0);
2535 } else {
2536 data.writeInt(0);
2537 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002538 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002539 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2540 reply.readException();
2541 int result = reply.readInt();
2542 reply.recycle();
2543 data.recycle();
2544 return result;
2545 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002546 public int startActivityIntentSender(IApplicationThread caller,
2547 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002548 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002549 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002550 Parcel data = Parcel.obtain();
2551 Parcel reply = Parcel.obtain();
2552 data.writeInterfaceToken(IActivityManager.descriptor);
2553 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2554 intent.writeToParcel(data, 0);
2555 if (fillInIntent != null) {
2556 data.writeInt(1);
2557 fillInIntent.writeToParcel(data, 0);
2558 } else {
2559 data.writeInt(0);
2560 }
2561 data.writeString(resolvedType);
2562 data.writeStrongBinder(resultTo);
2563 data.writeString(resultWho);
2564 data.writeInt(requestCode);
2565 data.writeInt(flagsMask);
2566 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002567 if (options != null) {
2568 data.writeInt(1);
2569 options.writeToParcel(data, 0);
2570 } else {
2571 data.writeInt(0);
2572 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002573 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002574 reply.readException();
2575 int result = reply.readInt();
2576 reply.recycle();
2577 data.recycle();
2578 return result;
2579 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002580 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2581 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002582 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2583 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002584 Parcel data = Parcel.obtain();
2585 Parcel reply = Parcel.obtain();
2586 data.writeInterfaceToken(IActivityManager.descriptor);
2587 data.writeString(callingPackage);
2588 data.writeInt(callingPid);
2589 data.writeInt(callingUid);
2590 intent.writeToParcel(data, 0);
2591 data.writeString(resolvedType);
2592 data.writeStrongBinder(session.asBinder());
2593 data.writeStrongBinder(interactor.asBinder());
2594 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002595 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002596 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002597 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002598 } else {
2599 data.writeInt(0);
2600 }
2601 if (options != null) {
2602 data.writeInt(1);
2603 options.writeToParcel(data, 0);
2604 } else {
2605 data.writeInt(0);
2606 }
2607 data.writeInt(userId);
2608 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2609 reply.readException();
2610 int result = reply.readInt();
2611 reply.recycle();
2612 data.recycle();
2613 return result;
2614 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002615 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002616 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeStrongBinder(callingActivity);
2621 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002622 if (options != null) {
2623 data.writeInt(1);
2624 options.writeToParcel(data, 0);
2625 } else {
2626 data.writeInt(0);
2627 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002628 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2629 reply.readException();
2630 int result = reply.readInt();
2631 reply.recycle();
2632 data.recycle();
2633 return result != 0;
2634 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002635 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2636 Parcel data = Parcel.obtain();
2637 Parcel reply = Parcel.obtain();
2638 data.writeInterfaceToken(IActivityManager.descriptor);
2639 data.writeInt(taskId);
2640 if (options == null) {
2641 data.writeInt(0);
2642 } else {
2643 data.writeInt(1);
2644 options.writeToParcel(data, 0);
2645 }
2646 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2647 reply.readException();
2648 int result = reply.readInt();
2649 reply.recycle();
2650 data.recycle();
2651 return result;
2652 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002653 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002654 throws RemoteException {
2655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
2658 data.writeStrongBinder(token);
2659 data.writeInt(resultCode);
2660 if (resultData != null) {
2661 data.writeInt(1);
2662 resultData.writeToParcel(data, 0);
2663 } else {
2664 data.writeInt(0);
2665 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002666 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002667 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2668 reply.readException();
2669 boolean res = reply.readInt() != 0;
2670 data.recycle();
2671 reply.recycle();
2672 return res;
2673 }
2674 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2675 {
2676 Parcel data = Parcel.obtain();
2677 Parcel reply = Parcel.obtain();
2678 data.writeInterfaceToken(IActivityManager.descriptor);
2679 data.writeStrongBinder(token);
2680 data.writeString(resultWho);
2681 data.writeInt(requestCode);
2682 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2683 reply.readException();
2684 data.recycle();
2685 reply.recycle();
2686 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002687 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 data.writeStrongBinder(token);
2692 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2693 reply.readException();
2694 boolean res = reply.readInt() != 0;
2695 data.recycle();
2696 reply.recycle();
2697 return res;
2698 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002699 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2700 Parcel data = Parcel.obtain();
2701 Parcel reply = Parcel.obtain();
2702 data.writeInterfaceToken(IActivityManager.descriptor);
2703 data.writeStrongBinder(session.asBinder());
2704 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2705 reply.readException();
2706 data.recycle();
2707 reply.recycle();
2708 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002709 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2710 Parcel data = Parcel.obtain();
2711 Parcel reply = Parcel.obtain();
2712 data.writeInterfaceToken(IActivityManager.descriptor);
2713 data.writeStrongBinder(token);
2714 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2715 reply.readException();
2716 boolean res = reply.readInt() != 0;
2717 data.recycle();
2718 reply.recycle();
2719 return res;
2720 }
2721 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2722 Parcel data = Parcel.obtain();
2723 Parcel reply = Parcel.obtain();
2724 data.writeInterfaceToken(IActivityManager.descriptor);
2725 data.writeStrongBinder(app.asBinder());
2726 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2727 reply.readException();
2728 data.recycle();
2729 reply.recycle();
2730 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002731 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2732 Parcel data = Parcel.obtain();
2733 Parcel reply = Parcel.obtain();
2734 data.writeInterfaceToken(IActivityManager.descriptor);
2735 data.writeStrongBinder(token);
2736 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2737 reply.readException();
2738 boolean res = reply.readInt() != 0;
2739 data.recycle();
2740 reply.recycle();
2741 return res;
2742 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002743 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002744 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002745 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 {
2747 Parcel data = Parcel.obtain();
2748 Parcel reply = Parcel.obtain();
2749 data.writeInterfaceToken(IActivityManager.descriptor);
2750 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002751 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002752 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2753 filter.writeToParcel(data, 0);
2754 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002755 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002756 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2757 reply.readException();
2758 Intent intent = null;
2759 int haveIntent = reply.readInt();
2760 if (haveIntent != 0) {
2761 intent = Intent.CREATOR.createFromParcel(reply);
2762 }
2763 reply.recycle();
2764 data.recycle();
2765 return intent;
2766 }
2767 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2768 {
2769 Parcel data = Parcel.obtain();
2770 Parcel reply = Parcel.obtain();
2771 data.writeInterfaceToken(IActivityManager.descriptor);
2772 data.writeStrongBinder(receiver.asBinder());
2773 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2774 reply.readException();
2775 data.recycle();
2776 reply.recycle();
2777 }
2778 public int broadcastIntent(IApplicationThread caller,
2779 Intent intent, String resolvedType, IIntentReceiver resultTo,
2780 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002781 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002782 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002783 {
2784 Parcel data = Parcel.obtain();
2785 Parcel reply = Parcel.obtain();
2786 data.writeInterfaceToken(IActivityManager.descriptor);
2787 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2788 intent.writeToParcel(data, 0);
2789 data.writeString(resolvedType);
2790 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2791 data.writeInt(resultCode);
2792 data.writeString(resultData);
2793 data.writeBundle(map);
2794 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002795 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002796 data.writeInt(serialized ? 1 : 0);
2797 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002798 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002799 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2800 reply.readException();
2801 int res = reply.readInt();
2802 reply.recycle();
2803 data.recycle();
2804 return res;
2805 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002806 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2807 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002808 {
2809 Parcel data = Parcel.obtain();
2810 Parcel reply = Parcel.obtain();
2811 data.writeInterfaceToken(IActivityManager.descriptor);
2812 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2813 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002814 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002815 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2816 reply.readException();
2817 data.recycle();
2818 reply.recycle();
2819 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002820 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
2821 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002822 {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 data.writeStrongBinder(who);
2827 data.writeInt(resultCode);
2828 data.writeString(resultData);
2829 data.writeBundle(map);
2830 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002831 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002832 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2833 reply.readException();
2834 data.recycle();
2835 reply.recycle();
2836 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002837 public void attachApplication(IApplicationThread app) throws RemoteException
2838 {
2839 Parcel data = Parcel.obtain();
2840 Parcel reply = Parcel.obtain();
2841 data.writeInterfaceToken(IActivityManager.descriptor);
2842 data.writeStrongBinder(app.asBinder());
2843 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2844 reply.readException();
2845 data.recycle();
2846 reply.recycle();
2847 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002848 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2849 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002850 {
2851 Parcel data = Parcel.obtain();
2852 Parcel reply = Parcel.obtain();
2853 data.writeInterfaceToken(IActivityManager.descriptor);
2854 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002855 if (config != null) {
2856 data.writeInt(1);
2857 config.writeToParcel(data, 0);
2858 } else {
2859 data.writeInt(0);
2860 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002861 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2863 reply.readException();
2864 data.recycle();
2865 reply.recycle();
2866 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002867 public void activityResumed(IBinder token) throws RemoteException
2868 {
2869 Parcel data = Parcel.obtain();
2870 Parcel reply = Parcel.obtain();
2871 data.writeInterfaceToken(IActivityManager.descriptor);
2872 data.writeStrongBinder(token);
2873 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2874 reply.readException();
2875 data.recycle();
2876 reply.recycle();
2877 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002878 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002879 {
2880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 data.writeStrongBinder(token);
2884 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2885 reply.readException();
2886 data.recycle();
2887 reply.recycle();
2888 }
2889 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002890 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002891 {
2892 Parcel data = Parcel.obtain();
2893 Parcel reply = Parcel.obtain();
2894 data.writeInterfaceToken(IActivityManager.descriptor);
2895 data.writeStrongBinder(token);
2896 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002897 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002898 TextUtils.writeToParcel(description, data, 0);
2899 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2900 reply.readException();
2901 data.recycle();
2902 reply.recycle();
2903 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002904 public void activitySlept(IBinder token) throws RemoteException
2905 {
2906 Parcel data = Parcel.obtain();
2907 Parcel reply = Parcel.obtain();
2908 data.writeInterfaceToken(IActivityManager.descriptor);
2909 data.writeStrongBinder(token);
2910 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2911 reply.readException();
2912 data.recycle();
2913 reply.recycle();
2914 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002915 public void activityDestroyed(IBinder token) throws RemoteException
2916 {
2917 Parcel data = Parcel.obtain();
2918 Parcel reply = Parcel.obtain();
2919 data.writeInterfaceToken(IActivityManager.descriptor);
2920 data.writeStrongBinder(token);
2921 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2922 reply.readException();
2923 data.recycle();
2924 reply.recycle();
2925 }
2926 public String getCallingPackage(IBinder token) throws RemoteException
2927 {
2928 Parcel data = Parcel.obtain();
2929 Parcel reply = Parcel.obtain();
2930 data.writeInterfaceToken(IActivityManager.descriptor);
2931 data.writeStrongBinder(token);
2932 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2933 reply.readException();
2934 String res = reply.readString();
2935 data.recycle();
2936 reply.recycle();
2937 return res;
2938 }
2939 public ComponentName getCallingActivity(IBinder token)
2940 throws RemoteException {
2941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
2944 data.writeStrongBinder(token);
2945 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2946 reply.readException();
2947 ComponentName res = ComponentName.readFromParcel(reply);
2948 data.recycle();
2949 reply.recycle();
2950 return res;
2951 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002952 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002953 Parcel data = Parcel.obtain();
2954 Parcel reply = Parcel.obtain();
2955 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002956 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002957 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2958 reply.readException();
2959 ArrayList<IAppTask> list = null;
2960 int N = reply.readInt();
2961 if (N >= 0) {
2962 list = new ArrayList<IAppTask>();
2963 while (N > 0) {
2964 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2965 list.add(task);
2966 N--;
2967 }
2968 }
2969 data.recycle();
2970 reply.recycle();
2971 return list;
2972 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002973 public int addAppTask(IBinder activityToken, Intent intent,
2974 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2975 Parcel data = Parcel.obtain();
2976 Parcel reply = Parcel.obtain();
2977 data.writeInterfaceToken(IActivityManager.descriptor);
2978 data.writeStrongBinder(activityToken);
2979 intent.writeToParcel(data, 0);
2980 description.writeToParcel(data, 0);
2981 thumbnail.writeToParcel(data, 0);
2982 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2983 reply.readException();
2984 int res = reply.readInt();
2985 data.recycle();
2986 reply.recycle();
2987 return res;
2988 }
2989 public Point getAppTaskThumbnailSize() throws RemoteException {
2990 Parcel data = Parcel.obtain();
2991 Parcel reply = Parcel.obtain();
2992 data.writeInterfaceToken(IActivityManager.descriptor);
2993 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2994 reply.readException();
2995 Point size = Point.CREATOR.createFromParcel(reply);
2996 data.recycle();
2997 reply.recycle();
2998 return size;
2999 }
Dianne Hackborn09233282014-04-30 11:33:59 -07003000 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003001 Parcel data = Parcel.obtain();
3002 Parcel reply = Parcel.obtain();
3003 data.writeInterfaceToken(IActivityManager.descriptor);
3004 data.writeInt(maxNum);
3005 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 ArrayList list = null;
3009 int N = reply.readInt();
3010 if (N >= 0) {
3011 list = new ArrayList();
3012 while (N > 0) {
3013 ActivityManager.RunningTaskInfo info =
3014 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003015 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 list.add(info);
3017 N--;
3018 }
3019 }
3020 data.recycle();
3021 reply.recycle();
3022 return list;
3023 }
3024 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003025 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003026 Parcel data = Parcel.obtain();
3027 Parcel reply = Parcel.obtain();
3028 data.writeInterfaceToken(IActivityManager.descriptor);
3029 data.writeInt(maxNum);
3030 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003031 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003032 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3033 reply.readException();
3034 ArrayList<ActivityManager.RecentTaskInfo> list
3035 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3036 data.recycle();
3037 reply.recycle();
3038 return list;
3039 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003040 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003041 Parcel data = Parcel.obtain();
3042 Parcel reply = Parcel.obtain();
3043 data.writeInterfaceToken(IActivityManager.descriptor);
3044 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003045 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003046 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003047 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003048 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003049 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003050 }
3051 data.recycle();
3052 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003053 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003054 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003055 public List getServices(int maxNum, int flags) throws RemoteException {
3056 Parcel data = Parcel.obtain();
3057 Parcel reply = Parcel.obtain();
3058 data.writeInterfaceToken(IActivityManager.descriptor);
3059 data.writeInt(maxNum);
3060 data.writeInt(flags);
3061 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3062 reply.readException();
3063 ArrayList list = null;
3064 int N = reply.readInt();
3065 if (N >= 0) {
3066 list = new ArrayList();
3067 while (N > 0) {
3068 ActivityManager.RunningServiceInfo info =
3069 ActivityManager.RunningServiceInfo.CREATOR
3070 .createFromParcel(reply);
3071 list.add(info);
3072 N--;
3073 }
3074 }
3075 data.recycle();
3076 reply.recycle();
3077 return list;
3078 }
3079 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3080 throws RemoteException {
3081 Parcel data = Parcel.obtain();
3082 Parcel reply = Parcel.obtain();
3083 data.writeInterfaceToken(IActivityManager.descriptor);
3084 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3087 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3088 data.recycle();
3089 reply.recycle();
3090 return list;
3091 }
3092 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3093 throws RemoteException {
3094 Parcel data = Parcel.obtain();
3095 Parcel reply = Parcel.obtain();
3096 data.writeInterfaceToken(IActivityManager.descriptor);
3097 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3098 reply.readException();
3099 ArrayList<ActivityManager.RunningAppProcessInfo> list
3100 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3101 data.recycle();
3102 reply.recycle();
3103 return list;
3104 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003105 public List<ApplicationInfo> getRunningExternalApplications()
3106 throws RemoteException {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3111 reply.readException();
3112 ArrayList<ApplicationInfo> list
3113 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3114 data.recycle();
3115 reply.recycle();
3116 return list;
3117 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003118 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003119 {
3120 Parcel data = Parcel.obtain();
3121 Parcel reply = Parcel.obtain();
3122 data.writeInterfaceToken(IActivityManager.descriptor);
3123 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003124 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003125 if (options != null) {
3126 data.writeInt(1);
3127 options.writeToParcel(data, 0);
3128 } else {
3129 data.writeInt(0);
3130 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003131 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3132 reply.readException();
3133 data.recycle();
3134 reply.recycle();
3135 }
3136 public void moveTaskToBack(int task) throws RemoteException
3137 {
3138 Parcel data = Parcel.obtain();
3139 Parcel reply = Parcel.obtain();
3140 data.writeInterfaceToken(IActivityManager.descriptor);
3141 data.writeInt(task);
3142 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3143 reply.readException();
3144 data.recycle();
3145 reply.recycle();
3146 }
3147 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3148 throws RemoteException {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
3151 data.writeInterfaceToken(IActivityManager.descriptor);
3152 data.writeStrongBinder(token);
3153 data.writeInt(nonRoot ? 1 : 0);
3154 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3155 reply.readException();
3156 boolean res = reply.readInt() != 0;
3157 data.recycle();
3158 reply.recycle();
3159 return res;
3160 }
3161 public void moveTaskBackwards(int task) throws RemoteException
3162 {
3163 Parcel data = Parcel.obtain();
3164 Parcel reply = Parcel.obtain();
3165 data.writeInterfaceToken(IActivityManager.descriptor);
3166 data.writeInt(task);
3167 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3168 reply.readException();
3169 data.recycle();
3170 reply.recycle();
3171 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003172 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003173 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3174 {
3175 Parcel data = Parcel.obtain();
3176 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003177 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003178 data.writeInt(taskId);
3179 data.writeInt(stackId);
3180 data.writeInt(toTop ? 1 : 0);
3181 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3182 reply.readException();
3183 data.recycle();
3184 reply.recycle();
3185 }
3186 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003187 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003188 {
3189 Parcel data = Parcel.obtain();
3190 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003191 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003192 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003193 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003194 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003195 reply.readException();
3196 data.recycle();
3197 reply.recycle();
3198 }
Craig Mautner967212c2013-04-13 21:10:58 -07003199 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003200 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003201 {
3202 Parcel data = Parcel.obtain();
3203 Parcel reply = Parcel.obtain();
3204 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003205 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003206 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003207 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003208 data.recycle();
3209 reply.recycle();
3210 return list;
3211 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003212 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003213 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003214 {
3215 Parcel data = Parcel.obtain();
3216 Parcel reply = Parcel.obtain();
3217 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003218 data.writeInt(stackId);
3219 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003220 reply.readException();
3221 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003222 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003223 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003224 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003225 }
3226 data.recycle();
3227 reply.recycle();
3228 return info;
3229 }
3230 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003231 public boolean isInHomeStack(int taskId) throws RemoteException {
3232 Parcel data = Parcel.obtain();
3233 Parcel reply = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 data.writeInt(taskId);
3236 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 boolean isInHomeStack = reply.readInt() > 0;
3239 data.recycle();
3240 reply.recycle();
3241 return isInHomeStack;
3242 }
3243 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003244 public void setFocusedStack(int stackId) throws RemoteException
3245 {
3246 Parcel data = Parcel.obtain();
3247 Parcel reply = Parcel.obtain();
3248 data.writeInterfaceToken(IActivityManager.descriptor);
3249 data.writeInt(stackId);
3250 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3251 reply.readException();
3252 data.recycle();
3253 reply.recycle();
3254 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3256 {
3257 Parcel data = Parcel.obtain();
3258 Parcel reply = Parcel.obtain();
3259 data.writeInterfaceToken(IActivityManager.descriptor);
3260 data.writeStrongBinder(token);
3261 data.writeInt(onlyRoot ? 1 : 0);
3262 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3263 reply.readException();
3264 int res = reply.readInt();
3265 data.recycle();
3266 reply.recycle();
3267 return res;
3268 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003269 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003270 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003271 Parcel data = Parcel.obtain();
3272 Parcel reply = Parcel.obtain();
3273 data.writeInterfaceToken(IActivityManager.descriptor);
3274 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3275 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003276 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003277 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003278 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3279 reply.readException();
3280 int res = reply.readInt();
3281 ContentProviderHolder cph = null;
3282 if (res != 0) {
3283 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3284 }
3285 data.recycle();
3286 reply.recycle();
3287 return cph;
3288 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003289 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3290 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003295 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003296 data.writeStrongBinder(token);
3297 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3298 reply.readException();
3299 int res = reply.readInt();
3300 ContentProviderHolder cph = null;
3301 if (res != 0) {
3302 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3303 }
3304 data.recycle();
3305 reply.recycle();
3306 return cph;
3307 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003308 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003309 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003310 {
3311 Parcel data = Parcel.obtain();
3312 Parcel reply = Parcel.obtain();
3313 data.writeInterfaceToken(IActivityManager.descriptor);
3314 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3315 data.writeTypedList(providers);
3316 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 data.recycle();
3319 reply.recycle();
3320 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003321 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3322 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003323 Parcel data = Parcel.obtain();
3324 Parcel reply = Parcel.obtain();
3325 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003326 data.writeStrongBinder(connection);
3327 data.writeInt(stable);
3328 data.writeInt(unstable);
3329 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 boolean res = reply.readInt() != 0;
3332 data.recycle();
3333 reply.recycle();
3334 return res;
3335 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003336
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003337 public void unstableProviderDied(IBinder connection) throws RemoteException {
3338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 data.writeStrongBinder(connection);
3342 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3343 reply.readException();
3344 data.recycle();
3345 reply.recycle();
3346 }
3347
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003348 @Override
3349 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3350 Parcel data = Parcel.obtain();
3351 Parcel reply = Parcel.obtain();
3352 data.writeInterfaceToken(IActivityManager.descriptor);
3353 data.writeStrongBinder(connection);
3354 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3355 reply.readException();
3356 data.recycle();
3357 reply.recycle();
3358 }
3359
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003360 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3361 Parcel data = Parcel.obtain();
3362 Parcel reply = Parcel.obtain();
3363 data.writeInterfaceToken(IActivityManager.descriptor);
3364 data.writeStrongBinder(connection);
3365 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003366 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3367 reply.readException();
3368 data.recycle();
3369 reply.recycle();
3370 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003371
3372 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3373 Parcel data = Parcel.obtain();
3374 Parcel reply = Parcel.obtain();
3375 data.writeInterfaceToken(IActivityManager.descriptor);
3376 data.writeString(name);
3377 data.writeStrongBinder(token);
3378 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3379 reply.readException();
3380 data.recycle();
3381 reply.recycle();
3382 }
3383
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003384 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3385 throws RemoteException
3386 {
3387 Parcel data = Parcel.obtain();
3388 Parcel reply = Parcel.obtain();
3389 data.writeInterfaceToken(IActivityManager.descriptor);
3390 service.writeToParcel(data, 0);
3391 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3392 reply.readException();
3393 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3394 data.recycle();
3395 reply.recycle();
3396 return res;
3397 }
3398
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003399 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003400 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003401 {
3402 Parcel data = Parcel.obtain();
3403 Parcel reply = Parcel.obtain();
3404 data.writeInterfaceToken(IActivityManager.descriptor);
3405 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3406 service.writeToParcel(data, 0);
3407 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003408 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003409 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 ComponentName res = ComponentName.readFromParcel(reply);
3412 data.recycle();
3413 reply.recycle();
3414 return res;
3415 }
3416 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003417 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003418 {
3419 Parcel data = Parcel.obtain();
3420 Parcel reply = Parcel.obtain();
3421 data.writeInterfaceToken(IActivityManager.descriptor);
3422 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3423 service.writeToParcel(data, 0);
3424 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003425 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003426 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3427 reply.readException();
3428 int res = reply.readInt();
3429 reply.recycle();
3430 data.recycle();
3431 return res;
3432 }
3433 public boolean stopServiceToken(ComponentName className, IBinder token,
3434 int startId) throws RemoteException {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 ComponentName.writeToParcel(className, data);
3439 data.writeStrongBinder(token);
3440 data.writeInt(startId);
3441 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3442 reply.readException();
3443 boolean res = reply.readInt() != 0;
3444 data.recycle();
3445 reply.recycle();
3446 return res;
3447 }
3448 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003449 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003450 Parcel data = Parcel.obtain();
3451 Parcel reply = Parcel.obtain();
3452 data.writeInterfaceToken(IActivityManager.descriptor);
3453 ComponentName.writeToParcel(className, data);
3454 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003455 data.writeInt(id);
3456 if (notification != null) {
3457 data.writeInt(1);
3458 notification.writeToParcel(data, 0);
3459 } else {
3460 data.writeInt(0);
3461 }
3462 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003463 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3464 reply.readException();
3465 data.recycle();
3466 reply.recycle();
3467 }
3468 public int bindService(IApplicationThread caller, IBinder token,
3469 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003470 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003471 Parcel data = Parcel.obtain();
3472 Parcel reply = Parcel.obtain();
3473 data.writeInterfaceToken(IActivityManager.descriptor);
3474 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3475 data.writeStrongBinder(token);
3476 service.writeToParcel(data, 0);
3477 data.writeString(resolvedType);
3478 data.writeStrongBinder(connection.asBinder());
3479 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003480 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003481 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3482 reply.readException();
3483 int res = reply.readInt();
3484 data.recycle();
3485 reply.recycle();
3486 return res;
3487 }
3488 public boolean unbindService(IServiceConnection connection) throws RemoteException
3489 {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 data.writeStrongBinder(connection.asBinder());
3494 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 boolean res = reply.readInt() != 0;
3497 data.recycle();
3498 reply.recycle();
3499 return res;
3500 }
3501
3502 public void publishService(IBinder token,
3503 Intent intent, IBinder service) throws RemoteException {
3504 Parcel data = Parcel.obtain();
3505 Parcel reply = Parcel.obtain();
3506 data.writeInterfaceToken(IActivityManager.descriptor);
3507 data.writeStrongBinder(token);
3508 intent.writeToParcel(data, 0);
3509 data.writeStrongBinder(service);
3510 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3511 reply.readException();
3512 data.recycle();
3513 reply.recycle();
3514 }
3515
3516 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3517 throws RemoteException {
3518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeStrongBinder(token);
3522 intent.writeToParcel(data, 0);
3523 data.writeInt(doRebind ? 1 : 0);
3524 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3525 reply.readException();
3526 data.recycle();
3527 reply.recycle();
3528 }
3529
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003530 public void serviceDoneExecuting(IBinder token, int type, int startId,
3531 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003532 Parcel data = Parcel.obtain();
3533 Parcel reply = Parcel.obtain();
3534 data.writeInterfaceToken(IActivityManager.descriptor);
3535 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003536 data.writeInt(type);
3537 data.writeInt(startId);
3538 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003539 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3540 reply.readException();
3541 data.recycle();
3542 reply.recycle();
3543 }
3544
3545 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 service.writeToParcel(data, 0);
3550 data.writeString(resolvedType);
3551 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3552 reply.readException();
3553 IBinder binder = reply.readStrongBinder();
3554 reply.recycle();
3555 data.recycle();
3556 return binder;
3557 }
3558
Christopher Tate181fafa2009-05-14 11:12:14 -07003559 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3560 throws RemoteException {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 app.writeToParcel(data, 0);
3565 data.writeInt(backupRestoreMode);
3566 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3567 reply.readException();
3568 boolean success = reply.readInt() != 0;
3569 reply.recycle();
3570 data.recycle();
3571 return success;
3572 }
3573
Christopher Tate346acb12012-10-15 19:20:25 -07003574 public void clearPendingBackup() throws RemoteException {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
3578 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3579 reply.recycle();
3580 data.recycle();
3581 }
3582
Christopher Tate181fafa2009-05-14 11:12:14 -07003583 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3584 Parcel data = Parcel.obtain();
3585 Parcel reply = Parcel.obtain();
3586 data.writeInterfaceToken(IActivityManager.descriptor);
3587 data.writeString(packageName);
3588 data.writeStrongBinder(agent);
3589 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3590 reply.recycle();
3591 data.recycle();
3592 }
3593
3594 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3595 Parcel data = Parcel.obtain();
3596 Parcel reply = Parcel.obtain();
3597 data.writeInterfaceToken(IActivityManager.descriptor);
3598 app.writeToParcel(data, 0);
3599 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 reply.recycle();
3602 data.recycle();
3603 }
3604
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003605 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003606 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003607 IUiAutomationConnection connection, int userId, String instructionSet)
3608 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003609 Parcel data = Parcel.obtain();
3610 Parcel reply = Parcel.obtain();
3611 data.writeInterfaceToken(IActivityManager.descriptor);
3612 ComponentName.writeToParcel(className, data);
3613 data.writeString(profileFile);
3614 data.writeInt(flags);
3615 data.writeBundle(arguments);
3616 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003617 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003618 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003619 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003620 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3621 reply.readException();
3622 boolean res = reply.readInt() != 0;
3623 reply.recycle();
3624 data.recycle();
3625 return res;
3626 }
3627
3628 public void finishInstrumentation(IApplicationThread target,
3629 int resultCode, Bundle results) throws RemoteException {
3630 Parcel data = Parcel.obtain();
3631 Parcel reply = Parcel.obtain();
3632 data.writeInterfaceToken(IActivityManager.descriptor);
3633 data.writeStrongBinder(target != null ? target.asBinder() : null);
3634 data.writeInt(resultCode);
3635 data.writeBundle(results);
3636 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3637 reply.readException();
3638 data.recycle();
3639 reply.recycle();
3640 }
3641 public Configuration getConfiguration() throws RemoteException
3642 {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3649 reply.recycle();
3650 data.recycle();
3651 return res;
3652 }
3653 public void updateConfiguration(Configuration values) throws RemoteException
3654 {
3655 Parcel data = Parcel.obtain();
3656 Parcel reply = Parcel.obtain();
3657 data.writeInterfaceToken(IActivityManager.descriptor);
3658 values.writeToParcel(data, 0);
3659 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3660 reply.readException();
3661 data.recycle();
3662 reply.recycle();
3663 }
3664 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3665 throws RemoteException {
3666 Parcel data = Parcel.obtain();
3667 Parcel reply = Parcel.obtain();
3668 data.writeInterfaceToken(IActivityManager.descriptor);
3669 data.writeStrongBinder(token);
3670 data.writeInt(requestedOrientation);
3671 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3672 reply.readException();
3673 data.recycle();
3674 reply.recycle();
3675 }
3676 public int getRequestedOrientation(IBinder token) throws RemoteException {
3677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 data.writeStrongBinder(token);
3681 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3682 reply.readException();
3683 int res = reply.readInt();
3684 data.recycle();
3685 reply.recycle();
3686 return res;
3687 }
3688 public ComponentName getActivityClassForToken(IBinder token)
3689 throws RemoteException {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 data.writeStrongBinder(token);
3694 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 ComponentName res = ComponentName.readFromParcel(reply);
3697 data.recycle();
3698 reply.recycle();
3699 return res;
3700 }
3701 public String getPackageForToken(IBinder token) throws RemoteException
3702 {
3703 Parcel data = Parcel.obtain();
3704 Parcel reply = Parcel.obtain();
3705 data.writeInterfaceToken(IActivityManager.descriptor);
3706 data.writeStrongBinder(token);
3707 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3708 reply.readException();
3709 String res = reply.readString();
3710 data.recycle();
3711 reply.recycle();
3712 return res;
3713 }
3714 public IIntentSender getIntentSender(int type,
3715 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003716 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003717 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003718 Parcel data = Parcel.obtain();
3719 Parcel reply = Parcel.obtain();
3720 data.writeInterfaceToken(IActivityManager.descriptor);
3721 data.writeInt(type);
3722 data.writeString(packageName);
3723 data.writeStrongBinder(token);
3724 data.writeString(resultWho);
3725 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003726 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003727 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003728 data.writeTypedArray(intents, 0);
3729 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003730 } else {
3731 data.writeInt(0);
3732 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003733 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003734 if (options != null) {
3735 data.writeInt(1);
3736 options.writeToParcel(data, 0);
3737 } else {
3738 data.writeInt(0);
3739 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003740 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003741 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3742 reply.readException();
3743 IIntentSender res = IIntentSender.Stub.asInterface(
3744 reply.readStrongBinder());
3745 data.recycle();
3746 reply.recycle();
3747 return res;
3748 }
3749 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 data.writeStrongBinder(sender.asBinder());
3754 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3755 reply.readException();
3756 data.recycle();
3757 reply.recycle();
3758 }
3759 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3760 Parcel data = Parcel.obtain();
3761 Parcel reply = Parcel.obtain();
3762 data.writeInterfaceToken(IActivityManager.descriptor);
3763 data.writeStrongBinder(sender.asBinder());
3764 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3765 reply.readException();
3766 String res = reply.readString();
3767 data.recycle();
3768 reply.recycle();
3769 return res;
3770 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003771 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3772 Parcel data = Parcel.obtain();
3773 Parcel reply = Parcel.obtain();
3774 data.writeInterfaceToken(IActivityManager.descriptor);
3775 data.writeStrongBinder(sender.asBinder());
3776 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3777 reply.readException();
3778 int res = reply.readInt();
3779 data.recycle();
3780 reply.recycle();
3781 return res;
3782 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003783 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3784 boolean requireFull, String name, String callerPackage) throws RemoteException {
3785 Parcel data = Parcel.obtain();
3786 Parcel reply = Parcel.obtain();
3787 data.writeInterfaceToken(IActivityManager.descriptor);
3788 data.writeInt(callingPid);
3789 data.writeInt(callingUid);
3790 data.writeInt(userId);
3791 data.writeInt(allowAll ? 1 : 0);
3792 data.writeInt(requireFull ? 1 : 0);
3793 data.writeString(name);
3794 data.writeString(callerPackage);
3795 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3796 reply.readException();
3797 int res = reply.readInt();
3798 data.recycle();
3799 reply.recycle();
3800 return res;
3801 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003802 public void setProcessLimit(int max) throws RemoteException
3803 {
3804 Parcel data = Parcel.obtain();
3805 Parcel reply = Parcel.obtain();
3806 data.writeInterfaceToken(IActivityManager.descriptor);
3807 data.writeInt(max);
3808 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3809 reply.readException();
3810 data.recycle();
3811 reply.recycle();
3812 }
3813 public int getProcessLimit() throws RemoteException
3814 {
3815 Parcel data = Parcel.obtain();
3816 Parcel reply = Parcel.obtain();
3817 data.writeInterfaceToken(IActivityManager.descriptor);
3818 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3819 reply.readException();
3820 int res = reply.readInt();
3821 data.recycle();
3822 reply.recycle();
3823 return res;
3824 }
3825 public void setProcessForeground(IBinder token, int pid,
3826 boolean isForeground) throws RemoteException {
3827 Parcel data = Parcel.obtain();
3828 Parcel reply = Parcel.obtain();
3829 data.writeInterfaceToken(IActivityManager.descriptor);
3830 data.writeStrongBinder(token);
3831 data.writeInt(pid);
3832 data.writeInt(isForeground ? 1 : 0);
3833 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3834 reply.readException();
3835 data.recycle();
3836 reply.recycle();
3837 }
3838 public int checkPermission(String permission, int pid, int uid)
3839 throws RemoteException {
3840 Parcel data = Parcel.obtain();
3841 Parcel reply = Parcel.obtain();
3842 data.writeInterfaceToken(IActivityManager.descriptor);
3843 data.writeString(permission);
3844 data.writeInt(pid);
3845 data.writeInt(uid);
3846 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3847 reply.readException();
3848 int res = reply.readInt();
3849 data.recycle();
3850 reply.recycle();
3851 return res;
3852 }
3853 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003854 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003855 Parcel data = Parcel.obtain();
3856 Parcel reply = Parcel.obtain();
3857 data.writeInterfaceToken(IActivityManager.descriptor);
3858 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003859 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003860 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003861 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3862 reply.readException();
3863 boolean res = reply.readInt() != 0;
3864 data.recycle();
3865 reply.recycle();
3866 return res;
3867 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003868 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003869 throws RemoteException {
3870 Parcel data = Parcel.obtain();
3871 Parcel reply = Parcel.obtain();
3872 data.writeInterfaceToken(IActivityManager.descriptor);
3873 uri.writeToParcel(data, 0);
3874 data.writeInt(pid);
3875 data.writeInt(uid);
3876 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003877 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003878 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 int res = reply.readInt();
3881 data.recycle();
3882 reply.recycle();
3883 return res;
3884 }
3885 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003886 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 data.writeStrongBinder(caller.asBinder());
3891 data.writeString(targetPkg);
3892 uri.writeToParcel(data, 0);
3893 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003894 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003895 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3896 reply.readException();
3897 data.recycle();
3898 reply.recycle();
3899 }
3900 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003901 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003902 Parcel data = Parcel.obtain();
3903 Parcel reply = Parcel.obtain();
3904 data.writeInterfaceToken(IActivityManager.descriptor);
3905 data.writeStrongBinder(caller.asBinder());
3906 uri.writeToParcel(data, 0);
3907 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003908 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003909 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3910 reply.readException();
3911 data.recycle();
3912 reply.recycle();
3913 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003914
3915 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003916 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3917 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 uri.writeToParcel(data, 0);
3922 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003923 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003924 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3925 reply.readException();
3926 data.recycle();
3927 reply.recycle();
3928 }
3929
3930 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003931 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3932 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003933 Parcel data = Parcel.obtain();
3934 Parcel reply = Parcel.obtain();
3935 data.writeInterfaceToken(IActivityManager.descriptor);
3936 uri.writeToParcel(data, 0);
3937 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003938 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003939 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3940 reply.readException();
3941 data.recycle();
3942 reply.recycle();
3943 }
3944
3945 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003946 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3947 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003948 Parcel data = Parcel.obtain();
3949 Parcel reply = Parcel.obtain();
3950 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003951 data.writeString(packageName);
3952 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003953 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3956 reply);
3957 data.recycle();
3958 reply.recycle();
3959 return perms;
3960 }
3961
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003962 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3963 throws RemoteException {
3964 Parcel data = Parcel.obtain();
3965 Parcel reply = Parcel.obtain();
3966 data.writeInterfaceToken(IActivityManager.descriptor);
3967 data.writeStrongBinder(who.asBinder());
3968 data.writeInt(waiting ? 1 : 0);
3969 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3970 reply.readException();
3971 data.recycle();
3972 reply.recycle();
3973 }
3974 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3979 reply.readException();
3980 outInfo.readFromParcel(reply);
3981 data.recycle();
3982 reply.recycle();
3983 }
3984 public void unhandledBack() throws RemoteException
3985 {
3986 Parcel data = Parcel.obtain();
3987 Parcel reply = Parcel.obtain();
3988 data.writeInterfaceToken(IActivityManager.descriptor);
3989 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3990 reply.readException();
3991 data.recycle();
3992 reply.recycle();
3993 }
3994 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3995 {
3996 Parcel data = Parcel.obtain();
3997 Parcel reply = Parcel.obtain();
3998 data.writeInterfaceToken(IActivityManager.descriptor);
3999 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4000 reply.readException();
4001 ParcelFileDescriptor pfd = null;
4002 if (reply.readInt() != 0) {
4003 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4004 }
4005 data.recycle();
4006 reply.recycle();
4007 return pfd;
4008 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004009 public void setLockScreenShown(boolean shown) throws RemoteException
4010 {
4011 Parcel data = Parcel.obtain();
4012 Parcel reply = Parcel.obtain();
4013 data.writeInterfaceToken(IActivityManager.descriptor);
4014 data.writeInt(shown ? 1 : 0);
4015 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4016 reply.readException();
4017 data.recycle();
4018 reply.recycle();
4019 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004020 public void setDebugApp(
4021 String packageName, boolean waitForDebugger, boolean persistent)
4022 throws RemoteException
4023 {
4024 Parcel data = Parcel.obtain();
4025 Parcel reply = Parcel.obtain();
4026 data.writeInterfaceToken(IActivityManager.descriptor);
4027 data.writeString(packageName);
4028 data.writeInt(waitForDebugger ? 1 : 0);
4029 data.writeInt(persistent ? 1 : 0);
4030 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4031 reply.readException();
4032 data.recycle();
4033 reply.recycle();
4034 }
4035 public void setAlwaysFinish(boolean enabled) throws RemoteException
4036 {
4037 Parcel data = Parcel.obtain();
4038 Parcel reply = Parcel.obtain();
4039 data.writeInterfaceToken(IActivityManager.descriptor);
4040 data.writeInt(enabled ? 1 : 0);
4041 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4042 reply.readException();
4043 data.recycle();
4044 reply.recycle();
4045 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004046 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004047 {
4048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004052 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004053 reply.readException();
4054 data.recycle();
4055 reply.recycle();
4056 }
4057 public void enterSafeMode() throws RemoteException {
4058 Parcel data = Parcel.obtain();
4059 data.writeInterfaceToken(IActivityManager.descriptor);
4060 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4061 data.recycle();
4062 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004063 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4064 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004065 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004066 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004067 data.writeStrongBinder(sender.asBinder());
4068 data.writeInt(sourceUid);
4069 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004070 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4071 data.recycle();
4072 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004073 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004074 Parcel data = Parcel.obtain();
4075 Parcel reply = Parcel.obtain();
4076 data.writeInterfaceToken(IActivityManager.descriptor);
4077 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004078 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004079 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004080 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004081 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004082 boolean res = reply.readInt() != 0;
4083 data.recycle();
4084 reply.recycle();
4085 return res;
4086 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004087 @Override
4088 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4089 Parcel data = Parcel.obtain();
4090 Parcel reply = Parcel.obtain();
4091 data.writeInterfaceToken(IActivityManager.descriptor);
4092 data.writeString(reason);
4093 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4094 boolean res = reply.readInt() != 0;
4095 data.recycle();
4096 reply.recycle();
4097 return res;
4098 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004099 public boolean testIsSystemReady()
4100 {
4101 /* this base class version is never called */
4102 return true;
4103 }
Dan Egnor60d87622009-12-16 16:32:58 -08004104 public void handleApplicationCrash(IBinder app,
4105 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4106 {
4107 Parcel data = Parcel.obtain();
4108 Parcel reply = Parcel.obtain();
4109 data.writeInterfaceToken(IActivityManager.descriptor);
4110 data.writeStrongBinder(app);
4111 crashInfo.writeToParcel(data, 0);
4112 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4113 reply.readException();
4114 reply.recycle();
4115 data.recycle();
4116 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004117
Dianne Hackborn52322712014-08-26 22:47:26 -07004118 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004119 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004120 {
4121 Parcel data = Parcel.obtain();
4122 Parcel reply = Parcel.obtain();
4123 data.writeInterfaceToken(IActivityManager.descriptor);
4124 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004125 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004126 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004127 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004128 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004129 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004130 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004131 reply.recycle();
4132 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004133 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004134 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004135
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004136 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004137 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004138 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004139 {
4140 Parcel data = Parcel.obtain();
4141 Parcel reply = Parcel.obtain();
4142 data.writeInterfaceToken(IActivityManager.descriptor);
4143 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004144 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004145 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004146 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 reply.recycle();
4149 data.recycle();
4150 }
4151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004152 public void signalPersistentProcesses(int sig) throws RemoteException {
4153 Parcel data = Parcel.obtain();
4154 Parcel reply = Parcel.obtain();
4155 data.writeInterfaceToken(IActivityManager.descriptor);
4156 data.writeInt(sig);
4157 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4158 reply.readException();
4159 data.recycle();
4160 reply.recycle();
4161 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004162
Dianne Hackborn1676c852012-09-10 14:52:30 -07004163 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004164 Parcel data = Parcel.obtain();
4165 Parcel reply = Parcel.obtain();
4166 data.writeInterfaceToken(IActivityManager.descriptor);
4167 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004168 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004169 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4170 reply.readException();
4171 data.recycle();
4172 reply.recycle();
4173 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004174
4175 public void killAllBackgroundProcesses() throws RemoteException {
4176 Parcel data = Parcel.obtain();
4177 Parcel reply = Parcel.obtain();
4178 data.writeInterfaceToken(IActivityManager.descriptor);
4179 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4180 reply.readException();
4181 data.recycle();
4182 reply.recycle();
4183 }
4184
Dianne Hackborn1676c852012-09-10 14:52:30 -07004185 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004190 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004191 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004192 reply.readException();
4193 data.recycle();
4194 reply.recycle();
4195 }
4196
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004197 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4198 throws RemoteException
4199 {
4200 Parcel data = Parcel.obtain();
4201 Parcel reply = Parcel.obtain();
4202 data.writeInterfaceToken(IActivityManager.descriptor);
4203 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4204 reply.readException();
4205 outInfo.readFromParcel(reply);
4206 reply.recycle();
4207 data.recycle();
4208 }
4209
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004210 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4211 {
4212 Parcel data = Parcel.obtain();
4213 Parcel reply = Parcel.obtain();
4214 data.writeInterfaceToken(IActivityManager.descriptor);
4215 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4216 reply.readException();
4217 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4218 reply.recycle();
4219 data.recycle();
4220 return res;
4221 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004222
Dianne Hackborn1676c852012-09-10 14:52:30 -07004223 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004224 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004225 {
4226 Parcel data = Parcel.obtain();
4227 Parcel reply = Parcel.obtain();
4228 data.writeInterfaceToken(IActivityManager.descriptor);
4229 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004230 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004231 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004232 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004233 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004234 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004235 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004236 } else {
4237 data.writeInt(0);
4238 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004239 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 boolean res = reply.readInt() != 0;
4242 reply.recycle();
4243 data.recycle();
4244 return res;
4245 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004246
Dianne Hackborn55280a92009-05-07 15:53:46 -07004247 public boolean shutdown(int timeout) throws RemoteException
4248 {
4249 Parcel data = Parcel.obtain();
4250 Parcel reply = Parcel.obtain();
4251 data.writeInterfaceToken(IActivityManager.descriptor);
4252 data.writeInt(timeout);
4253 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4254 reply.readException();
4255 boolean res = reply.readInt() != 0;
4256 reply.recycle();
4257 data.recycle();
4258 return res;
4259 }
4260
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004261 public void stopAppSwitches() throws RemoteException {
4262 Parcel data = Parcel.obtain();
4263 Parcel reply = Parcel.obtain();
4264 data.writeInterfaceToken(IActivityManager.descriptor);
4265 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4266 reply.readException();
4267 reply.recycle();
4268 data.recycle();
4269 }
4270
4271 public void resumeAppSwitches() throws RemoteException {
4272 Parcel data = Parcel.obtain();
4273 Parcel reply = Parcel.obtain();
4274 data.writeInterfaceToken(IActivityManager.descriptor);
4275 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4276 reply.readException();
4277 reply.recycle();
4278 data.recycle();
4279 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004280
4281 public void addPackageDependency(String packageName) throws RemoteException {
4282 Parcel data = Parcel.obtain();
4283 Parcel reply = Parcel.obtain();
4284 data.writeInterfaceToken(IActivityManager.descriptor);
4285 data.writeString(packageName);
4286 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4287 reply.readException();
4288 data.recycle();
4289 reply.recycle();
4290 }
4291
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004292 public void killApplicationWithAppId(String pkg, int appid, String reason)
4293 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004294 Parcel data = Parcel.obtain();
4295 Parcel reply = Parcel.obtain();
4296 data.writeInterfaceToken(IActivityManager.descriptor);
4297 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004298 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004299 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004300 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004301 reply.readException();
4302 data.recycle();
4303 reply.recycle();
4304 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004305
4306 public void closeSystemDialogs(String reason) throws RemoteException {
4307 Parcel data = Parcel.obtain();
4308 Parcel reply = Parcel.obtain();
4309 data.writeInterfaceToken(IActivityManager.descriptor);
4310 data.writeString(reason);
4311 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4312 reply.readException();
4313 data.recycle();
4314 reply.recycle();
4315 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004316
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004317 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004318 throws RemoteException {
4319 Parcel data = Parcel.obtain();
4320 Parcel reply = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004322 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004323 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4324 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004325 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004326 data.recycle();
4327 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004328 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004329 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004330
4331 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4332 Parcel data = Parcel.obtain();
4333 Parcel reply = Parcel.obtain();
4334 data.writeInterfaceToken(IActivityManager.descriptor);
4335 data.writeString(processName);
4336 data.writeInt(uid);
4337 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4338 reply.readException();
4339 data.recycle();
4340 reply.recycle();
4341 }
4342
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004343 public void overridePendingTransition(IBinder token, String packageName,
4344 int enterAnim, int exitAnim) throws RemoteException {
4345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 data.writeStrongBinder(token);
4349 data.writeString(packageName);
4350 data.writeInt(enterAnim);
4351 data.writeInt(exitAnim);
4352 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4353 reply.readException();
4354 data.recycle();
4355 reply.recycle();
4356 }
4357
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004358 public boolean isUserAMonkey() throws RemoteException {
4359 Parcel data = Parcel.obtain();
4360 Parcel reply = Parcel.obtain();
4361 data.writeInterfaceToken(IActivityManager.descriptor);
4362 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4363 reply.readException();
4364 boolean res = reply.readInt() != 0;
4365 data.recycle();
4366 reply.recycle();
4367 return res;
4368 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004369
4370 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4371 Parcel data = Parcel.obtain();
4372 Parcel reply = Parcel.obtain();
4373 data.writeInterfaceToken(IActivityManager.descriptor);
4374 data.writeInt(monkey ? 1 : 0);
4375 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4376 reply.readException();
4377 data.recycle();
4378 reply.recycle();
4379 }
4380
Dianne Hackborn860755f2010-06-03 18:47:52 -07004381 public void finishHeavyWeightApp() throws RemoteException {
4382 Parcel data = Parcel.obtain();
4383 Parcel reply = Parcel.obtain();
4384 data.writeInterfaceToken(IActivityManager.descriptor);
4385 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4386 reply.readException();
4387 data.recycle();
4388 reply.recycle();
4389 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004390
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004391 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004392 throws RemoteException {
4393 Parcel data = Parcel.obtain();
4394 Parcel reply = Parcel.obtain();
4395 data.writeInterfaceToken(IActivityManager.descriptor);
4396 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004397 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4398 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004399 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004400 data.recycle();
4401 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004402 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004403 }
4404
Craig Mautner233ceee2014-05-09 17:05:11 -07004405 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004406 throws RemoteException {
4407 Parcel data = Parcel.obtain();
4408 Parcel reply = Parcel.obtain();
4409 data.writeInterfaceToken(IActivityManager.descriptor);
4410 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004411 if (options == null) {
4412 data.writeInt(0);
4413 } else {
4414 data.writeInt(1);
4415 data.writeBundle(options.toBundle());
4416 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004417 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004418 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004419 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004420 data.recycle();
4421 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004422 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004423 }
4424
Craig Mautner233ceee2014-05-09 17:05:11 -07004425 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 data.writeStrongBinder(token);
4430 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4431 reply.readException();
4432 Bundle bundle = reply.readBundle();
4433 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4434 data.recycle();
4435 reply.recycle();
4436 return options;
4437 }
4438
Daniel Sandler69a48172010-06-23 16:29:36 -04004439 public void setImmersive(IBinder token, boolean immersive)
4440 throws RemoteException {
4441 Parcel data = Parcel.obtain();
4442 Parcel reply = Parcel.obtain();
4443 data.writeInterfaceToken(IActivityManager.descriptor);
4444 data.writeStrongBinder(token);
4445 data.writeInt(immersive ? 1 : 0);
4446 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4447 reply.readException();
4448 data.recycle();
4449 reply.recycle();
4450 }
4451
4452 public boolean isImmersive(IBinder token)
4453 throws RemoteException {
4454 Parcel data = Parcel.obtain();
4455 Parcel reply = Parcel.obtain();
4456 data.writeInterfaceToken(IActivityManager.descriptor);
4457 data.writeStrongBinder(token);
4458 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004459 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004460 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004461 data.recycle();
4462 reply.recycle();
4463 return res;
4464 }
4465
Craig Mautnerd61dc202014-07-07 11:09:11 -07004466 public boolean isTopOfTask(IBinder token) throws RemoteException {
4467 Parcel data = Parcel.obtain();
4468 Parcel reply = Parcel.obtain();
4469 data.writeInterfaceToken(IActivityManager.descriptor);
4470 data.writeStrongBinder(token);
4471 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4472 reply.readException();
4473 boolean res = reply.readInt() == 1;
4474 data.recycle();
4475 reply.recycle();
4476 return res;
4477 }
4478
Daniel Sandler69a48172010-06-23 16:29:36 -04004479 public boolean isTopActivityImmersive()
4480 throws RemoteException {
4481 Parcel data = Parcel.obtain();
4482 Parcel reply = Parcel.obtain();
4483 data.writeInterfaceToken(IActivityManager.descriptor);
4484 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004485 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004486 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004487 data.recycle();
4488 reply.recycle();
4489 return res;
4490 }
4491
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004492 public void crashApplication(int uid, int initialPid, String packageName,
4493 String message) throws RemoteException {
4494 Parcel data = Parcel.obtain();
4495 Parcel reply = Parcel.obtain();
4496 data.writeInterfaceToken(IActivityManager.descriptor);
4497 data.writeInt(uid);
4498 data.writeInt(initialPid);
4499 data.writeString(packageName);
4500 data.writeString(message);
4501 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4502 reply.readException();
4503 data.recycle();
4504 reply.recycle();
4505 }
Andy McFadden824c5102010-07-09 16:26:57 -07004506
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004507 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004508 Parcel data = Parcel.obtain();
4509 Parcel reply = Parcel.obtain();
4510 data.writeInterfaceToken(IActivityManager.descriptor);
4511 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004512 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004513 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4514 reply.readException();
4515 String res = reply.readString();
4516 data.recycle();
4517 reply.recycle();
4518 return res;
4519 }
4520
Dianne Hackborn7e269642010-08-25 19:50:20 -07004521 public IBinder newUriPermissionOwner(String name)
4522 throws RemoteException {
4523 Parcel data = Parcel.obtain();
4524 Parcel reply = Parcel.obtain();
4525 data.writeInterfaceToken(IActivityManager.descriptor);
4526 data.writeString(name);
4527 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4528 reply.readException();
4529 IBinder res = reply.readStrongBinder();
4530 data.recycle();
4531 reply.recycle();
4532 return res;
4533 }
4534
4535 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004536 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004537 Parcel data = Parcel.obtain();
4538 Parcel reply = Parcel.obtain();
4539 data.writeInterfaceToken(IActivityManager.descriptor);
4540 data.writeStrongBinder(owner);
4541 data.writeInt(fromUid);
4542 data.writeString(targetPkg);
4543 uri.writeToParcel(data, 0);
4544 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004545 data.writeInt(sourceUserId);
4546 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004547 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4548 reply.readException();
4549 data.recycle();
4550 reply.recycle();
4551 }
4552
4553 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004554 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004555 Parcel data = Parcel.obtain();
4556 Parcel reply = Parcel.obtain();
4557 data.writeInterfaceToken(IActivityManager.descriptor);
4558 data.writeStrongBinder(owner);
4559 if (uri != null) {
4560 data.writeInt(1);
4561 uri.writeToParcel(data, 0);
4562 } else {
4563 data.writeInt(0);
4564 }
4565 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004566 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004567 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4568 reply.readException();
4569 data.recycle();
4570 reply.recycle();
4571 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004572
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004573 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004574 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004575 Parcel data = Parcel.obtain();
4576 Parcel reply = Parcel.obtain();
4577 data.writeInterfaceToken(IActivityManager.descriptor);
4578 data.writeInt(callingUid);
4579 data.writeString(targetPkg);
4580 uri.writeToParcel(data, 0);
4581 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004582 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004583 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4584 reply.readException();
4585 int res = reply.readInt();
4586 data.recycle();
4587 reply.recycle();
4588 return res;
4589 }
4590
Dianne Hackborn1676c852012-09-10 14:52:30 -07004591 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004592 String path, ParcelFileDescriptor fd) throws RemoteException {
4593 Parcel data = Parcel.obtain();
4594 Parcel reply = Parcel.obtain();
4595 data.writeInterfaceToken(IActivityManager.descriptor);
4596 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004597 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004598 data.writeInt(managed ? 1 : 0);
4599 data.writeString(path);
4600 if (fd != null) {
4601 data.writeInt(1);
4602 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4603 } else {
4604 data.writeInt(0);
4605 }
4606 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4607 reply.readException();
4608 boolean res = reply.readInt() != 0;
4609 reply.recycle();
4610 data.recycle();
4611 return res;
4612 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004613
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004614 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004615 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004616 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004617 Parcel data = Parcel.obtain();
4618 Parcel reply = Parcel.obtain();
4619 data.writeInterfaceToken(IActivityManager.descriptor);
4620 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004621 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004622 data.writeTypedArray(intents, 0);
4623 data.writeStringArray(resolvedTypes);
4624 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004625 if (options != null) {
4626 data.writeInt(1);
4627 options.writeToParcel(data, 0);
4628 } else {
4629 data.writeInt(0);
4630 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004631 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004632 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4633 reply.readException();
4634 int result = reply.readInt();
4635 reply.recycle();
4636 data.recycle();
4637 return result;
4638 }
4639
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004640 public int getFrontActivityScreenCompatMode() throws RemoteException {
4641 Parcel data = Parcel.obtain();
4642 Parcel reply = Parcel.obtain();
4643 data.writeInterfaceToken(IActivityManager.descriptor);
4644 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4645 reply.readException();
4646 int mode = reply.readInt();
4647 reply.recycle();
4648 data.recycle();
4649 return mode;
4650 }
4651
4652 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4653 Parcel data = Parcel.obtain();
4654 Parcel reply = Parcel.obtain();
4655 data.writeInterfaceToken(IActivityManager.descriptor);
4656 data.writeInt(mode);
4657 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4658 reply.readException();
4659 reply.recycle();
4660 data.recycle();
4661 }
4662
4663 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4664 Parcel data = Parcel.obtain();
4665 Parcel reply = Parcel.obtain();
4666 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004667 data.writeString(packageName);
4668 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004669 reply.readException();
4670 int mode = reply.readInt();
4671 reply.recycle();
4672 data.recycle();
4673 return mode;
4674 }
4675
4676 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004677 throws RemoteException {
4678 Parcel data = Parcel.obtain();
4679 Parcel reply = Parcel.obtain();
4680 data.writeInterfaceToken(IActivityManager.descriptor);
4681 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004682 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004683 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4684 reply.readException();
4685 reply.recycle();
4686 data.recycle();
4687 }
4688
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004689 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4690 Parcel data = Parcel.obtain();
4691 Parcel reply = Parcel.obtain();
4692 data.writeInterfaceToken(IActivityManager.descriptor);
4693 data.writeString(packageName);
4694 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4695 reply.readException();
4696 boolean ask = reply.readInt() != 0;
4697 reply.recycle();
4698 data.recycle();
4699 return ask;
4700 }
4701
4702 public void setPackageAskScreenCompat(String packageName, boolean ask)
4703 throws RemoteException {
4704 Parcel data = Parcel.obtain();
4705 Parcel reply = Parcel.obtain();
4706 data.writeInterfaceToken(IActivityManager.descriptor);
4707 data.writeString(packageName);
4708 data.writeInt(ask ? 1 : 0);
4709 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4710 reply.readException();
4711 reply.recycle();
4712 data.recycle();
4713 }
4714
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004715 public boolean switchUser(int userid) throws RemoteException {
4716 Parcel data = Parcel.obtain();
4717 Parcel reply = Parcel.obtain();
4718 data.writeInterfaceToken(IActivityManager.descriptor);
4719 data.writeInt(userid);
4720 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4721 reply.readException();
4722 boolean result = reply.readInt() != 0;
4723 reply.recycle();
4724 data.recycle();
4725 return result;
4726 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004727
Kenny Guy08488bf2014-02-21 17:40:37 +00004728 public boolean startUserInBackground(int userid) throws RemoteException {
4729 Parcel data = Parcel.obtain();
4730 Parcel reply = Parcel.obtain();
4731 data.writeInterfaceToken(IActivityManager.descriptor);
4732 data.writeInt(userid);
4733 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4734 reply.readException();
4735 boolean result = reply.readInt() != 0;
4736 reply.recycle();
4737 data.recycle();
4738 return result;
4739 }
4740
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004741 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4742 Parcel data = Parcel.obtain();
4743 Parcel reply = Parcel.obtain();
4744 data.writeInterfaceToken(IActivityManager.descriptor);
4745 data.writeInt(userid);
4746 data.writeStrongInterface(callback);
4747 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4748 reply.readException();
4749 int result = reply.readInt();
4750 reply.recycle();
4751 data.recycle();
4752 return result;
4753 }
4754
Amith Yamasani52f1d752012-03-28 18:19:29 -07004755 public UserInfo getCurrentUser() throws RemoteException {
4756 Parcel data = Parcel.obtain();
4757 Parcel reply = Parcel.obtain();
4758 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004759 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004760 reply.readException();
4761 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4762 reply.recycle();
4763 data.recycle();
4764 return userInfo;
4765 }
4766
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004767 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004768 Parcel data = Parcel.obtain();
4769 Parcel reply = Parcel.obtain();
4770 data.writeInterfaceToken(IActivityManager.descriptor);
4771 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004772 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004773 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4774 reply.readException();
4775 boolean result = reply.readInt() != 0;
4776 reply.recycle();
4777 data.recycle();
4778 return result;
4779 }
4780
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004781 public int[] getRunningUserIds() throws RemoteException {
4782 Parcel data = Parcel.obtain();
4783 Parcel reply = Parcel.obtain();
4784 data.writeInterfaceToken(IActivityManager.descriptor);
4785 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4786 reply.readException();
4787 int[] result = reply.createIntArray();
4788 reply.recycle();
4789 data.recycle();
4790 return result;
4791 }
4792
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004793 public boolean removeTask(int taskId, int flags) throws RemoteException {
4794 Parcel data = Parcel.obtain();
4795 Parcel reply = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 data.writeInt(taskId);
4798 data.writeInt(flags);
4799 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4800 reply.readException();
4801 boolean result = reply.readInt() != 0;
4802 reply.recycle();
4803 data.recycle();
4804 return result;
4805 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004806
Jeff Sharkeya4620792011-05-20 15:29:23 -07004807 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4808 Parcel data = Parcel.obtain();
4809 Parcel reply = Parcel.obtain();
4810 data.writeInterfaceToken(IActivityManager.descriptor);
4811 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4812 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4813 reply.readException();
4814 data.recycle();
4815 reply.recycle();
4816 }
4817
4818 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4819 Parcel data = Parcel.obtain();
4820 Parcel reply = Parcel.obtain();
4821 data.writeInterfaceToken(IActivityManager.descriptor);
4822 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4823 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4824 reply.readException();
4825 data.recycle();
4826 reply.recycle();
4827 }
4828
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004829 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4830 Parcel data = Parcel.obtain();
4831 Parcel reply = Parcel.obtain();
4832 data.writeInterfaceToken(IActivityManager.descriptor);
4833 data.writeStrongBinder(sender.asBinder());
4834 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4835 reply.readException();
4836 boolean res = reply.readInt() != 0;
4837 data.recycle();
4838 reply.recycle();
4839 return res;
4840 }
4841
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004842 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4843 Parcel data = Parcel.obtain();
4844 Parcel reply = Parcel.obtain();
4845 data.writeInterfaceToken(IActivityManager.descriptor);
4846 data.writeStrongBinder(sender.asBinder());
4847 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4848 reply.readException();
4849 boolean res = reply.readInt() != 0;
4850 data.recycle();
4851 reply.recycle();
4852 return res;
4853 }
4854
Dianne Hackborn81038902012-11-26 17:04:09 -08004855 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4856 Parcel data = Parcel.obtain();
4857 Parcel reply = Parcel.obtain();
4858 data.writeInterfaceToken(IActivityManager.descriptor);
4859 data.writeStrongBinder(sender.asBinder());
4860 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4861 reply.readException();
4862 Intent res = reply.readInt() != 0
4863 ? Intent.CREATOR.createFromParcel(reply) : null;
4864 data.recycle();
4865 reply.recycle();
4866 return res;
4867 }
4868
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004869 public String getTagForIntentSender(IIntentSender sender, String prefix)
4870 throws RemoteException {
4871 Parcel data = Parcel.obtain();
4872 Parcel reply = Parcel.obtain();
4873 data.writeInterfaceToken(IActivityManager.descriptor);
4874 data.writeStrongBinder(sender.asBinder());
4875 data.writeString(prefix);
4876 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4877 reply.readException();
4878 String res = reply.readString();
4879 data.recycle();
4880 reply.recycle();
4881 return res;
4882 }
4883
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004884 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4885 {
4886 Parcel data = Parcel.obtain();
4887 Parcel reply = Parcel.obtain();
4888 data.writeInterfaceToken(IActivityManager.descriptor);
4889 values.writeToParcel(data, 0);
4890 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4891 reply.readException();
4892 data.recycle();
4893 reply.recycle();
4894 }
4895
Dianne Hackbornb437e092011-08-05 17:50:29 -07004896 public long[] getProcessPss(int[] pids) throws RemoteException {
4897 Parcel data = Parcel.obtain();
4898 Parcel reply = Parcel.obtain();
4899 data.writeInterfaceToken(IActivityManager.descriptor);
4900 data.writeIntArray(pids);
4901 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4902 reply.readException();
4903 long[] res = reply.createLongArray();
4904 data.recycle();
4905 reply.recycle();
4906 return res;
4907 }
4908
Dianne Hackborn661cd522011-08-22 00:26:20 -07004909 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4910 Parcel data = Parcel.obtain();
4911 Parcel reply = Parcel.obtain();
4912 data.writeInterfaceToken(IActivityManager.descriptor);
4913 TextUtils.writeToParcel(msg, data, 0);
4914 data.writeInt(always ? 1 : 0);
4915 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4916 reply.readException();
4917 data.recycle();
4918 reply.recycle();
4919 }
4920
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004921 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004922 Parcel data = Parcel.obtain();
4923 Parcel reply = Parcel.obtain();
4924 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004925 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004926 reply.readException();
4927 data.recycle();
4928 reply.recycle();
4929 }
4930
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004931 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004932 throws RemoteException {
4933 Parcel data = Parcel.obtain();
4934 Parcel reply = Parcel.obtain();
4935 data.writeInterfaceToken(IActivityManager.descriptor);
4936 data.writeStrongBinder(token);
4937 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004938 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07004939 reply.readException();
4940 boolean result = reply.readInt() != 0;
4941 data.recycle();
4942 reply.recycle();
4943 return result;
4944 }
4945
4946 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4947 throws RemoteException {
4948 Parcel data = Parcel.obtain();
4949 Parcel reply = Parcel.obtain();
4950 data.writeInterfaceToken(IActivityManager.descriptor);
4951 data.writeStrongBinder(token);
4952 target.writeToParcel(data, 0);
4953 data.writeInt(resultCode);
4954 if (resultData != null) {
4955 data.writeInt(1);
4956 resultData.writeToParcel(data, 0);
4957 } else {
4958 data.writeInt(0);
4959 }
4960 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4961 reply.readException();
4962 boolean result = reply.readInt() != 0;
4963 data.recycle();
4964 reply.recycle();
4965 return result;
4966 }
4967
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004968 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4969 Parcel data = Parcel.obtain();
4970 Parcel reply = Parcel.obtain();
4971 data.writeInterfaceToken(IActivityManager.descriptor);
4972 data.writeStrongBinder(activityToken);
4973 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4974 reply.readException();
4975 int result = reply.readInt();
4976 data.recycle();
4977 reply.recycle();
4978 return result;
4979 }
4980
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004981 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4982 Parcel data = Parcel.obtain();
4983 Parcel reply = Parcel.obtain();
4984 data.writeInterfaceToken(IActivityManager.descriptor);
4985 data.writeStrongBinder(activityToken);
4986 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4987 reply.readException();
4988 String result = reply.readString();
4989 data.recycle();
4990 reply.recycle();
4991 return result;
4992 }
4993
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004994 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4995 Parcel data = Parcel.obtain();
4996 Parcel reply = Parcel.obtain();
4997 data.writeInterfaceToken(IActivityManager.descriptor);
4998 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4999 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5000 reply.readException();
5001 data.recycle();
5002 reply.recycle();
5003 }
5004
5005 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5006 Parcel data = Parcel.obtain();
5007 Parcel reply = Parcel.obtain();
5008 data.writeInterfaceToken(IActivityManager.descriptor);
5009 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5010 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5011 reply.readException();
5012 data.recycle();
5013 reply.recycle();
5014 }
5015
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005016 public void requestBugReport() throws RemoteException {
5017 Parcel data = Parcel.obtain();
5018 Parcel reply = Parcel.obtain();
5019 data.writeInterfaceToken(IActivityManager.descriptor);
5020 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5021 reply.readException();
5022 data.recycle();
5023 reply.recycle();
5024 }
5025
Jeff Brownbd181bb2013-09-10 16:44:24 -07005026 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5027 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005028 Parcel data = Parcel.obtain();
5029 Parcel reply = Parcel.obtain();
5030 data.writeInterfaceToken(IActivityManager.descriptor);
5031 data.writeInt(pid);
5032 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005033 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005034 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5035 reply.readException();
5036 long res = reply.readInt();
5037 data.recycle();
5038 reply.recycle();
5039 return res;
5040 }
5041
Adam Skorydfc7fd72013-08-05 19:23:41 -07005042 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005043 Parcel data = Parcel.obtain();
5044 Parcel reply = Parcel.obtain();
5045 data.writeInterfaceToken(IActivityManager.descriptor);
5046 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005047 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005048 reply.readException();
5049 Bundle res = reply.readBundle();
5050 data.recycle();
5051 reply.recycle();
5052 return res;
5053 }
5054
Adam Skory7140a252013-09-11 12:04:58 +01005055 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005056 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005057 Parcel data = Parcel.obtain();
5058 Parcel reply = Parcel.obtain();
5059 data.writeInterfaceToken(IActivityManager.descriptor);
5060 data.writeStrongBinder(token);
5061 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005062 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005063 reply.readException();
5064 data.recycle();
5065 reply.recycle();
5066 }
5067
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005068 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5069 throws RemoteException {
5070 Parcel data = Parcel.obtain();
5071 Parcel reply = Parcel.obtain();
5072 data.writeInterfaceToken(IActivityManager.descriptor);
5073 intent.writeToParcel(data, 0);
5074 data.writeInt(requestType);
5075 data.writeString(hint);
5076 data.writeInt(userHandle);
5077 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5078 reply.readException();
5079 boolean res = reply.readInt() != 0;
5080 data.recycle();
5081 reply.recycle();
5082 return res;
5083 }
5084
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005085 public void killUid(int uid, String reason) throws RemoteException {
5086 Parcel data = Parcel.obtain();
5087 Parcel reply = Parcel.obtain();
5088 data.writeInterfaceToken(IActivityManager.descriptor);
5089 data.writeInt(uid);
5090 data.writeString(reason);
5091 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5092 reply.readException();
5093 data.recycle();
5094 reply.recycle();
5095 }
5096
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005097 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5098 Parcel data = Parcel.obtain();
5099 Parcel reply = Parcel.obtain();
5100 data.writeInterfaceToken(IActivityManager.descriptor);
5101 data.writeStrongBinder(who);
5102 data.writeInt(allowRestart ? 1 : 0);
5103 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5104 reply.readException();
5105 data.recycle();
5106 reply.recycle();
5107 }
5108
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005109 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5110 Parcel data = Parcel.obtain();
5111 Parcel reply = Parcel.obtain();
5112 data.writeInterfaceToken(IActivityManager.descriptor);
5113 data.writeStrongBinder(token);
5114 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5115 reply.readException();
5116 data.recycle();
5117 reply.recycle();
5118 }
5119
Craig Mautner5eda9b32013-07-02 11:58:16 -07005120 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5121 Parcel data = Parcel.obtain();
5122 Parcel reply = Parcel.obtain();
5123 data.writeInterfaceToken(IActivityManager.descriptor);
5124 data.writeStrongBinder(token);
5125 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5126 reply.readException();
5127 data.recycle();
5128 reply.recycle();
5129 }
5130
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005131 public void restart() throws RemoteException {
5132 Parcel data = Parcel.obtain();
5133 Parcel reply = Parcel.obtain();
5134 data.writeInterfaceToken(IActivityManager.descriptor);
5135 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5136 reply.readException();
5137 data.recycle();
5138 reply.recycle();
5139 }
5140
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005141 public void performIdleMaintenance() throws RemoteException {
5142 Parcel data = Parcel.obtain();
5143 Parcel reply = Parcel.obtain();
5144 data.writeInterfaceToken(IActivityManager.descriptor);
5145 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5146 reply.readException();
5147 data.recycle();
5148 reply.recycle();
5149 }
5150
Craig Mautner4a1cb222013-12-04 16:14:06 -08005151 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5152 IActivityContainerCallback callback) throws RemoteException {
5153 Parcel data = Parcel.obtain();
5154 Parcel reply = Parcel.obtain();
5155 data.writeInterfaceToken(IActivityManager.descriptor);
5156 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005157 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005158 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5159 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005160 final int result = reply.readInt();
5161 final IActivityContainer res;
5162 if (result == 1) {
5163 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5164 } else {
5165 res = null;
5166 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005167 data.recycle();
5168 reply.recycle();
5169 return res;
5170 }
5171
Craig Mautner95da1082014-02-24 17:54:35 -08005172 public void deleteActivityContainer(IActivityContainer activityContainer)
5173 throws RemoteException {
5174 Parcel data = Parcel.obtain();
5175 Parcel reply = Parcel.obtain();
5176 data.writeInterfaceToken(IActivityManager.descriptor);
5177 data.writeStrongBinder(activityContainer.asBinder());
5178 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5179 reply.readException();
5180 data.recycle();
5181 reply.recycle();
5182 }
5183
Craig Mautnere0a38842013-12-16 16:14:02 -08005184 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5185 throws RemoteException {
5186 Parcel data = Parcel.obtain();
5187 Parcel reply = Parcel.obtain();
5188 data.writeInterfaceToken(IActivityManager.descriptor);
5189 data.writeStrongBinder(activityToken);
5190 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5191 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005192 final int result = reply.readInt();
5193 final IActivityContainer res;
5194 if (result == 1) {
5195 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5196 } else {
5197 res = null;
5198 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005199 data.recycle();
5200 reply.recycle();
5201 return res;
5202 }
5203
Craig Mautner4a1cb222013-12-04 16:14:06 -08005204 public IBinder getHomeActivityToken() throws RemoteException {
5205 Parcel data = Parcel.obtain();
5206 Parcel reply = Parcel.obtain();
5207 data.writeInterfaceToken(IActivityManager.descriptor);
5208 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5209 reply.readException();
5210 IBinder res = reply.readStrongBinder();
5211 data.recycle();
5212 reply.recycle();
5213 return res;
5214 }
5215
Craig Mautneraea74a52014-03-08 14:23:10 -08005216 @Override
5217 public void startLockTaskMode(int taskId) throws RemoteException {
5218 Parcel data = Parcel.obtain();
5219 Parcel reply = Parcel.obtain();
5220 data.writeInterfaceToken(IActivityManager.descriptor);
5221 data.writeInt(taskId);
5222 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5223 reply.readException();
5224 data.recycle();
5225 reply.recycle();
5226 }
5227
5228 @Override
5229 public void startLockTaskMode(IBinder token) throws RemoteException {
5230 Parcel data = Parcel.obtain();
5231 Parcel reply = Parcel.obtain();
5232 data.writeInterfaceToken(IActivityManager.descriptor);
5233 data.writeStrongBinder(token);
5234 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5235 reply.readException();
5236 data.recycle();
5237 reply.recycle();
5238 }
5239
5240 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005241 public void startLockTaskModeOnCurrent() throws RemoteException {
5242 Parcel data = Parcel.obtain();
5243 Parcel reply = Parcel.obtain();
5244 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005245 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005246 reply.readException();
5247 data.recycle();
5248 reply.recycle();
5249 }
5250
5251 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005252 public void stopLockTaskMode() throws RemoteException {
5253 Parcel data = Parcel.obtain();
5254 Parcel reply = Parcel.obtain();
5255 data.writeInterfaceToken(IActivityManager.descriptor);
5256 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5257 reply.readException();
5258 data.recycle();
5259 reply.recycle();
5260 }
5261
5262 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005263 public void stopLockTaskModeOnCurrent() throws RemoteException {
5264 Parcel data = Parcel.obtain();
5265 Parcel reply = Parcel.obtain();
5266 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005267 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005268 reply.readException();
5269 data.recycle();
5270 reply.recycle();
5271 }
5272
5273 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005274 public boolean isInLockTaskMode() throws RemoteException {
5275 Parcel data = Parcel.obtain();
5276 Parcel reply = Parcel.obtain();
5277 data.writeInterfaceToken(IActivityManager.descriptor);
5278 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5279 reply.readException();
5280 boolean isInLockTaskMode = reply.readInt() == 1;
5281 data.recycle();
5282 reply.recycle();
5283 return isInLockTaskMode;
5284 }
5285
Craig Mautner688b5102014-03-27 16:55:03 -07005286 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005287 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005288 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005289 Parcel data = Parcel.obtain();
5290 Parcel reply = Parcel.obtain();
5291 data.writeInterfaceToken(IActivityManager.descriptor);
5292 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005293 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005294 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005295 reply.readException();
5296 data.recycle();
5297 reply.recycle();
5298 }
5299
Craig Mautneree2e45a2014-06-27 12:10:03 -07005300 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005301 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 data.writeString(filename);
5306 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5307 reply.readException();
5308 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5309 data.recycle();
5310 reply.recycle();
5311 return icon;
5312 }
5313
5314 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005315 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005316 Parcel data = Parcel.obtain();
5317 Parcel reply = Parcel.obtain();
5318 data.writeInterfaceToken(IActivityManager.descriptor);
5319 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005320 data.writeInt(visible ? 1 : 0);
5321 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005322 reply.readException();
5323 boolean success = reply.readInt() > 0;
5324 data.recycle();
5325 reply.recycle();
5326 return success;
5327 }
5328
5329 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005330 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005331 Parcel data = Parcel.obtain();
5332 Parcel reply = Parcel.obtain();
5333 data.writeInterfaceToken(IActivityManager.descriptor);
5334 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005335 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005336 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005337 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005338 data.recycle();
5339 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005340 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005341 }
5342
5343 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005344 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005345 Parcel data = Parcel.obtain();
5346 Parcel reply = Parcel.obtain();
5347 data.writeInterfaceToken(IActivityManager.descriptor);
5348 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005349 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5350 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005351 reply.readException();
5352 data.recycle();
5353 reply.recycle();
5354 }
5355
5356 @Override
5357 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5358 Parcel data = Parcel.obtain();
5359 Parcel reply = Parcel.obtain();
5360 data.writeInterfaceToken(IActivityManager.descriptor);
5361 data.writeStrongBinder(token);
5362 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5363 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005364 reply.readException();
5365 data.recycle();
5366 reply.recycle();
5367 }
5368
Craig Mautner8746a472014-07-24 15:12:54 -07005369 @Override
5370 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5371 Parcel data = Parcel.obtain();
5372 Parcel reply = Parcel.obtain();
5373 data.writeInterfaceToken(IActivityManager.descriptor);
5374 data.writeStrongBinder(token);
5375 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5376 IBinder.FLAG_ONEWAY);
5377 reply.readException();
5378 data.recycle();
5379 reply.recycle();
5380 }
5381
Craig Mautner6e2f3952014-09-09 14:26:41 -07005382 @Override
5383 public void bootAnimationComplete() throws RemoteException {
5384 Parcel data = Parcel.obtain();
5385 Parcel reply = Parcel.obtain();
5386 data.writeInterfaceToken(IActivityManager.descriptor);
5387 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5388 reply.readException();
5389 data.recycle();
5390 reply.recycle();
5391 }
5392
Jeff Sharkey605eb792014-11-04 13:34:06 -08005393 @Override
5394 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5395 Parcel data = Parcel.obtain();
5396 Parcel reply = Parcel.obtain();
5397 data.writeInterfaceToken(IActivityManager.descriptor);
5398 data.writeInt(uid);
5399 data.writeByteArray(firstPacket);
5400 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5401 reply.readException();
5402 data.recycle();
5403 reply.recycle();
5404 }
5405
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005406 private IBinder mRemote;
5407}