blob: 5917cbf54e0dcbceefb6a03c8c2e5b56cc7b3705 [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;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.Intent;
21import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070022import android.content.IIntentSender;
23import android.content.IIntentReceiver;
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.Parcelable;
36import android.os.ParcelFileDescriptor;
37import android.os.RemoteException;
38import android.os.IBinder;
39import android.os.Parcel;
40import 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 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080091 static public void broadcastStickyIntent(Intent intent, String permission) {
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,
Amith Yamasani742a6712011-05-04 14:49:28 -070095 null /*permission*/, false, true, Binder.getOrigCallingUser());
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
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800138 case START_ACTIVITY_AND_WAIT_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();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800145 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800146 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800147 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700148 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700149 String profileFile = data.readString();
150 ParcelFileDescriptor profileFd = data.readInt() != 0
151 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700152 Bundle options = data.readInt() != 0
153 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800154 WaitResult result = startActivityAndWait(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700155 resultTo, resultWho, requestCode, startFlags,
156 profileFile, profileFd, options);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800157 reply.writeNoException();
158 result.writeToParcel(reply, 0);
159 return true;
160 }
161
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700162 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
163 {
164 data.enforceInterface(IActivityManager.descriptor);
165 IBinder b = data.readStrongBinder();
166 IApplicationThread app = ApplicationThreadNative.asInterface(b);
167 Intent intent = Intent.CREATOR.createFromParcel(data);
168 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700169 IBinder resultTo = data.readStrongBinder();
170 String resultWho = data.readString();
171 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700172 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700173 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700174 Bundle options = data.readInt() != 0
175 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700176 int result = startActivityWithConfig(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700177 resultTo, resultWho, requestCode, startFlags, config, options);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700178 reply.writeNoException();
179 reply.writeInt(result);
180 return true;
181 }
182
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700183 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700184 {
185 data.enforceInterface(IActivityManager.descriptor);
186 IBinder b = data.readStrongBinder();
187 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700188 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700189 Intent fillInIntent = null;
190 if (data.readInt() != 0) {
191 fillInIntent = Intent.CREATOR.createFromParcel(data);
192 }
193 String resolvedType = data.readString();
194 IBinder resultTo = data.readStrongBinder();
195 String resultWho = data.readString();
196 int requestCode = data.readInt();
197 int flagsMask = data.readInt();
198 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700199 Bundle options = data.readInt() != 0
200 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700201 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700202 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700203 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700204 reply.writeNoException();
205 reply.writeInt(result);
206 return true;
207 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208
209 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
210 {
211 data.enforceInterface(IActivityManager.descriptor);
212 IBinder callingActivity = data.readStrongBinder();
213 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700214 Bundle options = data.readInt() != 0
215 ? Bundle.CREATOR.createFromParcel(data) : null;
216 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800217 reply.writeNoException();
218 reply.writeInt(result ? 1 : 0);
219 return true;
220 }
221
222 case FINISH_ACTIVITY_TRANSACTION: {
223 data.enforceInterface(IActivityManager.descriptor);
224 IBinder token = data.readStrongBinder();
225 Intent resultData = null;
226 int resultCode = data.readInt();
227 if (data.readInt() != 0) {
228 resultData = Intent.CREATOR.createFromParcel(data);
229 }
230 boolean res = finishActivity(token, resultCode, resultData);
231 reply.writeNoException();
232 reply.writeInt(res ? 1 : 0);
233 return true;
234 }
235
236 case FINISH_SUB_ACTIVITY_TRANSACTION: {
237 data.enforceInterface(IActivityManager.descriptor);
238 IBinder token = data.readStrongBinder();
239 String resultWho = data.readString();
240 int requestCode = data.readInt();
241 finishSubActivity(token, resultWho, requestCode);
242 reply.writeNoException();
243 return true;
244 }
245
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800246 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
247 data.enforceInterface(IActivityManager.descriptor);
248 IBinder token = data.readStrongBinder();
249 boolean res = willActivityBeVisible(token);
250 reply.writeNoException();
251 reply.writeInt(res ? 1 : 0);
252 return true;
253 }
254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 case REGISTER_RECEIVER_TRANSACTION:
256 {
257 data.enforceInterface(IActivityManager.descriptor);
258 IBinder b = data.readStrongBinder();
259 IApplicationThread app =
260 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700261 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800262 b = data.readStrongBinder();
263 IIntentReceiver rec
264 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
265 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
266 String perm = data.readString();
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700267 Intent intent = registerReceiver(app, packageName, rec, filter, perm);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800268 reply.writeNoException();
269 if (intent != null) {
270 reply.writeInt(1);
271 intent.writeToParcel(reply, 0);
272 } else {
273 reply.writeInt(0);
274 }
275 return true;
276 }
277
278 case UNREGISTER_RECEIVER_TRANSACTION:
279 {
280 data.enforceInterface(IActivityManager.descriptor);
281 IBinder b = data.readStrongBinder();
282 if (b == null) {
283 return true;
284 }
285 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
286 unregisterReceiver(rec);
287 reply.writeNoException();
288 return true;
289 }
290
291 case BROADCAST_INTENT_TRANSACTION:
292 {
293 data.enforceInterface(IActivityManager.descriptor);
294 IBinder b = data.readStrongBinder();
295 IApplicationThread app =
296 b != null ? ApplicationThreadNative.asInterface(b) : null;
297 Intent intent = Intent.CREATOR.createFromParcel(data);
298 String resolvedType = data.readString();
299 b = data.readStrongBinder();
300 IIntentReceiver resultTo =
301 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
302 int resultCode = data.readInt();
303 String resultData = data.readString();
304 Bundle resultExtras = data.readBundle();
305 String perm = data.readString();
306 boolean serialized = data.readInt() != 0;
307 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700308 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800309 int res = broadcastIntent(app, intent, resolvedType, resultTo,
310 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700311 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800312 reply.writeNoException();
313 reply.writeInt(res);
314 return true;
315 }
316
317 case UNBROADCAST_INTENT_TRANSACTION:
318 {
319 data.enforceInterface(IActivityManager.descriptor);
320 IBinder b = data.readStrongBinder();
321 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
322 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700323 int userId = data.readInt();
324 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800325 reply.writeNoException();
326 return true;
327 }
328
329 case FINISH_RECEIVER_TRANSACTION: {
330 data.enforceInterface(IActivityManager.descriptor);
331 IBinder who = data.readStrongBinder();
332 int resultCode = data.readInt();
333 String resultData = data.readString();
334 Bundle resultExtras = data.readBundle();
335 boolean resultAbort = data.readInt() != 0;
336 if (who != null) {
337 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
338 }
339 reply.writeNoException();
340 return true;
341 }
342
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800343 case ATTACH_APPLICATION_TRANSACTION: {
344 data.enforceInterface(IActivityManager.descriptor);
345 IApplicationThread app = ApplicationThreadNative.asInterface(
346 data.readStrongBinder());
347 if (app != null) {
348 attachApplication(app);
349 }
350 reply.writeNoException();
351 return true;
352 }
353
354 case ACTIVITY_IDLE_TRANSACTION: {
355 data.enforceInterface(IActivityManager.descriptor);
356 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700357 Configuration config = null;
358 if (data.readInt() != 0) {
359 config = Configuration.CREATOR.createFromParcel(data);
360 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700361 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700363 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800364 }
365 reply.writeNoException();
366 return true;
367 }
368
369 case ACTIVITY_PAUSED_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800372 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 reply.writeNoException();
374 return true;
375 }
376
377 case ACTIVITY_STOPPED_TRANSACTION: {
378 data.enforceInterface(IActivityManager.descriptor);
379 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800380 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 Bitmap thumbnail = data.readInt() != 0
382 ? Bitmap.CREATOR.createFromParcel(data) : null;
383 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800384 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 reply.writeNoException();
386 return true;
387 }
388
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800389 case ACTIVITY_SLEPT_TRANSACTION: {
390 data.enforceInterface(IActivityManager.descriptor);
391 IBinder token = data.readStrongBinder();
392 activitySlept(token);
393 reply.writeNoException();
394 return true;
395 }
396
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397 case ACTIVITY_DESTROYED_TRANSACTION: {
398 data.enforceInterface(IActivityManager.descriptor);
399 IBinder token = data.readStrongBinder();
400 activityDestroyed(token);
401 reply.writeNoException();
402 return true;
403 }
404
405 case GET_CALLING_PACKAGE_TRANSACTION: {
406 data.enforceInterface(IActivityManager.descriptor);
407 IBinder token = data.readStrongBinder();
408 String res = token != null ? getCallingPackage(token) : null;
409 reply.writeNoException();
410 reply.writeString(res);
411 return true;
412 }
413
414 case GET_CALLING_ACTIVITY_TRANSACTION: {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder token = data.readStrongBinder();
417 ComponentName cn = getCallingActivity(token);
418 reply.writeNoException();
419 ComponentName.writeToParcel(cn, reply);
420 return true;
421 }
422
423 case GET_TASKS_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 int maxNum = data.readInt();
426 int fl = data.readInt();
427 IBinder receiverBinder = data.readStrongBinder();
428 IThumbnailReceiver receiver = receiverBinder != null
429 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
430 : null;
431 List list = getTasks(maxNum, fl, receiver);
432 reply.writeNoException();
433 int N = list != null ? list.size() : -1;
434 reply.writeInt(N);
435 int i;
436 for (i=0; i<N; i++) {
437 ActivityManager.RunningTaskInfo info =
438 (ActivityManager.RunningTaskInfo)list.get(i);
439 info.writeToParcel(reply, 0);
440 }
441 return true;
442 }
443
444 case GET_RECENT_TASKS_TRANSACTION: {
445 data.enforceInterface(IActivityManager.descriptor);
446 int maxNum = data.readInt();
447 int fl = data.readInt();
448 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
449 fl);
450 reply.writeNoException();
451 reply.writeTypedList(list);
452 return true;
453 }
454
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700455 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800456 data.enforceInterface(IActivityManager.descriptor);
457 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700458 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800459 reply.writeNoException();
460 if (bm != null) {
461 reply.writeInt(1);
462 bm.writeToParcel(reply, 0);
463 } else {
464 reply.writeInt(0);
465 }
466 return true;
467 }
468
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 case GET_SERVICES_TRANSACTION: {
470 data.enforceInterface(IActivityManager.descriptor);
471 int maxNum = data.readInt();
472 int fl = data.readInt();
473 List list = getServices(maxNum, fl);
474 reply.writeNoException();
475 int N = list != null ? list.size() : -1;
476 reply.writeInt(N);
477 int i;
478 for (i=0; i<N; i++) {
479 ActivityManager.RunningServiceInfo info =
480 (ActivityManager.RunningServiceInfo)list.get(i);
481 info.writeToParcel(reply, 0);
482 }
483 return true;
484 }
485
486 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
487 data.enforceInterface(IActivityManager.descriptor);
488 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
489 reply.writeNoException();
490 reply.writeTypedList(list);
491 return true;
492 }
493
494 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
495 data.enforceInterface(IActivityManager.descriptor);
496 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
497 reply.writeNoException();
498 reply.writeTypedList(list);
499 return true;
500 }
501
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700502 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
503 data.enforceInterface(IActivityManager.descriptor);
504 List<ApplicationInfo> list = getRunningExternalApplications();
505 reply.writeNoException();
506 reply.writeTypedList(list);
507 return true;
508 }
509
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800510 case MOVE_TASK_TO_FRONT_TRANSACTION: {
511 data.enforceInterface(IActivityManager.descriptor);
512 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800513 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700514 Bundle options = data.readInt() != 0
515 ? Bundle.CREATOR.createFromParcel(data) : null;
516 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800517 reply.writeNoException();
518 return true;
519 }
520
521 case MOVE_TASK_TO_BACK_TRANSACTION: {
522 data.enforceInterface(IActivityManager.descriptor);
523 int task = data.readInt();
524 moveTaskToBack(task);
525 reply.writeNoException();
526 return true;
527 }
528
529 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
530 data.enforceInterface(IActivityManager.descriptor);
531 IBinder token = data.readStrongBinder();
532 boolean nonRoot = data.readInt() != 0;
533 boolean res = moveActivityTaskToBack(token, nonRoot);
534 reply.writeNoException();
535 reply.writeInt(res ? 1 : 0);
536 return true;
537 }
538
539 case MOVE_TASK_BACKWARDS_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 int task = data.readInt();
542 moveTaskBackwards(task);
543 reply.writeNoException();
544 return true;
545 }
546
547 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 IBinder token = data.readStrongBinder();
550 boolean onlyRoot = data.readInt() != 0;
551 int res = token != null
552 ? getTaskForActivity(token, onlyRoot) : -1;
553 reply.writeNoException();
554 reply.writeInt(res);
555 return true;
556 }
557
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800558 case REPORT_THUMBNAIL_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 Bitmap thumbnail = data.readInt() != 0
562 ? Bitmap.CREATOR.createFromParcel(data) : null;
563 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
564 reportThumbnail(token, thumbnail, description);
565 reply.writeNoException();
566 return true;
567 }
568
569 case GET_CONTENT_PROVIDER_TRANSACTION: {
570 data.enforceInterface(IActivityManager.descriptor);
571 IBinder b = data.readStrongBinder();
572 IApplicationThread app = ApplicationThreadNative.asInterface(b);
573 String name = data.readString();
574 ContentProviderHolder cph = getContentProvider(app, name);
575 reply.writeNoException();
576 if (cph != null) {
577 reply.writeInt(1);
578 cph.writeToParcel(reply, 0);
579 } else {
580 reply.writeInt(0);
581 }
582 return true;
583 }
584
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800585 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
586 data.enforceInterface(IActivityManager.descriptor);
587 String name = data.readString();
588 IBinder token = data.readStrongBinder();
589 ContentProviderHolder cph = getContentProviderExternal(name, token);
590 reply.writeNoException();
591 if (cph != null) {
592 reply.writeInt(1);
593 cph.writeToParcel(reply, 0);
594 } else {
595 reply.writeInt(0);
596 }
597 return true;
598 }
599
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800600 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
601 data.enforceInterface(IActivityManager.descriptor);
602 IBinder b = data.readStrongBinder();
603 IApplicationThread app = ApplicationThreadNative.asInterface(b);
604 ArrayList<ContentProviderHolder> providers =
605 data.createTypedArrayList(ContentProviderHolder.CREATOR);
606 publishContentProviders(app, providers);
607 reply.writeNoException();
608 return true;
609 }
610
611 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
612 data.enforceInterface(IActivityManager.descriptor);
613 IBinder b = data.readStrongBinder();
614 IApplicationThread app = ApplicationThreadNative.asInterface(b);
615 String name = data.readString();
616 removeContentProvider(app, name);
617 reply.writeNoException();
618 return true;
619 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800620
621 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
622 data.enforceInterface(IActivityManager.descriptor);
623 String name = data.readString();
624 IBinder token = data.readStrongBinder();
625 removeContentProviderExternal(name, token);
626 reply.writeNoException();
627 return true;
628 }
629
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700630 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
631 data.enforceInterface(IActivityManager.descriptor);
632 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
633 PendingIntent pi = getRunningServiceControlPanel(comp);
634 reply.writeNoException();
635 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
636 return true;
637 }
638
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 case START_SERVICE_TRANSACTION: {
640 data.enforceInterface(IActivityManager.descriptor);
641 IBinder b = data.readStrongBinder();
642 IApplicationThread app = ApplicationThreadNative.asInterface(b);
643 Intent service = Intent.CREATOR.createFromParcel(data);
644 String resolvedType = data.readString();
645 ComponentName cn = startService(app, service, resolvedType);
646 reply.writeNoException();
647 ComponentName.writeToParcel(cn, reply);
648 return true;
649 }
650
651 case STOP_SERVICE_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 IBinder b = data.readStrongBinder();
654 IApplicationThread app = ApplicationThreadNative.asInterface(b);
655 Intent service = Intent.CREATOR.createFromParcel(data);
656 String resolvedType = data.readString();
657 int res = stopService(app, service, resolvedType);
658 reply.writeNoException();
659 reply.writeInt(res);
660 return true;
661 }
662
663 case STOP_SERVICE_TOKEN_TRANSACTION: {
664 data.enforceInterface(IActivityManager.descriptor);
665 ComponentName className = ComponentName.readFromParcel(data);
666 IBinder token = data.readStrongBinder();
667 int startId = data.readInt();
668 boolean res = stopServiceToken(className, token, startId);
669 reply.writeNoException();
670 reply.writeInt(res ? 1 : 0);
671 return true;
672 }
673
674 case SET_SERVICE_FOREGROUND_TRANSACTION: {
675 data.enforceInterface(IActivityManager.descriptor);
676 ComponentName className = ComponentName.readFromParcel(data);
677 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700678 int id = data.readInt();
679 Notification notification = null;
680 if (data.readInt() != 0) {
681 notification = Notification.CREATOR.createFromParcel(data);
682 }
683 boolean removeNotification = data.readInt() != 0;
684 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800685 reply.writeNoException();
686 return true;
687 }
688
689 case BIND_SERVICE_TRANSACTION: {
690 data.enforceInterface(IActivityManager.descriptor);
691 IBinder b = data.readStrongBinder();
692 IApplicationThread app = ApplicationThreadNative.asInterface(b);
693 IBinder token = data.readStrongBinder();
694 Intent service = Intent.CREATOR.createFromParcel(data);
695 String resolvedType = data.readString();
696 b = data.readStrongBinder();
697 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800698 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800699 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800700 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 reply.writeNoException();
702 reply.writeInt(res);
703 return true;
704 }
705
706 case UNBIND_SERVICE_TRANSACTION: {
707 data.enforceInterface(IActivityManager.descriptor);
708 IBinder b = data.readStrongBinder();
709 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
710 boolean res = unbindService(conn);
711 reply.writeNoException();
712 reply.writeInt(res ? 1 : 0);
713 return true;
714 }
715
716 case PUBLISH_SERVICE_TRANSACTION: {
717 data.enforceInterface(IActivityManager.descriptor);
718 IBinder token = data.readStrongBinder();
719 Intent intent = Intent.CREATOR.createFromParcel(data);
720 IBinder service = data.readStrongBinder();
721 publishService(token, intent, service);
722 reply.writeNoException();
723 return true;
724 }
725
726 case UNBIND_FINISHED_TRANSACTION: {
727 data.enforceInterface(IActivityManager.descriptor);
728 IBinder token = data.readStrongBinder();
729 Intent intent = Intent.CREATOR.createFromParcel(data);
730 boolean doRebind = data.readInt() != 0;
731 unbindFinished(token, intent, doRebind);
732 reply.writeNoException();
733 return true;
734 }
735
736 case SERVICE_DONE_EXECUTING_TRANSACTION: {
737 data.enforceInterface(IActivityManager.descriptor);
738 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700739 int type = data.readInt();
740 int startId = data.readInt();
741 int res = data.readInt();
742 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800743 reply.writeNoException();
744 return true;
745 }
746
747 case START_INSTRUMENTATION_TRANSACTION: {
748 data.enforceInterface(IActivityManager.descriptor);
749 ComponentName className = ComponentName.readFromParcel(data);
750 String profileFile = data.readString();
751 int fl = data.readInt();
752 Bundle arguments = data.readBundle();
753 IBinder b = data.readStrongBinder();
754 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
755 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
756 reply.writeNoException();
757 reply.writeInt(res ? 1 : 0);
758 return true;
759 }
760
761
762 case FINISH_INSTRUMENTATION_TRANSACTION: {
763 data.enforceInterface(IActivityManager.descriptor);
764 IBinder b = data.readStrongBinder();
765 IApplicationThread app = ApplicationThreadNative.asInterface(b);
766 int resultCode = data.readInt();
767 Bundle results = data.readBundle();
768 finishInstrumentation(app, resultCode, results);
769 reply.writeNoException();
770 return true;
771 }
772
773 case GET_CONFIGURATION_TRANSACTION: {
774 data.enforceInterface(IActivityManager.descriptor);
775 Configuration config = getConfiguration();
776 reply.writeNoException();
777 config.writeToParcel(reply, 0);
778 return true;
779 }
780
781 case UPDATE_CONFIGURATION_TRANSACTION: {
782 data.enforceInterface(IActivityManager.descriptor);
783 Configuration config = Configuration.CREATOR.createFromParcel(data);
784 updateConfiguration(config);
785 reply.writeNoException();
786 return true;
787 }
788
789 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 IBinder token = data.readStrongBinder();
792 int requestedOrientation = data.readInt();
793 setRequestedOrientation(token, requestedOrientation);
794 reply.writeNoException();
795 return true;
796 }
797
798 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
799 data.enforceInterface(IActivityManager.descriptor);
800 IBinder token = data.readStrongBinder();
801 int req = getRequestedOrientation(token);
802 reply.writeNoException();
803 reply.writeInt(req);
804 return true;
805 }
806
807 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 IBinder token = data.readStrongBinder();
810 ComponentName cn = getActivityClassForToken(token);
811 reply.writeNoException();
812 ComponentName.writeToParcel(cn, reply);
813 return true;
814 }
815
816 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
817 data.enforceInterface(IActivityManager.descriptor);
818 IBinder token = data.readStrongBinder();
819 reply.writeNoException();
820 reply.writeString(getPackageForToken(token));
821 return true;
822 }
823
824 case GET_INTENT_SENDER_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 int type = data.readInt();
827 String packageName = data.readString();
828 IBinder token = data.readStrongBinder();
829 String resultWho = data.readString();
830 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800831 Intent[] requestIntents;
832 String[] requestResolvedTypes;
833 if (data.readInt() != 0) {
834 requestIntents = data.createTypedArray(Intent.CREATOR);
835 requestResolvedTypes = data.createStringArray();
836 } else {
837 requestIntents = null;
838 requestResolvedTypes = null;
839 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800840 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700841 Bundle options = data.readInt() != 0
842 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800843 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800844 resultWho, requestCode, requestIntents,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700845 requestResolvedTypes, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800846 reply.writeNoException();
847 reply.writeStrongBinder(res != null ? res.asBinder() : null);
848 return true;
849 }
850
851 case CANCEL_INTENT_SENDER_TRANSACTION: {
852 data.enforceInterface(IActivityManager.descriptor);
853 IIntentSender r = IIntentSender.Stub.asInterface(
854 data.readStrongBinder());
855 cancelIntentSender(r);
856 reply.writeNoException();
857 return true;
858 }
859
860 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
861 data.enforceInterface(IActivityManager.descriptor);
862 IIntentSender r = IIntentSender.Stub.asInterface(
863 data.readStrongBinder());
864 String res = getPackageForIntentSender(r);
865 reply.writeNoException();
866 reply.writeString(res);
867 return true;
868 }
869
870 case SET_PROCESS_LIMIT_TRANSACTION: {
871 data.enforceInterface(IActivityManager.descriptor);
872 int max = data.readInt();
873 setProcessLimit(max);
874 reply.writeNoException();
875 return true;
876 }
877
878 case GET_PROCESS_LIMIT_TRANSACTION: {
879 data.enforceInterface(IActivityManager.descriptor);
880 int limit = getProcessLimit();
881 reply.writeNoException();
882 reply.writeInt(limit);
883 return true;
884 }
885
886 case SET_PROCESS_FOREGROUND_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 IBinder token = data.readStrongBinder();
889 int pid = data.readInt();
890 boolean isForeground = data.readInt() != 0;
891 setProcessForeground(token, pid, isForeground);
892 reply.writeNoException();
893 return true;
894 }
895
896 case CHECK_PERMISSION_TRANSACTION: {
897 data.enforceInterface(IActivityManager.descriptor);
898 String perm = data.readString();
899 int pid = data.readInt();
900 int uid = data.readInt();
901 int res = checkPermission(perm, pid, uid);
902 reply.writeNoException();
903 reply.writeInt(res);
904 return true;
905 }
906
907 case CHECK_URI_PERMISSION_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 Uri uri = Uri.CREATOR.createFromParcel(data);
910 int pid = data.readInt();
911 int uid = data.readInt();
912 int mode = data.readInt();
913 int res = checkUriPermission(uri, pid, uid, mode);
914 reply.writeNoException();
915 reply.writeInt(res);
916 return true;
917 }
918
919 case CLEAR_APP_DATA_TRANSACTION: {
920 data.enforceInterface(IActivityManager.descriptor);
921 String packageName = data.readString();
922 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
923 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -0700924 int userId = data.readInt();
925 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 reply.writeNoException();
927 reply.writeInt(res ? 1 : 0);
928 return true;
929 }
930
931 case GRANT_URI_PERMISSION_TRANSACTION: {
932 data.enforceInterface(IActivityManager.descriptor);
933 IBinder b = data.readStrongBinder();
934 IApplicationThread app = ApplicationThreadNative.asInterface(b);
935 String targetPkg = data.readString();
936 Uri uri = Uri.CREATOR.createFromParcel(data);
937 int mode = data.readInt();
938 grantUriPermission(app, targetPkg, uri, mode);
939 reply.writeNoException();
940 return true;
941 }
942
943 case REVOKE_URI_PERMISSION_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 IBinder b = data.readStrongBinder();
946 IApplicationThread app = ApplicationThreadNative.asInterface(b);
947 Uri uri = Uri.CREATOR.createFromParcel(data);
948 int mode = data.readInt();
949 revokeUriPermission(app, uri, mode);
950 reply.writeNoException();
951 return true;
952 }
953
954 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
955 data.enforceInterface(IActivityManager.descriptor);
956 IBinder b = data.readStrongBinder();
957 IApplicationThread app = ApplicationThreadNative.asInterface(b);
958 boolean waiting = data.readInt() != 0;
959 showWaitingForDebugger(app, waiting);
960 reply.writeNoException();
961 return true;
962 }
963
964 case GET_MEMORY_INFO_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
967 getMemoryInfo(mi);
968 reply.writeNoException();
969 mi.writeToParcel(reply, 0);
970 return true;
971 }
972
973 case UNHANDLED_BACK_TRANSACTION: {
974 data.enforceInterface(IActivityManager.descriptor);
975 unhandledBack();
976 reply.writeNoException();
977 return true;
978 }
979
980 case OPEN_CONTENT_URI_TRANSACTION: {
981 data.enforceInterface(IActivityManager.descriptor);
982 Uri uri = Uri.parse(data.readString());
983 ParcelFileDescriptor pfd = openContentUri(uri);
984 reply.writeNoException();
985 if (pfd != null) {
986 reply.writeInt(1);
987 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
988 } else {
989 reply.writeInt(0);
990 }
991 return true;
992 }
993
994 case GOING_TO_SLEEP_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 goingToSleep();
997 reply.writeNoException();
998 return true;
999 }
1000
1001 case WAKING_UP_TRANSACTION: {
1002 data.enforceInterface(IActivityManager.descriptor);
1003 wakingUp();
1004 reply.writeNoException();
1005 return true;
1006 }
1007
1008 case SET_DEBUG_APP_TRANSACTION: {
1009 data.enforceInterface(IActivityManager.descriptor);
1010 String pn = data.readString();
1011 boolean wfd = data.readInt() != 0;
1012 boolean per = data.readInt() != 0;
1013 setDebugApp(pn, wfd, per);
1014 reply.writeNoException();
1015 return true;
1016 }
1017
1018 case SET_ALWAYS_FINISH_TRANSACTION: {
1019 data.enforceInterface(IActivityManager.descriptor);
1020 boolean enabled = data.readInt() != 0;
1021 setAlwaysFinish(enabled);
1022 reply.writeNoException();
1023 return true;
1024 }
1025
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001026 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001027 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001028 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001029 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001030 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001031 return true;
1032 }
1033
1034 case ENTER_SAFE_MODE_TRANSACTION: {
1035 data.enforceInterface(IActivityManager.descriptor);
1036 enterSafeMode();
1037 reply.writeNoException();
1038 return true;
1039 }
1040
1041 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1042 data.enforceInterface(IActivityManager.descriptor);
1043 IIntentSender is = IIntentSender.Stub.asInterface(
1044 data.readStrongBinder());
1045 noteWakeupAlarm(is);
1046 reply.writeNoException();
1047 return true;
1048 }
1049
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001050 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001051 data.enforceInterface(IActivityManager.descriptor);
1052 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001053 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001054 boolean secure = data.readInt() != 0;
1055 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001056 reply.writeNoException();
1057 reply.writeInt(res ? 1 : 0);
1058 return true;
1059 }
1060
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001061 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 String reason = data.readString();
1064 boolean res = killProcessesBelowForeground(reason);
1065 reply.writeNoException();
1066 reply.writeInt(res ? 1 : 0);
1067 return true;
1068 }
1069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001070 case START_RUNNING_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 String pkg = data.readString();
1073 String cls = data.readString();
1074 String action = data.readString();
1075 String indata = data.readString();
1076 startRunning(pkg, cls, action, indata);
1077 reply.writeNoException();
1078 return true;
1079 }
1080
Dan Egnor60d87622009-12-16 16:32:58 -08001081 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1082 data.enforceInterface(IActivityManager.descriptor);
1083 IBinder app = data.readStrongBinder();
1084 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1085 handleApplicationCrash(app, ci);
1086 reply.writeNoException();
1087 return true;
1088 }
1089
1090 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 data.enforceInterface(IActivityManager.descriptor);
1092 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001093 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001094 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001095 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001096 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001097 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 return true;
1099 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001100
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001101 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1102 data.enforceInterface(IActivityManager.descriptor);
1103 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001104 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001105 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1106 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001107 reply.writeNoException();
1108 return true;
1109 }
1110
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001111 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 int sig = data.readInt();
1114 signalPersistentProcesses(sig);
1115 reply.writeNoException();
1116 return true;
1117 }
1118
Dianne Hackborn03abb812010-01-04 18:43:19 -08001119 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001121 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001122 killBackgroundProcesses(packageName);
1123 reply.writeNoException();
1124 return true;
1125 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001126
1127 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 killAllBackgroundProcesses();
1130 reply.writeNoException();
1131 return true;
1132 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001133
1134 case FORCE_STOP_PACKAGE_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 String packageName = data.readString();
1137 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 reply.writeNoException();
1139 return true;
1140 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001141
1142 case GET_MY_MEMORY_STATE_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 ActivityManager.RunningAppProcessInfo info =
1145 new ActivityManager.RunningAppProcessInfo();
1146 getMyMemoryState(info);
1147 reply.writeNoException();
1148 info.writeToParcel(reply, 0);
1149 return true;
1150 }
1151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 ConfigurationInfo config = getDeviceConfigurationInfo();
1155 reply.writeNoException();
1156 config.writeToParcel(reply, 0);
1157 return true;
1158 }
1159
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001160 case PROFILE_CONTROL_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 String process = data.readString();
1163 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001164 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001165 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001166 ParcelFileDescriptor fd = data.readInt() != 0
1167 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001168 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001169 reply.writeNoException();
1170 reply.writeInt(res ? 1 : 0);
1171 return true;
1172 }
1173
Dianne Hackborn55280a92009-05-07 15:53:46 -07001174 case SHUTDOWN_TRANSACTION: {
1175 data.enforceInterface(IActivityManager.descriptor);
1176 boolean res = shutdown(data.readInt());
1177 reply.writeNoException();
1178 reply.writeInt(res ? 1 : 0);
1179 return true;
1180 }
1181
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001182 case STOP_APP_SWITCHES_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 stopAppSwitches();
1185 reply.writeNoException();
1186 return true;
1187 }
1188
1189 case RESUME_APP_SWITCHES_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 resumeAppSwitches();
1192 reply.writeNoException();
1193 return true;
1194 }
1195
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 case PEEK_SERVICE_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 Intent service = Intent.CREATOR.createFromParcel(data);
1199 String resolvedType = data.readString();
1200 IBinder binder = peekService(service, resolvedType);
1201 reply.writeNoException();
1202 reply.writeStrongBinder(binder);
1203 return true;
1204 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001205
1206 case START_BACKUP_AGENT_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1209 int backupRestoreMode = data.readInt();
1210 boolean success = bindBackupAgent(info, backupRestoreMode);
1211 reply.writeNoException();
1212 reply.writeInt(success ? 1 : 0);
1213 return true;
1214 }
1215
1216 case BACKUP_AGENT_CREATED_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 String packageName = data.readString();
1219 IBinder agent = data.readStrongBinder();
1220 backupAgentCreated(packageName, agent);
1221 reply.writeNoException();
1222 return true;
1223 }
1224
1225 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1228 unbindBackupAgent(info);
1229 reply.writeNoException();
1230 return true;
1231 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001232
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001233 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1234 {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 int uid = data.readInt();
1237 Intent intent = Intent.CREATOR.createFromParcel(data);
1238 String resolvedType = data.readString();
1239 IBinder resultTo = data.readStrongBinder();
1240 String resultWho = data.readString();
1241 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001242 int startFlags = data.readInt();
1243 Bundle options = data.readInt() != 0
1244 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001245 int result = startActivityInPackage(uid, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001246 resultTo, resultWho, requestCode, startFlags, options);
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001247 reply.writeNoException();
1248 reply.writeInt(result);
1249 return true;
1250 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001251
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001252 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1253 data.enforceInterface(IActivityManager.descriptor);
1254 String pkg = data.readString();
1255 int uid = data.readInt();
1256 killApplicationWithUid(pkg, uid);
1257 reply.writeNoException();
1258 return true;
1259 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001260
1261 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 String reason = data.readString();
1264 closeSystemDialogs(reason);
1265 reply.writeNoException();
1266 return true;
1267 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001268
1269 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1270 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001271 int[] pids = data.createIntArray();
1272 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001273 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001274 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001275 return true;
1276 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001277
1278 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1279 data.enforceInterface(IActivityManager.descriptor);
1280 String processName = data.readString();
1281 int uid = data.readInt();
1282 killApplicationProcess(processName, uid);
1283 reply.writeNoException();
1284 return true;
1285 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001286
1287 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
1289 IBinder token = data.readStrongBinder();
1290 String packageName = data.readString();
1291 int enterAnim = data.readInt();
1292 int exitAnim = data.readInt();
1293 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001294 reply.writeNoException();
1295 return true;
1296 }
1297
1298 case IS_USER_A_MONKEY_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001300 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001301 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001302 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001303 return true;
1304 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001305
1306 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 finishHeavyWeightApp();
1309 reply.writeNoException();
1310 return true;
1311 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001312
1313 case IS_IMMERSIVE_TRANSACTION: {
1314 data.enforceInterface(IActivityManager.descriptor);
1315 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001316 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001317 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001318 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001319 return true;
1320 }
1321
1322 case SET_IMMERSIVE_TRANSACTION: {
1323 data.enforceInterface(IActivityManager.descriptor);
1324 IBinder token = data.readStrongBinder();
1325 boolean imm = data.readInt() == 1;
1326 setImmersive(token, imm);
1327 reply.writeNoException();
1328 return true;
1329 }
1330
1331 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001333 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001334 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001335 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001336 return true;
1337 }
1338
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001339 case CRASH_APPLICATION_TRANSACTION: {
1340 data.enforceInterface(IActivityManager.descriptor);
1341 int uid = data.readInt();
1342 int initialPid = data.readInt();
1343 String packageName = data.readString();
1344 String message = data.readString();
1345 crashApplication(uid, initialPid, packageName, message);
1346 reply.writeNoException();
1347 return true;
1348 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001349
1350 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 Uri uri = Uri.CREATOR.createFromParcel(data);
1353 String type = getProviderMimeType(uri);
1354 reply.writeNoException();
1355 reply.writeString(type);
1356 return true;
1357 }
1358
Dianne Hackborn7e269642010-08-25 19:50:20 -07001359 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1360 data.enforceInterface(IActivityManager.descriptor);
1361 String name = data.readString();
1362 IBinder perm = newUriPermissionOwner(name);
1363 reply.writeNoException();
1364 reply.writeStrongBinder(perm);
1365 return true;
1366 }
1367
1368 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1369 data.enforceInterface(IActivityManager.descriptor);
1370 IBinder owner = data.readStrongBinder();
1371 int fromUid = data.readInt();
1372 String targetPkg = data.readString();
1373 Uri uri = Uri.CREATOR.createFromParcel(data);
1374 int mode = data.readInt();
1375 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1376 reply.writeNoException();
1377 return true;
1378 }
1379
1380 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 IBinder owner = data.readStrongBinder();
1383 Uri uri = null;
1384 if (data.readInt() != 0) {
1385 Uri.CREATOR.createFromParcel(data);
1386 }
1387 int mode = data.readInt();
1388 revokeUriPermissionFromOwner(owner, uri, mode);
1389 reply.writeNoException();
1390 return true;
1391 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001392
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001393 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1394 data.enforceInterface(IActivityManager.descriptor);
1395 int callingUid = data.readInt();
1396 String targetPkg = data.readString();
1397 Uri uri = Uri.CREATOR.createFromParcel(data);
1398 int modeFlags = data.readInt();
1399 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1400 reply.writeNoException();
1401 reply.writeInt(res);
1402 return true;
1403 }
1404
Andy McFadden824c5102010-07-09 16:26:57 -07001405 case DUMP_HEAP_TRANSACTION: {
1406 data.enforceInterface(IActivityManager.descriptor);
1407 String process = data.readString();
1408 boolean managed = data.readInt() != 0;
1409 String path = data.readString();
1410 ParcelFileDescriptor fd = data.readInt() != 0
1411 ? data.readFileDescriptor() : null;
1412 boolean res = dumpHeap(process, managed, path, fd);
1413 reply.writeNoException();
1414 reply.writeInt(res ? 1 : 0);
1415 return true;
1416 }
1417
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001418 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1419 {
1420 data.enforceInterface(IActivityManager.descriptor);
1421 int uid = data.readInt();
1422 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1423 String[] resolvedTypes = data.createStringArray();
1424 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001425 Bundle options = data.readInt() != 0
1426 ? Bundle.CREATOR.createFromParcel(data) : null;
1427 int result = startActivitiesInPackage(uid, intents, resolvedTypes,
1428 resultTo, options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001429 reply.writeNoException();
1430 reply.writeInt(result);
1431 return true;
1432 }
1433
1434 case START_ACTIVITIES_TRANSACTION:
1435 {
1436 data.enforceInterface(IActivityManager.descriptor);
1437 IBinder b = data.readStrongBinder();
1438 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1439 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1440 String[] resolvedTypes = data.createStringArray();
1441 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001442 Bundle options = data.readInt() != 0
1443 ? Bundle.CREATOR.createFromParcel(data) : null;
1444 int result = startActivities(app, intents, resolvedTypes, resultTo,
1445 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001446 reply.writeNoException();
1447 reply.writeInt(result);
1448 return true;
1449 }
1450
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001451 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1452 {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 int mode = getFrontActivityScreenCompatMode();
1455 reply.writeNoException();
1456 reply.writeInt(mode);
1457 return true;
1458 }
1459
1460 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1461 {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 int mode = data.readInt();
1464 setFrontActivityScreenCompatMode(mode);
1465 reply.writeNoException();
1466 reply.writeInt(mode);
1467 return true;
1468 }
1469
1470 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1471 {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 String pkg = data.readString();
1474 int mode = getPackageScreenCompatMode(pkg);
1475 reply.writeNoException();
1476 reply.writeInt(mode);
1477 return true;
1478 }
1479
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001480 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1481 {
1482 data.enforceInterface(IActivityManager.descriptor);
1483 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001484 int mode = data.readInt();
1485 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001486 reply.writeNoException();
1487 return true;
1488 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001489
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001490 case SWITCH_USER_TRANSACTION: {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 int userid = data.readInt();
1493 boolean result = switchUser(userid);
1494 reply.writeNoException();
1495 reply.writeInt(result ? 1 : 0);
1496 return true;
1497 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001498
1499 case GET_CURRENT_USER_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 UserInfo userInfo = getCurrentUser();
1502 reply.writeNoException();
1503 userInfo.writeToParcel(reply, 0);
1504 return true;
1505 }
1506
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001507 case REMOVE_SUB_TASK_TRANSACTION:
1508 {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 int taskId = data.readInt();
1511 int subTaskIndex = data.readInt();
1512 boolean result = removeSubTask(taskId, subTaskIndex);
1513 reply.writeNoException();
1514 reply.writeInt(result ? 1 : 0);
1515 return true;
1516 }
1517
1518 case REMOVE_TASK_TRANSACTION:
1519 {
1520 data.enforceInterface(IActivityManager.descriptor);
1521 int taskId = data.readInt();
1522 int fl = data.readInt();
1523 boolean result = removeTask(taskId, fl);
1524 reply.writeNoException();
1525 reply.writeInt(result ? 1 : 0);
1526 return true;
1527 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001528
Jeff Sharkeya4620792011-05-20 15:29:23 -07001529 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1532 data.readStrongBinder());
1533 registerProcessObserver(observer);
1534 return true;
1535 }
1536
1537 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1540 data.readStrongBinder());
1541 unregisterProcessObserver(observer);
1542 return true;
1543 }
1544
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001545 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1546 {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 String pkg = data.readString();
1549 boolean ask = getPackageAskScreenCompat(pkg);
1550 reply.writeNoException();
1551 reply.writeInt(ask ? 1 : 0);
1552 return true;
1553 }
1554
1555 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1556 {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 String pkg = data.readString();
1559 boolean ask = data.readInt() != 0;
1560 setPackageAskScreenCompat(pkg, ask);
1561 reply.writeNoException();
1562 return true;
1563 }
1564
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001565 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 IIntentSender r = IIntentSender.Stub.asInterface(
1568 data.readStrongBinder());
1569 boolean res = isIntentSenderTargetedToPackage(r);
1570 reply.writeNoException();
1571 reply.writeInt(res ? 1 : 0);
1572 return true;
1573 }
1574
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001575 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1576 data.enforceInterface(IActivityManager.descriptor);
1577 Configuration config = Configuration.CREATOR.createFromParcel(data);
1578 updatePersistentConfiguration(config);
1579 reply.writeNoException();
1580 return true;
1581 }
1582
Dianne Hackbornb437e092011-08-05 17:50:29 -07001583 case GET_PROCESS_PSS_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 int[] pids = data.createIntArray();
1586 long[] pss = getProcessPss(pids);
1587 reply.writeNoException();
1588 reply.writeLongArray(pss);
1589 return true;
1590 }
1591
Dianne Hackborn661cd522011-08-22 00:26:20 -07001592 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
1594 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1595 boolean always = data.readInt() != 0;
1596 showBootMessage(msg, always);
1597 reply.writeNoException();
1598 return true;
1599 }
1600
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001601 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 dismissKeyguardOnNextActivity();
1604 reply.writeNoException();
1605 return true;
1606 }
1607
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001608 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001609
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001610 return super.onTransact(code, data, reply, flags);
1611 }
1612
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001613 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001614 return this;
1615 }
1616
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001617 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1618 protected IActivityManager create() {
1619 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001620 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001621 Log.v("ActivityManager", "default service binder = " + b);
1622 }
1623 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001624 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001625 Log.v("ActivityManager", "default service = " + am);
1626 }
1627 return am;
1628 }
1629 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001630}
1631
1632class ActivityManagerProxy implements IActivityManager
1633{
1634 public ActivityManagerProxy(IBinder remote)
1635 {
1636 mRemote = remote;
1637 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001638
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001639 public IBinder asBinder()
1640 {
1641 return mRemote;
1642 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001643
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001644 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001645 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1646 int startFlags, String profileFile,
1647 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001648 Parcel data = Parcel.obtain();
1649 Parcel reply = Parcel.obtain();
1650 data.writeInterfaceToken(IActivityManager.descriptor);
1651 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1652 intent.writeToParcel(data, 0);
1653 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001654 data.writeStrongBinder(resultTo);
1655 data.writeString(resultWho);
1656 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001657 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001658 data.writeString(profileFile);
1659 if (profileFd != null) {
1660 data.writeInt(1);
1661 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1662 } else {
1663 data.writeInt(0);
1664 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001665 if (options != null) {
1666 data.writeInt(1);
1667 options.writeToParcel(data, 0);
1668 } else {
1669 data.writeInt(0);
1670 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001671 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1672 reply.readException();
1673 int result = reply.readInt();
1674 reply.recycle();
1675 data.recycle();
1676 return result;
1677 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001678 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001679 String resolvedType, IBinder resultTo, String resultWho,
1680 int requestCode, int startFlags, String profileFile,
1681 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001682 Parcel data = Parcel.obtain();
1683 Parcel reply = Parcel.obtain();
1684 data.writeInterfaceToken(IActivityManager.descriptor);
1685 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1686 intent.writeToParcel(data, 0);
1687 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001688 data.writeStrongBinder(resultTo);
1689 data.writeString(resultWho);
1690 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001691 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001692 data.writeString(profileFile);
1693 if (profileFd != null) {
1694 data.writeInt(1);
1695 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1696 } else {
1697 data.writeInt(0);
1698 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001699 if (options != null) {
1700 data.writeInt(1);
1701 options.writeToParcel(data, 0);
1702 } else {
1703 data.writeInt(0);
1704 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001705 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1706 reply.readException();
1707 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1708 reply.recycle();
1709 data.recycle();
1710 return result;
1711 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001712 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001713 String resolvedType, IBinder resultTo, String resultWho,
1714 int requestCode, int startFlags, Configuration config,
1715 Bundle options) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001716 Parcel data = Parcel.obtain();
1717 Parcel reply = Parcel.obtain();
1718 data.writeInterfaceToken(IActivityManager.descriptor);
1719 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1720 intent.writeToParcel(data, 0);
1721 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001722 data.writeStrongBinder(resultTo);
1723 data.writeString(resultWho);
1724 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001725 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001726 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001727 if (options != null) {
1728 data.writeInt(1);
1729 options.writeToParcel(data, 0);
1730 } else {
1731 data.writeInt(0);
1732 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001733 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1734 reply.readException();
1735 int result = reply.readInt();
1736 reply.recycle();
1737 data.recycle();
1738 return result;
1739 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001740 public int startActivityIntentSender(IApplicationThread caller,
1741 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001742 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001743 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001744 Parcel data = Parcel.obtain();
1745 Parcel reply = Parcel.obtain();
1746 data.writeInterfaceToken(IActivityManager.descriptor);
1747 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1748 intent.writeToParcel(data, 0);
1749 if (fillInIntent != null) {
1750 data.writeInt(1);
1751 fillInIntent.writeToParcel(data, 0);
1752 } else {
1753 data.writeInt(0);
1754 }
1755 data.writeString(resolvedType);
1756 data.writeStrongBinder(resultTo);
1757 data.writeString(resultWho);
1758 data.writeInt(requestCode);
1759 data.writeInt(flagsMask);
1760 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001761 if (options != null) {
1762 data.writeInt(1);
1763 options.writeToParcel(data, 0);
1764 } else {
1765 data.writeInt(0);
1766 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001767 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001768 reply.readException();
1769 int result = reply.readInt();
1770 reply.recycle();
1771 data.recycle();
1772 return result;
1773 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001774 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001775 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001776 Parcel data = Parcel.obtain();
1777 Parcel reply = Parcel.obtain();
1778 data.writeInterfaceToken(IActivityManager.descriptor);
1779 data.writeStrongBinder(callingActivity);
1780 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001781 if (options != null) {
1782 data.writeInt(1);
1783 options.writeToParcel(data, 0);
1784 } else {
1785 data.writeInt(0);
1786 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001787 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1788 reply.readException();
1789 int result = reply.readInt();
1790 reply.recycle();
1791 data.recycle();
1792 return result != 0;
1793 }
1794 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1795 throws RemoteException {
1796 Parcel data = Parcel.obtain();
1797 Parcel reply = Parcel.obtain();
1798 data.writeInterfaceToken(IActivityManager.descriptor);
1799 data.writeStrongBinder(token);
1800 data.writeInt(resultCode);
1801 if (resultData != null) {
1802 data.writeInt(1);
1803 resultData.writeToParcel(data, 0);
1804 } else {
1805 data.writeInt(0);
1806 }
1807 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1808 reply.readException();
1809 boolean res = reply.readInt() != 0;
1810 data.recycle();
1811 reply.recycle();
1812 return res;
1813 }
1814 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1815 {
1816 Parcel data = Parcel.obtain();
1817 Parcel reply = Parcel.obtain();
1818 data.writeInterfaceToken(IActivityManager.descriptor);
1819 data.writeStrongBinder(token);
1820 data.writeString(resultWho);
1821 data.writeInt(requestCode);
1822 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1823 reply.readException();
1824 data.recycle();
1825 reply.recycle();
1826 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001827 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1828 Parcel data = Parcel.obtain();
1829 Parcel reply = Parcel.obtain();
1830 data.writeInterfaceToken(IActivityManager.descriptor);
1831 data.writeStrongBinder(token);
1832 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1833 reply.readException();
1834 boolean res = reply.readInt() != 0;
1835 data.recycle();
1836 reply.recycle();
1837 return res;
1838 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001839 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001840 IIntentReceiver receiver,
1841 IntentFilter filter, String perm) throws RemoteException
1842 {
1843 Parcel data = Parcel.obtain();
1844 Parcel reply = Parcel.obtain();
1845 data.writeInterfaceToken(IActivityManager.descriptor);
1846 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001847 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001848 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1849 filter.writeToParcel(data, 0);
1850 data.writeString(perm);
1851 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1852 reply.readException();
1853 Intent intent = null;
1854 int haveIntent = reply.readInt();
1855 if (haveIntent != 0) {
1856 intent = Intent.CREATOR.createFromParcel(reply);
1857 }
1858 reply.recycle();
1859 data.recycle();
1860 return intent;
1861 }
1862 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1863 {
1864 Parcel data = Parcel.obtain();
1865 Parcel reply = Parcel.obtain();
1866 data.writeInterfaceToken(IActivityManager.descriptor);
1867 data.writeStrongBinder(receiver.asBinder());
1868 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1869 reply.readException();
1870 data.recycle();
1871 reply.recycle();
1872 }
1873 public int broadcastIntent(IApplicationThread caller,
1874 Intent intent, String resolvedType, IIntentReceiver resultTo,
1875 int resultCode, String resultData, Bundle map,
1876 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07001877 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001878 {
1879 Parcel data = Parcel.obtain();
1880 Parcel reply = Parcel.obtain();
1881 data.writeInterfaceToken(IActivityManager.descriptor);
1882 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1883 intent.writeToParcel(data, 0);
1884 data.writeString(resolvedType);
1885 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1886 data.writeInt(resultCode);
1887 data.writeString(resultData);
1888 data.writeBundle(map);
1889 data.writeString(requiredPermission);
1890 data.writeInt(serialized ? 1 : 0);
1891 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001892 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001893 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1894 reply.readException();
1895 int res = reply.readInt();
1896 reply.recycle();
1897 data.recycle();
1898 return res;
1899 }
Amith Yamasani742a6712011-05-04 14:49:28 -07001900 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
1901 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001902 {
1903 Parcel data = Parcel.obtain();
1904 Parcel reply = Parcel.obtain();
1905 data.writeInterfaceToken(IActivityManager.descriptor);
1906 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1907 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001908 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001909 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1910 reply.readException();
1911 data.recycle();
1912 reply.recycle();
1913 }
1914 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1915 {
1916 Parcel data = Parcel.obtain();
1917 Parcel reply = Parcel.obtain();
1918 data.writeInterfaceToken(IActivityManager.descriptor);
1919 data.writeStrongBinder(who);
1920 data.writeInt(resultCode);
1921 data.writeString(resultData);
1922 data.writeBundle(map);
1923 data.writeInt(abortBroadcast ? 1 : 0);
1924 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1925 reply.readException();
1926 data.recycle();
1927 reply.recycle();
1928 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001929 public void attachApplication(IApplicationThread app) throws RemoteException
1930 {
1931 Parcel data = Parcel.obtain();
1932 Parcel reply = Parcel.obtain();
1933 data.writeInterfaceToken(IActivityManager.descriptor);
1934 data.writeStrongBinder(app.asBinder());
1935 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1936 reply.readException();
1937 data.recycle();
1938 reply.recycle();
1939 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001940 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
1941 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001942 {
1943 Parcel data = Parcel.obtain();
1944 Parcel reply = Parcel.obtain();
1945 data.writeInterfaceToken(IActivityManager.descriptor);
1946 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001947 if (config != null) {
1948 data.writeInt(1);
1949 config.writeToParcel(data, 0);
1950 } else {
1951 data.writeInt(0);
1952 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001953 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001954 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1955 reply.readException();
1956 data.recycle();
1957 reply.recycle();
1958 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001959 public void activityPaused(IBinder token) throws RemoteException
1960 {
1961 Parcel data = Parcel.obtain();
1962 Parcel reply = Parcel.obtain();
1963 data.writeInterfaceToken(IActivityManager.descriptor);
1964 data.writeStrongBinder(token);
1965 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1966 reply.readException();
1967 data.recycle();
1968 reply.recycle();
1969 }
1970 public void activityStopped(IBinder token, Bundle state,
1971 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001972 {
1973 Parcel data = Parcel.obtain();
1974 Parcel reply = Parcel.obtain();
1975 data.writeInterfaceToken(IActivityManager.descriptor);
1976 data.writeStrongBinder(token);
1977 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001978 if (thumbnail != null) {
1979 data.writeInt(1);
1980 thumbnail.writeToParcel(data, 0);
1981 } else {
1982 data.writeInt(0);
1983 }
1984 TextUtils.writeToParcel(description, data, 0);
1985 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1986 reply.readException();
1987 data.recycle();
1988 reply.recycle();
1989 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001990 public void activitySlept(IBinder token) throws RemoteException
1991 {
1992 Parcel data = Parcel.obtain();
1993 Parcel reply = Parcel.obtain();
1994 data.writeInterfaceToken(IActivityManager.descriptor);
1995 data.writeStrongBinder(token);
1996 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1997 reply.readException();
1998 data.recycle();
1999 reply.recycle();
2000 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002001 public void activityDestroyed(IBinder token) throws RemoteException
2002 {
2003 Parcel data = Parcel.obtain();
2004 Parcel reply = Parcel.obtain();
2005 data.writeInterfaceToken(IActivityManager.descriptor);
2006 data.writeStrongBinder(token);
2007 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2008 reply.readException();
2009 data.recycle();
2010 reply.recycle();
2011 }
2012 public String getCallingPackage(IBinder token) throws RemoteException
2013 {
2014 Parcel data = Parcel.obtain();
2015 Parcel reply = Parcel.obtain();
2016 data.writeInterfaceToken(IActivityManager.descriptor);
2017 data.writeStrongBinder(token);
2018 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2019 reply.readException();
2020 String res = reply.readString();
2021 data.recycle();
2022 reply.recycle();
2023 return res;
2024 }
2025 public ComponentName getCallingActivity(IBinder token)
2026 throws RemoteException {
2027 Parcel data = Parcel.obtain();
2028 Parcel reply = Parcel.obtain();
2029 data.writeInterfaceToken(IActivityManager.descriptor);
2030 data.writeStrongBinder(token);
2031 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2032 reply.readException();
2033 ComponentName res = ComponentName.readFromParcel(reply);
2034 data.recycle();
2035 reply.recycle();
2036 return res;
2037 }
2038 public List getTasks(int maxNum, int flags,
2039 IThumbnailReceiver receiver) throws RemoteException {
2040 Parcel data = Parcel.obtain();
2041 Parcel reply = Parcel.obtain();
2042 data.writeInterfaceToken(IActivityManager.descriptor);
2043 data.writeInt(maxNum);
2044 data.writeInt(flags);
2045 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2046 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2047 reply.readException();
2048 ArrayList list = null;
2049 int N = reply.readInt();
2050 if (N >= 0) {
2051 list = new ArrayList();
2052 while (N > 0) {
2053 ActivityManager.RunningTaskInfo info =
2054 ActivityManager.RunningTaskInfo.CREATOR
2055 .createFromParcel(reply);
2056 list.add(info);
2057 N--;
2058 }
2059 }
2060 data.recycle();
2061 reply.recycle();
2062 return list;
2063 }
2064 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2065 int flags) throws RemoteException {
2066 Parcel data = Parcel.obtain();
2067 Parcel reply = Parcel.obtain();
2068 data.writeInterfaceToken(IActivityManager.descriptor);
2069 data.writeInt(maxNum);
2070 data.writeInt(flags);
2071 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2072 reply.readException();
2073 ArrayList<ActivityManager.RecentTaskInfo> list
2074 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2075 data.recycle();
2076 reply.recycle();
2077 return list;
2078 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002079 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002080 Parcel data = Parcel.obtain();
2081 Parcel reply = Parcel.obtain();
2082 data.writeInterfaceToken(IActivityManager.descriptor);
2083 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002084 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002085 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002086 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002087 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002088 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002089 }
2090 data.recycle();
2091 reply.recycle();
2092 return bm;
2093 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002094 public List getServices(int maxNum, int flags) throws RemoteException {
2095 Parcel data = Parcel.obtain();
2096 Parcel reply = Parcel.obtain();
2097 data.writeInterfaceToken(IActivityManager.descriptor);
2098 data.writeInt(maxNum);
2099 data.writeInt(flags);
2100 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2101 reply.readException();
2102 ArrayList list = null;
2103 int N = reply.readInt();
2104 if (N >= 0) {
2105 list = new ArrayList();
2106 while (N > 0) {
2107 ActivityManager.RunningServiceInfo info =
2108 ActivityManager.RunningServiceInfo.CREATOR
2109 .createFromParcel(reply);
2110 list.add(info);
2111 N--;
2112 }
2113 }
2114 data.recycle();
2115 reply.recycle();
2116 return list;
2117 }
2118 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2119 throws RemoteException {
2120 Parcel data = Parcel.obtain();
2121 Parcel reply = Parcel.obtain();
2122 data.writeInterfaceToken(IActivityManager.descriptor);
2123 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2124 reply.readException();
2125 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2126 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2127 data.recycle();
2128 reply.recycle();
2129 return list;
2130 }
2131 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2132 throws RemoteException {
2133 Parcel data = Parcel.obtain();
2134 Parcel reply = Parcel.obtain();
2135 data.writeInterfaceToken(IActivityManager.descriptor);
2136 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2137 reply.readException();
2138 ArrayList<ActivityManager.RunningAppProcessInfo> list
2139 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2140 data.recycle();
2141 reply.recycle();
2142 return list;
2143 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002144 public List<ApplicationInfo> getRunningExternalApplications()
2145 throws RemoteException {
2146 Parcel data = Parcel.obtain();
2147 Parcel reply = Parcel.obtain();
2148 data.writeInterfaceToken(IActivityManager.descriptor);
2149 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2150 reply.readException();
2151 ArrayList<ApplicationInfo> list
2152 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2153 data.recycle();
2154 reply.recycle();
2155 return list;
2156 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002157 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002158 {
2159 Parcel data = Parcel.obtain();
2160 Parcel reply = Parcel.obtain();
2161 data.writeInterfaceToken(IActivityManager.descriptor);
2162 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002163 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002164 if (options != null) {
2165 data.writeInt(1);
2166 options.writeToParcel(data, 0);
2167 } else {
2168 data.writeInt(0);
2169 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002170 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2171 reply.readException();
2172 data.recycle();
2173 reply.recycle();
2174 }
2175 public void moveTaskToBack(int task) throws RemoteException
2176 {
2177 Parcel data = Parcel.obtain();
2178 Parcel reply = Parcel.obtain();
2179 data.writeInterfaceToken(IActivityManager.descriptor);
2180 data.writeInt(task);
2181 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2182 reply.readException();
2183 data.recycle();
2184 reply.recycle();
2185 }
2186 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2187 throws RemoteException {
2188 Parcel data = Parcel.obtain();
2189 Parcel reply = Parcel.obtain();
2190 data.writeInterfaceToken(IActivityManager.descriptor);
2191 data.writeStrongBinder(token);
2192 data.writeInt(nonRoot ? 1 : 0);
2193 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2194 reply.readException();
2195 boolean res = reply.readInt() != 0;
2196 data.recycle();
2197 reply.recycle();
2198 return res;
2199 }
2200 public void moveTaskBackwards(int task) throws RemoteException
2201 {
2202 Parcel data = Parcel.obtain();
2203 Parcel reply = Parcel.obtain();
2204 data.writeInterfaceToken(IActivityManager.descriptor);
2205 data.writeInt(task);
2206 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2207 reply.readException();
2208 data.recycle();
2209 reply.recycle();
2210 }
2211 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2212 {
2213 Parcel data = Parcel.obtain();
2214 Parcel reply = Parcel.obtain();
2215 data.writeInterfaceToken(IActivityManager.descriptor);
2216 data.writeStrongBinder(token);
2217 data.writeInt(onlyRoot ? 1 : 0);
2218 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2219 reply.readException();
2220 int res = reply.readInt();
2221 data.recycle();
2222 reply.recycle();
2223 return res;
2224 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002225 public void reportThumbnail(IBinder token,
2226 Bitmap thumbnail, CharSequence description) throws RemoteException
2227 {
2228 Parcel data = Parcel.obtain();
2229 Parcel reply = Parcel.obtain();
2230 data.writeInterfaceToken(IActivityManager.descriptor);
2231 data.writeStrongBinder(token);
2232 if (thumbnail != null) {
2233 data.writeInt(1);
2234 thumbnail.writeToParcel(data, 0);
2235 } else {
2236 data.writeInt(0);
2237 }
2238 TextUtils.writeToParcel(description, data, 0);
2239 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2240 reply.readException();
2241 data.recycle();
2242 reply.recycle();
2243 }
2244 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2245 String name) throws RemoteException
2246 {
2247 Parcel data = Parcel.obtain();
2248 Parcel reply = Parcel.obtain();
2249 data.writeInterfaceToken(IActivityManager.descriptor);
2250 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2251 data.writeString(name);
2252 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2253 reply.readException();
2254 int res = reply.readInt();
2255 ContentProviderHolder cph = null;
2256 if (res != 0) {
2257 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2258 }
2259 data.recycle();
2260 reply.recycle();
2261 return cph;
2262 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002263 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2264 throws RemoteException
2265 {
2266 Parcel data = Parcel.obtain();
2267 Parcel reply = Parcel.obtain();
2268 data.writeInterfaceToken(IActivityManager.descriptor);
2269 data.writeString(name);
2270 data.writeStrongBinder(token);
2271 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2272 reply.readException();
2273 int res = reply.readInt();
2274 ContentProviderHolder cph = null;
2275 if (res != 0) {
2276 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2277 }
2278 data.recycle();
2279 reply.recycle();
2280 return cph;
2281 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002282 public void publishContentProviders(IApplicationThread caller,
2283 List<ContentProviderHolder> providers) throws RemoteException
2284 {
2285 Parcel data = Parcel.obtain();
2286 Parcel reply = Parcel.obtain();
2287 data.writeInterfaceToken(IActivityManager.descriptor);
2288 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2289 data.writeTypedList(providers);
2290 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2291 reply.readException();
2292 data.recycle();
2293 reply.recycle();
2294 }
2295
2296 public void removeContentProvider(IApplicationThread caller,
2297 String name) throws RemoteException {
2298 Parcel data = Parcel.obtain();
2299 Parcel reply = Parcel.obtain();
2300 data.writeInterfaceToken(IActivityManager.descriptor);
2301 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2302 data.writeString(name);
2303 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2304 reply.readException();
2305 data.recycle();
2306 reply.recycle();
2307 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002308
2309 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2310 Parcel data = Parcel.obtain();
2311 Parcel reply = Parcel.obtain();
2312 data.writeInterfaceToken(IActivityManager.descriptor);
2313 data.writeString(name);
2314 data.writeStrongBinder(token);
2315 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2316 reply.readException();
2317 data.recycle();
2318 reply.recycle();
2319 }
2320
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002321 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2322 throws RemoteException
2323 {
2324 Parcel data = Parcel.obtain();
2325 Parcel reply = Parcel.obtain();
2326 data.writeInterfaceToken(IActivityManager.descriptor);
2327 service.writeToParcel(data, 0);
2328 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2329 reply.readException();
2330 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2331 data.recycle();
2332 reply.recycle();
2333 return res;
2334 }
2335
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002336 public ComponentName startService(IApplicationThread caller, Intent service,
2337 String resolvedType) throws RemoteException
2338 {
2339 Parcel data = Parcel.obtain();
2340 Parcel reply = Parcel.obtain();
2341 data.writeInterfaceToken(IActivityManager.descriptor);
2342 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2343 service.writeToParcel(data, 0);
2344 data.writeString(resolvedType);
2345 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2346 reply.readException();
2347 ComponentName res = ComponentName.readFromParcel(reply);
2348 data.recycle();
2349 reply.recycle();
2350 return res;
2351 }
2352 public int stopService(IApplicationThread caller, Intent service,
2353 String resolvedType) throws RemoteException
2354 {
2355 Parcel data = Parcel.obtain();
2356 Parcel reply = Parcel.obtain();
2357 data.writeInterfaceToken(IActivityManager.descriptor);
2358 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2359 service.writeToParcel(data, 0);
2360 data.writeString(resolvedType);
2361 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2362 reply.readException();
2363 int res = reply.readInt();
2364 reply.recycle();
2365 data.recycle();
2366 return res;
2367 }
2368 public boolean stopServiceToken(ComponentName className, IBinder token,
2369 int startId) throws RemoteException {
2370 Parcel data = Parcel.obtain();
2371 Parcel reply = Parcel.obtain();
2372 data.writeInterfaceToken(IActivityManager.descriptor);
2373 ComponentName.writeToParcel(className, data);
2374 data.writeStrongBinder(token);
2375 data.writeInt(startId);
2376 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2377 reply.readException();
2378 boolean res = reply.readInt() != 0;
2379 data.recycle();
2380 reply.recycle();
2381 return res;
2382 }
2383 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002384 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002385 Parcel data = Parcel.obtain();
2386 Parcel reply = Parcel.obtain();
2387 data.writeInterfaceToken(IActivityManager.descriptor);
2388 ComponentName.writeToParcel(className, data);
2389 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002390 data.writeInt(id);
2391 if (notification != null) {
2392 data.writeInt(1);
2393 notification.writeToParcel(data, 0);
2394 } else {
2395 data.writeInt(0);
2396 }
2397 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002398 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2399 reply.readException();
2400 data.recycle();
2401 reply.recycle();
2402 }
2403 public int bindService(IApplicationThread caller, IBinder token,
2404 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002405 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002406 Parcel data = Parcel.obtain();
2407 Parcel reply = Parcel.obtain();
2408 data.writeInterfaceToken(IActivityManager.descriptor);
2409 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2410 data.writeStrongBinder(token);
2411 service.writeToParcel(data, 0);
2412 data.writeString(resolvedType);
2413 data.writeStrongBinder(connection.asBinder());
2414 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002415 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002416 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2417 reply.readException();
2418 int res = reply.readInt();
2419 data.recycle();
2420 reply.recycle();
2421 return res;
2422 }
2423 public boolean unbindService(IServiceConnection connection) throws RemoteException
2424 {
2425 Parcel data = Parcel.obtain();
2426 Parcel reply = Parcel.obtain();
2427 data.writeInterfaceToken(IActivityManager.descriptor);
2428 data.writeStrongBinder(connection.asBinder());
2429 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2430 reply.readException();
2431 boolean res = reply.readInt() != 0;
2432 data.recycle();
2433 reply.recycle();
2434 return res;
2435 }
2436
2437 public void publishService(IBinder token,
2438 Intent intent, IBinder service) throws RemoteException {
2439 Parcel data = Parcel.obtain();
2440 Parcel reply = Parcel.obtain();
2441 data.writeInterfaceToken(IActivityManager.descriptor);
2442 data.writeStrongBinder(token);
2443 intent.writeToParcel(data, 0);
2444 data.writeStrongBinder(service);
2445 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2446 reply.readException();
2447 data.recycle();
2448 reply.recycle();
2449 }
2450
2451 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2452 throws RemoteException {
2453 Parcel data = Parcel.obtain();
2454 Parcel reply = Parcel.obtain();
2455 data.writeInterfaceToken(IActivityManager.descriptor);
2456 data.writeStrongBinder(token);
2457 intent.writeToParcel(data, 0);
2458 data.writeInt(doRebind ? 1 : 0);
2459 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2460 reply.readException();
2461 data.recycle();
2462 reply.recycle();
2463 }
2464
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002465 public void serviceDoneExecuting(IBinder token, int type, int startId,
2466 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002467 Parcel data = Parcel.obtain();
2468 Parcel reply = Parcel.obtain();
2469 data.writeInterfaceToken(IActivityManager.descriptor);
2470 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002471 data.writeInt(type);
2472 data.writeInt(startId);
2473 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002474 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2475 reply.readException();
2476 data.recycle();
2477 reply.recycle();
2478 }
2479
2480 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2481 Parcel data = Parcel.obtain();
2482 Parcel reply = Parcel.obtain();
2483 data.writeInterfaceToken(IActivityManager.descriptor);
2484 service.writeToParcel(data, 0);
2485 data.writeString(resolvedType);
2486 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2487 reply.readException();
2488 IBinder binder = reply.readStrongBinder();
2489 reply.recycle();
2490 data.recycle();
2491 return binder;
2492 }
2493
Christopher Tate181fafa2009-05-14 11:12:14 -07002494 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2495 throws RemoteException {
2496 Parcel data = Parcel.obtain();
2497 Parcel reply = Parcel.obtain();
2498 data.writeInterfaceToken(IActivityManager.descriptor);
2499 app.writeToParcel(data, 0);
2500 data.writeInt(backupRestoreMode);
2501 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2502 reply.readException();
2503 boolean success = reply.readInt() != 0;
2504 reply.recycle();
2505 data.recycle();
2506 return success;
2507 }
2508
2509 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2510 Parcel data = Parcel.obtain();
2511 Parcel reply = Parcel.obtain();
2512 data.writeInterfaceToken(IActivityManager.descriptor);
2513 data.writeString(packageName);
2514 data.writeStrongBinder(agent);
2515 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2516 reply.recycle();
2517 data.recycle();
2518 }
2519
2520 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2521 Parcel data = Parcel.obtain();
2522 Parcel reply = Parcel.obtain();
2523 data.writeInterfaceToken(IActivityManager.descriptor);
2524 app.writeToParcel(data, 0);
2525 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2526 reply.readException();
2527 reply.recycle();
2528 data.recycle();
2529 }
2530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002531 public boolean startInstrumentation(ComponentName className, String profileFile,
2532 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2533 throws RemoteException {
2534 Parcel data = Parcel.obtain();
2535 Parcel reply = Parcel.obtain();
2536 data.writeInterfaceToken(IActivityManager.descriptor);
2537 ComponentName.writeToParcel(className, data);
2538 data.writeString(profileFile);
2539 data.writeInt(flags);
2540 data.writeBundle(arguments);
2541 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2542 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2543 reply.readException();
2544 boolean res = reply.readInt() != 0;
2545 reply.recycle();
2546 data.recycle();
2547 return res;
2548 }
2549
2550 public void finishInstrumentation(IApplicationThread target,
2551 int resultCode, Bundle results) throws RemoteException {
2552 Parcel data = Parcel.obtain();
2553 Parcel reply = Parcel.obtain();
2554 data.writeInterfaceToken(IActivityManager.descriptor);
2555 data.writeStrongBinder(target != null ? target.asBinder() : null);
2556 data.writeInt(resultCode);
2557 data.writeBundle(results);
2558 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2559 reply.readException();
2560 data.recycle();
2561 reply.recycle();
2562 }
2563 public Configuration getConfiguration() throws RemoteException
2564 {
2565 Parcel data = Parcel.obtain();
2566 Parcel reply = Parcel.obtain();
2567 data.writeInterfaceToken(IActivityManager.descriptor);
2568 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2569 reply.readException();
2570 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2571 reply.recycle();
2572 data.recycle();
2573 return res;
2574 }
2575 public void updateConfiguration(Configuration values) throws RemoteException
2576 {
2577 Parcel data = Parcel.obtain();
2578 Parcel reply = Parcel.obtain();
2579 data.writeInterfaceToken(IActivityManager.descriptor);
2580 values.writeToParcel(data, 0);
2581 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2582 reply.readException();
2583 data.recycle();
2584 reply.recycle();
2585 }
2586 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2587 throws RemoteException {
2588 Parcel data = Parcel.obtain();
2589 Parcel reply = Parcel.obtain();
2590 data.writeInterfaceToken(IActivityManager.descriptor);
2591 data.writeStrongBinder(token);
2592 data.writeInt(requestedOrientation);
2593 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2594 reply.readException();
2595 data.recycle();
2596 reply.recycle();
2597 }
2598 public int getRequestedOrientation(IBinder token) throws RemoteException {
2599 Parcel data = Parcel.obtain();
2600 Parcel reply = Parcel.obtain();
2601 data.writeInterfaceToken(IActivityManager.descriptor);
2602 data.writeStrongBinder(token);
2603 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2604 reply.readException();
2605 int res = reply.readInt();
2606 data.recycle();
2607 reply.recycle();
2608 return res;
2609 }
2610 public ComponentName getActivityClassForToken(IBinder token)
2611 throws RemoteException {
2612 Parcel data = Parcel.obtain();
2613 Parcel reply = Parcel.obtain();
2614 data.writeInterfaceToken(IActivityManager.descriptor);
2615 data.writeStrongBinder(token);
2616 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2617 reply.readException();
2618 ComponentName res = ComponentName.readFromParcel(reply);
2619 data.recycle();
2620 reply.recycle();
2621 return res;
2622 }
2623 public String getPackageForToken(IBinder token) throws RemoteException
2624 {
2625 Parcel data = Parcel.obtain();
2626 Parcel reply = Parcel.obtain();
2627 data.writeInterfaceToken(IActivityManager.descriptor);
2628 data.writeStrongBinder(token);
2629 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2630 reply.readException();
2631 String res = reply.readString();
2632 data.recycle();
2633 reply.recycle();
2634 return res;
2635 }
2636 public IIntentSender getIntentSender(int type,
2637 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002638 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
2639 Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 Parcel data = Parcel.obtain();
2641 Parcel reply = Parcel.obtain();
2642 data.writeInterfaceToken(IActivityManager.descriptor);
2643 data.writeInt(type);
2644 data.writeString(packageName);
2645 data.writeStrongBinder(token);
2646 data.writeString(resultWho);
2647 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002648 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002649 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002650 data.writeTypedArray(intents, 0);
2651 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002652 } else {
2653 data.writeInt(0);
2654 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002656 if (options != null) {
2657 data.writeInt(1);
2658 options.writeToParcel(data, 0);
2659 } else {
2660 data.writeInt(0);
2661 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002662 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2663 reply.readException();
2664 IIntentSender res = IIntentSender.Stub.asInterface(
2665 reply.readStrongBinder());
2666 data.recycle();
2667 reply.recycle();
2668 return res;
2669 }
2670 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2671 Parcel data = Parcel.obtain();
2672 Parcel reply = Parcel.obtain();
2673 data.writeInterfaceToken(IActivityManager.descriptor);
2674 data.writeStrongBinder(sender.asBinder());
2675 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2676 reply.readException();
2677 data.recycle();
2678 reply.recycle();
2679 }
2680 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2681 Parcel data = Parcel.obtain();
2682 Parcel reply = Parcel.obtain();
2683 data.writeInterfaceToken(IActivityManager.descriptor);
2684 data.writeStrongBinder(sender.asBinder());
2685 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2686 reply.readException();
2687 String res = reply.readString();
2688 data.recycle();
2689 reply.recycle();
2690 return res;
2691 }
2692 public void setProcessLimit(int max) throws RemoteException
2693 {
2694 Parcel data = Parcel.obtain();
2695 Parcel reply = Parcel.obtain();
2696 data.writeInterfaceToken(IActivityManager.descriptor);
2697 data.writeInt(max);
2698 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2699 reply.readException();
2700 data.recycle();
2701 reply.recycle();
2702 }
2703 public int getProcessLimit() throws RemoteException
2704 {
2705 Parcel data = Parcel.obtain();
2706 Parcel reply = Parcel.obtain();
2707 data.writeInterfaceToken(IActivityManager.descriptor);
2708 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2709 reply.readException();
2710 int res = reply.readInt();
2711 data.recycle();
2712 reply.recycle();
2713 return res;
2714 }
2715 public void setProcessForeground(IBinder token, int pid,
2716 boolean isForeground) throws RemoteException {
2717 Parcel data = Parcel.obtain();
2718 Parcel reply = Parcel.obtain();
2719 data.writeInterfaceToken(IActivityManager.descriptor);
2720 data.writeStrongBinder(token);
2721 data.writeInt(pid);
2722 data.writeInt(isForeground ? 1 : 0);
2723 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2724 reply.readException();
2725 data.recycle();
2726 reply.recycle();
2727 }
2728 public int checkPermission(String permission, int pid, int uid)
2729 throws RemoteException {
2730 Parcel data = Parcel.obtain();
2731 Parcel reply = Parcel.obtain();
2732 data.writeInterfaceToken(IActivityManager.descriptor);
2733 data.writeString(permission);
2734 data.writeInt(pid);
2735 data.writeInt(uid);
2736 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2737 reply.readException();
2738 int res = reply.readInt();
2739 data.recycle();
2740 reply.recycle();
2741 return res;
2742 }
2743 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002744 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002745 Parcel data = Parcel.obtain();
2746 Parcel reply = Parcel.obtain();
2747 data.writeInterfaceToken(IActivityManager.descriptor);
2748 data.writeString(packageName);
2749 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002750 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002751 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2752 reply.readException();
2753 boolean res = reply.readInt() != 0;
2754 data.recycle();
2755 reply.recycle();
2756 return res;
2757 }
2758 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2759 throws RemoteException {
2760 Parcel data = Parcel.obtain();
2761 Parcel reply = Parcel.obtain();
2762 data.writeInterfaceToken(IActivityManager.descriptor);
2763 uri.writeToParcel(data, 0);
2764 data.writeInt(pid);
2765 data.writeInt(uid);
2766 data.writeInt(mode);
2767 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2768 reply.readException();
2769 int res = reply.readInt();
2770 data.recycle();
2771 reply.recycle();
2772 return res;
2773 }
2774 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2775 Uri uri, int mode) throws RemoteException {
2776 Parcel data = Parcel.obtain();
2777 Parcel reply = Parcel.obtain();
2778 data.writeInterfaceToken(IActivityManager.descriptor);
2779 data.writeStrongBinder(caller.asBinder());
2780 data.writeString(targetPkg);
2781 uri.writeToParcel(data, 0);
2782 data.writeInt(mode);
2783 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2784 reply.readException();
2785 data.recycle();
2786 reply.recycle();
2787 }
2788 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2789 int mode) throws RemoteException {
2790 Parcel data = Parcel.obtain();
2791 Parcel reply = Parcel.obtain();
2792 data.writeInterfaceToken(IActivityManager.descriptor);
2793 data.writeStrongBinder(caller.asBinder());
2794 uri.writeToParcel(data, 0);
2795 data.writeInt(mode);
2796 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2797 reply.readException();
2798 data.recycle();
2799 reply.recycle();
2800 }
2801 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2802 throws RemoteException {
2803 Parcel data = Parcel.obtain();
2804 Parcel reply = Parcel.obtain();
2805 data.writeInterfaceToken(IActivityManager.descriptor);
2806 data.writeStrongBinder(who.asBinder());
2807 data.writeInt(waiting ? 1 : 0);
2808 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2809 reply.readException();
2810 data.recycle();
2811 reply.recycle();
2812 }
2813 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2814 Parcel data = Parcel.obtain();
2815 Parcel reply = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2818 reply.readException();
2819 outInfo.readFromParcel(reply);
2820 data.recycle();
2821 reply.recycle();
2822 }
2823 public void unhandledBack() throws RemoteException
2824 {
2825 Parcel data = Parcel.obtain();
2826 Parcel reply = Parcel.obtain();
2827 data.writeInterfaceToken(IActivityManager.descriptor);
2828 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2829 reply.readException();
2830 data.recycle();
2831 reply.recycle();
2832 }
2833 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2834 {
2835 Parcel data = Parcel.obtain();
2836 Parcel reply = Parcel.obtain();
2837 data.writeInterfaceToken(IActivityManager.descriptor);
2838 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2839 reply.readException();
2840 ParcelFileDescriptor pfd = null;
2841 if (reply.readInt() != 0) {
2842 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2843 }
2844 data.recycle();
2845 reply.recycle();
2846 return pfd;
2847 }
2848 public void goingToSleep() throws RemoteException
2849 {
2850 Parcel data = Parcel.obtain();
2851 Parcel reply = Parcel.obtain();
2852 data.writeInterfaceToken(IActivityManager.descriptor);
2853 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2854 reply.readException();
2855 data.recycle();
2856 reply.recycle();
2857 }
2858 public void wakingUp() throws RemoteException
2859 {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2864 reply.readException();
2865 data.recycle();
2866 reply.recycle();
2867 }
2868 public void setDebugApp(
2869 String packageName, boolean waitForDebugger, boolean persistent)
2870 throws RemoteException
2871 {
2872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeString(packageName);
2876 data.writeInt(waitForDebugger ? 1 : 0);
2877 data.writeInt(persistent ? 1 : 0);
2878 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2879 reply.readException();
2880 data.recycle();
2881 reply.recycle();
2882 }
2883 public void setAlwaysFinish(boolean enabled) throws RemoteException
2884 {
2885 Parcel data = Parcel.obtain();
2886 Parcel reply = Parcel.obtain();
2887 data.writeInterfaceToken(IActivityManager.descriptor);
2888 data.writeInt(enabled ? 1 : 0);
2889 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2890 reply.readException();
2891 data.recycle();
2892 reply.recycle();
2893 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002894 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002895 {
2896 Parcel data = Parcel.obtain();
2897 Parcel reply = Parcel.obtain();
2898 data.writeInterfaceToken(IActivityManager.descriptor);
2899 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002900 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002901 reply.readException();
2902 data.recycle();
2903 reply.recycle();
2904 }
2905 public void enterSafeMode() throws RemoteException {
2906 Parcel data = Parcel.obtain();
2907 data.writeInterfaceToken(IActivityManager.descriptor);
2908 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2909 data.recycle();
2910 }
2911 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2912 Parcel data = Parcel.obtain();
2913 data.writeStrongBinder(sender.asBinder());
2914 data.writeInterfaceToken(IActivityManager.descriptor);
2915 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2916 data.recycle();
2917 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002918 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002919 Parcel data = Parcel.obtain();
2920 Parcel reply = Parcel.obtain();
2921 data.writeInterfaceToken(IActivityManager.descriptor);
2922 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002923 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002924 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002925 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002926 boolean res = reply.readInt() != 0;
2927 data.recycle();
2928 reply.recycle();
2929 return res;
2930 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07002931 @Override
2932 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
2933 Parcel data = Parcel.obtain();
2934 Parcel reply = Parcel.obtain();
2935 data.writeInterfaceToken(IActivityManager.descriptor);
2936 data.writeString(reason);
2937 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
2938 boolean res = reply.readInt() != 0;
2939 data.recycle();
2940 reply.recycle();
2941 return res;
2942 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 public void startRunning(String pkg, String cls, String action,
2944 String indata) throws RemoteException {
2945 Parcel data = Parcel.obtain();
2946 Parcel reply = Parcel.obtain();
2947 data.writeInterfaceToken(IActivityManager.descriptor);
2948 data.writeString(pkg);
2949 data.writeString(cls);
2950 data.writeString(action);
2951 data.writeString(indata);
2952 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2953 reply.readException();
2954 data.recycle();
2955 reply.recycle();
2956 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002957 public boolean testIsSystemReady()
2958 {
2959 /* this base class version is never called */
2960 return true;
2961 }
Dan Egnor60d87622009-12-16 16:32:58 -08002962 public void handleApplicationCrash(IBinder app,
2963 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2964 {
2965 Parcel data = Parcel.obtain();
2966 Parcel reply = Parcel.obtain();
2967 data.writeInterfaceToken(IActivityManager.descriptor);
2968 data.writeStrongBinder(app);
2969 crashInfo.writeToParcel(data, 0);
2970 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2971 reply.readException();
2972 reply.recycle();
2973 data.recycle();
2974 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002975
Dan Egnor60d87622009-12-16 16:32:58 -08002976 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002977 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002978 {
2979 Parcel data = Parcel.obtain();
2980 Parcel reply = Parcel.obtain();
2981 data.writeInterfaceToken(IActivityManager.descriptor);
2982 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002983 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002984 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002985 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002986 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002987 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002988 reply.recycle();
2989 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002990 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002991 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002992
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002993 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002994 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002995 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002996 {
2997 Parcel data = Parcel.obtain();
2998 Parcel reply = Parcel.obtain();
2999 data.writeInterfaceToken(IActivityManager.descriptor);
3000 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003001 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003002 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003003 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3004 reply.readException();
3005 reply.recycle();
3006 data.recycle();
3007 }
3008
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003009 public void signalPersistentProcesses(int sig) throws RemoteException {
3010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
3013 data.writeInt(sig);
3014 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3015 reply.readException();
3016 data.recycle();
3017 reply.recycle();
3018 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003019
Dianne Hackborn03abb812010-01-04 18:43:19 -08003020 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003025 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3026 reply.readException();
3027 data.recycle();
3028 reply.recycle();
3029 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003030
3031 public void killAllBackgroundProcesses() throws RemoteException {
3032 Parcel data = Parcel.obtain();
3033 Parcel reply = Parcel.obtain();
3034 data.writeInterfaceToken(IActivityManager.descriptor);
3035 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3036 reply.readException();
3037 data.recycle();
3038 reply.recycle();
3039 }
3040
Dianne Hackborn03abb812010-01-04 18:43:19 -08003041 public void forceStopPackage(String packageName) throws RemoteException {
3042 Parcel data = Parcel.obtain();
3043 Parcel reply = Parcel.obtain();
3044 data.writeInterfaceToken(IActivityManager.descriptor);
3045 data.writeString(packageName);
3046 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003047 reply.readException();
3048 data.recycle();
3049 reply.recycle();
3050 }
3051
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003052 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3053 throws RemoteException
3054 {
3055 Parcel data = Parcel.obtain();
3056 Parcel reply = Parcel.obtain();
3057 data.writeInterfaceToken(IActivityManager.descriptor);
3058 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3059 reply.readException();
3060 outInfo.readFromParcel(reply);
3061 reply.recycle();
3062 data.recycle();
3063 }
3064
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003065 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3066 {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3073 reply.recycle();
3074 data.recycle();
3075 return res;
3076 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003077
3078 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003079 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003080 {
3081 Parcel data = Parcel.obtain();
3082 Parcel reply = Parcel.obtain();
3083 data.writeInterfaceToken(IActivityManager.descriptor);
3084 data.writeString(process);
3085 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003086 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003087 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003088 if (fd != null) {
3089 data.writeInt(1);
3090 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3091 } else {
3092 data.writeInt(0);
3093 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003094 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3095 reply.readException();
3096 boolean res = reply.readInt() != 0;
3097 reply.recycle();
3098 data.recycle();
3099 return res;
3100 }
3101
Dianne Hackborn55280a92009-05-07 15:53:46 -07003102 public boolean shutdown(int timeout) throws RemoteException
3103 {
3104 Parcel data = Parcel.obtain();
3105 Parcel reply = Parcel.obtain();
3106 data.writeInterfaceToken(IActivityManager.descriptor);
3107 data.writeInt(timeout);
3108 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3109 reply.readException();
3110 boolean res = reply.readInt() != 0;
3111 reply.recycle();
3112 data.recycle();
3113 return res;
3114 }
3115
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003116 public void stopAppSwitches() throws RemoteException {
3117 Parcel data = Parcel.obtain();
3118 Parcel reply = Parcel.obtain();
3119 data.writeInterfaceToken(IActivityManager.descriptor);
3120 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3121 reply.readException();
3122 reply.recycle();
3123 data.recycle();
3124 }
3125
3126 public void resumeAppSwitches() throws RemoteException {
3127 Parcel data = Parcel.obtain();
3128 Parcel reply = Parcel.obtain();
3129 data.writeInterfaceToken(IActivityManager.descriptor);
3130 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3131 reply.readException();
3132 reply.recycle();
3133 data.recycle();
3134 }
3135
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003136 public int startActivityInPackage(int uid,
3137 Intent intent, String resolvedType, IBinder resultTo,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003138 String resultWho, int requestCode, int startFlags, Bundle options)
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003139 throws RemoteException {
3140 Parcel data = Parcel.obtain();
3141 Parcel reply = Parcel.obtain();
3142 data.writeInterfaceToken(IActivityManager.descriptor);
3143 data.writeInt(uid);
3144 intent.writeToParcel(data, 0);
3145 data.writeString(resolvedType);
3146 data.writeStrongBinder(resultTo);
3147 data.writeString(resultWho);
3148 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003149 data.writeInt(startFlags);
3150 if (options != null) {
3151 data.writeInt(1);
3152 options.writeToParcel(data, 0);
3153 } else {
3154 data.writeInt(0);
3155 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003156 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3157 reply.readException();
3158 int result = reply.readInt();
3159 reply.recycle();
3160 data.recycle();
3161 return result;
3162 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003163
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003164 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 data.writeString(pkg);
3169 data.writeInt(uid);
3170 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3171 reply.readException();
3172 data.recycle();
3173 reply.recycle();
3174 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003175
3176 public void closeSystemDialogs(String reason) throws RemoteException {
3177 Parcel data = Parcel.obtain();
3178 Parcel reply = Parcel.obtain();
3179 data.writeInterfaceToken(IActivityManager.descriptor);
3180 data.writeString(reason);
3181 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3182 reply.readException();
3183 data.recycle();
3184 reply.recycle();
3185 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003186
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003187 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003188 throws RemoteException {
3189 Parcel data = Parcel.obtain();
3190 Parcel reply = Parcel.obtain();
3191 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003192 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003193 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3194 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003195 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003196 data.recycle();
3197 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003198 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003199 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003200
3201 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3202 Parcel data = Parcel.obtain();
3203 Parcel reply = Parcel.obtain();
3204 data.writeInterfaceToken(IActivityManager.descriptor);
3205 data.writeString(processName);
3206 data.writeInt(uid);
3207 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3208 reply.readException();
3209 data.recycle();
3210 reply.recycle();
3211 }
3212
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003213 public void overridePendingTransition(IBinder token, String packageName,
3214 int enterAnim, int exitAnim) throws RemoteException {
3215 Parcel data = Parcel.obtain();
3216 Parcel reply = Parcel.obtain();
3217 data.writeInterfaceToken(IActivityManager.descriptor);
3218 data.writeStrongBinder(token);
3219 data.writeString(packageName);
3220 data.writeInt(enterAnim);
3221 data.writeInt(exitAnim);
3222 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3223 reply.readException();
3224 data.recycle();
3225 reply.recycle();
3226 }
3227
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003228 public boolean isUserAMonkey() throws RemoteException {
3229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3233 reply.readException();
3234 boolean res = reply.readInt() != 0;
3235 data.recycle();
3236 reply.recycle();
3237 return res;
3238 }
3239
Dianne Hackborn860755f2010-06-03 18:47:52 -07003240 public void finishHeavyWeightApp() throws RemoteException {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3245 reply.readException();
3246 data.recycle();
3247 reply.recycle();
3248 }
3249
Daniel Sandler69a48172010-06-23 16:29:36 -04003250 public void setImmersive(IBinder token, boolean immersive)
3251 throws RemoteException {
3252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 data.writeStrongBinder(token);
3256 data.writeInt(immersive ? 1 : 0);
3257 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3258 reply.readException();
3259 data.recycle();
3260 reply.recycle();
3261 }
3262
3263 public boolean isImmersive(IBinder token)
3264 throws RemoteException {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 data.writeStrongBinder(token);
3269 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003270 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003271 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003272 data.recycle();
3273 reply.recycle();
3274 return res;
3275 }
3276
3277 public boolean isTopActivityImmersive()
3278 throws RemoteException {
3279 Parcel data = Parcel.obtain();
3280 Parcel reply = Parcel.obtain();
3281 data.writeInterfaceToken(IActivityManager.descriptor);
3282 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003283 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003284 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003285 data.recycle();
3286 reply.recycle();
3287 return res;
3288 }
3289
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003290 public void crashApplication(int uid, int initialPid, String packageName,
3291 String message) throws RemoteException {
3292 Parcel data = Parcel.obtain();
3293 Parcel reply = Parcel.obtain();
3294 data.writeInterfaceToken(IActivityManager.descriptor);
3295 data.writeInt(uid);
3296 data.writeInt(initialPid);
3297 data.writeString(packageName);
3298 data.writeString(message);
3299 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3300 reply.readException();
3301 data.recycle();
3302 reply.recycle();
3303 }
Andy McFadden824c5102010-07-09 16:26:57 -07003304
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003305 public String getProviderMimeType(Uri uri)
3306 throws RemoteException {
3307 Parcel data = Parcel.obtain();
3308 Parcel reply = Parcel.obtain();
3309 data.writeInterfaceToken(IActivityManager.descriptor);
3310 uri.writeToParcel(data, 0);
3311 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3312 reply.readException();
3313 String res = reply.readString();
3314 data.recycle();
3315 reply.recycle();
3316 return res;
3317 }
3318
Dianne Hackborn7e269642010-08-25 19:50:20 -07003319 public IBinder newUriPermissionOwner(String name)
3320 throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 data.writeString(name);
3325 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3326 reply.readException();
3327 IBinder res = reply.readStrongBinder();
3328 data.recycle();
3329 reply.recycle();
3330 return res;
3331 }
3332
3333 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3334 Uri uri, int mode) throws RemoteException {
3335 Parcel data = Parcel.obtain();
3336 Parcel reply = Parcel.obtain();
3337 data.writeInterfaceToken(IActivityManager.descriptor);
3338 data.writeStrongBinder(owner);
3339 data.writeInt(fromUid);
3340 data.writeString(targetPkg);
3341 uri.writeToParcel(data, 0);
3342 data.writeInt(mode);
3343 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3344 reply.readException();
3345 data.recycle();
3346 reply.recycle();
3347 }
3348
3349 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3350 int mode) throws RemoteException {
3351 Parcel data = Parcel.obtain();
3352 Parcel reply = Parcel.obtain();
3353 data.writeInterfaceToken(IActivityManager.descriptor);
3354 data.writeStrongBinder(owner);
3355 if (uri != null) {
3356 data.writeInt(1);
3357 uri.writeToParcel(data, 0);
3358 } else {
3359 data.writeInt(0);
3360 }
3361 data.writeInt(mode);
3362 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 data.recycle();
3365 reply.recycle();
3366 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003367
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003368 public int checkGrantUriPermission(int callingUid, String targetPkg,
3369 Uri uri, int modeFlags) throws RemoteException {
3370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
3372 data.writeInterfaceToken(IActivityManager.descriptor);
3373 data.writeInt(callingUid);
3374 data.writeString(targetPkg);
3375 uri.writeToParcel(data, 0);
3376 data.writeInt(modeFlags);
3377 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3378 reply.readException();
3379 int res = reply.readInt();
3380 data.recycle();
3381 reply.recycle();
3382 return res;
3383 }
3384
Andy McFadden824c5102010-07-09 16:26:57 -07003385 public boolean dumpHeap(String process, boolean managed,
3386 String path, ParcelFileDescriptor fd) throws RemoteException {
3387 Parcel data = Parcel.obtain();
3388 Parcel reply = Parcel.obtain();
3389 data.writeInterfaceToken(IActivityManager.descriptor);
3390 data.writeString(process);
3391 data.writeInt(managed ? 1 : 0);
3392 data.writeString(path);
3393 if (fd != null) {
3394 data.writeInt(1);
3395 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3396 } else {
3397 data.writeInt(0);
3398 }
3399 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3400 reply.readException();
3401 boolean res = reply.readInt() != 0;
3402 reply.recycle();
3403 data.recycle();
3404 return res;
3405 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003406
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003407 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003408 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3409 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3414 data.writeTypedArray(intents, 0);
3415 data.writeStringArray(resolvedTypes);
3416 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003417 if (options != null) {
3418 data.writeInt(1);
3419 options.writeToParcel(data, 0);
3420 } else {
3421 data.writeInt(0);
3422 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003423 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3424 reply.readException();
3425 int result = reply.readInt();
3426 reply.recycle();
3427 data.recycle();
3428 return result;
3429 }
3430
3431 public int startActivitiesInPackage(int uid,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003432 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3433 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003434 Parcel data = Parcel.obtain();
3435 Parcel reply = Parcel.obtain();
3436 data.writeInterfaceToken(IActivityManager.descriptor);
3437 data.writeInt(uid);
3438 data.writeTypedArray(intents, 0);
3439 data.writeStringArray(resolvedTypes);
3440 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003441 if (options != null) {
3442 data.writeInt(1);
3443 options.writeToParcel(data, 0);
3444 } else {
3445 data.writeInt(0);
3446 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003447 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3448 reply.readException();
3449 int result = reply.readInt();
3450 reply.recycle();
3451 data.recycle();
3452 return result;
3453 }
3454
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003455 public int getFrontActivityScreenCompatMode() throws RemoteException {
3456 Parcel data = Parcel.obtain();
3457 Parcel reply = Parcel.obtain();
3458 data.writeInterfaceToken(IActivityManager.descriptor);
3459 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3460 reply.readException();
3461 int mode = reply.readInt();
3462 reply.recycle();
3463 data.recycle();
3464 return mode;
3465 }
3466
3467 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3468 Parcel data = Parcel.obtain();
3469 Parcel reply = Parcel.obtain();
3470 data.writeInterfaceToken(IActivityManager.descriptor);
3471 data.writeInt(mode);
3472 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3473 reply.readException();
3474 reply.recycle();
3475 data.recycle();
3476 }
3477
3478 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3479 Parcel data = Parcel.obtain();
3480 Parcel reply = Parcel.obtain();
3481 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003482 data.writeString(packageName);
3483 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003484 reply.readException();
3485 int mode = reply.readInt();
3486 reply.recycle();
3487 data.recycle();
3488 return mode;
3489 }
3490
3491 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003492 throws RemoteException {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003497 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003498 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3499 reply.readException();
3500 reply.recycle();
3501 data.recycle();
3502 }
3503
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003504 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 data.writeString(packageName);
3509 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3510 reply.readException();
3511 boolean ask = reply.readInt() != 0;
3512 reply.recycle();
3513 data.recycle();
3514 return ask;
3515 }
3516
3517 public void setPackageAskScreenCompat(String packageName, boolean ask)
3518 throws RemoteException {
3519 Parcel data = Parcel.obtain();
3520 Parcel reply = Parcel.obtain();
3521 data.writeInterfaceToken(IActivityManager.descriptor);
3522 data.writeString(packageName);
3523 data.writeInt(ask ? 1 : 0);
3524 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3525 reply.readException();
3526 reply.recycle();
3527 data.recycle();
3528 }
3529
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003530 public boolean switchUser(int userid) throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 data.writeInt(userid);
3535 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3536 reply.readException();
3537 boolean result = reply.readInt() != 0;
3538 reply.recycle();
3539 data.recycle();
3540 return result;
3541 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003542
3543 public UserInfo getCurrentUser() throws RemoteException {
3544 Parcel data = Parcel.obtain();
3545 Parcel reply = Parcel.obtain();
3546 data.writeInterfaceToken(IActivityManager.descriptor);
3547 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3548 reply.readException();
3549 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3550 reply.recycle();
3551 data.recycle();
3552 return userInfo;
3553 }
3554
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003555 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3556 Parcel data = Parcel.obtain();
3557 Parcel reply = Parcel.obtain();
3558 data.writeInterfaceToken(IActivityManager.descriptor);
3559 data.writeInt(taskId);
3560 data.writeInt(subTaskIndex);
3561 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 boolean result = reply.readInt() != 0;
3564 reply.recycle();
3565 data.recycle();
3566 return result;
3567 }
3568
3569 public boolean removeTask(int taskId, int flags) throws RemoteException {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeInt(taskId);
3574 data.writeInt(flags);
3575 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3576 reply.readException();
3577 boolean result = reply.readInt() != 0;
3578 reply.recycle();
3579 data.recycle();
3580 return result;
3581 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003582
Jeff Sharkeya4620792011-05-20 15:29:23 -07003583 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3584 Parcel data = Parcel.obtain();
3585 Parcel reply = Parcel.obtain();
3586 data.writeInterfaceToken(IActivityManager.descriptor);
3587 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3588 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3589 reply.readException();
3590 data.recycle();
3591 reply.recycle();
3592 }
3593
3594 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3595 Parcel data = Parcel.obtain();
3596 Parcel reply = Parcel.obtain();
3597 data.writeInterfaceToken(IActivityManager.descriptor);
3598 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3599 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 data.recycle();
3602 reply.recycle();
3603 }
3604
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003605 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeStrongBinder(sender.asBinder());
3610 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3611 reply.readException();
3612 boolean res = reply.readInt() != 0;
3613 data.recycle();
3614 reply.recycle();
3615 return res;
3616 }
3617
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003618 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3619 {
3620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 values.writeToParcel(data, 0);
3624 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3625 reply.readException();
3626 data.recycle();
3627 reply.recycle();
3628 }
3629
Dianne Hackbornb437e092011-08-05 17:50:29 -07003630 public long[] getProcessPss(int[] pids) throws RemoteException {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeIntArray(pids);
3635 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3636 reply.readException();
3637 long[] res = reply.createLongArray();
3638 data.recycle();
3639 reply.recycle();
3640 return res;
3641 }
3642
Dianne Hackborn661cd522011-08-22 00:26:20 -07003643 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3644 Parcel data = Parcel.obtain();
3645 Parcel reply = Parcel.obtain();
3646 data.writeInterfaceToken(IActivityManager.descriptor);
3647 TextUtils.writeToParcel(msg, data, 0);
3648 data.writeInt(always ? 1 : 0);
3649 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3650 reply.readException();
3651 data.recycle();
3652 reply.recycle();
3653 }
3654
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003655 public void dismissKeyguardOnNextActivity() throws RemoteException {
3656 Parcel data = Parcel.obtain();
3657 Parcel reply = Parcel.obtain();
3658 data.writeInterfaceToken(IActivityManager.descriptor);
3659 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3660 reply.readException();
3661 data.recycle();
3662 reply.recycle();
3663 }
3664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003665 private IBinder mRemote;
3666}