blob: 000abc5f975af38cd9dcdd2f3f601365304ec963 [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
870 case SET_PROCESS_LIMIT_TRANSACTION: {
871 data.enforceInterface(IActivityManager.descriptor);
872 int max = data.readInt();
873 setProcessLimit(max);
874 reply.writeNoException();
875 return true;
876 }
877
878 case GET_PROCESS_LIMIT_TRANSACTION: {
879 data.enforceInterface(IActivityManager.descriptor);
880 int limit = getProcessLimit();
881 reply.writeNoException();
882 reply.writeInt(limit);
883 return true;
884 }
885
886 case SET_PROCESS_FOREGROUND_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 IBinder token = data.readStrongBinder();
889 int pid = data.readInt();
890 boolean isForeground = data.readInt() != 0;
891 setProcessForeground(token, pid, isForeground);
892 reply.writeNoException();
893 return true;
894 }
895
896 case CHECK_PERMISSION_TRANSACTION: {
897 data.enforceInterface(IActivityManager.descriptor);
898 String perm = data.readString();
899 int pid = data.readInt();
900 int uid = data.readInt();
901 int res = checkPermission(perm, pid, uid);
902 reply.writeNoException();
903 reply.writeInt(res);
904 return true;
905 }
906
907 case CHECK_URI_PERMISSION_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 Uri uri = Uri.CREATOR.createFromParcel(data);
910 int pid = data.readInt();
911 int uid = data.readInt();
912 int mode = data.readInt();
913 int res = checkUriPermission(uri, pid, uid, mode);
914 reply.writeNoException();
915 reply.writeInt(res);
916 return true;
917 }
918
919 case CLEAR_APP_DATA_TRANSACTION: {
920 data.enforceInterface(IActivityManager.descriptor);
921 String packageName = data.readString();
922 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
923 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -0700924 int userId = data.readInt();
925 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 reply.writeNoException();
927 reply.writeInt(res ? 1 : 0);
928 return true;
929 }
930
931 case GRANT_URI_PERMISSION_TRANSACTION: {
932 data.enforceInterface(IActivityManager.descriptor);
933 IBinder b = data.readStrongBinder();
934 IApplicationThread app = ApplicationThreadNative.asInterface(b);
935 String targetPkg = data.readString();
936 Uri uri = Uri.CREATOR.createFromParcel(data);
937 int mode = data.readInt();
938 grantUriPermission(app, targetPkg, uri, mode);
939 reply.writeNoException();
940 return true;
941 }
942
943 case REVOKE_URI_PERMISSION_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 IBinder b = data.readStrongBinder();
946 IApplicationThread app = ApplicationThreadNative.asInterface(b);
947 Uri uri = Uri.CREATOR.createFromParcel(data);
948 int mode = data.readInt();
949 revokeUriPermission(app, uri, mode);
950 reply.writeNoException();
951 return true;
952 }
953
954 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
955 data.enforceInterface(IActivityManager.descriptor);
956 IBinder b = data.readStrongBinder();
957 IApplicationThread app = ApplicationThreadNative.asInterface(b);
958 boolean waiting = data.readInt() != 0;
959 showWaitingForDebugger(app, waiting);
960 reply.writeNoException();
961 return true;
962 }
963
964 case GET_MEMORY_INFO_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
967 getMemoryInfo(mi);
968 reply.writeNoException();
969 mi.writeToParcel(reply, 0);
970 return true;
971 }
972
973 case UNHANDLED_BACK_TRANSACTION: {
974 data.enforceInterface(IActivityManager.descriptor);
975 unhandledBack();
976 reply.writeNoException();
977 return true;
978 }
979
980 case OPEN_CONTENT_URI_TRANSACTION: {
981 data.enforceInterface(IActivityManager.descriptor);
982 Uri uri = Uri.parse(data.readString());
983 ParcelFileDescriptor pfd = openContentUri(uri);
984 reply.writeNoException();
985 if (pfd != null) {
986 reply.writeInt(1);
987 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
988 } else {
989 reply.writeInt(0);
990 }
991 return true;
992 }
993
994 case GOING_TO_SLEEP_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 goingToSleep();
997 reply.writeNoException();
998 return true;
999 }
1000
1001 case WAKING_UP_TRANSACTION: {
1002 data.enforceInterface(IActivityManager.descriptor);
1003 wakingUp();
1004 reply.writeNoException();
1005 return true;
1006 }
1007
1008 case SET_DEBUG_APP_TRANSACTION: {
1009 data.enforceInterface(IActivityManager.descriptor);
1010 String pn = data.readString();
1011 boolean wfd = data.readInt() != 0;
1012 boolean per = data.readInt() != 0;
1013 setDebugApp(pn, wfd, per);
1014 reply.writeNoException();
1015 return true;
1016 }
1017
1018 case SET_ALWAYS_FINISH_TRANSACTION: {
1019 data.enforceInterface(IActivityManager.descriptor);
1020 boolean enabled = data.readInt() != 0;
1021 setAlwaysFinish(enabled);
1022 reply.writeNoException();
1023 return true;
1024 }
1025
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001026 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001027 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001028 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001029 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001030 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001031 return true;
1032 }
1033
1034 case ENTER_SAFE_MODE_TRANSACTION: {
1035 data.enforceInterface(IActivityManager.descriptor);
1036 enterSafeMode();
1037 reply.writeNoException();
1038 return true;
1039 }
1040
1041 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1042 data.enforceInterface(IActivityManager.descriptor);
1043 IIntentSender is = IIntentSender.Stub.asInterface(
1044 data.readStrongBinder());
1045 noteWakeupAlarm(is);
1046 reply.writeNoException();
1047 return true;
1048 }
1049
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001050 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001051 data.enforceInterface(IActivityManager.descriptor);
1052 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001053 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001054 boolean secure = data.readInt() != 0;
1055 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001056 reply.writeNoException();
1057 reply.writeInt(res ? 1 : 0);
1058 return true;
1059 }
1060
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001061 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 String reason = data.readString();
1064 boolean res = killProcessesBelowForeground(reason);
1065 reply.writeNoException();
1066 reply.writeInt(res ? 1 : 0);
1067 return true;
1068 }
1069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001070 case START_RUNNING_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 String pkg = data.readString();
1073 String cls = data.readString();
1074 String action = data.readString();
1075 String indata = data.readString();
1076 startRunning(pkg, cls, action, indata);
1077 reply.writeNoException();
1078 return true;
1079 }
1080
Dan Egnor60d87622009-12-16 16:32:58 -08001081 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1082 data.enforceInterface(IActivityManager.descriptor);
1083 IBinder app = data.readStrongBinder();
1084 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1085 handleApplicationCrash(app, ci);
1086 reply.writeNoException();
1087 return true;
1088 }
1089
1090 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 data.enforceInterface(IActivityManager.descriptor);
1092 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001093 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001094 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001095 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001096 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001097 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 return true;
1099 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001100
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001101 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1102 data.enforceInterface(IActivityManager.descriptor);
1103 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001104 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001105 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1106 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001107 reply.writeNoException();
1108 return true;
1109 }
1110
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001111 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 int sig = data.readInt();
1114 signalPersistentProcesses(sig);
1115 reply.writeNoException();
1116 return true;
1117 }
1118
Dianne Hackborn03abb812010-01-04 18:43:19 -08001119 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001121 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001122 killBackgroundProcesses(packageName);
1123 reply.writeNoException();
1124 return true;
1125 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001126
1127 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 killAllBackgroundProcesses();
1130 reply.writeNoException();
1131 return true;
1132 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001133
1134 case FORCE_STOP_PACKAGE_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 String packageName = data.readString();
1137 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 reply.writeNoException();
1139 return true;
1140 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001141
1142 case GET_MY_MEMORY_STATE_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 ActivityManager.RunningAppProcessInfo info =
1145 new ActivityManager.RunningAppProcessInfo();
1146 getMyMemoryState(info);
1147 reply.writeNoException();
1148 info.writeToParcel(reply, 0);
1149 return true;
1150 }
1151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 ConfigurationInfo config = getDeviceConfigurationInfo();
1155 reply.writeNoException();
1156 config.writeToParcel(reply, 0);
1157 return true;
1158 }
1159
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001160 case PROFILE_CONTROL_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 String process = data.readString();
1163 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001164 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001165 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001166 ParcelFileDescriptor fd = data.readInt() != 0
1167 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001168 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001169 reply.writeNoException();
1170 reply.writeInt(res ? 1 : 0);
1171 return true;
1172 }
1173
Dianne Hackborn55280a92009-05-07 15:53:46 -07001174 case SHUTDOWN_TRANSACTION: {
1175 data.enforceInterface(IActivityManager.descriptor);
1176 boolean res = shutdown(data.readInt());
1177 reply.writeNoException();
1178 reply.writeInt(res ? 1 : 0);
1179 return true;
1180 }
1181
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001182 case STOP_APP_SWITCHES_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 stopAppSwitches();
1185 reply.writeNoException();
1186 return true;
1187 }
1188
1189 case RESUME_APP_SWITCHES_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 resumeAppSwitches();
1192 reply.writeNoException();
1193 return true;
1194 }
1195
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 case PEEK_SERVICE_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 Intent service = Intent.CREATOR.createFromParcel(data);
1199 String resolvedType = data.readString();
1200 IBinder binder = peekService(service, resolvedType);
1201 reply.writeNoException();
1202 reply.writeStrongBinder(binder);
1203 return true;
1204 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001205
1206 case START_BACKUP_AGENT_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1209 int backupRestoreMode = data.readInt();
1210 boolean success = bindBackupAgent(info, backupRestoreMode);
1211 reply.writeNoException();
1212 reply.writeInt(success ? 1 : 0);
1213 return true;
1214 }
1215
1216 case BACKUP_AGENT_CREATED_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 String packageName = data.readString();
1219 IBinder agent = data.readStrongBinder();
1220 backupAgentCreated(packageName, agent);
1221 reply.writeNoException();
1222 return true;
1223 }
1224
1225 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1228 unbindBackupAgent(info);
1229 reply.writeNoException();
1230 return true;
1231 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001232
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001233 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1234 {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 int uid = data.readInt();
1237 Intent intent = Intent.CREATOR.createFromParcel(data);
1238 String resolvedType = data.readString();
1239 IBinder resultTo = data.readStrongBinder();
1240 String resultWho = data.readString();
1241 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001242 int startFlags = data.readInt();
1243 Bundle options = data.readInt() != 0
1244 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001245 int result = startActivityInPackage(uid, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001246 resultTo, resultWho, requestCode, startFlags, options);
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001247 reply.writeNoException();
1248 reply.writeInt(result);
1249 return true;
1250 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001251
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001252 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1253 data.enforceInterface(IActivityManager.descriptor);
1254 String pkg = data.readString();
1255 int uid = data.readInt();
1256 killApplicationWithUid(pkg, uid);
1257 reply.writeNoException();
1258 return true;
1259 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001260
1261 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 String reason = data.readString();
1264 closeSystemDialogs(reason);
1265 reply.writeNoException();
1266 return true;
1267 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001268
1269 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1270 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001271 int[] pids = data.createIntArray();
1272 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001273 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001274 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001275 return true;
1276 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001277
1278 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1279 data.enforceInterface(IActivityManager.descriptor);
1280 String processName = data.readString();
1281 int uid = data.readInt();
1282 killApplicationProcess(processName, uid);
1283 reply.writeNoException();
1284 return true;
1285 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001286
1287 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
1289 IBinder token = data.readStrongBinder();
1290 String packageName = data.readString();
1291 int enterAnim = data.readInt();
1292 int exitAnim = data.readInt();
1293 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001294 reply.writeNoException();
1295 return true;
1296 }
1297
1298 case IS_USER_A_MONKEY_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001300 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001301 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001302 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001303 return true;
1304 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001305
1306 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 finishHeavyWeightApp();
1309 reply.writeNoException();
1310 return true;
1311 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001312
1313 case IS_IMMERSIVE_TRANSACTION: {
1314 data.enforceInterface(IActivityManager.descriptor);
1315 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001316 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001317 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001318 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001319 return true;
1320 }
1321
1322 case SET_IMMERSIVE_TRANSACTION: {
1323 data.enforceInterface(IActivityManager.descriptor);
1324 IBinder token = data.readStrongBinder();
1325 boolean imm = data.readInt() == 1;
1326 setImmersive(token, imm);
1327 reply.writeNoException();
1328 return true;
1329 }
1330
1331 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001333 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001334 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001335 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001336 return true;
1337 }
1338
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001339 case CRASH_APPLICATION_TRANSACTION: {
1340 data.enforceInterface(IActivityManager.descriptor);
1341 int uid = data.readInt();
1342 int initialPid = data.readInt();
1343 String packageName = data.readString();
1344 String message = data.readString();
1345 crashApplication(uid, initialPid, packageName, message);
1346 reply.writeNoException();
1347 return true;
1348 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001349
1350 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 Uri uri = Uri.CREATOR.createFromParcel(data);
1353 String type = getProviderMimeType(uri);
1354 reply.writeNoException();
1355 reply.writeString(type);
1356 return true;
1357 }
1358
Dianne Hackborn7e269642010-08-25 19:50:20 -07001359 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1360 data.enforceInterface(IActivityManager.descriptor);
1361 String name = data.readString();
1362 IBinder perm = newUriPermissionOwner(name);
1363 reply.writeNoException();
1364 reply.writeStrongBinder(perm);
1365 return true;
1366 }
1367
1368 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1369 data.enforceInterface(IActivityManager.descriptor);
1370 IBinder owner = data.readStrongBinder();
1371 int fromUid = data.readInt();
1372 String targetPkg = data.readString();
1373 Uri uri = Uri.CREATOR.createFromParcel(data);
1374 int mode = data.readInt();
1375 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1376 reply.writeNoException();
1377 return true;
1378 }
1379
1380 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 IBinder owner = data.readStrongBinder();
1383 Uri uri = null;
1384 if (data.readInt() != 0) {
1385 Uri.CREATOR.createFromParcel(data);
1386 }
1387 int mode = data.readInt();
1388 revokeUriPermissionFromOwner(owner, uri, mode);
1389 reply.writeNoException();
1390 return true;
1391 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001392
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001393 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1394 data.enforceInterface(IActivityManager.descriptor);
1395 int callingUid = data.readInt();
1396 String targetPkg = data.readString();
1397 Uri uri = Uri.CREATOR.createFromParcel(data);
1398 int modeFlags = data.readInt();
1399 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1400 reply.writeNoException();
1401 reply.writeInt(res);
1402 return true;
1403 }
1404
Andy McFadden824c5102010-07-09 16:26:57 -07001405 case DUMP_HEAP_TRANSACTION: {
1406 data.enforceInterface(IActivityManager.descriptor);
1407 String process = data.readString();
1408 boolean managed = data.readInt() != 0;
1409 String path = data.readString();
1410 ParcelFileDescriptor fd = data.readInt() != 0
1411 ? data.readFileDescriptor() : null;
1412 boolean res = dumpHeap(process, managed, path, fd);
1413 reply.writeNoException();
1414 reply.writeInt(res ? 1 : 0);
1415 return true;
1416 }
1417
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001418 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1419 {
1420 data.enforceInterface(IActivityManager.descriptor);
1421 int uid = data.readInt();
1422 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1423 String[] resolvedTypes = data.createStringArray();
1424 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001425 Bundle options = data.readInt() != 0
1426 ? Bundle.CREATOR.createFromParcel(data) : null;
1427 int result = startActivitiesInPackage(uid, intents, resolvedTypes,
1428 resultTo, options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001429 reply.writeNoException();
1430 reply.writeInt(result);
1431 return true;
1432 }
1433
1434 case START_ACTIVITIES_TRANSACTION:
1435 {
1436 data.enforceInterface(IActivityManager.descriptor);
1437 IBinder b = data.readStrongBinder();
1438 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1439 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1440 String[] resolvedTypes = data.createStringArray();
1441 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001442 Bundle options = data.readInt() != 0
1443 ? Bundle.CREATOR.createFromParcel(data) : null;
1444 int result = startActivities(app, intents, resolvedTypes, resultTo,
1445 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001446 reply.writeNoException();
1447 reply.writeInt(result);
1448 return true;
1449 }
1450
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001451 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1452 {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 int mode = getFrontActivityScreenCompatMode();
1455 reply.writeNoException();
1456 reply.writeInt(mode);
1457 return true;
1458 }
1459
1460 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1461 {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 int mode = data.readInt();
1464 setFrontActivityScreenCompatMode(mode);
1465 reply.writeNoException();
1466 reply.writeInt(mode);
1467 return true;
1468 }
1469
1470 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1471 {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 String pkg = data.readString();
1474 int mode = getPackageScreenCompatMode(pkg);
1475 reply.writeNoException();
1476 reply.writeInt(mode);
1477 return true;
1478 }
1479
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001480 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1481 {
1482 data.enforceInterface(IActivityManager.descriptor);
1483 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001484 int mode = data.readInt();
1485 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001486 reply.writeNoException();
1487 return true;
1488 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001489
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001490 case SWITCH_USER_TRANSACTION: {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 int userid = data.readInt();
1493 boolean result = switchUser(userid);
1494 reply.writeNoException();
1495 reply.writeInt(result ? 1 : 0);
1496 return true;
1497 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001498
1499 case GET_CURRENT_USER_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 UserInfo userInfo = getCurrentUser();
1502 reply.writeNoException();
1503 userInfo.writeToParcel(reply, 0);
1504 return true;
1505 }
1506
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001507 case REMOVE_SUB_TASK_TRANSACTION:
1508 {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 int taskId = data.readInt();
1511 int subTaskIndex = data.readInt();
1512 boolean result = removeSubTask(taskId, subTaskIndex);
1513 reply.writeNoException();
1514 reply.writeInt(result ? 1 : 0);
1515 return true;
1516 }
1517
1518 case REMOVE_TASK_TRANSACTION:
1519 {
1520 data.enforceInterface(IActivityManager.descriptor);
1521 int taskId = data.readInt();
1522 int fl = data.readInt();
1523 boolean result = removeTask(taskId, fl);
1524 reply.writeNoException();
1525 reply.writeInt(result ? 1 : 0);
1526 return true;
1527 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001528
Jeff Sharkeya4620792011-05-20 15:29:23 -07001529 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1532 data.readStrongBinder());
1533 registerProcessObserver(observer);
1534 return true;
1535 }
1536
1537 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1540 data.readStrongBinder());
1541 unregisterProcessObserver(observer);
1542 return true;
1543 }
1544
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001545 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1546 {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 String pkg = data.readString();
1549 boolean ask = getPackageAskScreenCompat(pkg);
1550 reply.writeNoException();
1551 reply.writeInt(ask ? 1 : 0);
1552 return true;
1553 }
1554
1555 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1556 {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 String pkg = data.readString();
1559 boolean ask = data.readInt() != 0;
1560 setPackageAskScreenCompat(pkg, ask);
1561 reply.writeNoException();
1562 return true;
1563 }
1564
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001565 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 IIntentSender r = IIntentSender.Stub.asInterface(
1568 data.readStrongBinder());
1569 boolean res = isIntentSenderTargetedToPackage(r);
1570 reply.writeNoException();
1571 reply.writeInt(res ? 1 : 0);
1572 return true;
1573 }
1574
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001575 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1576 data.enforceInterface(IActivityManager.descriptor);
1577 Configuration config = Configuration.CREATOR.createFromParcel(data);
1578 updatePersistentConfiguration(config);
1579 reply.writeNoException();
1580 return true;
1581 }
1582
Dianne Hackbornb437e092011-08-05 17:50:29 -07001583 case GET_PROCESS_PSS_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 int[] pids = data.createIntArray();
1586 long[] pss = getProcessPss(pids);
1587 reply.writeNoException();
1588 reply.writeLongArray(pss);
1589 return true;
1590 }
1591
Dianne Hackborn661cd522011-08-22 00:26:20 -07001592 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
1594 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1595 boolean always = data.readInt() != 0;
1596 showBootMessage(msg, always);
1597 reply.writeNoException();
1598 return true;
1599 }
1600
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001601 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 dismissKeyguardOnNextActivity();
1604 reply.writeNoException();
1605 return true;
1606 }
1607
Adam Powelldd8fab22012-03-22 17:47:27 -07001608 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1609 data.enforceInterface(IActivityManager.descriptor);
1610 IBinder token = data.readStrongBinder();
1611 String destAffinity = data.readString();
1612 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1613 reply.writeNoException();
1614 reply.writeInt(res ? 1 : 0);
1615 return true;
1616 }
1617
1618 case NAVIGATE_UP_TO_TRANSACTION: {
1619 data.enforceInterface(IActivityManager.descriptor);
1620 IBinder token = data.readStrongBinder();
1621 Intent target = Intent.CREATOR.createFromParcel(data);
1622 int resultCode = data.readInt();
1623 Intent resultData = null;
1624 if (data.readInt() != 0) {
1625 resultData = Intent.CREATOR.createFromParcel(data);
1626 }
1627 boolean res = navigateUpTo(token, target, resultCode, resultData);
1628 reply.writeNoException();
1629 reply.writeInt(res ? 1 : 0);
1630 return true;
1631 }
1632
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001633 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001634
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001635 return super.onTransact(code, data, reply, flags);
1636 }
1637
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001638 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001639 return this;
1640 }
1641
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001642 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1643 protected IActivityManager create() {
1644 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001645 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001646 Log.v("ActivityManager", "default service binder = " + b);
1647 }
1648 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001649 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001650 Log.v("ActivityManager", "default service = " + am);
1651 }
1652 return am;
1653 }
1654 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001655}
1656
1657class ActivityManagerProxy implements IActivityManager
1658{
1659 public ActivityManagerProxy(IBinder remote)
1660 {
1661 mRemote = remote;
1662 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001664 public IBinder asBinder()
1665 {
1666 return mRemote;
1667 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001668
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001669 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001670 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1671 int startFlags, String profileFile,
1672 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001673 Parcel data = Parcel.obtain();
1674 Parcel reply = Parcel.obtain();
1675 data.writeInterfaceToken(IActivityManager.descriptor);
1676 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1677 intent.writeToParcel(data, 0);
1678 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001679 data.writeStrongBinder(resultTo);
1680 data.writeString(resultWho);
1681 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001682 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001683 data.writeString(profileFile);
1684 if (profileFd != null) {
1685 data.writeInt(1);
1686 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1687 } else {
1688 data.writeInt(0);
1689 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001690 if (options != null) {
1691 data.writeInt(1);
1692 options.writeToParcel(data, 0);
1693 } else {
1694 data.writeInt(0);
1695 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001696 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1697 reply.readException();
1698 int result = reply.readInt();
1699 reply.recycle();
1700 data.recycle();
1701 return result;
1702 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001703 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001704 String resolvedType, IBinder resultTo, String resultWho,
1705 int requestCode, int startFlags, String profileFile,
1706 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001707 Parcel data = Parcel.obtain();
1708 Parcel reply = Parcel.obtain();
1709 data.writeInterfaceToken(IActivityManager.descriptor);
1710 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1711 intent.writeToParcel(data, 0);
1712 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001713 data.writeStrongBinder(resultTo);
1714 data.writeString(resultWho);
1715 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001716 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001717 data.writeString(profileFile);
1718 if (profileFd != null) {
1719 data.writeInt(1);
1720 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1721 } else {
1722 data.writeInt(0);
1723 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001724 if (options != null) {
1725 data.writeInt(1);
1726 options.writeToParcel(data, 0);
1727 } else {
1728 data.writeInt(0);
1729 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001730 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1731 reply.readException();
1732 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1733 reply.recycle();
1734 data.recycle();
1735 return result;
1736 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001737 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001738 String resolvedType, IBinder resultTo, String resultWho,
1739 int requestCode, int startFlags, Configuration config,
1740 Bundle options) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001741 Parcel data = Parcel.obtain();
1742 Parcel reply = Parcel.obtain();
1743 data.writeInterfaceToken(IActivityManager.descriptor);
1744 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1745 intent.writeToParcel(data, 0);
1746 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001747 data.writeStrongBinder(resultTo);
1748 data.writeString(resultWho);
1749 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001750 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001751 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001752 if (options != null) {
1753 data.writeInt(1);
1754 options.writeToParcel(data, 0);
1755 } else {
1756 data.writeInt(0);
1757 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001758 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1759 reply.readException();
1760 int result = reply.readInt();
1761 reply.recycle();
1762 data.recycle();
1763 return result;
1764 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001765 public int startActivityIntentSender(IApplicationThread caller,
1766 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001767 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001768 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001769 Parcel data = Parcel.obtain();
1770 Parcel reply = Parcel.obtain();
1771 data.writeInterfaceToken(IActivityManager.descriptor);
1772 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1773 intent.writeToParcel(data, 0);
1774 if (fillInIntent != null) {
1775 data.writeInt(1);
1776 fillInIntent.writeToParcel(data, 0);
1777 } else {
1778 data.writeInt(0);
1779 }
1780 data.writeString(resolvedType);
1781 data.writeStrongBinder(resultTo);
1782 data.writeString(resultWho);
1783 data.writeInt(requestCode);
1784 data.writeInt(flagsMask);
1785 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001786 if (options != null) {
1787 data.writeInt(1);
1788 options.writeToParcel(data, 0);
1789 } else {
1790 data.writeInt(0);
1791 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001792 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001793 reply.readException();
1794 int result = reply.readInt();
1795 reply.recycle();
1796 data.recycle();
1797 return result;
1798 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001799 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001800 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001801 Parcel data = Parcel.obtain();
1802 Parcel reply = Parcel.obtain();
1803 data.writeInterfaceToken(IActivityManager.descriptor);
1804 data.writeStrongBinder(callingActivity);
1805 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001806 if (options != null) {
1807 data.writeInt(1);
1808 options.writeToParcel(data, 0);
1809 } else {
1810 data.writeInt(0);
1811 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001812 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1813 reply.readException();
1814 int result = reply.readInt();
1815 reply.recycle();
1816 data.recycle();
1817 return result != 0;
1818 }
1819 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1820 throws RemoteException {
1821 Parcel data = Parcel.obtain();
1822 Parcel reply = Parcel.obtain();
1823 data.writeInterfaceToken(IActivityManager.descriptor);
1824 data.writeStrongBinder(token);
1825 data.writeInt(resultCode);
1826 if (resultData != null) {
1827 data.writeInt(1);
1828 resultData.writeToParcel(data, 0);
1829 } else {
1830 data.writeInt(0);
1831 }
1832 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1833 reply.readException();
1834 boolean res = reply.readInt() != 0;
1835 data.recycle();
1836 reply.recycle();
1837 return res;
1838 }
1839 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1840 {
1841 Parcel data = Parcel.obtain();
1842 Parcel reply = Parcel.obtain();
1843 data.writeInterfaceToken(IActivityManager.descriptor);
1844 data.writeStrongBinder(token);
1845 data.writeString(resultWho);
1846 data.writeInt(requestCode);
1847 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1848 reply.readException();
1849 data.recycle();
1850 reply.recycle();
1851 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001852 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1853 Parcel data = Parcel.obtain();
1854 Parcel reply = Parcel.obtain();
1855 data.writeInterfaceToken(IActivityManager.descriptor);
1856 data.writeStrongBinder(token);
1857 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1858 reply.readException();
1859 boolean res = reply.readInt() != 0;
1860 data.recycle();
1861 reply.recycle();
1862 return res;
1863 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001864 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001865 IIntentReceiver receiver,
1866 IntentFilter filter, String perm) throws RemoteException
1867 {
1868 Parcel data = Parcel.obtain();
1869 Parcel reply = Parcel.obtain();
1870 data.writeInterfaceToken(IActivityManager.descriptor);
1871 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001872 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001873 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1874 filter.writeToParcel(data, 0);
1875 data.writeString(perm);
1876 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1877 reply.readException();
1878 Intent intent = null;
1879 int haveIntent = reply.readInt();
1880 if (haveIntent != 0) {
1881 intent = Intent.CREATOR.createFromParcel(reply);
1882 }
1883 reply.recycle();
1884 data.recycle();
1885 return intent;
1886 }
1887 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1888 {
1889 Parcel data = Parcel.obtain();
1890 Parcel reply = Parcel.obtain();
1891 data.writeInterfaceToken(IActivityManager.descriptor);
1892 data.writeStrongBinder(receiver.asBinder());
1893 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1894 reply.readException();
1895 data.recycle();
1896 reply.recycle();
1897 }
1898 public int broadcastIntent(IApplicationThread caller,
1899 Intent intent, String resolvedType, IIntentReceiver resultTo,
1900 int resultCode, String resultData, Bundle map,
1901 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07001902 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001903 {
1904 Parcel data = Parcel.obtain();
1905 Parcel reply = Parcel.obtain();
1906 data.writeInterfaceToken(IActivityManager.descriptor);
1907 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1908 intent.writeToParcel(data, 0);
1909 data.writeString(resolvedType);
1910 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1911 data.writeInt(resultCode);
1912 data.writeString(resultData);
1913 data.writeBundle(map);
1914 data.writeString(requiredPermission);
1915 data.writeInt(serialized ? 1 : 0);
1916 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001917 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001918 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1919 reply.readException();
1920 int res = reply.readInt();
1921 reply.recycle();
1922 data.recycle();
1923 return res;
1924 }
Amith Yamasani742a6712011-05-04 14:49:28 -07001925 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
1926 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001927 {
1928 Parcel data = Parcel.obtain();
1929 Parcel reply = Parcel.obtain();
1930 data.writeInterfaceToken(IActivityManager.descriptor);
1931 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1932 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001933 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001934 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1935 reply.readException();
1936 data.recycle();
1937 reply.recycle();
1938 }
1939 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1940 {
1941 Parcel data = Parcel.obtain();
1942 Parcel reply = Parcel.obtain();
1943 data.writeInterfaceToken(IActivityManager.descriptor);
1944 data.writeStrongBinder(who);
1945 data.writeInt(resultCode);
1946 data.writeString(resultData);
1947 data.writeBundle(map);
1948 data.writeInt(abortBroadcast ? 1 : 0);
1949 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1950 reply.readException();
1951 data.recycle();
1952 reply.recycle();
1953 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001954 public void attachApplication(IApplicationThread app) throws RemoteException
1955 {
1956 Parcel data = Parcel.obtain();
1957 Parcel reply = Parcel.obtain();
1958 data.writeInterfaceToken(IActivityManager.descriptor);
1959 data.writeStrongBinder(app.asBinder());
1960 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1961 reply.readException();
1962 data.recycle();
1963 reply.recycle();
1964 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001965 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
1966 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001967 {
1968 Parcel data = Parcel.obtain();
1969 Parcel reply = Parcel.obtain();
1970 data.writeInterfaceToken(IActivityManager.descriptor);
1971 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001972 if (config != null) {
1973 data.writeInt(1);
1974 config.writeToParcel(data, 0);
1975 } else {
1976 data.writeInt(0);
1977 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001978 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001979 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1980 reply.readException();
1981 data.recycle();
1982 reply.recycle();
1983 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001984 public void activityPaused(IBinder token) throws RemoteException
1985 {
1986 Parcel data = Parcel.obtain();
1987 Parcel reply = Parcel.obtain();
1988 data.writeInterfaceToken(IActivityManager.descriptor);
1989 data.writeStrongBinder(token);
1990 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1991 reply.readException();
1992 data.recycle();
1993 reply.recycle();
1994 }
1995 public void activityStopped(IBinder token, Bundle state,
1996 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001997 {
1998 Parcel data = Parcel.obtain();
1999 Parcel reply = Parcel.obtain();
2000 data.writeInterfaceToken(IActivityManager.descriptor);
2001 data.writeStrongBinder(token);
2002 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002003 if (thumbnail != null) {
2004 data.writeInt(1);
2005 thumbnail.writeToParcel(data, 0);
2006 } else {
2007 data.writeInt(0);
2008 }
2009 TextUtils.writeToParcel(description, data, 0);
2010 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2011 reply.readException();
2012 data.recycle();
2013 reply.recycle();
2014 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002015 public void activitySlept(IBinder token) throws RemoteException
2016 {
2017 Parcel data = Parcel.obtain();
2018 Parcel reply = Parcel.obtain();
2019 data.writeInterfaceToken(IActivityManager.descriptor);
2020 data.writeStrongBinder(token);
2021 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2022 reply.readException();
2023 data.recycle();
2024 reply.recycle();
2025 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002026 public void activityDestroyed(IBinder token) throws RemoteException
2027 {
2028 Parcel data = Parcel.obtain();
2029 Parcel reply = Parcel.obtain();
2030 data.writeInterfaceToken(IActivityManager.descriptor);
2031 data.writeStrongBinder(token);
2032 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2033 reply.readException();
2034 data.recycle();
2035 reply.recycle();
2036 }
2037 public String getCallingPackage(IBinder token) throws RemoteException
2038 {
2039 Parcel data = Parcel.obtain();
2040 Parcel reply = Parcel.obtain();
2041 data.writeInterfaceToken(IActivityManager.descriptor);
2042 data.writeStrongBinder(token);
2043 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2044 reply.readException();
2045 String res = reply.readString();
2046 data.recycle();
2047 reply.recycle();
2048 return res;
2049 }
2050 public ComponentName getCallingActivity(IBinder token)
2051 throws RemoteException {
2052 Parcel data = Parcel.obtain();
2053 Parcel reply = Parcel.obtain();
2054 data.writeInterfaceToken(IActivityManager.descriptor);
2055 data.writeStrongBinder(token);
2056 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2057 reply.readException();
2058 ComponentName res = ComponentName.readFromParcel(reply);
2059 data.recycle();
2060 reply.recycle();
2061 return res;
2062 }
2063 public List getTasks(int maxNum, int flags,
2064 IThumbnailReceiver receiver) throws RemoteException {
2065 Parcel data = Parcel.obtain();
2066 Parcel reply = Parcel.obtain();
2067 data.writeInterfaceToken(IActivityManager.descriptor);
2068 data.writeInt(maxNum);
2069 data.writeInt(flags);
2070 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2071 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2072 reply.readException();
2073 ArrayList list = null;
2074 int N = reply.readInt();
2075 if (N >= 0) {
2076 list = new ArrayList();
2077 while (N > 0) {
2078 ActivityManager.RunningTaskInfo info =
2079 ActivityManager.RunningTaskInfo.CREATOR
2080 .createFromParcel(reply);
2081 list.add(info);
2082 N--;
2083 }
2084 }
2085 data.recycle();
2086 reply.recycle();
2087 return list;
2088 }
2089 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2090 int flags) throws RemoteException {
2091 Parcel data = Parcel.obtain();
2092 Parcel reply = Parcel.obtain();
2093 data.writeInterfaceToken(IActivityManager.descriptor);
2094 data.writeInt(maxNum);
2095 data.writeInt(flags);
2096 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2097 reply.readException();
2098 ArrayList<ActivityManager.RecentTaskInfo> list
2099 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2100 data.recycle();
2101 reply.recycle();
2102 return list;
2103 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002104 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002105 Parcel data = Parcel.obtain();
2106 Parcel reply = Parcel.obtain();
2107 data.writeInterfaceToken(IActivityManager.descriptor);
2108 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002109 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002110 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002111 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002112 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002113 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002114 }
2115 data.recycle();
2116 reply.recycle();
2117 return bm;
2118 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002119 public List getServices(int maxNum, int flags) throws RemoteException {
2120 Parcel data = Parcel.obtain();
2121 Parcel reply = Parcel.obtain();
2122 data.writeInterfaceToken(IActivityManager.descriptor);
2123 data.writeInt(maxNum);
2124 data.writeInt(flags);
2125 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2126 reply.readException();
2127 ArrayList list = null;
2128 int N = reply.readInt();
2129 if (N >= 0) {
2130 list = new ArrayList();
2131 while (N > 0) {
2132 ActivityManager.RunningServiceInfo info =
2133 ActivityManager.RunningServiceInfo.CREATOR
2134 .createFromParcel(reply);
2135 list.add(info);
2136 N--;
2137 }
2138 }
2139 data.recycle();
2140 reply.recycle();
2141 return list;
2142 }
2143 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2144 throws RemoteException {
2145 Parcel data = Parcel.obtain();
2146 Parcel reply = Parcel.obtain();
2147 data.writeInterfaceToken(IActivityManager.descriptor);
2148 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2149 reply.readException();
2150 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2151 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2152 data.recycle();
2153 reply.recycle();
2154 return list;
2155 }
2156 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2157 throws RemoteException {
2158 Parcel data = Parcel.obtain();
2159 Parcel reply = Parcel.obtain();
2160 data.writeInterfaceToken(IActivityManager.descriptor);
2161 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2162 reply.readException();
2163 ArrayList<ActivityManager.RunningAppProcessInfo> list
2164 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2165 data.recycle();
2166 reply.recycle();
2167 return list;
2168 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002169 public List<ApplicationInfo> getRunningExternalApplications()
2170 throws RemoteException {
2171 Parcel data = Parcel.obtain();
2172 Parcel reply = Parcel.obtain();
2173 data.writeInterfaceToken(IActivityManager.descriptor);
2174 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2175 reply.readException();
2176 ArrayList<ApplicationInfo> list
2177 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2178 data.recycle();
2179 reply.recycle();
2180 return list;
2181 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002182 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002183 {
2184 Parcel data = Parcel.obtain();
2185 Parcel reply = Parcel.obtain();
2186 data.writeInterfaceToken(IActivityManager.descriptor);
2187 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002188 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002189 if (options != null) {
2190 data.writeInt(1);
2191 options.writeToParcel(data, 0);
2192 } else {
2193 data.writeInt(0);
2194 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002195 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2196 reply.readException();
2197 data.recycle();
2198 reply.recycle();
2199 }
2200 public void moveTaskToBack(int task) throws RemoteException
2201 {
2202 Parcel data = Parcel.obtain();
2203 Parcel reply = Parcel.obtain();
2204 data.writeInterfaceToken(IActivityManager.descriptor);
2205 data.writeInt(task);
2206 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2207 reply.readException();
2208 data.recycle();
2209 reply.recycle();
2210 }
2211 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2212 throws RemoteException {
2213 Parcel data = Parcel.obtain();
2214 Parcel reply = Parcel.obtain();
2215 data.writeInterfaceToken(IActivityManager.descriptor);
2216 data.writeStrongBinder(token);
2217 data.writeInt(nonRoot ? 1 : 0);
2218 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2219 reply.readException();
2220 boolean res = reply.readInt() != 0;
2221 data.recycle();
2222 reply.recycle();
2223 return res;
2224 }
2225 public void moveTaskBackwards(int task) throws RemoteException
2226 {
2227 Parcel data = Parcel.obtain();
2228 Parcel reply = Parcel.obtain();
2229 data.writeInterfaceToken(IActivityManager.descriptor);
2230 data.writeInt(task);
2231 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2232 reply.readException();
2233 data.recycle();
2234 reply.recycle();
2235 }
2236 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2237 {
2238 Parcel data = Parcel.obtain();
2239 Parcel reply = Parcel.obtain();
2240 data.writeInterfaceToken(IActivityManager.descriptor);
2241 data.writeStrongBinder(token);
2242 data.writeInt(onlyRoot ? 1 : 0);
2243 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2244 reply.readException();
2245 int res = reply.readInt();
2246 data.recycle();
2247 reply.recycle();
2248 return res;
2249 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002250 public void reportThumbnail(IBinder token,
2251 Bitmap thumbnail, CharSequence description) throws RemoteException
2252 {
2253 Parcel data = Parcel.obtain();
2254 Parcel reply = Parcel.obtain();
2255 data.writeInterfaceToken(IActivityManager.descriptor);
2256 data.writeStrongBinder(token);
2257 if (thumbnail != null) {
2258 data.writeInt(1);
2259 thumbnail.writeToParcel(data, 0);
2260 } else {
2261 data.writeInt(0);
2262 }
2263 TextUtils.writeToParcel(description, data, 0);
2264 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2265 reply.readException();
2266 data.recycle();
2267 reply.recycle();
2268 }
2269 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2270 String name) throws RemoteException
2271 {
2272 Parcel data = Parcel.obtain();
2273 Parcel reply = Parcel.obtain();
2274 data.writeInterfaceToken(IActivityManager.descriptor);
2275 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2276 data.writeString(name);
2277 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2278 reply.readException();
2279 int res = reply.readInt();
2280 ContentProviderHolder cph = null;
2281 if (res != 0) {
2282 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2283 }
2284 data.recycle();
2285 reply.recycle();
2286 return cph;
2287 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002288 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2289 throws RemoteException
2290 {
2291 Parcel data = Parcel.obtain();
2292 Parcel reply = Parcel.obtain();
2293 data.writeInterfaceToken(IActivityManager.descriptor);
2294 data.writeString(name);
2295 data.writeStrongBinder(token);
2296 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2297 reply.readException();
2298 int res = reply.readInt();
2299 ContentProviderHolder cph = null;
2300 if (res != 0) {
2301 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2302 }
2303 data.recycle();
2304 reply.recycle();
2305 return cph;
2306 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 public void publishContentProviders(IApplicationThread caller,
2308 List<ContentProviderHolder> providers) throws RemoteException
2309 {
2310 Parcel data = Parcel.obtain();
2311 Parcel reply = Parcel.obtain();
2312 data.writeInterfaceToken(IActivityManager.descriptor);
2313 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2314 data.writeTypedList(providers);
2315 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2316 reply.readException();
2317 data.recycle();
2318 reply.recycle();
2319 }
2320
2321 public void removeContentProvider(IApplicationThread caller,
2322 String name) throws RemoteException {
2323 Parcel data = Parcel.obtain();
2324 Parcel reply = Parcel.obtain();
2325 data.writeInterfaceToken(IActivityManager.descriptor);
2326 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2327 data.writeString(name);
2328 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2329 reply.readException();
2330 data.recycle();
2331 reply.recycle();
2332 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002333
2334 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2335 Parcel data = Parcel.obtain();
2336 Parcel reply = Parcel.obtain();
2337 data.writeInterfaceToken(IActivityManager.descriptor);
2338 data.writeString(name);
2339 data.writeStrongBinder(token);
2340 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2341 reply.readException();
2342 data.recycle();
2343 reply.recycle();
2344 }
2345
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002346 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2347 throws RemoteException
2348 {
2349 Parcel data = Parcel.obtain();
2350 Parcel reply = Parcel.obtain();
2351 data.writeInterfaceToken(IActivityManager.descriptor);
2352 service.writeToParcel(data, 0);
2353 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2354 reply.readException();
2355 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2356 data.recycle();
2357 reply.recycle();
2358 return res;
2359 }
2360
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002361 public ComponentName startService(IApplicationThread caller, Intent service,
2362 String resolvedType) throws RemoteException
2363 {
2364 Parcel data = Parcel.obtain();
2365 Parcel reply = Parcel.obtain();
2366 data.writeInterfaceToken(IActivityManager.descriptor);
2367 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2368 service.writeToParcel(data, 0);
2369 data.writeString(resolvedType);
2370 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2371 reply.readException();
2372 ComponentName res = ComponentName.readFromParcel(reply);
2373 data.recycle();
2374 reply.recycle();
2375 return res;
2376 }
2377 public int stopService(IApplicationThread caller, Intent service,
2378 String resolvedType) throws RemoteException
2379 {
2380 Parcel data = Parcel.obtain();
2381 Parcel reply = Parcel.obtain();
2382 data.writeInterfaceToken(IActivityManager.descriptor);
2383 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2384 service.writeToParcel(data, 0);
2385 data.writeString(resolvedType);
2386 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2387 reply.readException();
2388 int res = reply.readInt();
2389 reply.recycle();
2390 data.recycle();
2391 return res;
2392 }
2393 public boolean stopServiceToken(ComponentName className, IBinder token,
2394 int startId) throws RemoteException {
2395 Parcel data = Parcel.obtain();
2396 Parcel reply = Parcel.obtain();
2397 data.writeInterfaceToken(IActivityManager.descriptor);
2398 ComponentName.writeToParcel(className, data);
2399 data.writeStrongBinder(token);
2400 data.writeInt(startId);
2401 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2402 reply.readException();
2403 boolean res = reply.readInt() != 0;
2404 data.recycle();
2405 reply.recycle();
2406 return res;
2407 }
2408 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002409 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002410 Parcel data = Parcel.obtain();
2411 Parcel reply = Parcel.obtain();
2412 data.writeInterfaceToken(IActivityManager.descriptor);
2413 ComponentName.writeToParcel(className, data);
2414 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002415 data.writeInt(id);
2416 if (notification != null) {
2417 data.writeInt(1);
2418 notification.writeToParcel(data, 0);
2419 } else {
2420 data.writeInt(0);
2421 }
2422 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002423 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2424 reply.readException();
2425 data.recycle();
2426 reply.recycle();
2427 }
2428 public int bindService(IApplicationThread caller, IBinder token,
2429 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002430 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002431 Parcel data = Parcel.obtain();
2432 Parcel reply = Parcel.obtain();
2433 data.writeInterfaceToken(IActivityManager.descriptor);
2434 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2435 data.writeStrongBinder(token);
2436 service.writeToParcel(data, 0);
2437 data.writeString(resolvedType);
2438 data.writeStrongBinder(connection.asBinder());
2439 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002440 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002441 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2442 reply.readException();
2443 int res = reply.readInt();
2444 data.recycle();
2445 reply.recycle();
2446 return res;
2447 }
2448 public boolean unbindService(IServiceConnection connection) throws RemoteException
2449 {
2450 Parcel data = Parcel.obtain();
2451 Parcel reply = Parcel.obtain();
2452 data.writeInterfaceToken(IActivityManager.descriptor);
2453 data.writeStrongBinder(connection.asBinder());
2454 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2455 reply.readException();
2456 boolean res = reply.readInt() != 0;
2457 data.recycle();
2458 reply.recycle();
2459 return res;
2460 }
2461
2462 public void publishService(IBinder token,
2463 Intent intent, IBinder service) throws RemoteException {
2464 Parcel data = Parcel.obtain();
2465 Parcel reply = Parcel.obtain();
2466 data.writeInterfaceToken(IActivityManager.descriptor);
2467 data.writeStrongBinder(token);
2468 intent.writeToParcel(data, 0);
2469 data.writeStrongBinder(service);
2470 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2471 reply.readException();
2472 data.recycle();
2473 reply.recycle();
2474 }
2475
2476 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2477 throws RemoteException {
2478 Parcel data = Parcel.obtain();
2479 Parcel reply = Parcel.obtain();
2480 data.writeInterfaceToken(IActivityManager.descriptor);
2481 data.writeStrongBinder(token);
2482 intent.writeToParcel(data, 0);
2483 data.writeInt(doRebind ? 1 : 0);
2484 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2485 reply.readException();
2486 data.recycle();
2487 reply.recycle();
2488 }
2489
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002490 public void serviceDoneExecuting(IBinder token, int type, int startId,
2491 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002492 Parcel data = Parcel.obtain();
2493 Parcel reply = Parcel.obtain();
2494 data.writeInterfaceToken(IActivityManager.descriptor);
2495 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002496 data.writeInt(type);
2497 data.writeInt(startId);
2498 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002499 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2500 reply.readException();
2501 data.recycle();
2502 reply.recycle();
2503 }
2504
2505 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2506 Parcel data = Parcel.obtain();
2507 Parcel reply = Parcel.obtain();
2508 data.writeInterfaceToken(IActivityManager.descriptor);
2509 service.writeToParcel(data, 0);
2510 data.writeString(resolvedType);
2511 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2512 reply.readException();
2513 IBinder binder = reply.readStrongBinder();
2514 reply.recycle();
2515 data.recycle();
2516 return binder;
2517 }
2518
Christopher Tate181fafa2009-05-14 11:12:14 -07002519 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2520 throws RemoteException {
2521 Parcel data = Parcel.obtain();
2522 Parcel reply = Parcel.obtain();
2523 data.writeInterfaceToken(IActivityManager.descriptor);
2524 app.writeToParcel(data, 0);
2525 data.writeInt(backupRestoreMode);
2526 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2527 reply.readException();
2528 boolean success = reply.readInt() != 0;
2529 reply.recycle();
2530 data.recycle();
2531 return success;
2532 }
2533
2534 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2535 Parcel data = Parcel.obtain();
2536 Parcel reply = Parcel.obtain();
2537 data.writeInterfaceToken(IActivityManager.descriptor);
2538 data.writeString(packageName);
2539 data.writeStrongBinder(agent);
2540 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2541 reply.recycle();
2542 data.recycle();
2543 }
2544
2545 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2546 Parcel data = Parcel.obtain();
2547 Parcel reply = Parcel.obtain();
2548 data.writeInterfaceToken(IActivityManager.descriptor);
2549 app.writeToParcel(data, 0);
2550 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2551 reply.readException();
2552 reply.recycle();
2553 data.recycle();
2554 }
2555
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002556 public boolean startInstrumentation(ComponentName className, String profileFile,
2557 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2558 throws RemoteException {
2559 Parcel data = Parcel.obtain();
2560 Parcel reply = Parcel.obtain();
2561 data.writeInterfaceToken(IActivityManager.descriptor);
2562 ComponentName.writeToParcel(className, data);
2563 data.writeString(profileFile);
2564 data.writeInt(flags);
2565 data.writeBundle(arguments);
2566 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2567 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2568 reply.readException();
2569 boolean res = reply.readInt() != 0;
2570 reply.recycle();
2571 data.recycle();
2572 return res;
2573 }
2574
2575 public void finishInstrumentation(IApplicationThread target,
2576 int resultCode, Bundle results) throws RemoteException {
2577 Parcel data = Parcel.obtain();
2578 Parcel reply = Parcel.obtain();
2579 data.writeInterfaceToken(IActivityManager.descriptor);
2580 data.writeStrongBinder(target != null ? target.asBinder() : null);
2581 data.writeInt(resultCode);
2582 data.writeBundle(results);
2583 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 data.recycle();
2586 reply.recycle();
2587 }
2588 public Configuration getConfiguration() throws RemoteException
2589 {
2590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
2593 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2594 reply.readException();
2595 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2596 reply.recycle();
2597 data.recycle();
2598 return res;
2599 }
2600 public void updateConfiguration(Configuration values) throws RemoteException
2601 {
2602 Parcel data = Parcel.obtain();
2603 Parcel reply = Parcel.obtain();
2604 data.writeInterfaceToken(IActivityManager.descriptor);
2605 values.writeToParcel(data, 0);
2606 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2607 reply.readException();
2608 data.recycle();
2609 reply.recycle();
2610 }
2611 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2612 throws RemoteException {
2613 Parcel data = Parcel.obtain();
2614 Parcel reply = Parcel.obtain();
2615 data.writeInterfaceToken(IActivityManager.descriptor);
2616 data.writeStrongBinder(token);
2617 data.writeInt(requestedOrientation);
2618 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2619 reply.readException();
2620 data.recycle();
2621 reply.recycle();
2622 }
2623 public int getRequestedOrientation(IBinder token) throws RemoteException {
2624 Parcel data = Parcel.obtain();
2625 Parcel reply = Parcel.obtain();
2626 data.writeInterfaceToken(IActivityManager.descriptor);
2627 data.writeStrongBinder(token);
2628 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2629 reply.readException();
2630 int res = reply.readInt();
2631 data.recycle();
2632 reply.recycle();
2633 return res;
2634 }
2635 public ComponentName getActivityClassForToken(IBinder token)
2636 throws RemoteException {
2637 Parcel data = Parcel.obtain();
2638 Parcel reply = Parcel.obtain();
2639 data.writeInterfaceToken(IActivityManager.descriptor);
2640 data.writeStrongBinder(token);
2641 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2642 reply.readException();
2643 ComponentName res = ComponentName.readFromParcel(reply);
2644 data.recycle();
2645 reply.recycle();
2646 return res;
2647 }
2648 public String getPackageForToken(IBinder token) throws RemoteException
2649 {
2650 Parcel data = Parcel.obtain();
2651 Parcel reply = Parcel.obtain();
2652 data.writeInterfaceToken(IActivityManager.descriptor);
2653 data.writeStrongBinder(token);
2654 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2655 reply.readException();
2656 String res = reply.readString();
2657 data.recycle();
2658 reply.recycle();
2659 return res;
2660 }
2661 public IIntentSender getIntentSender(int type,
2662 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002663 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
2664 Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002665 Parcel data = Parcel.obtain();
2666 Parcel reply = Parcel.obtain();
2667 data.writeInterfaceToken(IActivityManager.descriptor);
2668 data.writeInt(type);
2669 data.writeString(packageName);
2670 data.writeStrongBinder(token);
2671 data.writeString(resultWho);
2672 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002673 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002674 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002675 data.writeTypedArray(intents, 0);
2676 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002677 } else {
2678 data.writeInt(0);
2679 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002680 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002681 if (options != null) {
2682 data.writeInt(1);
2683 options.writeToParcel(data, 0);
2684 } else {
2685 data.writeInt(0);
2686 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002687 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2688 reply.readException();
2689 IIntentSender res = IIntentSender.Stub.asInterface(
2690 reply.readStrongBinder());
2691 data.recycle();
2692 reply.recycle();
2693 return res;
2694 }
2695 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2696 Parcel data = Parcel.obtain();
2697 Parcel reply = Parcel.obtain();
2698 data.writeInterfaceToken(IActivityManager.descriptor);
2699 data.writeStrongBinder(sender.asBinder());
2700 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2701 reply.readException();
2702 data.recycle();
2703 reply.recycle();
2704 }
2705 public String getPackageForIntentSender(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(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2711 reply.readException();
2712 String res = reply.readString();
2713 data.recycle();
2714 reply.recycle();
2715 return res;
2716 }
2717 public void setProcessLimit(int max) throws RemoteException
2718 {
2719 Parcel data = Parcel.obtain();
2720 Parcel reply = Parcel.obtain();
2721 data.writeInterfaceToken(IActivityManager.descriptor);
2722 data.writeInt(max);
2723 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2724 reply.readException();
2725 data.recycle();
2726 reply.recycle();
2727 }
2728 public int getProcessLimit() throws RemoteException
2729 {
2730 Parcel data = Parcel.obtain();
2731 Parcel reply = Parcel.obtain();
2732 data.writeInterfaceToken(IActivityManager.descriptor);
2733 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 int res = reply.readInt();
2736 data.recycle();
2737 reply.recycle();
2738 return res;
2739 }
2740 public void setProcessForeground(IBinder token, int pid,
2741 boolean isForeground) throws RemoteException {
2742 Parcel data = Parcel.obtain();
2743 Parcel reply = Parcel.obtain();
2744 data.writeInterfaceToken(IActivityManager.descriptor);
2745 data.writeStrongBinder(token);
2746 data.writeInt(pid);
2747 data.writeInt(isForeground ? 1 : 0);
2748 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2749 reply.readException();
2750 data.recycle();
2751 reply.recycle();
2752 }
2753 public int checkPermission(String permission, int pid, int uid)
2754 throws RemoteException {
2755 Parcel data = Parcel.obtain();
2756 Parcel reply = Parcel.obtain();
2757 data.writeInterfaceToken(IActivityManager.descriptor);
2758 data.writeString(permission);
2759 data.writeInt(pid);
2760 data.writeInt(uid);
2761 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2762 reply.readException();
2763 int res = reply.readInt();
2764 data.recycle();
2765 reply.recycle();
2766 return res;
2767 }
2768 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002769 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002770 Parcel data = Parcel.obtain();
2771 Parcel reply = Parcel.obtain();
2772 data.writeInterfaceToken(IActivityManager.descriptor);
2773 data.writeString(packageName);
2774 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002775 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002776 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2777 reply.readException();
2778 boolean res = reply.readInt() != 0;
2779 data.recycle();
2780 reply.recycle();
2781 return res;
2782 }
2783 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2784 throws RemoteException {
2785 Parcel data = Parcel.obtain();
2786 Parcel reply = Parcel.obtain();
2787 data.writeInterfaceToken(IActivityManager.descriptor);
2788 uri.writeToParcel(data, 0);
2789 data.writeInt(pid);
2790 data.writeInt(uid);
2791 data.writeInt(mode);
2792 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2793 reply.readException();
2794 int res = reply.readInt();
2795 data.recycle();
2796 reply.recycle();
2797 return res;
2798 }
2799 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2800 Uri uri, int mode) throws RemoteException {
2801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 data.writeStrongBinder(caller.asBinder());
2805 data.writeString(targetPkg);
2806 uri.writeToParcel(data, 0);
2807 data.writeInt(mode);
2808 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2809 reply.readException();
2810 data.recycle();
2811 reply.recycle();
2812 }
2813 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2814 int mode) throws RemoteException {
2815 Parcel data = Parcel.obtain();
2816 Parcel reply = Parcel.obtain();
2817 data.writeInterfaceToken(IActivityManager.descriptor);
2818 data.writeStrongBinder(caller.asBinder());
2819 uri.writeToParcel(data, 0);
2820 data.writeInt(mode);
2821 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2822 reply.readException();
2823 data.recycle();
2824 reply.recycle();
2825 }
2826 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2827 throws RemoteException {
2828 Parcel data = Parcel.obtain();
2829 Parcel reply = Parcel.obtain();
2830 data.writeInterfaceToken(IActivityManager.descriptor);
2831 data.writeStrongBinder(who.asBinder());
2832 data.writeInt(waiting ? 1 : 0);
2833 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2834 reply.readException();
2835 data.recycle();
2836 reply.recycle();
2837 }
2838 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2839 Parcel data = Parcel.obtain();
2840 Parcel reply = Parcel.obtain();
2841 data.writeInterfaceToken(IActivityManager.descriptor);
2842 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2843 reply.readException();
2844 outInfo.readFromParcel(reply);
2845 data.recycle();
2846 reply.recycle();
2847 }
2848 public void unhandledBack() throws RemoteException
2849 {
2850 Parcel data = Parcel.obtain();
2851 Parcel reply = Parcel.obtain();
2852 data.writeInterfaceToken(IActivityManager.descriptor);
2853 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2854 reply.readException();
2855 data.recycle();
2856 reply.recycle();
2857 }
2858 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2859 {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2864 reply.readException();
2865 ParcelFileDescriptor pfd = null;
2866 if (reply.readInt() != 0) {
2867 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2868 }
2869 data.recycle();
2870 reply.recycle();
2871 return pfd;
2872 }
2873 public void goingToSleep() throws RemoteException
2874 {
2875 Parcel data = Parcel.obtain();
2876 Parcel reply = Parcel.obtain();
2877 data.writeInterfaceToken(IActivityManager.descriptor);
2878 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2879 reply.readException();
2880 data.recycle();
2881 reply.recycle();
2882 }
2883 public void wakingUp() throws RemoteException
2884 {
2885 Parcel data = Parcel.obtain();
2886 Parcel reply = Parcel.obtain();
2887 data.writeInterfaceToken(IActivityManager.descriptor);
2888 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2889 reply.readException();
2890 data.recycle();
2891 reply.recycle();
2892 }
2893 public void setDebugApp(
2894 String packageName, boolean waitForDebugger, boolean persistent)
2895 throws RemoteException
2896 {
2897 Parcel data = Parcel.obtain();
2898 Parcel reply = Parcel.obtain();
2899 data.writeInterfaceToken(IActivityManager.descriptor);
2900 data.writeString(packageName);
2901 data.writeInt(waitForDebugger ? 1 : 0);
2902 data.writeInt(persistent ? 1 : 0);
2903 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2904 reply.readException();
2905 data.recycle();
2906 reply.recycle();
2907 }
2908 public void setAlwaysFinish(boolean enabled) throws RemoteException
2909 {
2910 Parcel data = Parcel.obtain();
2911 Parcel reply = Parcel.obtain();
2912 data.writeInterfaceToken(IActivityManager.descriptor);
2913 data.writeInt(enabled ? 1 : 0);
2914 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2915 reply.readException();
2916 data.recycle();
2917 reply.recycle();
2918 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002919 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002920 {
2921 Parcel data = Parcel.obtain();
2922 Parcel reply = Parcel.obtain();
2923 data.writeInterfaceToken(IActivityManager.descriptor);
2924 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002925 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002926 reply.readException();
2927 data.recycle();
2928 reply.recycle();
2929 }
2930 public void enterSafeMode() throws RemoteException {
2931 Parcel data = Parcel.obtain();
2932 data.writeInterfaceToken(IActivityManager.descriptor);
2933 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2934 data.recycle();
2935 }
2936 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2937 Parcel data = Parcel.obtain();
2938 data.writeStrongBinder(sender.asBinder());
2939 data.writeInterfaceToken(IActivityManager.descriptor);
2940 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2941 data.recycle();
2942 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002943 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
2947 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002948 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002949 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002950 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002951 boolean res = reply.readInt() != 0;
2952 data.recycle();
2953 reply.recycle();
2954 return res;
2955 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07002956 @Override
2957 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
2958 Parcel data = Parcel.obtain();
2959 Parcel reply = Parcel.obtain();
2960 data.writeInterfaceToken(IActivityManager.descriptor);
2961 data.writeString(reason);
2962 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
2963 boolean res = reply.readInt() != 0;
2964 data.recycle();
2965 reply.recycle();
2966 return res;
2967 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002968 public void startRunning(String pkg, String cls, String action,
2969 String indata) throws RemoteException {
2970 Parcel data = Parcel.obtain();
2971 Parcel reply = Parcel.obtain();
2972 data.writeInterfaceToken(IActivityManager.descriptor);
2973 data.writeString(pkg);
2974 data.writeString(cls);
2975 data.writeString(action);
2976 data.writeString(indata);
2977 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2978 reply.readException();
2979 data.recycle();
2980 reply.recycle();
2981 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002982 public boolean testIsSystemReady()
2983 {
2984 /* this base class version is never called */
2985 return true;
2986 }
Dan Egnor60d87622009-12-16 16:32:58 -08002987 public void handleApplicationCrash(IBinder app,
2988 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2989 {
2990 Parcel data = Parcel.obtain();
2991 Parcel reply = Parcel.obtain();
2992 data.writeInterfaceToken(IActivityManager.descriptor);
2993 data.writeStrongBinder(app);
2994 crashInfo.writeToParcel(data, 0);
2995 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2996 reply.readException();
2997 reply.recycle();
2998 data.recycle();
2999 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003000
Dan Egnor60d87622009-12-16 16:32:58 -08003001 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003002 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003003 {
3004 Parcel data = Parcel.obtain();
3005 Parcel reply = Parcel.obtain();
3006 data.writeInterfaceToken(IActivityManager.descriptor);
3007 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003008 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003009 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003010 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003011 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003012 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003013 reply.recycle();
3014 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003015 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003017
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003018 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003019 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003020 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003021 {
3022 Parcel data = Parcel.obtain();
3023 Parcel reply = Parcel.obtain();
3024 data.writeInterfaceToken(IActivityManager.descriptor);
3025 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003026 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003027 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003028 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 reply.recycle();
3031 data.recycle();
3032 }
3033
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003034 public void signalPersistentProcesses(int sig) throws RemoteException {
3035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 data.writeInt(sig);
3039 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3040 reply.readException();
3041 data.recycle();
3042 reply.recycle();
3043 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003044
Dianne Hackborn03abb812010-01-04 18:43:19 -08003045 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003050 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3051 reply.readException();
3052 data.recycle();
3053 reply.recycle();
3054 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003055
3056 public void killAllBackgroundProcesses() throws RemoteException {
3057 Parcel data = Parcel.obtain();
3058 Parcel reply = Parcel.obtain();
3059 data.writeInterfaceToken(IActivityManager.descriptor);
3060 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3061 reply.readException();
3062 data.recycle();
3063 reply.recycle();
3064 }
3065
Dianne Hackborn03abb812010-01-04 18:43:19 -08003066 public void forceStopPackage(String packageName) throws RemoteException {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 data.writeString(packageName);
3071 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003072 reply.readException();
3073 data.recycle();
3074 reply.recycle();
3075 }
3076
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003077 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3078 throws RemoteException
3079 {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3084 reply.readException();
3085 outInfo.readFromParcel(reply);
3086 reply.recycle();
3087 data.recycle();
3088 }
3089
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003090 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3091 {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3096 reply.readException();
3097 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3098 reply.recycle();
3099 data.recycle();
3100 return res;
3101 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003102
3103 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003104 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003105 {
3106 Parcel data = Parcel.obtain();
3107 Parcel reply = Parcel.obtain();
3108 data.writeInterfaceToken(IActivityManager.descriptor);
3109 data.writeString(process);
3110 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003111 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003112 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003113 if (fd != null) {
3114 data.writeInt(1);
3115 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3116 } else {
3117 data.writeInt(0);
3118 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003119 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3120 reply.readException();
3121 boolean res = reply.readInt() != 0;
3122 reply.recycle();
3123 data.recycle();
3124 return res;
3125 }
3126
Dianne Hackborn55280a92009-05-07 15:53:46 -07003127 public boolean shutdown(int timeout) throws RemoteException
3128 {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 data.writeInt(timeout);
3133 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3134 reply.readException();
3135 boolean res = reply.readInt() != 0;
3136 reply.recycle();
3137 data.recycle();
3138 return res;
3139 }
3140
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003141 public void stopAppSwitches() throws RemoteException {
3142 Parcel data = Parcel.obtain();
3143 Parcel reply = Parcel.obtain();
3144 data.writeInterfaceToken(IActivityManager.descriptor);
3145 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3146 reply.readException();
3147 reply.recycle();
3148 data.recycle();
3149 }
3150
3151 public void resumeAppSwitches() throws RemoteException {
3152 Parcel data = Parcel.obtain();
3153 Parcel reply = Parcel.obtain();
3154 data.writeInterfaceToken(IActivityManager.descriptor);
3155 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3156 reply.readException();
3157 reply.recycle();
3158 data.recycle();
3159 }
3160
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003161 public int startActivityInPackage(int uid,
3162 Intent intent, String resolvedType, IBinder resultTo,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003163 String resultWho, int requestCode, int startFlags, Bundle options)
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003164 throws RemoteException {
3165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 data.writeInt(uid);
3169 intent.writeToParcel(data, 0);
3170 data.writeString(resolvedType);
3171 data.writeStrongBinder(resultTo);
3172 data.writeString(resultWho);
3173 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003174 data.writeInt(startFlags);
3175 if (options != null) {
3176 data.writeInt(1);
3177 options.writeToParcel(data, 0);
3178 } else {
3179 data.writeInt(0);
3180 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003181 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3182 reply.readException();
3183 int result = reply.readInt();
3184 reply.recycle();
3185 data.recycle();
3186 return result;
3187 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003188
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003189 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3190 Parcel data = Parcel.obtain();
3191 Parcel reply = Parcel.obtain();
3192 data.writeInterfaceToken(IActivityManager.descriptor);
3193 data.writeString(pkg);
3194 data.writeInt(uid);
3195 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3196 reply.readException();
3197 data.recycle();
3198 reply.recycle();
3199 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003200
3201 public void closeSystemDialogs(String reason) throws RemoteException {
3202 Parcel data = Parcel.obtain();
3203 Parcel reply = Parcel.obtain();
3204 data.writeInterfaceToken(IActivityManager.descriptor);
3205 data.writeString(reason);
3206 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3207 reply.readException();
3208 data.recycle();
3209 reply.recycle();
3210 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003211
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003212 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003213 throws RemoteException {
3214 Parcel data = Parcel.obtain();
3215 Parcel reply = Parcel.obtain();
3216 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003217 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003218 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3219 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003220 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003221 data.recycle();
3222 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003223 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003224 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003225
3226 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3227 Parcel data = Parcel.obtain();
3228 Parcel reply = Parcel.obtain();
3229 data.writeInterfaceToken(IActivityManager.descriptor);
3230 data.writeString(processName);
3231 data.writeInt(uid);
3232 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3233 reply.readException();
3234 data.recycle();
3235 reply.recycle();
3236 }
3237
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003238 public void overridePendingTransition(IBinder token, String packageName,
3239 int enterAnim, int exitAnim) throws RemoteException {
3240 Parcel data = Parcel.obtain();
3241 Parcel reply = Parcel.obtain();
3242 data.writeInterfaceToken(IActivityManager.descriptor);
3243 data.writeStrongBinder(token);
3244 data.writeString(packageName);
3245 data.writeInt(enterAnim);
3246 data.writeInt(exitAnim);
3247 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3248 reply.readException();
3249 data.recycle();
3250 reply.recycle();
3251 }
3252
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003253 public boolean isUserAMonkey() throws RemoteException {
3254 Parcel data = Parcel.obtain();
3255 Parcel reply = Parcel.obtain();
3256 data.writeInterfaceToken(IActivityManager.descriptor);
3257 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3258 reply.readException();
3259 boolean res = reply.readInt() != 0;
3260 data.recycle();
3261 reply.recycle();
3262 return res;
3263 }
3264
Dianne Hackborn860755f2010-06-03 18:47:52 -07003265 public void finishHeavyWeightApp() throws RemoteException {
3266 Parcel data = Parcel.obtain();
3267 Parcel reply = Parcel.obtain();
3268 data.writeInterfaceToken(IActivityManager.descriptor);
3269 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3270 reply.readException();
3271 data.recycle();
3272 reply.recycle();
3273 }
3274
Daniel Sandler69a48172010-06-23 16:29:36 -04003275 public void setImmersive(IBinder token, boolean immersive)
3276 throws RemoteException {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 data.writeStrongBinder(token);
3281 data.writeInt(immersive ? 1 : 0);
3282 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3283 reply.readException();
3284 data.recycle();
3285 reply.recycle();
3286 }
3287
3288 public boolean isImmersive(IBinder token)
3289 throws RemoteException {
3290 Parcel data = Parcel.obtain();
3291 Parcel reply = Parcel.obtain();
3292 data.writeInterfaceToken(IActivityManager.descriptor);
3293 data.writeStrongBinder(token);
3294 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003295 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003296 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003297 data.recycle();
3298 reply.recycle();
3299 return res;
3300 }
3301
3302 public boolean isTopActivityImmersive()
3303 throws RemoteException {
3304 Parcel data = Parcel.obtain();
3305 Parcel reply = Parcel.obtain();
3306 data.writeInterfaceToken(IActivityManager.descriptor);
3307 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003308 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003309 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003310 data.recycle();
3311 reply.recycle();
3312 return res;
3313 }
3314
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003315 public void crashApplication(int uid, int initialPid, String packageName,
3316 String message) throws RemoteException {
3317 Parcel data = Parcel.obtain();
3318 Parcel reply = Parcel.obtain();
3319 data.writeInterfaceToken(IActivityManager.descriptor);
3320 data.writeInt(uid);
3321 data.writeInt(initialPid);
3322 data.writeString(packageName);
3323 data.writeString(message);
3324 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3325 reply.readException();
3326 data.recycle();
3327 reply.recycle();
3328 }
Andy McFadden824c5102010-07-09 16:26:57 -07003329
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003330 public String getProviderMimeType(Uri uri)
3331 throws RemoteException {
3332 Parcel data = Parcel.obtain();
3333 Parcel reply = Parcel.obtain();
3334 data.writeInterfaceToken(IActivityManager.descriptor);
3335 uri.writeToParcel(data, 0);
3336 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3337 reply.readException();
3338 String res = reply.readString();
3339 data.recycle();
3340 reply.recycle();
3341 return res;
3342 }
3343
Dianne Hackborn7e269642010-08-25 19:50:20 -07003344 public IBinder newUriPermissionOwner(String name)
3345 throws RemoteException {
3346 Parcel data = Parcel.obtain();
3347 Parcel reply = Parcel.obtain();
3348 data.writeInterfaceToken(IActivityManager.descriptor);
3349 data.writeString(name);
3350 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3351 reply.readException();
3352 IBinder res = reply.readStrongBinder();
3353 data.recycle();
3354 reply.recycle();
3355 return res;
3356 }
3357
3358 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3359 Uri uri, int mode) throws RemoteException {
3360 Parcel data = Parcel.obtain();
3361 Parcel reply = Parcel.obtain();
3362 data.writeInterfaceToken(IActivityManager.descriptor);
3363 data.writeStrongBinder(owner);
3364 data.writeInt(fromUid);
3365 data.writeString(targetPkg);
3366 uri.writeToParcel(data, 0);
3367 data.writeInt(mode);
3368 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3369 reply.readException();
3370 data.recycle();
3371 reply.recycle();
3372 }
3373
3374 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3375 int mode) throws RemoteException {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(owner);
3380 if (uri != null) {
3381 data.writeInt(1);
3382 uri.writeToParcel(data, 0);
3383 } else {
3384 data.writeInt(0);
3385 }
3386 data.writeInt(mode);
3387 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3388 reply.readException();
3389 data.recycle();
3390 reply.recycle();
3391 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003392
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003393 public int checkGrantUriPermission(int callingUid, String targetPkg,
3394 Uri uri, int modeFlags) throws RemoteException {
3395 Parcel data = Parcel.obtain();
3396 Parcel reply = Parcel.obtain();
3397 data.writeInterfaceToken(IActivityManager.descriptor);
3398 data.writeInt(callingUid);
3399 data.writeString(targetPkg);
3400 uri.writeToParcel(data, 0);
3401 data.writeInt(modeFlags);
3402 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3403 reply.readException();
3404 int res = reply.readInt();
3405 data.recycle();
3406 reply.recycle();
3407 return res;
3408 }
3409
Andy McFadden824c5102010-07-09 16:26:57 -07003410 public boolean dumpHeap(String process, boolean managed,
3411 String path, ParcelFileDescriptor fd) throws RemoteException {
3412 Parcel data = Parcel.obtain();
3413 Parcel reply = Parcel.obtain();
3414 data.writeInterfaceToken(IActivityManager.descriptor);
3415 data.writeString(process);
3416 data.writeInt(managed ? 1 : 0);
3417 data.writeString(path);
3418 if (fd != null) {
3419 data.writeInt(1);
3420 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3421 } else {
3422 data.writeInt(0);
3423 }
3424 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3425 reply.readException();
3426 boolean res = reply.readInt() != 0;
3427 reply.recycle();
3428 data.recycle();
3429 return res;
3430 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003431
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003432 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003433 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3434 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3439 data.writeTypedArray(intents, 0);
3440 data.writeStringArray(resolvedTypes);
3441 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003442 if (options != null) {
3443 data.writeInt(1);
3444 options.writeToParcel(data, 0);
3445 } else {
3446 data.writeInt(0);
3447 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003448 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3449 reply.readException();
3450 int result = reply.readInt();
3451 reply.recycle();
3452 data.recycle();
3453 return result;
3454 }
3455
3456 public int startActivitiesInPackage(int uid,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003457 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3458 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003459 Parcel data = Parcel.obtain();
3460 Parcel reply = Parcel.obtain();
3461 data.writeInterfaceToken(IActivityManager.descriptor);
3462 data.writeInt(uid);
3463 data.writeTypedArray(intents, 0);
3464 data.writeStringArray(resolvedTypes);
3465 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003466 if (options != null) {
3467 data.writeInt(1);
3468 options.writeToParcel(data, 0);
3469 } else {
3470 data.writeInt(0);
3471 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003472 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3473 reply.readException();
3474 int result = reply.readInt();
3475 reply.recycle();
3476 data.recycle();
3477 return result;
3478 }
3479
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003480 public int getFrontActivityScreenCompatMode() throws RemoteException {
3481 Parcel data = Parcel.obtain();
3482 Parcel reply = Parcel.obtain();
3483 data.writeInterfaceToken(IActivityManager.descriptor);
3484 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3485 reply.readException();
3486 int mode = reply.readInt();
3487 reply.recycle();
3488 data.recycle();
3489 return mode;
3490 }
3491
3492 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 data.writeInt(mode);
3497 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3498 reply.readException();
3499 reply.recycle();
3500 data.recycle();
3501 }
3502
3503 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3504 Parcel data = Parcel.obtain();
3505 Parcel reply = Parcel.obtain();
3506 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003507 data.writeString(packageName);
3508 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003509 reply.readException();
3510 int mode = reply.readInt();
3511 reply.recycle();
3512 data.recycle();
3513 return mode;
3514 }
3515
3516 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003517 throws RemoteException {
3518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003522 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003523 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3524 reply.readException();
3525 reply.recycle();
3526 data.recycle();
3527 }
3528
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003529 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3530 Parcel data = Parcel.obtain();
3531 Parcel reply = Parcel.obtain();
3532 data.writeInterfaceToken(IActivityManager.descriptor);
3533 data.writeString(packageName);
3534 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3535 reply.readException();
3536 boolean ask = reply.readInt() != 0;
3537 reply.recycle();
3538 data.recycle();
3539 return ask;
3540 }
3541
3542 public void setPackageAskScreenCompat(String packageName, boolean ask)
3543 throws RemoteException {
3544 Parcel data = Parcel.obtain();
3545 Parcel reply = Parcel.obtain();
3546 data.writeInterfaceToken(IActivityManager.descriptor);
3547 data.writeString(packageName);
3548 data.writeInt(ask ? 1 : 0);
3549 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 reply.recycle();
3552 data.recycle();
3553 }
3554
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003555 public boolean switchUser(int userid) throws RemoteException {
3556 Parcel data = Parcel.obtain();
3557 Parcel reply = Parcel.obtain();
3558 data.writeInterfaceToken(IActivityManager.descriptor);
3559 data.writeInt(userid);
3560 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3561 reply.readException();
3562 boolean result = reply.readInt() != 0;
3563 reply.recycle();
3564 data.recycle();
3565 return result;
3566 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003567
3568 public UserInfo getCurrentUser() throws RemoteException {
3569 Parcel data = Parcel.obtain();
3570 Parcel reply = Parcel.obtain();
3571 data.writeInterfaceToken(IActivityManager.descriptor);
3572 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3573 reply.readException();
3574 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3575 reply.recycle();
3576 data.recycle();
3577 return userInfo;
3578 }
3579
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003580 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 data.writeInt(taskId);
3585 data.writeInt(subTaskIndex);
3586 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3587 reply.readException();
3588 boolean result = reply.readInt() != 0;
3589 reply.recycle();
3590 data.recycle();
3591 return result;
3592 }
3593
3594 public boolean removeTask(int taskId, int flags) throws RemoteException {
3595 Parcel data = Parcel.obtain();
3596 Parcel reply = Parcel.obtain();
3597 data.writeInterfaceToken(IActivityManager.descriptor);
3598 data.writeInt(taskId);
3599 data.writeInt(flags);
3600 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3601 reply.readException();
3602 boolean result = reply.readInt() != 0;
3603 reply.recycle();
3604 data.recycle();
3605 return result;
3606 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003607
Jeff Sharkeya4620792011-05-20 15:29:23 -07003608 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3609 Parcel data = Parcel.obtain();
3610 Parcel reply = Parcel.obtain();
3611 data.writeInterfaceToken(IActivityManager.descriptor);
3612 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3613 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3614 reply.readException();
3615 data.recycle();
3616 reply.recycle();
3617 }
3618
3619 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3624 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3625 reply.readException();
3626 data.recycle();
3627 reply.recycle();
3628 }
3629
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003630 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeStrongBinder(sender.asBinder());
3635 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3636 reply.readException();
3637 boolean res = reply.readInt() != 0;
3638 data.recycle();
3639 reply.recycle();
3640 return res;
3641 }
3642
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003643 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3644 {
3645 Parcel data = Parcel.obtain();
3646 Parcel reply = Parcel.obtain();
3647 data.writeInterfaceToken(IActivityManager.descriptor);
3648 values.writeToParcel(data, 0);
3649 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3650 reply.readException();
3651 data.recycle();
3652 reply.recycle();
3653 }
3654
Dianne Hackbornb437e092011-08-05 17:50:29 -07003655 public long[] getProcessPss(int[] pids) throws RemoteException {
3656 Parcel data = Parcel.obtain();
3657 Parcel reply = Parcel.obtain();
3658 data.writeInterfaceToken(IActivityManager.descriptor);
3659 data.writeIntArray(pids);
3660 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3661 reply.readException();
3662 long[] res = reply.createLongArray();
3663 data.recycle();
3664 reply.recycle();
3665 return res;
3666 }
3667
Dianne Hackborn661cd522011-08-22 00:26:20 -07003668 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3669 Parcel data = Parcel.obtain();
3670 Parcel reply = Parcel.obtain();
3671 data.writeInterfaceToken(IActivityManager.descriptor);
3672 TextUtils.writeToParcel(msg, data, 0);
3673 data.writeInt(always ? 1 : 0);
3674 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3675 reply.readException();
3676 data.recycle();
3677 reply.recycle();
3678 }
3679
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003680 public void dismissKeyguardOnNextActivity() throws RemoteException {
3681 Parcel data = Parcel.obtain();
3682 Parcel reply = Parcel.obtain();
3683 data.writeInterfaceToken(IActivityManager.descriptor);
3684 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3685 reply.readException();
3686 data.recycle();
3687 reply.recycle();
3688 }
3689
Adam Powelldd8fab22012-03-22 17:47:27 -07003690 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3691 throws RemoteException {
3692 Parcel data = Parcel.obtain();
3693 Parcel reply = Parcel.obtain();
3694 data.writeInterfaceToken(IActivityManager.descriptor);
3695 data.writeStrongBinder(token);
3696 data.writeString(destAffinity);
3697 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3698 reply.readException();
3699 boolean result = reply.readInt() != 0;
3700 data.recycle();
3701 reply.recycle();
3702 return result;
3703 }
3704
3705 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3706 throws RemoteException {
3707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 data.writeStrongBinder(token);
3711 target.writeToParcel(data, 0);
3712 data.writeInt(resultCode);
3713 if (resultData != null) {
3714 data.writeInt(1);
3715 resultData.writeToParcel(data, 0);
3716 } else {
3717 data.writeInt(0);
3718 }
3719 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3720 reply.readException();
3721 boolean result = reply.readInt() != 0;
3722 data.recycle();
3723 reply.recycle();
3724 return result;
3725 }
3726
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003727 private IBinder mRemote;
3728}