blob: 20355ec9ca0d445b34ce2cb94e2c67496ed5b8b4 [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 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002333 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002334
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002335 return super.onTransact(code, data, reply, flags);
2336 }
2337
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002338 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002339 return this;
2340 }
2341
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002342 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2343 protected IActivityManager create() {
2344 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002345 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002346 Log.v("ActivityManager", "default service binder = " + b);
2347 }
2348 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002349 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002350 Log.v("ActivityManager", "default service = " + am);
2351 }
2352 return am;
2353 }
2354 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002355}
2356
2357class ActivityManagerProxy implements IActivityManager
2358{
2359 public ActivityManagerProxy(IBinder remote)
2360 {
2361 mRemote = remote;
2362 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002363
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002364 public IBinder asBinder()
2365 {
2366 return mRemote;
2367 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002368
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002369 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002370 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002371 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002372 Parcel data = Parcel.obtain();
2373 Parcel reply = Parcel.obtain();
2374 data.writeInterfaceToken(IActivityManager.descriptor);
2375 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002376 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377 intent.writeToParcel(data, 0);
2378 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002379 data.writeStrongBinder(resultTo);
2380 data.writeString(resultWho);
2381 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002382 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002383 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002384 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002385 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002386 } else {
2387 data.writeInt(0);
2388 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002389 if (options != null) {
2390 data.writeInt(1);
2391 options.writeToParcel(data, 0);
2392 } else {
2393 data.writeInt(0);
2394 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002395 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2396 reply.readException();
2397 int result = reply.readInt();
2398 reply.recycle();
2399 data.recycle();
2400 return result;
2401 }
Amith Yamasani82644082012-08-03 13:09:11 -07002402
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002403 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002404 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002405 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2406 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002407 Parcel data = Parcel.obtain();
2408 Parcel reply = Parcel.obtain();
2409 data.writeInterfaceToken(IActivityManager.descriptor);
2410 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002411 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002412 intent.writeToParcel(data, 0);
2413 data.writeString(resolvedType);
2414 data.writeStrongBinder(resultTo);
2415 data.writeString(resultWho);
2416 data.writeInt(requestCode);
2417 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002418 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002419 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002420 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002421 } else {
2422 data.writeInt(0);
2423 }
2424 if (options != null) {
2425 data.writeInt(1);
2426 options.writeToParcel(data, 0);
2427 } else {
2428 data.writeInt(0);
2429 }
2430 data.writeInt(userId);
2431 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2432 reply.readException();
2433 int result = reply.readInt();
2434 reply.recycle();
2435 data.recycle();
2436 return result;
2437 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002438 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2439 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002440 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002441 Parcel data = Parcel.obtain();
2442 Parcel reply = Parcel.obtain();
2443 data.writeInterfaceToken(IActivityManager.descriptor);
2444 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2445 data.writeString(callingPackage);
2446 intent.writeToParcel(data, 0);
2447 data.writeString(resolvedType);
2448 data.writeStrongBinder(resultTo);
2449 data.writeString(resultWho);
2450 data.writeInt(requestCode);
2451 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002452 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002453 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002454 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002455 } else {
2456 data.writeInt(0);
2457 }
2458 if (options != null) {
2459 data.writeInt(1);
2460 options.writeToParcel(data, 0);
2461 } else {
2462 data.writeInt(0);
2463 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002464 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002465 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2466 reply.readException();
2467 int result = reply.readInt();
2468 reply.recycle();
2469 data.recycle();
2470 return result;
2471 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002472 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2473 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002474 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2475 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002476 Parcel data = Parcel.obtain();
2477 Parcel reply = Parcel.obtain();
2478 data.writeInterfaceToken(IActivityManager.descriptor);
2479 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002480 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002481 intent.writeToParcel(data, 0);
2482 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002483 data.writeStrongBinder(resultTo);
2484 data.writeString(resultWho);
2485 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002486 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002487 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002488 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002489 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002490 } else {
2491 data.writeInt(0);
2492 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002493 if (options != null) {
2494 data.writeInt(1);
2495 options.writeToParcel(data, 0);
2496 } else {
2497 data.writeInt(0);
2498 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002499 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002500 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2501 reply.readException();
2502 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2503 reply.recycle();
2504 data.recycle();
2505 return result;
2506 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002507 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2508 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002509 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002510 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002511 Parcel data = Parcel.obtain();
2512 Parcel reply = Parcel.obtain();
2513 data.writeInterfaceToken(IActivityManager.descriptor);
2514 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002515 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002516 intent.writeToParcel(data, 0);
2517 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002518 data.writeStrongBinder(resultTo);
2519 data.writeString(resultWho);
2520 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002521 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002522 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002523 if (options != null) {
2524 data.writeInt(1);
2525 options.writeToParcel(data, 0);
2526 } else {
2527 data.writeInt(0);
2528 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002529 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002530 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2531 reply.readException();
2532 int result = reply.readInt();
2533 reply.recycle();
2534 data.recycle();
2535 return result;
2536 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002537 public int startActivityIntentSender(IApplicationThread caller,
2538 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002539 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002540 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002541 Parcel data = Parcel.obtain();
2542 Parcel reply = Parcel.obtain();
2543 data.writeInterfaceToken(IActivityManager.descriptor);
2544 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2545 intent.writeToParcel(data, 0);
2546 if (fillInIntent != null) {
2547 data.writeInt(1);
2548 fillInIntent.writeToParcel(data, 0);
2549 } else {
2550 data.writeInt(0);
2551 }
2552 data.writeString(resolvedType);
2553 data.writeStrongBinder(resultTo);
2554 data.writeString(resultWho);
2555 data.writeInt(requestCode);
2556 data.writeInt(flagsMask);
2557 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002558 if (options != null) {
2559 data.writeInt(1);
2560 options.writeToParcel(data, 0);
2561 } else {
2562 data.writeInt(0);
2563 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002564 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002565 reply.readException();
2566 int result = reply.readInt();
2567 reply.recycle();
2568 data.recycle();
2569 return result;
2570 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002571 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2572 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002573 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2574 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002575 Parcel data = Parcel.obtain();
2576 Parcel reply = Parcel.obtain();
2577 data.writeInterfaceToken(IActivityManager.descriptor);
2578 data.writeString(callingPackage);
2579 data.writeInt(callingPid);
2580 data.writeInt(callingUid);
2581 intent.writeToParcel(data, 0);
2582 data.writeString(resolvedType);
2583 data.writeStrongBinder(session.asBinder());
2584 data.writeStrongBinder(interactor.asBinder());
2585 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002586 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002587 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002588 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002589 } else {
2590 data.writeInt(0);
2591 }
2592 if (options != null) {
2593 data.writeInt(1);
2594 options.writeToParcel(data, 0);
2595 } else {
2596 data.writeInt(0);
2597 }
2598 data.writeInt(userId);
2599 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2600 reply.readException();
2601 int result = reply.readInt();
2602 reply.recycle();
2603 data.recycle();
2604 return result;
2605 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002606 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002607 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002608 Parcel data = Parcel.obtain();
2609 Parcel reply = Parcel.obtain();
2610 data.writeInterfaceToken(IActivityManager.descriptor);
2611 data.writeStrongBinder(callingActivity);
2612 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002613 if (options != null) {
2614 data.writeInt(1);
2615 options.writeToParcel(data, 0);
2616 } else {
2617 data.writeInt(0);
2618 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002619 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2620 reply.readException();
2621 int result = reply.readInt();
2622 reply.recycle();
2623 data.recycle();
2624 return result != 0;
2625 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002626 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2627 Parcel data = Parcel.obtain();
2628 Parcel reply = Parcel.obtain();
2629 data.writeInterfaceToken(IActivityManager.descriptor);
2630 data.writeInt(taskId);
2631 if (options == null) {
2632 data.writeInt(0);
2633 } else {
2634 data.writeInt(1);
2635 options.writeToParcel(data, 0);
2636 }
2637 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2638 reply.readException();
2639 int result = reply.readInt();
2640 reply.recycle();
2641 data.recycle();
2642 return result;
2643 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002644 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002645 throws RemoteException {
2646 Parcel data = Parcel.obtain();
2647 Parcel reply = Parcel.obtain();
2648 data.writeInterfaceToken(IActivityManager.descriptor);
2649 data.writeStrongBinder(token);
2650 data.writeInt(resultCode);
2651 if (resultData != null) {
2652 data.writeInt(1);
2653 resultData.writeToParcel(data, 0);
2654 } else {
2655 data.writeInt(0);
2656 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002657 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002658 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2659 reply.readException();
2660 boolean res = reply.readInt() != 0;
2661 data.recycle();
2662 reply.recycle();
2663 return res;
2664 }
2665 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2666 {
2667 Parcel data = Parcel.obtain();
2668 Parcel reply = Parcel.obtain();
2669 data.writeInterfaceToken(IActivityManager.descriptor);
2670 data.writeStrongBinder(token);
2671 data.writeString(resultWho);
2672 data.writeInt(requestCode);
2673 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2674 reply.readException();
2675 data.recycle();
2676 reply.recycle();
2677 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002678 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2679 Parcel data = Parcel.obtain();
2680 Parcel reply = Parcel.obtain();
2681 data.writeInterfaceToken(IActivityManager.descriptor);
2682 data.writeStrongBinder(token);
2683 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2684 reply.readException();
2685 boolean res = reply.readInt() != 0;
2686 data.recycle();
2687 reply.recycle();
2688 return res;
2689 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002690 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2691 Parcel data = Parcel.obtain();
2692 Parcel reply = Parcel.obtain();
2693 data.writeInterfaceToken(IActivityManager.descriptor);
2694 data.writeStrongBinder(session.asBinder());
2695 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2696 reply.readException();
2697 data.recycle();
2698 reply.recycle();
2699 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002700 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2701 Parcel data = Parcel.obtain();
2702 Parcel reply = Parcel.obtain();
2703 data.writeInterfaceToken(IActivityManager.descriptor);
2704 data.writeStrongBinder(token);
2705 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2706 reply.readException();
2707 boolean res = reply.readInt() != 0;
2708 data.recycle();
2709 reply.recycle();
2710 return res;
2711 }
2712 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2713 Parcel data = Parcel.obtain();
2714 Parcel reply = Parcel.obtain();
2715 data.writeInterfaceToken(IActivityManager.descriptor);
2716 data.writeStrongBinder(app.asBinder());
2717 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 data.recycle();
2720 reply.recycle();
2721 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002722 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2723 Parcel data = Parcel.obtain();
2724 Parcel reply = Parcel.obtain();
2725 data.writeInterfaceToken(IActivityManager.descriptor);
2726 data.writeStrongBinder(token);
2727 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2728 reply.readException();
2729 boolean res = reply.readInt() != 0;
2730 data.recycle();
2731 reply.recycle();
2732 return res;
2733 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002734 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002735 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002736 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002737 {
2738 Parcel data = Parcel.obtain();
2739 Parcel reply = Parcel.obtain();
2740 data.writeInterfaceToken(IActivityManager.descriptor);
2741 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002742 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002743 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2744 filter.writeToParcel(data, 0);
2745 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002746 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002747 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2748 reply.readException();
2749 Intent intent = null;
2750 int haveIntent = reply.readInt();
2751 if (haveIntent != 0) {
2752 intent = Intent.CREATOR.createFromParcel(reply);
2753 }
2754 reply.recycle();
2755 data.recycle();
2756 return intent;
2757 }
2758 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2759 {
2760 Parcel data = Parcel.obtain();
2761 Parcel reply = Parcel.obtain();
2762 data.writeInterfaceToken(IActivityManager.descriptor);
2763 data.writeStrongBinder(receiver.asBinder());
2764 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2765 reply.readException();
2766 data.recycle();
2767 reply.recycle();
2768 }
2769 public int broadcastIntent(IApplicationThread caller,
2770 Intent intent, String resolvedType, IIntentReceiver resultTo,
2771 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002772 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002773 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002774 {
2775 Parcel data = Parcel.obtain();
2776 Parcel reply = Parcel.obtain();
2777 data.writeInterfaceToken(IActivityManager.descriptor);
2778 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2779 intent.writeToParcel(data, 0);
2780 data.writeString(resolvedType);
2781 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2782 data.writeInt(resultCode);
2783 data.writeString(resultData);
2784 data.writeBundle(map);
2785 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002786 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002787 data.writeInt(serialized ? 1 : 0);
2788 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002789 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002790 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2791 reply.readException();
2792 int res = reply.readInt();
2793 reply.recycle();
2794 data.recycle();
2795 return res;
2796 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002797 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2798 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002799 {
2800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2804 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002805 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002806 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2807 reply.readException();
2808 data.recycle();
2809 reply.recycle();
2810 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002811 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
2812 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813 {
2814 Parcel data = Parcel.obtain();
2815 Parcel reply = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 data.writeStrongBinder(who);
2818 data.writeInt(resultCode);
2819 data.writeString(resultData);
2820 data.writeBundle(map);
2821 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002822 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002823 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2824 reply.readException();
2825 data.recycle();
2826 reply.recycle();
2827 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002828 public void attachApplication(IApplicationThread app) throws RemoteException
2829 {
2830 Parcel data = Parcel.obtain();
2831 Parcel reply = Parcel.obtain();
2832 data.writeInterfaceToken(IActivityManager.descriptor);
2833 data.writeStrongBinder(app.asBinder());
2834 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2835 reply.readException();
2836 data.recycle();
2837 reply.recycle();
2838 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002839 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2840 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002841 {
2842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002846 if (config != null) {
2847 data.writeInt(1);
2848 config.writeToParcel(data, 0);
2849 } else {
2850 data.writeInt(0);
2851 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002852 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002853 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2854 reply.readException();
2855 data.recycle();
2856 reply.recycle();
2857 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002858 public void activityResumed(IBinder token) throws RemoteException
2859 {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeStrongBinder(token);
2864 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2865 reply.readException();
2866 data.recycle();
2867 reply.recycle();
2868 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002869 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002870 {
2871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeStrongBinder(token);
2875 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2876 reply.readException();
2877 data.recycle();
2878 reply.recycle();
2879 }
2880 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002881 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002882 {
2883 Parcel data = Parcel.obtain();
2884 Parcel reply = Parcel.obtain();
2885 data.writeInterfaceToken(IActivityManager.descriptor);
2886 data.writeStrongBinder(token);
2887 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002888 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002889 TextUtils.writeToParcel(description, data, 0);
2890 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2891 reply.readException();
2892 data.recycle();
2893 reply.recycle();
2894 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002895 public void activitySlept(IBinder token) throws RemoteException
2896 {
2897 Parcel data = Parcel.obtain();
2898 Parcel reply = Parcel.obtain();
2899 data.writeInterfaceToken(IActivityManager.descriptor);
2900 data.writeStrongBinder(token);
2901 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2902 reply.readException();
2903 data.recycle();
2904 reply.recycle();
2905 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002906 public void activityDestroyed(IBinder token) throws RemoteException
2907 {
2908 Parcel data = Parcel.obtain();
2909 Parcel reply = Parcel.obtain();
2910 data.writeInterfaceToken(IActivityManager.descriptor);
2911 data.writeStrongBinder(token);
2912 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2913 reply.readException();
2914 data.recycle();
2915 reply.recycle();
2916 }
2917 public String getCallingPackage(IBinder token) throws RemoteException
2918 {
2919 Parcel data = Parcel.obtain();
2920 Parcel reply = Parcel.obtain();
2921 data.writeInterfaceToken(IActivityManager.descriptor);
2922 data.writeStrongBinder(token);
2923 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2924 reply.readException();
2925 String res = reply.readString();
2926 data.recycle();
2927 reply.recycle();
2928 return res;
2929 }
2930 public ComponentName getCallingActivity(IBinder token)
2931 throws RemoteException {
2932 Parcel data = Parcel.obtain();
2933 Parcel reply = Parcel.obtain();
2934 data.writeInterfaceToken(IActivityManager.descriptor);
2935 data.writeStrongBinder(token);
2936 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2937 reply.readException();
2938 ComponentName res = ComponentName.readFromParcel(reply);
2939 data.recycle();
2940 reply.recycle();
2941 return res;
2942 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002943 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002947 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002948 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2949 reply.readException();
2950 ArrayList<IAppTask> list = null;
2951 int N = reply.readInt();
2952 if (N >= 0) {
2953 list = new ArrayList<IAppTask>();
2954 while (N > 0) {
2955 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2956 list.add(task);
2957 N--;
2958 }
2959 }
2960 data.recycle();
2961 reply.recycle();
2962 return list;
2963 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002964 public int addAppTask(IBinder activityToken, Intent intent,
2965 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2966 Parcel data = Parcel.obtain();
2967 Parcel reply = Parcel.obtain();
2968 data.writeInterfaceToken(IActivityManager.descriptor);
2969 data.writeStrongBinder(activityToken);
2970 intent.writeToParcel(data, 0);
2971 description.writeToParcel(data, 0);
2972 thumbnail.writeToParcel(data, 0);
2973 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2974 reply.readException();
2975 int res = reply.readInt();
2976 data.recycle();
2977 reply.recycle();
2978 return res;
2979 }
2980 public Point getAppTaskThumbnailSize() throws RemoteException {
2981 Parcel data = Parcel.obtain();
2982 Parcel reply = Parcel.obtain();
2983 data.writeInterfaceToken(IActivityManager.descriptor);
2984 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2985 reply.readException();
2986 Point size = Point.CREATOR.createFromParcel(reply);
2987 data.recycle();
2988 reply.recycle();
2989 return size;
2990 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002991 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002992 Parcel data = Parcel.obtain();
2993 Parcel reply = Parcel.obtain();
2994 data.writeInterfaceToken(IActivityManager.descriptor);
2995 data.writeInt(maxNum);
2996 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002997 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2998 reply.readException();
2999 ArrayList list = null;
3000 int N = reply.readInt();
3001 if (N >= 0) {
3002 list = new ArrayList();
3003 while (N > 0) {
3004 ActivityManager.RunningTaskInfo info =
3005 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003006 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 list.add(info);
3008 N--;
3009 }
3010 }
3011 data.recycle();
3012 reply.recycle();
3013 return list;
3014 }
3015 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003016 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 Parcel data = Parcel.obtain();
3018 Parcel reply = Parcel.obtain();
3019 data.writeInterfaceToken(IActivityManager.descriptor);
3020 data.writeInt(maxNum);
3021 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003022 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003023 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3024 reply.readException();
3025 ArrayList<ActivityManager.RecentTaskInfo> list
3026 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3027 data.recycle();
3028 reply.recycle();
3029 return list;
3030 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003031 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003032 Parcel data = Parcel.obtain();
3033 Parcel reply = Parcel.obtain();
3034 data.writeInterfaceToken(IActivityManager.descriptor);
3035 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003036 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003037 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003038 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003039 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003040 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003041 }
3042 data.recycle();
3043 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003044 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003045 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003046 public List getServices(int maxNum, int flags) throws RemoteException {
3047 Parcel data = Parcel.obtain();
3048 Parcel reply = Parcel.obtain();
3049 data.writeInterfaceToken(IActivityManager.descriptor);
3050 data.writeInt(maxNum);
3051 data.writeInt(flags);
3052 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3053 reply.readException();
3054 ArrayList list = null;
3055 int N = reply.readInt();
3056 if (N >= 0) {
3057 list = new ArrayList();
3058 while (N > 0) {
3059 ActivityManager.RunningServiceInfo info =
3060 ActivityManager.RunningServiceInfo.CREATOR
3061 .createFromParcel(reply);
3062 list.add(info);
3063 N--;
3064 }
3065 }
3066 data.recycle();
3067 reply.recycle();
3068 return list;
3069 }
3070 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3071 throws RemoteException {
3072 Parcel data = Parcel.obtain();
3073 Parcel reply = Parcel.obtain();
3074 data.writeInterfaceToken(IActivityManager.descriptor);
3075 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3076 reply.readException();
3077 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3078 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3079 data.recycle();
3080 reply.recycle();
3081 return list;
3082 }
3083 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3084 throws RemoteException {
3085 Parcel data = Parcel.obtain();
3086 Parcel reply = Parcel.obtain();
3087 data.writeInterfaceToken(IActivityManager.descriptor);
3088 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3089 reply.readException();
3090 ArrayList<ActivityManager.RunningAppProcessInfo> list
3091 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3092 data.recycle();
3093 reply.recycle();
3094 return list;
3095 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003096 public List<ApplicationInfo> getRunningExternalApplications()
3097 throws RemoteException {
3098 Parcel data = Parcel.obtain();
3099 Parcel reply = Parcel.obtain();
3100 data.writeInterfaceToken(IActivityManager.descriptor);
3101 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3102 reply.readException();
3103 ArrayList<ApplicationInfo> list
3104 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3105 data.recycle();
3106 reply.recycle();
3107 return list;
3108 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003109 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003110 {
3111 Parcel data = Parcel.obtain();
3112 Parcel reply = Parcel.obtain();
3113 data.writeInterfaceToken(IActivityManager.descriptor);
3114 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003115 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003116 if (options != null) {
3117 data.writeInt(1);
3118 options.writeToParcel(data, 0);
3119 } else {
3120 data.writeInt(0);
3121 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003122 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3123 reply.readException();
3124 data.recycle();
3125 reply.recycle();
3126 }
3127 public void moveTaskToBack(int task) throws RemoteException
3128 {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 data.writeInt(task);
3133 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3134 reply.readException();
3135 data.recycle();
3136 reply.recycle();
3137 }
3138 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3139 throws RemoteException {
3140 Parcel data = Parcel.obtain();
3141 Parcel reply = Parcel.obtain();
3142 data.writeInterfaceToken(IActivityManager.descriptor);
3143 data.writeStrongBinder(token);
3144 data.writeInt(nonRoot ? 1 : 0);
3145 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3146 reply.readException();
3147 boolean res = reply.readInt() != 0;
3148 data.recycle();
3149 reply.recycle();
3150 return res;
3151 }
3152 public void moveTaskBackwards(int task) throws RemoteException
3153 {
3154 Parcel data = Parcel.obtain();
3155 Parcel reply = Parcel.obtain();
3156 data.writeInterfaceToken(IActivityManager.descriptor);
3157 data.writeInt(task);
3158 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3159 reply.readException();
3160 data.recycle();
3161 reply.recycle();
3162 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003163 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003164 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3165 {
3166 Parcel data = Parcel.obtain();
3167 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003168 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003169 data.writeInt(taskId);
3170 data.writeInt(stackId);
3171 data.writeInt(toTop ? 1 : 0);
3172 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3173 reply.readException();
3174 data.recycle();
3175 reply.recycle();
3176 }
3177 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003178 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003179 {
3180 Parcel data = Parcel.obtain();
3181 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003182 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003183 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003184 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003185 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003186 reply.readException();
3187 data.recycle();
3188 reply.recycle();
3189 }
Craig Mautner967212c2013-04-13 21:10:58 -07003190 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003191 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003192 {
3193 Parcel data = Parcel.obtain();
3194 Parcel reply = Parcel.obtain();
3195 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003196 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003197 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003198 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003199 data.recycle();
3200 reply.recycle();
3201 return list;
3202 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003203 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003204 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003205 {
3206 Parcel data = Parcel.obtain();
3207 Parcel reply = Parcel.obtain();
3208 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003209 data.writeInt(stackId);
3210 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003211 reply.readException();
3212 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003213 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003214 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003215 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003216 }
3217 data.recycle();
3218 reply.recycle();
3219 return info;
3220 }
3221 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003222 public boolean isInHomeStack(int taskId) throws RemoteException {
3223 Parcel data = Parcel.obtain();
3224 Parcel reply = Parcel.obtain();
3225 data.writeInterfaceToken(IActivityManager.descriptor);
3226 data.writeInt(taskId);
3227 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3228 reply.readException();
3229 boolean isInHomeStack = reply.readInt() > 0;
3230 data.recycle();
3231 reply.recycle();
3232 return isInHomeStack;
3233 }
3234 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003235 public void setFocusedStack(int stackId) throws RemoteException
3236 {
3237 Parcel data = Parcel.obtain();
3238 Parcel reply = Parcel.obtain();
3239 data.writeInterfaceToken(IActivityManager.descriptor);
3240 data.writeInt(stackId);
3241 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3242 reply.readException();
3243 data.recycle();
3244 reply.recycle();
3245 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003246 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3247 {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeStrongBinder(token);
3252 data.writeInt(onlyRoot ? 1 : 0);
3253 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3254 reply.readException();
3255 int res = reply.readInt();
3256 data.recycle();
3257 reply.recycle();
3258 return res;
3259 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003260 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003261 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 Parcel data = Parcel.obtain();
3263 Parcel reply = Parcel.obtain();
3264 data.writeInterfaceToken(IActivityManager.descriptor);
3265 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3266 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003267 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003268 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003269 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3270 reply.readException();
3271 int res = reply.readInt();
3272 ContentProviderHolder cph = null;
3273 if (res != 0) {
3274 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3275 }
3276 data.recycle();
3277 reply.recycle();
3278 return cph;
3279 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003280 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3281 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003282 Parcel data = Parcel.obtain();
3283 Parcel reply = Parcel.obtain();
3284 data.writeInterfaceToken(IActivityManager.descriptor);
3285 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003286 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003287 data.writeStrongBinder(token);
3288 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3289 reply.readException();
3290 int res = reply.readInt();
3291 ContentProviderHolder cph = null;
3292 if (res != 0) {
3293 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3294 }
3295 data.recycle();
3296 reply.recycle();
3297 return cph;
3298 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003299 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003300 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003301 {
3302 Parcel data = Parcel.obtain();
3303 Parcel reply = Parcel.obtain();
3304 data.writeInterfaceToken(IActivityManager.descriptor);
3305 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3306 data.writeTypedList(providers);
3307 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3308 reply.readException();
3309 data.recycle();
3310 reply.recycle();
3311 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003312 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3313 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003317 data.writeStrongBinder(connection);
3318 data.writeInt(stable);
3319 data.writeInt(unstable);
3320 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3321 reply.readException();
3322 boolean res = reply.readInt() != 0;
3323 data.recycle();
3324 reply.recycle();
3325 return res;
3326 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003327
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003328 public void unstableProviderDied(IBinder connection) throws RemoteException {
3329 Parcel data = Parcel.obtain();
3330 Parcel reply = Parcel.obtain();
3331 data.writeInterfaceToken(IActivityManager.descriptor);
3332 data.writeStrongBinder(connection);
3333 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3334 reply.readException();
3335 data.recycle();
3336 reply.recycle();
3337 }
3338
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003339 @Override
3340 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 data.writeStrongBinder(connection);
3345 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 data.recycle();
3348 reply.recycle();
3349 }
3350
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003351 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 data.writeStrongBinder(connection);
3356 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003357 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3358 reply.readException();
3359 data.recycle();
3360 reply.recycle();
3361 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003362
3363 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3364 Parcel data = Parcel.obtain();
3365 Parcel reply = Parcel.obtain();
3366 data.writeInterfaceToken(IActivityManager.descriptor);
3367 data.writeString(name);
3368 data.writeStrongBinder(token);
3369 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3370 reply.readException();
3371 data.recycle();
3372 reply.recycle();
3373 }
3374
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003375 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3376 throws RemoteException
3377 {
3378 Parcel data = Parcel.obtain();
3379 Parcel reply = Parcel.obtain();
3380 data.writeInterfaceToken(IActivityManager.descriptor);
3381 service.writeToParcel(data, 0);
3382 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3385 data.recycle();
3386 reply.recycle();
3387 return res;
3388 }
3389
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003390 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003391 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003392 {
3393 Parcel data = Parcel.obtain();
3394 Parcel reply = Parcel.obtain();
3395 data.writeInterfaceToken(IActivityManager.descriptor);
3396 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3397 service.writeToParcel(data, 0);
3398 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003399 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003400 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3401 reply.readException();
3402 ComponentName res = ComponentName.readFromParcel(reply);
3403 data.recycle();
3404 reply.recycle();
3405 return res;
3406 }
3407 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003408 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003409 {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3414 service.writeToParcel(data, 0);
3415 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003416 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003417 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3418 reply.readException();
3419 int res = reply.readInt();
3420 reply.recycle();
3421 data.recycle();
3422 return res;
3423 }
3424 public boolean stopServiceToken(ComponentName className, IBinder token,
3425 int startId) throws RemoteException {
3426 Parcel data = Parcel.obtain();
3427 Parcel reply = Parcel.obtain();
3428 data.writeInterfaceToken(IActivityManager.descriptor);
3429 ComponentName.writeToParcel(className, data);
3430 data.writeStrongBinder(token);
3431 data.writeInt(startId);
3432 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3433 reply.readException();
3434 boolean res = reply.readInt() != 0;
3435 data.recycle();
3436 reply.recycle();
3437 return res;
3438 }
3439 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003440 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
3444 ComponentName.writeToParcel(className, data);
3445 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003446 data.writeInt(id);
3447 if (notification != null) {
3448 data.writeInt(1);
3449 notification.writeToParcel(data, 0);
3450 } else {
3451 data.writeInt(0);
3452 }
3453 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003454 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3455 reply.readException();
3456 data.recycle();
3457 reply.recycle();
3458 }
3459 public int bindService(IApplicationThread caller, IBinder token,
3460 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003461 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003462 Parcel data = Parcel.obtain();
3463 Parcel reply = Parcel.obtain();
3464 data.writeInterfaceToken(IActivityManager.descriptor);
3465 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3466 data.writeStrongBinder(token);
3467 service.writeToParcel(data, 0);
3468 data.writeString(resolvedType);
3469 data.writeStrongBinder(connection.asBinder());
3470 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003471 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003472 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3473 reply.readException();
3474 int res = reply.readInt();
3475 data.recycle();
3476 reply.recycle();
3477 return res;
3478 }
3479 public boolean unbindService(IServiceConnection connection) throws RemoteException
3480 {
3481 Parcel data = Parcel.obtain();
3482 Parcel reply = Parcel.obtain();
3483 data.writeInterfaceToken(IActivityManager.descriptor);
3484 data.writeStrongBinder(connection.asBinder());
3485 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3486 reply.readException();
3487 boolean res = reply.readInt() != 0;
3488 data.recycle();
3489 reply.recycle();
3490 return res;
3491 }
3492
3493 public void publishService(IBinder token,
3494 Intent intent, IBinder service) throws RemoteException {
3495 Parcel data = Parcel.obtain();
3496 Parcel reply = Parcel.obtain();
3497 data.writeInterfaceToken(IActivityManager.descriptor);
3498 data.writeStrongBinder(token);
3499 intent.writeToParcel(data, 0);
3500 data.writeStrongBinder(service);
3501 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3502 reply.readException();
3503 data.recycle();
3504 reply.recycle();
3505 }
3506
3507 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3508 throws RemoteException {
3509 Parcel data = Parcel.obtain();
3510 Parcel reply = Parcel.obtain();
3511 data.writeInterfaceToken(IActivityManager.descriptor);
3512 data.writeStrongBinder(token);
3513 intent.writeToParcel(data, 0);
3514 data.writeInt(doRebind ? 1 : 0);
3515 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3516 reply.readException();
3517 data.recycle();
3518 reply.recycle();
3519 }
3520
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003521 public void serviceDoneExecuting(IBinder token, int type, int startId,
3522 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003527 data.writeInt(type);
3528 data.writeInt(startId);
3529 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003530 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3531 reply.readException();
3532 data.recycle();
3533 reply.recycle();
3534 }
3535
3536 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3537 Parcel data = Parcel.obtain();
3538 Parcel reply = Parcel.obtain();
3539 data.writeInterfaceToken(IActivityManager.descriptor);
3540 service.writeToParcel(data, 0);
3541 data.writeString(resolvedType);
3542 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3543 reply.readException();
3544 IBinder binder = reply.readStrongBinder();
3545 reply.recycle();
3546 data.recycle();
3547 return binder;
3548 }
3549
Christopher Tate181fafa2009-05-14 11:12:14 -07003550 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3551 throws RemoteException {
3552 Parcel data = Parcel.obtain();
3553 Parcel reply = Parcel.obtain();
3554 data.writeInterfaceToken(IActivityManager.descriptor);
3555 app.writeToParcel(data, 0);
3556 data.writeInt(backupRestoreMode);
3557 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 boolean success = reply.readInt() != 0;
3560 reply.recycle();
3561 data.recycle();
3562 return success;
3563 }
3564
Christopher Tate346acb12012-10-15 19:20:25 -07003565 public void clearPendingBackup() throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3570 reply.recycle();
3571 data.recycle();
3572 }
3573
Christopher Tate181fafa2009-05-14 11:12:14 -07003574 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
3578 data.writeString(packageName);
3579 data.writeStrongBinder(agent);
3580 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3581 reply.recycle();
3582 data.recycle();
3583 }
3584
3585 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3586 Parcel data = Parcel.obtain();
3587 Parcel reply = Parcel.obtain();
3588 data.writeInterfaceToken(IActivityManager.descriptor);
3589 app.writeToParcel(data, 0);
3590 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3591 reply.readException();
3592 reply.recycle();
3593 data.recycle();
3594 }
3595
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003596 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003597 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003598 IUiAutomationConnection connection, int userId, String instructionSet)
3599 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003600 Parcel data = Parcel.obtain();
3601 Parcel reply = Parcel.obtain();
3602 data.writeInterfaceToken(IActivityManager.descriptor);
3603 ComponentName.writeToParcel(className, data);
3604 data.writeString(profileFile);
3605 data.writeInt(flags);
3606 data.writeBundle(arguments);
3607 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003608 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003609 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003610 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003611 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3612 reply.readException();
3613 boolean res = reply.readInt() != 0;
3614 reply.recycle();
3615 data.recycle();
3616 return res;
3617 }
3618
3619 public void finishInstrumentation(IApplicationThread target,
3620 int resultCode, Bundle results) throws RemoteException {
3621 Parcel data = Parcel.obtain();
3622 Parcel reply = Parcel.obtain();
3623 data.writeInterfaceToken(IActivityManager.descriptor);
3624 data.writeStrongBinder(target != null ? target.asBinder() : null);
3625 data.writeInt(resultCode);
3626 data.writeBundle(results);
3627 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3628 reply.readException();
3629 data.recycle();
3630 reply.recycle();
3631 }
3632 public Configuration getConfiguration() throws RemoteException
3633 {
3634 Parcel data = Parcel.obtain();
3635 Parcel reply = Parcel.obtain();
3636 data.writeInterfaceToken(IActivityManager.descriptor);
3637 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3638 reply.readException();
3639 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3640 reply.recycle();
3641 data.recycle();
3642 return res;
3643 }
3644 public void updateConfiguration(Configuration values) throws RemoteException
3645 {
3646 Parcel data = Parcel.obtain();
3647 Parcel reply = Parcel.obtain();
3648 data.writeInterfaceToken(IActivityManager.descriptor);
3649 values.writeToParcel(data, 0);
3650 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3651 reply.readException();
3652 data.recycle();
3653 reply.recycle();
3654 }
3655 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3656 throws RemoteException {
3657 Parcel data = Parcel.obtain();
3658 Parcel reply = Parcel.obtain();
3659 data.writeInterfaceToken(IActivityManager.descriptor);
3660 data.writeStrongBinder(token);
3661 data.writeInt(requestedOrientation);
3662 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3663 reply.readException();
3664 data.recycle();
3665 reply.recycle();
3666 }
3667 public int getRequestedOrientation(IBinder token) throws RemoteException {
3668 Parcel data = Parcel.obtain();
3669 Parcel reply = Parcel.obtain();
3670 data.writeInterfaceToken(IActivityManager.descriptor);
3671 data.writeStrongBinder(token);
3672 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3673 reply.readException();
3674 int res = reply.readInt();
3675 data.recycle();
3676 reply.recycle();
3677 return res;
3678 }
3679 public ComponentName getActivityClassForToken(IBinder token)
3680 throws RemoteException {
3681 Parcel data = Parcel.obtain();
3682 Parcel reply = Parcel.obtain();
3683 data.writeInterfaceToken(IActivityManager.descriptor);
3684 data.writeStrongBinder(token);
3685 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3686 reply.readException();
3687 ComponentName res = ComponentName.readFromParcel(reply);
3688 data.recycle();
3689 reply.recycle();
3690 return res;
3691 }
3692 public String getPackageForToken(IBinder token) throws RemoteException
3693 {
3694 Parcel data = Parcel.obtain();
3695 Parcel reply = Parcel.obtain();
3696 data.writeInterfaceToken(IActivityManager.descriptor);
3697 data.writeStrongBinder(token);
3698 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3699 reply.readException();
3700 String res = reply.readString();
3701 data.recycle();
3702 reply.recycle();
3703 return res;
3704 }
3705 public IIntentSender getIntentSender(int type,
3706 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003707 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003708 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003709 Parcel data = Parcel.obtain();
3710 Parcel reply = Parcel.obtain();
3711 data.writeInterfaceToken(IActivityManager.descriptor);
3712 data.writeInt(type);
3713 data.writeString(packageName);
3714 data.writeStrongBinder(token);
3715 data.writeString(resultWho);
3716 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003717 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003718 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003719 data.writeTypedArray(intents, 0);
3720 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003721 } else {
3722 data.writeInt(0);
3723 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003724 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003725 if (options != null) {
3726 data.writeInt(1);
3727 options.writeToParcel(data, 0);
3728 } else {
3729 data.writeInt(0);
3730 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003731 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003732 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3733 reply.readException();
3734 IIntentSender res = IIntentSender.Stub.asInterface(
3735 reply.readStrongBinder());
3736 data.recycle();
3737 reply.recycle();
3738 return res;
3739 }
3740 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3741 Parcel data = Parcel.obtain();
3742 Parcel reply = Parcel.obtain();
3743 data.writeInterfaceToken(IActivityManager.descriptor);
3744 data.writeStrongBinder(sender.asBinder());
3745 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3746 reply.readException();
3747 data.recycle();
3748 reply.recycle();
3749 }
3750 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeStrongBinder(sender.asBinder());
3755 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3756 reply.readException();
3757 String res = reply.readString();
3758 data.recycle();
3759 reply.recycle();
3760 return res;
3761 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003762 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 data.writeStrongBinder(sender.asBinder());
3767 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3768 reply.readException();
3769 int res = reply.readInt();
3770 data.recycle();
3771 reply.recycle();
3772 return res;
3773 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003774 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3775 boolean requireFull, String name, String callerPackage) throws RemoteException {
3776 Parcel data = Parcel.obtain();
3777 Parcel reply = Parcel.obtain();
3778 data.writeInterfaceToken(IActivityManager.descriptor);
3779 data.writeInt(callingPid);
3780 data.writeInt(callingUid);
3781 data.writeInt(userId);
3782 data.writeInt(allowAll ? 1 : 0);
3783 data.writeInt(requireFull ? 1 : 0);
3784 data.writeString(name);
3785 data.writeString(callerPackage);
3786 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3787 reply.readException();
3788 int res = reply.readInt();
3789 data.recycle();
3790 reply.recycle();
3791 return res;
3792 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 public void setProcessLimit(int max) throws RemoteException
3794 {
3795 Parcel data = Parcel.obtain();
3796 Parcel reply = Parcel.obtain();
3797 data.writeInterfaceToken(IActivityManager.descriptor);
3798 data.writeInt(max);
3799 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 data.recycle();
3802 reply.recycle();
3803 }
3804 public int getProcessLimit() throws RemoteException
3805 {
3806 Parcel data = Parcel.obtain();
3807 Parcel reply = Parcel.obtain();
3808 data.writeInterfaceToken(IActivityManager.descriptor);
3809 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3810 reply.readException();
3811 int res = reply.readInt();
3812 data.recycle();
3813 reply.recycle();
3814 return res;
3815 }
3816 public void setProcessForeground(IBinder token, int pid,
3817 boolean isForeground) throws RemoteException {
3818 Parcel data = Parcel.obtain();
3819 Parcel reply = Parcel.obtain();
3820 data.writeInterfaceToken(IActivityManager.descriptor);
3821 data.writeStrongBinder(token);
3822 data.writeInt(pid);
3823 data.writeInt(isForeground ? 1 : 0);
3824 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3825 reply.readException();
3826 data.recycle();
3827 reply.recycle();
3828 }
3829 public int checkPermission(String permission, int pid, int uid)
3830 throws RemoteException {
3831 Parcel data = Parcel.obtain();
3832 Parcel reply = Parcel.obtain();
3833 data.writeInterfaceToken(IActivityManager.descriptor);
3834 data.writeString(permission);
3835 data.writeInt(pid);
3836 data.writeInt(uid);
3837 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3838 reply.readException();
3839 int res = reply.readInt();
3840 data.recycle();
3841 reply.recycle();
3842 return res;
3843 }
3844 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003845 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003846 Parcel data = Parcel.obtain();
3847 Parcel reply = Parcel.obtain();
3848 data.writeInterfaceToken(IActivityManager.descriptor);
3849 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003850 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003851 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003852 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3853 reply.readException();
3854 boolean res = reply.readInt() != 0;
3855 data.recycle();
3856 reply.recycle();
3857 return res;
3858 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003859 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003860 throws RemoteException {
3861 Parcel data = Parcel.obtain();
3862 Parcel reply = Parcel.obtain();
3863 data.writeInterfaceToken(IActivityManager.descriptor);
3864 uri.writeToParcel(data, 0);
3865 data.writeInt(pid);
3866 data.writeInt(uid);
3867 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003868 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003869 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 int res = reply.readInt();
3872 data.recycle();
3873 reply.recycle();
3874 return res;
3875 }
3876 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003877 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003878 Parcel data = Parcel.obtain();
3879 Parcel reply = Parcel.obtain();
3880 data.writeInterfaceToken(IActivityManager.descriptor);
3881 data.writeStrongBinder(caller.asBinder());
3882 data.writeString(targetPkg);
3883 uri.writeToParcel(data, 0);
3884 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003885 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003886 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3887 reply.readException();
3888 data.recycle();
3889 reply.recycle();
3890 }
3891 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003892 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003893 Parcel data = Parcel.obtain();
3894 Parcel reply = Parcel.obtain();
3895 data.writeInterfaceToken(IActivityManager.descriptor);
3896 data.writeStrongBinder(caller.asBinder());
3897 uri.writeToParcel(data, 0);
3898 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003899 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003900 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3901 reply.readException();
3902 data.recycle();
3903 reply.recycle();
3904 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003905
3906 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003907 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3908 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003909 Parcel data = Parcel.obtain();
3910 Parcel reply = Parcel.obtain();
3911 data.writeInterfaceToken(IActivityManager.descriptor);
3912 uri.writeToParcel(data, 0);
3913 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003914 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003915 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3916 reply.readException();
3917 data.recycle();
3918 reply.recycle();
3919 }
3920
3921 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003922 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3923 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003924 Parcel data = Parcel.obtain();
3925 Parcel reply = Parcel.obtain();
3926 data.writeInterfaceToken(IActivityManager.descriptor);
3927 uri.writeToParcel(data, 0);
3928 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003929 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003930 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3931 reply.readException();
3932 data.recycle();
3933 reply.recycle();
3934 }
3935
3936 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003937 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3938 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003939 Parcel data = Parcel.obtain();
3940 Parcel reply = Parcel.obtain();
3941 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003942 data.writeString(packageName);
3943 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003944 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3945 reply.readException();
3946 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3947 reply);
3948 data.recycle();
3949 reply.recycle();
3950 return perms;
3951 }
3952
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003953 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3954 throws RemoteException {
3955 Parcel data = Parcel.obtain();
3956 Parcel reply = Parcel.obtain();
3957 data.writeInterfaceToken(IActivityManager.descriptor);
3958 data.writeStrongBinder(who.asBinder());
3959 data.writeInt(waiting ? 1 : 0);
3960 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3961 reply.readException();
3962 data.recycle();
3963 reply.recycle();
3964 }
3965 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3966 Parcel data = Parcel.obtain();
3967 Parcel reply = Parcel.obtain();
3968 data.writeInterfaceToken(IActivityManager.descriptor);
3969 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3970 reply.readException();
3971 outInfo.readFromParcel(reply);
3972 data.recycle();
3973 reply.recycle();
3974 }
3975 public void unhandledBack() throws RemoteException
3976 {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3981 reply.readException();
3982 data.recycle();
3983 reply.recycle();
3984 }
3985 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3986 {
3987 Parcel data = Parcel.obtain();
3988 Parcel reply = Parcel.obtain();
3989 data.writeInterfaceToken(IActivityManager.descriptor);
3990 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3991 reply.readException();
3992 ParcelFileDescriptor pfd = null;
3993 if (reply.readInt() != 0) {
3994 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3995 }
3996 data.recycle();
3997 reply.recycle();
3998 return pfd;
3999 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004000 public void setLockScreenShown(boolean shown) throws RemoteException
4001 {
4002 Parcel data = Parcel.obtain();
4003 Parcel reply = Parcel.obtain();
4004 data.writeInterfaceToken(IActivityManager.descriptor);
4005 data.writeInt(shown ? 1 : 0);
4006 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4007 reply.readException();
4008 data.recycle();
4009 reply.recycle();
4010 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004011 public void setDebugApp(
4012 String packageName, boolean waitForDebugger, boolean persistent)
4013 throws RemoteException
4014 {
4015 Parcel data = Parcel.obtain();
4016 Parcel reply = Parcel.obtain();
4017 data.writeInterfaceToken(IActivityManager.descriptor);
4018 data.writeString(packageName);
4019 data.writeInt(waitForDebugger ? 1 : 0);
4020 data.writeInt(persistent ? 1 : 0);
4021 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4022 reply.readException();
4023 data.recycle();
4024 reply.recycle();
4025 }
4026 public void setAlwaysFinish(boolean enabled) throws RemoteException
4027 {
4028 Parcel data = Parcel.obtain();
4029 Parcel reply = Parcel.obtain();
4030 data.writeInterfaceToken(IActivityManager.descriptor);
4031 data.writeInt(enabled ? 1 : 0);
4032 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4033 reply.readException();
4034 data.recycle();
4035 reply.recycle();
4036 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004037 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004038 {
4039 Parcel data = Parcel.obtain();
4040 Parcel reply = Parcel.obtain();
4041 data.writeInterfaceToken(IActivityManager.descriptor);
4042 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004043 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004044 reply.readException();
4045 data.recycle();
4046 reply.recycle();
4047 }
4048 public void enterSafeMode() throws RemoteException {
4049 Parcel data = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4052 data.recycle();
4053 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004054 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4055 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004056 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004057 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004058 data.writeStrongBinder(sender.asBinder());
4059 data.writeInt(sourceUid);
4060 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004061 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4062 data.recycle();
4063 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004064 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004065 Parcel data = Parcel.obtain();
4066 Parcel reply = Parcel.obtain();
4067 data.writeInterfaceToken(IActivityManager.descriptor);
4068 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004069 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004070 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004071 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004072 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004073 boolean res = reply.readInt() != 0;
4074 data.recycle();
4075 reply.recycle();
4076 return res;
4077 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004078 @Override
4079 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4080 Parcel data = Parcel.obtain();
4081 Parcel reply = Parcel.obtain();
4082 data.writeInterfaceToken(IActivityManager.descriptor);
4083 data.writeString(reason);
4084 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4085 boolean res = reply.readInt() != 0;
4086 data.recycle();
4087 reply.recycle();
4088 return res;
4089 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004090 public boolean testIsSystemReady()
4091 {
4092 /* this base class version is never called */
4093 return true;
4094 }
Dan Egnor60d87622009-12-16 16:32:58 -08004095 public void handleApplicationCrash(IBinder app,
4096 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4097 {
4098 Parcel data = Parcel.obtain();
4099 Parcel reply = Parcel.obtain();
4100 data.writeInterfaceToken(IActivityManager.descriptor);
4101 data.writeStrongBinder(app);
4102 crashInfo.writeToParcel(data, 0);
4103 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4104 reply.readException();
4105 reply.recycle();
4106 data.recycle();
4107 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004108
Dianne Hackborn52322712014-08-26 22:47:26 -07004109 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004110 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004111 {
4112 Parcel data = Parcel.obtain();
4113 Parcel reply = Parcel.obtain();
4114 data.writeInterfaceToken(IActivityManager.descriptor);
4115 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004116 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004117 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004118 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004119 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004120 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004121 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004122 reply.recycle();
4123 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004124 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004125 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004126
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004127 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004128 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004129 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004130 {
4131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004135 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004136 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004137 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4138 reply.readException();
4139 reply.recycle();
4140 data.recycle();
4141 }
4142
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004143 public void signalPersistentProcesses(int sig) throws RemoteException {
4144 Parcel data = Parcel.obtain();
4145 Parcel reply = Parcel.obtain();
4146 data.writeInterfaceToken(IActivityManager.descriptor);
4147 data.writeInt(sig);
4148 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4149 reply.readException();
4150 data.recycle();
4151 reply.recycle();
4152 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004153
Dianne Hackborn1676c852012-09-10 14:52:30 -07004154 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004159 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004160 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4161 reply.readException();
4162 data.recycle();
4163 reply.recycle();
4164 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004165
4166 public void killAllBackgroundProcesses() throws RemoteException {
4167 Parcel data = Parcel.obtain();
4168 Parcel reply = Parcel.obtain();
4169 data.writeInterfaceToken(IActivityManager.descriptor);
4170 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4171 reply.readException();
4172 data.recycle();
4173 reply.recycle();
4174 }
4175
Dianne Hackborn1676c852012-09-10 14:52:30 -07004176 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004177 Parcel data = Parcel.obtain();
4178 Parcel reply = Parcel.obtain();
4179 data.writeInterfaceToken(IActivityManager.descriptor);
4180 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004181 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004182 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004183 reply.readException();
4184 data.recycle();
4185 reply.recycle();
4186 }
4187
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004188 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4189 throws RemoteException
4190 {
4191 Parcel data = Parcel.obtain();
4192 Parcel reply = Parcel.obtain();
4193 data.writeInterfaceToken(IActivityManager.descriptor);
4194 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4195 reply.readException();
4196 outInfo.readFromParcel(reply);
4197 reply.recycle();
4198 data.recycle();
4199 }
4200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004201 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4202 {
4203 Parcel data = Parcel.obtain();
4204 Parcel reply = Parcel.obtain();
4205 data.writeInterfaceToken(IActivityManager.descriptor);
4206 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4207 reply.readException();
4208 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4209 reply.recycle();
4210 data.recycle();
4211 return res;
4212 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004213
Dianne Hackborn1676c852012-09-10 14:52:30 -07004214 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004215 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004216 {
4217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004221 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004222 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004223 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004224 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004225 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004226 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004227 } else {
4228 data.writeInt(0);
4229 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004230 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4231 reply.readException();
4232 boolean res = reply.readInt() != 0;
4233 reply.recycle();
4234 data.recycle();
4235 return res;
4236 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004237
Dianne Hackborn55280a92009-05-07 15:53:46 -07004238 public boolean shutdown(int timeout) throws RemoteException
4239 {
4240 Parcel data = Parcel.obtain();
4241 Parcel reply = Parcel.obtain();
4242 data.writeInterfaceToken(IActivityManager.descriptor);
4243 data.writeInt(timeout);
4244 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4245 reply.readException();
4246 boolean res = reply.readInt() != 0;
4247 reply.recycle();
4248 data.recycle();
4249 return res;
4250 }
4251
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004252 public void stopAppSwitches() throws RemoteException {
4253 Parcel data = Parcel.obtain();
4254 Parcel reply = Parcel.obtain();
4255 data.writeInterfaceToken(IActivityManager.descriptor);
4256 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4257 reply.readException();
4258 reply.recycle();
4259 data.recycle();
4260 }
4261
4262 public void resumeAppSwitches() throws RemoteException {
4263 Parcel data = Parcel.obtain();
4264 Parcel reply = Parcel.obtain();
4265 data.writeInterfaceToken(IActivityManager.descriptor);
4266 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4267 reply.readException();
4268 reply.recycle();
4269 data.recycle();
4270 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004271
4272 public void addPackageDependency(String packageName) throws RemoteException {
4273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 data.writeString(packageName);
4277 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4278 reply.readException();
4279 data.recycle();
4280 reply.recycle();
4281 }
4282
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004283 public void killApplicationWithAppId(String pkg, int appid, String reason)
4284 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004289 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004290 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004291 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004292 reply.readException();
4293 data.recycle();
4294 reply.recycle();
4295 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004296
4297 public void closeSystemDialogs(String reason) throws RemoteException {
4298 Parcel data = Parcel.obtain();
4299 Parcel reply = Parcel.obtain();
4300 data.writeInterfaceToken(IActivityManager.descriptor);
4301 data.writeString(reason);
4302 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4303 reply.readException();
4304 data.recycle();
4305 reply.recycle();
4306 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004307
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004308 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004309 throws RemoteException {
4310 Parcel data = Parcel.obtain();
4311 Parcel reply = Parcel.obtain();
4312 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004313 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004314 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4315 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004316 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004317 data.recycle();
4318 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004319 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004320 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004321
4322 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4323 Parcel data = Parcel.obtain();
4324 Parcel reply = Parcel.obtain();
4325 data.writeInterfaceToken(IActivityManager.descriptor);
4326 data.writeString(processName);
4327 data.writeInt(uid);
4328 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4329 reply.readException();
4330 data.recycle();
4331 reply.recycle();
4332 }
4333
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004334 public void overridePendingTransition(IBinder token, String packageName,
4335 int enterAnim, int exitAnim) throws RemoteException {
4336 Parcel data = Parcel.obtain();
4337 Parcel reply = Parcel.obtain();
4338 data.writeInterfaceToken(IActivityManager.descriptor);
4339 data.writeStrongBinder(token);
4340 data.writeString(packageName);
4341 data.writeInt(enterAnim);
4342 data.writeInt(exitAnim);
4343 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4344 reply.readException();
4345 data.recycle();
4346 reply.recycle();
4347 }
4348
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004349 public boolean isUserAMonkey() throws RemoteException {
4350 Parcel data = Parcel.obtain();
4351 Parcel reply = Parcel.obtain();
4352 data.writeInterfaceToken(IActivityManager.descriptor);
4353 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4354 reply.readException();
4355 boolean res = reply.readInt() != 0;
4356 data.recycle();
4357 reply.recycle();
4358 return res;
4359 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004360
4361 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4362 Parcel data = Parcel.obtain();
4363 Parcel reply = Parcel.obtain();
4364 data.writeInterfaceToken(IActivityManager.descriptor);
4365 data.writeInt(monkey ? 1 : 0);
4366 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4367 reply.readException();
4368 data.recycle();
4369 reply.recycle();
4370 }
4371
Dianne Hackborn860755f2010-06-03 18:47:52 -07004372 public void finishHeavyWeightApp() throws RemoteException {
4373 Parcel data = Parcel.obtain();
4374 Parcel reply = Parcel.obtain();
4375 data.writeInterfaceToken(IActivityManager.descriptor);
4376 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 data.recycle();
4379 reply.recycle();
4380 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004381
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004382 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004383 throws RemoteException {
4384 Parcel data = Parcel.obtain();
4385 Parcel reply = Parcel.obtain();
4386 data.writeInterfaceToken(IActivityManager.descriptor);
4387 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004388 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4389 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004390 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004391 data.recycle();
4392 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004393 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004394 }
4395
Craig Mautner233ceee2014-05-09 17:05:11 -07004396 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004397 throws RemoteException {
4398 Parcel data = Parcel.obtain();
4399 Parcel reply = Parcel.obtain();
4400 data.writeInterfaceToken(IActivityManager.descriptor);
4401 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004402 if (options == null) {
4403 data.writeInt(0);
4404 } else {
4405 data.writeInt(1);
4406 data.writeBundle(options.toBundle());
4407 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004408 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004409 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004410 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004411 data.recycle();
4412 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004413 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004414 }
4415
Craig Mautner233ceee2014-05-09 17:05:11 -07004416 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4417 Parcel data = Parcel.obtain();
4418 Parcel reply = Parcel.obtain();
4419 data.writeInterfaceToken(IActivityManager.descriptor);
4420 data.writeStrongBinder(token);
4421 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4422 reply.readException();
4423 Bundle bundle = reply.readBundle();
4424 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4425 data.recycle();
4426 reply.recycle();
4427 return options;
4428 }
4429
Daniel Sandler69a48172010-06-23 16:29:36 -04004430 public void setImmersive(IBinder token, boolean immersive)
4431 throws RemoteException {
4432 Parcel data = Parcel.obtain();
4433 Parcel reply = Parcel.obtain();
4434 data.writeInterfaceToken(IActivityManager.descriptor);
4435 data.writeStrongBinder(token);
4436 data.writeInt(immersive ? 1 : 0);
4437 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4438 reply.readException();
4439 data.recycle();
4440 reply.recycle();
4441 }
4442
4443 public boolean isImmersive(IBinder token)
4444 throws RemoteException {
4445 Parcel data = Parcel.obtain();
4446 Parcel reply = Parcel.obtain();
4447 data.writeInterfaceToken(IActivityManager.descriptor);
4448 data.writeStrongBinder(token);
4449 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004450 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004451 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004452 data.recycle();
4453 reply.recycle();
4454 return res;
4455 }
4456
Craig Mautnerd61dc202014-07-07 11:09:11 -07004457 public boolean isTopOfTask(IBinder token) throws RemoteException {
4458 Parcel data = Parcel.obtain();
4459 Parcel reply = Parcel.obtain();
4460 data.writeInterfaceToken(IActivityManager.descriptor);
4461 data.writeStrongBinder(token);
4462 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4463 reply.readException();
4464 boolean res = reply.readInt() == 1;
4465 data.recycle();
4466 reply.recycle();
4467 return res;
4468 }
4469
Daniel Sandler69a48172010-06-23 16:29:36 -04004470 public boolean isTopActivityImmersive()
4471 throws RemoteException {
4472 Parcel data = Parcel.obtain();
4473 Parcel reply = Parcel.obtain();
4474 data.writeInterfaceToken(IActivityManager.descriptor);
4475 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004476 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004477 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004478 data.recycle();
4479 reply.recycle();
4480 return res;
4481 }
4482
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004483 public void crashApplication(int uid, int initialPid, String packageName,
4484 String message) throws RemoteException {
4485 Parcel data = Parcel.obtain();
4486 Parcel reply = Parcel.obtain();
4487 data.writeInterfaceToken(IActivityManager.descriptor);
4488 data.writeInt(uid);
4489 data.writeInt(initialPid);
4490 data.writeString(packageName);
4491 data.writeString(message);
4492 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4493 reply.readException();
4494 data.recycle();
4495 reply.recycle();
4496 }
Andy McFadden824c5102010-07-09 16:26:57 -07004497
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004498 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004499 Parcel data = Parcel.obtain();
4500 Parcel reply = Parcel.obtain();
4501 data.writeInterfaceToken(IActivityManager.descriptor);
4502 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004503 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004504 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4505 reply.readException();
4506 String res = reply.readString();
4507 data.recycle();
4508 reply.recycle();
4509 return res;
4510 }
4511
Dianne Hackborn7e269642010-08-25 19:50:20 -07004512 public IBinder newUriPermissionOwner(String name)
4513 throws RemoteException {
4514 Parcel data = Parcel.obtain();
4515 Parcel reply = Parcel.obtain();
4516 data.writeInterfaceToken(IActivityManager.descriptor);
4517 data.writeString(name);
4518 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4519 reply.readException();
4520 IBinder res = reply.readStrongBinder();
4521 data.recycle();
4522 reply.recycle();
4523 return res;
4524 }
4525
4526 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004527 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004528 Parcel data = Parcel.obtain();
4529 Parcel reply = Parcel.obtain();
4530 data.writeInterfaceToken(IActivityManager.descriptor);
4531 data.writeStrongBinder(owner);
4532 data.writeInt(fromUid);
4533 data.writeString(targetPkg);
4534 uri.writeToParcel(data, 0);
4535 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004536 data.writeInt(sourceUserId);
4537 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004538 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4539 reply.readException();
4540 data.recycle();
4541 reply.recycle();
4542 }
4543
4544 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004545 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004546 Parcel data = Parcel.obtain();
4547 Parcel reply = Parcel.obtain();
4548 data.writeInterfaceToken(IActivityManager.descriptor);
4549 data.writeStrongBinder(owner);
4550 if (uri != null) {
4551 data.writeInt(1);
4552 uri.writeToParcel(data, 0);
4553 } else {
4554 data.writeInt(0);
4555 }
4556 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004557 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004558 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4559 reply.readException();
4560 data.recycle();
4561 reply.recycle();
4562 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004563
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004564 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004565 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004566 Parcel data = Parcel.obtain();
4567 Parcel reply = Parcel.obtain();
4568 data.writeInterfaceToken(IActivityManager.descriptor);
4569 data.writeInt(callingUid);
4570 data.writeString(targetPkg);
4571 uri.writeToParcel(data, 0);
4572 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004573 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004574 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4575 reply.readException();
4576 int res = reply.readInt();
4577 data.recycle();
4578 reply.recycle();
4579 return res;
4580 }
4581
Dianne Hackborn1676c852012-09-10 14:52:30 -07004582 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004583 String path, ParcelFileDescriptor fd) throws RemoteException {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
4587 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004588 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004589 data.writeInt(managed ? 1 : 0);
4590 data.writeString(path);
4591 if (fd != null) {
4592 data.writeInt(1);
4593 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4594 } else {
4595 data.writeInt(0);
4596 }
4597 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4598 reply.readException();
4599 boolean res = reply.readInt() != 0;
4600 reply.recycle();
4601 data.recycle();
4602 return res;
4603 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004604
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004605 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004606 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004607 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004608 Parcel data = Parcel.obtain();
4609 Parcel reply = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
4611 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004612 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004613 data.writeTypedArray(intents, 0);
4614 data.writeStringArray(resolvedTypes);
4615 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004616 if (options != null) {
4617 data.writeInt(1);
4618 options.writeToParcel(data, 0);
4619 } else {
4620 data.writeInt(0);
4621 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004622 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004623 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4624 reply.readException();
4625 int result = reply.readInt();
4626 reply.recycle();
4627 data.recycle();
4628 return result;
4629 }
4630
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004631 public int getFrontActivityScreenCompatMode() throws RemoteException {
4632 Parcel data = Parcel.obtain();
4633 Parcel reply = Parcel.obtain();
4634 data.writeInterfaceToken(IActivityManager.descriptor);
4635 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4636 reply.readException();
4637 int mode = reply.readInt();
4638 reply.recycle();
4639 data.recycle();
4640 return mode;
4641 }
4642
4643 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4644 Parcel data = Parcel.obtain();
4645 Parcel reply = Parcel.obtain();
4646 data.writeInterfaceToken(IActivityManager.descriptor);
4647 data.writeInt(mode);
4648 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4649 reply.readException();
4650 reply.recycle();
4651 data.recycle();
4652 }
4653
4654 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4655 Parcel data = Parcel.obtain();
4656 Parcel reply = Parcel.obtain();
4657 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004658 data.writeString(packageName);
4659 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004660 reply.readException();
4661 int mode = reply.readInt();
4662 reply.recycle();
4663 data.recycle();
4664 return mode;
4665 }
4666
4667 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004668 throws RemoteException {
4669 Parcel data = Parcel.obtain();
4670 Parcel reply = Parcel.obtain();
4671 data.writeInterfaceToken(IActivityManager.descriptor);
4672 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004673 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004674 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4675 reply.readException();
4676 reply.recycle();
4677 data.recycle();
4678 }
4679
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004680 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4681 Parcel data = Parcel.obtain();
4682 Parcel reply = Parcel.obtain();
4683 data.writeInterfaceToken(IActivityManager.descriptor);
4684 data.writeString(packageName);
4685 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4686 reply.readException();
4687 boolean ask = reply.readInt() != 0;
4688 reply.recycle();
4689 data.recycle();
4690 return ask;
4691 }
4692
4693 public void setPackageAskScreenCompat(String packageName, boolean ask)
4694 throws RemoteException {
4695 Parcel data = Parcel.obtain();
4696 Parcel reply = Parcel.obtain();
4697 data.writeInterfaceToken(IActivityManager.descriptor);
4698 data.writeString(packageName);
4699 data.writeInt(ask ? 1 : 0);
4700 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4701 reply.readException();
4702 reply.recycle();
4703 data.recycle();
4704 }
4705
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004706 public boolean switchUser(int userid) throws RemoteException {
4707 Parcel data = Parcel.obtain();
4708 Parcel reply = Parcel.obtain();
4709 data.writeInterfaceToken(IActivityManager.descriptor);
4710 data.writeInt(userid);
4711 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4712 reply.readException();
4713 boolean result = reply.readInt() != 0;
4714 reply.recycle();
4715 data.recycle();
4716 return result;
4717 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004718
Kenny Guy08488bf2014-02-21 17:40:37 +00004719 public boolean startUserInBackground(int userid) throws RemoteException {
4720 Parcel data = Parcel.obtain();
4721 Parcel reply = Parcel.obtain();
4722 data.writeInterfaceToken(IActivityManager.descriptor);
4723 data.writeInt(userid);
4724 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4725 reply.readException();
4726 boolean result = reply.readInt() != 0;
4727 reply.recycle();
4728 data.recycle();
4729 return result;
4730 }
4731
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004732 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4733 Parcel data = Parcel.obtain();
4734 Parcel reply = Parcel.obtain();
4735 data.writeInterfaceToken(IActivityManager.descriptor);
4736 data.writeInt(userid);
4737 data.writeStrongInterface(callback);
4738 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4739 reply.readException();
4740 int result = reply.readInt();
4741 reply.recycle();
4742 data.recycle();
4743 return result;
4744 }
4745
Amith Yamasani52f1d752012-03-28 18:19:29 -07004746 public UserInfo getCurrentUser() throws RemoteException {
4747 Parcel data = Parcel.obtain();
4748 Parcel reply = Parcel.obtain();
4749 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004750 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004751 reply.readException();
4752 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4753 reply.recycle();
4754 data.recycle();
4755 return userInfo;
4756 }
4757
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004758 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004759 Parcel data = Parcel.obtain();
4760 Parcel reply = Parcel.obtain();
4761 data.writeInterfaceToken(IActivityManager.descriptor);
4762 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004763 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004764 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4765 reply.readException();
4766 boolean result = reply.readInt() != 0;
4767 reply.recycle();
4768 data.recycle();
4769 return result;
4770 }
4771
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004772 public int[] getRunningUserIds() throws RemoteException {
4773 Parcel data = Parcel.obtain();
4774 Parcel reply = Parcel.obtain();
4775 data.writeInterfaceToken(IActivityManager.descriptor);
4776 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4777 reply.readException();
4778 int[] result = reply.createIntArray();
4779 reply.recycle();
4780 data.recycle();
4781 return result;
4782 }
4783
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004784 public boolean removeTask(int taskId, int flags) throws RemoteException {
4785 Parcel data = Parcel.obtain();
4786 Parcel reply = Parcel.obtain();
4787 data.writeInterfaceToken(IActivityManager.descriptor);
4788 data.writeInt(taskId);
4789 data.writeInt(flags);
4790 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4791 reply.readException();
4792 boolean result = reply.readInt() != 0;
4793 reply.recycle();
4794 data.recycle();
4795 return result;
4796 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004797
Jeff Sharkeya4620792011-05-20 15:29:23 -07004798 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4799 Parcel data = Parcel.obtain();
4800 Parcel reply = Parcel.obtain();
4801 data.writeInterfaceToken(IActivityManager.descriptor);
4802 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4803 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4804 reply.readException();
4805 data.recycle();
4806 reply.recycle();
4807 }
4808
4809 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4810 Parcel data = Parcel.obtain();
4811 Parcel reply = Parcel.obtain();
4812 data.writeInterfaceToken(IActivityManager.descriptor);
4813 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4814 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4815 reply.readException();
4816 data.recycle();
4817 reply.recycle();
4818 }
4819
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004820 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4821 Parcel data = Parcel.obtain();
4822 Parcel reply = Parcel.obtain();
4823 data.writeInterfaceToken(IActivityManager.descriptor);
4824 data.writeStrongBinder(sender.asBinder());
4825 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4826 reply.readException();
4827 boolean res = reply.readInt() != 0;
4828 data.recycle();
4829 reply.recycle();
4830 return res;
4831 }
4832
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004833 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4834 Parcel data = Parcel.obtain();
4835 Parcel reply = Parcel.obtain();
4836 data.writeInterfaceToken(IActivityManager.descriptor);
4837 data.writeStrongBinder(sender.asBinder());
4838 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4839 reply.readException();
4840 boolean res = reply.readInt() != 0;
4841 data.recycle();
4842 reply.recycle();
4843 return res;
4844 }
4845
Dianne Hackborn81038902012-11-26 17:04:09 -08004846 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 data.writeStrongBinder(sender.asBinder());
4851 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4852 reply.readException();
4853 Intent res = reply.readInt() != 0
4854 ? Intent.CREATOR.createFromParcel(reply) : null;
4855 data.recycle();
4856 reply.recycle();
4857 return res;
4858 }
4859
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004860 public String getTagForIntentSender(IIntentSender sender, String prefix)
4861 throws RemoteException {
4862 Parcel data = Parcel.obtain();
4863 Parcel reply = Parcel.obtain();
4864 data.writeInterfaceToken(IActivityManager.descriptor);
4865 data.writeStrongBinder(sender.asBinder());
4866 data.writeString(prefix);
4867 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4868 reply.readException();
4869 String res = reply.readString();
4870 data.recycle();
4871 reply.recycle();
4872 return res;
4873 }
4874
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004875 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4876 {
4877 Parcel data = Parcel.obtain();
4878 Parcel reply = Parcel.obtain();
4879 data.writeInterfaceToken(IActivityManager.descriptor);
4880 values.writeToParcel(data, 0);
4881 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4882 reply.readException();
4883 data.recycle();
4884 reply.recycle();
4885 }
4886
Dianne Hackbornb437e092011-08-05 17:50:29 -07004887 public long[] getProcessPss(int[] pids) throws RemoteException {
4888 Parcel data = Parcel.obtain();
4889 Parcel reply = Parcel.obtain();
4890 data.writeInterfaceToken(IActivityManager.descriptor);
4891 data.writeIntArray(pids);
4892 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4893 reply.readException();
4894 long[] res = reply.createLongArray();
4895 data.recycle();
4896 reply.recycle();
4897 return res;
4898 }
4899
Dianne Hackborn661cd522011-08-22 00:26:20 -07004900 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4901 Parcel data = Parcel.obtain();
4902 Parcel reply = Parcel.obtain();
4903 data.writeInterfaceToken(IActivityManager.descriptor);
4904 TextUtils.writeToParcel(msg, data, 0);
4905 data.writeInt(always ? 1 : 0);
4906 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4907 reply.readException();
4908 data.recycle();
4909 reply.recycle();
4910 }
4911
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004912 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004913 Parcel data = Parcel.obtain();
4914 Parcel reply = Parcel.obtain();
4915 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004916 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004917 reply.readException();
4918 data.recycle();
4919 reply.recycle();
4920 }
4921
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004922 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004923 throws RemoteException {
4924 Parcel data = Parcel.obtain();
4925 Parcel reply = Parcel.obtain();
4926 data.writeInterfaceToken(IActivityManager.descriptor);
4927 data.writeStrongBinder(token);
4928 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004929 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07004930 reply.readException();
4931 boolean result = reply.readInt() != 0;
4932 data.recycle();
4933 reply.recycle();
4934 return result;
4935 }
4936
4937 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4938 throws RemoteException {
4939 Parcel data = Parcel.obtain();
4940 Parcel reply = Parcel.obtain();
4941 data.writeInterfaceToken(IActivityManager.descriptor);
4942 data.writeStrongBinder(token);
4943 target.writeToParcel(data, 0);
4944 data.writeInt(resultCode);
4945 if (resultData != null) {
4946 data.writeInt(1);
4947 resultData.writeToParcel(data, 0);
4948 } else {
4949 data.writeInt(0);
4950 }
4951 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4952 reply.readException();
4953 boolean result = reply.readInt() != 0;
4954 data.recycle();
4955 reply.recycle();
4956 return result;
4957 }
4958
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004959 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4960 Parcel data = Parcel.obtain();
4961 Parcel reply = Parcel.obtain();
4962 data.writeInterfaceToken(IActivityManager.descriptor);
4963 data.writeStrongBinder(activityToken);
4964 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4965 reply.readException();
4966 int result = reply.readInt();
4967 data.recycle();
4968 reply.recycle();
4969 return result;
4970 }
4971
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004972 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4973 Parcel data = Parcel.obtain();
4974 Parcel reply = Parcel.obtain();
4975 data.writeInterfaceToken(IActivityManager.descriptor);
4976 data.writeStrongBinder(activityToken);
4977 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4978 reply.readException();
4979 String result = reply.readString();
4980 data.recycle();
4981 reply.recycle();
4982 return result;
4983 }
4984
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004985 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4986 Parcel data = Parcel.obtain();
4987 Parcel reply = Parcel.obtain();
4988 data.writeInterfaceToken(IActivityManager.descriptor);
4989 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4990 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4991 reply.readException();
4992 data.recycle();
4993 reply.recycle();
4994 }
4995
4996 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4997 Parcel data = Parcel.obtain();
4998 Parcel reply = Parcel.obtain();
4999 data.writeInterfaceToken(IActivityManager.descriptor);
5000 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5001 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5002 reply.readException();
5003 data.recycle();
5004 reply.recycle();
5005 }
5006
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005007 public void requestBugReport() throws RemoteException {
5008 Parcel data = Parcel.obtain();
5009 Parcel reply = Parcel.obtain();
5010 data.writeInterfaceToken(IActivityManager.descriptor);
5011 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5012 reply.readException();
5013 data.recycle();
5014 reply.recycle();
5015 }
5016
Jeff Brownbd181bb2013-09-10 16:44:24 -07005017 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5018 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005019 Parcel data = Parcel.obtain();
5020 Parcel reply = Parcel.obtain();
5021 data.writeInterfaceToken(IActivityManager.descriptor);
5022 data.writeInt(pid);
5023 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005024 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005025 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5026 reply.readException();
5027 long res = reply.readInt();
5028 data.recycle();
5029 reply.recycle();
5030 return res;
5031 }
5032
Adam Skorydfc7fd72013-08-05 19:23:41 -07005033 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
5037 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005038 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005039 reply.readException();
5040 Bundle res = reply.readBundle();
5041 data.recycle();
5042 reply.recycle();
5043 return res;
5044 }
5045
Adam Skory7140a252013-09-11 12:04:58 +01005046 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005047 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005048 Parcel data = Parcel.obtain();
5049 Parcel reply = Parcel.obtain();
5050 data.writeInterfaceToken(IActivityManager.descriptor);
5051 data.writeStrongBinder(token);
5052 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005053 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005054 reply.readException();
5055 data.recycle();
5056 reply.recycle();
5057 }
5058
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005059 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5060 throws RemoteException {
5061 Parcel data = Parcel.obtain();
5062 Parcel reply = Parcel.obtain();
5063 data.writeInterfaceToken(IActivityManager.descriptor);
5064 intent.writeToParcel(data, 0);
5065 data.writeInt(requestType);
5066 data.writeString(hint);
5067 data.writeInt(userHandle);
5068 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5069 reply.readException();
5070 boolean res = reply.readInt() != 0;
5071 data.recycle();
5072 reply.recycle();
5073 return res;
5074 }
5075
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005076 public void killUid(int uid, String reason) throws RemoteException {
5077 Parcel data = Parcel.obtain();
5078 Parcel reply = Parcel.obtain();
5079 data.writeInterfaceToken(IActivityManager.descriptor);
5080 data.writeInt(uid);
5081 data.writeString(reason);
5082 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5083 reply.readException();
5084 data.recycle();
5085 reply.recycle();
5086 }
5087
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005088 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5089 Parcel data = Parcel.obtain();
5090 Parcel reply = Parcel.obtain();
5091 data.writeInterfaceToken(IActivityManager.descriptor);
5092 data.writeStrongBinder(who);
5093 data.writeInt(allowRestart ? 1 : 0);
5094 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5095 reply.readException();
5096 data.recycle();
5097 reply.recycle();
5098 }
5099
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005100 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5101 Parcel data = Parcel.obtain();
5102 Parcel reply = Parcel.obtain();
5103 data.writeInterfaceToken(IActivityManager.descriptor);
5104 data.writeStrongBinder(token);
5105 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5106 reply.readException();
5107 data.recycle();
5108 reply.recycle();
5109 }
5110
Craig Mautner5eda9b32013-07-02 11:58:16 -07005111 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5112 Parcel data = Parcel.obtain();
5113 Parcel reply = Parcel.obtain();
5114 data.writeInterfaceToken(IActivityManager.descriptor);
5115 data.writeStrongBinder(token);
5116 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5117 reply.readException();
5118 data.recycle();
5119 reply.recycle();
5120 }
5121
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005122 public void restart() throws RemoteException {
5123 Parcel data = Parcel.obtain();
5124 Parcel reply = Parcel.obtain();
5125 data.writeInterfaceToken(IActivityManager.descriptor);
5126 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5127 reply.readException();
5128 data.recycle();
5129 reply.recycle();
5130 }
5131
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005132 public void performIdleMaintenance() throws RemoteException {
5133 Parcel data = Parcel.obtain();
5134 Parcel reply = Parcel.obtain();
5135 data.writeInterfaceToken(IActivityManager.descriptor);
5136 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5137 reply.readException();
5138 data.recycle();
5139 reply.recycle();
5140 }
5141
Craig Mautner4a1cb222013-12-04 16:14:06 -08005142 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5143 IActivityContainerCallback callback) throws RemoteException {
5144 Parcel data = Parcel.obtain();
5145 Parcel reply = Parcel.obtain();
5146 data.writeInterfaceToken(IActivityManager.descriptor);
5147 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005148 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005149 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5150 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005151 final int result = reply.readInt();
5152 final IActivityContainer res;
5153 if (result == 1) {
5154 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5155 } else {
5156 res = null;
5157 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005158 data.recycle();
5159 reply.recycle();
5160 return res;
5161 }
5162
Craig Mautner95da1082014-02-24 17:54:35 -08005163 public void deleteActivityContainer(IActivityContainer activityContainer)
5164 throws RemoteException {
5165 Parcel data = Parcel.obtain();
5166 Parcel reply = Parcel.obtain();
5167 data.writeInterfaceToken(IActivityManager.descriptor);
5168 data.writeStrongBinder(activityContainer.asBinder());
5169 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5170 reply.readException();
5171 data.recycle();
5172 reply.recycle();
5173 }
5174
Craig Mautnere0a38842013-12-16 16:14:02 -08005175 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5176 throws RemoteException {
5177 Parcel data = Parcel.obtain();
5178 Parcel reply = Parcel.obtain();
5179 data.writeInterfaceToken(IActivityManager.descriptor);
5180 data.writeStrongBinder(activityToken);
5181 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5182 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005183 final int result = reply.readInt();
5184 final IActivityContainer res;
5185 if (result == 1) {
5186 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5187 } else {
5188 res = null;
5189 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005190 data.recycle();
5191 reply.recycle();
5192 return res;
5193 }
5194
Craig Mautner4a1cb222013-12-04 16:14:06 -08005195 public IBinder getHomeActivityToken() throws RemoteException {
5196 Parcel data = Parcel.obtain();
5197 Parcel reply = Parcel.obtain();
5198 data.writeInterfaceToken(IActivityManager.descriptor);
5199 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5200 reply.readException();
5201 IBinder res = reply.readStrongBinder();
5202 data.recycle();
5203 reply.recycle();
5204 return res;
5205 }
5206
Craig Mautneraea74a52014-03-08 14:23:10 -08005207 @Override
5208 public void startLockTaskMode(int taskId) throws RemoteException {
5209 Parcel data = Parcel.obtain();
5210 Parcel reply = Parcel.obtain();
5211 data.writeInterfaceToken(IActivityManager.descriptor);
5212 data.writeInt(taskId);
5213 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5214 reply.readException();
5215 data.recycle();
5216 reply.recycle();
5217 }
5218
5219 @Override
5220 public void startLockTaskMode(IBinder token) throws RemoteException {
5221 Parcel data = Parcel.obtain();
5222 Parcel reply = Parcel.obtain();
5223 data.writeInterfaceToken(IActivityManager.descriptor);
5224 data.writeStrongBinder(token);
5225 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5226 reply.readException();
5227 data.recycle();
5228 reply.recycle();
5229 }
5230
5231 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005232 public void startLockTaskModeOnCurrent() throws RemoteException {
5233 Parcel data = Parcel.obtain();
5234 Parcel reply = Parcel.obtain();
5235 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005236 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005237 reply.readException();
5238 data.recycle();
5239 reply.recycle();
5240 }
5241
5242 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005243 public void stopLockTaskMode() throws RemoteException {
5244 Parcel data = Parcel.obtain();
5245 Parcel reply = Parcel.obtain();
5246 data.writeInterfaceToken(IActivityManager.descriptor);
5247 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5248 reply.readException();
5249 data.recycle();
5250 reply.recycle();
5251 }
5252
5253 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005254 public void stopLockTaskModeOnCurrent() throws RemoteException {
5255 Parcel data = Parcel.obtain();
5256 Parcel reply = Parcel.obtain();
5257 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005258 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005259 reply.readException();
5260 data.recycle();
5261 reply.recycle();
5262 }
5263
5264 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005265 public boolean isInLockTaskMode() throws RemoteException {
5266 Parcel data = Parcel.obtain();
5267 Parcel reply = Parcel.obtain();
5268 data.writeInterfaceToken(IActivityManager.descriptor);
5269 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5270 reply.readException();
5271 boolean isInLockTaskMode = reply.readInt() == 1;
5272 data.recycle();
5273 reply.recycle();
5274 return isInLockTaskMode;
5275 }
5276
Craig Mautner688b5102014-03-27 16:55:03 -07005277 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005278 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005279 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005280 Parcel data = Parcel.obtain();
5281 Parcel reply = Parcel.obtain();
5282 data.writeInterfaceToken(IActivityManager.descriptor);
5283 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005284 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005285 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005286 reply.readException();
5287 data.recycle();
5288 reply.recycle();
5289 }
5290
Craig Mautneree2e45a2014-06-27 12:10:03 -07005291 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005292 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5293 Parcel data = Parcel.obtain();
5294 Parcel reply = Parcel.obtain();
5295 data.writeInterfaceToken(IActivityManager.descriptor);
5296 data.writeString(filename);
5297 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5298 reply.readException();
5299 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5300 data.recycle();
5301 reply.recycle();
5302 return icon;
5303 }
5304
5305 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005306 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005307 Parcel data = Parcel.obtain();
5308 Parcel reply = Parcel.obtain();
5309 data.writeInterfaceToken(IActivityManager.descriptor);
5310 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005311 data.writeInt(visible ? 1 : 0);
5312 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005313 reply.readException();
5314 boolean success = reply.readInt() > 0;
5315 data.recycle();
5316 reply.recycle();
5317 return success;
5318 }
5319
5320 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005321 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005322 Parcel data = Parcel.obtain();
5323 Parcel reply = Parcel.obtain();
5324 data.writeInterfaceToken(IActivityManager.descriptor);
5325 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005326 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005327 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005328 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005329 data.recycle();
5330 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005331 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005332 }
5333
5334 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005335 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005336 Parcel data = Parcel.obtain();
5337 Parcel reply = Parcel.obtain();
5338 data.writeInterfaceToken(IActivityManager.descriptor);
5339 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005340 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5341 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005342 reply.readException();
5343 data.recycle();
5344 reply.recycle();
5345 }
5346
5347 @Override
5348 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5349 Parcel data = Parcel.obtain();
5350 Parcel reply = Parcel.obtain();
5351 data.writeInterfaceToken(IActivityManager.descriptor);
5352 data.writeStrongBinder(token);
5353 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5354 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005355 reply.readException();
5356 data.recycle();
5357 reply.recycle();
5358 }
5359
Craig Mautner8746a472014-07-24 15:12:54 -07005360 @Override
5361 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5362 Parcel data = Parcel.obtain();
5363 Parcel reply = Parcel.obtain();
5364 data.writeInterfaceToken(IActivityManager.descriptor);
5365 data.writeStrongBinder(token);
5366 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5367 IBinder.FLAG_ONEWAY);
5368 reply.readException();
5369 data.recycle();
5370 reply.recycle();
5371 }
5372
Craig Mautner6e2f3952014-09-09 14:26:41 -07005373 @Override
5374 public void bootAnimationComplete() throws RemoteException {
5375 Parcel data = Parcel.obtain();
5376 Parcel reply = Parcel.obtain();
5377 data.writeInterfaceToken(IActivityManager.descriptor);
5378 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5379 reply.readException();
5380 data.recycle();
5381 reply.recycle();
5382 }
5383
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005384 private IBinder mRemote;
5385}