blob: 3b88973940caa9d5e4600b095ab704474eb07ab1 [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 Mautner5ff12102013-05-24 12:50:15 -070019import android.app.ActivityManager.StackBoxInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
33import android.graphics.Bitmap;
34import android.net.Uri;
35import android.os.Binder;
36import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070037import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.os.IBinder;
39import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070040import android.os.ParcelFileDescriptor;
41import android.os.Parcelable;
42import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070044import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080047import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import java.util.ArrayList;
50import java.util.List;
51
52/** {@hide} */
53public abstract class ActivityManagerNative extends Binder implements IActivityManager
54{
55 /**
56 * Cast a Binder object into an activity manager interface, generating
57 * a proxy if needed.
58 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080059 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060 if (obj == null) {
61 return null;
62 }
63 IActivityManager in =
64 (IActivityManager)obj.queryLocalInterface(descriptor);
65 if (in != null) {
66 return in;
67 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 return new ActivityManagerProxy(obj);
70 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080071
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 /**
73 * Retrieve the system's default/global activity manager.
74 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080075 static public IActivityManager getDefault() {
76 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 }
78
79 /**
80 * Convenience for checking whether the system is ready. For internal use only.
81 */
82 static public boolean isSystemReady() {
83 if (!sSystemReady) {
84 sSystemReady = getDefault().testIsSystemReady();
85 }
86 return sSystemReady;
87 }
88 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080089
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090 /**
91 * Convenience for sending a sticky broadcast. For internal use only.
92 * If you don't care about permission, use null.
93 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070094 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 try {
96 getDefault().broadcastIntent(
97 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -080098 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 } catch (RemoteException ex) {
100 }
101 }
102
103 static public void noteWakeupAlarm(PendingIntent ps) {
104 try {
105 getDefault().noteWakeupAlarm(ps.getTarget());
106 } catch (RemoteException ex) {
107 }
108 }
109
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800110 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111 attachInterface(this, descriptor);
112 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700113
114 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
116 throws RemoteException {
117 switch (code) {
118 case START_ACTIVITY_TRANSACTION:
119 {
120 data.enforceInterface(IActivityManager.descriptor);
121 IBinder b = data.readStrongBinder();
122 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800123 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 Intent intent = Intent.CREATOR.createFromParcel(data);
125 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800127 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700129 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700130 String profileFile = data.readString();
131 ParcelFileDescriptor profileFd = data.readInt() != 0
132 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700133 Bundle options = data.readInt() != 0
134 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800135 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700136 resultTo, resultWho, requestCode, startFlags,
137 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800138 reply.writeNoException();
139 reply.writeInt(result);
140 return true;
141 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700142
Amith Yamasani82644082012-08-03 13:09:11 -0700143 case START_ACTIVITY_AS_USER_TRANSACTION:
144 {
145 data.enforceInterface(IActivityManager.descriptor);
146 IBinder b = data.readStrongBinder();
147 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800148 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700149 Intent intent = Intent.CREATOR.createFromParcel(data);
150 String resolvedType = data.readString();
151 IBinder resultTo = data.readStrongBinder();
152 String resultWho = data.readString();
153 int requestCode = data.readInt();
154 int startFlags = data.readInt();
155 String profileFile = data.readString();
156 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700157 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700158 Bundle options = data.readInt() != 0
159 ? Bundle.CREATOR.createFromParcel(data) : null;
160 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800161 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700162 resultTo, resultWho, requestCode, startFlags,
163 profileFile, profileFd, options, userId);
164 reply.writeNoException();
165 reply.writeInt(result);
166 return true;
167 }
168
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800169 case START_ACTIVITY_AND_WAIT_TRANSACTION:
170 {
171 data.enforceInterface(IActivityManager.descriptor);
172 IBinder b = data.readStrongBinder();
173 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800174 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800175 Intent intent = Intent.CREATOR.createFromParcel(data);
176 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800177 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800178 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800179 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700180 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700181 String profileFile = data.readString();
182 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700183 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700186 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800187 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700188 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700189 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800190 reply.writeNoException();
191 result.writeToParcel(reply, 0);
192 return true;
193 }
194
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700195 case START_ACTIVITY_WITH_CONFIG_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 Hackborn2ccda4d2010-03-22 21:49:15 -0700201 Intent intent = Intent.CREATOR.createFromParcel(data);
202 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700204 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700206 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700207 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700210 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800211 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700212 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700213 reply.writeNoException();
214 reply.writeInt(result);
215 return true;
216 }
217
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700218 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700219 {
220 data.enforceInterface(IActivityManager.descriptor);
221 IBinder b = data.readStrongBinder();
222 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700223 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700224 Intent fillInIntent = null;
225 if (data.readInt() != 0) {
226 fillInIntent = Intent.CREATOR.createFromParcel(data);
227 }
228 String resolvedType = data.readString();
229 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700230 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700231 int requestCode = data.readInt();
232 int flagsMask = data.readInt();
233 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 Bundle options = data.readInt() != 0
235 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700236 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700237 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700238 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700239 reply.writeNoException();
240 reply.writeInt(result);
241 return true;
242 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700243
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800244 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
245 {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder callingActivity = data.readStrongBinder();
248 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700249 Bundle options = data.readInt() != 0
250 ? Bundle.CREATOR.createFromParcel(data) : null;
251 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800252 reply.writeNoException();
253 reply.writeInt(result ? 1 : 0);
254 return true;
255 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700256
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800257 case FINISH_ACTIVITY_TRANSACTION: {
258 data.enforceInterface(IActivityManager.descriptor);
259 IBinder token = data.readStrongBinder();
260 Intent resultData = null;
261 int resultCode = data.readInt();
262 if (data.readInt() != 0) {
263 resultData = Intent.CREATOR.createFromParcel(data);
264 }
265 boolean res = finishActivity(token, resultCode, resultData);
266 reply.writeNoException();
267 reply.writeInt(res ? 1 : 0);
268 return true;
269 }
270
271 case FINISH_SUB_ACTIVITY_TRANSACTION: {
272 data.enforceInterface(IActivityManager.descriptor);
273 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700274 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 int requestCode = data.readInt();
276 finishSubActivity(token, resultWho, requestCode);
277 reply.writeNoException();
278 return true;
279 }
280
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700281 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
282 data.enforceInterface(IActivityManager.descriptor);
283 IBinder token = data.readStrongBinder();
284 boolean res = finishActivityAffinity(token);
285 reply.writeNoException();
286 reply.writeInt(res ? 1 : 0);
287 return true;
288 }
289
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800290 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
291 data.enforceInterface(IActivityManager.descriptor);
292 IBinder token = data.readStrongBinder();
293 boolean res = willActivityBeVisible(token);
294 reply.writeNoException();
295 reply.writeInt(res ? 1 : 0);
296 return true;
297 }
298
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800299 case REGISTER_RECEIVER_TRANSACTION:
300 {
301 data.enforceInterface(IActivityManager.descriptor);
302 IBinder b = data.readStrongBinder();
303 IApplicationThread app =
304 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700305 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 b = data.readStrongBinder();
307 IIntentReceiver rec
308 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
309 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
310 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700311 int userId = data.readInt();
312 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800313 reply.writeNoException();
314 if (intent != null) {
315 reply.writeInt(1);
316 intent.writeToParcel(reply, 0);
317 } else {
318 reply.writeInt(0);
319 }
320 return true;
321 }
322
323 case UNREGISTER_RECEIVER_TRANSACTION:
324 {
325 data.enforceInterface(IActivityManager.descriptor);
326 IBinder b = data.readStrongBinder();
327 if (b == null) {
328 return true;
329 }
330 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
331 unregisterReceiver(rec);
332 reply.writeNoException();
333 return true;
334 }
335
336 case BROADCAST_INTENT_TRANSACTION:
337 {
338 data.enforceInterface(IActivityManager.descriptor);
339 IBinder b = data.readStrongBinder();
340 IApplicationThread app =
341 b != null ? ApplicationThreadNative.asInterface(b) : null;
342 Intent intent = Intent.CREATOR.createFromParcel(data);
343 String resolvedType = data.readString();
344 b = data.readStrongBinder();
345 IIntentReceiver resultTo =
346 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
347 int resultCode = data.readInt();
348 String resultData = data.readString();
349 Bundle resultExtras = data.readBundle();
350 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800351 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352 boolean serialized = data.readInt() != 0;
353 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700354 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800356 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700357 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 reply.writeNoException();
359 reply.writeInt(res);
360 return true;
361 }
362
363 case UNBROADCAST_INTENT_TRANSACTION:
364 {
365 data.enforceInterface(IActivityManager.descriptor);
366 IBinder b = data.readStrongBinder();
367 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
368 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700369 int userId = data.readInt();
370 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 reply.writeNoException();
372 return true;
373 }
374
375 case FINISH_RECEIVER_TRANSACTION: {
376 data.enforceInterface(IActivityManager.descriptor);
377 IBinder who = data.readStrongBinder();
378 int resultCode = data.readInt();
379 String resultData = data.readString();
380 Bundle resultExtras = data.readBundle();
381 boolean resultAbort = data.readInt() != 0;
382 if (who != null) {
383 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
384 }
385 reply.writeNoException();
386 return true;
387 }
388
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 case ATTACH_APPLICATION_TRANSACTION: {
390 data.enforceInterface(IActivityManager.descriptor);
391 IApplicationThread app = ApplicationThreadNative.asInterface(
392 data.readStrongBinder());
393 if (app != null) {
394 attachApplication(app);
395 }
396 reply.writeNoException();
397 return true;
398 }
399
400 case ACTIVITY_IDLE_TRANSACTION: {
401 data.enforceInterface(IActivityManager.descriptor);
402 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700403 Configuration config = null;
404 if (data.readInt() != 0) {
405 config = Configuration.CREATOR.createFromParcel(data);
406 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700407 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800408 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700409 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800410 }
411 reply.writeNoException();
412 return true;
413 }
414
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700415 case ACTIVITY_RESUMED_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder token = data.readStrongBinder();
418 activityResumed(token);
419 reply.writeNoException();
420 return true;
421 }
422
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 case ACTIVITY_PAUSED_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800426 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 reply.writeNoException();
428 return true;
429 }
430
431 case ACTIVITY_STOPPED_TRANSACTION: {
432 data.enforceInterface(IActivityManager.descriptor);
433 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800434 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800435 Bitmap thumbnail = data.readInt() != 0
436 ? Bitmap.CREATOR.createFromParcel(data) : null;
437 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800438 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 reply.writeNoException();
440 return true;
441 }
442
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800443 case ACTIVITY_SLEPT_TRANSACTION: {
444 data.enforceInterface(IActivityManager.descriptor);
445 IBinder token = data.readStrongBinder();
446 activitySlept(token);
447 reply.writeNoException();
448 return true;
449 }
450
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800451 case ACTIVITY_DESTROYED_TRANSACTION: {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder token = data.readStrongBinder();
454 activityDestroyed(token);
455 reply.writeNoException();
456 return true;
457 }
458
459 case GET_CALLING_PACKAGE_TRANSACTION: {
460 data.enforceInterface(IActivityManager.descriptor);
461 IBinder token = data.readStrongBinder();
462 String res = token != null ? getCallingPackage(token) : null;
463 reply.writeNoException();
464 reply.writeString(res);
465 return true;
466 }
467
468 case GET_CALLING_ACTIVITY_TRANSACTION: {
469 data.enforceInterface(IActivityManager.descriptor);
470 IBinder token = data.readStrongBinder();
471 ComponentName cn = getCallingActivity(token);
472 reply.writeNoException();
473 ComponentName.writeToParcel(cn, reply);
474 return true;
475 }
476
477 case GET_TASKS_TRANSACTION: {
478 data.enforceInterface(IActivityManager.descriptor);
479 int maxNum = data.readInt();
480 int fl = data.readInt();
481 IBinder receiverBinder = data.readStrongBinder();
482 IThumbnailReceiver receiver = receiverBinder != null
483 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
484 : null;
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700485 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl, receiver);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 reply.writeNoException();
487 int N = list != null ? list.size() : -1;
488 reply.writeInt(N);
489 int i;
490 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700491 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492 info.writeToParcel(reply, 0);
493 }
494 return true;
495 }
496
497 case GET_RECENT_TASKS_TRANSACTION: {
498 data.enforceInterface(IActivityManager.descriptor);
499 int maxNum = data.readInt();
500 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700501 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700503 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800504 reply.writeNoException();
505 reply.writeTypedList(list);
506 return true;
507 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700508
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700509 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800510 data.enforceInterface(IActivityManager.descriptor);
511 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700512 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800513 reply.writeNoException();
514 if (bm != null) {
515 reply.writeInt(1);
516 bm.writeToParcel(reply, 0);
517 } else {
518 reply.writeInt(0);
519 }
520 return true;
521 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700522
523 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
524 data.enforceInterface(IActivityManager.descriptor);
525 int id = data.readInt();
526 Bitmap bm = getTaskTopThumbnail(id);
527 reply.writeNoException();
528 if (bm != null) {
529 reply.writeInt(1);
530 bm.writeToParcel(reply, 0);
531 } else {
532 reply.writeInt(0);
533 }
534 return true;
535 }
536
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 case GET_SERVICES_TRANSACTION: {
538 data.enforceInterface(IActivityManager.descriptor);
539 int maxNum = data.readInt();
540 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700541 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800542 reply.writeNoException();
543 int N = list != null ? list.size() : -1;
544 reply.writeInt(N);
545 int i;
546 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700547 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800548 info.writeToParcel(reply, 0);
549 }
550 return true;
551 }
552
553 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
554 data.enforceInterface(IActivityManager.descriptor);
555 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
556 reply.writeNoException();
557 reply.writeTypedList(list);
558 return true;
559 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700560
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800561 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
562 data.enforceInterface(IActivityManager.descriptor);
563 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
564 reply.writeNoException();
565 reply.writeTypedList(list);
566 return true;
567 }
568
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700569 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
570 data.enforceInterface(IActivityManager.descriptor);
571 List<ApplicationInfo> list = getRunningExternalApplications();
572 reply.writeNoException();
573 reply.writeTypedList(list);
574 return true;
575 }
576
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800577 case MOVE_TASK_TO_FRONT_TRANSACTION: {
578 data.enforceInterface(IActivityManager.descriptor);
579 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800580 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700581 Bundle options = data.readInt() != 0
582 ? Bundle.CREATOR.createFromParcel(data) : null;
583 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584 reply.writeNoException();
585 return true;
586 }
587
588 case MOVE_TASK_TO_BACK_TRANSACTION: {
589 data.enforceInterface(IActivityManager.descriptor);
590 int task = data.readInt();
591 moveTaskToBack(task);
592 reply.writeNoException();
593 return true;
594 }
595
596 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
597 data.enforceInterface(IActivityManager.descriptor);
598 IBinder token = data.readStrongBinder();
599 boolean nonRoot = data.readInt() != 0;
600 boolean res = moveActivityTaskToBack(token, nonRoot);
601 reply.writeNoException();
602 reply.writeInt(res ? 1 : 0);
603 return true;
604 }
605
606 case MOVE_TASK_BACKWARDS_TRANSACTION: {
607 data.enforceInterface(IActivityManager.descriptor);
608 int task = data.readInt();
609 moveTaskBackwards(task);
610 reply.writeNoException();
611 return true;
612 }
613
Craig Mautnerc00204b2013-03-05 15:02:14 -0800614 case CREATE_STACK_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700616 int taskId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800617 int relativeStackId = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700618 int position = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800619 float weight = data.readFloat();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700620 int res = createStack(taskId, relativeStackId, position, weight);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800621 reply.writeNoException();
622 reply.writeInt(res);
623 return true;
624 }
625
626 case MOVE_TASK_TO_STACK_TRANSACTION: {
627 data.enforceInterface(IActivityManager.descriptor);
628 int taskId = data.readInt();
629 int stackId = data.readInt();
630 boolean toTop = data.readInt() != 0;
631 moveTaskToStack(taskId, stackId, toTop);
632 reply.writeNoException();
633 return true;
634 }
635
636 case RESIZE_STACK_TRANSACTION: {
637 data.enforceInterface(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -0700638 int stackBoxId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800639 float weight = data.readFloat();
Craig Mautner5a449152013-05-24 15:49:29 -0700640 resizeStackBox(stackBoxId, weight);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800641 reply.writeNoException();
642 return true;
643 }
644
Craig Mautner5ff12102013-05-24 12:50:15 -0700645 case GET_STACK_BOXES_TRANSACTION: {
646 data.enforceInterface(IActivityManager.descriptor);
647 List<StackBoxInfo> list = getStackBoxes();
648 reply.writeNoException();
649 reply.writeTypedList(list);
650 return true;
651 }
652
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700653 case GET_STACK_BOX_INFO_TRANSACTION: {
654 data.enforceInterface(IActivityManager.descriptor);
655 int stackBoxId = data.readInt();
656 StackBoxInfo info = getStackBoxInfo(stackBoxId);
657 reply.writeNoException();
658 if (info != null) {
659 reply.writeInt(1);
660 info.writeToParcel(reply, 0);
661 } else {
662 reply.writeInt(0);
663 }
664 return true;
665 }
666
Craig Mautnercf910b02013-04-23 11:23:27 -0700667 case SET_FOCUSED_STACK_TRANSACTION: {
668 data.enforceInterface(IActivityManager.descriptor);
669 int stackId = data.readInt();
670 setFocusedStack(stackId);
671 reply.writeNoException();
672 return true;
673 }
674
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
676 data.enforceInterface(IActivityManager.descriptor);
677 IBinder token = data.readStrongBinder();
678 boolean onlyRoot = data.readInt() != 0;
679 int res = token != null
680 ? getTaskForActivity(token, onlyRoot) : -1;
681 reply.writeNoException();
682 reply.writeInt(res);
683 return true;
684 }
685
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800686 case REPORT_THUMBNAIL_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 IBinder token = data.readStrongBinder();
689 Bitmap thumbnail = data.readInt() != 0
690 ? Bitmap.CREATOR.createFromParcel(data) : null;
691 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
692 reportThumbnail(token, thumbnail, description);
693 reply.writeNoException();
694 return true;
695 }
696
697 case GET_CONTENT_PROVIDER_TRANSACTION: {
698 data.enforceInterface(IActivityManager.descriptor);
699 IBinder b = data.readStrongBinder();
700 IApplicationThread app = ApplicationThreadNative.asInterface(b);
701 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700702 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700703 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700704 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 reply.writeNoException();
706 if (cph != null) {
707 reply.writeInt(1);
708 cph.writeToParcel(reply, 0);
709 } else {
710 reply.writeInt(0);
711 }
712 return true;
713 }
714
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800715 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
716 data.enforceInterface(IActivityManager.descriptor);
717 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700718 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800719 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700720 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800721 reply.writeNoException();
722 if (cph != null) {
723 reply.writeInt(1);
724 cph.writeToParcel(reply, 0);
725 } else {
726 reply.writeInt(0);
727 }
728 return true;
729 }
730
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800731 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 IBinder b = data.readStrongBinder();
734 IApplicationThread app = ApplicationThreadNative.asInterface(b);
735 ArrayList<ContentProviderHolder> providers =
736 data.createTypedArrayList(ContentProviderHolder.CREATOR);
737 publishContentProviders(app, providers);
738 reply.writeNoException();
739 return true;
740 }
741
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700742 case REF_CONTENT_PROVIDER_TRANSACTION: {
743 data.enforceInterface(IActivityManager.descriptor);
744 IBinder b = data.readStrongBinder();
745 int stable = data.readInt();
746 int unstable = data.readInt();
747 boolean res = refContentProvider(b, stable, unstable);
748 reply.writeNoException();
749 reply.writeInt(res ? 1 : 0);
750 return true;
751 }
752
753 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
754 data.enforceInterface(IActivityManager.descriptor);
755 IBinder b = data.readStrongBinder();
756 unstableProviderDied(b);
757 reply.writeNoException();
758 return true;
759 }
760
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800761 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
762 data.enforceInterface(IActivityManager.descriptor);
763 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700764 boolean stable = data.readInt() != 0;
765 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800766 reply.writeNoException();
767 return true;
768 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800769
770 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
771 data.enforceInterface(IActivityManager.descriptor);
772 String name = data.readString();
773 IBinder token = data.readStrongBinder();
774 removeContentProviderExternal(name, token);
775 reply.writeNoException();
776 return true;
777 }
778
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700779 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
780 data.enforceInterface(IActivityManager.descriptor);
781 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
782 PendingIntent pi = getRunningServiceControlPanel(comp);
783 reply.writeNoException();
784 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
785 return true;
786 }
787
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 case START_SERVICE_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder b = data.readStrongBinder();
791 IApplicationThread app = ApplicationThreadNative.asInterface(b);
792 Intent service = Intent.CREATOR.createFromParcel(data);
793 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700794 int userId = data.readInt();
795 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800796 reply.writeNoException();
797 ComponentName.writeToParcel(cn, reply);
798 return true;
799 }
800
801 case STOP_SERVICE_TRANSACTION: {
802 data.enforceInterface(IActivityManager.descriptor);
803 IBinder b = data.readStrongBinder();
804 IApplicationThread app = ApplicationThreadNative.asInterface(b);
805 Intent service = Intent.CREATOR.createFromParcel(data);
806 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700807 int userId = data.readInt();
808 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800809 reply.writeNoException();
810 reply.writeInt(res);
811 return true;
812 }
813
814 case STOP_SERVICE_TOKEN_TRANSACTION: {
815 data.enforceInterface(IActivityManager.descriptor);
816 ComponentName className = ComponentName.readFromParcel(data);
817 IBinder token = data.readStrongBinder();
818 int startId = data.readInt();
819 boolean res = stopServiceToken(className, token, startId);
820 reply.writeNoException();
821 reply.writeInt(res ? 1 : 0);
822 return true;
823 }
824
825 case SET_SERVICE_FOREGROUND_TRANSACTION: {
826 data.enforceInterface(IActivityManager.descriptor);
827 ComponentName className = ComponentName.readFromParcel(data);
828 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700829 int id = data.readInt();
830 Notification notification = null;
831 if (data.readInt() != 0) {
832 notification = Notification.CREATOR.createFromParcel(data);
833 }
834 boolean removeNotification = data.readInt() != 0;
835 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800836 reply.writeNoException();
837 return true;
838 }
839
840 case BIND_SERVICE_TRANSACTION: {
841 data.enforceInterface(IActivityManager.descriptor);
842 IBinder b = data.readStrongBinder();
843 IApplicationThread app = ApplicationThreadNative.asInterface(b);
844 IBinder token = data.readStrongBinder();
845 Intent service = Intent.CREATOR.createFromParcel(data);
846 String resolvedType = data.readString();
847 b = data.readStrongBinder();
848 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800849 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800850 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800851 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800852 reply.writeNoException();
853 reply.writeInt(res);
854 return true;
855 }
856
857 case UNBIND_SERVICE_TRANSACTION: {
858 data.enforceInterface(IActivityManager.descriptor);
859 IBinder b = data.readStrongBinder();
860 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
861 boolean res = unbindService(conn);
862 reply.writeNoException();
863 reply.writeInt(res ? 1 : 0);
864 return true;
865 }
866
867 case PUBLISH_SERVICE_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 IBinder token = data.readStrongBinder();
870 Intent intent = Intent.CREATOR.createFromParcel(data);
871 IBinder service = data.readStrongBinder();
872 publishService(token, intent, service);
873 reply.writeNoException();
874 return true;
875 }
876
877 case UNBIND_FINISHED_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 IBinder token = data.readStrongBinder();
880 Intent intent = Intent.CREATOR.createFromParcel(data);
881 boolean doRebind = data.readInt() != 0;
882 unbindFinished(token, intent, doRebind);
883 reply.writeNoException();
884 return true;
885 }
886
887 case SERVICE_DONE_EXECUTING_TRANSACTION: {
888 data.enforceInterface(IActivityManager.descriptor);
889 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700890 int type = data.readInt();
891 int startId = data.readInt();
892 int res = data.readInt();
893 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800894 reply.writeNoException();
895 return true;
896 }
897
898 case START_INSTRUMENTATION_TRANSACTION: {
899 data.enforceInterface(IActivityManager.descriptor);
900 ComponentName className = ComponentName.readFromParcel(data);
901 String profileFile = data.readString();
902 int fl = data.readInt();
903 Bundle arguments = data.readBundle();
904 IBinder b = data.readStrongBinder();
905 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800906 b = data.readStrongBinder();
907 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700908 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800909 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800910 reply.writeNoException();
911 reply.writeInt(res ? 1 : 0);
912 return true;
913 }
914
915
916 case FINISH_INSTRUMENTATION_TRANSACTION: {
917 data.enforceInterface(IActivityManager.descriptor);
918 IBinder b = data.readStrongBinder();
919 IApplicationThread app = ApplicationThreadNative.asInterface(b);
920 int resultCode = data.readInt();
921 Bundle results = data.readBundle();
922 finishInstrumentation(app, resultCode, results);
923 reply.writeNoException();
924 return true;
925 }
926
927 case GET_CONFIGURATION_TRANSACTION: {
928 data.enforceInterface(IActivityManager.descriptor);
929 Configuration config = getConfiguration();
930 reply.writeNoException();
931 config.writeToParcel(reply, 0);
932 return true;
933 }
934
935 case UPDATE_CONFIGURATION_TRANSACTION: {
936 data.enforceInterface(IActivityManager.descriptor);
937 Configuration config = Configuration.CREATOR.createFromParcel(data);
938 updateConfiguration(config);
939 reply.writeNoException();
940 return true;
941 }
942
943 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 IBinder token = data.readStrongBinder();
946 int requestedOrientation = data.readInt();
947 setRequestedOrientation(token, requestedOrientation);
948 reply.writeNoException();
949 return true;
950 }
951
952 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
953 data.enforceInterface(IActivityManager.descriptor);
954 IBinder token = data.readStrongBinder();
955 int req = getRequestedOrientation(token);
956 reply.writeNoException();
957 reply.writeInt(req);
958 return true;
959 }
960
961 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
962 data.enforceInterface(IActivityManager.descriptor);
963 IBinder token = data.readStrongBinder();
964 ComponentName cn = getActivityClassForToken(token);
965 reply.writeNoException();
966 ComponentName.writeToParcel(cn, reply);
967 return true;
968 }
969
970 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
971 data.enforceInterface(IActivityManager.descriptor);
972 IBinder token = data.readStrongBinder();
973 reply.writeNoException();
974 reply.writeString(getPackageForToken(token));
975 return true;
976 }
977
978 case GET_INTENT_SENDER_TRANSACTION: {
979 data.enforceInterface(IActivityManager.descriptor);
980 int type = data.readInt();
981 String packageName = data.readString();
982 IBinder token = data.readStrongBinder();
983 String resultWho = data.readString();
984 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800985 Intent[] requestIntents;
986 String[] requestResolvedTypes;
987 if (data.readInt() != 0) {
988 requestIntents = data.createTypedArray(Intent.CREATOR);
989 requestResolvedTypes = data.createStringArray();
990 } else {
991 requestIntents = null;
992 requestResolvedTypes = null;
993 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700995 Bundle options = data.readInt() != 0
996 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700997 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800998 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800999 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001000 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 reply.writeNoException();
1002 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1003 return true;
1004 }
1005
1006 case CANCEL_INTENT_SENDER_TRANSACTION: {
1007 data.enforceInterface(IActivityManager.descriptor);
1008 IIntentSender r = IIntentSender.Stub.asInterface(
1009 data.readStrongBinder());
1010 cancelIntentSender(r);
1011 reply.writeNoException();
1012 return true;
1013 }
1014
1015 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1016 data.enforceInterface(IActivityManager.descriptor);
1017 IIntentSender r = IIntentSender.Stub.asInterface(
1018 data.readStrongBinder());
1019 String res = getPackageForIntentSender(r);
1020 reply.writeNoException();
1021 reply.writeString(res);
1022 return true;
1023 }
1024
Christopher Tatec4a07d12012-04-06 14:19:13 -07001025 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1026 data.enforceInterface(IActivityManager.descriptor);
1027 IIntentSender r = IIntentSender.Stub.asInterface(
1028 data.readStrongBinder());
1029 int res = getUidForIntentSender(r);
1030 reply.writeNoException();
1031 reply.writeInt(res);
1032 return true;
1033 }
1034
Dianne Hackborn41203752012-08-31 14:05:51 -07001035 case HANDLE_INCOMING_USER_TRANSACTION: {
1036 data.enforceInterface(IActivityManager.descriptor);
1037 int callingPid = data.readInt();
1038 int callingUid = data.readInt();
1039 int userId = data.readInt();
1040 boolean allowAll = data.readInt() != 0 ;
1041 boolean requireFull = data.readInt() != 0;
1042 String name = data.readString();
1043 String callerPackage = data.readString();
1044 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1045 requireFull, name, callerPackage);
1046 reply.writeNoException();
1047 reply.writeInt(res);
1048 return true;
1049 }
1050
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001051 case SET_PROCESS_LIMIT_TRANSACTION: {
1052 data.enforceInterface(IActivityManager.descriptor);
1053 int max = data.readInt();
1054 setProcessLimit(max);
1055 reply.writeNoException();
1056 return true;
1057 }
1058
1059 case GET_PROCESS_LIMIT_TRANSACTION: {
1060 data.enforceInterface(IActivityManager.descriptor);
1061 int limit = getProcessLimit();
1062 reply.writeNoException();
1063 reply.writeInt(limit);
1064 return true;
1065 }
1066
1067 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1068 data.enforceInterface(IActivityManager.descriptor);
1069 IBinder token = data.readStrongBinder();
1070 int pid = data.readInt();
1071 boolean isForeground = data.readInt() != 0;
1072 setProcessForeground(token, pid, isForeground);
1073 reply.writeNoException();
1074 return true;
1075 }
1076
1077 case CHECK_PERMISSION_TRANSACTION: {
1078 data.enforceInterface(IActivityManager.descriptor);
1079 String perm = data.readString();
1080 int pid = data.readInt();
1081 int uid = data.readInt();
1082 int res = checkPermission(perm, pid, uid);
1083 reply.writeNoException();
1084 reply.writeInt(res);
1085 return true;
1086 }
1087
1088 case CHECK_URI_PERMISSION_TRANSACTION: {
1089 data.enforceInterface(IActivityManager.descriptor);
1090 Uri uri = Uri.CREATOR.createFromParcel(data);
1091 int pid = data.readInt();
1092 int uid = data.readInt();
1093 int mode = data.readInt();
1094 int res = checkUriPermission(uri, pid, uid, mode);
1095 reply.writeNoException();
1096 reply.writeInt(res);
1097 return true;
1098 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001099
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001101 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001102 String packageName = data.readString();
1103 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1104 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001105 int userId = data.readInt();
1106 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 reply.writeNoException();
1108 reply.writeInt(res ? 1 : 0);
1109 return true;
1110 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001111
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001112 case GRANT_URI_PERMISSION_TRANSACTION: {
1113 data.enforceInterface(IActivityManager.descriptor);
1114 IBinder b = data.readStrongBinder();
1115 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1116 String targetPkg = data.readString();
1117 Uri uri = Uri.CREATOR.createFromParcel(data);
1118 int mode = data.readInt();
1119 grantUriPermission(app, targetPkg, uri, mode);
1120 reply.writeNoException();
1121 return true;
1122 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001123
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001124 case REVOKE_URI_PERMISSION_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 IBinder b = data.readStrongBinder();
1127 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1128 Uri uri = Uri.CREATOR.createFromParcel(data);
1129 int mode = data.readInt();
1130 revokeUriPermission(app, uri, mode);
1131 reply.writeNoException();
1132 return true;
1133 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001134
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001135 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 Uri uri = Uri.CREATOR.createFromParcel(data);
1138 int mode = data.readInt();
1139 takePersistableUriPermission(uri, mode);
1140 reply.writeNoException();
1141 return true;
1142 }
1143
1144 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 Uri uri = Uri.CREATOR.createFromParcel(data);
1147 int mode = data.readInt();
1148 releasePersistableUriPermission(uri, mode);
1149 reply.writeNoException();
1150 return true;
1151 }
1152
1153 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions();
1156 reply.writeNoException();
1157 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1158 return true;
1159 }
1160
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 IBinder b = data.readStrongBinder();
1164 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1165 boolean waiting = data.readInt() != 0;
1166 showWaitingForDebugger(app, waiting);
1167 reply.writeNoException();
1168 return true;
1169 }
1170
1171 case GET_MEMORY_INFO_TRANSACTION: {
1172 data.enforceInterface(IActivityManager.descriptor);
1173 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1174 getMemoryInfo(mi);
1175 reply.writeNoException();
1176 mi.writeToParcel(reply, 0);
1177 return true;
1178 }
1179
1180 case UNHANDLED_BACK_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 unhandledBack();
1183 reply.writeNoException();
1184 return true;
1185 }
1186
1187 case OPEN_CONTENT_URI_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 Uri uri = Uri.parse(data.readString());
1190 ParcelFileDescriptor pfd = openContentUri(uri);
1191 reply.writeNoException();
1192 if (pfd != null) {
1193 reply.writeInt(1);
1194 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1195 } else {
1196 reply.writeInt(0);
1197 }
1198 return true;
1199 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001201 case GOING_TO_SLEEP_TRANSACTION: {
1202 data.enforceInterface(IActivityManager.descriptor);
1203 goingToSleep();
1204 reply.writeNoException();
1205 return true;
1206 }
1207
1208 case WAKING_UP_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 wakingUp();
1211 reply.writeNoException();
1212 return true;
1213 }
1214
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001215 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1216 data.enforceInterface(IActivityManager.descriptor);
1217 setLockScreenShown(data.readInt() != 0);
1218 reply.writeNoException();
1219 return true;
1220 }
1221
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 case SET_DEBUG_APP_TRANSACTION: {
1223 data.enforceInterface(IActivityManager.descriptor);
1224 String pn = data.readString();
1225 boolean wfd = data.readInt() != 0;
1226 boolean per = data.readInt() != 0;
1227 setDebugApp(pn, wfd, per);
1228 reply.writeNoException();
1229 return true;
1230 }
1231
1232 case SET_ALWAYS_FINISH_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 boolean enabled = data.readInt() != 0;
1235 setAlwaysFinish(enabled);
1236 reply.writeNoException();
1237 return true;
1238 }
1239
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001240 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001242 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001243 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001244 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001245 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 return true;
1247 }
1248
1249 case ENTER_SAFE_MODE_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 enterSafeMode();
1252 reply.writeNoException();
1253 return true;
1254 }
1255
1256 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1257 data.enforceInterface(IActivityManager.descriptor);
1258 IIntentSender is = IIntentSender.Stub.asInterface(
1259 data.readStrongBinder());
1260 noteWakeupAlarm(is);
1261 reply.writeNoException();
1262 return true;
1263 }
1264
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001265 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001266 data.enforceInterface(IActivityManager.descriptor);
1267 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001268 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001269 boolean secure = data.readInt() != 0;
1270 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 reply.writeNoException();
1272 reply.writeInt(res ? 1 : 0);
1273 return true;
1274 }
1275
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001276 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1277 data.enforceInterface(IActivityManager.descriptor);
1278 String reason = data.readString();
1279 boolean res = killProcessesBelowForeground(reason);
1280 reply.writeNoException();
1281 reply.writeInt(res ? 1 : 0);
1282 return true;
1283 }
1284
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 case START_RUNNING_TRANSACTION: {
1286 data.enforceInterface(IActivityManager.descriptor);
1287 String pkg = data.readString();
1288 String cls = data.readString();
1289 String action = data.readString();
1290 String indata = data.readString();
1291 startRunning(pkg, cls, action, indata);
1292 reply.writeNoException();
1293 return true;
1294 }
1295
Dan Egnor60d87622009-12-16 16:32:58 -08001296 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 IBinder app = data.readStrongBinder();
1299 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1300 handleApplicationCrash(app, ci);
1301 reply.writeNoException();
1302 return true;
1303 }
1304
1305 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001306 data.enforceInterface(IActivityManager.descriptor);
1307 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001308 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001309 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001310 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001311 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001312 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001313 return true;
1314 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001315
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001316 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001319 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001320 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1321 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001322 reply.writeNoException();
1323 return true;
1324 }
1325
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001326 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 int sig = data.readInt();
1329 signalPersistentProcesses(sig);
1330 reply.writeNoException();
1331 return true;
1332 }
1333
Dianne Hackborn03abb812010-01-04 18:43:19 -08001334 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001337 int userId = data.readInt();
1338 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001339 reply.writeNoException();
1340 return true;
1341 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001342
1343 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
1345 killAllBackgroundProcesses();
1346 reply.writeNoException();
1347 return true;
1348 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001349
Dianne Hackborn03abb812010-01-04 18:43:19 -08001350 case FORCE_STOP_PACKAGE_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001353 int userId = data.readInt();
1354 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001355 reply.writeNoException();
1356 return true;
1357 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001358
1359 case GET_MY_MEMORY_STATE_TRANSACTION: {
1360 data.enforceInterface(IActivityManager.descriptor);
1361 ActivityManager.RunningAppProcessInfo info =
1362 new ActivityManager.RunningAppProcessInfo();
1363 getMyMemoryState(info);
1364 reply.writeNoException();
1365 info.writeToParcel(reply, 0);
1366 return true;
1367 }
1368
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001369 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1370 data.enforceInterface(IActivityManager.descriptor);
1371 ConfigurationInfo config = getDeviceConfigurationInfo();
1372 reply.writeNoException();
1373 config.writeToParcel(reply, 0);
1374 return true;
1375 }
1376
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001377 case PROFILE_CONTROL_TRANSACTION: {
1378 data.enforceInterface(IActivityManager.descriptor);
1379 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001380 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001381 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001382 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001383 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001384 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001385 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001386 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001387 reply.writeNoException();
1388 reply.writeInt(res ? 1 : 0);
1389 return true;
1390 }
1391
Dianne Hackborn55280a92009-05-07 15:53:46 -07001392 case SHUTDOWN_TRANSACTION: {
1393 data.enforceInterface(IActivityManager.descriptor);
1394 boolean res = shutdown(data.readInt());
1395 reply.writeNoException();
1396 reply.writeInt(res ? 1 : 0);
1397 return true;
1398 }
1399
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001400 case STOP_APP_SWITCHES_TRANSACTION: {
1401 data.enforceInterface(IActivityManager.descriptor);
1402 stopAppSwitches();
1403 reply.writeNoException();
1404 return true;
1405 }
1406
1407 case RESUME_APP_SWITCHES_TRANSACTION: {
1408 data.enforceInterface(IActivityManager.descriptor);
1409 resumeAppSwitches();
1410 reply.writeNoException();
1411 return true;
1412 }
1413
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001414 case PEEK_SERVICE_TRANSACTION: {
1415 data.enforceInterface(IActivityManager.descriptor);
1416 Intent service = Intent.CREATOR.createFromParcel(data);
1417 String resolvedType = data.readString();
1418 IBinder binder = peekService(service, resolvedType);
1419 reply.writeNoException();
1420 reply.writeStrongBinder(binder);
1421 return true;
1422 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001423
1424 case START_BACKUP_AGENT_TRANSACTION: {
1425 data.enforceInterface(IActivityManager.descriptor);
1426 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1427 int backupRestoreMode = data.readInt();
1428 boolean success = bindBackupAgent(info, backupRestoreMode);
1429 reply.writeNoException();
1430 reply.writeInt(success ? 1 : 0);
1431 return true;
1432 }
1433
1434 case BACKUP_AGENT_CREATED_TRANSACTION: {
1435 data.enforceInterface(IActivityManager.descriptor);
1436 String packageName = data.readString();
1437 IBinder agent = data.readStrongBinder();
1438 backupAgentCreated(packageName, agent);
1439 reply.writeNoException();
1440 return true;
1441 }
1442
1443 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1444 data.enforceInterface(IActivityManager.descriptor);
1445 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1446 unbindBackupAgent(info);
1447 reply.writeNoException();
1448 return true;
1449 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001450
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001451 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001452 data.enforceInterface(IActivityManager.descriptor);
1453 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001454 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001455 String reason = data.readString();
1456 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001457 reply.writeNoException();
1458 return true;
1459 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001460
1461 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 String reason = data.readString();
1464 closeSystemDialogs(reason);
1465 reply.writeNoException();
1466 return true;
1467 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001468
1469 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001471 int[] pids = data.createIntArray();
1472 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001473 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001474 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001475 return true;
1476 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001477
1478 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 String processName = data.readString();
1481 int uid = data.readInt();
1482 killApplicationProcess(processName, uid);
1483 reply.writeNoException();
1484 return true;
1485 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001486
1487 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
1489 IBinder token = data.readStrongBinder();
1490 String packageName = data.readString();
1491 int enterAnim = data.readInt();
1492 int exitAnim = data.readInt();
1493 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001494 reply.writeNoException();
1495 return true;
1496 }
1497
1498 case IS_USER_A_MONKEY_TRANSACTION: {
1499 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001500 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001501 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001502 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001503 return true;
1504 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001505
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001506 case SET_USER_IS_MONKEY_TRANSACTION: {
1507 data.enforceInterface(IActivityManager.descriptor);
1508 final boolean monkey = (data.readInt() == 1);
1509 setUserIsMonkey(monkey);
1510 reply.writeNoException();
1511 return true;
1512 }
1513
Dianne Hackborn860755f2010-06-03 18:47:52 -07001514 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1515 data.enforceInterface(IActivityManager.descriptor);
1516 finishHeavyWeightApp();
1517 reply.writeNoException();
1518 return true;
1519 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001520
1521 case IS_IMMERSIVE_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001524 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001525 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001526 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001527 return true;
1528 }
1529
Craig Mautner5eda9b32013-07-02 11:58:16 -07001530 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001531 data.enforceInterface(IActivityManager.descriptor);
1532 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001533 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001534 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001535 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001536 return true;
1537 }
1538
1539 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1540 data.enforceInterface(IActivityManager.descriptor);
1541 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001542 boolean converted = convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001543 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001544 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001545 return true;
1546 }
1547
Daniel Sandler69a48172010-06-23 16:29:36 -04001548 case SET_IMMERSIVE_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 IBinder token = data.readStrongBinder();
1551 boolean imm = data.readInt() == 1;
1552 setImmersive(token, imm);
1553 reply.writeNoException();
1554 return true;
1555 }
1556
1557 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1558 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001559 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001560 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001561 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001562 return true;
1563 }
1564
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001565 case CRASH_APPLICATION_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 int uid = data.readInt();
1568 int initialPid = data.readInt();
1569 String packageName = data.readString();
1570 String message = data.readString();
1571 crashApplication(uid, initialPid, packageName, message);
1572 reply.writeNoException();
1573 return true;
1574 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001575
1576 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001579 int userId = data.readInt();
1580 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001581 reply.writeNoException();
1582 reply.writeString(type);
1583 return true;
1584 }
1585
Dianne Hackborn7e269642010-08-25 19:50:20 -07001586 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1587 data.enforceInterface(IActivityManager.descriptor);
1588 String name = data.readString();
1589 IBinder perm = newUriPermissionOwner(name);
1590 reply.writeNoException();
1591 reply.writeStrongBinder(perm);
1592 return true;
1593 }
1594
1595 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1596 data.enforceInterface(IActivityManager.descriptor);
1597 IBinder owner = data.readStrongBinder();
1598 int fromUid = data.readInt();
1599 String targetPkg = data.readString();
1600 Uri uri = Uri.CREATOR.createFromParcel(data);
1601 int mode = data.readInt();
1602 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1603 reply.writeNoException();
1604 return true;
1605 }
1606
1607 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 IBinder owner = data.readStrongBinder();
1610 Uri uri = null;
1611 if (data.readInt() != 0) {
1612 Uri.CREATOR.createFromParcel(data);
1613 }
1614 int mode = data.readInt();
1615 revokeUriPermissionFromOwner(owner, uri, mode);
1616 reply.writeNoException();
1617 return true;
1618 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001619
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001620 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1621 data.enforceInterface(IActivityManager.descriptor);
1622 int callingUid = data.readInt();
1623 String targetPkg = data.readString();
1624 Uri uri = Uri.CREATOR.createFromParcel(data);
1625 int modeFlags = data.readInt();
1626 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1627 reply.writeNoException();
1628 reply.writeInt(res);
1629 return true;
1630 }
1631
Andy McFadden824c5102010-07-09 16:26:57 -07001632 case DUMP_HEAP_TRANSACTION: {
1633 data.enforceInterface(IActivityManager.descriptor);
1634 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001635 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001636 boolean managed = data.readInt() != 0;
1637 String path = data.readString();
1638 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001639 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001640 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001641 reply.writeNoException();
1642 reply.writeInt(res ? 1 : 0);
1643 return true;
1644 }
1645
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001646 case START_ACTIVITIES_TRANSACTION:
1647 {
1648 data.enforceInterface(IActivityManager.descriptor);
1649 IBinder b = data.readStrongBinder();
1650 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001651 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001652 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1653 String[] resolvedTypes = data.createStringArray();
1654 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001655 Bundle options = data.readInt() != 0
1656 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001657 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001658 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001659 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001660 reply.writeNoException();
1661 reply.writeInt(result);
1662 return true;
1663 }
1664
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001665 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1666 {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 int mode = getFrontActivityScreenCompatMode();
1669 reply.writeNoException();
1670 reply.writeInt(mode);
1671 return true;
1672 }
1673
1674 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1675 {
1676 data.enforceInterface(IActivityManager.descriptor);
1677 int mode = data.readInt();
1678 setFrontActivityScreenCompatMode(mode);
1679 reply.writeNoException();
1680 reply.writeInt(mode);
1681 return true;
1682 }
1683
1684 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1685 {
1686 data.enforceInterface(IActivityManager.descriptor);
1687 String pkg = data.readString();
1688 int mode = getPackageScreenCompatMode(pkg);
1689 reply.writeNoException();
1690 reply.writeInt(mode);
1691 return true;
1692 }
1693
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001694 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1695 {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001698 int mode = data.readInt();
1699 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001700 reply.writeNoException();
1701 return true;
1702 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001703
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001704 case SWITCH_USER_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 int userid = data.readInt();
1707 boolean result = switchUser(userid);
1708 reply.writeNoException();
1709 reply.writeInt(result ? 1 : 0);
1710 return true;
1711 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001712
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001713 case STOP_USER_TRANSACTION: {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 int userid = data.readInt();
1716 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1717 data.readStrongBinder());
1718 int result = stopUser(userid, callback);
1719 reply.writeNoException();
1720 reply.writeInt(result);
1721 return true;
1722 }
1723
Amith Yamasani52f1d752012-03-28 18:19:29 -07001724 case GET_CURRENT_USER_TRANSACTION: {
1725 data.enforceInterface(IActivityManager.descriptor);
1726 UserInfo userInfo = getCurrentUser();
1727 reply.writeNoException();
1728 userInfo.writeToParcel(reply, 0);
1729 return true;
1730 }
1731
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001732 case IS_USER_RUNNING_TRANSACTION: {
1733 data.enforceInterface(IActivityManager.descriptor);
1734 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001735 boolean orStopping = data.readInt() != 0;
1736 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001737 reply.writeNoException();
1738 reply.writeInt(result ? 1 : 0);
1739 return true;
1740 }
1741
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001742 case GET_RUNNING_USER_IDS_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 int[] result = getRunningUserIds();
1745 reply.writeNoException();
1746 reply.writeIntArray(result);
1747 return true;
1748 }
1749
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001750 case REMOVE_SUB_TASK_TRANSACTION:
1751 {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 int taskId = data.readInt();
1754 int subTaskIndex = data.readInt();
1755 boolean result = removeSubTask(taskId, subTaskIndex);
1756 reply.writeNoException();
1757 reply.writeInt(result ? 1 : 0);
1758 return true;
1759 }
1760
1761 case REMOVE_TASK_TRANSACTION:
1762 {
1763 data.enforceInterface(IActivityManager.descriptor);
1764 int taskId = data.readInt();
1765 int fl = data.readInt();
1766 boolean result = removeTask(taskId, fl);
1767 reply.writeNoException();
1768 reply.writeInt(result ? 1 : 0);
1769 return true;
1770 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001771
Jeff Sharkeya4620792011-05-20 15:29:23 -07001772 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1773 data.enforceInterface(IActivityManager.descriptor);
1774 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1775 data.readStrongBinder());
1776 registerProcessObserver(observer);
1777 return true;
1778 }
1779
1780 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1783 data.readStrongBinder());
1784 unregisterProcessObserver(observer);
1785 return true;
1786 }
1787
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001788 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1789 {
1790 data.enforceInterface(IActivityManager.descriptor);
1791 String pkg = data.readString();
1792 boolean ask = getPackageAskScreenCompat(pkg);
1793 reply.writeNoException();
1794 reply.writeInt(ask ? 1 : 0);
1795 return true;
1796 }
1797
1798 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1799 {
1800 data.enforceInterface(IActivityManager.descriptor);
1801 String pkg = data.readString();
1802 boolean ask = data.readInt() != 0;
1803 setPackageAskScreenCompat(pkg, ask);
1804 reply.writeNoException();
1805 return true;
1806 }
1807
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001808 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1809 data.enforceInterface(IActivityManager.descriptor);
1810 IIntentSender r = IIntentSender.Stub.asInterface(
1811 data.readStrongBinder());
1812 boolean res = isIntentSenderTargetedToPackage(r);
1813 reply.writeNoException();
1814 reply.writeInt(res ? 1 : 0);
1815 return true;
1816 }
1817
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001818 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1819 data.enforceInterface(IActivityManager.descriptor);
1820 IIntentSender r = IIntentSender.Stub.asInterface(
1821 data.readStrongBinder());
1822 boolean res = isIntentSenderAnActivity(r);
1823 reply.writeNoException();
1824 reply.writeInt(res ? 1 : 0);
1825 return true;
1826 }
1827
Dianne Hackborn81038902012-11-26 17:04:09 -08001828 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1829 data.enforceInterface(IActivityManager.descriptor);
1830 IIntentSender r = IIntentSender.Stub.asInterface(
1831 data.readStrongBinder());
1832 Intent intent = getIntentForIntentSender(r);
1833 reply.writeNoException();
1834 if (intent != null) {
1835 reply.writeInt(1);
1836 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1837 } else {
1838 reply.writeInt(0);
1839 }
1840 return true;
1841 }
1842
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001843 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1844 data.enforceInterface(IActivityManager.descriptor);
1845 Configuration config = Configuration.CREATOR.createFromParcel(data);
1846 updatePersistentConfiguration(config);
1847 reply.writeNoException();
1848 return true;
1849 }
1850
Dianne Hackbornb437e092011-08-05 17:50:29 -07001851 case GET_PROCESS_PSS_TRANSACTION: {
1852 data.enforceInterface(IActivityManager.descriptor);
1853 int[] pids = data.createIntArray();
1854 long[] pss = getProcessPss(pids);
1855 reply.writeNoException();
1856 reply.writeLongArray(pss);
1857 return true;
1858 }
1859
Dianne Hackborn661cd522011-08-22 00:26:20 -07001860 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1861 data.enforceInterface(IActivityManager.descriptor);
1862 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1863 boolean always = data.readInt() != 0;
1864 showBootMessage(msg, always);
1865 reply.writeNoException();
1866 return true;
1867 }
1868
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001869 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1870 data.enforceInterface(IActivityManager.descriptor);
1871 dismissKeyguardOnNextActivity();
1872 reply.writeNoException();
1873 return true;
1874 }
1875
Adam Powelldd8fab22012-03-22 17:47:27 -07001876 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1877 data.enforceInterface(IActivityManager.descriptor);
1878 IBinder token = data.readStrongBinder();
1879 String destAffinity = data.readString();
1880 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1881 reply.writeNoException();
1882 reply.writeInt(res ? 1 : 0);
1883 return true;
1884 }
1885
1886 case NAVIGATE_UP_TO_TRANSACTION: {
1887 data.enforceInterface(IActivityManager.descriptor);
1888 IBinder token = data.readStrongBinder();
1889 Intent target = Intent.CREATOR.createFromParcel(data);
1890 int resultCode = data.readInt();
1891 Intent resultData = null;
1892 if (data.readInt() != 0) {
1893 resultData = Intent.CREATOR.createFromParcel(data);
1894 }
1895 boolean res = navigateUpTo(token, target, resultCode, resultData);
1896 reply.writeNoException();
1897 reply.writeInt(res ? 1 : 0);
1898 return true;
1899 }
1900
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001901 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 IBinder token = data.readStrongBinder();
1904 int res = getLaunchedFromUid(token);
1905 reply.writeNoException();
1906 reply.writeInt(res);
1907 return true;
1908 }
1909
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001910 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 IBinder token = data.readStrongBinder();
1913 String res = getLaunchedFromPackage(token);
1914 reply.writeNoException();
1915 reply.writeString(res);
1916 return true;
1917 }
1918
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001919 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1920 data.enforceInterface(IActivityManager.descriptor);
1921 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1922 data.readStrongBinder());
1923 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001924 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001925 return true;
1926 }
1927
1928 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1929 data.enforceInterface(IActivityManager.descriptor);
1930 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1931 data.readStrongBinder());
1932 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001933 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001934 return true;
1935 }
1936
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001937 case REQUEST_BUG_REPORT_TRANSACTION: {
1938 data.enforceInterface(IActivityManager.descriptor);
1939 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001940 reply.writeNoException();
1941 return true;
1942 }
1943
1944 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1945 data.enforceInterface(IActivityManager.descriptor);
1946 int pid = data.readInt();
1947 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001948 String reason = data.readString();
1949 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001950 reply.writeNoException();
1951 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001952 return true;
1953 }
1954
Adam Skorydfc7fd72013-08-05 19:23:41 -07001955 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001956 data.enforceInterface(IActivityManager.descriptor);
1957 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001958 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001959 reply.writeNoException();
1960 reply.writeBundle(res);
1961 return true;
1962 }
1963
Adam Skorydfc7fd72013-08-05 19:23:41 -07001964 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001965 data.enforceInterface(IActivityManager.descriptor);
1966 IBinder token = data.readStrongBinder();
1967 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01001968 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001969 reply.writeNoException();
1970 return true;
1971 }
1972
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001973 case KILL_UID_TRANSACTION: {
1974 data.enforceInterface(IActivityManager.descriptor);
1975 int uid = data.readInt();
1976 String reason = data.readString();
1977 killUid(uid, reason);
1978 reply.writeNoException();
1979 return true;
1980 }
1981
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07001982 case HANG_TRANSACTION: {
1983 data.enforceInterface(IActivityManager.descriptor);
1984 IBinder who = data.readStrongBinder();
1985 boolean allowRestart = data.readInt() != 0;
1986 hang(who, allowRestart);
1987 reply.writeNoException();
1988 return true;
1989 }
1990
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07001991 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
1992 data.enforceInterface(IActivityManager.descriptor);
1993 IBinder token = data.readStrongBinder();
1994 reportActivityFullyDrawn(token);
1995 reply.writeNoException();
1996 return true;
1997 }
1998
Craig Mautner5eda9b32013-07-02 11:58:16 -07001999 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2000 data.enforceInterface(IActivityManager.descriptor);
2001 IBinder token = data.readStrongBinder();
2002 notifyActivityDrawn(token);
2003 reply.writeNoException();
2004 return true;
2005 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002006
2007 case RESTART_TRANSACTION: {
2008 data.enforceInterface(IActivityManager.descriptor);
2009 restart();
2010 reply.writeNoException();
2011 return true;
2012 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002013
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002014 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2015 data.enforceInterface(IActivityManager.descriptor);
2016 performIdleMaintenance();
2017 reply.writeNoException();
2018 return true;
2019 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002020 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002021
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002022 return super.onTransact(code, data, reply, flags);
2023 }
2024
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002025 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002026 return this;
2027 }
2028
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002029 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2030 protected IActivityManager create() {
2031 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002032 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002033 Log.v("ActivityManager", "default service binder = " + b);
2034 }
2035 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002036 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002037 Log.v("ActivityManager", "default service = " + am);
2038 }
2039 return am;
2040 }
2041 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002042}
2043
2044class ActivityManagerProxy implements IActivityManager
2045{
2046 public ActivityManagerProxy(IBinder remote)
2047 {
2048 mRemote = remote;
2049 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002050
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002051 public IBinder asBinder()
2052 {
2053 return mRemote;
2054 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002055
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002056 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002057 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2058 int startFlags, String profileFile,
2059 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002060 Parcel data = Parcel.obtain();
2061 Parcel reply = Parcel.obtain();
2062 data.writeInterfaceToken(IActivityManager.descriptor);
2063 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002064 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002065 intent.writeToParcel(data, 0);
2066 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002067 data.writeStrongBinder(resultTo);
2068 data.writeString(resultWho);
2069 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002070 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002071 data.writeString(profileFile);
2072 if (profileFd != null) {
2073 data.writeInt(1);
2074 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2075 } else {
2076 data.writeInt(0);
2077 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002078 if (options != null) {
2079 data.writeInt(1);
2080 options.writeToParcel(data, 0);
2081 } else {
2082 data.writeInt(0);
2083 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002084 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2085 reply.readException();
2086 int result = reply.readInt();
2087 reply.recycle();
2088 data.recycle();
2089 return result;
2090 }
Amith Yamasani82644082012-08-03 13:09:11 -07002091
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002092 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002093 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2094 int startFlags, String profileFile,
2095 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2096 Parcel data = Parcel.obtain();
2097 Parcel reply = Parcel.obtain();
2098 data.writeInterfaceToken(IActivityManager.descriptor);
2099 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002100 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002101 intent.writeToParcel(data, 0);
2102 data.writeString(resolvedType);
2103 data.writeStrongBinder(resultTo);
2104 data.writeString(resultWho);
2105 data.writeInt(requestCode);
2106 data.writeInt(startFlags);
2107 data.writeString(profileFile);
2108 if (profileFd != null) {
2109 data.writeInt(1);
2110 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2111 } else {
2112 data.writeInt(0);
2113 }
2114 if (options != null) {
2115 data.writeInt(1);
2116 options.writeToParcel(data, 0);
2117 } else {
2118 data.writeInt(0);
2119 }
2120 data.writeInt(userId);
2121 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2122 reply.readException();
2123 int result = reply.readInt();
2124 reply.recycle();
2125 data.recycle();
2126 return result;
2127 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002128 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2129 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002130 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002131 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002132 Parcel data = Parcel.obtain();
2133 Parcel reply = Parcel.obtain();
2134 data.writeInterfaceToken(IActivityManager.descriptor);
2135 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002136 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002137 intent.writeToParcel(data, 0);
2138 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002139 data.writeStrongBinder(resultTo);
2140 data.writeString(resultWho);
2141 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002142 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002143 data.writeString(profileFile);
2144 if (profileFd != null) {
2145 data.writeInt(1);
2146 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2147 } else {
2148 data.writeInt(0);
2149 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002150 if (options != null) {
2151 data.writeInt(1);
2152 options.writeToParcel(data, 0);
2153 } else {
2154 data.writeInt(0);
2155 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002156 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002157 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2158 reply.readException();
2159 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2160 reply.recycle();
2161 data.recycle();
2162 return result;
2163 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002164 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2165 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002166 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002167 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002168 Parcel data = Parcel.obtain();
2169 Parcel reply = Parcel.obtain();
2170 data.writeInterfaceToken(IActivityManager.descriptor);
2171 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002172 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002173 intent.writeToParcel(data, 0);
2174 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002175 data.writeStrongBinder(resultTo);
2176 data.writeString(resultWho);
2177 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002178 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002179 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002180 if (options != null) {
2181 data.writeInt(1);
2182 options.writeToParcel(data, 0);
2183 } else {
2184 data.writeInt(0);
2185 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002186 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002187 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2188 reply.readException();
2189 int result = reply.readInt();
2190 reply.recycle();
2191 data.recycle();
2192 return result;
2193 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002194 public int startActivityIntentSender(IApplicationThread caller,
2195 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002196 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002197 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002198 Parcel data = Parcel.obtain();
2199 Parcel reply = Parcel.obtain();
2200 data.writeInterfaceToken(IActivityManager.descriptor);
2201 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2202 intent.writeToParcel(data, 0);
2203 if (fillInIntent != null) {
2204 data.writeInt(1);
2205 fillInIntent.writeToParcel(data, 0);
2206 } else {
2207 data.writeInt(0);
2208 }
2209 data.writeString(resolvedType);
2210 data.writeStrongBinder(resultTo);
2211 data.writeString(resultWho);
2212 data.writeInt(requestCode);
2213 data.writeInt(flagsMask);
2214 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002215 if (options != null) {
2216 data.writeInt(1);
2217 options.writeToParcel(data, 0);
2218 } else {
2219 data.writeInt(0);
2220 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002221 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002222 reply.readException();
2223 int result = reply.readInt();
2224 reply.recycle();
2225 data.recycle();
2226 return result;
2227 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002228 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002229 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002230 Parcel data = Parcel.obtain();
2231 Parcel reply = Parcel.obtain();
2232 data.writeInterfaceToken(IActivityManager.descriptor);
2233 data.writeStrongBinder(callingActivity);
2234 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002235 if (options != null) {
2236 data.writeInt(1);
2237 options.writeToParcel(data, 0);
2238 } else {
2239 data.writeInt(0);
2240 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002241 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2242 reply.readException();
2243 int result = reply.readInt();
2244 reply.recycle();
2245 data.recycle();
2246 return result != 0;
2247 }
2248 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2249 throws RemoteException {
2250 Parcel data = Parcel.obtain();
2251 Parcel reply = Parcel.obtain();
2252 data.writeInterfaceToken(IActivityManager.descriptor);
2253 data.writeStrongBinder(token);
2254 data.writeInt(resultCode);
2255 if (resultData != null) {
2256 data.writeInt(1);
2257 resultData.writeToParcel(data, 0);
2258 } else {
2259 data.writeInt(0);
2260 }
2261 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2262 reply.readException();
2263 boolean res = reply.readInt() != 0;
2264 data.recycle();
2265 reply.recycle();
2266 return res;
2267 }
2268 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2269 {
2270 Parcel data = Parcel.obtain();
2271 Parcel reply = Parcel.obtain();
2272 data.writeInterfaceToken(IActivityManager.descriptor);
2273 data.writeStrongBinder(token);
2274 data.writeString(resultWho);
2275 data.writeInt(requestCode);
2276 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2277 reply.readException();
2278 data.recycle();
2279 reply.recycle();
2280 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002281 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2282 Parcel data = Parcel.obtain();
2283 Parcel reply = Parcel.obtain();
2284 data.writeInterfaceToken(IActivityManager.descriptor);
2285 data.writeStrongBinder(token);
2286 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2287 reply.readException();
2288 boolean res = reply.readInt() != 0;
2289 data.recycle();
2290 reply.recycle();
2291 return res;
2292 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002293 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2294 Parcel data = Parcel.obtain();
2295 Parcel reply = Parcel.obtain();
2296 data.writeInterfaceToken(IActivityManager.descriptor);
2297 data.writeStrongBinder(token);
2298 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2299 reply.readException();
2300 boolean res = reply.readInt() != 0;
2301 data.recycle();
2302 reply.recycle();
2303 return res;
2304 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002305 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002306 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002307 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002308 {
2309 Parcel data = Parcel.obtain();
2310 Parcel reply = Parcel.obtain();
2311 data.writeInterfaceToken(IActivityManager.descriptor);
2312 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002313 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002314 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2315 filter.writeToParcel(data, 0);
2316 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002317 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002318 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2319 reply.readException();
2320 Intent intent = null;
2321 int haveIntent = reply.readInt();
2322 if (haveIntent != 0) {
2323 intent = Intent.CREATOR.createFromParcel(reply);
2324 }
2325 reply.recycle();
2326 data.recycle();
2327 return intent;
2328 }
2329 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2330 {
2331 Parcel data = Parcel.obtain();
2332 Parcel reply = Parcel.obtain();
2333 data.writeInterfaceToken(IActivityManager.descriptor);
2334 data.writeStrongBinder(receiver.asBinder());
2335 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2336 reply.readException();
2337 data.recycle();
2338 reply.recycle();
2339 }
2340 public int broadcastIntent(IApplicationThread caller,
2341 Intent intent, String resolvedType, IIntentReceiver resultTo,
2342 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002343 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002344 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 {
2346 Parcel data = Parcel.obtain();
2347 Parcel reply = Parcel.obtain();
2348 data.writeInterfaceToken(IActivityManager.descriptor);
2349 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2350 intent.writeToParcel(data, 0);
2351 data.writeString(resolvedType);
2352 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2353 data.writeInt(resultCode);
2354 data.writeString(resultData);
2355 data.writeBundle(map);
2356 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002357 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002358 data.writeInt(serialized ? 1 : 0);
2359 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002360 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002361 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2362 reply.readException();
2363 int res = reply.readInt();
2364 reply.recycle();
2365 data.recycle();
2366 return res;
2367 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002368 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2369 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002370 {
2371 Parcel data = Parcel.obtain();
2372 Parcel reply = Parcel.obtain();
2373 data.writeInterfaceToken(IActivityManager.descriptor);
2374 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2375 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002376 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2378 reply.readException();
2379 data.recycle();
2380 reply.recycle();
2381 }
2382 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2383 {
2384 Parcel data = Parcel.obtain();
2385 Parcel reply = Parcel.obtain();
2386 data.writeInterfaceToken(IActivityManager.descriptor);
2387 data.writeStrongBinder(who);
2388 data.writeInt(resultCode);
2389 data.writeString(resultData);
2390 data.writeBundle(map);
2391 data.writeInt(abortBroadcast ? 1 : 0);
2392 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2393 reply.readException();
2394 data.recycle();
2395 reply.recycle();
2396 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002397 public void attachApplication(IApplicationThread app) throws RemoteException
2398 {
2399 Parcel data = Parcel.obtain();
2400 Parcel reply = Parcel.obtain();
2401 data.writeInterfaceToken(IActivityManager.descriptor);
2402 data.writeStrongBinder(app.asBinder());
2403 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2404 reply.readException();
2405 data.recycle();
2406 reply.recycle();
2407 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002408 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2409 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002410 {
2411 Parcel data = Parcel.obtain();
2412 Parcel reply = Parcel.obtain();
2413 data.writeInterfaceToken(IActivityManager.descriptor);
2414 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002415 if (config != null) {
2416 data.writeInt(1);
2417 config.writeToParcel(data, 0);
2418 } else {
2419 data.writeInt(0);
2420 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002421 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002422 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2423 reply.readException();
2424 data.recycle();
2425 reply.recycle();
2426 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002427 public void activityResumed(IBinder token) throws RemoteException
2428 {
2429 Parcel data = Parcel.obtain();
2430 Parcel reply = Parcel.obtain();
2431 data.writeInterfaceToken(IActivityManager.descriptor);
2432 data.writeStrongBinder(token);
2433 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2434 reply.readException();
2435 data.recycle();
2436 reply.recycle();
2437 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002438 public void activityPaused(IBinder token) throws RemoteException
2439 {
2440 Parcel data = Parcel.obtain();
2441 Parcel reply = Parcel.obtain();
2442 data.writeInterfaceToken(IActivityManager.descriptor);
2443 data.writeStrongBinder(token);
2444 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2445 reply.readException();
2446 data.recycle();
2447 reply.recycle();
2448 }
2449 public void activityStopped(IBinder token, Bundle state,
2450 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002451 {
2452 Parcel data = Parcel.obtain();
2453 Parcel reply = Parcel.obtain();
2454 data.writeInterfaceToken(IActivityManager.descriptor);
2455 data.writeStrongBinder(token);
2456 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002457 if (thumbnail != null) {
2458 data.writeInt(1);
2459 thumbnail.writeToParcel(data, 0);
2460 } else {
2461 data.writeInt(0);
2462 }
2463 TextUtils.writeToParcel(description, data, 0);
2464 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2465 reply.readException();
2466 data.recycle();
2467 reply.recycle();
2468 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002469 public void activitySlept(IBinder token) throws RemoteException
2470 {
2471 Parcel data = Parcel.obtain();
2472 Parcel reply = Parcel.obtain();
2473 data.writeInterfaceToken(IActivityManager.descriptor);
2474 data.writeStrongBinder(token);
2475 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2476 reply.readException();
2477 data.recycle();
2478 reply.recycle();
2479 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002480 public void activityDestroyed(IBinder token) throws RemoteException
2481 {
2482 Parcel data = Parcel.obtain();
2483 Parcel reply = Parcel.obtain();
2484 data.writeInterfaceToken(IActivityManager.descriptor);
2485 data.writeStrongBinder(token);
2486 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2487 reply.readException();
2488 data.recycle();
2489 reply.recycle();
2490 }
2491 public String getCallingPackage(IBinder token) throws RemoteException
2492 {
2493 Parcel data = Parcel.obtain();
2494 Parcel reply = Parcel.obtain();
2495 data.writeInterfaceToken(IActivityManager.descriptor);
2496 data.writeStrongBinder(token);
2497 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2498 reply.readException();
2499 String res = reply.readString();
2500 data.recycle();
2501 reply.recycle();
2502 return res;
2503 }
2504 public ComponentName getCallingActivity(IBinder token)
2505 throws RemoteException {
2506 Parcel data = Parcel.obtain();
2507 Parcel reply = Parcel.obtain();
2508 data.writeInterfaceToken(IActivityManager.descriptor);
2509 data.writeStrongBinder(token);
2510 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2511 reply.readException();
2512 ComponentName res = ComponentName.readFromParcel(reply);
2513 data.recycle();
2514 reply.recycle();
2515 return res;
2516 }
2517 public List getTasks(int maxNum, int flags,
2518 IThumbnailReceiver receiver) throws RemoteException {
2519 Parcel data = Parcel.obtain();
2520 Parcel reply = Parcel.obtain();
2521 data.writeInterfaceToken(IActivityManager.descriptor);
2522 data.writeInt(maxNum);
2523 data.writeInt(flags);
2524 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2525 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2526 reply.readException();
2527 ArrayList list = null;
2528 int N = reply.readInt();
2529 if (N >= 0) {
2530 list = new ArrayList();
2531 while (N > 0) {
2532 ActivityManager.RunningTaskInfo info =
2533 ActivityManager.RunningTaskInfo.CREATOR
2534 .createFromParcel(reply);
2535 list.add(info);
2536 N--;
2537 }
2538 }
2539 data.recycle();
2540 reply.recycle();
2541 return list;
2542 }
2543 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002544 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002545 Parcel data = Parcel.obtain();
2546 Parcel reply = Parcel.obtain();
2547 data.writeInterfaceToken(IActivityManager.descriptor);
2548 data.writeInt(maxNum);
2549 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002550 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002551 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2552 reply.readException();
2553 ArrayList<ActivityManager.RecentTaskInfo> list
2554 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2555 data.recycle();
2556 reply.recycle();
2557 return list;
2558 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002559 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002560 Parcel data = Parcel.obtain();
2561 Parcel reply = Parcel.obtain();
2562 data.writeInterfaceToken(IActivityManager.descriptor);
2563 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002564 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002565 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002566 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002567 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002568 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002569 }
2570 data.recycle();
2571 reply.recycle();
2572 return bm;
2573 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002574 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2575 Parcel data = Parcel.obtain();
2576 Parcel reply = Parcel.obtain();
2577 data.writeInterfaceToken(IActivityManager.descriptor);
2578 data.writeInt(id);
2579 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2580 reply.readException();
2581 Bitmap bm = null;
2582 if (reply.readInt() != 0) {
2583 bm = Bitmap.CREATOR.createFromParcel(reply);
2584 }
2585 data.recycle();
2586 reply.recycle();
2587 return bm;
2588 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002589 public List getServices(int maxNum, int flags) throws RemoteException {
2590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
2593 data.writeInt(maxNum);
2594 data.writeInt(flags);
2595 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2596 reply.readException();
2597 ArrayList list = null;
2598 int N = reply.readInt();
2599 if (N >= 0) {
2600 list = new ArrayList();
2601 while (N > 0) {
2602 ActivityManager.RunningServiceInfo info =
2603 ActivityManager.RunningServiceInfo.CREATOR
2604 .createFromParcel(reply);
2605 list.add(info);
2606 N--;
2607 }
2608 }
2609 data.recycle();
2610 reply.recycle();
2611 return list;
2612 }
2613 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2614 throws RemoteException {
2615 Parcel data = Parcel.obtain();
2616 Parcel reply = Parcel.obtain();
2617 data.writeInterfaceToken(IActivityManager.descriptor);
2618 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2619 reply.readException();
2620 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2621 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2622 data.recycle();
2623 reply.recycle();
2624 return list;
2625 }
2626 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2627 throws RemoteException {
2628 Parcel data = Parcel.obtain();
2629 Parcel reply = Parcel.obtain();
2630 data.writeInterfaceToken(IActivityManager.descriptor);
2631 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2632 reply.readException();
2633 ArrayList<ActivityManager.RunningAppProcessInfo> list
2634 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2635 data.recycle();
2636 reply.recycle();
2637 return list;
2638 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002639 public List<ApplicationInfo> getRunningExternalApplications()
2640 throws RemoteException {
2641 Parcel data = Parcel.obtain();
2642 Parcel reply = Parcel.obtain();
2643 data.writeInterfaceToken(IActivityManager.descriptor);
2644 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2645 reply.readException();
2646 ArrayList<ApplicationInfo> list
2647 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2648 data.recycle();
2649 reply.recycle();
2650 return list;
2651 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002652 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002653 {
2654 Parcel data = Parcel.obtain();
2655 Parcel reply = Parcel.obtain();
2656 data.writeInterfaceToken(IActivityManager.descriptor);
2657 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002658 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002659 if (options != null) {
2660 data.writeInt(1);
2661 options.writeToParcel(data, 0);
2662 } else {
2663 data.writeInt(0);
2664 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002665 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2666 reply.readException();
2667 data.recycle();
2668 reply.recycle();
2669 }
2670 public void moveTaskToBack(int task) throws RemoteException
2671 {
2672 Parcel data = Parcel.obtain();
2673 Parcel reply = Parcel.obtain();
2674 data.writeInterfaceToken(IActivityManager.descriptor);
2675 data.writeInt(task);
2676 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2677 reply.readException();
2678 data.recycle();
2679 reply.recycle();
2680 }
2681 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2682 throws RemoteException {
2683 Parcel data = Parcel.obtain();
2684 Parcel reply = Parcel.obtain();
2685 data.writeInterfaceToken(IActivityManager.descriptor);
2686 data.writeStrongBinder(token);
2687 data.writeInt(nonRoot ? 1 : 0);
2688 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2689 reply.readException();
2690 boolean res = reply.readInt() != 0;
2691 data.recycle();
2692 reply.recycle();
2693 return res;
2694 }
2695 public void moveTaskBackwards(int task) throws RemoteException
2696 {
2697 Parcel data = Parcel.obtain();
2698 Parcel reply = Parcel.obtain();
2699 data.writeInterfaceToken(IActivityManager.descriptor);
2700 data.writeInt(task);
2701 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2702 reply.readException();
2703 data.recycle();
2704 reply.recycle();
2705 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002706 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002707 public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002708 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002709 {
2710 Parcel data = Parcel.obtain();
2711 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002712 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002713 data.writeInt(taskId);
Craig Mautner5a449152013-05-24 15:49:29 -07002714 data.writeInt(relativeStackBoxId);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002715 data.writeInt(position);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002716 data.writeFloat(weight);
2717 mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 int res = reply.readInt();
2720 data.recycle();
2721 reply.recycle();
2722 return res;
2723 }
2724 @Override
2725 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2726 {
2727 Parcel data = Parcel.obtain();
2728 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002729 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002730 data.writeInt(taskId);
2731 data.writeInt(stackId);
2732 data.writeInt(toTop ? 1 : 0);
2733 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 data.recycle();
2736 reply.recycle();
2737 }
2738 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002739 public void resizeStackBox(int stackBoxId, float weight) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002740 {
2741 Parcel data = Parcel.obtain();
2742 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002743 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002744 data.writeInt(stackBoxId);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002745 data.writeFloat(weight);
Craig Mautnercf910b02013-04-23 11:23:27 -07002746 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002747 reply.readException();
2748 data.recycle();
2749 reply.recycle();
2750 }
Craig Mautner967212c2013-04-13 21:10:58 -07002751 @Override
Craig Mautner5ff12102013-05-24 12:50:15 -07002752 public List<StackBoxInfo> getStackBoxes() throws RemoteException
2753 {
2754 Parcel data = Parcel.obtain();
2755 Parcel reply = Parcel.obtain();
2756 data.writeInterfaceToken(IActivityManager.descriptor);
2757 mRemote.transact(GET_STACK_BOXES_TRANSACTION, data, reply, 0);
2758 reply.readException();
2759 ArrayList<StackBoxInfo> list = reply.createTypedArrayList(StackBoxInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002760 data.recycle();
2761 reply.recycle();
2762 return list;
2763 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002764 @Override
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002765 public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException
2766 {
2767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 data.writeInt(stackBoxId);
2771 mRemote.transact(GET_STACK_BOX_INFO_TRANSACTION, data, reply, 0);
2772 reply.readException();
2773 int res = reply.readInt();
2774 StackBoxInfo info = null;
2775 if (res != 0) {
2776 info = StackBoxInfo.CREATOR.createFromParcel(reply);
2777 }
2778 data.recycle();
2779 reply.recycle();
2780 return info;
2781 }
2782 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002783 public void setFocusedStack(int stackId) throws RemoteException
2784 {
2785 Parcel data = Parcel.obtain();
2786 Parcel reply = Parcel.obtain();
2787 data.writeInterfaceToken(IActivityManager.descriptor);
2788 data.writeInt(stackId);
2789 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2790 reply.readException();
2791 data.recycle();
2792 reply.recycle();
2793 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002794 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2795 {
2796 Parcel data = Parcel.obtain();
2797 Parcel reply = Parcel.obtain();
2798 data.writeInterfaceToken(IActivityManager.descriptor);
2799 data.writeStrongBinder(token);
2800 data.writeInt(onlyRoot ? 1 : 0);
2801 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2802 reply.readException();
2803 int res = reply.readInt();
2804 data.recycle();
2805 reply.recycle();
2806 return res;
2807 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002808 public void reportThumbnail(IBinder token,
2809 Bitmap thumbnail, CharSequence description) throws RemoteException
2810 {
2811 Parcel data = Parcel.obtain();
2812 Parcel reply = Parcel.obtain();
2813 data.writeInterfaceToken(IActivityManager.descriptor);
2814 data.writeStrongBinder(token);
2815 if (thumbnail != null) {
2816 data.writeInt(1);
2817 thumbnail.writeToParcel(data, 0);
2818 } else {
2819 data.writeInt(0);
2820 }
2821 TextUtils.writeToParcel(description, data, 0);
2822 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2823 reply.readException();
2824 data.recycle();
2825 reply.recycle();
2826 }
2827 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002828 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
2832 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2833 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002834 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002835 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2837 reply.readException();
2838 int res = reply.readInt();
2839 ContentProviderHolder cph = null;
2840 if (res != 0) {
2841 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2842 }
2843 data.recycle();
2844 reply.recycle();
2845 return cph;
2846 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002847 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2848 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002853 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002854 data.writeStrongBinder(token);
2855 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2856 reply.readException();
2857 int res = reply.readInt();
2858 ContentProviderHolder cph = null;
2859 if (res != 0) {
2860 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2861 }
2862 data.recycle();
2863 reply.recycle();
2864 return cph;
2865 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002866 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002867 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002868 {
2869 Parcel data = Parcel.obtain();
2870 Parcel reply = Parcel.obtain();
2871 data.writeInterfaceToken(IActivityManager.descriptor);
2872 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2873 data.writeTypedList(providers);
2874 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2875 reply.readException();
2876 data.recycle();
2877 reply.recycle();
2878 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002879 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2880 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002881 Parcel data = Parcel.obtain();
2882 Parcel reply = Parcel.obtain();
2883 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002884 data.writeStrongBinder(connection);
2885 data.writeInt(stable);
2886 data.writeInt(unstable);
2887 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2888 reply.readException();
2889 boolean res = reply.readInt() != 0;
2890 data.recycle();
2891 reply.recycle();
2892 return res;
2893 }
2894 public void unstableProviderDied(IBinder connection) throws RemoteException {
2895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 data.writeStrongBinder(connection);
2899 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2900 reply.readException();
2901 data.recycle();
2902 reply.recycle();
2903 }
2904
2905 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2906 Parcel data = Parcel.obtain();
2907 Parcel reply = Parcel.obtain();
2908 data.writeInterfaceToken(IActivityManager.descriptor);
2909 data.writeStrongBinder(connection);
2910 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002911 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2912 reply.readException();
2913 data.recycle();
2914 reply.recycle();
2915 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002916
2917 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 data.writeString(name);
2922 data.writeStrongBinder(token);
2923 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2924 reply.readException();
2925 data.recycle();
2926 reply.recycle();
2927 }
2928
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002929 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2930 throws RemoteException
2931 {
2932 Parcel data = Parcel.obtain();
2933 Parcel reply = Parcel.obtain();
2934 data.writeInterfaceToken(IActivityManager.descriptor);
2935 service.writeToParcel(data, 0);
2936 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2937 reply.readException();
2938 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2939 data.recycle();
2940 reply.recycle();
2941 return res;
2942 }
2943
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002944 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002945 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002946 {
2947 Parcel data = Parcel.obtain();
2948 Parcel reply = Parcel.obtain();
2949 data.writeInterfaceToken(IActivityManager.descriptor);
2950 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2951 service.writeToParcel(data, 0);
2952 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002953 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002954 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 ComponentName res = ComponentName.readFromParcel(reply);
2957 data.recycle();
2958 reply.recycle();
2959 return res;
2960 }
2961 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002962 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002963 {
2964 Parcel data = Parcel.obtain();
2965 Parcel reply = Parcel.obtain();
2966 data.writeInterfaceToken(IActivityManager.descriptor);
2967 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2968 service.writeToParcel(data, 0);
2969 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002970 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 int res = reply.readInt();
2974 reply.recycle();
2975 data.recycle();
2976 return res;
2977 }
2978 public boolean stopServiceToken(ComponentName className, IBinder token,
2979 int startId) throws RemoteException {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 ComponentName.writeToParcel(className, data);
2984 data.writeStrongBinder(token);
2985 data.writeInt(startId);
2986 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2987 reply.readException();
2988 boolean res = reply.readInt() != 0;
2989 data.recycle();
2990 reply.recycle();
2991 return res;
2992 }
2993 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002994 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002995 Parcel data = Parcel.obtain();
2996 Parcel reply = Parcel.obtain();
2997 data.writeInterfaceToken(IActivityManager.descriptor);
2998 ComponentName.writeToParcel(className, data);
2999 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003000 data.writeInt(id);
3001 if (notification != null) {
3002 data.writeInt(1);
3003 notification.writeToParcel(data, 0);
3004 } else {
3005 data.writeInt(0);
3006 }
3007 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003008 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3009 reply.readException();
3010 data.recycle();
3011 reply.recycle();
3012 }
3013 public int bindService(IApplicationThread caller, IBinder token,
3014 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003015 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 Parcel data = Parcel.obtain();
3017 Parcel reply = Parcel.obtain();
3018 data.writeInterfaceToken(IActivityManager.descriptor);
3019 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3020 data.writeStrongBinder(token);
3021 service.writeToParcel(data, 0);
3022 data.writeString(resolvedType);
3023 data.writeStrongBinder(connection.asBinder());
3024 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003025 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003026 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3027 reply.readException();
3028 int res = reply.readInt();
3029 data.recycle();
3030 reply.recycle();
3031 return res;
3032 }
3033 public boolean unbindService(IServiceConnection connection) throws RemoteException
3034 {
3035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 data.writeStrongBinder(connection.asBinder());
3039 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3040 reply.readException();
3041 boolean res = reply.readInt() != 0;
3042 data.recycle();
3043 reply.recycle();
3044 return res;
3045 }
3046
3047 public void publishService(IBinder token,
3048 Intent intent, IBinder service) throws RemoteException {
3049 Parcel data = Parcel.obtain();
3050 Parcel reply = Parcel.obtain();
3051 data.writeInterfaceToken(IActivityManager.descriptor);
3052 data.writeStrongBinder(token);
3053 intent.writeToParcel(data, 0);
3054 data.writeStrongBinder(service);
3055 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 data.recycle();
3058 reply.recycle();
3059 }
3060
3061 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3062 throws RemoteException {
3063 Parcel data = Parcel.obtain();
3064 Parcel reply = Parcel.obtain();
3065 data.writeInterfaceToken(IActivityManager.descriptor);
3066 data.writeStrongBinder(token);
3067 intent.writeToParcel(data, 0);
3068 data.writeInt(doRebind ? 1 : 0);
3069 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3070 reply.readException();
3071 data.recycle();
3072 reply.recycle();
3073 }
3074
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003075 public void serviceDoneExecuting(IBinder token, int type, int startId,
3076 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003077 Parcel data = Parcel.obtain();
3078 Parcel reply = Parcel.obtain();
3079 data.writeInterfaceToken(IActivityManager.descriptor);
3080 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003081 data.writeInt(type);
3082 data.writeInt(startId);
3083 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003084 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3085 reply.readException();
3086 data.recycle();
3087 reply.recycle();
3088 }
3089
3090 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
3094 service.writeToParcel(data, 0);
3095 data.writeString(resolvedType);
3096 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 IBinder binder = reply.readStrongBinder();
3099 reply.recycle();
3100 data.recycle();
3101 return binder;
3102 }
3103
Christopher Tate181fafa2009-05-14 11:12:14 -07003104 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3105 throws RemoteException {
3106 Parcel data = Parcel.obtain();
3107 Parcel reply = Parcel.obtain();
3108 data.writeInterfaceToken(IActivityManager.descriptor);
3109 app.writeToParcel(data, 0);
3110 data.writeInt(backupRestoreMode);
3111 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3112 reply.readException();
3113 boolean success = reply.readInt() != 0;
3114 reply.recycle();
3115 data.recycle();
3116 return success;
3117 }
3118
Christopher Tate346acb12012-10-15 19:20:25 -07003119 public void clearPendingBackup() throws RemoteException {
3120 Parcel data = Parcel.obtain();
3121 Parcel reply = Parcel.obtain();
3122 data.writeInterfaceToken(IActivityManager.descriptor);
3123 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3124 reply.recycle();
3125 data.recycle();
3126 }
3127
Christopher Tate181fafa2009-05-14 11:12:14 -07003128 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 data.writeString(packageName);
3133 data.writeStrongBinder(agent);
3134 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3135 reply.recycle();
3136 data.recycle();
3137 }
3138
3139 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3140 Parcel data = Parcel.obtain();
3141 Parcel reply = Parcel.obtain();
3142 data.writeInterfaceToken(IActivityManager.descriptor);
3143 app.writeToParcel(data, 0);
3144 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 reply.recycle();
3147 data.recycle();
3148 }
3149
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003150 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003151 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3152 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003153 Parcel data = Parcel.obtain();
3154 Parcel reply = Parcel.obtain();
3155 data.writeInterfaceToken(IActivityManager.descriptor);
3156 ComponentName.writeToParcel(className, data);
3157 data.writeString(profileFile);
3158 data.writeInt(flags);
3159 data.writeBundle(arguments);
3160 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003161 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003162 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003163 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3164 reply.readException();
3165 boolean res = reply.readInt() != 0;
3166 reply.recycle();
3167 data.recycle();
3168 return res;
3169 }
3170
3171 public void finishInstrumentation(IApplicationThread target,
3172 int resultCode, Bundle results) throws RemoteException {
3173 Parcel data = Parcel.obtain();
3174 Parcel reply = Parcel.obtain();
3175 data.writeInterfaceToken(IActivityManager.descriptor);
3176 data.writeStrongBinder(target != null ? target.asBinder() : null);
3177 data.writeInt(resultCode);
3178 data.writeBundle(results);
3179 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3180 reply.readException();
3181 data.recycle();
3182 reply.recycle();
3183 }
3184 public Configuration getConfiguration() throws RemoteException
3185 {
3186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
3189 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3192 reply.recycle();
3193 data.recycle();
3194 return res;
3195 }
3196 public void updateConfiguration(Configuration values) throws RemoteException
3197 {
3198 Parcel data = Parcel.obtain();
3199 Parcel reply = Parcel.obtain();
3200 data.writeInterfaceToken(IActivityManager.descriptor);
3201 values.writeToParcel(data, 0);
3202 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3203 reply.readException();
3204 data.recycle();
3205 reply.recycle();
3206 }
3207 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3208 throws RemoteException {
3209 Parcel data = Parcel.obtain();
3210 Parcel reply = Parcel.obtain();
3211 data.writeInterfaceToken(IActivityManager.descriptor);
3212 data.writeStrongBinder(token);
3213 data.writeInt(requestedOrientation);
3214 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3215 reply.readException();
3216 data.recycle();
3217 reply.recycle();
3218 }
3219 public int getRequestedOrientation(IBinder token) throws RemoteException {
3220 Parcel data = Parcel.obtain();
3221 Parcel reply = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 data.writeStrongBinder(token);
3224 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3225 reply.readException();
3226 int res = reply.readInt();
3227 data.recycle();
3228 reply.recycle();
3229 return res;
3230 }
3231 public ComponentName getActivityClassForToken(IBinder token)
3232 throws RemoteException {
3233 Parcel data = Parcel.obtain();
3234 Parcel reply = Parcel.obtain();
3235 data.writeInterfaceToken(IActivityManager.descriptor);
3236 data.writeStrongBinder(token);
3237 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3238 reply.readException();
3239 ComponentName res = ComponentName.readFromParcel(reply);
3240 data.recycle();
3241 reply.recycle();
3242 return res;
3243 }
3244 public String getPackageForToken(IBinder token) throws RemoteException
3245 {
3246 Parcel data = Parcel.obtain();
3247 Parcel reply = Parcel.obtain();
3248 data.writeInterfaceToken(IActivityManager.descriptor);
3249 data.writeStrongBinder(token);
3250 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3251 reply.readException();
3252 String res = reply.readString();
3253 data.recycle();
3254 reply.recycle();
3255 return res;
3256 }
3257 public IIntentSender getIntentSender(int type,
3258 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003259 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003260 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003261 Parcel data = Parcel.obtain();
3262 Parcel reply = Parcel.obtain();
3263 data.writeInterfaceToken(IActivityManager.descriptor);
3264 data.writeInt(type);
3265 data.writeString(packageName);
3266 data.writeStrongBinder(token);
3267 data.writeString(resultWho);
3268 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003269 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003270 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003271 data.writeTypedArray(intents, 0);
3272 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003273 } else {
3274 data.writeInt(0);
3275 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003277 if (options != null) {
3278 data.writeInt(1);
3279 options.writeToParcel(data, 0);
3280 } else {
3281 data.writeInt(0);
3282 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003283 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003284 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3285 reply.readException();
3286 IIntentSender res = IIntentSender.Stub.asInterface(
3287 reply.readStrongBinder());
3288 data.recycle();
3289 reply.recycle();
3290 return res;
3291 }
3292 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3293 Parcel data = Parcel.obtain();
3294 Parcel reply = Parcel.obtain();
3295 data.writeInterfaceToken(IActivityManager.descriptor);
3296 data.writeStrongBinder(sender.asBinder());
3297 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3298 reply.readException();
3299 data.recycle();
3300 reply.recycle();
3301 }
3302 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3303 Parcel data = Parcel.obtain();
3304 Parcel reply = Parcel.obtain();
3305 data.writeInterfaceToken(IActivityManager.descriptor);
3306 data.writeStrongBinder(sender.asBinder());
3307 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3308 reply.readException();
3309 String res = reply.readString();
3310 data.recycle();
3311 reply.recycle();
3312 return res;
3313 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003314 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3315 Parcel data = Parcel.obtain();
3316 Parcel reply = Parcel.obtain();
3317 data.writeInterfaceToken(IActivityManager.descriptor);
3318 data.writeStrongBinder(sender.asBinder());
3319 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3320 reply.readException();
3321 int res = reply.readInt();
3322 data.recycle();
3323 reply.recycle();
3324 return res;
3325 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003326 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3327 boolean requireFull, String name, String callerPackage) throws RemoteException {
3328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeInt(callingPid);
3332 data.writeInt(callingUid);
3333 data.writeInt(userId);
3334 data.writeInt(allowAll ? 1 : 0);
3335 data.writeInt(requireFull ? 1 : 0);
3336 data.writeString(name);
3337 data.writeString(callerPackage);
3338 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3339 reply.readException();
3340 int res = reply.readInt();
3341 data.recycle();
3342 reply.recycle();
3343 return res;
3344 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003345 public void setProcessLimit(int max) throws RemoteException
3346 {
3347 Parcel data = Parcel.obtain();
3348 Parcel reply = Parcel.obtain();
3349 data.writeInterfaceToken(IActivityManager.descriptor);
3350 data.writeInt(max);
3351 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3352 reply.readException();
3353 data.recycle();
3354 reply.recycle();
3355 }
3356 public int getProcessLimit() throws RemoteException
3357 {
3358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3362 reply.readException();
3363 int res = reply.readInt();
3364 data.recycle();
3365 reply.recycle();
3366 return res;
3367 }
3368 public void setProcessForeground(IBinder token, int pid,
3369 boolean isForeground) throws RemoteException {
3370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
3372 data.writeInterfaceToken(IActivityManager.descriptor);
3373 data.writeStrongBinder(token);
3374 data.writeInt(pid);
3375 data.writeInt(isForeground ? 1 : 0);
3376 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3377 reply.readException();
3378 data.recycle();
3379 reply.recycle();
3380 }
3381 public int checkPermission(String permission, int pid, int uid)
3382 throws RemoteException {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
3386 data.writeString(permission);
3387 data.writeInt(pid);
3388 data.writeInt(uid);
3389 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3390 reply.readException();
3391 int res = reply.readInt();
3392 data.recycle();
3393 reply.recycle();
3394 return res;
3395 }
3396 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003397 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003398 Parcel data = Parcel.obtain();
3399 Parcel reply = Parcel.obtain();
3400 data.writeInterfaceToken(IActivityManager.descriptor);
3401 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003402 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003403 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003404 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3405 reply.readException();
3406 boolean res = reply.readInt() != 0;
3407 data.recycle();
3408 reply.recycle();
3409 return res;
3410 }
3411 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3412 throws RemoteException {
3413 Parcel data = Parcel.obtain();
3414 Parcel reply = Parcel.obtain();
3415 data.writeInterfaceToken(IActivityManager.descriptor);
3416 uri.writeToParcel(data, 0);
3417 data.writeInt(pid);
3418 data.writeInt(uid);
3419 data.writeInt(mode);
3420 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3421 reply.readException();
3422 int res = reply.readInt();
3423 data.recycle();
3424 reply.recycle();
3425 return res;
3426 }
3427 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3428 Uri uri, int mode) throws RemoteException {
3429 Parcel data = Parcel.obtain();
3430 Parcel reply = Parcel.obtain();
3431 data.writeInterfaceToken(IActivityManager.descriptor);
3432 data.writeStrongBinder(caller.asBinder());
3433 data.writeString(targetPkg);
3434 uri.writeToParcel(data, 0);
3435 data.writeInt(mode);
3436 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3437 reply.readException();
3438 data.recycle();
3439 reply.recycle();
3440 }
3441 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3442 int mode) throws RemoteException {
3443 Parcel data = Parcel.obtain();
3444 Parcel reply = Parcel.obtain();
3445 data.writeInterfaceToken(IActivityManager.descriptor);
3446 data.writeStrongBinder(caller.asBinder());
3447 uri.writeToParcel(data, 0);
3448 data.writeInt(mode);
3449 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3450 reply.readException();
3451 data.recycle();
3452 reply.recycle();
3453 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003454
3455 @Override
3456 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 uri.writeToParcel(data, 0);
3461 data.writeInt(mode);
3462 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3463 reply.readException();
3464 data.recycle();
3465 reply.recycle();
3466 }
3467
3468 @Override
3469 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3470 Parcel data = Parcel.obtain();
3471 Parcel reply = Parcel.obtain();
3472 data.writeInterfaceToken(IActivityManager.descriptor);
3473 uri.writeToParcel(data, 0);
3474 data.writeInt(mode);
3475 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3476 reply.readException();
3477 data.recycle();
3478 reply.recycle();
3479 }
3480
3481 @Override
3482 public ParceledListSlice<UriPermission> getPersistedUriPermissions() throws RemoteException {
3483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3487 reply.readException();
3488 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3489 reply);
3490 data.recycle();
3491 reply.recycle();
3492 return perms;
3493 }
3494
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003495 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3496 throws RemoteException {
3497 Parcel data = Parcel.obtain();
3498 Parcel reply = Parcel.obtain();
3499 data.writeInterfaceToken(IActivityManager.descriptor);
3500 data.writeStrongBinder(who.asBinder());
3501 data.writeInt(waiting ? 1 : 0);
3502 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3503 reply.readException();
3504 data.recycle();
3505 reply.recycle();
3506 }
3507 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3508 Parcel data = Parcel.obtain();
3509 Parcel reply = Parcel.obtain();
3510 data.writeInterfaceToken(IActivityManager.descriptor);
3511 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 outInfo.readFromParcel(reply);
3514 data.recycle();
3515 reply.recycle();
3516 }
3517 public void unhandledBack() throws RemoteException
3518 {
3519 Parcel data = Parcel.obtain();
3520 Parcel reply = Parcel.obtain();
3521 data.writeInterfaceToken(IActivityManager.descriptor);
3522 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3523 reply.readException();
3524 data.recycle();
3525 reply.recycle();
3526 }
3527 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3528 {
3529 Parcel data = Parcel.obtain();
3530 Parcel reply = Parcel.obtain();
3531 data.writeInterfaceToken(IActivityManager.descriptor);
3532 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3533 reply.readException();
3534 ParcelFileDescriptor pfd = null;
3535 if (reply.readInt() != 0) {
3536 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3537 }
3538 data.recycle();
3539 reply.recycle();
3540 return pfd;
3541 }
3542 public void goingToSleep() throws RemoteException
3543 {
3544 Parcel data = Parcel.obtain();
3545 Parcel reply = Parcel.obtain();
3546 data.writeInterfaceToken(IActivityManager.descriptor);
3547 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3548 reply.readException();
3549 data.recycle();
3550 reply.recycle();
3551 }
3552 public void wakingUp() throws RemoteException
3553 {
3554 Parcel data = Parcel.obtain();
3555 Parcel reply = Parcel.obtain();
3556 data.writeInterfaceToken(IActivityManager.descriptor);
3557 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 data.recycle();
3560 reply.recycle();
3561 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003562 public void setLockScreenShown(boolean shown) throws RemoteException
3563 {
3564 Parcel data = Parcel.obtain();
3565 Parcel reply = Parcel.obtain();
3566 data.writeInterfaceToken(IActivityManager.descriptor);
3567 data.writeInt(shown ? 1 : 0);
3568 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 data.recycle();
3571 reply.recycle();
3572 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003573 public void setDebugApp(
3574 String packageName, boolean waitForDebugger, boolean persistent)
3575 throws RemoteException
3576 {
3577 Parcel data = Parcel.obtain();
3578 Parcel reply = Parcel.obtain();
3579 data.writeInterfaceToken(IActivityManager.descriptor);
3580 data.writeString(packageName);
3581 data.writeInt(waitForDebugger ? 1 : 0);
3582 data.writeInt(persistent ? 1 : 0);
3583 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3584 reply.readException();
3585 data.recycle();
3586 reply.recycle();
3587 }
3588 public void setAlwaysFinish(boolean enabled) throws RemoteException
3589 {
3590 Parcel data = Parcel.obtain();
3591 Parcel reply = Parcel.obtain();
3592 data.writeInterfaceToken(IActivityManager.descriptor);
3593 data.writeInt(enabled ? 1 : 0);
3594 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3595 reply.readException();
3596 data.recycle();
3597 reply.recycle();
3598 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003599 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003600 {
3601 Parcel data = Parcel.obtain();
3602 Parcel reply = Parcel.obtain();
3603 data.writeInterfaceToken(IActivityManager.descriptor);
3604 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003605 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 reply.readException();
3607 data.recycle();
3608 reply.recycle();
3609 }
3610 public void enterSafeMode() throws RemoteException {
3611 Parcel data = Parcel.obtain();
3612 data.writeInterfaceToken(IActivityManager.descriptor);
3613 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3614 data.recycle();
3615 }
3616 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3617 Parcel data = Parcel.obtain();
3618 data.writeStrongBinder(sender.asBinder());
3619 data.writeInterfaceToken(IActivityManager.descriptor);
3620 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3621 data.recycle();
3622 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003623 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003624 Parcel data = Parcel.obtain();
3625 Parcel reply = Parcel.obtain();
3626 data.writeInterfaceToken(IActivityManager.descriptor);
3627 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003628 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003629 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003630 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003631 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003632 boolean res = reply.readInt() != 0;
3633 data.recycle();
3634 reply.recycle();
3635 return res;
3636 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003637 @Override
3638 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3639 Parcel data = Parcel.obtain();
3640 Parcel reply = Parcel.obtain();
3641 data.writeInterfaceToken(IActivityManager.descriptor);
3642 data.writeString(reason);
3643 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3644 boolean res = reply.readInt() != 0;
3645 data.recycle();
3646 reply.recycle();
3647 return res;
3648 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003649 public void startRunning(String pkg, String cls, String action,
3650 String indata) throws RemoteException {
3651 Parcel data = Parcel.obtain();
3652 Parcel reply = Parcel.obtain();
3653 data.writeInterfaceToken(IActivityManager.descriptor);
3654 data.writeString(pkg);
3655 data.writeString(cls);
3656 data.writeString(action);
3657 data.writeString(indata);
3658 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3659 reply.readException();
3660 data.recycle();
3661 reply.recycle();
3662 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003663 public boolean testIsSystemReady()
3664 {
3665 /* this base class version is never called */
3666 return true;
3667 }
Dan Egnor60d87622009-12-16 16:32:58 -08003668 public void handleApplicationCrash(IBinder app,
3669 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3670 {
3671 Parcel data = Parcel.obtain();
3672 Parcel reply = Parcel.obtain();
3673 data.writeInterfaceToken(IActivityManager.descriptor);
3674 data.writeStrongBinder(app);
3675 crashInfo.writeToParcel(data, 0);
3676 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3677 reply.readException();
3678 reply.recycle();
3679 data.recycle();
3680 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003681
Dan Egnor60d87622009-12-16 16:32:58 -08003682 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003683 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003684 {
3685 Parcel data = Parcel.obtain();
3686 Parcel reply = Parcel.obtain();
3687 data.writeInterfaceToken(IActivityManager.descriptor);
3688 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003689 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003690 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003691 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003692 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003693 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003694 reply.recycle();
3695 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003696 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003697 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003698
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003699 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003700 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003701 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003702 {
3703 Parcel data = Parcel.obtain();
3704 Parcel reply = Parcel.obtain();
3705 data.writeInterfaceToken(IActivityManager.descriptor);
3706 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003707 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003708 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003709 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3710 reply.readException();
3711 reply.recycle();
3712 data.recycle();
3713 }
3714
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003715 public void signalPersistentProcesses(int sig) throws RemoteException {
3716 Parcel data = Parcel.obtain();
3717 Parcel reply = Parcel.obtain();
3718 data.writeInterfaceToken(IActivityManager.descriptor);
3719 data.writeInt(sig);
3720 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3721 reply.readException();
3722 data.recycle();
3723 reply.recycle();
3724 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003725
Dianne Hackborn1676c852012-09-10 14:52:30 -07003726 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003727 Parcel data = Parcel.obtain();
3728 Parcel reply = Parcel.obtain();
3729 data.writeInterfaceToken(IActivityManager.descriptor);
3730 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003731 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003732 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3733 reply.readException();
3734 data.recycle();
3735 reply.recycle();
3736 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003737
3738 public void killAllBackgroundProcesses() throws RemoteException {
3739 Parcel data = Parcel.obtain();
3740 Parcel reply = Parcel.obtain();
3741 data.writeInterfaceToken(IActivityManager.descriptor);
3742 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3743 reply.readException();
3744 data.recycle();
3745 reply.recycle();
3746 }
3747
Dianne Hackborn1676c852012-09-10 14:52:30 -07003748 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003749 Parcel data = Parcel.obtain();
3750 Parcel reply = Parcel.obtain();
3751 data.writeInterfaceToken(IActivityManager.descriptor);
3752 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003753 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003754 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003755 reply.readException();
3756 data.recycle();
3757 reply.recycle();
3758 }
3759
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003760 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3761 throws RemoteException
3762 {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3767 reply.readException();
3768 outInfo.readFromParcel(reply);
3769 reply.recycle();
3770 data.recycle();
3771 }
3772
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003773 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3774 {
3775 Parcel data = Parcel.obtain();
3776 Parcel reply = Parcel.obtain();
3777 data.writeInterfaceToken(IActivityManager.descriptor);
3778 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3779 reply.readException();
3780 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3781 reply.recycle();
3782 data.recycle();
3783 return res;
3784 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003785
Dianne Hackborn1676c852012-09-10 14:52:30 -07003786 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003787 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003788 {
3789 Parcel data = Parcel.obtain();
3790 Parcel reply = Parcel.obtain();
3791 data.writeInterfaceToken(IActivityManager.descriptor);
3792 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003793 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003794 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003795 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003796 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003797 if (fd != null) {
3798 data.writeInt(1);
3799 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3800 } else {
3801 data.writeInt(0);
3802 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003803 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3804 reply.readException();
3805 boolean res = reply.readInt() != 0;
3806 reply.recycle();
3807 data.recycle();
3808 return res;
3809 }
3810
Dianne Hackborn55280a92009-05-07 15:53:46 -07003811 public boolean shutdown(int timeout) throws RemoteException
3812 {
3813 Parcel data = Parcel.obtain();
3814 Parcel reply = Parcel.obtain();
3815 data.writeInterfaceToken(IActivityManager.descriptor);
3816 data.writeInt(timeout);
3817 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3818 reply.readException();
3819 boolean res = reply.readInt() != 0;
3820 reply.recycle();
3821 data.recycle();
3822 return res;
3823 }
3824
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003825 public void stopAppSwitches() throws RemoteException {
3826 Parcel data = Parcel.obtain();
3827 Parcel reply = Parcel.obtain();
3828 data.writeInterfaceToken(IActivityManager.descriptor);
3829 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3830 reply.readException();
3831 reply.recycle();
3832 data.recycle();
3833 }
3834
3835 public void resumeAppSwitches() throws RemoteException {
3836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
3839 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3840 reply.readException();
3841 reply.recycle();
3842 data.recycle();
3843 }
3844
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003845 public void killApplicationWithAppId(String pkg, int appid, String reason)
3846 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003851 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003852 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003853 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003854 reply.readException();
3855 data.recycle();
3856 reply.recycle();
3857 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003858
3859 public void closeSystemDialogs(String reason) throws RemoteException {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 data.writeString(reason);
3864 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 data.recycle();
3867 reply.recycle();
3868 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003869
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003870 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003871 throws RemoteException {
3872 Parcel data = Parcel.obtain();
3873 Parcel reply = Parcel.obtain();
3874 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003875 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003876 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3877 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003878 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003879 data.recycle();
3880 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003881 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003882 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003883
3884 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3885 Parcel data = Parcel.obtain();
3886 Parcel reply = Parcel.obtain();
3887 data.writeInterfaceToken(IActivityManager.descriptor);
3888 data.writeString(processName);
3889 data.writeInt(uid);
3890 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3891 reply.readException();
3892 data.recycle();
3893 reply.recycle();
3894 }
3895
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003896 public void overridePendingTransition(IBinder token, String packageName,
3897 int enterAnim, int exitAnim) throws RemoteException {
3898 Parcel data = Parcel.obtain();
3899 Parcel reply = Parcel.obtain();
3900 data.writeInterfaceToken(IActivityManager.descriptor);
3901 data.writeStrongBinder(token);
3902 data.writeString(packageName);
3903 data.writeInt(enterAnim);
3904 data.writeInt(exitAnim);
3905 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3906 reply.readException();
3907 data.recycle();
3908 reply.recycle();
3909 }
3910
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003911 public boolean isUserAMonkey() throws RemoteException {
3912 Parcel data = Parcel.obtain();
3913 Parcel reply = Parcel.obtain();
3914 data.writeInterfaceToken(IActivityManager.descriptor);
3915 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3916 reply.readException();
3917 boolean res = reply.readInt() != 0;
3918 data.recycle();
3919 reply.recycle();
3920 return res;
3921 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003922
3923 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3924 Parcel data = Parcel.obtain();
3925 Parcel reply = Parcel.obtain();
3926 data.writeInterfaceToken(IActivityManager.descriptor);
3927 data.writeInt(monkey ? 1 : 0);
3928 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3929 reply.readException();
3930 data.recycle();
3931 reply.recycle();
3932 }
3933
Dianne Hackborn860755f2010-06-03 18:47:52 -07003934 public void finishHeavyWeightApp() throws RemoteException {
3935 Parcel data = Parcel.obtain();
3936 Parcel reply = Parcel.obtain();
3937 data.writeInterfaceToken(IActivityManager.descriptor);
3938 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3939 reply.readException();
3940 data.recycle();
3941 reply.recycle();
3942 }
Craig Mautner4addfc52013-06-25 08:05:45 -07003943
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003944 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07003945 throws RemoteException {
3946 Parcel data = Parcel.obtain();
3947 Parcel reply = Parcel.obtain();
3948 data.writeInterfaceToken(IActivityManager.descriptor);
3949 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07003950 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
3951 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003952 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07003953 data.recycle();
3954 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003955 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07003956 }
3957
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003958 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07003959 throws RemoteException {
3960 Parcel data = Parcel.obtain();
3961 Parcel reply = Parcel.obtain();
3962 data.writeInterfaceToken(IActivityManager.descriptor);
3963 data.writeStrongBinder(token);
3964 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07003965 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003966 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07003967 data.recycle();
3968 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003969 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07003970 }
3971
Daniel Sandler69a48172010-06-23 16:29:36 -04003972 public void setImmersive(IBinder token, boolean immersive)
3973 throws RemoteException {
3974 Parcel data = Parcel.obtain();
3975 Parcel reply = Parcel.obtain();
3976 data.writeInterfaceToken(IActivityManager.descriptor);
3977 data.writeStrongBinder(token);
3978 data.writeInt(immersive ? 1 : 0);
3979 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3980 reply.readException();
3981 data.recycle();
3982 reply.recycle();
3983 }
3984
3985 public boolean isImmersive(IBinder token)
3986 throws RemoteException {
3987 Parcel data = Parcel.obtain();
3988 Parcel reply = Parcel.obtain();
3989 data.writeInterfaceToken(IActivityManager.descriptor);
3990 data.writeStrongBinder(token);
3991 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003992 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003993 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003994 data.recycle();
3995 reply.recycle();
3996 return res;
3997 }
3998
3999 public boolean isTopActivityImmersive()
4000 throws RemoteException {
4001 Parcel data = Parcel.obtain();
4002 Parcel reply = Parcel.obtain();
4003 data.writeInterfaceToken(IActivityManager.descriptor);
4004 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004005 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004006 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004007 data.recycle();
4008 reply.recycle();
4009 return res;
4010 }
4011
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004012 public void crashApplication(int uid, int initialPid, String packageName,
4013 String message) throws RemoteException {
4014 Parcel data = Parcel.obtain();
4015 Parcel reply = Parcel.obtain();
4016 data.writeInterfaceToken(IActivityManager.descriptor);
4017 data.writeInt(uid);
4018 data.writeInt(initialPid);
4019 data.writeString(packageName);
4020 data.writeString(message);
4021 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4022 reply.readException();
4023 data.recycle();
4024 reply.recycle();
4025 }
Andy McFadden824c5102010-07-09 16:26:57 -07004026
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004027 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004028 Parcel data = Parcel.obtain();
4029 Parcel reply = Parcel.obtain();
4030 data.writeInterfaceToken(IActivityManager.descriptor);
4031 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004032 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004033 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4034 reply.readException();
4035 String res = reply.readString();
4036 data.recycle();
4037 reply.recycle();
4038 return res;
4039 }
4040
Dianne Hackborn7e269642010-08-25 19:50:20 -07004041 public IBinder newUriPermissionOwner(String name)
4042 throws RemoteException {
4043 Parcel data = Parcel.obtain();
4044 Parcel reply = Parcel.obtain();
4045 data.writeInterfaceToken(IActivityManager.descriptor);
4046 data.writeString(name);
4047 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4048 reply.readException();
4049 IBinder res = reply.readStrongBinder();
4050 data.recycle();
4051 reply.recycle();
4052 return res;
4053 }
4054
4055 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4056 Uri uri, int mode) throws RemoteException {
4057 Parcel data = Parcel.obtain();
4058 Parcel reply = Parcel.obtain();
4059 data.writeInterfaceToken(IActivityManager.descriptor);
4060 data.writeStrongBinder(owner);
4061 data.writeInt(fromUid);
4062 data.writeString(targetPkg);
4063 uri.writeToParcel(data, 0);
4064 data.writeInt(mode);
4065 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 data.recycle();
4068 reply.recycle();
4069 }
4070
4071 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4072 int mode) throws RemoteException {
4073 Parcel data = Parcel.obtain();
4074 Parcel reply = Parcel.obtain();
4075 data.writeInterfaceToken(IActivityManager.descriptor);
4076 data.writeStrongBinder(owner);
4077 if (uri != null) {
4078 data.writeInt(1);
4079 uri.writeToParcel(data, 0);
4080 } else {
4081 data.writeInt(0);
4082 }
4083 data.writeInt(mode);
4084 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4085 reply.readException();
4086 data.recycle();
4087 reply.recycle();
4088 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004089
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004090 public int checkGrantUriPermission(int callingUid, String targetPkg,
4091 Uri uri, int modeFlags) throws RemoteException {
4092 Parcel data = Parcel.obtain();
4093 Parcel reply = Parcel.obtain();
4094 data.writeInterfaceToken(IActivityManager.descriptor);
4095 data.writeInt(callingUid);
4096 data.writeString(targetPkg);
4097 uri.writeToParcel(data, 0);
4098 data.writeInt(modeFlags);
4099 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4100 reply.readException();
4101 int res = reply.readInt();
4102 data.recycle();
4103 reply.recycle();
4104 return res;
4105 }
4106
Dianne Hackborn1676c852012-09-10 14:52:30 -07004107 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004108 String path, ParcelFileDescriptor fd) throws RemoteException {
4109 Parcel data = Parcel.obtain();
4110 Parcel reply = Parcel.obtain();
4111 data.writeInterfaceToken(IActivityManager.descriptor);
4112 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004113 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004114 data.writeInt(managed ? 1 : 0);
4115 data.writeString(path);
4116 if (fd != null) {
4117 data.writeInt(1);
4118 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4119 } else {
4120 data.writeInt(0);
4121 }
4122 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4123 reply.readException();
4124 boolean res = reply.readInt() != 0;
4125 reply.recycle();
4126 data.recycle();
4127 return res;
4128 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004129
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004130 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004131 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004132 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004133 Parcel data = Parcel.obtain();
4134 Parcel reply = Parcel.obtain();
4135 data.writeInterfaceToken(IActivityManager.descriptor);
4136 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004137 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004138 data.writeTypedArray(intents, 0);
4139 data.writeStringArray(resolvedTypes);
4140 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004141 if (options != null) {
4142 data.writeInt(1);
4143 options.writeToParcel(data, 0);
4144 } else {
4145 data.writeInt(0);
4146 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004147 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004148 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4149 reply.readException();
4150 int result = reply.readInt();
4151 reply.recycle();
4152 data.recycle();
4153 return result;
4154 }
4155
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004156 public int getFrontActivityScreenCompatMode() throws RemoteException {
4157 Parcel data = Parcel.obtain();
4158 Parcel reply = Parcel.obtain();
4159 data.writeInterfaceToken(IActivityManager.descriptor);
4160 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4161 reply.readException();
4162 int mode = reply.readInt();
4163 reply.recycle();
4164 data.recycle();
4165 return mode;
4166 }
4167
4168 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4169 Parcel data = Parcel.obtain();
4170 Parcel reply = Parcel.obtain();
4171 data.writeInterfaceToken(IActivityManager.descriptor);
4172 data.writeInt(mode);
4173 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4174 reply.readException();
4175 reply.recycle();
4176 data.recycle();
4177 }
4178
4179 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4180 Parcel data = Parcel.obtain();
4181 Parcel reply = Parcel.obtain();
4182 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004183 data.writeString(packageName);
4184 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004185 reply.readException();
4186 int mode = reply.readInt();
4187 reply.recycle();
4188 data.recycle();
4189 return mode;
4190 }
4191
4192 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004193 throws RemoteException {
4194 Parcel data = Parcel.obtain();
4195 Parcel reply = Parcel.obtain();
4196 data.writeInterfaceToken(IActivityManager.descriptor);
4197 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004198 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004199 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4200 reply.readException();
4201 reply.recycle();
4202 data.recycle();
4203 }
4204
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004205 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4206 Parcel data = Parcel.obtain();
4207 Parcel reply = Parcel.obtain();
4208 data.writeInterfaceToken(IActivityManager.descriptor);
4209 data.writeString(packageName);
4210 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4211 reply.readException();
4212 boolean ask = reply.readInt() != 0;
4213 reply.recycle();
4214 data.recycle();
4215 return ask;
4216 }
4217
4218 public void setPackageAskScreenCompat(String packageName, boolean ask)
4219 throws RemoteException {
4220 Parcel data = Parcel.obtain();
4221 Parcel reply = Parcel.obtain();
4222 data.writeInterfaceToken(IActivityManager.descriptor);
4223 data.writeString(packageName);
4224 data.writeInt(ask ? 1 : 0);
4225 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4226 reply.readException();
4227 reply.recycle();
4228 data.recycle();
4229 }
4230
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004231 public boolean switchUser(int userid) throws RemoteException {
4232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 data.writeInt(userid);
4236 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4237 reply.readException();
4238 boolean result = reply.readInt() != 0;
4239 reply.recycle();
4240 data.recycle();
4241 return result;
4242 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004243
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004244 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4245 Parcel data = Parcel.obtain();
4246 Parcel reply = Parcel.obtain();
4247 data.writeInterfaceToken(IActivityManager.descriptor);
4248 data.writeInt(userid);
4249 data.writeStrongInterface(callback);
4250 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4251 reply.readException();
4252 int result = reply.readInt();
4253 reply.recycle();
4254 data.recycle();
4255 return result;
4256 }
4257
Amith Yamasani52f1d752012-03-28 18:19:29 -07004258 public UserInfo getCurrentUser() throws RemoteException {
4259 Parcel data = Parcel.obtain();
4260 Parcel reply = Parcel.obtain();
4261 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004262 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004263 reply.readException();
4264 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4265 reply.recycle();
4266 data.recycle();
4267 return userInfo;
4268 }
4269
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004270 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004271 Parcel data = Parcel.obtain();
4272 Parcel reply = Parcel.obtain();
4273 data.writeInterfaceToken(IActivityManager.descriptor);
4274 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004275 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004276 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4277 reply.readException();
4278 boolean result = reply.readInt() != 0;
4279 reply.recycle();
4280 data.recycle();
4281 return result;
4282 }
4283
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004284 public int[] getRunningUserIds() throws RemoteException {
4285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4289 reply.readException();
4290 int[] result = reply.createIntArray();
4291 reply.recycle();
4292 data.recycle();
4293 return result;
4294 }
4295
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004296 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4297 Parcel data = Parcel.obtain();
4298 Parcel reply = Parcel.obtain();
4299 data.writeInterfaceToken(IActivityManager.descriptor);
4300 data.writeInt(taskId);
4301 data.writeInt(subTaskIndex);
4302 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4303 reply.readException();
4304 boolean result = reply.readInt() != 0;
4305 reply.recycle();
4306 data.recycle();
4307 return result;
4308 }
4309
4310 public boolean removeTask(int taskId, int flags) throws RemoteException {
4311 Parcel data = Parcel.obtain();
4312 Parcel reply = Parcel.obtain();
4313 data.writeInterfaceToken(IActivityManager.descriptor);
4314 data.writeInt(taskId);
4315 data.writeInt(flags);
4316 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4317 reply.readException();
4318 boolean result = reply.readInt() != 0;
4319 reply.recycle();
4320 data.recycle();
4321 return result;
4322 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004323
Jeff Sharkeya4620792011-05-20 15:29:23 -07004324 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4325 Parcel data = Parcel.obtain();
4326 Parcel reply = Parcel.obtain();
4327 data.writeInterfaceToken(IActivityManager.descriptor);
4328 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4329 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4330 reply.readException();
4331 data.recycle();
4332 reply.recycle();
4333 }
4334
4335 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4336 Parcel data = Parcel.obtain();
4337 Parcel reply = Parcel.obtain();
4338 data.writeInterfaceToken(IActivityManager.descriptor);
4339 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4340 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4341 reply.readException();
4342 data.recycle();
4343 reply.recycle();
4344 }
4345
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004346 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4347 Parcel data = Parcel.obtain();
4348 Parcel reply = Parcel.obtain();
4349 data.writeInterfaceToken(IActivityManager.descriptor);
4350 data.writeStrongBinder(sender.asBinder());
4351 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4352 reply.readException();
4353 boolean res = reply.readInt() != 0;
4354 data.recycle();
4355 reply.recycle();
4356 return res;
4357 }
4358
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004359 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 data.writeStrongBinder(sender.asBinder());
4364 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4365 reply.readException();
4366 boolean res = reply.readInt() != 0;
4367 data.recycle();
4368 reply.recycle();
4369 return res;
4370 }
4371
Dianne Hackborn81038902012-11-26 17:04:09 -08004372 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4373 Parcel data = Parcel.obtain();
4374 Parcel reply = Parcel.obtain();
4375 data.writeInterfaceToken(IActivityManager.descriptor);
4376 data.writeStrongBinder(sender.asBinder());
4377 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4378 reply.readException();
4379 Intent res = reply.readInt() != 0
4380 ? Intent.CREATOR.createFromParcel(reply) : null;
4381 data.recycle();
4382 reply.recycle();
4383 return res;
4384 }
4385
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004386 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4387 {
4388 Parcel data = Parcel.obtain();
4389 Parcel reply = Parcel.obtain();
4390 data.writeInterfaceToken(IActivityManager.descriptor);
4391 values.writeToParcel(data, 0);
4392 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4393 reply.readException();
4394 data.recycle();
4395 reply.recycle();
4396 }
4397
Dianne Hackbornb437e092011-08-05 17:50:29 -07004398 public long[] getProcessPss(int[] pids) throws RemoteException {
4399 Parcel data = Parcel.obtain();
4400 Parcel reply = Parcel.obtain();
4401 data.writeInterfaceToken(IActivityManager.descriptor);
4402 data.writeIntArray(pids);
4403 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4404 reply.readException();
4405 long[] res = reply.createLongArray();
4406 data.recycle();
4407 reply.recycle();
4408 return res;
4409 }
4410
Dianne Hackborn661cd522011-08-22 00:26:20 -07004411 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4412 Parcel data = Parcel.obtain();
4413 Parcel reply = Parcel.obtain();
4414 data.writeInterfaceToken(IActivityManager.descriptor);
4415 TextUtils.writeToParcel(msg, data, 0);
4416 data.writeInt(always ? 1 : 0);
4417 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4418 reply.readException();
4419 data.recycle();
4420 reply.recycle();
4421 }
4422
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004423 public void dismissKeyguardOnNextActivity() throws RemoteException {
4424 Parcel data = Parcel.obtain();
4425 Parcel reply = Parcel.obtain();
4426 data.writeInterfaceToken(IActivityManager.descriptor);
4427 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4428 reply.readException();
4429 data.recycle();
4430 reply.recycle();
4431 }
4432
Adam Powelldd8fab22012-03-22 17:47:27 -07004433 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4434 throws RemoteException {
4435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 data.writeStrongBinder(token);
4439 data.writeString(destAffinity);
4440 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4441 reply.readException();
4442 boolean result = reply.readInt() != 0;
4443 data.recycle();
4444 reply.recycle();
4445 return result;
4446 }
4447
4448 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4449 throws RemoteException {
4450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 data.writeStrongBinder(token);
4454 target.writeToParcel(data, 0);
4455 data.writeInt(resultCode);
4456 if (resultData != null) {
4457 data.writeInt(1);
4458 resultData.writeToParcel(data, 0);
4459 } else {
4460 data.writeInt(0);
4461 }
4462 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4463 reply.readException();
4464 boolean result = reply.readInt() != 0;
4465 data.recycle();
4466 reply.recycle();
4467 return result;
4468 }
4469
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004470 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4471 Parcel data = Parcel.obtain();
4472 Parcel reply = Parcel.obtain();
4473 data.writeInterfaceToken(IActivityManager.descriptor);
4474 data.writeStrongBinder(activityToken);
4475 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4476 reply.readException();
4477 int result = reply.readInt();
4478 data.recycle();
4479 reply.recycle();
4480 return result;
4481 }
4482
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004483 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4484 Parcel data = Parcel.obtain();
4485 Parcel reply = Parcel.obtain();
4486 data.writeInterfaceToken(IActivityManager.descriptor);
4487 data.writeStrongBinder(activityToken);
4488 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4489 reply.readException();
4490 String result = reply.readString();
4491 data.recycle();
4492 reply.recycle();
4493 return result;
4494 }
4495
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004496 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4497 Parcel data = Parcel.obtain();
4498 Parcel reply = Parcel.obtain();
4499 data.writeInterfaceToken(IActivityManager.descriptor);
4500 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4501 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4502 reply.readException();
4503 data.recycle();
4504 reply.recycle();
4505 }
4506
4507 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4508 Parcel data = Parcel.obtain();
4509 Parcel reply = Parcel.obtain();
4510 data.writeInterfaceToken(IActivityManager.descriptor);
4511 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4512 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4513 reply.readException();
4514 data.recycle();
4515 reply.recycle();
4516 }
4517
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004518 public void requestBugReport() throws RemoteException {
4519 Parcel data = Parcel.obtain();
4520 Parcel reply = Parcel.obtain();
4521 data.writeInterfaceToken(IActivityManager.descriptor);
4522 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4523 reply.readException();
4524 data.recycle();
4525 reply.recycle();
4526 }
4527
Jeff Brownbd181bb2013-09-10 16:44:24 -07004528 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4529 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004530 Parcel data = Parcel.obtain();
4531 Parcel reply = Parcel.obtain();
4532 data.writeInterfaceToken(IActivityManager.descriptor);
4533 data.writeInt(pid);
4534 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004535 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004536 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4537 reply.readException();
4538 long res = reply.readInt();
4539 data.recycle();
4540 reply.recycle();
4541 return res;
4542 }
4543
Adam Skorydfc7fd72013-08-05 19:23:41 -07004544 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004545 Parcel data = Parcel.obtain();
4546 Parcel reply = Parcel.obtain();
4547 data.writeInterfaceToken(IActivityManager.descriptor);
4548 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004549 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004550 reply.readException();
4551 Bundle res = reply.readBundle();
4552 data.recycle();
4553 reply.recycle();
4554 return res;
4555 }
4556
Adam Skory7140a252013-09-11 12:04:58 +01004557 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004558 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004559 Parcel data = Parcel.obtain();
4560 Parcel reply = Parcel.obtain();
4561 data.writeInterfaceToken(IActivityManager.descriptor);
4562 data.writeStrongBinder(token);
4563 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004564 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004565 reply.readException();
4566 data.recycle();
4567 reply.recycle();
4568 }
4569
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004570 public void killUid(int uid, String reason) throws RemoteException {
4571 Parcel data = Parcel.obtain();
4572 Parcel reply = Parcel.obtain();
4573 data.writeInterfaceToken(IActivityManager.descriptor);
4574 data.writeInt(uid);
4575 data.writeString(reason);
4576 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4577 reply.readException();
4578 data.recycle();
4579 reply.recycle();
4580 }
4581
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004582 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4583 Parcel data = Parcel.obtain();
4584 Parcel reply = Parcel.obtain();
4585 data.writeInterfaceToken(IActivityManager.descriptor);
4586 data.writeStrongBinder(who);
4587 data.writeInt(allowRestart ? 1 : 0);
4588 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4589 reply.readException();
4590 data.recycle();
4591 reply.recycle();
4592 }
4593
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004594 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4595 Parcel data = Parcel.obtain();
4596 Parcel reply = Parcel.obtain();
4597 data.writeInterfaceToken(IActivityManager.descriptor);
4598 data.writeStrongBinder(token);
4599 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4600 reply.readException();
4601 data.recycle();
4602 reply.recycle();
4603 }
4604
Craig Mautner5eda9b32013-07-02 11:58:16 -07004605 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4606 Parcel data = Parcel.obtain();
4607 Parcel reply = Parcel.obtain();
4608 data.writeInterfaceToken(IActivityManager.descriptor);
4609 data.writeStrongBinder(token);
4610 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4611 reply.readException();
4612 data.recycle();
4613 reply.recycle();
4614 }
4615
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004616 public void restart() throws RemoteException {
4617 Parcel data = Parcel.obtain();
4618 Parcel reply = Parcel.obtain();
4619 data.writeInterfaceToken(IActivityManager.descriptor);
4620 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4621 reply.readException();
4622 data.recycle();
4623 reply.recycle();
4624 }
4625
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004626 public void performIdleMaintenance() throws RemoteException {
4627 Parcel data = Parcel.obtain();
4628 Parcel reply = Parcel.obtain();
4629 data.writeInterfaceToken(IActivityManager.descriptor);
4630 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4631 reply.readException();
4632 data.recycle();
4633 reply.recycle();
4634 }
4635
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004636 private IBinder mRemote;
4637}