blob: ee126f44030117fb51e9c62646ba3171c4f81221 [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
19import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070020import android.content.IIntentReceiver;
21import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Intent;
23import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070028import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.res.Configuration;
30import android.graphics.Bitmap;
31import android.net.Uri;
32import android.os.Binder;
33import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070034import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.os.IBinder;
36import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070037import android.os.ParcelFileDescriptor;
38import android.os.Parcelable;
39import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070041import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080044import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import java.util.ArrayList;
47import java.util.List;
48
49/** {@hide} */
50public abstract class ActivityManagerNative extends Binder implements IActivityManager
51{
52 /**
53 * Cast a Binder object into an activity manager interface, generating
54 * a proxy if needed.
55 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080056 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 if (obj == null) {
58 return null;
59 }
60 IActivityManager in =
61 (IActivityManager)obj.queryLocalInterface(descriptor);
62 if (in != null) {
63 return in;
64 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 return new ActivityManagerProxy(obj);
67 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 /**
70 * Retrieve the system's default/global activity manager.
71 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072 static public IActivityManager getDefault() {
73 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 }
75
76 /**
77 * Convenience for checking whether the system is ready. For internal use only.
78 */
79 static public boolean isSystemReady() {
80 if (!sSystemReady) {
81 sSystemReady = getDefault().testIsSystemReady();
82 }
83 return sSystemReady;
84 }
85 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 /**
88 * Convenience for sending a sticky broadcast. For internal use only.
89 * If you don't care about permission, use null.
90 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070091 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 try {
93 getDefault().broadcastIntent(
94 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070095 null /*permission*/, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 } catch (RemoteException ex) {
97 }
98 }
99
100 static public void noteWakeupAlarm(PendingIntent ps) {
101 try {
102 getDefault().noteWakeupAlarm(ps.getTarget());
103 } catch (RemoteException ex) {
104 }
105 }
106
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800107 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 attachInterface(this, descriptor);
109 }
110
111 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
112 throws RemoteException {
113 switch (code) {
114 case START_ACTIVITY_TRANSACTION:
115 {
116 data.enforceInterface(IActivityManager.descriptor);
117 IBinder b = data.readStrongBinder();
118 IApplicationThread app = ApplicationThreadNative.asInterface(b);
119 Intent intent = Intent.CREATOR.createFromParcel(data);
120 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800122 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700124 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700125 String profileFile = data.readString();
126 ParcelFileDescriptor profileFd = data.readInt() != 0
127 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700128 Bundle options = data.readInt() != 0
129 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 int result = startActivity(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700131 resultTo, resultWho, requestCode, startFlags,
132 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 reply.writeNoException();
134 reply.writeInt(result);
135 return true;
136 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700137
Amith Yamasani82644082012-08-03 13:09:11 -0700138 case START_ACTIVITY_AS_USER_TRANSACTION:
139 {
140 data.enforceInterface(IActivityManager.descriptor);
141 IBinder b = data.readStrongBinder();
142 IApplicationThread app = ApplicationThreadNative.asInterface(b);
143 Intent intent = Intent.CREATOR.createFromParcel(data);
144 String resolvedType = data.readString();
145 IBinder resultTo = data.readStrongBinder();
146 String resultWho = data.readString();
147 int requestCode = data.readInt();
148 int startFlags = data.readInt();
149 String profileFile = data.readString();
150 ParcelFileDescriptor profileFd = data.readInt() != 0
151 ? data.readFileDescriptor() : null;
152 Bundle options = data.readInt() != 0
153 ? Bundle.CREATOR.createFromParcel(data) : null;
154 int userId = data.readInt();
155 int result = startActivityAsUser(app, intent, resolvedType,
156 resultTo, resultWho, requestCode, startFlags,
157 profileFile, profileFd, options, userId);
158 reply.writeNoException();
159 reply.writeInt(result);
160 return true;
161 }
162
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800163 case START_ACTIVITY_AND_WAIT_TRANSACTION:
164 {
165 data.enforceInterface(IActivityManager.descriptor);
166 IBinder b = data.readStrongBinder();
167 IApplicationThread app = ApplicationThreadNative.asInterface(b);
168 Intent intent = Intent.CREATOR.createFromParcel(data);
169 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800170 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800171 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800172 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700173 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700174 String profileFile = data.readString();
175 ParcelFileDescriptor profileFd = data.readInt() != 0
176 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700177 Bundle options = data.readInt() != 0
178 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700179 int userId = data.readInt();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800180 WaitResult result = startActivityAndWait(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700181 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700182 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800183 reply.writeNoException();
184 result.writeToParcel(reply, 0);
185 return true;
186 }
187
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700188 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
189 {
190 data.enforceInterface(IActivityManager.descriptor);
191 IBinder b = data.readStrongBinder();
192 IApplicationThread app = ApplicationThreadNative.asInterface(b);
193 Intent intent = Intent.CREATOR.createFromParcel(data);
194 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700195 IBinder resultTo = data.readStrongBinder();
196 String resultWho = data.readString();
197 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700198 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700200 Bundle options = data.readInt() != 0
201 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700202 int userId = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 int result = startActivityWithConfig(app, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700204 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 reply.writeNoException();
206 reply.writeInt(result);
207 return true;
208 }
209
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700210 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700211 {
212 data.enforceInterface(IActivityManager.descriptor);
213 IBinder b = data.readStrongBinder();
214 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700215 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700216 Intent fillInIntent = null;
217 if (data.readInt() != 0) {
218 fillInIntent = Intent.CREATOR.createFromParcel(data);
219 }
220 String resolvedType = data.readString();
221 IBinder resultTo = data.readStrongBinder();
222 String resultWho = data.readString();
223 int requestCode = data.readInt();
224 int flagsMask = data.readInt();
225 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700226 Bundle options = data.readInt() != 0
227 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700228 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700229 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700231 reply.writeNoException();
232 reply.writeInt(result);
233 return true;
234 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800235
236 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
237 {
238 data.enforceInterface(IActivityManager.descriptor);
239 IBinder callingActivity = data.readStrongBinder();
240 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700241 Bundle options = data.readInt() != 0
242 ? Bundle.CREATOR.createFromParcel(data) : null;
243 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800244 reply.writeNoException();
245 reply.writeInt(result ? 1 : 0);
246 return true;
247 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 case FINISH_ACTIVITY_TRANSACTION: {
250 data.enforceInterface(IActivityManager.descriptor);
251 IBinder token = data.readStrongBinder();
252 Intent resultData = null;
253 int resultCode = data.readInt();
254 if (data.readInt() != 0) {
255 resultData = Intent.CREATOR.createFromParcel(data);
256 }
257 boolean res = finishActivity(token, resultCode, resultData);
258 reply.writeNoException();
259 reply.writeInt(res ? 1 : 0);
260 return true;
261 }
262
263 case FINISH_SUB_ACTIVITY_TRANSACTION: {
264 data.enforceInterface(IActivityManager.descriptor);
265 IBinder token = data.readStrongBinder();
266 String resultWho = data.readString();
267 int requestCode = data.readInt();
268 finishSubActivity(token, resultWho, requestCode);
269 reply.writeNoException();
270 return true;
271 }
272
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700273 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
274 data.enforceInterface(IActivityManager.descriptor);
275 IBinder token = data.readStrongBinder();
276 boolean res = finishActivityAffinity(token);
277 reply.writeNoException();
278 reply.writeInt(res ? 1 : 0);
279 return true;
280 }
281
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800282 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
283 data.enforceInterface(IActivityManager.descriptor);
284 IBinder token = data.readStrongBinder();
285 boolean res = willActivityBeVisible(token);
286 reply.writeNoException();
287 reply.writeInt(res ? 1 : 0);
288 return true;
289 }
290
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800291 case REGISTER_RECEIVER_TRANSACTION:
292 {
293 data.enforceInterface(IActivityManager.descriptor);
294 IBinder b = data.readStrongBinder();
295 IApplicationThread app =
296 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700297 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 b = data.readStrongBinder();
299 IIntentReceiver rec
300 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
301 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
302 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700303 int userId = data.readInt();
304 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800305 reply.writeNoException();
306 if (intent != null) {
307 reply.writeInt(1);
308 intent.writeToParcel(reply, 0);
309 } else {
310 reply.writeInt(0);
311 }
312 return true;
313 }
314
315 case UNREGISTER_RECEIVER_TRANSACTION:
316 {
317 data.enforceInterface(IActivityManager.descriptor);
318 IBinder b = data.readStrongBinder();
319 if (b == null) {
320 return true;
321 }
322 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
323 unregisterReceiver(rec);
324 reply.writeNoException();
325 return true;
326 }
327
328 case BROADCAST_INTENT_TRANSACTION:
329 {
330 data.enforceInterface(IActivityManager.descriptor);
331 IBinder b = data.readStrongBinder();
332 IApplicationThread app =
333 b != null ? ApplicationThreadNative.asInterface(b) : null;
334 Intent intent = Intent.CREATOR.createFromParcel(data);
335 String resolvedType = data.readString();
336 b = data.readStrongBinder();
337 IIntentReceiver resultTo =
338 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
339 int resultCode = data.readInt();
340 String resultData = data.readString();
341 Bundle resultExtras = data.readBundle();
342 String perm = data.readString();
343 boolean serialized = data.readInt() != 0;
344 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700345 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800346 int res = broadcastIntent(app, intent, resolvedType, resultTo,
347 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700348 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800349 reply.writeNoException();
350 reply.writeInt(res);
351 return true;
352 }
353
354 case UNBROADCAST_INTENT_TRANSACTION:
355 {
356 data.enforceInterface(IActivityManager.descriptor);
357 IBinder b = data.readStrongBinder();
358 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
359 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700360 int userId = data.readInt();
361 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 reply.writeNoException();
363 return true;
364 }
365
366 case FINISH_RECEIVER_TRANSACTION: {
367 data.enforceInterface(IActivityManager.descriptor);
368 IBinder who = data.readStrongBinder();
369 int resultCode = data.readInt();
370 String resultData = data.readString();
371 Bundle resultExtras = data.readBundle();
372 boolean resultAbort = data.readInt() != 0;
373 if (who != null) {
374 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
375 }
376 reply.writeNoException();
377 return true;
378 }
379
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 case ATTACH_APPLICATION_TRANSACTION: {
381 data.enforceInterface(IActivityManager.descriptor);
382 IApplicationThread app = ApplicationThreadNative.asInterface(
383 data.readStrongBinder());
384 if (app != null) {
385 attachApplication(app);
386 }
387 reply.writeNoException();
388 return true;
389 }
390
391 case ACTIVITY_IDLE_TRANSACTION: {
392 data.enforceInterface(IActivityManager.descriptor);
393 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700394 Configuration config = null;
395 if (data.readInt() != 0) {
396 config = Configuration.CREATOR.createFromParcel(data);
397 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700398 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700400 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800401 }
402 reply.writeNoException();
403 return true;
404 }
405
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700406 case ACTIVITY_RESUMED_TRANSACTION: {
407 data.enforceInterface(IActivityManager.descriptor);
408 IBinder token = data.readStrongBinder();
409 activityResumed(token);
410 reply.writeNoException();
411 return true;
412 }
413
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800414 case ACTIVITY_PAUSED_TRANSACTION: {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800417 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 reply.writeNoException();
419 return true;
420 }
421
422 case ACTIVITY_STOPPED_TRANSACTION: {
423 data.enforceInterface(IActivityManager.descriptor);
424 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800425 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800426 Bitmap thumbnail = data.readInt() != 0
427 ? Bitmap.CREATOR.createFromParcel(data) : null;
428 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800429 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430 reply.writeNoException();
431 return true;
432 }
433
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800434 case ACTIVITY_SLEPT_TRANSACTION: {
435 data.enforceInterface(IActivityManager.descriptor);
436 IBinder token = data.readStrongBinder();
437 activitySlept(token);
438 reply.writeNoException();
439 return true;
440 }
441
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 case ACTIVITY_DESTROYED_TRANSACTION: {
443 data.enforceInterface(IActivityManager.descriptor);
444 IBinder token = data.readStrongBinder();
445 activityDestroyed(token);
446 reply.writeNoException();
447 return true;
448 }
449
450 case GET_CALLING_PACKAGE_TRANSACTION: {
451 data.enforceInterface(IActivityManager.descriptor);
452 IBinder token = data.readStrongBinder();
453 String res = token != null ? getCallingPackage(token) : null;
454 reply.writeNoException();
455 reply.writeString(res);
456 return true;
457 }
458
459 case GET_CALLING_ACTIVITY_TRANSACTION: {
460 data.enforceInterface(IActivityManager.descriptor);
461 IBinder token = data.readStrongBinder();
462 ComponentName cn = getCallingActivity(token);
463 reply.writeNoException();
464 ComponentName.writeToParcel(cn, reply);
465 return true;
466 }
467
468 case GET_TASKS_TRANSACTION: {
469 data.enforceInterface(IActivityManager.descriptor);
470 int maxNum = data.readInt();
471 int fl = data.readInt();
472 IBinder receiverBinder = data.readStrongBinder();
473 IThumbnailReceiver receiver = receiverBinder != null
474 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
475 : null;
476 List list = getTasks(maxNum, fl, receiver);
477 reply.writeNoException();
478 int N = list != null ? list.size() : -1;
479 reply.writeInt(N);
480 int i;
481 for (i=0; i<N; i++) {
482 ActivityManager.RunningTaskInfo info =
483 (ActivityManager.RunningTaskInfo)list.get(i);
484 info.writeToParcel(reply, 0);
485 }
486 return true;
487 }
488
489 case GET_RECENT_TASKS_TRANSACTION: {
490 data.enforceInterface(IActivityManager.descriptor);
491 int maxNum = data.readInt();
492 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700493 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700495 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 reply.writeNoException();
497 reply.writeTypedList(list);
498 return true;
499 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700500
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700501 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800502 data.enforceInterface(IActivityManager.descriptor);
503 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700504 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800505 reply.writeNoException();
506 if (bm != null) {
507 reply.writeInt(1);
508 bm.writeToParcel(reply, 0);
509 } else {
510 reply.writeInt(0);
511 }
512 return true;
513 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700514
515 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
516 data.enforceInterface(IActivityManager.descriptor);
517 int id = data.readInt();
518 Bitmap bm = getTaskTopThumbnail(id);
519 reply.writeNoException();
520 if (bm != null) {
521 reply.writeInt(1);
522 bm.writeToParcel(reply, 0);
523 } else {
524 reply.writeInt(0);
525 }
526 return true;
527 }
528
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800529 case GET_SERVICES_TRANSACTION: {
530 data.enforceInterface(IActivityManager.descriptor);
531 int maxNum = data.readInt();
532 int fl = data.readInt();
533 List list = getServices(maxNum, fl);
534 reply.writeNoException();
535 int N = list != null ? list.size() : -1;
536 reply.writeInt(N);
537 int i;
538 for (i=0; i<N; i++) {
539 ActivityManager.RunningServiceInfo info =
540 (ActivityManager.RunningServiceInfo)list.get(i);
541 info.writeToParcel(reply, 0);
542 }
543 return true;
544 }
545
546 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
549 reply.writeNoException();
550 reply.writeTypedList(list);
551 return true;
552 }
553
554 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
555 data.enforceInterface(IActivityManager.descriptor);
556 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
557 reply.writeNoException();
558 reply.writeTypedList(list);
559 return true;
560 }
561
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700562 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
563 data.enforceInterface(IActivityManager.descriptor);
564 List<ApplicationInfo> list = getRunningExternalApplications();
565 reply.writeNoException();
566 reply.writeTypedList(list);
567 return true;
568 }
569
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800570 case MOVE_TASK_TO_FRONT_TRANSACTION: {
571 data.enforceInterface(IActivityManager.descriptor);
572 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800573 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700574 Bundle options = data.readInt() != 0
575 ? Bundle.CREATOR.createFromParcel(data) : null;
576 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800577 reply.writeNoException();
578 return true;
579 }
580
581 case MOVE_TASK_TO_BACK_TRANSACTION: {
582 data.enforceInterface(IActivityManager.descriptor);
583 int task = data.readInt();
584 moveTaskToBack(task);
585 reply.writeNoException();
586 return true;
587 }
588
589 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
591 IBinder token = data.readStrongBinder();
592 boolean nonRoot = data.readInt() != 0;
593 boolean res = moveActivityTaskToBack(token, nonRoot);
594 reply.writeNoException();
595 reply.writeInt(res ? 1 : 0);
596 return true;
597 }
598
599 case MOVE_TASK_BACKWARDS_TRANSACTION: {
600 data.enforceInterface(IActivityManager.descriptor);
601 int task = data.readInt();
602 moveTaskBackwards(task);
603 reply.writeNoException();
604 return true;
605 }
606
607 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 IBinder token = data.readStrongBinder();
610 boolean onlyRoot = data.readInt() != 0;
611 int res = token != null
612 ? getTaskForActivity(token, onlyRoot) : -1;
613 reply.writeNoException();
614 reply.writeInt(res);
615 return true;
616 }
617
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800618 case REPORT_THUMBNAIL_TRANSACTION: {
619 data.enforceInterface(IActivityManager.descriptor);
620 IBinder token = data.readStrongBinder();
621 Bitmap thumbnail = data.readInt() != 0
622 ? Bitmap.CREATOR.createFromParcel(data) : null;
623 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
624 reportThumbnail(token, thumbnail, description);
625 reply.writeNoException();
626 return true;
627 }
628
629 case GET_CONTENT_PROVIDER_TRANSACTION: {
630 data.enforceInterface(IActivityManager.descriptor);
631 IBinder b = data.readStrongBinder();
632 IApplicationThread app = ApplicationThreadNative.asInterface(b);
633 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700634 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700635 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700636 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800637 reply.writeNoException();
638 if (cph != null) {
639 reply.writeInt(1);
640 cph.writeToParcel(reply, 0);
641 } else {
642 reply.writeInt(0);
643 }
644 return true;
645 }
646
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800647 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
648 data.enforceInterface(IActivityManager.descriptor);
649 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700650 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800651 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700652 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800653 reply.writeNoException();
654 if (cph != null) {
655 reply.writeInt(1);
656 cph.writeToParcel(reply, 0);
657 } else {
658 reply.writeInt(0);
659 }
660 return true;
661 }
662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800663 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
664 data.enforceInterface(IActivityManager.descriptor);
665 IBinder b = data.readStrongBinder();
666 IApplicationThread app = ApplicationThreadNative.asInterface(b);
667 ArrayList<ContentProviderHolder> providers =
668 data.createTypedArrayList(ContentProviderHolder.CREATOR);
669 publishContentProviders(app, providers);
670 reply.writeNoException();
671 return true;
672 }
673
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700674 case REF_CONTENT_PROVIDER_TRANSACTION: {
675 data.enforceInterface(IActivityManager.descriptor);
676 IBinder b = data.readStrongBinder();
677 int stable = data.readInt();
678 int unstable = data.readInt();
679 boolean res = refContentProvider(b, stable, unstable);
680 reply.writeNoException();
681 reply.writeInt(res ? 1 : 0);
682 return true;
683 }
684
685 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
686 data.enforceInterface(IActivityManager.descriptor);
687 IBinder b = data.readStrongBinder();
688 unstableProviderDied(b);
689 reply.writeNoException();
690 return true;
691 }
692
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800693 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700696 boolean stable = data.readInt() != 0;
697 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 reply.writeNoException();
699 return true;
700 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800701
702 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 String name = data.readString();
705 IBinder token = data.readStrongBinder();
706 removeContentProviderExternal(name, token);
707 reply.writeNoException();
708 return true;
709 }
710
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700711 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
712 data.enforceInterface(IActivityManager.descriptor);
713 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
714 PendingIntent pi = getRunningServiceControlPanel(comp);
715 reply.writeNoException();
716 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
717 return true;
718 }
719
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 case START_SERVICE_TRANSACTION: {
721 data.enforceInterface(IActivityManager.descriptor);
722 IBinder b = data.readStrongBinder();
723 IApplicationThread app = ApplicationThreadNative.asInterface(b);
724 Intent service = Intent.CREATOR.createFromParcel(data);
725 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700726 int userId = data.readInt();
727 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 reply.writeNoException();
729 ComponentName.writeToParcel(cn, reply);
730 return true;
731 }
732
733 case STOP_SERVICE_TRANSACTION: {
734 data.enforceInterface(IActivityManager.descriptor);
735 IBinder b = data.readStrongBinder();
736 IApplicationThread app = ApplicationThreadNative.asInterface(b);
737 Intent service = Intent.CREATOR.createFromParcel(data);
738 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700739 int userId = data.readInt();
740 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800741 reply.writeNoException();
742 reply.writeInt(res);
743 return true;
744 }
745
746 case STOP_SERVICE_TOKEN_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 ComponentName className = ComponentName.readFromParcel(data);
749 IBinder token = data.readStrongBinder();
750 int startId = data.readInt();
751 boolean res = stopServiceToken(className, token, startId);
752 reply.writeNoException();
753 reply.writeInt(res ? 1 : 0);
754 return true;
755 }
756
757 case SET_SERVICE_FOREGROUND_TRANSACTION: {
758 data.enforceInterface(IActivityManager.descriptor);
759 ComponentName className = ComponentName.readFromParcel(data);
760 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700761 int id = data.readInt();
762 Notification notification = null;
763 if (data.readInt() != 0) {
764 notification = Notification.CREATOR.createFromParcel(data);
765 }
766 boolean removeNotification = data.readInt() != 0;
767 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 reply.writeNoException();
769 return true;
770 }
771
772 case BIND_SERVICE_TRANSACTION: {
773 data.enforceInterface(IActivityManager.descriptor);
774 IBinder b = data.readStrongBinder();
775 IApplicationThread app = ApplicationThreadNative.asInterface(b);
776 IBinder token = data.readStrongBinder();
777 Intent service = Intent.CREATOR.createFromParcel(data);
778 String resolvedType = data.readString();
779 b = data.readStrongBinder();
780 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800781 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800782 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800783 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800784 reply.writeNoException();
785 reply.writeInt(res);
786 return true;
787 }
788
789 case UNBIND_SERVICE_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 IBinder b = data.readStrongBinder();
792 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
793 boolean res = unbindService(conn);
794 reply.writeNoException();
795 reply.writeInt(res ? 1 : 0);
796 return true;
797 }
798
799 case PUBLISH_SERVICE_TRANSACTION: {
800 data.enforceInterface(IActivityManager.descriptor);
801 IBinder token = data.readStrongBinder();
802 Intent intent = Intent.CREATOR.createFromParcel(data);
803 IBinder service = data.readStrongBinder();
804 publishService(token, intent, service);
805 reply.writeNoException();
806 return true;
807 }
808
809 case UNBIND_FINISHED_TRANSACTION: {
810 data.enforceInterface(IActivityManager.descriptor);
811 IBinder token = data.readStrongBinder();
812 Intent intent = Intent.CREATOR.createFromParcel(data);
813 boolean doRebind = data.readInt() != 0;
814 unbindFinished(token, intent, doRebind);
815 reply.writeNoException();
816 return true;
817 }
818
819 case SERVICE_DONE_EXECUTING_TRANSACTION: {
820 data.enforceInterface(IActivityManager.descriptor);
821 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700822 int type = data.readInt();
823 int startId = data.readInt();
824 int res = data.readInt();
825 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800826 reply.writeNoException();
827 return true;
828 }
829
830 case START_INSTRUMENTATION_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 ComponentName className = ComponentName.readFromParcel(data);
833 String profileFile = data.readString();
834 int fl = data.readInt();
835 Bundle arguments = data.readBundle();
836 IBinder b = data.readStrongBinder();
837 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800838 b = data.readStrongBinder();
839 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700840 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800841 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800842 reply.writeNoException();
843 reply.writeInt(res ? 1 : 0);
844 return true;
845 }
846
847
848 case FINISH_INSTRUMENTATION_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 IBinder b = data.readStrongBinder();
851 IApplicationThread app = ApplicationThreadNative.asInterface(b);
852 int resultCode = data.readInt();
853 Bundle results = data.readBundle();
854 finishInstrumentation(app, resultCode, results);
855 reply.writeNoException();
856 return true;
857 }
858
859 case GET_CONFIGURATION_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 Configuration config = getConfiguration();
862 reply.writeNoException();
863 config.writeToParcel(reply, 0);
864 return true;
865 }
866
867 case UPDATE_CONFIGURATION_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 Configuration config = Configuration.CREATOR.createFromParcel(data);
870 updateConfiguration(config);
871 reply.writeNoException();
872 return true;
873 }
874
875 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 IBinder token = data.readStrongBinder();
878 int requestedOrientation = data.readInt();
879 setRequestedOrientation(token, requestedOrientation);
880 reply.writeNoException();
881 return true;
882 }
883
884 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
885 data.enforceInterface(IActivityManager.descriptor);
886 IBinder token = data.readStrongBinder();
887 int req = getRequestedOrientation(token);
888 reply.writeNoException();
889 reply.writeInt(req);
890 return true;
891 }
892
893 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
894 data.enforceInterface(IActivityManager.descriptor);
895 IBinder token = data.readStrongBinder();
896 ComponentName cn = getActivityClassForToken(token);
897 reply.writeNoException();
898 ComponentName.writeToParcel(cn, reply);
899 return true;
900 }
901
902 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
903 data.enforceInterface(IActivityManager.descriptor);
904 IBinder token = data.readStrongBinder();
905 reply.writeNoException();
906 reply.writeString(getPackageForToken(token));
907 return true;
908 }
909
910 case GET_INTENT_SENDER_TRANSACTION: {
911 data.enforceInterface(IActivityManager.descriptor);
912 int type = data.readInt();
913 String packageName = data.readString();
914 IBinder token = data.readStrongBinder();
915 String resultWho = data.readString();
916 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800917 Intent[] requestIntents;
918 String[] requestResolvedTypes;
919 if (data.readInt() != 0) {
920 requestIntents = data.createTypedArray(Intent.CREATOR);
921 requestResolvedTypes = data.createStringArray();
922 } else {
923 requestIntents = null;
924 requestResolvedTypes = null;
925 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700927 Bundle options = data.readInt() != 0
928 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700929 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800930 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800931 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700932 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800933 reply.writeNoException();
934 reply.writeStrongBinder(res != null ? res.asBinder() : null);
935 return true;
936 }
937
938 case CANCEL_INTENT_SENDER_TRANSACTION: {
939 data.enforceInterface(IActivityManager.descriptor);
940 IIntentSender r = IIntentSender.Stub.asInterface(
941 data.readStrongBinder());
942 cancelIntentSender(r);
943 reply.writeNoException();
944 return true;
945 }
946
947 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
948 data.enforceInterface(IActivityManager.descriptor);
949 IIntentSender r = IIntentSender.Stub.asInterface(
950 data.readStrongBinder());
951 String res = getPackageForIntentSender(r);
952 reply.writeNoException();
953 reply.writeString(res);
954 return true;
955 }
956
Christopher Tatec4a07d12012-04-06 14:19:13 -0700957 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 IIntentSender r = IIntentSender.Stub.asInterface(
960 data.readStrongBinder());
961 int res = getUidForIntentSender(r);
962 reply.writeNoException();
963 reply.writeInt(res);
964 return true;
965 }
966
Dianne Hackborn41203752012-08-31 14:05:51 -0700967 case HANDLE_INCOMING_USER_TRANSACTION: {
968 data.enforceInterface(IActivityManager.descriptor);
969 int callingPid = data.readInt();
970 int callingUid = data.readInt();
971 int userId = data.readInt();
972 boolean allowAll = data.readInt() != 0 ;
973 boolean requireFull = data.readInt() != 0;
974 String name = data.readString();
975 String callerPackage = data.readString();
976 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
977 requireFull, name, callerPackage);
978 reply.writeNoException();
979 reply.writeInt(res);
980 return true;
981 }
982
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800983 case SET_PROCESS_LIMIT_TRANSACTION: {
984 data.enforceInterface(IActivityManager.descriptor);
985 int max = data.readInt();
986 setProcessLimit(max);
987 reply.writeNoException();
988 return true;
989 }
990
991 case GET_PROCESS_LIMIT_TRANSACTION: {
992 data.enforceInterface(IActivityManager.descriptor);
993 int limit = getProcessLimit();
994 reply.writeNoException();
995 reply.writeInt(limit);
996 return true;
997 }
998
999 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1000 data.enforceInterface(IActivityManager.descriptor);
1001 IBinder token = data.readStrongBinder();
1002 int pid = data.readInt();
1003 boolean isForeground = data.readInt() != 0;
1004 setProcessForeground(token, pid, isForeground);
1005 reply.writeNoException();
1006 return true;
1007 }
1008
1009 case CHECK_PERMISSION_TRANSACTION: {
1010 data.enforceInterface(IActivityManager.descriptor);
1011 String perm = data.readString();
1012 int pid = data.readInt();
1013 int uid = data.readInt();
1014 int res = checkPermission(perm, pid, uid);
1015 reply.writeNoException();
1016 reply.writeInt(res);
1017 return true;
1018 }
1019
1020 case CHECK_URI_PERMISSION_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 Uri uri = Uri.CREATOR.createFromParcel(data);
1023 int pid = data.readInt();
1024 int uid = data.readInt();
1025 int mode = data.readInt();
1026 int res = checkUriPermission(uri, pid, uid, mode);
1027 reply.writeNoException();
1028 reply.writeInt(res);
1029 return true;
1030 }
1031
1032 case CLEAR_APP_DATA_TRANSACTION: {
1033 data.enforceInterface(IActivityManager.descriptor);
1034 String packageName = data.readString();
1035 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1036 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001037 int userId = data.readInt();
1038 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001039 reply.writeNoException();
1040 reply.writeInt(res ? 1 : 0);
1041 return true;
1042 }
1043
1044 case GRANT_URI_PERMISSION_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 IBinder b = data.readStrongBinder();
1047 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1048 String targetPkg = data.readString();
1049 Uri uri = Uri.CREATOR.createFromParcel(data);
1050 int mode = data.readInt();
1051 grantUriPermission(app, targetPkg, uri, mode);
1052 reply.writeNoException();
1053 return true;
1054 }
1055
1056 case REVOKE_URI_PERMISSION_TRANSACTION: {
1057 data.enforceInterface(IActivityManager.descriptor);
1058 IBinder b = data.readStrongBinder();
1059 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1060 Uri uri = Uri.CREATOR.createFromParcel(data);
1061 int mode = data.readInt();
1062 revokeUriPermission(app, uri, mode);
1063 reply.writeNoException();
1064 return true;
1065 }
1066
1067 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1068 data.enforceInterface(IActivityManager.descriptor);
1069 IBinder b = data.readStrongBinder();
1070 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1071 boolean waiting = data.readInt() != 0;
1072 showWaitingForDebugger(app, waiting);
1073 reply.writeNoException();
1074 return true;
1075 }
1076
1077 case GET_MEMORY_INFO_TRANSACTION: {
1078 data.enforceInterface(IActivityManager.descriptor);
1079 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1080 getMemoryInfo(mi);
1081 reply.writeNoException();
1082 mi.writeToParcel(reply, 0);
1083 return true;
1084 }
1085
1086 case UNHANDLED_BACK_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 unhandledBack();
1089 reply.writeNoException();
1090 return true;
1091 }
1092
1093 case OPEN_CONTENT_URI_TRANSACTION: {
1094 data.enforceInterface(IActivityManager.descriptor);
1095 Uri uri = Uri.parse(data.readString());
1096 ParcelFileDescriptor pfd = openContentUri(uri);
1097 reply.writeNoException();
1098 if (pfd != null) {
1099 reply.writeInt(1);
1100 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1101 } else {
1102 reply.writeInt(0);
1103 }
1104 return true;
1105 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 case GOING_TO_SLEEP_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 goingToSleep();
1110 reply.writeNoException();
1111 return true;
1112 }
1113
1114 case WAKING_UP_TRANSACTION: {
1115 data.enforceInterface(IActivityManager.descriptor);
1116 wakingUp();
1117 reply.writeNoException();
1118 return true;
1119 }
1120
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001121 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1122 data.enforceInterface(IActivityManager.descriptor);
1123 setLockScreenShown(data.readInt() != 0);
1124 reply.writeNoException();
1125 return true;
1126 }
1127
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001128 case SET_DEBUG_APP_TRANSACTION: {
1129 data.enforceInterface(IActivityManager.descriptor);
1130 String pn = data.readString();
1131 boolean wfd = data.readInt() != 0;
1132 boolean per = data.readInt() != 0;
1133 setDebugApp(pn, wfd, per);
1134 reply.writeNoException();
1135 return true;
1136 }
1137
1138 case SET_ALWAYS_FINISH_TRANSACTION: {
1139 data.enforceInterface(IActivityManager.descriptor);
1140 boolean enabled = data.readInt() != 0;
1141 setAlwaysFinish(enabled);
1142 reply.writeNoException();
1143 return true;
1144 }
1145
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001146 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001148 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001149 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001150 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 return true;
1152 }
1153
1154 case ENTER_SAFE_MODE_TRANSACTION: {
1155 data.enforceInterface(IActivityManager.descriptor);
1156 enterSafeMode();
1157 reply.writeNoException();
1158 return true;
1159 }
1160
1161 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 IIntentSender is = IIntentSender.Stub.asInterface(
1164 data.readStrongBinder());
1165 noteWakeupAlarm(is);
1166 reply.writeNoException();
1167 return true;
1168 }
1169
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001170 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 data.enforceInterface(IActivityManager.descriptor);
1172 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001173 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001174 boolean secure = data.readInt() != 0;
1175 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 reply.writeNoException();
1177 reply.writeInt(res ? 1 : 0);
1178 return true;
1179 }
1180
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001181 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 String reason = data.readString();
1184 boolean res = killProcessesBelowForeground(reason);
1185 reply.writeNoException();
1186 reply.writeInt(res ? 1 : 0);
1187 return true;
1188 }
1189
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 case START_RUNNING_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 String pkg = data.readString();
1193 String cls = data.readString();
1194 String action = data.readString();
1195 String indata = data.readString();
1196 startRunning(pkg, cls, action, indata);
1197 reply.writeNoException();
1198 return true;
1199 }
1200
Dan Egnor60d87622009-12-16 16:32:58 -08001201 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1202 data.enforceInterface(IActivityManager.descriptor);
1203 IBinder app = data.readStrongBinder();
1204 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1205 handleApplicationCrash(app, ci);
1206 reply.writeNoException();
1207 return true;
1208 }
1209
1210 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211 data.enforceInterface(IActivityManager.descriptor);
1212 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001214 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001215 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001217 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 return true;
1219 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001220
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001221 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1222 data.enforceInterface(IActivityManager.descriptor);
1223 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001224 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001225 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1226 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001227 reply.writeNoException();
1228 return true;
1229 }
1230
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1232 data.enforceInterface(IActivityManager.descriptor);
1233 int sig = data.readInt();
1234 signalPersistentProcesses(sig);
1235 reply.writeNoException();
1236 return true;
1237 }
1238
Dianne Hackborn03abb812010-01-04 18:43:19 -08001239 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1240 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001242 int userId = data.readInt();
1243 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001244 reply.writeNoException();
1245 return true;
1246 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001247
1248 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 killAllBackgroundProcesses();
1251 reply.writeNoException();
1252 return true;
1253 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001254
1255 case FORCE_STOP_PACKAGE_TRANSACTION: {
1256 data.enforceInterface(IActivityManager.descriptor);
1257 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001258 int userId = data.readInt();
1259 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001260 reply.writeNoException();
1261 return true;
1262 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001263
1264 case GET_MY_MEMORY_STATE_TRANSACTION: {
1265 data.enforceInterface(IActivityManager.descriptor);
1266 ActivityManager.RunningAppProcessInfo info =
1267 new ActivityManager.RunningAppProcessInfo();
1268 getMyMemoryState(info);
1269 reply.writeNoException();
1270 info.writeToParcel(reply, 0);
1271 return true;
1272 }
1273
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1275 data.enforceInterface(IActivityManager.descriptor);
1276 ConfigurationInfo config = getDeviceConfigurationInfo();
1277 reply.writeNoException();
1278 config.writeToParcel(reply, 0);
1279 return true;
1280 }
1281
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001282 case PROFILE_CONTROL_TRANSACTION: {
1283 data.enforceInterface(IActivityManager.descriptor);
1284 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001285 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001286 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001287 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001288 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001289 ParcelFileDescriptor fd = data.readInt() != 0
1290 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001291 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001292 reply.writeNoException();
1293 reply.writeInt(res ? 1 : 0);
1294 return true;
1295 }
1296
Dianne Hackborn55280a92009-05-07 15:53:46 -07001297 case SHUTDOWN_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 boolean res = shutdown(data.readInt());
1300 reply.writeNoException();
1301 reply.writeInt(res ? 1 : 0);
1302 return true;
1303 }
1304
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001305 case STOP_APP_SWITCHES_TRANSACTION: {
1306 data.enforceInterface(IActivityManager.descriptor);
1307 stopAppSwitches();
1308 reply.writeNoException();
1309 return true;
1310 }
1311
1312 case RESUME_APP_SWITCHES_TRANSACTION: {
1313 data.enforceInterface(IActivityManager.descriptor);
1314 resumeAppSwitches();
1315 reply.writeNoException();
1316 return true;
1317 }
1318
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001319 case PEEK_SERVICE_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 Intent service = Intent.CREATOR.createFromParcel(data);
1322 String resolvedType = data.readString();
1323 IBinder binder = peekService(service, resolvedType);
1324 reply.writeNoException();
1325 reply.writeStrongBinder(binder);
1326 return true;
1327 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001328
1329 case START_BACKUP_AGENT_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1332 int backupRestoreMode = data.readInt();
1333 boolean success = bindBackupAgent(info, backupRestoreMode);
1334 reply.writeNoException();
1335 reply.writeInt(success ? 1 : 0);
1336 return true;
1337 }
1338
1339 case BACKUP_AGENT_CREATED_TRANSACTION: {
1340 data.enforceInterface(IActivityManager.descriptor);
1341 String packageName = data.readString();
1342 IBinder agent = data.readStrongBinder();
1343 backupAgentCreated(packageName, agent);
1344 reply.writeNoException();
1345 return true;
1346 }
1347
1348 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1351 unbindBackupAgent(info);
1352 reply.writeNoException();
1353 return true;
1354 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001355
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001356 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001357 data.enforceInterface(IActivityManager.descriptor);
1358 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001359 int appid = data.readInt();
1360 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001361 reply.writeNoException();
1362 return true;
1363 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001364
1365 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 String reason = data.readString();
1368 closeSystemDialogs(reason);
1369 reply.writeNoException();
1370 return true;
1371 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001372
1373 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001375 int[] pids = data.createIntArray();
1376 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001377 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001378 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001379 return true;
1380 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001381
1382 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1383 data.enforceInterface(IActivityManager.descriptor);
1384 String processName = data.readString();
1385 int uid = data.readInt();
1386 killApplicationProcess(processName, uid);
1387 reply.writeNoException();
1388 return true;
1389 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001390
1391 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1392 data.enforceInterface(IActivityManager.descriptor);
1393 IBinder token = data.readStrongBinder();
1394 String packageName = data.readString();
1395 int enterAnim = data.readInt();
1396 int exitAnim = data.readInt();
1397 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001398 reply.writeNoException();
1399 return true;
1400 }
1401
1402 case IS_USER_A_MONKEY_TRANSACTION: {
1403 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001404 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001405 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001406 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001407 return true;
1408 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001409
1410 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 finishHeavyWeightApp();
1413 reply.writeNoException();
1414 return true;
1415 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001416
1417 case IS_IMMERSIVE_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
1419 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001420 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001421 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001422 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001423 return true;
1424 }
1425
1426 case SET_IMMERSIVE_TRANSACTION: {
1427 data.enforceInterface(IActivityManager.descriptor);
1428 IBinder token = data.readStrongBinder();
1429 boolean imm = data.readInt() == 1;
1430 setImmersive(token, imm);
1431 reply.writeNoException();
1432 return true;
1433 }
1434
1435 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1436 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001437 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001438 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001439 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001440 return true;
1441 }
1442
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001443 case CRASH_APPLICATION_TRANSACTION: {
1444 data.enforceInterface(IActivityManager.descriptor);
1445 int uid = data.readInt();
1446 int initialPid = data.readInt();
1447 String packageName = data.readString();
1448 String message = data.readString();
1449 crashApplication(uid, initialPid, packageName, message);
1450 reply.writeNoException();
1451 return true;
1452 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001453
1454 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1455 data.enforceInterface(IActivityManager.descriptor);
1456 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001457 int userId = data.readInt();
1458 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001459 reply.writeNoException();
1460 reply.writeString(type);
1461 return true;
1462 }
1463
Dianne Hackborn7e269642010-08-25 19:50:20 -07001464 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 String name = data.readString();
1467 IBinder perm = newUriPermissionOwner(name);
1468 reply.writeNoException();
1469 reply.writeStrongBinder(perm);
1470 return true;
1471 }
1472
1473 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1474 data.enforceInterface(IActivityManager.descriptor);
1475 IBinder owner = data.readStrongBinder();
1476 int fromUid = data.readInt();
1477 String targetPkg = data.readString();
1478 Uri uri = Uri.CREATOR.createFromParcel(data);
1479 int mode = data.readInt();
1480 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1481 reply.writeNoException();
1482 return true;
1483 }
1484
1485 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 IBinder owner = data.readStrongBinder();
1488 Uri uri = null;
1489 if (data.readInt() != 0) {
1490 Uri.CREATOR.createFromParcel(data);
1491 }
1492 int mode = data.readInt();
1493 revokeUriPermissionFromOwner(owner, uri, mode);
1494 reply.writeNoException();
1495 return true;
1496 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001497
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001498 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1499 data.enforceInterface(IActivityManager.descriptor);
1500 int callingUid = data.readInt();
1501 String targetPkg = data.readString();
1502 Uri uri = Uri.CREATOR.createFromParcel(data);
1503 int modeFlags = data.readInt();
1504 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1505 reply.writeNoException();
1506 reply.writeInt(res);
1507 return true;
1508 }
1509
Andy McFadden824c5102010-07-09 16:26:57 -07001510 case DUMP_HEAP_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001513 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001514 boolean managed = data.readInt() != 0;
1515 String path = data.readString();
1516 ParcelFileDescriptor fd = data.readInt() != 0
1517 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001518 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001519 reply.writeNoException();
1520 reply.writeInt(res ? 1 : 0);
1521 return true;
1522 }
1523
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001524 case START_ACTIVITIES_TRANSACTION:
1525 {
1526 data.enforceInterface(IActivityManager.descriptor);
1527 IBinder b = data.readStrongBinder();
1528 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1529 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1530 String[] resolvedTypes = data.createStringArray();
1531 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001532 Bundle options = data.readInt() != 0
1533 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001534 int userId = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001535 int result = startActivities(app, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001536 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001537 reply.writeNoException();
1538 reply.writeInt(result);
1539 return true;
1540 }
1541
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001542 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1543 {
1544 data.enforceInterface(IActivityManager.descriptor);
1545 int mode = getFrontActivityScreenCompatMode();
1546 reply.writeNoException();
1547 reply.writeInt(mode);
1548 return true;
1549 }
1550
1551 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1552 {
1553 data.enforceInterface(IActivityManager.descriptor);
1554 int mode = data.readInt();
1555 setFrontActivityScreenCompatMode(mode);
1556 reply.writeNoException();
1557 reply.writeInt(mode);
1558 return true;
1559 }
1560
1561 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1562 {
1563 data.enforceInterface(IActivityManager.descriptor);
1564 String pkg = data.readString();
1565 int mode = getPackageScreenCompatMode(pkg);
1566 reply.writeNoException();
1567 reply.writeInt(mode);
1568 return true;
1569 }
1570
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001571 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1572 {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001575 int mode = data.readInt();
1576 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001577 reply.writeNoException();
1578 return true;
1579 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001580
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001581 case SWITCH_USER_TRANSACTION: {
1582 data.enforceInterface(IActivityManager.descriptor);
1583 int userid = data.readInt();
1584 boolean result = switchUser(userid);
1585 reply.writeNoException();
1586 reply.writeInt(result ? 1 : 0);
1587 return true;
1588 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001589
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001590 case STOP_USER_TRANSACTION: {
1591 data.enforceInterface(IActivityManager.descriptor);
1592 int userid = data.readInt();
1593 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1594 data.readStrongBinder());
1595 int result = stopUser(userid, callback);
1596 reply.writeNoException();
1597 reply.writeInt(result);
1598 return true;
1599 }
1600
Amith Yamasani52f1d752012-03-28 18:19:29 -07001601 case GET_CURRENT_USER_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 UserInfo userInfo = getCurrentUser();
1604 reply.writeNoException();
1605 userInfo.writeToParcel(reply, 0);
1606 return true;
1607 }
1608
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001609 case IS_USER_RUNNING_TRANSACTION: {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001612 boolean orStopping = data.readInt() != 0;
1613 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001614 reply.writeNoException();
1615 reply.writeInt(result ? 1 : 0);
1616 return true;
1617 }
1618
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001619 case GET_RUNNING_USER_IDS_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 int[] result = getRunningUserIds();
1622 reply.writeNoException();
1623 reply.writeIntArray(result);
1624 return true;
1625 }
1626
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001627 case REMOVE_SUB_TASK_TRANSACTION:
1628 {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 int taskId = data.readInt();
1631 int subTaskIndex = data.readInt();
1632 boolean result = removeSubTask(taskId, subTaskIndex);
1633 reply.writeNoException();
1634 reply.writeInt(result ? 1 : 0);
1635 return true;
1636 }
1637
1638 case REMOVE_TASK_TRANSACTION:
1639 {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 int taskId = data.readInt();
1642 int fl = data.readInt();
1643 boolean result = removeTask(taskId, fl);
1644 reply.writeNoException();
1645 reply.writeInt(result ? 1 : 0);
1646 return true;
1647 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001648
Jeff Sharkeya4620792011-05-20 15:29:23 -07001649 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1650 data.enforceInterface(IActivityManager.descriptor);
1651 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1652 data.readStrongBinder());
1653 registerProcessObserver(observer);
1654 return true;
1655 }
1656
1657 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1660 data.readStrongBinder());
1661 unregisterProcessObserver(observer);
1662 return true;
1663 }
1664
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001665 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1666 {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 String pkg = data.readString();
1669 boolean ask = getPackageAskScreenCompat(pkg);
1670 reply.writeNoException();
1671 reply.writeInt(ask ? 1 : 0);
1672 return true;
1673 }
1674
1675 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1676 {
1677 data.enforceInterface(IActivityManager.descriptor);
1678 String pkg = data.readString();
1679 boolean ask = data.readInt() != 0;
1680 setPackageAskScreenCompat(pkg, ask);
1681 reply.writeNoException();
1682 return true;
1683 }
1684
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001685 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1686 data.enforceInterface(IActivityManager.descriptor);
1687 IIntentSender r = IIntentSender.Stub.asInterface(
1688 data.readStrongBinder());
1689 boolean res = isIntentSenderTargetedToPackage(r);
1690 reply.writeNoException();
1691 reply.writeInt(res ? 1 : 0);
1692 return true;
1693 }
1694
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001695 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 IIntentSender r = IIntentSender.Stub.asInterface(
1698 data.readStrongBinder());
1699 boolean res = isIntentSenderAnActivity(r);
1700 reply.writeNoException();
1701 reply.writeInt(res ? 1 : 0);
1702 return true;
1703 }
1704
Dianne Hackborn81038902012-11-26 17:04:09 -08001705 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1706 data.enforceInterface(IActivityManager.descriptor);
1707 IIntentSender r = IIntentSender.Stub.asInterface(
1708 data.readStrongBinder());
1709 Intent intent = getIntentForIntentSender(r);
1710 reply.writeNoException();
1711 if (intent != null) {
1712 reply.writeInt(1);
1713 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1714 } else {
1715 reply.writeInt(0);
1716 }
1717 return true;
1718 }
1719
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001720 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1721 data.enforceInterface(IActivityManager.descriptor);
1722 Configuration config = Configuration.CREATOR.createFromParcel(data);
1723 updatePersistentConfiguration(config);
1724 reply.writeNoException();
1725 return true;
1726 }
1727
Dianne Hackbornb437e092011-08-05 17:50:29 -07001728 case GET_PROCESS_PSS_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 int[] pids = data.createIntArray();
1731 long[] pss = getProcessPss(pids);
1732 reply.writeNoException();
1733 reply.writeLongArray(pss);
1734 return true;
1735 }
1736
Dianne Hackborn661cd522011-08-22 00:26:20 -07001737 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1738 data.enforceInterface(IActivityManager.descriptor);
1739 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1740 boolean always = data.readInt() != 0;
1741 showBootMessage(msg, always);
1742 reply.writeNoException();
1743 return true;
1744 }
1745
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001746 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1747 data.enforceInterface(IActivityManager.descriptor);
1748 dismissKeyguardOnNextActivity();
1749 reply.writeNoException();
1750 return true;
1751 }
1752
Adam Powelldd8fab22012-03-22 17:47:27 -07001753 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1754 data.enforceInterface(IActivityManager.descriptor);
1755 IBinder token = data.readStrongBinder();
1756 String destAffinity = data.readString();
1757 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1758 reply.writeNoException();
1759 reply.writeInt(res ? 1 : 0);
1760 return true;
1761 }
1762
1763 case NAVIGATE_UP_TO_TRANSACTION: {
1764 data.enforceInterface(IActivityManager.descriptor);
1765 IBinder token = data.readStrongBinder();
1766 Intent target = Intent.CREATOR.createFromParcel(data);
1767 int resultCode = data.readInt();
1768 Intent resultData = null;
1769 if (data.readInt() != 0) {
1770 resultData = Intent.CREATOR.createFromParcel(data);
1771 }
1772 boolean res = navigateUpTo(token, target, resultCode, resultData);
1773 reply.writeNoException();
1774 reply.writeInt(res ? 1 : 0);
1775 return true;
1776 }
1777
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001778 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 IBinder token = data.readStrongBinder();
1781 int res = getLaunchedFromUid(token);
1782 reply.writeNoException();
1783 reply.writeInt(res);
1784 return true;
1785 }
1786
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001787 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1788 data.enforceInterface(IActivityManager.descriptor);
1789 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1790 data.readStrongBinder());
1791 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001792 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001793 return true;
1794 }
1795
1796 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
1798 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1799 data.readStrongBinder());
1800 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001801 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001802 return true;
1803 }
1804
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001805 case REQUEST_BUG_REPORT_TRANSACTION: {
1806 data.enforceInterface(IActivityManager.descriptor);
1807 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001808 reply.writeNoException();
1809 return true;
1810 }
1811
1812 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1813 data.enforceInterface(IActivityManager.descriptor);
1814 int pid = data.readInt();
1815 boolean aboveSystem = data.readInt() != 0;
1816 long res = inputDispatchingTimedOut(pid, aboveSystem);
1817 reply.writeNoException();
1818 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001819 return true;
1820 }
1821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001822 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001823
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001824 return super.onTransact(code, data, reply, flags);
1825 }
1826
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001827 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001828 return this;
1829 }
1830
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001831 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1832 protected IActivityManager create() {
1833 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001834 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001835 Log.v("ActivityManager", "default service binder = " + b);
1836 }
1837 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001838 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001839 Log.v("ActivityManager", "default service = " + am);
1840 }
1841 return am;
1842 }
1843 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001844}
1845
1846class ActivityManagerProxy implements IActivityManager
1847{
1848 public ActivityManagerProxy(IBinder remote)
1849 {
1850 mRemote = remote;
1851 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001852
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001853 public IBinder asBinder()
1854 {
1855 return mRemote;
1856 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001857
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001858 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001859 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1860 int startFlags, String profileFile,
1861 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001862 Parcel data = Parcel.obtain();
1863 Parcel reply = Parcel.obtain();
1864 data.writeInterfaceToken(IActivityManager.descriptor);
1865 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1866 intent.writeToParcel(data, 0);
1867 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001868 data.writeStrongBinder(resultTo);
1869 data.writeString(resultWho);
1870 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001871 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001872 data.writeString(profileFile);
1873 if (profileFd != null) {
1874 data.writeInt(1);
1875 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1876 } else {
1877 data.writeInt(0);
1878 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001879 if (options != null) {
1880 data.writeInt(1);
1881 options.writeToParcel(data, 0);
1882 } else {
1883 data.writeInt(0);
1884 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001885 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1886 reply.readException();
1887 int result = reply.readInt();
1888 reply.recycle();
1889 data.recycle();
1890 return result;
1891 }
Amith Yamasani82644082012-08-03 13:09:11 -07001892
1893 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1894 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1895 int startFlags, String profileFile,
1896 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1897 Parcel data = Parcel.obtain();
1898 Parcel reply = Parcel.obtain();
1899 data.writeInterfaceToken(IActivityManager.descriptor);
1900 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1901 intent.writeToParcel(data, 0);
1902 data.writeString(resolvedType);
1903 data.writeStrongBinder(resultTo);
1904 data.writeString(resultWho);
1905 data.writeInt(requestCode);
1906 data.writeInt(startFlags);
1907 data.writeString(profileFile);
1908 if (profileFd != null) {
1909 data.writeInt(1);
1910 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1911 } else {
1912 data.writeInt(0);
1913 }
1914 if (options != null) {
1915 data.writeInt(1);
1916 options.writeToParcel(data, 0);
1917 } else {
1918 data.writeInt(0);
1919 }
1920 data.writeInt(userId);
1921 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1922 reply.readException();
1923 int result = reply.readInt();
1924 reply.recycle();
1925 data.recycle();
1926 return result;
1927 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001928 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001929 String resolvedType, IBinder resultTo, String resultWho,
1930 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001931 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001932 Parcel data = Parcel.obtain();
1933 Parcel reply = Parcel.obtain();
1934 data.writeInterfaceToken(IActivityManager.descriptor);
1935 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1936 intent.writeToParcel(data, 0);
1937 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001938 data.writeStrongBinder(resultTo);
1939 data.writeString(resultWho);
1940 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001941 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001942 data.writeString(profileFile);
1943 if (profileFd != null) {
1944 data.writeInt(1);
1945 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1946 } else {
1947 data.writeInt(0);
1948 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001949 if (options != null) {
1950 data.writeInt(1);
1951 options.writeToParcel(data, 0);
1952 } else {
1953 data.writeInt(0);
1954 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001955 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001956 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1957 reply.readException();
1958 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1959 reply.recycle();
1960 data.recycle();
1961 return result;
1962 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001963 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001964 String resolvedType, IBinder resultTo, String resultWho,
1965 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001966 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001967 Parcel data = Parcel.obtain();
1968 Parcel reply = Parcel.obtain();
1969 data.writeInterfaceToken(IActivityManager.descriptor);
1970 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1971 intent.writeToParcel(data, 0);
1972 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001973 data.writeStrongBinder(resultTo);
1974 data.writeString(resultWho);
1975 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001976 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001977 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001978 if (options != null) {
1979 data.writeInt(1);
1980 options.writeToParcel(data, 0);
1981 } else {
1982 data.writeInt(0);
1983 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001984 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001985 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1986 reply.readException();
1987 int result = reply.readInt();
1988 reply.recycle();
1989 data.recycle();
1990 return result;
1991 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001992 public int startActivityIntentSender(IApplicationThread caller,
1993 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001994 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001995 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001996 Parcel data = Parcel.obtain();
1997 Parcel reply = Parcel.obtain();
1998 data.writeInterfaceToken(IActivityManager.descriptor);
1999 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2000 intent.writeToParcel(data, 0);
2001 if (fillInIntent != null) {
2002 data.writeInt(1);
2003 fillInIntent.writeToParcel(data, 0);
2004 } else {
2005 data.writeInt(0);
2006 }
2007 data.writeString(resolvedType);
2008 data.writeStrongBinder(resultTo);
2009 data.writeString(resultWho);
2010 data.writeInt(requestCode);
2011 data.writeInt(flagsMask);
2012 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002013 if (options != null) {
2014 data.writeInt(1);
2015 options.writeToParcel(data, 0);
2016 } else {
2017 data.writeInt(0);
2018 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002019 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002020 reply.readException();
2021 int result = reply.readInt();
2022 reply.recycle();
2023 data.recycle();
2024 return result;
2025 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002026 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002027 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002028 Parcel data = Parcel.obtain();
2029 Parcel reply = Parcel.obtain();
2030 data.writeInterfaceToken(IActivityManager.descriptor);
2031 data.writeStrongBinder(callingActivity);
2032 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002033 if (options != null) {
2034 data.writeInt(1);
2035 options.writeToParcel(data, 0);
2036 } else {
2037 data.writeInt(0);
2038 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002039 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2040 reply.readException();
2041 int result = reply.readInt();
2042 reply.recycle();
2043 data.recycle();
2044 return result != 0;
2045 }
2046 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2047 throws RemoteException {
2048 Parcel data = Parcel.obtain();
2049 Parcel reply = Parcel.obtain();
2050 data.writeInterfaceToken(IActivityManager.descriptor);
2051 data.writeStrongBinder(token);
2052 data.writeInt(resultCode);
2053 if (resultData != null) {
2054 data.writeInt(1);
2055 resultData.writeToParcel(data, 0);
2056 } else {
2057 data.writeInt(0);
2058 }
2059 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2060 reply.readException();
2061 boolean res = reply.readInt() != 0;
2062 data.recycle();
2063 reply.recycle();
2064 return res;
2065 }
2066 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2067 {
2068 Parcel data = Parcel.obtain();
2069 Parcel reply = Parcel.obtain();
2070 data.writeInterfaceToken(IActivityManager.descriptor);
2071 data.writeStrongBinder(token);
2072 data.writeString(resultWho);
2073 data.writeInt(requestCode);
2074 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2075 reply.readException();
2076 data.recycle();
2077 reply.recycle();
2078 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002079 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2080 Parcel data = Parcel.obtain();
2081 Parcel reply = Parcel.obtain();
2082 data.writeInterfaceToken(IActivityManager.descriptor);
2083 data.writeStrongBinder(token);
2084 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2085 reply.readException();
2086 boolean res = reply.readInt() != 0;
2087 data.recycle();
2088 reply.recycle();
2089 return res;
2090 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002091 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2092 Parcel data = Parcel.obtain();
2093 Parcel reply = Parcel.obtain();
2094 data.writeInterfaceToken(IActivityManager.descriptor);
2095 data.writeStrongBinder(token);
2096 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2097 reply.readException();
2098 boolean res = reply.readInt() != 0;
2099 data.recycle();
2100 reply.recycle();
2101 return res;
2102 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002103 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002104 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002105 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002106 {
2107 Parcel data = Parcel.obtain();
2108 Parcel reply = Parcel.obtain();
2109 data.writeInterfaceToken(IActivityManager.descriptor);
2110 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002111 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002112 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2113 filter.writeToParcel(data, 0);
2114 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002115 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002116 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2117 reply.readException();
2118 Intent intent = null;
2119 int haveIntent = reply.readInt();
2120 if (haveIntent != 0) {
2121 intent = Intent.CREATOR.createFromParcel(reply);
2122 }
2123 reply.recycle();
2124 data.recycle();
2125 return intent;
2126 }
2127 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2128 {
2129 Parcel data = Parcel.obtain();
2130 Parcel reply = Parcel.obtain();
2131 data.writeInterfaceToken(IActivityManager.descriptor);
2132 data.writeStrongBinder(receiver.asBinder());
2133 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2134 reply.readException();
2135 data.recycle();
2136 reply.recycle();
2137 }
2138 public int broadcastIntent(IApplicationThread caller,
2139 Intent intent, String resolvedType, IIntentReceiver resultTo,
2140 int resultCode, String resultData, Bundle map,
2141 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002142 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002143 {
2144 Parcel data = Parcel.obtain();
2145 Parcel reply = Parcel.obtain();
2146 data.writeInterfaceToken(IActivityManager.descriptor);
2147 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2148 intent.writeToParcel(data, 0);
2149 data.writeString(resolvedType);
2150 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2151 data.writeInt(resultCode);
2152 data.writeString(resultData);
2153 data.writeBundle(map);
2154 data.writeString(requiredPermission);
2155 data.writeInt(serialized ? 1 : 0);
2156 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002157 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002158 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2159 reply.readException();
2160 int res = reply.readInt();
2161 reply.recycle();
2162 data.recycle();
2163 return res;
2164 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002165 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2166 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002167 {
2168 Parcel data = Parcel.obtain();
2169 Parcel reply = Parcel.obtain();
2170 data.writeInterfaceToken(IActivityManager.descriptor);
2171 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2172 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002173 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002174 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2175 reply.readException();
2176 data.recycle();
2177 reply.recycle();
2178 }
2179 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2180 {
2181 Parcel data = Parcel.obtain();
2182 Parcel reply = Parcel.obtain();
2183 data.writeInterfaceToken(IActivityManager.descriptor);
2184 data.writeStrongBinder(who);
2185 data.writeInt(resultCode);
2186 data.writeString(resultData);
2187 data.writeBundle(map);
2188 data.writeInt(abortBroadcast ? 1 : 0);
2189 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2190 reply.readException();
2191 data.recycle();
2192 reply.recycle();
2193 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002194 public void attachApplication(IApplicationThread app) throws RemoteException
2195 {
2196 Parcel data = Parcel.obtain();
2197 Parcel reply = Parcel.obtain();
2198 data.writeInterfaceToken(IActivityManager.descriptor);
2199 data.writeStrongBinder(app.asBinder());
2200 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2201 reply.readException();
2202 data.recycle();
2203 reply.recycle();
2204 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002205 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2206 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002207 {
2208 Parcel data = Parcel.obtain();
2209 Parcel reply = Parcel.obtain();
2210 data.writeInterfaceToken(IActivityManager.descriptor);
2211 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002212 if (config != null) {
2213 data.writeInt(1);
2214 config.writeToParcel(data, 0);
2215 } else {
2216 data.writeInt(0);
2217 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002218 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002219 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2220 reply.readException();
2221 data.recycle();
2222 reply.recycle();
2223 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002224 public void activityResumed(IBinder token) throws RemoteException
2225 {
2226 Parcel data = Parcel.obtain();
2227 Parcel reply = Parcel.obtain();
2228 data.writeInterfaceToken(IActivityManager.descriptor);
2229 data.writeStrongBinder(token);
2230 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2231 reply.readException();
2232 data.recycle();
2233 reply.recycle();
2234 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002235 public void activityPaused(IBinder token) throws RemoteException
2236 {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 data.writeStrongBinder(token);
2241 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2242 reply.readException();
2243 data.recycle();
2244 reply.recycle();
2245 }
2246 public void activityStopped(IBinder token, Bundle state,
2247 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002248 {
2249 Parcel data = Parcel.obtain();
2250 Parcel reply = Parcel.obtain();
2251 data.writeInterfaceToken(IActivityManager.descriptor);
2252 data.writeStrongBinder(token);
2253 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002254 if (thumbnail != null) {
2255 data.writeInt(1);
2256 thumbnail.writeToParcel(data, 0);
2257 } else {
2258 data.writeInt(0);
2259 }
2260 TextUtils.writeToParcel(description, data, 0);
2261 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2262 reply.readException();
2263 data.recycle();
2264 reply.recycle();
2265 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002266 public void activitySlept(IBinder token) throws RemoteException
2267 {
2268 Parcel data = Parcel.obtain();
2269 Parcel reply = Parcel.obtain();
2270 data.writeInterfaceToken(IActivityManager.descriptor);
2271 data.writeStrongBinder(token);
2272 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2273 reply.readException();
2274 data.recycle();
2275 reply.recycle();
2276 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002277 public void activityDestroyed(IBinder token) throws RemoteException
2278 {
2279 Parcel data = Parcel.obtain();
2280 Parcel reply = Parcel.obtain();
2281 data.writeInterfaceToken(IActivityManager.descriptor);
2282 data.writeStrongBinder(token);
2283 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2284 reply.readException();
2285 data.recycle();
2286 reply.recycle();
2287 }
2288 public String getCallingPackage(IBinder token) throws RemoteException
2289 {
2290 Parcel data = Parcel.obtain();
2291 Parcel reply = Parcel.obtain();
2292 data.writeInterfaceToken(IActivityManager.descriptor);
2293 data.writeStrongBinder(token);
2294 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2295 reply.readException();
2296 String res = reply.readString();
2297 data.recycle();
2298 reply.recycle();
2299 return res;
2300 }
2301 public ComponentName getCallingActivity(IBinder token)
2302 throws RemoteException {
2303 Parcel data = Parcel.obtain();
2304 Parcel reply = Parcel.obtain();
2305 data.writeInterfaceToken(IActivityManager.descriptor);
2306 data.writeStrongBinder(token);
2307 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2308 reply.readException();
2309 ComponentName res = ComponentName.readFromParcel(reply);
2310 data.recycle();
2311 reply.recycle();
2312 return res;
2313 }
2314 public List getTasks(int maxNum, int flags,
2315 IThumbnailReceiver receiver) throws RemoteException {
2316 Parcel data = Parcel.obtain();
2317 Parcel reply = Parcel.obtain();
2318 data.writeInterfaceToken(IActivityManager.descriptor);
2319 data.writeInt(maxNum);
2320 data.writeInt(flags);
2321 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2322 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2323 reply.readException();
2324 ArrayList list = null;
2325 int N = reply.readInt();
2326 if (N >= 0) {
2327 list = new ArrayList();
2328 while (N > 0) {
2329 ActivityManager.RunningTaskInfo info =
2330 ActivityManager.RunningTaskInfo.CREATOR
2331 .createFromParcel(reply);
2332 list.add(info);
2333 N--;
2334 }
2335 }
2336 data.recycle();
2337 reply.recycle();
2338 return list;
2339 }
2340 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002341 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 Parcel data = Parcel.obtain();
2343 Parcel reply = Parcel.obtain();
2344 data.writeInterfaceToken(IActivityManager.descriptor);
2345 data.writeInt(maxNum);
2346 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002347 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002348 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2349 reply.readException();
2350 ArrayList<ActivityManager.RecentTaskInfo> list
2351 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2352 data.recycle();
2353 reply.recycle();
2354 return list;
2355 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002356 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002357 Parcel data = Parcel.obtain();
2358 Parcel reply = Parcel.obtain();
2359 data.writeInterfaceToken(IActivityManager.descriptor);
2360 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002361 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002362 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002363 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002364 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002365 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002366 }
2367 data.recycle();
2368 reply.recycle();
2369 return bm;
2370 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002371 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2372 Parcel data = Parcel.obtain();
2373 Parcel reply = Parcel.obtain();
2374 data.writeInterfaceToken(IActivityManager.descriptor);
2375 data.writeInt(id);
2376 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2377 reply.readException();
2378 Bitmap bm = null;
2379 if (reply.readInt() != 0) {
2380 bm = Bitmap.CREATOR.createFromParcel(reply);
2381 }
2382 data.recycle();
2383 reply.recycle();
2384 return bm;
2385 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002386 public List getServices(int maxNum, int flags) throws RemoteException {
2387 Parcel data = Parcel.obtain();
2388 Parcel reply = Parcel.obtain();
2389 data.writeInterfaceToken(IActivityManager.descriptor);
2390 data.writeInt(maxNum);
2391 data.writeInt(flags);
2392 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2393 reply.readException();
2394 ArrayList list = null;
2395 int N = reply.readInt();
2396 if (N >= 0) {
2397 list = new ArrayList();
2398 while (N > 0) {
2399 ActivityManager.RunningServiceInfo info =
2400 ActivityManager.RunningServiceInfo.CREATOR
2401 .createFromParcel(reply);
2402 list.add(info);
2403 N--;
2404 }
2405 }
2406 data.recycle();
2407 reply.recycle();
2408 return list;
2409 }
2410 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2411 throws RemoteException {
2412 Parcel data = Parcel.obtain();
2413 Parcel reply = Parcel.obtain();
2414 data.writeInterfaceToken(IActivityManager.descriptor);
2415 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2416 reply.readException();
2417 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2418 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2419 data.recycle();
2420 reply.recycle();
2421 return list;
2422 }
2423 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2424 throws RemoteException {
2425 Parcel data = Parcel.obtain();
2426 Parcel reply = Parcel.obtain();
2427 data.writeInterfaceToken(IActivityManager.descriptor);
2428 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2429 reply.readException();
2430 ArrayList<ActivityManager.RunningAppProcessInfo> list
2431 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2432 data.recycle();
2433 reply.recycle();
2434 return list;
2435 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002436 public List<ApplicationInfo> getRunningExternalApplications()
2437 throws RemoteException {
2438 Parcel data = Parcel.obtain();
2439 Parcel reply = Parcel.obtain();
2440 data.writeInterfaceToken(IActivityManager.descriptor);
2441 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2442 reply.readException();
2443 ArrayList<ApplicationInfo> list
2444 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2445 data.recycle();
2446 reply.recycle();
2447 return list;
2448 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002449 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002450 {
2451 Parcel data = Parcel.obtain();
2452 Parcel reply = Parcel.obtain();
2453 data.writeInterfaceToken(IActivityManager.descriptor);
2454 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002455 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002456 if (options != null) {
2457 data.writeInt(1);
2458 options.writeToParcel(data, 0);
2459 } else {
2460 data.writeInt(0);
2461 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002462 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2463 reply.readException();
2464 data.recycle();
2465 reply.recycle();
2466 }
2467 public void moveTaskToBack(int task) throws RemoteException
2468 {
2469 Parcel data = Parcel.obtain();
2470 Parcel reply = Parcel.obtain();
2471 data.writeInterfaceToken(IActivityManager.descriptor);
2472 data.writeInt(task);
2473 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2474 reply.readException();
2475 data.recycle();
2476 reply.recycle();
2477 }
2478 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2479 throws RemoteException {
2480 Parcel data = Parcel.obtain();
2481 Parcel reply = Parcel.obtain();
2482 data.writeInterfaceToken(IActivityManager.descriptor);
2483 data.writeStrongBinder(token);
2484 data.writeInt(nonRoot ? 1 : 0);
2485 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2486 reply.readException();
2487 boolean res = reply.readInt() != 0;
2488 data.recycle();
2489 reply.recycle();
2490 return res;
2491 }
2492 public void moveTaskBackwards(int task) throws RemoteException
2493 {
2494 Parcel data = Parcel.obtain();
2495 Parcel reply = Parcel.obtain();
2496 data.writeInterfaceToken(IActivityManager.descriptor);
2497 data.writeInt(task);
2498 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2499 reply.readException();
2500 data.recycle();
2501 reply.recycle();
2502 }
2503 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2504 {
2505 Parcel data = Parcel.obtain();
2506 Parcel reply = Parcel.obtain();
2507 data.writeInterfaceToken(IActivityManager.descriptor);
2508 data.writeStrongBinder(token);
2509 data.writeInt(onlyRoot ? 1 : 0);
2510 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2511 reply.readException();
2512 int res = reply.readInt();
2513 data.recycle();
2514 reply.recycle();
2515 return res;
2516 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002517 public void reportThumbnail(IBinder token,
2518 Bitmap thumbnail, CharSequence description) throws RemoteException
2519 {
2520 Parcel data = Parcel.obtain();
2521 Parcel reply = Parcel.obtain();
2522 data.writeInterfaceToken(IActivityManager.descriptor);
2523 data.writeStrongBinder(token);
2524 if (thumbnail != null) {
2525 data.writeInt(1);
2526 thumbnail.writeToParcel(data, 0);
2527 } else {
2528 data.writeInt(0);
2529 }
2530 TextUtils.writeToParcel(description, data, 0);
2531 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2532 reply.readException();
2533 data.recycle();
2534 reply.recycle();
2535 }
2536 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002537 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002538 Parcel data = Parcel.obtain();
2539 Parcel reply = Parcel.obtain();
2540 data.writeInterfaceToken(IActivityManager.descriptor);
2541 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2542 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002543 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002544 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002545 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2546 reply.readException();
2547 int res = reply.readInt();
2548 ContentProviderHolder cph = null;
2549 if (res != 0) {
2550 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2551 }
2552 data.recycle();
2553 reply.recycle();
2554 return cph;
2555 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002556 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2557 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002558 Parcel data = Parcel.obtain();
2559 Parcel reply = Parcel.obtain();
2560 data.writeInterfaceToken(IActivityManager.descriptor);
2561 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002562 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002563 data.writeStrongBinder(token);
2564 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2565 reply.readException();
2566 int res = reply.readInt();
2567 ContentProviderHolder cph = null;
2568 if (res != 0) {
2569 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2570 }
2571 data.recycle();
2572 reply.recycle();
2573 return cph;
2574 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002575 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002576 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002577 {
2578 Parcel data = Parcel.obtain();
2579 Parcel reply = Parcel.obtain();
2580 data.writeInterfaceToken(IActivityManager.descriptor);
2581 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2582 data.writeTypedList(providers);
2583 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 data.recycle();
2586 reply.recycle();
2587 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002588 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2589 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002593 data.writeStrongBinder(connection);
2594 data.writeInt(stable);
2595 data.writeInt(unstable);
2596 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2597 reply.readException();
2598 boolean res = reply.readInt() != 0;
2599 data.recycle();
2600 reply.recycle();
2601 return res;
2602 }
2603 public void unstableProviderDied(IBinder connection) throws RemoteException {
2604 Parcel data = Parcel.obtain();
2605 Parcel reply = Parcel.obtain();
2606 data.writeInterfaceToken(IActivityManager.descriptor);
2607 data.writeStrongBinder(connection);
2608 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2609 reply.readException();
2610 data.recycle();
2611 reply.recycle();
2612 }
2613
2614 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2615 Parcel data = Parcel.obtain();
2616 Parcel reply = Parcel.obtain();
2617 data.writeInterfaceToken(IActivityManager.descriptor);
2618 data.writeStrongBinder(connection);
2619 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002620 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2621 reply.readException();
2622 data.recycle();
2623 reply.recycle();
2624 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002625
2626 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2627 Parcel data = Parcel.obtain();
2628 Parcel reply = Parcel.obtain();
2629 data.writeInterfaceToken(IActivityManager.descriptor);
2630 data.writeString(name);
2631 data.writeStrongBinder(token);
2632 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2633 reply.readException();
2634 data.recycle();
2635 reply.recycle();
2636 }
2637
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002638 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2639 throws RemoteException
2640 {
2641 Parcel data = Parcel.obtain();
2642 Parcel reply = Parcel.obtain();
2643 data.writeInterfaceToken(IActivityManager.descriptor);
2644 service.writeToParcel(data, 0);
2645 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2646 reply.readException();
2647 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2648 data.recycle();
2649 reply.recycle();
2650 return res;
2651 }
2652
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002653 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002654 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 {
2656 Parcel data = Parcel.obtain();
2657 Parcel reply = Parcel.obtain();
2658 data.writeInterfaceToken(IActivityManager.descriptor);
2659 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2660 service.writeToParcel(data, 0);
2661 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002662 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002663 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2664 reply.readException();
2665 ComponentName res = ComponentName.readFromParcel(reply);
2666 data.recycle();
2667 reply.recycle();
2668 return res;
2669 }
2670 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002671 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002672 {
2673 Parcel data = Parcel.obtain();
2674 Parcel reply = Parcel.obtain();
2675 data.writeInterfaceToken(IActivityManager.descriptor);
2676 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2677 service.writeToParcel(data, 0);
2678 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002679 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002680 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 int res = reply.readInt();
2683 reply.recycle();
2684 data.recycle();
2685 return res;
2686 }
2687 public boolean stopServiceToken(ComponentName className, IBinder token,
2688 int startId) throws RemoteException {
2689 Parcel data = Parcel.obtain();
2690 Parcel reply = Parcel.obtain();
2691 data.writeInterfaceToken(IActivityManager.descriptor);
2692 ComponentName.writeToParcel(className, data);
2693 data.writeStrongBinder(token);
2694 data.writeInt(startId);
2695 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2696 reply.readException();
2697 boolean res = reply.readInt() != 0;
2698 data.recycle();
2699 reply.recycle();
2700 return res;
2701 }
2702 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002703 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002704 Parcel data = Parcel.obtain();
2705 Parcel reply = Parcel.obtain();
2706 data.writeInterfaceToken(IActivityManager.descriptor);
2707 ComponentName.writeToParcel(className, data);
2708 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002709 data.writeInt(id);
2710 if (notification != null) {
2711 data.writeInt(1);
2712 notification.writeToParcel(data, 0);
2713 } else {
2714 data.writeInt(0);
2715 }
2716 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002717 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 data.recycle();
2720 reply.recycle();
2721 }
2722 public int bindService(IApplicationThread caller, IBinder token,
2723 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002724 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002725 Parcel data = Parcel.obtain();
2726 Parcel reply = Parcel.obtain();
2727 data.writeInterfaceToken(IActivityManager.descriptor);
2728 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2729 data.writeStrongBinder(token);
2730 service.writeToParcel(data, 0);
2731 data.writeString(resolvedType);
2732 data.writeStrongBinder(connection.asBinder());
2733 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002734 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002735 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2736 reply.readException();
2737 int res = reply.readInt();
2738 data.recycle();
2739 reply.recycle();
2740 return res;
2741 }
2742 public boolean unbindService(IServiceConnection connection) throws RemoteException
2743 {
2744 Parcel data = Parcel.obtain();
2745 Parcel reply = Parcel.obtain();
2746 data.writeInterfaceToken(IActivityManager.descriptor);
2747 data.writeStrongBinder(connection.asBinder());
2748 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2749 reply.readException();
2750 boolean res = reply.readInt() != 0;
2751 data.recycle();
2752 reply.recycle();
2753 return res;
2754 }
2755
2756 public void publishService(IBinder token,
2757 Intent intent, IBinder service) throws RemoteException {
2758 Parcel data = Parcel.obtain();
2759 Parcel reply = Parcel.obtain();
2760 data.writeInterfaceToken(IActivityManager.descriptor);
2761 data.writeStrongBinder(token);
2762 intent.writeToParcel(data, 0);
2763 data.writeStrongBinder(service);
2764 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2765 reply.readException();
2766 data.recycle();
2767 reply.recycle();
2768 }
2769
2770 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2771 throws RemoteException {
2772 Parcel data = Parcel.obtain();
2773 Parcel reply = Parcel.obtain();
2774 data.writeInterfaceToken(IActivityManager.descriptor);
2775 data.writeStrongBinder(token);
2776 intent.writeToParcel(data, 0);
2777 data.writeInt(doRebind ? 1 : 0);
2778 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2779 reply.readException();
2780 data.recycle();
2781 reply.recycle();
2782 }
2783
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002784 public void serviceDoneExecuting(IBinder token, int type, int startId,
2785 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002786 Parcel data = Parcel.obtain();
2787 Parcel reply = Parcel.obtain();
2788 data.writeInterfaceToken(IActivityManager.descriptor);
2789 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002790 data.writeInt(type);
2791 data.writeInt(startId);
2792 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002793 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2794 reply.readException();
2795 data.recycle();
2796 reply.recycle();
2797 }
2798
2799 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 service.writeToParcel(data, 0);
2804 data.writeString(resolvedType);
2805 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2806 reply.readException();
2807 IBinder binder = reply.readStrongBinder();
2808 reply.recycle();
2809 data.recycle();
2810 return binder;
2811 }
2812
Christopher Tate181fafa2009-05-14 11:12:14 -07002813 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2814 throws RemoteException {
2815 Parcel data = Parcel.obtain();
2816 Parcel reply = Parcel.obtain();
2817 data.writeInterfaceToken(IActivityManager.descriptor);
2818 app.writeToParcel(data, 0);
2819 data.writeInt(backupRestoreMode);
2820 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2821 reply.readException();
2822 boolean success = reply.readInt() != 0;
2823 reply.recycle();
2824 data.recycle();
2825 return success;
2826 }
2827
Christopher Tate346acb12012-10-15 19:20:25 -07002828 public void clearPendingBackup() throws RemoteException {
2829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
2832 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
2833 reply.recycle();
2834 data.recycle();
2835 }
2836
Christopher Tate181fafa2009-05-14 11:12:14 -07002837 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2838 Parcel data = Parcel.obtain();
2839 Parcel reply = Parcel.obtain();
2840 data.writeInterfaceToken(IActivityManager.descriptor);
2841 data.writeString(packageName);
2842 data.writeStrongBinder(agent);
2843 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2844 reply.recycle();
2845 data.recycle();
2846 }
2847
2848 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 app.writeToParcel(data, 0);
2853 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2854 reply.readException();
2855 reply.recycle();
2856 data.recycle();
2857 }
2858
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002859 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002860 int flags, Bundle arguments, IInstrumentationWatcher watcher,
2861 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 Parcel data = Parcel.obtain();
2863 Parcel reply = Parcel.obtain();
2864 data.writeInterfaceToken(IActivityManager.descriptor);
2865 ComponentName.writeToParcel(className, data);
2866 data.writeString(profileFile);
2867 data.writeInt(flags);
2868 data.writeBundle(arguments);
2869 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002870 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002871 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002872 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2873 reply.readException();
2874 boolean res = reply.readInt() != 0;
2875 reply.recycle();
2876 data.recycle();
2877 return res;
2878 }
2879
2880 public void finishInstrumentation(IApplicationThread target,
2881 int resultCode, Bundle results) throws RemoteException {
2882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
2884 data.writeInterfaceToken(IActivityManager.descriptor);
2885 data.writeStrongBinder(target != null ? target.asBinder() : null);
2886 data.writeInt(resultCode);
2887 data.writeBundle(results);
2888 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2889 reply.readException();
2890 data.recycle();
2891 reply.recycle();
2892 }
2893 public Configuration getConfiguration() throws RemoteException
2894 {
2895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2899 reply.readException();
2900 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2901 reply.recycle();
2902 data.recycle();
2903 return res;
2904 }
2905 public void updateConfiguration(Configuration values) throws RemoteException
2906 {
2907 Parcel data = Parcel.obtain();
2908 Parcel reply = Parcel.obtain();
2909 data.writeInterfaceToken(IActivityManager.descriptor);
2910 values.writeToParcel(data, 0);
2911 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2912 reply.readException();
2913 data.recycle();
2914 reply.recycle();
2915 }
2916 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2917 throws RemoteException {
2918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 data.writeStrongBinder(token);
2922 data.writeInt(requestedOrientation);
2923 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2924 reply.readException();
2925 data.recycle();
2926 reply.recycle();
2927 }
2928 public int getRequestedOrientation(IBinder token) throws RemoteException {
2929 Parcel data = Parcel.obtain();
2930 Parcel reply = Parcel.obtain();
2931 data.writeInterfaceToken(IActivityManager.descriptor);
2932 data.writeStrongBinder(token);
2933 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2934 reply.readException();
2935 int res = reply.readInt();
2936 data.recycle();
2937 reply.recycle();
2938 return res;
2939 }
2940 public ComponentName getActivityClassForToken(IBinder token)
2941 throws RemoteException {
2942 Parcel data = Parcel.obtain();
2943 Parcel reply = Parcel.obtain();
2944 data.writeInterfaceToken(IActivityManager.descriptor);
2945 data.writeStrongBinder(token);
2946 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 ComponentName res = ComponentName.readFromParcel(reply);
2949 data.recycle();
2950 reply.recycle();
2951 return res;
2952 }
2953 public String getPackageForToken(IBinder token) throws RemoteException
2954 {
2955 Parcel data = Parcel.obtain();
2956 Parcel reply = Parcel.obtain();
2957 data.writeInterfaceToken(IActivityManager.descriptor);
2958 data.writeStrongBinder(token);
2959 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2960 reply.readException();
2961 String res = reply.readString();
2962 data.recycle();
2963 reply.recycle();
2964 return res;
2965 }
2966 public IIntentSender getIntentSender(int type,
2967 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002968 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002969 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002970 Parcel data = Parcel.obtain();
2971 Parcel reply = Parcel.obtain();
2972 data.writeInterfaceToken(IActivityManager.descriptor);
2973 data.writeInt(type);
2974 data.writeString(packageName);
2975 data.writeStrongBinder(token);
2976 data.writeString(resultWho);
2977 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002978 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002979 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002980 data.writeTypedArray(intents, 0);
2981 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002982 } else {
2983 data.writeInt(0);
2984 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002985 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002986 if (options != null) {
2987 data.writeInt(1);
2988 options.writeToParcel(data, 0);
2989 } else {
2990 data.writeInt(0);
2991 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002992 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002993 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2994 reply.readException();
2995 IIntentSender res = IIntentSender.Stub.asInterface(
2996 reply.readStrongBinder());
2997 data.recycle();
2998 reply.recycle();
2999 return res;
3000 }
3001 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3002 Parcel data = Parcel.obtain();
3003 Parcel reply = Parcel.obtain();
3004 data.writeInterfaceToken(IActivityManager.descriptor);
3005 data.writeStrongBinder(sender.asBinder());
3006 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 data.recycle();
3009 reply.recycle();
3010 }
3011 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3012 Parcel data = Parcel.obtain();
3013 Parcel reply = Parcel.obtain();
3014 data.writeInterfaceToken(IActivityManager.descriptor);
3015 data.writeStrongBinder(sender.asBinder());
3016 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3017 reply.readException();
3018 String res = reply.readString();
3019 data.recycle();
3020 reply.recycle();
3021 return res;
3022 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003023 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3024 Parcel data = Parcel.obtain();
3025 Parcel reply = Parcel.obtain();
3026 data.writeInterfaceToken(IActivityManager.descriptor);
3027 data.writeStrongBinder(sender.asBinder());
3028 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 int res = reply.readInt();
3031 data.recycle();
3032 reply.recycle();
3033 return res;
3034 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003035 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3036 boolean requireFull, String name, String callerPackage) throws RemoteException {
3037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 data.writeInt(callingPid);
3041 data.writeInt(callingUid);
3042 data.writeInt(userId);
3043 data.writeInt(allowAll ? 1 : 0);
3044 data.writeInt(requireFull ? 1 : 0);
3045 data.writeString(name);
3046 data.writeString(callerPackage);
3047 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3048 reply.readException();
3049 int res = reply.readInt();
3050 data.recycle();
3051 reply.recycle();
3052 return res;
3053 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003054 public void setProcessLimit(int max) throws RemoteException
3055 {
3056 Parcel data = Parcel.obtain();
3057 Parcel reply = Parcel.obtain();
3058 data.writeInterfaceToken(IActivityManager.descriptor);
3059 data.writeInt(max);
3060 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3061 reply.readException();
3062 data.recycle();
3063 reply.recycle();
3064 }
3065 public int getProcessLimit() throws RemoteException
3066 {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 int res = reply.readInt();
3073 data.recycle();
3074 reply.recycle();
3075 return res;
3076 }
3077 public void setProcessForeground(IBinder token, int pid,
3078 boolean isForeground) throws RemoteException {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 data.writeStrongBinder(token);
3083 data.writeInt(pid);
3084 data.writeInt(isForeground ? 1 : 0);
3085 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3086 reply.readException();
3087 data.recycle();
3088 reply.recycle();
3089 }
3090 public int checkPermission(String permission, int pid, int uid)
3091 throws RemoteException {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeString(permission);
3096 data.writeInt(pid);
3097 data.writeInt(uid);
3098 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3099 reply.readException();
3100 int res = reply.readInt();
3101 data.recycle();
3102 reply.recycle();
3103 return res;
3104 }
3105 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003106 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeString(packageName);
3111 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003112 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003113 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3114 reply.readException();
3115 boolean res = reply.readInt() != 0;
3116 data.recycle();
3117 reply.recycle();
3118 return res;
3119 }
3120 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3121 throws RemoteException {
3122 Parcel data = Parcel.obtain();
3123 Parcel reply = Parcel.obtain();
3124 data.writeInterfaceToken(IActivityManager.descriptor);
3125 uri.writeToParcel(data, 0);
3126 data.writeInt(pid);
3127 data.writeInt(uid);
3128 data.writeInt(mode);
3129 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3130 reply.readException();
3131 int res = reply.readInt();
3132 data.recycle();
3133 reply.recycle();
3134 return res;
3135 }
3136 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3137 Uri uri, int mode) throws RemoteException {
3138 Parcel data = Parcel.obtain();
3139 Parcel reply = Parcel.obtain();
3140 data.writeInterfaceToken(IActivityManager.descriptor);
3141 data.writeStrongBinder(caller.asBinder());
3142 data.writeString(targetPkg);
3143 uri.writeToParcel(data, 0);
3144 data.writeInt(mode);
3145 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3146 reply.readException();
3147 data.recycle();
3148 reply.recycle();
3149 }
3150 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3151 int mode) throws RemoteException {
3152 Parcel data = Parcel.obtain();
3153 Parcel reply = Parcel.obtain();
3154 data.writeInterfaceToken(IActivityManager.descriptor);
3155 data.writeStrongBinder(caller.asBinder());
3156 uri.writeToParcel(data, 0);
3157 data.writeInt(mode);
3158 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3159 reply.readException();
3160 data.recycle();
3161 reply.recycle();
3162 }
3163 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3164 throws RemoteException {
3165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 data.writeStrongBinder(who.asBinder());
3169 data.writeInt(waiting ? 1 : 0);
3170 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3171 reply.readException();
3172 data.recycle();
3173 reply.recycle();
3174 }
3175 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3180 reply.readException();
3181 outInfo.readFromParcel(reply);
3182 data.recycle();
3183 reply.recycle();
3184 }
3185 public void unhandledBack() throws RemoteException
3186 {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 data.recycle();
3193 reply.recycle();
3194 }
3195 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3196 {
3197 Parcel data = Parcel.obtain();
3198 Parcel reply = Parcel.obtain();
3199 data.writeInterfaceToken(IActivityManager.descriptor);
3200 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3201 reply.readException();
3202 ParcelFileDescriptor pfd = null;
3203 if (reply.readInt() != 0) {
3204 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3205 }
3206 data.recycle();
3207 reply.recycle();
3208 return pfd;
3209 }
3210 public void goingToSleep() throws RemoteException
3211 {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3216 reply.readException();
3217 data.recycle();
3218 reply.recycle();
3219 }
3220 public void wakingUp() throws RemoteException
3221 {
3222 Parcel data = Parcel.obtain();
3223 Parcel reply = Parcel.obtain();
3224 data.writeInterfaceToken(IActivityManager.descriptor);
3225 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3226 reply.readException();
3227 data.recycle();
3228 reply.recycle();
3229 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003230 public void setLockScreenShown(boolean shown) throws RemoteException
3231 {
3232 Parcel data = Parcel.obtain();
3233 Parcel reply = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 data.writeInt(shown ? 1 : 0);
3236 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 data.recycle();
3239 reply.recycle();
3240 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003241 public void setDebugApp(
3242 String packageName, boolean waitForDebugger, boolean persistent)
3243 throws RemoteException
3244 {
3245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 data.writeString(packageName);
3249 data.writeInt(waitForDebugger ? 1 : 0);
3250 data.writeInt(persistent ? 1 : 0);
3251 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3252 reply.readException();
3253 data.recycle();
3254 reply.recycle();
3255 }
3256 public void setAlwaysFinish(boolean enabled) throws RemoteException
3257 {
3258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 data.writeInt(enabled ? 1 : 0);
3262 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3263 reply.readException();
3264 data.recycle();
3265 reply.recycle();
3266 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003267 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003268 {
3269 Parcel data = Parcel.obtain();
3270 Parcel reply = Parcel.obtain();
3271 data.writeInterfaceToken(IActivityManager.descriptor);
3272 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003273 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003274 reply.readException();
3275 data.recycle();
3276 reply.recycle();
3277 }
3278 public void enterSafeMode() throws RemoteException {
3279 Parcel data = Parcel.obtain();
3280 data.writeInterfaceToken(IActivityManager.descriptor);
3281 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3282 data.recycle();
3283 }
3284 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3285 Parcel data = Parcel.obtain();
3286 data.writeStrongBinder(sender.asBinder());
3287 data.writeInterfaceToken(IActivityManager.descriptor);
3288 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3289 data.recycle();
3290 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003291 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003292 Parcel data = Parcel.obtain();
3293 Parcel reply = Parcel.obtain();
3294 data.writeInterfaceToken(IActivityManager.descriptor);
3295 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003296 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003297 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003298 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003299 boolean res = reply.readInt() != 0;
3300 data.recycle();
3301 reply.recycle();
3302 return res;
3303 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003304 @Override
3305 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3306 Parcel data = Parcel.obtain();
3307 Parcel reply = Parcel.obtain();
3308 data.writeInterfaceToken(IActivityManager.descriptor);
3309 data.writeString(reason);
3310 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3311 boolean res = reply.readInt() != 0;
3312 data.recycle();
3313 reply.recycle();
3314 return res;
3315 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003316 public void startRunning(String pkg, String cls, String action,
3317 String indata) throws RemoteException {
3318 Parcel data = Parcel.obtain();
3319 Parcel reply = Parcel.obtain();
3320 data.writeInterfaceToken(IActivityManager.descriptor);
3321 data.writeString(pkg);
3322 data.writeString(cls);
3323 data.writeString(action);
3324 data.writeString(indata);
3325 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3326 reply.readException();
3327 data.recycle();
3328 reply.recycle();
3329 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003330 public boolean testIsSystemReady()
3331 {
3332 /* this base class version is never called */
3333 return true;
3334 }
Dan Egnor60d87622009-12-16 16:32:58 -08003335 public void handleApplicationCrash(IBinder app,
3336 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3337 {
3338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 data.writeStrongBinder(app);
3342 crashInfo.writeToParcel(data, 0);
3343 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3344 reply.readException();
3345 reply.recycle();
3346 data.recycle();
3347 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003348
Dan Egnor60d87622009-12-16 16:32:58 -08003349 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003350 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003351 {
3352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003356 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003357 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003358 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003359 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003360 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003361 reply.recycle();
3362 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003363 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003364 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003365
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003366 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003367 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003368 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003369 {
3370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
3372 data.writeInterfaceToken(IActivityManager.descriptor);
3373 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003374 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003375 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003376 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3377 reply.readException();
3378 reply.recycle();
3379 data.recycle();
3380 }
3381
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003382 public void signalPersistentProcesses(int sig) throws RemoteException {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
3386 data.writeInt(sig);
3387 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3388 reply.readException();
3389 data.recycle();
3390 reply.recycle();
3391 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003392
Dianne Hackborn1676c852012-09-10 14:52:30 -07003393 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003394 Parcel data = Parcel.obtain();
3395 Parcel reply = Parcel.obtain();
3396 data.writeInterfaceToken(IActivityManager.descriptor);
3397 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003398 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003399 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3400 reply.readException();
3401 data.recycle();
3402 reply.recycle();
3403 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003404
3405 public void killAllBackgroundProcesses() throws RemoteException {
3406 Parcel data = Parcel.obtain();
3407 Parcel reply = Parcel.obtain();
3408 data.writeInterfaceToken(IActivityManager.descriptor);
3409 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 data.recycle();
3412 reply.recycle();
3413 }
3414
Dianne Hackborn1676c852012-09-10 14:52:30 -07003415 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003416 Parcel data = Parcel.obtain();
3417 Parcel reply = Parcel.obtain();
3418 data.writeInterfaceToken(IActivityManager.descriptor);
3419 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003420 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003421 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003422 reply.readException();
3423 data.recycle();
3424 reply.recycle();
3425 }
3426
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003427 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3428 throws RemoteException
3429 {
3430 Parcel data = Parcel.obtain();
3431 Parcel reply = Parcel.obtain();
3432 data.writeInterfaceToken(IActivityManager.descriptor);
3433 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3434 reply.readException();
3435 outInfo.readFromParcel(reply);
3436 reply.recycle();
3437 data.recycle();
3438 }
3439
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003440 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3441 {
3442 Parcel data = Parcel.obtain();
3443 Parcel reply = Parcel.obtain();
3444 data.writeInterfaceToken(IActivityManager.descriptor);
3445 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3446 reply.readException();
3447 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3448 reply.recycle();
3449 data.recycle();
3450 return res;
3451 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003452
Dianne Hackborn1676c852012-09-10 14:52:30 -07003453 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003454 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003455 {
3456 Parcel data = Parcel.obtain();
3457 Parcel reply = Parcel.obtain();
3458 data.writeInterfaceToken(IActivityManager.descriptor);
3459 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003460 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003461 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003462 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003463 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003464 if (fd != null) {
3465 data.writeInt(1);
3466 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3467 } else {
3468 data.writeInt(0);
3469 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003470 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3471 reply.readException();
3472 boolean res = reply.readInt() != 0;
3473 reply.recycle();
3474 data.recycle();
3475 return res;
3476 }
3477
Dianne Hackborn55280a92009-05-07 15:53:46 -07003478 public boolean shutdown(int timeout) throws RemoteException
3479 {
3480 Parcel data = Parcel.obtain();
3481 Parcel reply = Parcel.obtain();
3482 data.writeInterfaceToken(IActivityManager.descriptor);
3483 data.writeInt(timeout);
3484 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3485 reply.readException();
3486 boolean res = reply.readInt() != 0;
3487 reply.recycle();
3488 data.recycle();
3489 return res;
3490 }
3491
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003492 public void stopAppSwitches() throws RemoteException {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3497 reply.readException();
3498 reply.recycle();
3499 data.recycle();
3500 }
3501
3502 public void resumeAppSwitches() throws RemoteException {
3503 Parcel data = Parcel.obtain();
3504 Parcel reply = Parcel.obtain();
3505 data.writeInterfaceToken(IActivityManager.descriptor);
3506 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 reply.recycle();
3509 data.recycle();
3510 }
3511
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003512 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003513 Parcel data = Parcel.obtain();
3514 Parcel reply = Parcel.obtain();
3515 data.writeInterfaceToken(IActivityManager.descriptor);
3516 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003517 data.writeInt(appid);
3518 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003519 reply.readException();
3520 data.recycle();
3521 reply.recycle();
3522 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003523
3524 public void closeSystemDialogs(String reason) throws RemoteException {
3525 Parcel data = Parcel.obtain();
3526 Parcel reply = Parcel.obtain();
3527 data.writeInterfaceToken(IActivityManager.descriptor);
3528 data.writeString(reason);
3529 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3530 reply.readException();
3531 data.recycle();
3532 reply.recycle();
3533 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003534
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003535 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003536 throws RemoteException {
3537 Parcel data = Parcel.obtain();
3538 Parcel reply = Parcel.obtain();
3539 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003540 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003541 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3542 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003543 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003544 data.recycle();
3545 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003546 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003547 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003548
3549 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3550 Parcel data = Parcel.obtain();
3551 Parcel reply = Parcel.obtain();
3552 data.writeInterfaceToken(IActivityManager.descriptor);
3553 data.writeString(processName);
3554 data.writeInt(uid);
3555 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3556 reply.readException();
3557 data.recycle();
3558 reply.recycle();
3559 }
3560
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003561 public void overridePendingTransition(IBinder token, String packageName,
3562 int enterAnim, int exitAnim) throws RemoteException {
3563 Parcel data = Parcel.obtain();
3564 Parcel reply = Parcel.obtain();
3565 data.writeInterfaceToken(IActivityManager.descriptor);
3566 data.writeStrongBinder(token);
3567 data.writeString(packageName);
3568 data.writeInt(enterAnim);
3569 data.writeInt(exitAnim);
3570 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3571 reply.readException();
3572 data.recycle();
3573 reply.recycle();
3574 }
3575
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003576 public boolean isUserAMonkey() throws RemoteException {
3577 Parcel data = Parcel.obtain();
3578 Parcel reply = Parcel.obtain();
3579 data.writeInterfaceToken(IActivityManager.descriptor);
3580 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3581 reply.readException();
3582 boolean res = reply.readInt() != 0;
3583 data.recycle();
3584 reply.recycle();
3585 return res;
3586 }
3587
Dianne Hackborn860755f2010-06-03 18:47:52 -07003588 public void finishHeavyWeightApp() throws RemoteException {
3589 Parcel data = Parcel.obtain();
3590 Parcel reply = Parcel.obtain();
3591 data.writeInterfaceToken(IActivityManager.descriptor);
3592 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3593 reply.readException();
3594 data.recycle();
3595 reply.recycle();
3596 }
3597
Daniel Sandler69a48172010-06-23 16:29:36 -04003598 public void setImmersive(IBinder token, boolean immersive)
3599 throws RemoteException {
3600 Parcel data = Parcel.obtain();
3601 Parcel reply = Parcel.obtain();
3602 data.writeInterfaceToken(IActivityManager.descriptor);
3603 data.writeStrongBinder(token);
3604 data.writeInt(immersive ? 1 : 0);
3605 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3606 reply.readException();
3607 data.recycle();
3608 reply.recycle();
3609 }
3610
3611 public boolean isImmersive(IBinder token)
3612 throws RemoteException {
3613 Parcel data = Parcel.obtain();
3614 Parcel reply = Parcel.obtain();
3615 data.writeInterfaceToken(IActivityManager.descriptor);
3616 data.writeStrongBinder(token);
3617 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003618 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003619 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003620 data.recycle();
3621 reply.recycle();
3622 return res;
3623 }
3624
3625 public boolean isTopActivityImmersive()
3626 throws RemoteException {
3627 Parcel data = Parcel.obtain();
3628 Parcel reply = Parcel.obtain();
3629 data.writeInterfaceToken(IActivityManager.descriptor);
3630 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003631 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003632 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003633 data.recycle();
3634 reply.recycle();
3635 return res;
3636 }
3637
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003638 public void crashApplication(int uid, int initialPid, String packageName,
3639 String message) throws RemoteException {
3640 Parcel data = Parcel.obtain();
3641 Parcel reply = Parcel.obtain();
3642 data.writeInterfaceToken(IActivityManager.descriptor);
3643 data.writeInt(uid);
3644 data.writeInt(initialPid);
3645 data.writeString(packageName);
3646 data.writeString(message);
3647 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3648 reply.readException();
3649 data.recycle();
3650 reply.recycle();
3651 }
Andy McFadden824c5102010-07-09 16:26:57 -07003652
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003653 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003654 Parcel data = Parcel.obtain();
3655 Parcel reply = Parcel.obtain();
3656 data.writeInterfaceToken(IActivityManager.descriptor);
3657 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003658 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003659 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3660 reply.readException();
3661 String res = reply.readString();
3662 data.recycle();
3663 reply.recycle();
3664 return res;
3665 }
3666
Dianne Hackborn7e269642010-08-25 19:50:20 -07003667 public IBinder newUriPermissionOwner(String name)
3668 throws RemoteException {
3669 Parcel data = Parcel.obtain();
3670 Parcel reply = Parcel.obtain();
3671 data.writeInterfaceToken(IActivityManager.descriptor);
3672 data.writeString(name);
3673 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3674 reply.readException();
3675 IBinder res = reply.readStrongBinder();
3676 data.recycle();
3677 reply.recycle();
3678 return res;
3679 }
3680
3681 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3682 Uri uri, int mode) throws RemoteException {
3683 Parcel data = Parcel.obtain();
3684 Parcel reply = Parcel.obtain();
3685 data.writeInterfaceToken(IActivityManager.descriptor);
3686 data.writeStrongBinder(owner);
3687 data.writeInt(fromUid);
3688 data.writeString(targetPkg);
3689 uri.writeToParcel(data, 0);
3690 data.writeInt(mode);
3691 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3692 reply.readException();
3693 data.recycle();
3694 reply.recycle();
3695 }
3696
3697 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3698 int mode) throws RemoteException {
3699 Parcel data = Parcel.obtain();
3700 Parcel reply = Parcel.obtain();
3701 data.writeInterfaceToken(IActivityManager.descriptor);
3702 data.writeStrongBinder(owner);
3703 if (uri != null) {
3704 data.writeInt(1);
3705 uri.writeToParcel(data, 0);
3706 } else {
3707 data.writeInt(0);
3708 }
3709 data.writeInt(mode);
3710 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3711 reply.readException();
3712 data.recycle();
3713 reply.recycle();
3714 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003715
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003716 public int checkGrantUriPermission(int callingUid, String targetPkg,
3717 Uri uri, int modeFlags) throws RemoteException {
3718 Parcel data = Parcel.obtain();
3719 Parcel reply = Parcel.obtain();
3720 data.writeInterfaceToken(IActivityManager.descriptor);
3721 data.writeInt(callingUid);
3722 data.writeString(targetPkg);
3723 uri.writeToParcel(data, 0);
3724 data.writeInt(modeFlags);
3725 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3726 reply.readException();
3727 int res = reply.readInt();
3728 data.recycle();
3729 reply.recycle();
3730 return res;
3731 }
3732
Dianne Hackborn1676c852012-09-10 14:52:30 -07003733 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003734 String path, ParcelFileDescriptor fd) throws RemoteException {
3735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003739 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003740 data.writeInt(managed ? 1 : 0);
3741 data.writeString(path);
3742 if (fd != null) {
3743 data.writeInt(1);
3744 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3745 } else {
3746 data.writeInt(0);
3747 }
3748 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 boolean res = reply.readInt() != 0;
3751 reply.recycle();
3752 data.recycle();
3753 return res;
3754 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003755
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003756 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003757 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003758 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3763 data.writeTypedArray(intents, 0);
3764 data.writeStringArray(resolvedTypes);
3765 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003766 if (options != null) {
3767 data.writeInt(1);
3768 options.writeToParcel(data, 0);
3769 } else {
3770 data.writeInt(0);
3771 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003772 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003773 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3774 reply.readException();
3775 int result = reply.readInt();
3776 reply.recycle();
3777 data.recycle();
3778 return result;
3779 }
3780
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003781 public int getFrontActivityScreenCompatMode() throws RemoteException {
3782 Parcel data = Parcel.obtain();
3783 Parcel reply = Parcel.obtain();
3784 data.writeInterfaceToken(IActivityManager.descriptor);
3785 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3786 reply.readException();
3787 int mode = reply.readInt();
3788 reply.recycle();
3789 data.recycle();
3790 return mode;
3791 }
3792
3793 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3794 Parcel data = Parcel.obtain();
3795 Parcel reply = Parcel.obtain();
3796 data.writeInterfaceToken(IActivityManager.descriptor);
3797 data.writeInt(mode);
3798 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3799 reply.readException();
3800 reply.recycle();
3801 data.recycle();
3802 }
3803
3804 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003808 data.writeString(packageName);
3809 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003810 reply.readException();
3811 int mode = reply.readInt();
3812 reply.recycle();
3813 data.recycle();
3814 return mode;
3815 }
3816
3817 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003818 throws RemoteException {
3819 Parcel data = Parcel.obtain();
3820 Parcel reply = Parcel.obtain();
3821 data.writeInterfaceToken(IActivityManager.descriptor);
3822 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003823 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003824 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3825 reply.readException();
3826 reply.recycle();
3827 data.recycle();
3828 }
3829
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003830 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3831 Parcel data = Parcel.obtain();
3832 Parcel reply = Parcel.obtain();
3833 data.writeInterfaceToken(IActivityManager.descriptor);
3834 data.writeString(packageName);
3835 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3836 reply.readException();
3837 boolean ask = reply.readInt() != 0;
3838 reply.recycle();
3839 data.recycle();
3840 return ask;
3841 }
3842
3843 public void setPackageAskScreenCompat(String packageName, boolean ask)
3844 throws RemoteException {
3845 Parcel data = Parcel.obtain();
3846 Parcel reply = Parcel.obtain();
3847 data.writeInterfaceToken(IActivityManager.descriptor);
3848 data.writeString(packageName);
3849 data.writeInt(ask ? 1 : 0);
3850 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3851 reply.readException();
3852 reply.recycle();
3853 data.recycle();
3854 }
3855
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003856 public boolean switchUser(int userid) throws RemoteException {
3857 Parcel data = Parcel.obtain();
3858 Parcel reply = Parcel.obtain();
3859 data.writeInterfaceToken(IActivityManager.descriptor);
3860 data.writeInt(userid);
3861 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3862 reply.readException();
3863 boolean result = reply.readInt() != 0;
3864 reply.recycle();
3865 data.recycle();
3866 return result;
3867 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003868
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003869 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3870 Parcel data = Parcel.obtain();
3871 Parcel reply = Parcel.obtain();
3872 data.writeInterfaceToken(IActivityManager.descriptor);
3873 data.writeInt(userid);
3874 data.writeStrongInterface(callback);
3875 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3876 reply.readException();
3877 int result = reply.readInt();
3878 reply.recycle();
3879 data.recycle();
3880 return result;
3881 }
3882
Amith Yamasani52f1d752012-03-28 18:19:29 -07003883 public UserInfo getCurrentUser() throws RemoteException {
3884 Parcel data = Parcel.obtain();
3885 Parcel reply = Parcel.obtain();
3886 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003887 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003888 reply.readException();
3889 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3890 reply.recycle();
3891 data.recycle();
3892 return userInfo;
3893 }
3894
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003895 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003896 Parcel data = Parcel.obtain();
3897 Parcel reply = Parcel.obtain();
3898 data.writeInterfaceToken(IActivityManager.descriptor);
3899 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003900 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003901 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3902 reply.readException();
3903 boolean result = reply.readInt() != 0;
3904 reply.recycle();
3905 data.recycle();
3906 return result;
3907 }
3908
Dianne Hackbornc72fc672012-09-20 13:12:03 -07003909 public int[] getRunningUserIds() throws RemoteException {
3910 Parcel data = Parcel.obtain();
3911 Parcel reply = Parcel.obtain();
3912 data.writeInterfaceToken(IActivityManager.descriptor);
3913 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
3914 reply.readException();
3915 int[] result = reply.createIntArray();
3916 reply.recycle();
3917 data.recycle();
3918 return result;
3919 }
3920
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003921 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3922 Parcel data = Parcel.obtain();
3923 Parcel reply = Parcel.obtain();
3924 data.writeInterfaceToken(IActivityManager.descriptor);
3925 data.writeInt(taskId);
3926 data.writeInt(subTaskIndex);
3927 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3928 reply.readException();
3929 boolean result = reply.readInt() != 0;
3930 reply.recycle();
3931 data.recycle();
3932 return result;
3933 }
3934
3935 public boolean removeTask(int taskId, int flags) throws RemoteException {
3936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
3939 data.writeInt(taskId);
3940 data.writeInt(flags);
3941 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3942 reply.readException();
3943 boolean result = reply.readInt() != 0;
3944 reply.recycle();
3945 data.recycle();
3946 return result;
3947 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003948
Jeff Sharkeya4620792011-05-20 15:29:23 -07003949 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3954 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3955 reply.readException();
3956 data.recycle();
3957 reply.recycle();
3958 }
3959
3960 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3961 Parcel data = Parcel.obtain();
3962 Parcel reply = Parcel.obtain();
3963 data.writeInterfaceToken(IActivityManager.descriptor);
3964 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3965 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 data.recycle();
3968 reply.recycle();
3969 }
3970
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003971 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3972 Parcel data = Parcel.obtain();
3973 Parcel reply = Parcel.obtain();
3974 data.writeInterfaceToken(IActivityManager.descriptor);
3975 data.writeStrongBinder(sender.asBinder());
3976 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3977 reply.readException();
3978 boolean res = reply.readInt() != 0;
3979 data.recycle();
3980 reply.recycle();
3981 return res;
3982 }
3983
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003984 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3985 Parcel data = Parcel.obtain();
3986 Parcel reply = Parcel.obtain();
3987 data.writeInterfaceToken(IActivityManager.descriptor);
3988 data.writeStrongBinder(sender.asBinder());
3989 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3990 reply.readException();
3991 boolean res = reply.readInt() != 0;
3992 data.recycle();
3993 reply.recycle();
3994 return res;
3995 }
3996
Dianne Hackborn81038902012-11-26 17:04:09 -08003997 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
3998 Parcel data = Parcel.obtain();
3999 Parcel reply = Parcel.obtain();
4000 data.writeInterfaceToken(IActivityManager.descriptor);
4001 data.writeStrongBinder(sender.asBinder());
4002 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4003 reply.readException();
4004 Intent res = reply.readInt() != 0
4005 ? Intent.CREATOR.createFromParcel(reply) : null;
4006 data.recycle();
4007 reply.recycle();
4008 return res;
4009 }
4010
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004011 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4012 {
4013 Parcel data = Parcel.obtain();
4014 Parcel reply = Parcel.obtain();
4015 data.writeInterfaceToken(IActivityManager.descriptor);
4016 values.writeToParcel(data, 0);
4017 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4018 reply.readException();
4019 data.recycle();
4020 reply.recycle();
4021 }
4022
Dianne Hackbornb437e092011-08-05 17:50:29 -07004023 public long[] getProcessPss(int[] pids) throws RemoteException {
4024 Parcel data = Parcel.obtain();
4025 Parcel reply = Parcel.obtain();
4026 data.writeInterfaceToken(IActivityManager.descriptor);
4027 data.writeIntArray(pids);
4028 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4029 reply.readException();
4030 long[] res = reply.createLongArray();
4031 data.recycle();
4032 reply.recycle();
4033 return res;
4034 }
4035
Dianne Hackborn661cd522011-08-22 00:26:20 -07004036 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4037 Parcel data = Parcel.obtain();
4038 Parcel reply = Parcel.obtain();
4039 data.writeInterfaceToken(IActivityManager.descriptor);
4040 TextUtils.writeToParcel(msg, data, 0);
4041 data.writeInt(always ? 1 : 0);
4042 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4043 reply.readException();
4044 data.recycle();
4045 reply.recycle();
4046 }
4047
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004048 public void dismissKeyguardOnNextActivity() throws RemoteException {
4049 Parcel data = Parcel.obtain();
4050 Parcel reply = Parcel.obtain();
4051 data.writeInterfaceToken(IActivityManager.descriptor);
4052 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4053 reply.readException();
4054 data.recycle();
4055 reply.recycle();
4056 }
4057
Adam Powelldd8fab22012-03-22 17:47:27 -07004058 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4059 throws RemoteException {
4060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeStrongBinder(token);
4064 data.writeString(destAffinity);
4065 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 boolean result = reply.readInt() != 0;
4068 data.recycle();
4069 reply.recycle();
4070 return result;
4071 }
4072
4073 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4074 throws RemoteException {
4075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 data.writeStrongBinder(token);
4079 target.writeToParcel(data, 0);
4080 data.writeInt(resultCode);
4081 if (resultData != null) {
4082 data.writeInt(1);
4083 resultData.writeToParcel(data, 0);
4084 } else {
4085 data.writeInt(0);
4086 }
4087 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4088 reply.readException();
4089 boolean result = reply.readInt() != 0;
4090 data.recycle();
4091 reply.recycle();
4092 return result;
4093 }
4094
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004095 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4096 Parcel data = Parcel.obtain();
4097 Parcel reply = Parcel.obtain();
4098 data.writeInterfaceToken(IActivityManager.descriptor);
4099 data.writeStrongBinder(activityToken);
4100 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4101 reply.readException();
4102 int result = reply.readInt();
4103 data.recycle();
4104 reply.recycle();
4105 return result;
4106 }
4107
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004108 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4109 Parcel data = Parcel.obtain();
4110 Parcel reply = Parcel.obtain();
4111 data.writeInterfaceToken(IActivityManager.descriptor);
4112 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4113 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4114 reply.readException();
4115 data.recycle();
4116 reply.recycle();
4117 }
4118
4119 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4120 Parcel data = Parcel.obtain();
4121 Parcel reply = Parcel.obtain();
4122 data.writeInterfaceToken(IActivityManager.descriptor);
4123 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4124 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4125 reply.readException();
4126 data.recycle();
4127 reply.recycle();
4128 }
4129
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004130 public void requestBugReport() throws RemoteException {
4131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4135 reply.readException();
4136 data.recycle();
4137 reply.recycle();
4138 }
4139
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004140 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4141 Parcel data = Parcel.obtain();
4142 Parcel reply = Parcel.obtain();
4143 data.writeInterfaceToken(IActivityManager.descriptor);
4144 data.writeInt(pid);
4145 data.writeInt(aboveSystem ? 1 : 0);
4146 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 long res = reply.readInt();
4149 data.recycle();
4150 reply.recycle();
4151 return res;
4152 }
4153
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004154 private IBinder mRemote;
4155}