blob: a3fdf3e81a34e1d83de2ef02fc28406cd4dad361 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070020import android.content.IIntentReceiver;
21import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Intent;
23import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070028import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.res.Configuration;
30import android.graphics.Bitmap;
31import android.net.Uri;
32import android.os.Binder;
33import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070034import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.os.IBinder;
36import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070037import android.os.ParcelFileDescriptor;
38import android.os.Parcelable;
39import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070041import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080044import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import java.util.ArrayList;
47import java.util.List;
48
49/** {@hide} */
50public abstract class ActivityManagerNative extends Binder implements IActivityManager
51{
52 /**
53 * Cast a Binder object into an activity manager interface, generating
54 * a proxy if needed.
55 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080056 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 if (obj == null) {
58 return null;
59 }
60 IActivityManager in =
61 (IActivityManager)obj.queryLocalInterface(descriptor);
62 if (in != null) {
63 return in;
64 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 return new ActivityManagerProxy(obj);
67 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 /**
70 * Retrieve the system's default/global activity manager.
71 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072 static public IActivityManager getDefault() {
73 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 }
75
76 /**
77 * Convenience for checking whether the system is ready. For internal use only.
78 */
79 static public boolean isSystemReady() {
80 if (!sSystemReady) {
81 sSystemReady = getDefault().testIsSystemReady();
82 }
83 return sSystemReady;
84 }
85 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 /**
88 * Convenience for sending a sticky broadcast. For internal use only.
89 * If you don't care about permission, use null.
90 */
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
Christopher Tatec4a07d12012-04-06 14:19:13 -0700870 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
871 data.enforceInterface(IActivityManager.descriptor);
872 IIntentSender r = IIntentSender.Stub.asInterface(
873 data.readStrongBinder());
874 int res = getUidForIntentSender(r);
875 reply.writeNoException();
876 reply.writeInt(res);
877 return true;
878 }
879
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800880 case SET_PROCESS_LIMIT_TRANSACTION: {
881 data.enforceInterface(IActivityManager.descriptor);
882 int max = data.readInt();
883 setProcessLimit(max);
884 reply.writeNoException();
885 return true;
886 }
887
888 case GET_PROCESS_LIMIT_TRANSACTION: {
889 data.enforceInterface(IActivityManager.descriptor);
890 int limit = getProcessLimit();
891 reply.writeNoException();
892 reply.writeInt(limit);
893 return true;
894 }
895
896 case SET_PROCESS_FOREGROUND_TRANSACTION: {
897 data.enforceInterface(IActivityManager.descriptor);
898 IBinder token = data.readStrongBinder();
899 int pid = data.readInt();
900 boolean isForeground = data.readInt() != 0;
901 setProcessForeground(token, pid, isForeground);
902 reply.writeNoException();
903 return true;
904 }
905
906 case CHECK_PERMISSION_TRANSACTION: {
907 data.enforceInterface(IActivityManager.descriptor);
908 String perm = data.readString();
909 int pid = data.readInt();
910 int uid = data.readInt();
911 int res = checkPermission(perm, pid, uid);
912 reply.writeNoException();
913 reply.writeInt(res);
914 return true;
915 }
916
917 case CHECK_URI_PERMISSION_TRANSACTION: {
918 data.enforceInterface(IActivityManager.descriptor);
919 Uri uri = Uri.CREATOR.createFromParcel(data);
920 int pid = data.readInt();
921 int uid = data.readInt();
922 int mode = data.readInt();
923 int res = checkUriPermission(uri, pid, uid, mode);
924 reply.writeNoException();
925 reply.writeInt(res);
926 return true;
927 }
928
929 case CLEAR_APP_DATA_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 String packageName = data.readString();
932 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
933 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -0700934 int userId = data.readInt();
935 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 reply.writeNoException();
937 reply.writeInt(res ? 1 : 0);
938 return true;
939 }
940
941 case GRANT_URI_PERMISSION_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 IBinder b = data.readStrongBinder();
944 IApplicationThread app = ApplicationThreadNative.asInterface(b);
945 String targetPkg = data.readString();
946 Uri uri = Uri.CREATOR.createFromParcel(data);
947 int mode = data.readInt();
948 grantUriPermission(app, targetPkg, uri, mode);
949 reply.writeNoException();
950 return true;
951 }
952
953 case REVOKE_URI_PERMISSION_TRANSACTION: {
954 data.enforceInterface(IActivityManager.descriptor);
955 IBinder b = data.readStrongBinder();
956 IApplicationThread app = ApplicationThreadNative.asInterface(b);
957 Uri uri = Uri.CREATOR.createFromParcel(data);
958 int mode = data.readInt();
959 revokeUriPermission(app, uri, mode);
960 reply.writeNoException();
961 return true;
962 }
963
964 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 IBinder b = data.readStrongBinder();
967 IApplicationThread app = ApplicationThreadNative.asInterface(b);
968 boolean waiting = data.readInt() != 0;
969 showWaitingForDebugger(app, waiting);
970 reply.writeNoException();
971 return true;
972 }
973
974 case GET_MEMORY_INFO_TRANSACTION: {
975 data.enforceInterface(IActivityManager.descriptor);
976 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
977 getMemoryInfo(mi);
978 reply.writeNoException();
979 mi.writeToParcel(reply, 0);
980 return true;
981 }
982
983 case UNHANDLED_BACK_TRANSACTION: {
984 data.enforceInterface(IActivityManager.descriptor);
985 unhandledBack();
986 reply.writeNoException();
987 return true;
988 }
989
990 case OPEN_CONTENT_URI_TRANSACTION: {
991 data.enforceInterface(IActivityManager.descriptor);
992 Uri uri = Uri.parse(data.readString());
993 ParcelFileDescriptor pfd = openContentUri(uri);
994 reply.writeNoException();
995 if (pfd != null) {
996 reply.writeInt(1);
997 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
998 } else {
999 reply.writeInt(0);
1000 }
1001 return true;
1002 }
1003
1004 case GOING_TO_SLEEP_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 goingToSleep();
1007 reply.writeNoException();
1008 return true;
1009 }
1010
1011 case WAKING_UP_TRANSACTION: {
1012 data.enforceInterface(IActivityManager.descriptor);
1013 wakingUp();
1014 reply.writeNoException();
1015 return true;
1016 }
1017
1018 case SET_DEBUG_APP_TRANSACTION: {
1019 data.enforceInterface(IActivityManager.descriptor);
1020 String pn = data.readString();
1021 boolean wfd = data.readInt() != 0;
1022 boolean per = data.readInt() != 0;
1023 setDebugApp(pn, wfd, per);
1024 reply.writeNoException();
1025 return true;
1026 }
1027
1028 case SET_ALWAYS_FINISH_TRANSACTION: {
1029 data.enforceInterface(IActivityManager.descriptor);
1030 boolean enabled = data.readInt() != 0;
1031 setAlwaysFinish(enabled);
1032 reply.writeNoException();
1033 return true;
1034 }
1035
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001036 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001037 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001038 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001039 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001040 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001041 return true;
1042 }
1043
1044 case ENTER_SAFE_MODE_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 enterSafeMode();
1047 reply.writeNoException();
1048 return true;
1049 }
1050
1051 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1052 data.enforceInterface(IActivityManager.descriptor);
1053 IIntentSender is = IIntentSender.Stub.asInterface(
1054 data.readStrongBinder());
1055 noteWakeupAlarm(is);
1056 reply.writeNoException();
1057 return true;
1058 }
1059
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001060 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001061 data.enforceInterface(IActivityManager.descriptor);
1062 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001063 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001064 boolean secure = data.readInt() != 0;
1065 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001066 reply.writeNoException();
1067 reply.writeInt(res ? 1 : 0);
1068 return true;
1069 }
1070
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001071 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 String reason = data.readString();
1074 boolean res = killProcessesBelowForeground(reason);
1075 reply.writeNoException();
1076 reply.writeInt(res ? 1 : 0);
1077 return true;
1078 }
1079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001080 case START_RUNNING_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 String pkg = data.readString();
1083 String cls = data.readString();
1084 String action = data.readString();
1085 String indata = data.readString();
1086 startRunning(pkg, cls, action, indata);
1087 reply.writeNoException();
1088 return true;
1089 }
1090
Dan Egnor60d87622009-12-16 16:32:58 -08001091 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1092 data.enforceInterface(IActivityManager.descriptor);
1093 IBinder app = data.readStrongBinder();
1094 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1095 handleApplicationCrash(app, ci);
1096 reply.writeNoException();
1097 return true;
1098 }
1099
1100 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001101 data.enforceInterface(IActivityManager.descriptor);
1102 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001103 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001104 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001105 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001106 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001107 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001108 return true;
1109 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001110
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001111 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001114 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001115 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1116 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001117 reply.writeNoException();
1118 return true;
1119 }
1120
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001121 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1122 data.enforceInterface(IActivityManager.descriptor);
1123 int sig = data.readInt();
1124 signalPersistentProcesses(sig);
1125 reply.writeNoException();
1126 return true;
1127 }
1128
Dianne Hackborn03abb812010-01-04 18:43:19 -08001129 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1130 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001131 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001132 killBackgroundProcesses(packageName);
1133 reply.writeNoException();
1134 return true;
1135 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001136
1137 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 killAllBackgroundProcesses();
1140 reply.writeNoException();
1141 return true;
1142 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001143
1144 case FORCE_STOP_PACKAGE_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 String packageName = data.readString();
1147 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 reply.writeNoException();
1149 return true;
1150 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001151
1152 case GET_MY_MEMORY_STATE_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 ActivityManager.RunningAppProcessInfo info =
1155 new ActivityManager.RunningAppProcessInfo();
1156 getMyMemoryState(info);
1157 reply.writeNoException();
1158 info.writeToParcel(reply, 0);
1159 return true;
1160 }
1161
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001162 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1163 data.enforceInterface(IActivityManager.descriptor);
1164 ConfigurationInfo config = getDeviceConfigurationInfo();
1165 reply.writeNoException();
1166 config.writeToParcel(reply, 0);
1167 return true;
1168 }
1169
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001170 case PROFILE_CONTROL_TRANSACTION: {
1171 data.enforceInterface(IActivityManager.descriptor);
1172 String process = data.readString();
1173 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001174 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001175 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001176 ParcelFileDescriptor fd = data.readInt() != 0
1177 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001178 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001179 reply.writeNoException();
1180 reply.writeInt(res ? 1 : 0);
1181 return true;
1182 }
1183
Dianne Hackborn55280a92009-05-07 15:53:46 -07001184 case SHUTDOWN_TRANSACTION: {
1185 data.enforceInterface(IActivityManager.descriptor);
1186 boolean res = shutdown(data.readInt());
1187 reply.writeNoException();
1188 reply.writeInt(res ? 1 : 0);
1189 return true;
1190 }
1191
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001192 case STOP_APP_SWITCHES_TRANSACTION: {
1193 data.enforceInterface(IActivityManager.descriptor);
1194 stopAppSwitches();
1195 reply.writeNoException();
1196 return true;
1197 }
1198
1199 case RESUME_APP_SWITCHES_TRANSACTION: {
1200 data.enforceInterface(IActivityManager.descriptor);
1201 resumeAppSwitches();
1202 reply.writeNoException();
1203 return true;
1204 }
1205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 case PEEK_SERVICE_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 Intent service = Intent.CREATOR.createFromParcel(data);
1209 String resolvedType = data.readString();
1210 IBinder binder = peekService(service, resolvedType);
1211 reply.writeNoException();
1212 reply.writeStrongBinder(binder);
1213 return true;
1214 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001215
1216 case START_BACKUP_AGENT_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1219 int backupRestoreMode = data.readInt();
1220 boolean success = bindBackupAgent(info, backupRestoreMode);
1221 reply.writeNoException();
1222 reply.writeInt(success ? 1 : 0);
1223 return true;
1224 }
1225
1226 case BACKUP_AGENT_CREATED_TRANSACTION: {
1227 data.enforceInterface(IActivityManager.descriptor);
1228 String packageName = data.readString();
1229 IBinder agent = data.readStrongBinder();
1230 backupAgentCreated(packageName, agent);
1231 reply.writeNoException();
1232 return true;
1233 }
1234
1235 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1238 unbindBackupAgent(info);
1239 reply.writeNoException();
1240 return true;
1241 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001242
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001243 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1244 {
1245 data.enforceInterface(IActivityManager.descriptor);
1246 int uid = data.readInt();
1247 Intent intent = Intent.CREATOR.createFromParcel(data);
1248 String resolvedType = data.readString();
1249 IBinder resultTo = data.readStrongBinder();
1250 String resultWho = data.readString();
1251 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001252 int startFlags = data.readInt();
1253 Bundle options = data.readInt() != 0
1254 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001255 int result = startActivityInPackage(uid, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001256 resultTo, resultWho, requestCode, startFlags, options);
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001257 reply.writeNoException();
1258 reply.writeInt(result);
1259 return true;
1260 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001261
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001262 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1263 data.enforceInterface(IActivityManager.descriptor);
1264 String pkg = data.readString();
1265 int uid = data.readInt();
1266 killApplicationWithUid(pkg, uid);
1267 reply.writeNoException();
1268 return true;
1269 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001270
1271 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
1273 String reason = data.readString();
1274 closeSystemDialogs(reason);
1275 reply.writeNoException();
1276 return true;
1277 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001278
1279 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001281 int[] pids = data.createIntArray();
1282 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001283 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001284 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001285 return true;
1286 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001287
1288 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 String processName = data.readString();
1291 int uid = data.readInt();
1292 killApplicationProcess(processName, uid);
1293 reply.writeNoException();
1294 return true;
1295 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001296
1297 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 IBinder token = data.readStrongBinder();
1300 String packageName = data.readString();
1301 int enterAnim = data.readInt();
1302 int exitAnim = data.readInt();
1303 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001304 reply.writeNoException();
1305 return true;
1306 }
1307
1308 case IS_USER_A_MONKEY_TRANSACTION: {
1309 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001310 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001311 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001312 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001313 return true;
1314 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001315
1316 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 finishHeavyWeightApp();
1319 reply.writeNoException();
1320 return true;
1321 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001322
1323 case IS_IMMERSIVE_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001326 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001327 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001328 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001329 return true;
1330 }
1331
1332 case SET_IMMERSIVE_TRANSACTION: {
1333 data.enforceInterface(IActivityManager.descriptor);
1334 IBinder token = data.readStrongBinder();
1335 boolean imm = data.readInt() == 1;
1336 setImmersive(token, imm);
1337 reply.writeNoException();
1338 return true;
1339 }
1340
1341 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001343 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001344 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001345 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001346 return true;
1347 }
1348
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001349 case CRASH_APPLICATION_TRANSACTION: {
1350 data.enforceInterface(IActivityManager.descriptor);
1351 int uid = data.readInt();
1352 int initialPid = data.readInt();
1353 String packageName = data.readString();
1354 String message = data.readString();
1355 crashApplication(uid, initialPid, packageName, message);
1356 reply.writeNoException();
1357 return true;
1358 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001359
1360 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
1362 Uri uri = Uri.CREATOR.createFromParcel(data);
1363 String type = getProviderMimeType(uri);
1364 reply.writeNoException();
1365 reply.writeString(type);
1366 return true;
1367 }
1368
Dianne Hackborn7e269642010-08-25 19:50:20 -07001369 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1370 data.enforceInterface(IActivityManager.descriptor);
1371 String name = data.readString();
1372 IBinder perm = newUriPermissionOwner(name);
1373 reply.writeNoException();
1374 reply.writeStrongBinder(perm);
1375 return true;
1376 }
1377
1378 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1379 data.enforceInterface(IActivityManager.descriptor);
1380 IBinder owner = data.readStrongBinder();
1381 int fromUid = data.readInt();
1382 String targetPkg = data.readString();
1383 Uri uri = Uri.CREATOR.createFromParcel(data);
1384 int mode = data.readInt();
1385 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1386 reply.writeNoException();
1387 return true;
1388 }
1389
1390 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1391 data.enforceInterface(IActivityManager.descriptor);
1392 IBinder owner = data.readStrongBinder();
1393 Uri uri = null;
1394 if (data.readInt() != 0) {
1395 Uri.CREATOR.createFromParcel(data);
1396 }
1397 int mode = data.readInt();
1398 revokeUriPermissionFromOwner(owner, uri, mode);
1399 reply.writeNoException();
1400 return true;
1401 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001402
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001403 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 int callingUid = data.readInt();
1406 String targetPkg = data.readString();
1407 Uri uri = Uri.CREATOR.createFromParcel(data);
1408 int modeFlags = data.readInt();
1409 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1410 reply.writeNoException();
1411 reply.writeInt(res);
1412 return true;
1413 }
1414
Andy McFadden824c5102010-07-09 16:26:57 -07001415 case DUMP_HEAP_TRANSACTION: {
1416 data.enforceInterface(IActivityManager.descriptor);
1417 String process = data.readString();
1418 boolean managed = data.readInt() != 0;
1419 String path = data.readString();
1420 ParcelFileDescriptor fd = data.readInt() != 0
1421 ? data.readFileDescriptor() : null;
1422 boolean res = dumpHeap(process, managed, path, fd);
1423 reply.writeNoException();
1424 reply.writeInt(res ? 1 : 0);
1425 return true;
1426 }
1427
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001428 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1429 {
1430 data.enforceInterface(IActivityManager.descriptor);
1431 int uid = data.readInt();
1432 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1433 String[] resolvedTypes = data.createStringArray();
1434 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001435 Bundle options = data.readInt() != 0
1436 ? Bundle.CREATOR.createFromParcel(data) : null;
1437 int result = startActivitiesInPackage(uid, intents, resolvedTypes,
1438 resultTo, options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001439 reply.writeNoException();
1440 reply.writeInt(result);
1441 return true;
1442 }
1443
1444 case START_ACTIVITIES_TRANSACTION:
1445 {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 IBinder b = data.readStrongBinder();
1448 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1449 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1450 String[] resolvedTypes = data.createStringArray();
1451 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001452 Bundle options = data.readInt() != 0
1453 ? Bundle.CREATOR.createFromParcel(data) : null;
1454 int result = startActivities(app, intents, resolvedTypes, resultTo,
1455 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001456 reply.writeNoException();
1457 reply.writeInt(result);
1458 return true;
1459 }
1460
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001461 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1462 {
1463 data.enforceInterface(IActivityManager.descriptor);
1464 int mode = getFrontActivityScreenCompatMode();
1465 reply.writeNoException();
1466 reply.writeInt(mode);
1467 return true;
1468 }
1469
1470 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1471 {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 int mode = data.readInt();
1474 setFrontActivityScreenCompatMode(mode);
1475 reply.writeNoException();
1476 reply.writeInt(mode);
1477 return true;
1478 }
1479
1480 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1481 {
1482 data.enforceInterface(IActivityManager.descriptor);
1483 String pkg = data.readString();
1484 int mode = getPackageScreenCompatMode(pkg);
1485 reply.writeNoException();
1486 reply.writeInt(mode);
1487 return true;
1488 }
1489
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001490 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1491 {
1492 data.enforceInterface(IActivityManager.descriptor);
1493 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001494 int mode = data.readInt();
1495 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001496 reply.writeNoException();
1497 return true;
1498 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001499
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001500 case SWITCH_USER_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 int userid = data.readInt();
1503 boolean result = switchUser(userid);
1504 reply.writeNoException();
1505 reply.writeInt(result ? 1 : 0);
1506 return true;
1507 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001508
1509 case GET_CURRENT_USER_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 UserInfo userInfo = getCurrentUser();
1512 reply.writeNoException();
1513 userInfo.writeToParcel(reply, 0);
1514 return true;
1515 }
1516
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001517 case REMOVE_SUB_TASK_TRANSACTION:
1518 {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 int taskId = data.readInt();
1521 int subTaskIndex = data.readInt();
1522 boolean result = removeSubTask(taskId, subTaskIndex);
1523 reply.writeNoException();
1524 reply.writeInt(result ? 1 : 0);
1525 return true;
1526 }
1527
1528 case REMOVE_TASK_TRANSACTION:
1529 {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 int taskId = data.readInt();
1532 int fl = data.readInt();
1533 boolean result = removeTask(taskId, fl);
1534 reply.writeNoException();
1535 reply.writeInt(result ? 1 : 0);
1536 return true;
1537 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001538
Jeff Sharkeya4620792011-05-20 15:29:23 -07001539 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1540 data.enforceInterface(IActivityManager.descriptor);
1541 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1542 data.readStrongBinder());
1543 registerProcessObserver(observer);
1544 return true;
1545 }
1546
1547 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1548 data.enforceInterface(IActivityManager.descriptor);
1549 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1550 data.readStrongBinder());
1551 unregisterProcessObserver(observer);
1552 return true;
1553 }
1554
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001555 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1556 {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 String pkg = data.readString();
1559 boolean ask = getPackageAskScreenCompat(pkg);
1560 reply.writeNoException();
1561 reply.writeInt(ask ? 1 : 0);
1562 return true;
1563 }
1564
1565 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1566 {
1567 data.enforceInterface(IActivityManager.descriptor);
1568 String pkg = data.readString();
1569 boolean ask = data.readInt() != 0;
1570 setPackageAskScreenCompat(pkg, ask);
1571 reply.writeNoException();
1572 return true;
1573 }
1574
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001575 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1576 data.enforceInterface(IActivityManager.descriptor);
1577 IIntentSender r = IIntentSender.Stub.asInterface(
1578 data.readStrongBinder());
1579 boolean res = isIntentSenderTargetedToPackage(r);
1580 reply.writeNoException();
1581 reply.writeInt(res ? 1 : 0);
1582 return true;
1583 }
1584
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001585 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1586 data.enforceInterface(IActivityManager.descriptor);
1587 Configuration config = Configuration.CREATOR.createFromParcel(data);
1588 updatePersistentConfiguration(config);
1589 reply.writeNoException();
1590 return true;
1591 }
1592
Dianne Hackbornb437e092011-08-05 17:50:29 -07001593 case GET_PROCESS_PSS_TRANSACTION: {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 int[] pids = data.createIntArray();
1596 long[] pss = getProcessPss(pids);
1597 reply.writeNoException();
1598 reply.writeLongArray(pss);
1599 return true;
1600 }
1601
Dianne Hackborn661cd522011-08-22 00:26:20 -07001602 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1605 boolean always = data.readInt() != 0;
1606 showBootMessage(msg, always);
1607 reply.writeNoException();
1608 return true;
1609 }
1610
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001611 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1612 data.enforceInterface(IActivityManager.descriptor);
1613 dismissKeyguardOnNextActivity();
1614 reply.writeNoException();
1615 return true;
1616 }
1617
Adam Powelldd8fab22012-03-22 17:47:27 -07001618 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1619 data.enforceInterface(IActivityManager.descriptor);
1620 IBinder token = data.readStrongBinder();
1621 String destAffinity = data.readString();
1622 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1623 reply.writeNoException();
1624 reply.writeInt(res ? 1 : 0);
1625 return true;
1626 }
1627
1628 case NAVIGATE_UP_TO_TRANSACTION: {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 IBinder token = data.readStrongBinder();
1631 Intent target = Intent.CREATOR.createFromParcel(data);
1632 int resultCode = data.readInt();
1633 Intent resultData = null;
1634 if (data.readInt() != 0) {
1635 resultData = Intent.CREATOR.createFromParcel(data);
1636 }
1637 boolean res = navigateUpTo(token, target, resultCode, resultData);
1638 reply.writeNoException();
1639 reply.writeInt(res ? 1 : 0);
1640 return true;
1641 }
1642
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001643 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001644
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001645 return super.onTransact(code, data, reply, flags);
1646 }
1647
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001648 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001649 return this;
1650 }
1651
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001652 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1653 protected IActivityManager create() {
1654 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001655 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001656 Log.v("ActivityManager", "default service binder = " + b);
1657 }
1658 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001659 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001660 Log.v("ActivityManager", "default service = " + am);
1661 }
1662 return am;
1663 }
1664 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001665}
1666
1667class ActivityManagerProxy implements IActivityManager
1668{
1669 public ActivityManagerProxy(IBinder remote)
1670 {
1671 mRemote = remote;
1672 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001673
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001674 public IBinder asBinder()
1675 {
1676 return mRemote;
1677 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001678
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001679 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001680 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1681 int startFlags, String profileFile,
1682 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001683 Parcel data = Parcel.obtain();
1684 Parcel reply = Parcel.obtain();
1685 data.writeInterfaceToken(IActivityManager.descriptor);
1686 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1687 intent.writeToParcel(data, 0);
1688 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001689 data.writeStrongBinder(resultTo);
1690 data.writeString(resultWho);
1691 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001692 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001693 data.writeString(profileFile);
1694 if (profileFd != null) {
1695 data.writeInt(1);
1696 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1697 } else {
1698 data.writeInt(0);
1699 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001700 if (options != null) {
1701 data.writeInt(1);
1702 options.writeToParcel(data, 0);
1703 } else {
1704 data.writeInt(0);
1705 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001706 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1707 reply.readException();
1708 int result = reply.readInt();
1709 reply.recycle();
1710 data.recycle();
1711 return result;
1712 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001713 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001714 String resolvedType, IBinder resultTo, String resultWho,
1715 int requestCode, int startFlags, String profileFile,
1716 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001717 Parcel data = Parcel.obtain();
1718 Parcel reply = Parcel.obtain();
1719 data.writeInterfaceToken(IActivityManager.descriptor);
1720 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1721 intent.writeToParcel(data, 0);
1722 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001723 data.writeStrongBinder(resultTo);
1724 data.writeString(resultWho);
1725 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001726 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001727 data.writeString(profileFile);
1728 if (profileFd != null) {
1729 data.writeInt(1);
1730 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1731 } else {
1732 data.writeInt(0);
1733 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001734 if (options != null) {
1735 data.writeInt(1);
1736 options.writeToParcel(data, 0);
1737 } else {
1738 data.writeInt(0);
1739 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001740 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1741 reply.readException();
1742 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1743 reply.recycle();
1744 data.recycle();
1745 return result;
1746 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001747 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001748 String resolvedType, IBinder resultTo, String resultWho,
1749 int requestCode, int startFlags, Configuration config,
1750 Bundle options) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001751 Parcel data = Parcel.obtain();
1752 Parcel reply = Parcel.obtain();
1753 data.writeInterfaceToken(IActivityManager.descriptor);
1754 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1755 intent.writeToParcel(data, 0);
1756 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001757 data.writeStrongBinder(resultTo);
1758 data.writeString(resultWho);
1759 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001760 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001761 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001762 if (options != null) {
1763 data.writeInt(1);
1764 options.writeToParcel(data, 0);
1765 } else {
1766 data.writeInt(0);
1767 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001768 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1769 reply.readException();
1770 int result = reply.readInt();
1771 reply.recycle();
1772 data.recycle();
1773 return result;
1774 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001775 public int startActivityIntentSender(IApplicationThread caller,
1776 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001777 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001778 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001779 Parcel data = Parcel.obtain();
1780 Parcel reply = Parcel.obtain();
1781 data.writeInterfaceToken(IActivityManager.descriptor);
1782 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1783 intent.writeToParcel(data, 0);
1784 if (fillInIntent != null) {
1785 data.writeInt(1);
1786 fillInIntent.writeToParcel(data, 0);
1787 } else {
1788 data.writeInt(0);
1789 }
1790 data.writeString(resolvedType);
1791 data.writeStrongBinder(resultTo);
1792 data.writeString(resultWho);
1793 data.writeInt(requestCode);
1794 data.writeInt(flagsMask);
1795 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001796 if (options != null) {
1797 data.writeInt(1);
1798 options.writeToParcel(data, 0);
1799 } else {
1800 data.writeInt(0);
1801 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001802 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001803 reply.readException();
1804 int result = reply.readInt();
1805 reply.recycle();
1806 data.recycle();
1807 return result;
1808 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001809 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001810 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001811 Parcel data = Parcel.obtain();
1812 Parcel reply = Parcel.obtain();
1813 data.writeInterfaceToken(IActivityManager.descriptor);
1814 data.writeStrongBinder(callingActivity);
1815 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001816 if (options != null) {
1817 data.writeInt(1);
1818 options.writeToParcel(data, 0);
1819 } else {
1820 data.writeInt(0);
1821 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001822 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1823 reply.readException();
1824 int result = reply.readInt();
1825 reply.recycle();
1826 data.recycle();
1827 return result != 0;
1828 }
1829 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1830 throws RemoteException {
1831 Parcel data = Parcel.obtain();
1832 Parcel reply = Parcel.obtain();
1833 data.writeInterfaceToken(IActivityManager.descriptor);
1834 data.writeStrongBinder(token);
1835 data.writeInt(resultCode);
1836 if (resultData != null) {
1837 data.writeInt(1);
1838 resultData.writeToParcel(data, 0);
1839 } else {
1840 data.writeInt(0);
1841 }
1842 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1843 reply.readException();
1844 boolean res = reply.readInt() != 0;
1845 data.recycle();
1846 reply.recycle();
1847 return res;
1848 }
1849 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1850 {
1851 Parcel data = Parcel.obtain();
1852 Parcel reply = Parcel.obtain();
1853 data.writeInterfaceToken(IActivityManager.descriptor);
1854 data.writeStrongBinder(token);
1855 data.writeString(resultWho);
1856 data.writeInt(requestCode);
1857 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1858 reply.readException();
1859 data.recycle();
1860 reply.recycle();
1861 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001862 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1863 Parcel data = Parcel.obtain();
1864 Parcel reply = Parcel.obtain();
1865 data.writeInterfaceToken(IActivityManager.descriptor);
1866 data.writeStrongBinder(token);
1867 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1868 reply.readException();
1869 boolean res = reply.readInt() != 0;
1870 data.recycle();
1871 reply.recycle();
1872 return res;
1873 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001874 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001875 IIntentReceiver receiver,
1876 IntentFilter filter, String perm) throws RemoteException
1877 {
1878 Parcel data = Parcel.obtain();
1879 Parcel reply = Parcel.obtain();
1880 data.writeInterfaceToken(IActivityManager.descriptor);
1881 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001882 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001883 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1884 filter.writeToParcel(data, 0);
1885 data.writeString(perm);
1886 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1887 reply.readException();
1888 Intent intent = null;
1889 int haveIntent = reply.readInt();
1890 if (haveIntent != 0) {
1891 intent = Intent.CREATOR.createFromParcel(reply);
1892 }
1893 reply.recycle();
1894 data.recycle();
1895 return intent;
1896 }
1897 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1898 {
1899 Parcel data = Parcel.obtain();
1900 Parcel reply = Parcel.obtain();
1901 data.writeInterfaceToken(IActivityManager.descriptor);
1902 data.writeStrongBinder(receiver.asBinder());
1903 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1904 reply.readException();
1905 data.recycle();
1906 reply.recycle();
1907 }
1908 public int broadcastIntent(IApplicationThread caller,
1909 Intent intent, String resolvedType, IIntentReceiver resultTo,
1910 int resultCode, String resultData, Bundle map,
1911 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07001912 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001913 {
1914 Parcel data = Parcel.obtain();
1915 Parcel reply = Parcel.obtain();
1916 data.writeInterfaceToken(IActivityManager.descriptor);
1917 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1918 intent.writeToParcel(data, 0);
1919 data.writeString(resolvedType);
1920 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1921 data.writeInt(resultCode);
1922 data.writeString(resultData);
1923 data.writeBundle(map);
1924 data.writeString(requiredPermission);
1925 data.writeInt(serialized ? 1 : 0);
1926 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001927 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001928 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1929 reply.readException();
1930 int res = reply.readInt();
1931 reply.recycle();
1932 data.recycle();
1933 return res;
1934 }
Amith Yamasani742a6712011-05-04 14:49:28 -07001935 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
1936 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001937 {
1938 Parcel data = Parcel.obtain();
1939 Parcel reply = Parcel.obtain();
1940 data.writeInterfaceToken(IActivityManager.descriptor);
1941 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1942 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001943 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001944 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1945 reply.readException();
1946 data.recycle();
1947 reply.recycle();
1948 }
1949 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1950 {
1951 Parcel data = Parcel.obtain();
1952 Parcel reply = Parcel.obtain();
1953 data.writeInterfaceToken(IActivityManager.descriptor);
1954 data.writeStrongBinder(who);
1955 data.writeInt(resultCode);
1956 data.writeString(resultData);
1957 data.writeBundle(map);
1958 data.writeInt(abortBroadcast ? 1 : 0);
1959 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1960 reply.readException();
1961 data.recycle();
1962 reply.recycle();
1963 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001964 public void attachApplication(IApplicationThread app) throws RemoteException
1965 {
1966 Parcel data = Parcel.obtain();
1967 Parcel reply = Parcel.obtain();
1968 data.writeInterfaceToken(IActivityManager.descriptor);
1969 data.writeStrongBinder(app.asBinder());
1970 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1971 reply.readException();
1972 data.recycle();
1973 reply.recycle();
1974 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001975 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
1976 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001977 {
1978 Parcel data = Parcel.obtain();
1979 Parcel reply = Parcel.obtain();
1980 data.writeInterfaceToken(IActivityManager.descriptor);
1981 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001982 if (config != null) {
1983 data.writeInt(1);
1984 config.writeToParcel(data, 0);
1985 } else {
1986 data.writeInt(0);
1987 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001988 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001989 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1990 reply.readException();
1991 data.recycle();
1992 reply.recycle();
1993 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001994 public void activityPaused(IBinder token) throws RemoteException
1995 {
1996 Parcel data = Parcel.obtain();
1997 Parcel reply = Parcel.obtain();
1998 data.writeInterfaceToken(IActivityManager.descriptor);
1999 data.writeStrongBinder(token);
2000 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2001 reply.readException();
2002 data.recycle();
2003 reply.recycle();
2004 }
2005 public void activityStopped(IBinder token, Bundle state,
2006 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002007 {
2008 Parcel data = Parcel.obtain();
2009 Parcel reply = Parcel.obtain();
2010 data.writeInterfaceToken(IActivityManager.descriptor);
2011 data.writeStrongBinder(token);
2012 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002013 if (thumbnail != null) {
2014 data.writeInt(1);
2015 thumbnail.writeToParcel(data, 0);
2016 } else {
2017 data.writeInt(0);
2018 }
2019 TextUtils.writeToParcel(description, data, 0);
2020 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2021 reply.readException();
2022 data.recycle();
2023 reply.recycle();
2024 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002025 public void activitySlept(IBinder token) throws RemoteException
2026 {
2027 Parcel data = Parcel.obtain();
2028 Parcel reply = Parcel.obtain();
2029 data.writeInterfaceToken(IActivityManager.descriptor);
2030 data.writeStrongBinder(token);
2031 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2032 reply.readException();
2033 data.recycle();
2034 reply.recycle();
2035 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002036 public void activityDestroyed(IBinder token) throws RemoteException
2037 {
2038 Parcel data = Parcel.obtain();
2039 Parcel reply = Parcel.obtain();
2040 data.writeInterfaceToken(IActivityManager.descriptor);
2041 data.writeStrongBinder(token);
2042 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2043 reply.readException();
2044 data.recycle();
2045 reply.recycle();
2046 }
2047 public String getCallingPackage(IBinder token) throws RemoteException
2048 {
2049 Parcel data = Parcel.obtain();
2050 Parcel reply = Parcel.obtain();
2051 data.writeInterfaceToken(IActivityManager.descriptor);
2052 data.writeStrongBinder(token);
2053 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2054 reply.readException();
2055 String res = reply.readString();
2056 data.recycle();
2057 reply.recycle();
2058 return res;
2059 }
2060 public ComponentName getCallingActivity(IBinder token)
2061 throws RemoteException {
2062 Parcel data = Parcel.obtain();
2063 Parcel reply = Parcel.obtain();
2064 data.writeInterfaceToken(IActivityManager.descriptor);
2065 data.writeStrongBinder(token);
2066 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2067 reply.readException();
2068 ComponentName res = ComponentName.readFromParcel(reply);
2069 data.recycle();
2070 reply.recycle();
2071 return res;
2072 }
2073 public List getTasks(int maxNum, int flags,
2074 IThumbnailReceiver receiver) throws RemoteException {
2075 Parcel data = Parcel.obtain();
2076 Parcel reply = Parcel.obtain();
2077 data.writeInterfaceToken(IActivityManager.descriptor);
2078 data.writeInt(maxNum);
2079 data.writeInt(flags);
2080 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2081 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2082 reply.readException();
2083 ArrayList list = null;
2084 int N = reply.readInt();
2085 if (N >= 0) {
2086 list = new ArrayList();
2087 while (N > 0) {
2088 ActivityManager.RunningTaskInfo info =
2089 ActivityManager.RunningTaskInfo.CREATOR
2090 .createFromParcel(reply);
2091 list.add(info);
2092 N--;
2093 }
2094 }
2095 data.recycle();
2096 reply.recycle();
2097 return list;
2098 }
2099 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2100 int flags) throws RemoteException {
2101 Parcel data = Parcel.obtain();
2102 Parcel reply = Parcel.obtain();
2103 data.writeInterfaceToken(IActivityManager.descriptor);
2104 data.writeInt(maxNum);
2105 data.writeInt(flags);
2106 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2107 reply.readException();
2108 ArrayList<ActivityManager.RecentTaskInfo> list
2109 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2110 data.recycle();
2111 reply.recycle();
2112 return list;
2113 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002114 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002115 Parcel data = Parcel.obtain();
2116 Parcel reply = Parcel.obtain();
2117 data.writeInterfaceToken(IActivityManager.descriptor);
2118 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002119 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002120 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002121 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002122 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002123 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002124 }
2125 data.recycle();
2126 reply.recycle();
2127 return bm;
2128 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002129 public List getServices(int maxNum, int flags) throws RemoteException {
2130 Parcel data = Parcel.obtain();
2131 Parcel reply = Parcel.obtain();
2132 data.writeInterfaceToken(IActivityManager.descriptor);
2133 data.writeInt(maxNum);
2134 data.writeInt(flags);
2135 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2136 reply.readException();
2137 ArrayList list = null;
2138 int N = reply.readInt();
2139 if (N >= 0) {
2140 list = new ArrayList();
2141 while (N > 0) {
2142 ActivityManager.RunningServiceInfo info =
2143 ActivityManager.RunningServiceInfo.CREATOR
2144 .createFromParcel(reply);
2145 list.add(info);
2146 N--;
2147 }
2148 }
2149 data.recycle();
2150 reply.recycle();
2151 return list;
2152 }
2153 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2154 throws RemoteException {
2155 Parcel data = Parcel.obtain();
2156 Parcel reply = Parcel.obtain();
2157 data.writeInterfaceToken(IActivityManager.descriptor);
2158 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2159 reply.readException();
2160 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2161 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2162 data.recycle();
2163 reply.recycle();
2164 return list;
2165 }
2166 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2167 throws RemoteException {
2168 Parcel data = Parcel.obtain();
2169 Parcel reply = Parcel.obtain();
2170 data.writeInterfaceToken(IActivityManager.descriptor);
2171 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2172 reply.readException();
2173 ArrayList<ActivityManager.RunningAppProcessInfo> list
2174 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2175 data.recycle();
2176 reply.recycle();
2177 return list;
2178 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002179 public List<ApplicationInfo> getRunningExternalApplications()
2180 throws RemoteException {
2181 Parcel data = Parcel.obtain();
2182 Parcel reply = Parcel.obtain();
2183 data.writeInterfaceToken(IActivityManager.descriptor);
2184 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2185 reply.readException();
2186 ArrayList<ApplicationInfo> list
2187 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2188 data.recycle();
2189 reply.recycle();
2190 return list;
2191 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002192 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002193 {
2194 Parcel data = Parcel.obtain();
2195 Parcel reply = Parcel.obtain();
2196 data.writeInterfaceToken(IActivityManager.descriptor);
2197 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002198 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002199 if (options != null) {
2200 data.writeInt(1);
2201 options.writeToParcel(data, 0);
2202 } else {
2203 data.writeInt(0);
2204 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002205 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2206 reply.readException();
2207 data.recycle();
2208 reply.recycle();
2209 }
2210 public void moveTaskToBack(int task) throws RemoteException
2211 {
2212 Parcel data = Parcel.obtain();
2213 Parcel reply = Parcel.obtain();
2214 data.writeInterfaceToken(IActivityManager.descriptor);
2215 data.writeInt(task);
2216 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2217 reply.readException();
2218 data.recycle();
2219 reply.recycle();
2220 }
2221 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2222 throws RemoteException {
2223 Parcel data = Parcel.obtain();
2224 Parcel reply = Parcel.obtain();
2225 data.writeInterfaceToken(IActivityManager.descriptor);
2226 data.writeStrongBinder(token);
2227 data.writeInt(nonRoot ? 1 : 0);
2228 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2229 reply.readException();
2230 boolean res = reply.readInt() != 0;
2231 data.recycle();
2232 reply.recycle();
2233 return res;
2234 }
2235 public void moveTaskBackwards(int task) throws RemoteException
2236 {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 data.writeInt(task);
2241 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2242 reply.readException();
2243 data.recycle();
2244 reply.recycle();
2245 }
2246 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2247 {
2248 Parcel data = Parcel.obtain();
2249 Parcel reply = Parcel.obtain();
2250 data.writeInterfaceToken(IActivityManager.descriptor);
2251 data.writeStrongBinder(token);
2252 data.writeInt(onlyRoot ? 1 : 0);
2253 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2254 reply.readException();
2255 int res = reply.readInt();
2256 data.recycle();
2257 reply.recycle();
2258 return res;
2259 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002260 public void reportThumbnail(IBinder token,
2261 Bitmap thumbnail, CharSequence description) throws RemoteException
2262 {
2263 Parcel data = Parcel.obtain();
2264 Parcel reply = Parcel.obtain();
2265 data.writeInterfaceToken(IActivityManager.descriptor);
2266 data.writeStrongBinder(token);
2267 if (thumbnail != null) {
2268 data.writeInt(1);
2269 thumbnail.writeToParcel(data, 0);
2270 } else {
2271 data.writeInt(0);
2272 }
2273 TextUtils.writeToParcel(description, data, 0);
2274 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2275 reply.readException();
2276 data.recycle();
2277 reply.recycle();
2278 }
2279 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2280 String name) throws RemoteException
2281 {
2282 Parcel data = Parcel.obtain();
2283 Parcel reply = Parcel.obtain();
2284 data.writeInterfaceToken(IActivityManager.descriptor);
2285 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2286 data.writeString(name);
2287 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2288 reply.readException();
2289 int res = reply.readInt();
2290 ContentProviderHolder cph = null;
2291 if (res != 0) {
2292 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2293 }
2294 data.recycle();
2295 reply.recycle();
2296 return cph;
2297 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002298 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2299 throws RemoteException
2300 {
2301 Parcel data = Parcel.obtain();
2302 Parcel reply = Parcel.obtain();
2303 data.writeInterfaceToken(IActivityManager.descriptor);
2304 data.writeString(name);
2305 data.writeStrongBinder(token);
2306 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2307 reply.readException();
2308 int res = reply.readInt();
2309 ContentProviderHolder cph = null;
2310 if (res != 0) {
2311 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2312 }
2313 data.recycle();
2314 reply.recycle();
2315 return cph;
2316 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002317 public void publishContentProviders(IApplicationThread caller,
2318 List<ContentProviderHolder> providers) throws RemoteException
2319 {
2320 Parcel data = Parcel.obtain();
2321 Parcel reply = Parcel.obtain();
2322 data.writeInterfaceToken(IActivityManager.descriptor);
2323 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2324 data.writeTypedList(providers);
2325 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2326 reply.readException();
2327 data.recycle();
2328 reply.recycle();
2329 }
2330
2331 public void removeContentProvider(IApplicationThread caller,
2332 String name) throws RemoteException {
2333 Parcel data = Parcel.obtain();
2334 Parcel reply = Parcel.obtain();
2335 data.writeInterfaceToken(IActivityManager.descriptor);
2336 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2337 data.writeString(name);
2338 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2339 reply.readException();
2340 data.recycle();
2341 reply.recycle();
2342 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002343
2344 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2345 Parcel data = Parcel.obtain();
2346 Parcel reply = Parcel.obtain();
2347 data.writeInterfaceToken(IActivityManager.descriptor);
2348 data.writeString(name);
2349 data.writeStrongBinder(token);
2350 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2351 reply.readException();
2352 data.recycle();
2353 reply.recycle();
2354 }
2355
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002356 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2357 throws RemoteException
2358 {
2359 Parcel data = Parcel.obtain();
2360 Parcel reply = Parcel.obtain();
2361 data.writeInterfaceToken(IActivityManager.descriptor);
2362 service.writeToParcel(data, 0);
2363 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2364 reply.readException();
2365 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2366 data.recycle();
2367 reply.recycle();
2368 return res;
2369 }
2370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002371 public ComponentName startService(IApplicationThread caller, Intent service,
2372 String resolvedType) throws RemoteException
2373 {
2374 Parcel data = Parcel.obtain();
2375 Parcel reply = Parcel.obtain();
2376 data.writeInterfaceToken(IActivityManager.descriptor);
2377 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2378 service.writeToParcel(data, 0);
2379 data.writeString(resolvedType);
2380 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2381 reply.readException();
2382 ComponentName res = ComponentName.readFromParcel(reply);
2383 data.recycle();
2384 reply.recycle();
2385 return res;
2386 }
2387 public int stopService(IApplicationThread caller, Intent service,
2388 String resolvedType) throws RemoteException
2389 {
2390 Parcel data = Parcel.obtain();
2391 Parcel reply = Parcel.obtain();
2392 data.writeInterfaceToken(IActivityManager.descriptor);
2393 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2394 service.writeToParcel(data, 0);
2395 data.writeString(resolvedType);
2396 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2397 reply.readException();
2398 int res = reply.readInt();
2399 reply.recycle();
2400 data.recycle();
2401 return res;
2402 }
2403 public boolean stopServiceToken(ComponentName className, IBinder token,
2404 int startId) throws RemoteException {
2405 Parcel data = Parcel.obtain();
2406 Parcel reply = Parcel.obtain();
2407 data.writeInterfaceToken(IActivityManager.descriptor);
2408 ComponentName.writeToParcel(className, data);
2409 data.writeStrongBinder(token);
2410 data.writeInt(startId);
2411 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2412 reply.readException();
2413 boolean res = reply.readInt() != 0;
2414 data.recycle();
2415 reply.recycle();
2416 return res;
2417 }
2418 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002419 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002420 Parcel data = Parcel.obtain();
2421 Parcel reply = Parcel.obtain();
2422 data.writeInterfaceToken(IActivityManager.descriptor);
2423 ComponentName.writeToParcel(className, data);
2424 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002425 data.writeInt(id);
2426 if (notification != null) {
2427 data.writeInt(1);
2428 notification.writeToParcel(data, 0);
2429 } else {
2430 data.writeInt(0);
2431 }
2432 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002433 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2434 reply.readException();
2435 data.recycle();
2436 reply.recycle();
2437 }
2438 public int bindService(IApplicationThread caller, IBinder token,
2439 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002440 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002441 Parcel data = Parcel.obtain();
2442 Parcel reply = Parcel.obtain();
2443 data.writeInterfaceToken(IActivityManager.descriptor);
2444 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2445 data.writeStrongBinder(token);
2446 service.writeToParcel(data, 0);
2447 data.writeString(resolvedType);
2448 data.writeStrongBinder(connection.asBinder());
2449 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002450 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002451 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2452 reply.readException();
2453 int res = reply.readInt();
2454 data.recycle();
2455 reply.recycle();
2456 return res;
2457 }
2458 public boolean unbindService(IServiceConnection connection) throws RemoteException
2459 {
2460 Parcel data = Parcel.obtain();
2461 Parcel reply = Parcel.obtain();
2462 data.writeInterfaceToken(IActivityManager.descriptor);
2463 data.writeStrongBinder(connection.asBinder());
2464 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2465 reply.readException();
2466 boolean res = reply.readInt() != 0;
2467 data.recycle();
2468 reply.recycle();
2469 return res;
2470 }
2471
2472 public void publishService(IBinder token,
2473 Intent intent, IBinder service) throws RemoteException {
2474 Parcel data = Parcel.obtain();
2475 Parcel reply = Parcel.obtain();
2476 data.writeInterfaceToken(IActivityManager.descriptor);
2477 data.writeStrongBinder(token);
2478 intent.writeToParcel(data, 0);
2479 data.writeStrongBinder(service);
2480 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2481 reply.readException();
2482 data.recycle();
2483 reply.recycle();
2484 }
2485
2486 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2487 throws RemoteException {
2488 Parcel data = Parcel.obtain();
2489 Parcel reply = Parcel.obtain();
2490 data.writeInterfaceToken(IActivityManager.descriptor);
2491 data.writeStrongBinder(token);
2492 intent.writeToParcel(data, 0);
2493 data.writeInt(doRebind ? 1 : 0);
2494 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2495 reply.readException();
2496 data.recycle();
2497 reply.recycle();
2498 }
2499
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002500 public void serviceDoneExecuting(IBinder token, int type, int startId,
2501 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002502 Parcel data = Parcel.obtain();
2503 Parcel reply = Parcel.obtain();
2504 data.writeInterfaceToken(IActivityManager.descriptor);
2505 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002506 data.writeInt(type);
2507 data.writeInt(startId);
2508 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002509 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2510 reply.readException();
2511 data.recycle();
2512 reply.recycle();
2513 }
2514
2515 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2516 Parcel data = Parcel.obtain();
2517 Parcel reply = Parcel.obtain();
2518 data.writeInterfaceToken(IActivityManager.descriptor);
2519 service.writeToParcel(data, 0);
2520 data.writeString(resolvedType);
2521 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2522 reply.readException();
2523 IBinder binder = reply.readStrongBinder();
2524 reply.recycle();
2525 data.recycle();
2526 return binder;
2527 }
2528
Christopher Tate181fafa2009-05-14 11:12:14 -07002529 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2530 throws RemoteException {
2531 Parcel data = Parcel.obtain();
2532 Parcel reply = Parcel.obtain();
2533 data.writeInterfaceToken(IActivityManager.descriptor);
2534 app.writeToParcel(data, 0);
2535 data.writeInt(backupRestoreMode);
2536 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2537 reply.readException();
2538 boolean success = reply.readInt() != 0;
2539 reply.recycle();
2540 data.recycle();
2541 return success;
2542 }
2543
2544 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2545 Parcel data = Parcel.obtain();
2546 Parcel reply = Parcel.obtain();
2547 data.writeInterfaceToken(IActivityManager.descriptor);
2548 data.writeString(packageName);
2549 data.writeStrongBinder(agent);
2550 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2551 reply.recycle();
2552 data.recycle();
2553 }
2554
2555 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2556 Parcel data = Parcel.obtain();
2557 Parcel reply = Parcel.obtain();
2558 data.writeInterfaceToken(IActivityManager.descriptor);
2559 app.writeToParcel(data, 0);
2560 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2561 reply.readException();
2562 reply.recycle();
2563 data.recycle();
2564 }
2565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002566 public boolean startInstrumentation(ComponentName className, String profileFile,
2567 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2568 throws RemoteException {
2569 Parcel data = Parcel.obtain();
2570 Parcel reply = Parcel.obtain();
2571 data.writeInterfaceToken(IActivityManager.descriptor);
2572 ComponentName.writeToParcel(className, data);
2573 data.writeString(profileFile);
2574 data.writeInt(flags);
2575 data.writeBundle(arguments);
2576 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2577 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2578 reply.readException();
2579 boolean res = reply.readInt() != 0;
2580 reply.recycle();
2581 data.recycle();
2582 return res;
2583 }
2584
2585 public void finishInstrumentation(IApplicationThread target,
2586 int resultCode, Bundle results) throws RemoteException {
2587 Parcel data = Parcel.obtain();
2588 Parcel reply = Parcel.obtain();
2589 data.writeInterfaceToken(IActivityManager.descriptor);
2590 data.writeStrongBinder(target != null ? target.asBinder() : null);
2591 data.writeInt(resultCode);
2592 data.writeBundle(results);
2593 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2594 reply.readException();
2595 data.recycle();
2596 reply.recycle();
2597 }
2598 public Configuration getConfiguration() throws RemoteException
2599 {
2600 Parcel data = Parcel.obtain();
2601 Parcel reply = Parcel.obtain();
2602 data.writeInterfaceToken(IActivityManager.descriptor);
2603 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2604 reply.readException();
2605 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2606 reply.recycle();
2607 data.recycle();
2608 return res;
2609 }
2610 public void updateConfiguration(Configuration values) throws RemoteException
2611 {
2612 Parcel data = Parcel.obtain();
2613 Parcel reply = Parcel.obtain();
2614 data.writeInterfaceToken(IActivityManager.descriptor);
2615 values.writeToParcel(data, 0);
2616 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2617 reply.readException();
2618 data.recycle();
2619 reply.recycle();
2620 }
2621 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2622 throws RemoteException {
2623 Parcel data = Parcel.obtain();
2624 Parcel reply = Parcel.obtain();
2625 data.writeInterfaceToken(IActivityManager.descriptor);
2626 data.writeStrongBinder(token);
2627 data.writeInt(requestedOrientation);
2628 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2629 reply.readException();
2630 data.recycle();
2631 reply.recycle();
2632 }
2633 public int getRequestedOrientation(IBinder token) throws RemoteException {
2634 Parcel data = Parcel.obtain();
2635 Parcel reply = Parcel.obtain();
2636 data.writeInterfaceToken(IActivityManager.descriptor);
2637 data.writeStrongBinder(token);
2638 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2639 reply.readException();
2640 int res = reply.readInt();
2641 data.recycle();
2642 reply.recycle();
2643 return res;
2644 }
2645 public ComponentName getActivityClassForToken(IBinder token)
2646 throws RemoteException {
2647 Parcel data = Parcel.obtain();
2648 Parcel reply = Parcel.obtain();
2649 data.writeInterfaceToken(IActivityManager.descriptor);
2650 data.writeStrongBinder(token);
2651 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2652 reply.readException();
2653 ComponentName res = ComponentName.readFromParcel(reply);
2654 data.recycle();
2655 reply.recycle();
2656 return res;
2657 }
2658 public String getPackageForToken(IBinder token) throws RemoteException
2659 {
2660 Parcel data = Parcel.obtain();
2661 Parcel reply = Parcel.obtain();
2662 data.writeInterfaceToken(IActivityManager.descriptor);
2663 data.writeStrongBinder(token);
2664 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2665 reply.readException();
2666 String res = reply.readString();
2667 data.recycle();
2668 reply.recycle();
2669 return res;
2670 }
2671 public IIntentSender getIntentSender(int type,
2672 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002673 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
2674 Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002675 Parcel data = Parcel.obtain();
2676 Parcel reply = Parcel.obtain();
2677 data.writeInterfaceToken(IActivityManager.descriptor);
2678 data.writeInt(type);
2679 data.writeString(packageName);
2680 data.writeStrongBinder(token);
2681 data.writeString(resultWho);
2682 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002683 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002684 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002685 data.writeTypedArray(intents, 0);
2686 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002687 } else {
2688 data.writeInt(0);
2689 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002690 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002691 if (options != null) {
2692 data.writeInt(1);
2693 options.writeToParcel(data, 0);
2694 } else {
2695 data.writeInt(0);
2696 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002697 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2698 reply.readException();
2699 IIntentSender res = IIntentSender.Stub.asInterface(
2700 reply.readStrongBinder());
2701 data.recycle();
2702 reply.recycle();
2703 return res;
2704 }
2705 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2706 Parcel data = Parcel.obtain();
2707 Parcel reply = Parcel.obtain();
2708 data.writeInterfaceToken(IActivityManager.descriptor);
2709 data.writeStrongBinder(sender.asBinder());
2710 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2711 reply.readException();
2712 data.recycle();
2713 reply.recycle();
2714 }
2715 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2716 Parcel data = Parcel.obtain();
2717 Parcel reply = Parcel.obtain();
2718 data.writeInterfaceToken(IActivityManager.descriptor);
2719 data.writeStrongBinder(sender.asBinder());
2720 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2721 reply.readException();
2722 String res = reply.readString();
2723 data.recycle();
2724 reply.recycle();
2725 return res;
2726 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002727 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2728 Parcel data = Parcel.obtain();
2729 Parcel reply = Parcel.obtain();
2730 data.writeInterfaceToken(IActivityManager.descriptor);
2731 data.writeStrongBinder(sender.asBinder());
2732 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2733 reply.readException();
2734 int res = reply.readInt();
2735 data.recycle();
2736 reply.recycle();
2737 return res;
2738 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002739 public void setProcessLimit(int max) throws RemoteException
2740 {
2741 Parcel data = Parcel.obtain();
2742 Parcel reply = Parcel.obtain();
2743 data.writeInterfaceToken(IActivityManager.descriptor);
2744 data.writeInt(max);
2745 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2746 reply.readException();
2747 data.recycle();
2748 reply.recycle();
2749 }
2750 public int getProcessLimit() throws RemoteException
2751 {
2752 Parcel data = Parcel.obtain();
2753 Parcel reply = Parcel.obtain();
2754 data.writeInterfaceToken(IActivityManager.descriptor);
2755 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2756 reply.readException();
2757 int res = reply.readInt();
2758 data.recycle();
2759 reply.recycle();
2760 return res;
2761 }
2762 public void setProcessForeground(IBinder token, int pid,
2763 boolean isForeground) throws RemoteException {
2764 Parcel data = Parcel.obtain();
2765 Parcel reply = Parcel.obtain();
2766 data.writeInterfaceToken(IActivityManager.descriptor);
2767 data.writeStrongBinder(token);
2768 data.writeInt(pid);
2769 data.writeInt(isForeground ? 1 : 0);
2770 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2771 reply.readException();
2772 data.recycle();
2773 reply.recycle();
2774 }
2775 public int checkPermission(String permission, int pid, int uid)
2776 throws RemoteException {
2777 Parcel data = Parcel.obtain();
2778 Parcel reply = Parcel.obtain();
2779 data.writeInterfaceToken(IActivityManager.descriptor);
2780 data.writeString(permission);
2781 data.writeInt(pid);
2782 data.writeInt(uid);
2783 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2784 reply.readException();
2785 int res = reply.readInt();
2786 data.recycle();
2787 reply.recycle();
2788 return res;
2789 }
2790 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002791 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 data.writeString(packageName);
2796 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002797 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002798 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2799 reply.readException();
2800 boolean res = reply.readInt() != 0;
2801 data.recycle();
2802 reply.recycle();
2803 return res;
2804 }
2805 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2806 throws RemoteException {
2807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 uri.writeToParcel(data, 0);
2811 data.writeInt(pid);
2812 data.writeInt(uid);
2813 data.writeInt(mode);
2814 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2815 reply.readException();
2816 int res = reply.readInt();
2817 data.recycle();
2818 reply.recycle();
2819 return res;
2820 }
2821 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2822 Uri uri, int mode) throws RemoteException {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 data.writeStrongBinder(caller.asBinder());
2827 data.writeString(targetPkg);
2828 uri.writeToParcel(data, 0);
2829 data.writeInt(mode);
2830 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2831 reply.readException();
2832 data.recycle();
2833 reply.recycle();
2834 }
2835 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2836 int mode) throws RemoteException {
2837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeStrongBinder(caller.asBinder());
2841 uri.writeToParcel(data, 0);
2842 data.writeInt(mode);
2843 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2844 reply.readException();
2845 data.recycle();
2846 reply.recycle();
2847 }
2848 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2849 throws RemoteException {
2850 Parcel data = Parcel.obtain();
2851 Parcel reply = Parcel.obtain();
2852 data.writeInterfaceToken(IActivityManager.descriptor);
2853 data.writeStrongBinder(who.asBinder());
2854 data.writeInt(waiting ? 1 : 0);
2855 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2856 reply.readException();
2857 data.recycle();
2858 reply.recycle();
2859 }
2860 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2861 Parcel data = Parcel.obtain();
2862 Parcel reply = Parcel.obtain();
2863 data.writeInterfaceToken(IActivityManager.descriptor);
2864 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2865 reply.readException();
2866 outInfo.readFromParcel(reply);
2867 data.recycle();
2868 reply.recycle();
2869 }
2870 public void unhandledBack() throws RemoteException
2871 {
2872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2876 reply.readException();
2877 data.recycle();
2878 reply.recycle();
2879 }
2880 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2881 {
2882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
2884 data.writeInterfaceToken(IActivityManager.descriptor);
2885 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2886 reply.readException();
2887 ParcelFileDescriptor pfd = null;
2888 if (reply.readInt() != 0) {
2889 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2890 }
2891 data.recycle();
2892 reply.recycle();
2893 return pfd;
2894 }
2895 public void goingToSleep() throws RemoteException
2896 {
2897 Parcel data = Parcel.obtain();
2898 Parcel reply = Parcel.obtain();
2899 data.writeInterfaceToken(IActivityManager.descriptor);
2900 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 data.recycle();
2903 reply.recycle();
2904 }
2905 public void wakingUp() throws RemoteException
2906 {
2907 Parcel data = Parcel.obtain();
2908 Parcel reply = Parcel.obtain();
2909 data.writeInterfaceToken(IActivityManager.descriptor);
2910 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2911 reply.readException();
2912 data.recycle();
2913 reply.recycle();
2914 }
2915 public void setDebugApp(
2916 String packageName, boolean waitForDebugger, boolean persistent)
2917 throws RemoteException
2918 {
2919 Parcel data = Parcel.obtain();
2920 Parcel reply = Parcel.obtain();
2921 data.writeInterfaceToken(IActivityManager.descriptor);
2922 data.writeString(packageName);
2923 data.writeInt(waitForDebugger ? 1 : 0);
2924 data.writeInt(persistent ? 1 : 0);
2925 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2926 reply.readException();
2927 data.recycle();
2928 reply.recycle();
2929 }
2930 public void setAlwaysFinish(boolean enabled) throws RemoteException
2931 {
2932 Parcel data = Parcel.obtain();
2933 Parcel reply = Parcel.obtain();
2934 data.writeInterfaceToken(IActivityManager.descriptor);
2935 data.writeInt(enabled ? 1 : 0);
2936 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2937 reply.readException();
2938 data.recycle();
2939 reply.recycle();
2940 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002941 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002942 {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002947 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 reply.readException();
2949 data.recycle();
2950 reply.recycle();
2951 }
2952 public void enterSafeMode() throws RemoteException {
2953 Parcel data = Parcel.obtain();
2954 data.writeInterfaceToken(IActivityManager.descriptor);
2955 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2956 data.recycle();
2957 }
2958 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2959 Parcel data = Parcel.obtain();
2960 data.writeStrongBinder(sender.asBinder());
2961 data.writeInterfaceToken(IActivityManager.descriptor);
2962 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2963 data.recycle();
2964 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002965 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002966 Parcel data = Parcel.obtain();
2967 Parcel reply = Parcel.obtain();
2968 data.writeInterfaceToken(IActivityManager.descriptor);
2969 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002970 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002971 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002972 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 boolean res = reply.readInt() != 0;
2974 data.recycle();
2975 reply.recycle();
2976 return res;
2977 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07002978 @Override
2979 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 data.writeString(reason);
2984 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
2985 boolean res = reply.readInt() != 0;
2986 data.recycle();
2987 reply.recycle();
2988 return res;
2989 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002990 public void startRunning(String pkg, String cls, String action,
2991 String indata) throws RemoteException {
2992 Parcel data = Parcel.obtain();
2993 Parcel reply = Parcel.obtain();
2994 data.writeInterfaceToken(IActivityManager.descriptor);
2995 data.writeString(pkg);
2996 data.writeString(cls);
2997 data.writeString(action);
2998 data.writeString(indata);
2999 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3000 reply.readException();
3001 data.recycle();
3002 reply.recycle();
3003 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003004 public boolean testIsSystemReady()
3005 {
3006 /* this base class version is never called */
3007 return true;
3008 }
Dan Egnor60d87622009-12-16 16:32:58 -08003009 public void handleApplicationCrash(IBinder app,
3010 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3011 {
3012 Parcel data = Parcel.obtain();
3013 Parcel reply = Parcel.obtain();
3014 data.writeInterfaceToken(IActivityManager.descriptor);
3015 data.writeStrongBinder(app);
3016 crashInfo.writeToParcel(data, 0);
3017 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3018 reply.readException();
3019 reply.recycle();
3020 data.recycle();
3021 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003022
Dan Egnor60d87622009-12-16 16:32:58 -08003023 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003024 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003025 {
3026 Parcel data = Parcel.obtain();
3027 Parcel reply = Parcel.obtain();
3028 data.writeInterfaceToken(IActivityManager.descriptor);
3029 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003030 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003031 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003032 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003033 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003034 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003035 reply.recycle();
3036 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003037 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003038 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003039
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003040 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003041 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003042 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003043 {
3044 Parcel data = Parcel.obtain();
3045 Parcel reply = Parcel.obtain();
3046 data.writeInterfaceToken(IActivityManager.descriptor);
3047 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003048 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003049 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003050 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3051 reply.readException();
3052 reply.recycle();
3053 data.recycle();
3054 }
3055
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003056 public void signalPersistentProcesses(int sig) throws RemoteException {
3057 Parcel data = Parcel.obtain();
3058 Parcel reply = Parcel.obtain();
3059 data.writeInterfaceToken(IActivityManager.descriptor);
3060 data.writeInt(sig);
3061 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3062 reply.readException();
3063 data.recycle();
3064 reply.recycle();
3065 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003066
Dianne Hackborn03abb812010-01-04 18:43:19 -08003067 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003068 Parcel data = Parcel.obtain();
3069 Parcel reply = Parcel.obtain();
3070 data.writeInterfaceToken(IActivityManager.descriptor);
3071 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003072 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 data.recycle();
3075 reply.recycle();
3076 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003077
3078 public void killAllBackgroundProcesses() throws RemoteException {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3083 reply.readException();
3084 data.recycle();
3085 reply.recycle();
3086 }
3087
Dianne Hackborn03abb812010-01-04 18:43:19 -08003088 public void forceStopPackage(String packageName) throws RemoteException {
3089 Parcel data = Parcel.obtain();
3090 Parcel reply = Parcel.obtain();
3091 data.writeInterfaceToken(IActivityManager.descriptor);
3092 data.writeString(packageName);
3093 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003094 reply.readException();
3095 data.recycle();
3096 reply.recycle();
3097 }
3098
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003099 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3100 throws RemoteException
3101 {
3102 Parcel data = Parcel.obtain();
3103 Parcel reply = Parcel.obtain();
3104 data.writeInterfaceToken(IActivityManager.descriptor);
3105 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3106 reply.readException();
3107 outInfo.readFromParcel(reply);
3108 reply.recycle();
3109 data.recycle();
3110 }
3111
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003112 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3113 {
3114 Parcel data = Parcel.obtain();
3115 Parcel reply = Parcel.obtain();
3116 data.writeInterfaceToken(IActivityManager.descriptor);
3117 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3118 reply.readException();
3119 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3120 reply.recycle();
3121 data.recycle();
3122 return res;
3123 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003124
3125 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003126 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003127 {
3128 Parcel data = Parcel.obtain();
3129 Parcel reply = Parcel.obtain();
3130 data.writeInterfaceToken(IActivityManager.descriptor);
3131 data.writeString(process);
3132 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003133 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003134 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003135 if (fd != null) {
3136 data.writeInt(1);
3137 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3138 } else {
3139 data.writeInt(0);
3140 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003141 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3142 reply.readException();
3143 boolean res = reply.readInt() != 0;
3144 reply.recycle();
3145 data.recycle();
3146 return res;
3147 }
3148
Dianne Hackborn55280a92009-05-07 15:53:46 -07003149 public boolean shutdown(int timeout) throws RemoteException
3150 {
3151 Parcel data = Parcel.obtain();
3152 Parcel reply = Parcel.obtain();
3153 data.writeInterfaceToken(IActivityManager.descriptor);
3154 data.writeInt(timeout);
3155 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3156 reply.readException();
3157 boolean res = reply.readInt() != 0;
3158 reply.recycle();
3159 data.recycle();
3160 return res;
3161 }
3162
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003163 public void stopAppSwitches() throws RemoteException {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3168 reply.readException();
3169 reply.recycle();
3170 data.recycle();
3171 }
3172
3173 public void resumeAppSwitches() throws RemoteException {
3174 Parcel data = Parcel.obtain();
3175 Parcel reply = Parcel.obtain();
3176 data.writeInterfaceToken(IActivityManager.descriptor);
3177 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 reply.recycle();
3180 data.recycle();
3181 }
3182
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003183 public int startActivityInPackage(int uid,
3184 Intent intent, String resolvedType, IBinder resultTo,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003185 String resultWho, int requestCode, int startFlags, Bundle options)
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003186 throws RemoteException {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 data.writeInt(uid);
3191 intent.writeToParcel(data, 0);
3192 data.writeString(resolvedType);
3193 data.writeStrongBinder(resultTo);
3194 data.writeString(resultWho);
3195 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003196 data.writeInt(startFlags);
3197 if (options != null) {
3198 data.writeInt(1);
3199 options.writeToParcel(data, 0);
3200 } else {
3201 data.writeInt(0);
3202 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003203 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3204 reply.readException();
3205 int result = reply.readInt();
3206 reply.recycle();
3207 data.recycle();
3208 return result;
3209 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003210
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003211 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeString(pkg);
3216 data.writeInt(uid);
3217 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3218 reply.readException();
3219 data.recycle();
3220 reply.recycle();
3221 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003222
3223 public void closeSystemDialogs(String reason) throws RemoteException {
3224 Parcel data = Parcel.obtain();
3225 Parcel reply = Parcel.obtain();
3226 data.writeInterfaceToken(IActivityManager.descriptor);
3227 data.writeString(reason);
3228 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3229 reply.readException();
3230 data.recycle();
3231 reply.recycle();
3232 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003233
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003234 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003235 throws RemoteException {
3236 Parcel data = Parcel.obtain();
3237 Parcel reply = Parcel.obtain();
3238 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003239 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003240 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3241 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003242 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003243 data.recycle();
3244 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003245 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003246 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003247
3248 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3249 Parcel data = Parcel.obtain();
3250 Parcel reply = Parcel.obtain();
3251 data.writeInterfaceToken(IActivityManager.descriptor);
3252 data.writeString(processName);
3253 data.writeInt(uid);
3254 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3255 reply.readException();
3256 data.recycle();
3257 reply.recycle();
3258 }
3259
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003260 public void overridePendingTransition(IBinder token, String packageName,
3261 int enterAnim, int exitAnim) throws RemoteException {
3262 Parcel data = Parcel.obtain();
3263 Parcel reply = Parcel.obtain();
3264 data.writeInterfaceToken(IActivityManager.descriptor);
3265 data.writeStrongBinder(token);
3266 data.writeString(packageName);
3267 data.writeInt(enterAnim);
3268 data.writeInt(exitAnim);
3269 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3270 reply.readException();
3271 data.recycle();
3272 reply.recycle();
3273 }
3274
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003275 public boolean isUserAMonkey() throws RemoteException {
3276 Parcel data = Parcel.obtain();
3277 Parcel reply = Parcel.obtain();
3278 data.writeInterfaceToken(IActivityManager.descriptor);
3279 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3280 reply.readException();
3281 boolean res = reply.readInt() != 0;
3282 data.recycle();
3283 reply.recycle();
3284 return res;
3285 }
3286
Dianne Hackborn860755f2010-06-03 18:47:52 -07003287 public void finishHeavyWeightApp() throws RemoteException {
3288 Parcel data = Parcel.obtain();
3289 Parcel reply = Parcel.obtain();
3290 data.writeInterfaceToken(IActivityManager.descriptor);
3291 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3292 reply.readException();
3293 data.recycle();
3294 reply.recycle();
3295 }
3296
Daniel Sandler69a48172010-06-23 16:29:36 -04003297 public void setImmersive(IBinder token, boolean immersive)
3298 throws RemoteException {
3299 Parcel data = Parcel.obtain();
3300 Parcel reply = Parcel.obtain();
3301 data.writeInterfaceToken(IActivityManager.descriptor);
3302 data.writeStrongBinder(token);
3303 data.writeInt(immersive ? 1 : 0);
3304 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3305 reply.readException();
3306 data.recycle();
3307 reply.recycle();
3308 }
3309
3310 public boolean isImmersive(IBinder token)
3311 throws RemoteException {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 data.writeStrongBinder(token);
3316 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003317 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003318 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003319 data.recycle();
3320 reply.recycle();
3321 return res;
3322 }
3323
3324 public boolean isTopActivityImmersive()
3325 throws RemoteException {
3326 Parcel data = Parcel.obtain();
3327 Parcel reply = Parcel.obtain();
3328 data.writeInterfaceToken(IActivityManager.descriptor);
3329 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003330 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003331 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003332 data.recycle();
3333 reply.recycle();
3334 return res;
3335 }
3336
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003337 public void crashApplication(int uid, int initialPid, String packageName,
3338 String message) throws RemoteException {
3339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 data.writeInt(uid);
3343 data.writeInt(initialPid);
3344 data.writeString(packageName);
3345 data.writeString(message);
3346 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3347 reply.readException();
3348 data.recycle();
3349 reply.recycle();
3350 }
Andy McFadden824c5102010-07-09 16:26:57 -07003351
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003352 public String getProviderMimeType(Uri uri)
3353 throws RemoteException {
3354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
3356 data.writeInterfaceToken(IActivityManager.descriptor);
3357 uri.writeToParcel(data, 0);
3358 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3359 reply.readException();
3360 String res = reply.readString();
3361 data.recycle();
3362 reply.recycle();
3363 return res;
3364 }
3365
Dianne Hackborn7e269642010-08-25 19:50:20 -07003366 public IBinder newUriPermissionOwner(String name)
3367 throws RemoteException {
3368 Parcel data = Parcel.obtain();
3369 Parcel reply = Parcel.obtain();
3370 data.writeInterfaceToken(IActivityManager.descriptor);
3371 data.writeString(name);
3372 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3373 reply.readException();
3374 IBinder res = reply.readStrongBinder();
3375 data.recycle();
3376 reply.recycle();
3377 return res;
3378 }
3379
3380 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3381 Uri uri, int mode) throws RemoteException {
3382 Parcel data = Parcel.obtain();
3383 Parcel reply = Parcel.obtain();
3384 data.writeInterfaceToken(IActivityManager.descriptor);
3385 data.writeStrongBinder(owner);
3386 data.writeInt(fromUid);
3387 data.writeString(targetPkg);
3388 uri.writeToParcel(data, 0);
3389 data.writeInt(mode);
3390 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3391 reply.readException();
3392 data.recycle();
3393 reply.recycle();
3394 }
3395
3396 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3397 int mode) throws RemoteException {
3398 Parcel data = Parcel.obtain();
3399 Parcel reply = Parcel.obtain();
3400 data.writeInterfaceToken(IActivityManager.descriptor);
3401 data.writeStrongBinder(owner);
3402 if (uri != null) {
3403 data.writeInt(1);
3404 uri.writeToParcel(data, 0);
3405 } else {
3406 data.writeInt(0);
3407 }
3408 data.writeInt(mode);
3409 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 data.recycle();
3412 reply.recycle();
3413 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003414
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003415 public int checkGrantUriPermission(int callingUid, String targetPkg,
3416 Uri uri, int modeFlags) throws RemoteException {
3417 Parcel data = Parcel.obtain();
3418 Parcel reply = Parcel.obtain();
3419 data.writeInterfaceToken(IActivityManager.descriptor);
3420 data.writeInt(callingUid);
3421 data.writeString(targetPkg);
3422 uri.writeToParcel(data, 0);
3423 data.writeInt(modeFlags);
3424 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3425 reply.readException();
3426 int res = reply.readInt();
3427 data.recycle();
3428 reply.recycle();
3429 return res;
3430 }
3431
Andy McFadden824c5102010-07-09 16:26:57 -07003432 public boolean dumpHeap(String process, boolean managed,
3433 String path, ParcelFileDescriptor fd) throws RemoteException {
3434 Parcel data = Parcel.obtain();
3435 Parcel reply = Parcel.obtain();
3436 data.writeInterfaceToken(IActivityManager.descriptor);
3437 data.writeString(process);
3438 data.writeInt(managed ? 1 : 0);
3439 data.writeString(path);
3440 if (fd != null) {
3441 data.writeInt(1);
3442 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3443 } else {
3444 data.writeInt(0);
3445 }
3446 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3447 reply.readException();
3448 boolean res = reply.readInt() != 0;
3449 reply.recycle();
3450 data.recycle();
3451 return res;
3452 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003453
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003454 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003455 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3456 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3461 data.writeTypedArray(intents, 0);
3462 data.writeStringArray(resolvedTypes);
3463 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003464 if (options != null) {
3465 data.writeInt(1);
3466 options.writeToParcel(data, 0);
3467 } else {
3468 data.writeInt(0);
3469 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003470 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3471 reply.readException();
3472 int result = reply.readInt();
3473 reply.recycle();
3474 data.recycle();
3475 return result;
3476 }
3477
3478 public int startActivitiesInPackage(int uid,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003479 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3480 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003481 Parcel data = Parcel.obtain();
3482 Parcel reply = Parcel.obtain();
3483 data.writeInterfaceToken(IActivityManager.descriptor);
3484 data.writeInt(uid);
3485 data.writeTypedArray(intents, 0);
3486 data.writeStringArray(resolvedTypes);
3487 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003488 if (options != null) {
3489 data.writeInt(1);
3490 options.writeToParcel(data, 0);
3491 } else {
3492 data.writeInt(0);
3493 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003494 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 int result = reply.readInt();
3497 reply.recycle();
3498 data.recycle();
3499 return result;
3500 }
3501
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003502 public int getFrontActivityScreenCompatMode() throws RemoteException {
3503 Parcel data = Parcel.obtain();
3504 Parcel reply = Parcel.obtain();
3505 data.writeInterfaceToken(IActivityManager.descriptor);
3506 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 int mode = reply.readInt();
3509 reply.recycle();
3510 data.recycle();
3511 return mode;
3512 }
3513
3514 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeInt(mode);
3519 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 reply.recycle();
3522 data.recycle();
3523 }
3524
3525 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3526 Parcel data = Parcel.obtain();
3527 Parcel reply = Parcel.obtain();
3528 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003529 data.writeString(packageName);
3530 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003531 reply.readException();
3532 int mode = reply.readInt();
3533 reply.recycle();
3534 data.recycle();
3535 return mode;
3536 }
3537
3538 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003539 throws RemoteException {
3540 Parcel data = Parcel.obtain();
3541 Parcel reply = Parcel.obtain();
3542 data.writeInterfaceToken(IActivityManager.descriptor);
3543 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003544 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003545 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3546 reply.readException();
3547 reply.recycle();
3548 data.recycle();
3549 }
3550
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003551 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3552 Parcel data = Parcel.obtain();
3553 Parcel reply = Parcel.obtain();
3554 data.writeInterfaceToken(IActivityManager.descriptor);
3555 data.writeString(packageName);
3556 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3557 reply.readException();
3558 boolean ask = reply.readInt() != 0;
3559 reply.recycle();
3560 data.recycle();
3561 return ask;
3562 }
3563
3564 public void setPackageAskScreenCompat(String packageName, boolean ask)
3565 throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeString(packageName);
3570 data.writeInt(ask ? 1 : 0);
3571 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3572 reply.readException();
3573 reply.recycle();
3574 data.recycle();
3575 }
3576
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003577 public boolean switchUser(int userid) throws RemoteException {
3578 Parcel data = Parcel.obtain();
3579 Parcel reply = Parcel.obtain();
3580 data.writeInterfaceToken(IActivityManager.descriptor);
3581 data.writeInt(userid);
3582 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3583 reply.readException();
3584 boolean result = reply.readInt() != 0;
3585 reply.recycle();
3586 data.recycle();
3587 return result;
3588 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003589
3590 public UserInfo getCurrentUser() throws RemoteException {
3591 Parcel data = Parcel.obtain();
3592 Parcel reply = Parcel.obtain();
3593 data.writeInterfaceToken(IActivityManager.descriptor);
3594 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3595 reply.readException();
3596 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3597 reply.recycle();
3598 data.recycle();
3599 return userInfo;
3600 }
3601
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003602 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3603 Parcel data = Parcel.obtain();
3604 Parcel reply = Parcel.obtain();
3605 data.writeInterfaceToken(IActivityManager.descriptor);
3606 data.writeInt(taskId);
3607 data.writeInt(subTaskIndex);
3608 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3609 reply.readException();
3610 boolean result = reply.readInt() != 0;
3611 reply.recycle();
3612 data.recycle();
3613 return result;
3614 }
3615
3616 public boolean removeTask(int taskId, int flags) throws RemoteException {
3617 Parcel data = Parcel.obtain();
3618 Parcel reply = Parcel.obtain();
3619 data.writeInterfaceToken(IActivityManager.descriptor);
3620 data.writeInt(taskId);
3621 data.writeInt(flags);
3622 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3623 reply.readException();
3624 boolean result = reply.readInt() != 0;
3625 reply.recycle();
3626 data.recycle();
3627 return result;
3628 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003629
Jeff Sharkeya4620792011-05-20 15:29:23 -07003630 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3635 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3636 reply.readException();
3637 data.recycle();
3638 reply.recycle();
3639 }
3640
3641 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3642 Parcel data = Parcel.obtain();
3643 Parcel reply = Parcel.obtain();
3644 data.writeInterfaceToken(IActivityManager.descriptor);
3645 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3646 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 data.recycle();
3649 reply.recycle();
3650 }
3651
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003652 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 data.writeStrongBinder(sender.asBinder());
3657 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 boolean res = reply.readInt() != 0;
3660 data.recycle();
3661 reply.recycle();
3662 return res;
3663 }
3664
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003665 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3666 {
3667 Parcel data = Parcel.obtain();
3668 Parcel reply = Parcel.obtain();
3669 data.writeInterfaceToken(IActivityManager.descriptor);
3670 values.writeToParcel(data, 0);
3671 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3672 reply.readException();
3673 data.recycle();
3674 reply.recycle();
3675 }
3676
Dianne Hackbornb437e092011-08-05 17:50:29 -07003677 public long[] getProcessPss(int[] pids) throws RemoteException {
3678 Parcel data = Parcel.obtain();
3679 Parcel reply = Parcel.obtain();
3680 data.writeInterfaceToken(IActivityManager.descriptor);
3681 data.writeIntArray(pids);
3682 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3683 reply.readException();
3684 long[] res = reply.createLongArray();
3685 data.recycle();
3686 reply.recycle();
3687 return res;
3688 }
3689
Dianne Hackborn661cd522011-08-22 00:26:20 -07003690 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3691 Parcel data = Parcel.obtain();
3692 Parcel reply = Parcel.obtain();
3693 data.writeInterfaceToken(IActivityManager.descriptor);
3694 TextUtils.writeToParcel(msg, data, 0);
3695 data.writeInt(always ? 1 : 0);
3696 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3697 reply.readException();
3698 data.recycle();
3699 reply.recycle();
3700 }
3701
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003702 public void dismissKeyguardOnNextActivity() throws RemoteException {
3703 Parcel data = Parcel.obtain();
3704 Parcel reply = Parcel.obtain();
3705 data.writeInterfaceToken(IActivityManager.descriptor);
3706 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3707 reply.readException();
3708 data.recycle();
3709 reply.recycle();
3710 }
3711
Adam Powelldd8fab22012-03-22 17:47:27 -07003712 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3713 throws RemoteException {
3714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 data.writeStrongBinder(token);
3718 data.writeString(destAffinity);
3719 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3720 reply.readException();
3721 boolean result = reply.readInt() != 0;
3722 data.recycle();
3723 reply.recycle();
3724 return result;
3725 }
3726
3727 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3728 throws RemoteException {
3729 Parcel data = Parcel.obtain();
3730 Parcel reply = Parcel.obtain();
3731 data.writeInterfaceToken(IActivityManager.descriptor);
3732 data.writeStrongBinder(token);
3733 target.writeToParcel(data, 0);
3734 data.writeInt(resultCode);
3735 if (resultData != null) {
3736 data.writeInt(1);
3737 resultData.writeToParcel(data, 0);
3738 } else {
3739 data.writeInt(0);
3740 }
3741 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3742 reply.readException();
3743 boolean result = reply.readInt() != 0;
3744 data.recycle();
3745 reply.recycle();
3746 return result;
3747 }
3748
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003749 private IBinder mRemote;
3750}