blob: e12fa19f447845cbd7c6b183865520ee952535d0 [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 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700221
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800222 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 Hackbornecc5a9c2012-04-26 18:56:09 -0700246 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
247 data.enforceInterface(IActivityManager.descriptor);
248 IBinder token = data.readStrongBinder();
249 boolean res = finishActivityAffinity(token);
250 reply.writeNoException();
251 reply.writeInt(res ? 1 : 0);
252 return true;
253 }
254
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800255 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
256 data.enforceInterface(IActivityManager.descriptor);
257 IBinder token = data.readStrongBinder();
258 boolean res = willActivityBeVisible(token);
259 reply.writeNoException();
260 reply.writeInt(res ? 1 : 0);
261 return true;
262 }
263
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800264 case REGISTER_RECEIVER_TRANSACTION:
265 {
266 data.enforceInterface(IActivityManager.descriptor);
267 IBinder b = data.readStrongBinder();
268 IApplicationThread app =
269 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700270 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800271 b = data.readStrongBinder();
272 IIntentReceiver rec
273 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
274 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
275 String perm = data.readString();
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700276 Intent intent = registerReceiver(app, packageName, rec, filter, perm);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800277 reply.writeNoException();
278 if (intent != null) {
279 reply.writeInt(1);
280 intent.writeToParcel(reply, 0);
281 } else {
282 reply.writeInt(0);
283 }
284 return true;
285 }
286
287 case UNREGISTER_RECEIVER_TRANSACTION:
288 {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder b = data.readStrongBinder();
291 if (b == null) {
292 return true;
293 }
294 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
295 unregisterReceiver(rec);
296 reply.writeNoException();
297 return true;
298 }
299
300 case BROADCAST_INTENT_TRANSACTION:
301 {
302 data.enforceInterface(IActivityManager.descriptor);
303 IBinder b = data.readStrongBinder();
304 IApplicationThread app =
305 b != null ? ApplicationThreadNative.asInterface(b) : null;
306 Intent intent = Intent.CREATOR.createFromParcel(data);
307 String resolvedType = data.readString();
308 b = data.readStrongBinder();
309 IIntentReceiver resultTo =
310 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
311 int resultCode = data.readInt();
312 String resultData = data.readString();
313 Bundle resultExtras = data.readBundle();
314 String perm = data.readString();
315 boolean serialized = data.readInt() != 0;
316 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700317 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 int res = broadcastIntent(app, intent, resolvedType, resultTo,
319 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700320 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800321 reply.writeNoException();
322 reply.writeInt(res);
323 return true;
324 }
325
326 case UNBROADCAST_INTENT_TRANSACTION:
327 {
328 data.enforceInterface(IActivityManager.descriptor);
329 IBinder b = data.readStrongBinder();
330 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
331 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700332 int userId = data.readInt();
333 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800334 reply.writeNoException();
335 return true;
336 }
337
338 case FINISH_RECEIVER_TRANSACTION: {
339 data.enforceInterface(IActivityManager.descriptor);
340 IBinder who = data.readStrongBinder();
341 int resultCode = data.readInt();
342 String resultData = data.readString();
343 Bundle resultExtras = data.readBundle();
344 boolean resultAbort = data.readInt() != 0;
345 if (who != null) {
346 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
347 }
348 reply.writeNoException();
349 return true;
350 }
351
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352 case ATTACH_APPLICATION_TRANSACTION: {
353 data.enforceInterface(IActivityManager.descriptor);
354 IApplicationThread app = ApplicationThreadNative.asInterface(
355 data.readStrongBinder());
356 if (app != null) {
357 attachApplication(app);
358 }
359 reply.writeNoException();
360 return true;
361 }
362
363 case ACTIVITY_IDLE_TRANSACTION: {
364 data.enforceInterface(IActivityManager.descriptor);
365 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700366 Configuration config = null;
367 if (data.readInt() != 0) {
368 config = Configuration.CREATOR.createFromParcel(data);
369 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700370 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700372 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 }
374 reply.writeNoException();
375 return true;
376 }
377
378 case ACTIVITY_PAUSED_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800381 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 reply.writeNoException();
383 return true;
384 }
385
386 case ACTIVITY_STOPPED_TRANSACTION: {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800389 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 Bitmap thumbnail = data.readInt() != 0
391 ? Bitmap.CREATOR.createFromParcel(data) : null;
392 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800393 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 reply.writeNoException();
395 return true;
396 }
397
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800398 case ACTIVITY_SLEPT_TRANSACTION: {
399 data.enforceInterface(IActivityManager.descriptor);
400 IBinder token = data.readStrongBinder();
401 activitySlept(token);
402 reply.writeNoException();
403 return true;
404 }
405
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 case ACTIVITY_DESTROYED_TRANSACTION: {
407 data.enforceInterface(IActivityManager.descriptor);
408 IBinder token = data.readStrongBinder();
409 activityDestroyed(token);
410 reply.writeNoException();
411 return true;
412 }
413
414 case GET_CALLING_PACKAGE_TRANSACTION: {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder token = data.readStrongBinder();
417 String res = token != null ? getCallingPackage(token) : null;
418 reply.writeNoException();
419 reply.writeString(res);
420 return true;
421 }
422
423 case GET_CALLING_ACTIVITY_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder token = data.readStrongBinder();
426 ComponentName cn = getCallingActivity(token);
427 reply.writeNoException();
428 ComponentName.writeToParcel(cn, reply);
429 return true;
430 }
431
432 case GET_TASKS_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 int maxNum = data.readInt();
435 int fl = data.readInt();
436 IBinder receiverBinder = data.readStrongBinder();
437 IThumbnailReceiver receiver = receiverBinder != null
438 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
439 : null;
440 List list = getTasks(maxNum, fl, receiver);
441 reply.writeNoException();
442 int N = list != null ? list.size() : -1;
443 reply.writeInt(N);
444 int i;
445 for (i=0; i<N; i++) {
446 ActivityManager.RunningTaskInfo info =
447 (ActivityManager.RunningTaskInfo)list.get(i);
448 info.writeToParcel(reply, 0);
449 }
450 return true;
451 }
452
453 case GET_RECENT_TASKS_TRANSACTION: {
454 data.enforceInterface(IActivityManager.descriptor);
455 int maxNum = data.readInt();
456 int fl = data.readInt();
457 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
458 fl);
459 reply.writeNoException();
460 reply.writeTypedList(list);
461 return true;
462 }
463
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700464 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800465 data.enforceInterface(IActivityManager.descriptor);
466 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700467 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800468 reply.writeNoException();
469 if (bm != null) {
470 reply.writeInt(1);
471 bm.writeToParcel(reply, 0);
472 } else {
473 reply.writeInt(0);
474 }
475 return true;
476 }
477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 case GET_SERVICES_TRANSACTION: {
479 data.enforceInterface(IActivityManager.descriptor);
480 int maxNum = data.readInt();
481 int fl = data.readInt();
482 List list = getServices(maxNum, fl);
483 reply.writeNoException();
484 int N = list != null ? list.size() : -1;
485 reply.writeInt(N);
486 int i;
487 for (i=0; i<N; i++) {
488 ActivityManager.RunningServiceInfo info =
489 (ActivityManager.RunningServiceInfo)list.get(i);
490 info.writeToParcel(reply, 0);
491 }
492 return true;
493 }
494
495 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
496 data.enforceInterface(IActivityManager.descriptor);
497 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
498 reply.writeNoException();
499 reply.writeTypedList(list);
500 return true;
501 }
502
503 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
504 data.enforceInterface(IActivityManager.descriptor);
505 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
506 reply.writeNoException();
507 reply.writeTypedList(list);
508 return true;
509 }
510
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700511 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
512 data.enforceInterface(IActivityManager.descriptor);
513 List<ApplicationInfo> list = getRunningExternalApplications();
514 reply.writeNoException();
515 reply.writeTypedList(list);
516 return true;
517 }
518
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800519 case MOVE_TASK_TO_FRONT_TRANSACTION: {
520 data.enforceInterface(IActivityManager.descriptor);
521 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800522 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700523 Bundle options = data.readInt() != 0
524 ? Bundle.CREATOR.createFromParcel(data) : null;
525 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 reply.writeNoException();
527 return true;
528 }
529
530 case MOVE_TASK_TO_BACK_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 int task = data.readInt();
533 moveTaskToBack(task);
534 reply.writeNoException();
535 return true;
536 }
537
538 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 IBinder token = data.readStrongBinder();
541 boolean nonRoot = data.readInt() != 0;
542 boolean res = moveActivityTaskToBack(token, nonRoot);
543 reply.writeNoException();
544 reply.writeInt(res ? 1 : 0);
545 return true;
546 }
547
548 case MOVE_TASK_BACKWARDS_TRANSACTION: {
549 data.enforceInterface(IActivityManager.descriptor);
550 int task = data.readInt();
551 moveTaskBackwards(task);
552 reply.writeNoException();
553 return true;
554 }
555
556 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
557 data.enforceInterface(IActivityManager.descriptor);
558 IBinder token = data.readStrongBinder();
559 boolean onlyRoot = data.readInt() != 0;
560 int res = token != null
561 ? getTaskForActivity(token, onlyRoot) : -1;
562 reply.writeNoException();
563 reply.writeInt(res);
564 return true;
565 }
566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800567 case REPORT_THUMBNAIL_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 IBinder token = data.readStrongBinder();
570 Bitmap thumbnail = data.readInt() != 0
571 ? Bitmap.CREATOR.createFromParcel(data) : null;
572 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
573 reportThumbnail(token, thumbnail, description);
574 reply.writeNoException();
575 return true;
576 }
577
578 case GET_CONTENT_PROVIDER_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 IBinder b = data.readStrongBinder();
581 IApplicationThread app = ApplicationThreadNative.asInterface(b);
582 String name = data.readString();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700583 boolean stable = data.readInt() != 0;
584 ContentProviderHolder cph = getContentProvider(app, name, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800585 reply.writeNoException();
586 if (cph != null) {
587 reply.writeInt(1);
588 cph.writeToParcel(reply, 0);
589 } else {
590 reply.writeInt(0);
591 }
592 return true;
593 }
594
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800595 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
596 data.enforceInterface(IActivityManager.descriptor);
597 String name = data.readString();
598 IBinder token = data.readStrongBinder();
599 ContentProviderHolder cph = getContentProviderExternal(name, token);
600 reply.writeNoException();
601 if (cph != null) {
602 reply.writeInt(1);
603 cph.writeToParcel(reply, 0);
604 } else {
605 reply.writeInt(0);
606 }
607 return true;
608 }
609
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800610 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
611 data.enforceInterface(IActivityManager.descriptor);
612 IBinder b = data.readStrongBinder();
613 IApplicationThread app = ApplicationThreadNative.asInterface(b);
614 ArrayList<ContentProviderHolder> providers =
615 data.createTypedArrayList(ContentProviderHolder.CREATOR);
616 publishContentProviders(app, providers);
617 reply.writeNoException();
618 return true;
619 }
620
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700621 case REF_CONTENT_PROVIDER_TRANSACTION: {
622 data.enforceInterface(IActivityManager.descriptor);
623 IBinder b = data.readStrongBinder();
624 int stable = data.readInt();
625 int unstable = data.readInt();
626 boolean res = refContentProvider(b, stable, unstable);
627 reply.writeNoException();
628 reply.writeInt(res ? 1 : 0);
629 return true;
630 }
631
632 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
633 data.enforceInterface(IActivityManager.descriptor);
634 IBinder b = data.readStrongBinder();
635 unstableProviderDied(b);
636 reply.writeNoException();
637 return true;
638 }
639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
641 data.enforceInterface(IActivityManager.descriptor);
642 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700643 boolean stable = data.readInt() != 0;
644 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800645 reply.writeNoException();
646 return true;
647 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800648
649 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
650 data.enforceInterface(IActivityManager.descriptor);
651 String name = data.readString();
652 IBinder token = data.readStrongBinder();
653 removeContentProviderExternal(name, token);
654 reply.writeNoException();
655 return true;
656 }
657
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700658 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
659 data.enforceInterface(IActivityManager.descriptor);
660 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
661 PendingIntent pi = getRunningServiceControlPanel(comp);
662 reply.writeNoException();
663 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
664 return true;
665 }
666
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667 case START_SERVICE_TRANSACTION: {
668 data.enforceInterface(IActivityManager.descriptor);
669 IBinder b = data.readStrongBinder();
670 IApplicationThread app = ApplicationThreadNative.asInterface(b);
671 Intent service = Intent.CREATOR.createFromParcel(data);
672 String resolvedType = data.readString();
673 ComponentName cn = startService(app, service, resolvedType);
674 reply.writeNoException();
675 ComponentName.writeToParcel(cn, reply);
676 return true;
677 }
678
679 case STOP_SERVICE_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 IBinder b = data.readStrongBinder();
682 IApplicationThread app = ApplicationThreadNative.asInterface(b);
683 Intent service = Intent.CREATOR.createFromParcel(data);
684 String resolvedType = data.readString();
685 int res = stopService(app, service, resolvedType);
686 reply.writeNoException();
687 reply.writeInt(res);
688 return true;
689 }
690
691 case STOP_SERVICE_TOKEN_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 ComponentName className = ComponentName.readFromParcel(data);
694 IBinder token = data.readStrongBinder();
695 int startId = data.readInt();
696 boolean res = stopServiceToken(className, token, startId);
697 reply.writeNoException();
698 reply.writeInt(res ? 1 : 0);
699 return true;
700 }
701
702 case SET_SERVICE_FOREGROUND_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 ComponentName className = ComponentName.readFromParcel(data);
705 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700706 int id = data.readInt();
707 Notification notification = null;
708 if (data.readInt() != 0) {
709 notification = Notification.CREATOR.createFromParcel(data);
710 }
711 boolean removeNotification = data.readInt() != 0;
712 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800713 reply.writeNoException();
714 return true;
715 }
716
717 case BIND_SERVICE_TRANSACTION: {
718 data.enforceInterface(IActivityManager.descriptor);
719 IBinder b = data.readStrongBinder();
720 IApplicationThread app = ApplicationThreadNative.asInterface(b);
721 IBinder token = data.readStrongBinder();
722 Intent service = Intent.CREATOR.createFromParcel(data);
723 String resolvedType = data.readString();
724 b = data.readStrongBinder();
725 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800726 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800727 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800728 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 reply.writeNoException();
730 reply.writeInt(res);
731 return true;
732 }
733
734 case UNBIND_SERVICE_TRANSACTION: {
735 data.enforceInterface(IActivityManager.descriptor);
736 IBinder b = data.readStrongBinder();
737 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
738 boolean res = unbindService(conn);
739 reply.writeNoException();
740 reply.writeInt(res ? 1 : 0);
741 return true;
742 }
743
744 case PUBLISH_SERVICE_TRANSACTION: {
745 data.enforceInterface(IActivityManager.descriptor);
746 IBinder token = data.readStrongBinder();
747 Intent intent = Intent.CREATOR.createFromParcel(data);
748 IBinder service = data.readStrongBinder();
749 publishService(token, intent, service);
750 reply.writeNoException();
751 return true;
752 }
753
754 case UNBIND_FINISHED_TRANSACTION: {
755 data.enforceInterface(IActivityManager.descriptor);
756 IBinder token = data.readStrongBinder();
757 Intent intent = Intent.CREATOR.createFromParcel(data);
758 boolean doRebind = data.readInt() != 0;
759 unbindFinished(token, intent, doRebind);
760 reply.writeNoException();
761 return true;
762 }
763
764 case SERVICE_DONE_EXECUTING_TRANSACTION: {
765 data.enforceInterface(IActivityManager.descriptor);
766 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700767 int type = data.readInt();
768 int startId = data.readInt();
769 int res = data.readInt();
770 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800771 reply.writeNoException();
772 return true;
773 }
774
775 case START_INSTRUMENTATION_TRANSACTION: {
776 data.enforceInterface(IActivityManager.descriptor);
777 ComponentName className = ComponentName.readFromParcel(data);
778 String profileFile = data.readString();
779 int fl = data.readInt();
780 Bundle arguments = data.readBundle();
781 IBinder b = data.readStrongBinder();
782 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
783 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
784 reply.writeNoException();
785 reply.writeInt(res ? 1 : 0);
786 return true;
787 }
788
789
790 case FINISH_INSTRUMENTATION_TRANSACTION: {
791 data.enforceInterface(IActivityManager.descriptor);
792 IBinder b = data.readStrongBinder();
793 IApplicationThread app = ApplicationThreadNative.asInterface(b);
794 int resultCode = data.readInt();
795 Bundle results = data.readBundle();
796 finishInstrumentation(app, resultCode, results);
797 reply.writeNoException();
798 return true;
799 }
800
801 case GET_CONFIGURATION_TRANSACTION: {
802 data.enforceInterface(IActivityManager.descriptor);
803 Configuration config = getConfiguration();
804 reply.writeNoException();
805 config.writeToParcel(reply, 0);
806 return true;
807 }
808
809 case UPDATE_CONFIGURATION_TRANSACTION: {
810 data.enforceInterface(IActivityManager.descriptor);
811 Configuration config = Configuration.CREATOR.createFromParcel(data);
812 updateConfiguration(config);
813 reply.writeNoException();
814 return true;
815 }
816
817 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
818 data.enforceInterface(IActivityManager.descriptor);
819 IBinder token = data.readStrongBinder();
820 int requestedOrientation = data.readInt();
821 setRequestedOrientation(token, requestedOrientation);
822 reply.writeNoException();
823 return true;
824 }
825
826 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
827 data.enforceInterface(IActivityManager.descriptor);
828 IBinder token = data.readStrongBinder();
829 int req = getRequestedOrientation(token);
830 reply.writeNoException();
831 reply.writeInt(req);
832 return true;
833 }
834
835 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
836 data.enforceInterface(IActivityManager.descriptor);
837 IBinder token = data.readStrongBinder();
838 ComponentName cn = getActivityClassForToken(token);
839 reply.writeNoException();
840 ComponentName.writeToParcel(cn, reply);
841 return true;
842 }
843
844 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
845 data.enforceInterface(IActivityManager.descriptor);
846 IBinder token = data.readStrongBinder();
847 reply.writeNoException();
848 reply.writeString(getPackageForToken(token));
849 return true;
850 }
851
852 case GET_INTENT_SENDER_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 int type = data.readInt();
855 String packageName = data.readString();
856 IBinder token = data.readStrongBinder();
857 String resultWho = data.readString();
858 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800859 Intent[] requestIntents;
860 String[] requestResolvedTypes;
861 if (data.readInt() != 0) {
862 requestIntents = data.createTypedArray(Intent.CREATOR);
863 requestResolvedTypes = data.createStringArray();
864 } else {
865 requestIntents = null;
866 requestResolvedTypes = null;
867 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700869 Bundle options = data.readInt() != 0
870 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800871 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800872 resultWho, requestCode, requestIntents,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700873 requestResolvedTypes, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800874 reply.writeNoException();
875 reply.writeStrongBinder(res != null ? res.asBinder() : null);
876 return true;
877 }
878
879 case CANCEL_INTENT_SENDER_TRANSACTION: {
880 data.enforceInterface(IActivityManager.descriptor);
881 IIntentSender r = IIntentSender.Stub.asInterface(
882 data.readStrongBinder());
883 cancelIntentSender(r);
884 reply.writeNoException();
885 return true;
886 }
887
888 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
889 data.enforceInterface(IActivityManager.descriptor);
890 IIntentSender r = IIntentSender.Stub.asInterface(
891 data.readStrongBinder());
892 String res = getPackageForIntentSender(r);
893 reply.writeNoException();
894 reply.writeString(res);
895 return true;
896 }
897
Christopher Tatec4a07d12012-04-06 14:19:13 -0700898 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
899 data.enforceInterface(IActivityManager.descriptor);
900 IIntentSender r = IIntentSender.Stub.asInterface(
901 data.readStrongBinder());
902 int res = getUidForIntentSender(r);
903 reply.writeNoException();
904 reply.writeInt(res);
905 return true;
906 }
907
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 case SET_PROCESS_LIMIT_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 int max = data.readInt();
911 setProcessLimit(max);
912 reply.writeNoException();
913 return true;
914 }
915
916 case GET_PROCESS_LIMIT_TRANSACTION: {
917 data.enforceInterface(IActivityManager.descriptor);
918 int limit = getProcessLimit();
919 reply.writeNoException();
920 reply.writeInt(limit);
921 return true;
922 }
923
924 case SET_PROCESS_FOREGROUND_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 IBinder token = data.readStrongBinder();
927 int pid = data.readInt();
928 boolean isForeground = data.readInt() != 0;
929 setProcessForeground(token, pid, isForeground);
930 reply.writeNoException();
931 return true;
932 }
933
934 case CHECK_PERMISSION_TRANSACTION: {
935 data.enforceInterface(IActivityManager.descriptor);
936 String perm = data.readString();
937 int pid = data.readInt();
938 int uid = data.readInt();
939 int res = checkPermission(perm, pid, uid);
940 reply.writeNoException();
941 reply.writeInt(res);
942 return true;
943 }
944
945 case CHECK_URI_PERMISSION_TRANSACTION: {
946 data.enforceInterface(IActivityManager.descriptor);
947 Uri uri = Uri.CREATOR.createFromParcel(data);
948 int pid = data.readInt();
949 int uid = data.readInt();
950 int mode = data.readInt();
951 int res = checkUriPermission(uri, pid, uid, mode);
952 reply.writeNoException();
953 reply.writeInt(res);
954 return true;
955 }
956
957 case CLEAR_APP_DATA_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 String packageName = data.readString();
960 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
961 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -0700962 int userId = data.readInt();
963 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800964 reply.writeNoException();
965 reply.writeInt(res ? 1 : 0);
966 return true;
967 }
968
969 case GRANT_URI_PERMISSION_TRANSACTION: {
970 data.enforceInterface(IActivityManager.descriptor);
971 IBinder b = data.readStrongBinder();
972 IApplicationThread app = ApplicationThreadNative.asInterface(b);
973 String targetPkg = data.readString();
974 Uri uri = Uri.CREATOR.createFromParcel(data);
975 int mode = data.readInt();
976 grantUriPermission(app, targetPkg, uri, mode);
977 reply.writeNoException();
978 return true;
979 }
980
981 case REVOKE_URI_PERMISSION_TRANSACTION: {
982 data.enforceInterface(IActivityManager.descriptor);
983 IBinder b = data.readStrongBinder();
984 IApplicationThread app = ApplicationThreadNative.asInterface(b);
985 Uri uri = Uri.CREATOR.createFromParcel(data);
986 int mode = data.readInt();
987 revokeUriPermission(app, uri, mode);
988 reply.writeNoException();
989 return true;
990 }
991
992 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
993 data.enforceInterface(IActivityManager.descriptor);
994 IBinder b = data.readStrongBinder();
995 IApplicationThread app = ApplicationThreadNative.asInterface(b);
996 boolean waiting = data.readInt() != 0;
997 showWaitingForDebugger(app, waiting);
998 reply.writeNoException();
999 return true;
1000 }
1001
1002 case GET_MEMORY_INFO_TRANSACTION: {
1003 data.enforceInterface(IActivityManager.descriptor);
1004 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1005 getMemoryInfo(mi);
1006 reply.writeNoException();
1007 mi.writeToParcel(reply, 0);
1008 return true;
1009 }
1010
1011 case UNHANDLED_BACK_TRANSACTION: {
1012 data.enforceInterface(IActivityManager.descriptor);
1013 unhandledBack();
1014 reply.writeNoException();
1015 return true;
1016 }
1017
1018 case OPEN_CONTENT_URI_TRANSACTION: {
1019 data.enforceInterface(IActivityManager.descriptor);
1020 Uri uri = Uri.parse(data.readString());
1021 ParcelFileDescriptor pfd = openContentUri(uri);
1022 reply.writeNoException();
1023 if (pfd != null) {
1024 reply.writeInt(1);
1025 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1026 } else {
1027 reply.writeInt(0);
1028 }
1029 return true;
1030 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001031
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001032 case GOING_TO_SLEEP_TRANSACTION: {
1033 data.enforceInterface(IActivityManager.descriptor);
1034 goingToSleep();
1035 reply.writeNoException();
1036 return true;
1037 }
1038
1039 case WAKING_UP_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 wakingUp();
1042 reply.writeNoException();
1043 return true;
1044 }
1045
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001046 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1047 data.enforceInterface(IActivityManager.descriptor);
1048 setLockScreenShown(data.readInt() != 0);
1049 reply.writeNoException();
1050 return true;
1051 }
1052
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001053 case SET_DEBUG_APP_TRANSACTION: {
1054 data.enforceInterface(IActivityManager.descriptor);
1055 String pn = data.readString();
1056 boolean wfd = data.readInt() != 0;
1057 boolean per = data.readInt() != 0;
1058 setDebugApp(pn, wfd, per);
1059 reply.writeNoException();
1060 return true;
1061 }
1062
1063 case SET_ALWAYS_FINISH_TRANSACTION: {
1064 data.enforceInterface(IActivityManager.descriptor);
1065 boolean enabled = data.readInt() != 0;
1066 setAlwaysFinish(enabled);
1067 reply.writeNoException();
1068 return true;
1069 }
1070
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001071 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001072 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001073 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001074 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001075 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001076 return true;
1077 }
1078
1079 case ENTER_SAFE_MODE_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 enterSafeMode();
1082 reply.writeNoException();
1083 return true;
1084 }
1085
1086 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 IIntentSender is = IIntentSender.Stub.asInterface(
1089 data.readStrongBinder());
1090 noteWakeupAlarm(is);
1091 reply.writeNoException();
1092 return true;
1093 }
1094
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001095 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001096 data.enforceInterface(IActivityManager.descriptor);
1097 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001098 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001099 boolean secure = data.readInt() != 0;
1100 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001101 reply.writeNoException();
1102 reply.writeInt(res ? 1 : 0);
1103 return true;
1104 }
1105
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001106 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1107 data.enforceInterface(IActivityManager.descriptor);
1108 String reason = data.readString();
1109 boolean res = killProcessesBelowForeground(reason);
1110 reply.writeNoException();
1111 reply.writeInt(res ? 1 : 0);
1112 return true;
1113 }
1114
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001115 case START_RUNNING_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 String pkg = data.readString();
1118 String cls = data.readString();
1119 String action = data.readString();
1120 String indata = data.readString();
1121 startRunning(pkg, cls, action, indata);
1122 reply.writeNoException();
1123 return true;
1124 }
1125
Dan Egnor60d87622009-12-16 16:32:58 -08001126 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 IBinder app = data.readStrongBinder();
1129 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1130 handleApplicationCrash(app, ci);
1131 reply.writeNoException();
1132 return true;
1133 }
1134
1135 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001136 data.enforceInterface(IActivityManager.descriptor);
1137 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001139 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001140 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001141 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001142 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001143 return true;
1144 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001145
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001146 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1147 data.enforceInterface(IActivityManager.descriptor);
1148 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001149 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001150 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1151 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001152 reply.writeNoException();
1153 return true;
1154 }
1155
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001156 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1157 data.enforceInterface(IActivityManager.descriptor);
1158 int sig = data.readInt();
1159 signalPersistentProcesses(sig);
1160 reply.writeNoException();
1161 return true;
1162 }
1163
Dianne Hackborn03abb812010-01-04 18:43:19 -08001164 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1165 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001166 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001167 killBackgroundProcesses(packageName);
1168 reply.writeNoException();
1169 return true;
1170 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001171
1172 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 killAllBackgroundProcesses();
1175 reply.writeNoException();
1176 return true;
1177 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001178
1179 case FORCE_STOP_PACKAGE_TRANSACTION: {
1180 data.enforceInterface(IActivityManager.descriptor);
1181 String packageName = data.readString();
1182 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001183 reply.writeNoException();
1184 return true;
1185 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001186
1187 case GET_MY_MEMORY_STATE_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 ActivityManager.RunningAppProcessInfo info =
1190 new ActivityManager.RunningAppProcessInfo();
1191 getMyMemoryState(info);
1192 reply.writeNoException();
1193 info.writeToParcel(reply, 0);
1194 return true;
1195 }
1196
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1198 data.enforceInterface(IActivityManager.descriptor);
1199 ConfigurationInfo config = getDeviceConfigurationInfo();
1200 reply.writeNoException();
1201 config.writeToParcel(reply, 0);
1202 return true;
1203 }
1204
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001205 case PROFILE_CONTROL_TRANSACTION: {
1206 data.enforceInterface(IActivityManager.descriptor);
1207 String process = data.readString();
1208 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001209 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001210 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001211 ParcelFileDescriptor fd = data.readInt() != 0
1212 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001213 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001214 reply.writeNoException();
1215 reply.writeInt(res ? 1 : 0);
1216 return true;
1217 }
1218
Dianne Hackborn55280a92009-05-07 15:53:46 -07001219 case SHUTDOWN_TRANSACTION: {
1220 data.enforceInterface(IActivityManager.descriptor);
1221 boolean res = shutdown(data.readInt());
1222 reply.writeNoException();
1223 reply.writeInt(res ? 1 : 0);
1224 return true;
1225 }
1226
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001227 case STOP_APP_SWITCHES_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 stopAppSwitches();
1230 reply.writeNoException();
1231 return true;
1232 }
1233
1234 case RESUME_APP_SWITCHES_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 resumeAppSwitches();
1237 reply.writeNoException();
1238 return true;
1239 }
1240
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 case PEEK_SERVICE_TRANSACTION: {
1242 data.enforceInterface(IActivityManager.descriptor);
1243 Intent service = Intent.CREATOR.createFromParcel(data);
1244 String resolvedType = data.readString();
1245 IBinder binder = peekService(service, resolvedType);
1246 reply.writeNoException();
1247 reply.writeStrongBinder(binder);
1248 return true;
1249 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001250
1251 case START_BACKUP_AGENT_TRANSACTION: {
1252 data.enforceInterface(IActivityManager.descriptor);
1253 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1254 int backupRestoreMode = data.readInt();
1255 boolean success = bindBackupAgent(info, backupRestoreMode);
1256 reply.writeNoException();
1257 reply.writeInt(success ? 1 : 0);
1258 return true;
1259 }
1260
1261 case BACKUP_AGENT_CREATED_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 String packageName = data.readString();
1264 IBinder agent = data.readStrongBinder();
1265 backupAgentCreated(packageName, agent);
1266 reply.writeNoException();
1267 return true;
1268 }
1269
1270 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1273 unbindBackupAgent(info);
1274 reply.writeNoException();
1275 return true;
1276 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001277
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001278 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1279 {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 int uid = data.readInt();
1282 Intent intent = Intent.CREATOR.createFromParcel(data);
1283 String resolvedType = data.readString();
1284 IBinder resultTo = data.readStrongBinder();
1285 String resultWho = data.readString();
1286 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001287 int startFlags = data.readInt();
1288 Bundle options = data.readInt() != 0
1289 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001290 int result = startActivityInPackage(uid, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001291 resultTo, resultWho, requestCode, startFlags, options);
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001292 reply.writeNoException();
1293 reply.writeInt(result);
1294 return true;
1295 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001296
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001297 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 String pkg = data.readString();
1300 int uid = data.readInt();
1301 killApplicationWithUid(pkg, uid);
1302 reply.writeNoException();
1303 return true;
1304 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001305
1306 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 String reason = data.readString();
1309 closeSystemDialogs(reason);
1310 reply.writeNoException();
1311 return true;
1312 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001313
1314 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1315 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001316 int[] pids = data.createIntArray();
1317 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001318 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001319 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001320 return true;
1321 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001322
1323 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 String processName = data.readString();
1326 int uid = data.readInt();
1327 killApplicationProcess(processName, uid);
1328 reply.writeNoException();
1329 return true;
1330 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001331
1332 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1333 data.enforceInterface(IActivityManager.descriptor);
1334 IBinder token = data.readStrongBinder();
1335 String packageName = data.readString();
1336 int enterAnim = data.readInt();
1337 int exitAnim = data.readInt();
1338 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001339 reply.writeNoException();
1340 return true;
1341 }
1342
1343 case IS_USER_A_MONKEY_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001345 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001346 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001347 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001348 return true;
1349 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001350
1351 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1352 data.enforceInterface(IActivityManager.descriptor);
1353 finishHeavyWeightApp();
1354 reply.writeNoException();
1355 return true;
1356 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001357
1358 case IS_IMMERSIVE_TRANSACTION: {
1359 data.enforceInterface(IActivityManager.descriptor);
1360 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001361 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001362 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001363 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001364 return true;
1365 }
1366
1367 case SET_IMMERSIVE_TRANSACTION: {
1368 data.enforceInterface(IActivityManager.descriptor);
1369 IBinder token = data.readStrongBinder();
1370 boolean imm = data.readInt() == 1;
1371 setImmersive(token, imm);
1372 reply.writeNoException();
1373 return true;
1374 }
1375
1376 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1377 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001378 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001379 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001380 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001381 return true;
1382 }
1383
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001384 case CRASH_APPLICATION_TRANSACTION: {
1385 data.enforceInterface(IActivityManager.descriptor);
1386 int uid = data.readInt();
1387 int initialPid = data.readInt();
1388 String packageName = data.readString();
1389 String message = data.readString();
1390 crashApplication(uid, initialPid, packageName, message);
1391 reply.writeNoException();
1392 return true;
1393 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001394
1395 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 Uri uri = Uri.CREATOR.createFromParcel(data);
1398 String type = getProviderMimeType(uri);
1399 reply.writeNoException();
1400 reply.writeString(type);
1401 return true;
1402 }
1403
Dianne Hackborn7e269642010-08-25 19:50:20 -07001404 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
1406 String name = data.readString();
1407 IBinder perm = newUriPermissionOwner(name);
1408 reply.writeNoException();
1409 reply.writeStrongBinder(perm);
1410 return true;
1411 }
1412
1413 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1414 data.enforceInterface(IActivityManager.descriptor);
1415 IBinder owner = data.readStrongBinder();
1416 int fromUid = data.readInt();
1417 String targetPkg = data.readString();
1418 Uri uri = Uri.CREATOR.createFromParcel(data);
1419 int mode = data.readInt();
1420 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1421 reply.writeNoException();
1422 return true;
1423 }
1424
1425 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1426 data.enforceInterface(IActivityManager.descriptor);
1427 IBinder owner = data.readStrongBinder();
1428 Uri uri = null;
1429 if (data.readInt() != 0) {
1430 Uri.CREATOR.createFromParcel(data);
1431 }
1432 int mode = data.readInt();
1433 revokeUriPermissionFromOwner(owner, uri, mode);
1434 reply.writeNoException();
1435 return true;
1436 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001437
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001438 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1439 data.enforceInterface(IActivityManager.descriptor);
1440 int callingUid = data.readInt();
1441 String targetPkg = data.readString();
1442 Uri uri = Uri.CREATOR.createFromParcel(data);
1443 int modeFlags = data.readInt();
1444 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1445 reply.writeNoException();
1446 reply.writeInt(res);
1447 return true;
1448 }
1449
Andy McFadden824c5102010-07-09 16:26:57 -07001450 case DUMP_HEAP_TRANSACTION: {
1451 data.enforceInterface(IActivityManager.descriptor);
1452 String process = data.readString();
1453 boolean managed = data.readInt() != 0;
1454 String path = data.readString();
1455 ParcelFileDescriptor fd = data.readInt() != 0
1456 ? data.readFileDescriptor() : null;
1457 boolean res = dumpHeap(process, managed, path, fd);
1458 reply.writeNoException();
1459 reply.writeInt(res ? 1 : 0);
1460 return true;
1461 }
1462
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001463 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1464 {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 int uid = data.readInt();
1467 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1468 String[] resolvedTypes = data.createStringArray();
1469 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001470 Bundle options = data.readInt() != 0
1471 ? Bundle.CREATOR.createFromParcel(data) : null;
1472 int result = startActivitiesInPackage(uid, intents, resolvedTypes,
1473 resultTo, options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001474 reply.writeNoException();
1475 reply.writeInt(result);
1476 return true;
1477 }
1478
1479 case START_ACTIVITIES_TRANSACTION:
1480 {
1481 data.enforceInterface(IActivityManager.descriptor);
1482 IBinder b = data.readStrongBinder();
1483 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1484 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1485 String[] resolvedTypes = data.createStringArray();
1486 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001487 Bundle options = data.readInt() != 0
1488 ? Bundle.CREATOR.createFromParcel(data) : null;
1489 int result = startActivities(app, intents, resolvedTypes, resultTo,
1490 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001491 reply.writeNoException();
1492 reply.writeInt(result);
1493 return true;
1494 }
1495
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001496 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1497 {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 int mode = getFrontActivityScreenCompatMode();
1500 reply.writeNoException();
1501 reply.writeInt(mode);
1502 return true;
1503 }
1504
1505 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1506 {
1507 data.enforceInterface(IActivityManager.descriptor);
1508 int mode = data.readInt();
1509 setFrontActivityScreenCompatMode(mode);
1510 reply.writeNoException();
1511 reply.writeInt(mode);
1512 return true;
1513 }
1514
1515 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1516 {
1517 data.enforceInterface(IActivityManager.descriptor);
1518 String pkg = data.readString();
1519 int mode = getPackageScreenCompatMode(pkg);
1520 reply.writeNoException();
1521 reply.writeInt(mode);
1522 return true;
1523 }
1524
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001525 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1526 {
1527 data.enforceInterface(IActivityManager.descriptor);
1528 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001529 int mode = data.readInt();
1530 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001531 reply.writeNoException();
1532 return true;
1533 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001534
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001535 case SWITCH_USER_TRANSACTION: {
1536 data.enforceInterface(IActivityManager.descriptor);
1537 int userid = data.readInt();
1538 boolean result = switchUser(userid);
1539 reply.writeNoException();
1540 reply.writeInt(result ? 1 : 0);
1541 return true;
1542 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001543
1544 case GET_CURRENT_USER_TRANSACTION: {
1545 data.enforceInterface(IActivityManager.descriptor);
1546 UserInfo userInfo = getCurrentUser();
1547 reply.writeNoException();
1548 userInfo.writeToParcel(reply, 0);
1549 return true;
1550 }
1551
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001552 case REMOVE_SUB_TASK_TRANSACTION:
1553 {
1554 data.enforceInterface(IActivityManager.descriptor);
1555 int taskId = data.readInt();
1556 int subTaskIndex = data.readInt();
1557 boolean result = removeSubTask(taskId, subTaskIndex);
1558 reply.writeNoException();
1559 reply.writeInt(result ? 1 : 0);
1560 return true;
1561 }
1562
1563 case REMOVE_TASK_TRANSACTION:
1564 {
1565 data.enforceInterface(IActivityManager.descriptor);
1566 int taskId = data.readInt();
1567 int fl = data.readInt();
1568 boolean result = removeTask(taskId, fl);
1569 reply.writeNoException();
1570 reply.writeInt(result ? 1 : 0);
1571 return true;
1572 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001573
Jeff Sharkeya4620792011-05-20 15:29:23 -07001574 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1575 data.enforceInterface(IActivityManager.descriptor);
1576 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1577 data.readStrongBinder());
1578 registerProcessObserver(observer);
1579 return true;
1580 }
1581
1582 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1585 data.readStrongBinder());
1586 unregisterProcessObserver(observer);
1587 return true;
1588 }
1589
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001590 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1591 {
1592 data.enforceInterface(IActivityManager.descriptor);
1593 String pkg = data.readString();
1594 boolean ask = getPackageAskScreenCompat(pkg);
1595 reply.writeNoException();
1596 reply.writeInt(ask ? 1 : 0);
1597 return true;
1598 }
1599
1600 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1601 {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 String pkg = data.readString();
1604 boolean ask = data.readInt() != 0;
1605 setPackageAskScreenCompat(pkg, ask);
1606 reply.writeNoException();
1607 return true;
1608 }
1609
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001610 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1611 data.enforceInterface(IActivityManager.descriptor);
1612 IIntentSender r = IIntentSender.Stub.asInterface(
1613 data.readStrongBinder());
1614 boolean res = isIntentSenderTargetedToPackage(r);
1615 reply.writeNoException();
1616 reply.writeInt(res ? 1 : 0);
1617 return true;
1618 }
1619
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001620 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1621 data.enforceInterface(IActivityManager.descriptor);
1622 IIntentSender r = IIntentSender.Stub.asInterface(
1623 data.readStrongBinder());
1624 boolean res = isIntentSenderAnActivity(r);
1625 reply.writeNoException();
1626 reply.writeInt(res ? 1 : 0);
1627 return true;
1628 }
1629
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001630 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
1632 Configuration config = Configuration.CREATOR.createFromParcel(data);
1633 updatePersistentConfiguration(config);
1634 reply.writeNoException();
1635 return true;
1636 }
1637
Dianne Hackbornb437e092011-08-05 17:50:29 -07001638 case GET_PROCESS_PSS_TRANSACTION: {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 int[] pids = data.createIntArray();
1641 long[] pss = getProcessPss(pids);
1642 reply.writeNoException();
1643 reply.writeLongArray(pss);
1644 return true;
1645 }
1646
Dianne Hackborn661cd522011-08-22 00:26:20 -07001647 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1648 data.enforceInterface(IActivityManager.descriptor);
1649 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1650 boolean always = data.readInt() != 0;
1651 showBootMessage(msg, always);
1652 reply.writeNoException();
1653 return true;
1654 }
1655
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001656 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1657 data.enforceInterface(IActivityManager.descriptor);
1658 dismissKeyguardOnNextActivity();
1659 reply.writeNoException();
1660 return true;
1661 }
1662
Adam Powelldd8fab22012-03-22 17:47:27 -07001663 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 IBinder token = data.readStrongBinder();
1666 String destAffinity = data.readString();
1667 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1668 reply.writeNoException();
1669 reply.writeInt(res ? 1 : 0);
1670 return true;
1671 }
1672
1673 case NAVIGATE_UP_TO_TRANSACTION: {
1674 data.enforceInterface(IActivityManager.descriptor);
1675 IBinder token = data.readStrongBinder();
1676 Intent target = Intent.CREATOR.createFromParcel(data);
1677 int resultCode = data.readInt();
1678 Intent resultData = null;
1679 if (data.readInt() != 0) {
1680 resultData = Intent.CREATOR.createFromParcel(data);
1681 }
1682 boolean res = navigateUpTo(token, target, resultCode, resultData);
1683 reply.writeNoException();
1684 reply.writeInt(res ? 1 : 0);
1685 return true;
1686 }
1687
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001688 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1689 data.enforceInterface(IActivityManager.descriptor);
1690 IBinder token = data.readStrongBinder();
1691 int res = getLaunchedFromUid(token);
1692 reply.writeNoException();
1693 reply.writeInt(res);
1694 return true;
1695 }
1696
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001697 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001698
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001699 return super.onTransact(code, data, reply, flags);
1700 }
1701
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001702 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001703 return this;
1704 }
1705
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001706 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1707 protected IActivityManager create() {
1708 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001709 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001710 Log.v("ActivityManager", "default service binder = " + b);
1711 }
1712 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001713 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001714 Log.v("ActivityManager", "default service = " + am);
1715 }
1716 return am;
1717 }
1718 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001719}
1720
1721class ActivityManagerProxy implements IActivityManager
1722{
1723 public ActivityManagerProxy(IBinder remote)
1724 {
1725 mRemote = remote;
1726 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001727
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001728 public IBinder asBinder()
1729 {
1730 return mRemote;
1731 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001732
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001733 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001734 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1735 int startFlags, String profileFile,
1736 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001737 Parcel data = Parcel.obtain();
1738 Parcel reply = Parcel.obtain();
1739 data.writeInterfaceToken(IActivityManager.descriptor);
1740 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1741 intent.writeToParcel(data, 0);
1742 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001743 data.writeStrongBinder(resultTo);
1744 data.writeString(resultWho);
1745 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001746 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001747 data.writeString(profileFile);
1748 if (profileFd != null) {
1749 data.writeInt(1);
1750 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1751 } else {
1752 data.writeInt(0);
1753 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001754 if (options != null) {
1755 data.writeInt(1);
1756 options.writeToParcel(data, 0);
1757 } else {
1758 data.writeInt(0);
1759 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001760 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1761 reply.readException();
1762 int result = reply.readInt();
1763 reply.recycle();
1764 data.recycle();
1765 return result;
1766 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001767 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001768 String resolvedType, IBinder resultTo, String resultWho,
1769 int requestCode, int startFlags, String profileFile,
1770 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001771 Parcel data = Parcel.obtain();
1772 Parcel reply = Parcel.obtain();
1773 data.writeInterfaceToken(IActivityManager.descriptor);
1774 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1775 intent.writeToParcel(data, 0);
1776 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001777 data.writeStrongBinder(resultTo);
1778 data.writeString(resultWho);
1779 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001780 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001781 data.writeString(profileFile);
1782 if (profileFd != null) {
1783 data.writeInt(1);
1784 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1785 } else {
1786 data.writeInt(0);
1787 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001788 if (options != null) {
1789 data.writeInt(1);
1790 options.writeToParcel(data, 0);
1791 } else {
1792 data.writeInt(0);
1793 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001794 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1795 reply.readException();
1796 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1797 reply.recycle();
1798 data.recycle();
1799 return result;
1800 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001801 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001802 String resolvedType, IBinder resultTo, String resultWho,
1803 int requestCode, int startFlags, Configuration config,
1804 Bundle options) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001805 Parcel data = Parcel.obtain();
1806 Parcel reply = Parcel.obtain();
1807 data.writeInterfaceToken(IActivityManager.descriptor);
1808 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1809 intent.writeToParcel(data, 0);
1810 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001811 data.writeStrongBinder(resultTo);
1812 data.writeString(resultWho);
1813 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001814 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001815 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001816 if (options != null) {
1817 data.writeInt(1);
1818 options.writeToParcel(data, 0);
1819 } else {
1820 data.writeInt(0);
1821 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001822 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1823 reply.readException();
1824 int result = reply.readInt();
1825 reply.recycle();
1826 data.recycle();
1827 return result;
1828 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001829 public int startActivityIntentSender(IApplicationThread caller,
1830 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001831 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001832 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001833 Parcel data = Parcel.obtain();
1834 Parcel reply = Parcel.obtain();
1835 data.writeInterfaceToken(IActivityManager.descriptor);
1836 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1837 intent.writeToParcel(data, 0);
1838 if (fillInIntent != null) {
1839 data.writeInt(1);
1840 fillInIntent.writeToParcel(data, 0);
1841 } else {
1842 data.writeInt(0);
1843 }
1844 data.writeString(resolvedType);
1845 data.writeStrongBinder(resultTo);
1846 data.writeString(resultWho);
1847 data.writeInt(requestCode);
1848 data.writeInt(flagsMask);
1849 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001850 if (options != null) {
1851 data.writeInt(1);
1852 options.writeToParcel(data, 0);
1853 } else {
1854 data.writeInt(0);
1855 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001856 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001857 reply.readException();
1858 int result = reply.readInt();
1859 reply.recycle();
1860 data.recycle();
1861 return result;
1862 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001863 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001864 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001865 Parcel data = Parcel.obtain();
1866 Parcel reply = Parcel.obtain();
1867 data.writeInterfaceToken(IActivityManager.descriptor);
1868 data.writeStrongBinder(callingActivity);
1869 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001870 if (options != null) {
1871 data.writeInt(1);
1872 options.writeToParcel(data, 0);
1873 } else {
1874 data.writeInt(0);
1875 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001876 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1877 reply.readException();
1878 int result = reply.readInt();
1879 reply.recycle();
1880 data.recycle();
1881 return result != 0;
1882 }
1883 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1884 throws RemoteException {
1885 Parcel data = Parcel.obtain();
1886 Parcel reply = Parcel.obtain();
1887 data.writeInterfaceToken(IActivityManager.descriptor);
1888 data.writeStrongBinder(token);
1889 data.writeInt(resultCode);
1890 if (resultData != null) {
1891 data.writeInt(1);
1892 resultData.writeToParcel(data, 0);
1893 } else {
1894 data.writeInt(0);
1895 }
1896 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1897 reply.readException();
1898 boolean res = reply.readInt() != 0;
1899 data.recycle();
1900 reply.recycle();
1901 return res;
1902 }
1903 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1904 {
1905 Parcel data = Parcel.obtain();
1906 Parcel reply = Parcel.obtain();
1907 data.writeInterfaceToken(IActivityManager.descriptor);
1908 data.writeStrongBinder(token);
1909 data.writeString(resultWho);
1910 data.writeInt(requestCode);
1911 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1912 reply.readException();
1913 data.recycle();
1914 reply.recycle();
1915 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07001916 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
1917 Parcel data = Parcel.obtain();
1918 Parcel reply = Parcel.obtain();
1919 data.writeInterfaceToken(IActivityManager.descriptor);
1920 data.writeStrongBinder(token);
1921 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
1922 reply.readException();
1923 boolean res = reply.readInt() != 0;
1924 data.recycle();
1925 reply.recycle();
1926 return res;
1927 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001928 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1929 Parcel data = Parcel.obtain();
1930 Parcel reply = Parcel.obtain();
1931 data.writeInterfaceToken(IActivityManager.descriptor);
1932 data.writeStrongBinder(token);
1933 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1934 reply.readException();
1935 boolean res = reply.readInt() != 0;
1936 data.recycle();
1937 reply.recycle();
1938 return res;
1939 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001940 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001941 IIntentReceiver receiver,
1942 IntentFilter filter, String perm) throws RemoteException
1943 {
1944 Parcel data = Parcel.obtain();
1945 Parcel reply = Parcel.obtain();
1946 data.writeInterfaceToken(IActivityManager.descriptor);
1947 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001948 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001949 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1950 filter.writeToParcel(data, 0);
1951 data.writeString(perm);
1952 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1953 reply.readException();
1954 Intent intent = null;
1955 int haveIntent = reply.readInt();
1956 if (haveIntent != 0) {
1957 intent = Intent.CREATOR.createFromParcel(reply);
1958 }
1959 reply.recycle();
1960 data.recycle();
1961 return intent;
1962 }
1963 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1964 {
1965 Parcel data = Parcel.obtain();
1966 Parcel reply = Parcel.obtain();
1967 data.writeInterfaceToken(IActivityManager.descriptor);
1968 data.writeStrongBinder(receiver.asBinder());
1969 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1970 reply.readException();
1971 data.recycle();
1972 reply.recycle();
1973 }
1974 public int broadcastIntent(IApplicationThread caller,
1975 Intent intent, String resolvedType, IIntentReceiver resultTo,
1976 int resultCode, String resultData, Bundle map,
1977 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07001978 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001979 {
1980 Parcel data = Parcel.obtain();
1981 Parcel reply = Parcel.obtain();
1982 data.writeInterfaceToken(IActivityManager.descriptor);
1983 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1984 intent.writeToParcel(data, 0);
1985 data.writeString(resolvedType);
1986 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1987 data.writeInt(resultCode);
1988 data.writeString(resultData);
1989 data.writeBundle(map);
1990 data.writeString(requiredPermission);
1991 data.writeInt(serialized ? 1 : 0);
1992 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001993 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001994 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1995 reply.readException();
1996 int res = reply.readInt();
1997 reply.recycle();
1998 data.recycle();
1999 return res;
2000 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002001 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2002 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002003 {
2004 Parcel data = Parcel.obtain();
2005 Parcel reply = Parcel.obtain();
2006 data.writeInterfaceToken(IActivityManager.descriptor);
2007 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2008 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002009 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002010 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2011 reply.readException();
2012 data.recycle();
2013 reply.recycle();
2014 }
2015 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2016 {
2017 Parcel data = Parcel.obtain();
2018 Parcel reply = Parcel.obtain();
2019 data.writeInterfaceToken(IActivityManager.descriptor);
2020 data.writeStrongBinder(who);
2021 data.writeInt(resultCode);
2022 data.writeString(resultData);
2023 data.writeBundle(map);
2024 data.writeInt(abortBroadcast ? 1 : 0);
2025 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2026 reply.readException();
2027 data.recycle();
2028 reply.recycle();
2029 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002030 public void attachApplication(IApplicationThread app) throws RemoteException
2031 {
2032 Parcel data = Parcel.obtain();
2033 Parcel reply = Parcel.obtain();
2034 data.writeInterfaceToken(IActivityManager.descriptor);
2035 data.writeStrongBinder(app.asBinder());
2036 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2037 reply.readException();
2038 data.recycle();
2039 reply.recycle();
2040 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002041 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2042 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002043 {
2044 Parcel data = Parcel.obtain();
2045 Parcel reply = Parcel.obtain();
2046 data.writeInterfaceToken(IActivityManager.descriptor);
2047 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002048 if (config != null) {
2049 data.writeInt(1);
2050 config.writeToParcel(data, 0);
2051 } else {
2052 data.writeInt(0);
2053 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002054 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002055 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2056 reply.readException();
2057 data.recycle();
2058 reply.recycle();
2059 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002060 public void activityPaused(IBinder token) throws RemoteException
2061 {
2062 Parcel data = Parcel.obtain();
2063 Parcel reply = Parcel.obtain();
2064 data.writeInterfaceToken(IActivityManager.descriptor);
2065 data.writeStrongBinder(token);
2066 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2067 reply.readException();
2068 data.recycle();
2069 reply.recycle();
2070 }
2071 public void activityStopped(IBinder token, Bundle state,
2072 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002073 {
2074 Parcel data = Parcel.obtain();
2075 Parcel reply = Parcel.obtain();
2076 data.writeInterfaceToken(IActivityManager.descriptor);
2077 data.writeStrongBinder(token);
2078 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002079 if (thumbnail != null) {
2080 data.writeInt(1);
2081 thumbnail.writeToParcel(data, 0);
2082 } else {
2083 data.writeInt(0);
2084 }
2085 TextUtils.writeToParcel(description, data, 0);
2086 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2087 reply.readException();
2088 data.recycle();
2089 reply.recycle();
2090 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002091 public void activitySlept(IBinder token) throws RemoteException
2092 {
2093 Parcel data = Parcel.obtain();
2094 Parcel reply = Parcel.obtain();
2095 data.writeInterfaceToken(IActivityManager.descriptor);
2096 data.writeStrongBinder(token);
2097 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2098 reply.readException();
2099 data.recycle();
2100 reply.recycle();
2101 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002102 public void activityDestroyed(IBinder token) throws RemoteException
2103 {
2104 Parcel data = Parcel.obtain();
2105 Parcel reply = Parcel.obtain();
2106 data.writeInterfaceToken(IActivityManager.descriptor);
2107 data.writeStrongBinder(token);
2108 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2109 reply.readException();
2110 data.recycle();
2111 reply.recycle();
2112 }
2113 public String getCallingPackage(IBinder token) throws RemoteException
2114 {
2115 Parcel data = Parcel.obtain();
2116 Parcel reply = Parcel.obtain();
2117 data.writeInterfaceToken(IActivityManager.descriptor);
2118 data.writeStrongBinder(token);
2119 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2120 reply.readException();
2121 String res = reply.readString();
2122 data.recycle();
2123 reply.recycle();
2124 return res;
2125 }
2126 public ComponentName getCallingActivity(IBinder token)
2127 throws RemoteException {
2128 Parcel data = Parcel.obtain();
2129 Parcel reply = Parcel.obtain();
2130 data.writeInterfaceToken(IActivityManager.descriptor);
2131 data.writeStrongBinder(token);
2132 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2133 reply.readException();
2134 ComponentName res = ComponentName.readFromParcel(reply);
2135 data.recycle();
2136 reply.recycle();
2137 return res;
2138 }
2139 public List getTasks(int maxNum, int flags,
2140 IThumbnailReceiver receiver) throws RemoteException {
2141 Parcel data = Parcel.obtain();
2142 Parcel reply = Parcel.obtain();
2143 data.writeInterfaceToken(IActivityManager.descriptor);
2144 data.writeInt(maxNum);
2145 data.writeInt(flags);
2146 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2147 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2148 reply.readException();
2149 ArrayList list = null;
2150 int N = reply.readInt();
2151 if (N >= 0) {
2152 list = new ArrayList();
2153 while (N > 0) {
2154 ActivityManager.RunningTaskInfo info =
2155 ActivityManager.RunningTaskInfo.CREATOR
2156 .createFromParcel(reply);
2157 list.add(info);
2158 N--;
2159 }
2160 }
2161 data.recycle();
2162 reply.recycle();
2163 return list;
2164 }
2165 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2166 int flags) throws RemoteException {
2167 Parcel data = Parcel.obtain();
2168 Parcel reply = Parcel.obtain();
2169 data.writeInterfaceToken(IActivityManager.descriptor);
2170 data.writeInt(maxNum);
2171 data.writeInt(flags);
2172 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2173 reply.readException();
2174 ArrayList<ActivityManager.RecentTaskInfo> list
2175 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2176 data.recycle();
2177 reply.recycle();
2178 return list;
2179 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002180 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002181 Parcel data = Parcel.obtain();
2182 Parcel reply = Parcel.obtain();
2183 data.writeInterfaceToken(IActivityManager.descriptor);
2184 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002185 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002186 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002187 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002188 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002189 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002190 }
2191 data.recycle();
2192 reply.recycle();
2193 return bm;
2194 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002195 public List getServices(int maxNum, int flags) throws RemoteException {
2196 Parcel data = Parcel.obtain();
2197 Parcel reply = Parcel.obtain();
2198 data.writeInterfaceToken(IActivityManager.descriptor);
2199 data.writeInt(maxNum);
2200 data.writeInt(flags);
2201 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2202 reply.readException();
2203 ArrayList list = null;
2204 int N = reply.readInt();
2205 if (N >= 0) {
2206 list = new ArrayList();
2207 while (N > 0) {
2208 ActivityManager.RunningServiceInfo info =
2209 ActivityManager.RunningServiceInfo.CREATOR
2210 .createFromParcel(reply);
2211 list.add(info);
2212 N--;
2213 }
2214 }
2215 data.recycle();
2216 reply.recycle();
2217 return list;
2218 }
2219 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2220 throws RemoteException {
2221 Parcel data = Parcel.obtain();
2222 Parcel reply = Parcel.obtain();
2223 data.writeInterfaceToken(IActivityManager.descriptor);
2224 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2225 reply.readException();
2226 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2227 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2228 data.recycle();
2229 reply.recycle();
2230 return list;
2231 }
2232 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2233 throws RemoteException {
2234 Parcel data = Parcel.obtain();
2235 Parcel reply = Parcel.obtain();
2236 data.writeInterfaceToken(IActivityManager.descriptor);
2237 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2238 reply.readException();
2239 ArrayList<ActivityManager.RunningAppProcessInfo> list
2240 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2241 data.recycle();
2242 reply.recycle();
2243 return list;
2244 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002245 public List<ApplicationInfo> getRunningExternalApplications()
2246 throws RemoteException {
2247 Parcel data = Parcel.obtain();
2248 Parcel reply = Parcel.obtain();
2249 data.writeInterfaceToken(IActivityManager.descriptor);
2250 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2251 reply.readException();
2252 ArrayList<ApplicationInfo> list
2253 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2254 data.recycle();
2255 reply.recycle();
2256 return list;
2257 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002258 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002259 {
2260 Parcel data = Parcel.obtain();
2261 Parcel reply = Parcel.obtain();
2262 data.writeInterfaceToken(IActivityManager.descriptor);
2263 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002264 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002265 if (options != null) {
2266 data.writeInt(1);
2267 options.writeToParcel(data, 0);
2268 } else {
2269 data.writeInt(0);
2270 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002271 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2272 reply.readException();
2273 data.recycle();
2274 reply.recycle();
2275 }
2276 public void moveTaskToBack(int task) throws RemoteException
2277 {
2278 Parcel data = Parcel.obtain();
2279 Parcel reply = Parcel.obtain();
2280 data.writeInterfaceToken(IActivityManager.descriptor);
2281 data.writeInt(task);
2282 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2283 reply.readException();
2284 data.recycle();
2285 reply.recycle();
2286 }
2287 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2288 throws RemoteException {
2289 Parcel data = Parcel.obtain();
2290 Parcel reply = Parcel.obtain();
2291 data.writeInterfaceToken(IActivityManager.descriptor);
2292 data.writeStrongBinder(token);
2293 data.writeInt(nonRoot ? 1 : 0);
2294 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2295 reply.readException();
2296 boolean res = reply.readInt() != 0;
2297 data.recycle();
2298 reply.recycle();
2299 return res;
2300 }
2301 public void moveTaskBackwards(int task) throws RemoteException
2302 {
2303 Parcel data = Parcel.obtain();
2304 Parcel reply = Parcel.obtain();
2305 data.writeInterfaceToken(IActivityManager.descriptor);
2306 data.writeInt(task);
2307 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2308 reply.readException();
2309 data.recycle();
2310 reply.recycle();
2311 }
2312 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2313 {
2314 Parcel data = Parcel.obtain();
2315 Parcel reply = Parcel.obtain();
2316 data.writeInterfaceToken(IActivityManager.descriptor);
2317 data.writeStrongBinder(token);
2318 data.writeInt(onlyRoot ? 1 : 0);
2319 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2320 reply.readException();
2321 int res = reply.readInt();
2322 data.recycle();
2323 reply.recycle();
2324 return res;
2325 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002326 public void reportThumbnail(IBinder token,
2327 Bitmap thumbnail, CharSequence description) throws RemoteException
2328 {
2329 Parcel data = Parcel.obtain();
2330 Parcel reply = Parcel.obtain();
2331 data.writeInterfaceToken(IActivityManager.descriptor);
2332 data.writeStrongBinder(token);
2333 if (thumbnail != null) {
2334 data.writeInt(1);
2335 thumbnail.writeToParcel(data, 0);
2336 } else {
2337 data.writeInt(0);
2338 }
2339 TextUtils.writeToParcel(description, data, 0);
2340 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2341 reply.readException();
2342 data.recycle();
2343 reply.recycle();
2344 }
2345 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002346 String name, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002347 Parcel data = Parcel.obtain();
2348 Parcel reply = Parcel.obtain();
2349 data.writeInterfaceToken(IActivityManager.descriptor);
2350 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2351 data.writeString(name);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002352 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002353 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2354 reply.readException();
2355 int res = reply.readInt();
2356 ContentProviderHolder cph = null;
2357 if (res != 0) {
2358 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2359 }
2360 data.recycle();
2361 reply.recycle();
2362 return cph;
2363 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002364 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2365 throws RemoteException
2366 {
2367 Parcel data = Parcel.obtain();
2368 Parcel reply = Parcel.obtain();
2369 data.writeInterfaceToken(IActivityManager.descriptor);
2370 data.writeString(name);
2371 data.writeStrongBinder(token);
2372 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2373 reply.readException();
2374 int res = reply.readInt();
2375 ContentProviderHolder cph = null;
2376 if (res != 0) {
2377 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2378 }
2379 data.recycle();
2380 reply.recycle();
2381 return cph;
2382 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002383 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002384 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002385 {
2386 Parcel data = Parcel.obtain();
2387 Parcel reply = Parcel.obtain();
2388 data.writeInterfaceToken(IActivityManager.descriptor);
2389 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2390 data.writeTypedList(providers);
2391 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2392 reply.readException();
2393 data.recycle();
2394 reply.recycle();
2395 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002396 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2397 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002398 Parcel data = Parcel.obtain();
2399 Parcel reply = Parcel.obtain();
2400 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002401 data.writeStrongBinder(connection);
2402 data.writeInt(stable);
2403 data.writeInt(unstable);
2404 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2405 reply.readException();
2406 boolean res = reply.readInt() != 0;
2407 data.recycle();
2408 reply.recycle();
2409 return res;
2410 }
2411 public void unstableProviderDied(IBinder connection) throws RemoteException {
2412 Parcel data = Parcel.obtain();
2413 Parcel reply = Parcel.obtain();
2414 data.writeInterfaceToken(IActivityManager.descriptor);
2415 data.writeStrongBinder(connection);
2416 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2417 reply.readException();
2418 data.recycle();
2419 reply.recycle();
2420 }
2421
2422 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2423 Parcel data = Parcel.obtain();
2424 Parcel reply = Parcel.obtain();
2425 data.writeInterfaceToken(IActivityManager.descriptor);
2426 data.writeStrongBinder(connection);
2427 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002428 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2429 reply.readException();
2430 data.recycle();
2431 reply.recycle();
2432 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002433
2434 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2435 Parcel data = Parcel.obtain();
2436 Parcel reply = Parcel.obtain();
2437 data.writeInterfaceToken(IActivityManager.descriptor);
2438 data.writeString(name);
2439 data.writeStrongBinder(token);
2440 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2441 reply.readException();
2442 data.recycle();
2443 reply.recycle();
2444 }
2445
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002446 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2447 throws RemoteException
2448 {
2449 Parcel data = Parcel.obtain();
2450 Parcel reply = Parcel.obtain();
2451 data.writeInterfaceToken(IActivityManager.descriptor);
2452 service.writeToParcel(data, 0);
2453 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2454 reply.readException();
2455 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2456 data.recycle();
2457 reply.recycle();
2458 return res;
2459 }
2460
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002461 public ComponentName startService(IApplicationThread caller, Intent service,
2462 String resolvedType) throws RemoteException
2463 {
2464 Parcel data = Parcel.obtain();
2465 Parcel reply = Parcel.obtain();
2466 data.writeInterfaceToken(IActivityManager.descriptor);
2467 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2468 service.writeToParcel(data, 0);
2469 data.writeString(resolvedType);
2470 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2471 reply.readException();
2472 ComponentName res = ComponentName.readFromParcel(reply);
2473 data.recycle();
2474 reply.recycle();
2475 return res;
2476 }
2477 public int stopService(IApplicationThread caller, Intent service,
2478 String resolvedType) throws RemoteException
2479 {
2480 Parcel data = Parcel.obtain();
2481 Parcel reply = Parcel.obtain();
2482 data.writeInterfaceToken(IActivityManager.descriptor);
2483 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2484 service.writeToParcel(data, 0);
2485 data.writeString(resolvedType);
2486 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2487 reply.readException();
2488 int res = reply.readInt();
2489 reply.recycle();
2490 data.recycle();
2491 return res;
2492 }
2493 public boolean stopServiceToken(ComponentName className, IBinder token,
2494 int startId) throws RemoteException {
2495 Parcel data = Parcel.obtain();
2496 Parcel reply = Parcel.obtain();
2497 data.writeInterfaceToken(IActivityManager.descriptor);
2498 ComponentName.writeToParcel(className, data);
2499 data.writeStrongBinder(token);
2500 data.writeInt(startId);
2501 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2502 reply.readException();
2503 boolean res = reply.readInt() != 0;
2504 data.recycle();
2505 reply.recycle();
2506 return res;
2507 }
2508 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002509 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002510 Parcel data = Parcel.obtain();
2511 Parcel reply = Parcel.obtain();
2512 data.writeInterfaceToken(IActivityManager.descriptor);
2513 ComponentName.writeToParcel(className, data);
2514 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002515 data.writeInt(id);
2516 if (notification != null) {
2517 data.writeInt(1);
2518 notification.writeToParcel(data, 0);
2519 } else {
2520 data.writeInt(0);
2521 }
2522 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002523 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2524 reply.readException();
2525 data.recycle();
2526 reply.recycle();
2527 }
2528 public int bindService(IApplicationThread caller, IBinder token,
2529 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002530 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002531 Parcel data = Parcel.obtain();
2532 Parcel reply = Parcel.obtain();
2533 data.writeInterfaceToken(IActivityManager.descriptor);
2534 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2535 data.writeStrongBinder(token);
2536 service.writeToParcel(data, 0);
2537 data.writeString(resolvedType);
2538 data.writeStrongBinder(connection.asBinder());
2539 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002540 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002541 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2542 reply.readException();
2543 int res = reply.readInt();
2544 data.recycle();
2545 reply.recycle();
2546 return res;
2547 }
2548 public boolean unbindService(IServiceConnection connection) throws RemoteException
2549 {
2550 Parcel data = Parcel.obtain();
2551 Parcel reply = Parcel.obtain();
2552 data.writeInterfaceToken(IActivityManager.descriptor);
2553 data.writeStrongBinder(connection.asBinder());
2554 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2555 reply.readException();
2556 boolean res = reply.readInt() != 0;
2557 data.recycle();
2558 reply.recycle();
2559 return res;
2560 }
2561
2562 public void publishService(IBinder token,
2563 Intent intent, IBinder service) throws RemoteException {
2564 Parcel data = Parcel.obtain();
2565 Parcel reply = Parcel.obtain();
2566 data.writeInterfaceToken(IActivityManager.descriptor);
2567 data.writeStrongBinder(token);
2568 intent.writeToParcel(data, 0);
2569 data.writeStrongBinder(service);
2570 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2571 reply.readException();
2572 data.recycle();
2573 reply.recycle();
2574 }
2575
2576 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2577 throws RemoteException {
2578 Parcel data = Parcel.obtain();
2579 Parcel reply = Parcel.obtain();
2580 data.writeInterfaceToken(IActivityManager.descriptor);
2581 data.writeStrongBinder(token);
2582 intent.writeToParcel(data, 0);
2583 data.writeInt(doRebind ? 1 : 0);
2584 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2585 reply.readException();
2586 data.recycle();
2587 reply.recycle();
2588 }
2589
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002590 public void serviceDoneExecuting(IBinder token, int type, int startId,
2591 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002592 Parcel data = Parcel.obtain();
2593 Parcel reply = Parcel.obtain();
2594 data.writeInterfaceToken(IActivityManager.descriptor);
2595 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002596 data.writeInt(type);
2597 data.writeInt(startId);
2598 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002599 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2600 reply.readException();
2601 data.recycle();
2602 reply.recycle();
2603 }
2604
2605 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2606 Parcel data = Parcel.obtain();
2607 Parcel reply = Parcel.obtain();
2608 data.writeInterfaceToken(IActivityManager.descriptor);
2609 service.writeToParcel(data, 0);
2610 data.writeString(resolvedType);
2611 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2612 reply.readException();
2613 IBinder binder = reply.readStrongBinder();
2614 reply.recycle();
2615 data.recycle();
2616 return binder;
2617 }
2618
Christopher Tate181fafa2009-05-14 11:12:14 -07002619 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2620 throws RemoteException {
2621 Parcel data = Parcel.obtain();
2622 Parcel reply = Parcel.obtain();
2623 data.writeInterfaceToken(IActivityManager.descriptor);
2624 app.writeToParcel(data, 0);
2625 data.writeInt(backupRestoreMode);
2626 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2627 reply.readException();
2628 boolean success = reply.readInt() != 0;
2629 reply.recycle();
2630 data.recycle();
2631 return success;
2632 }
2633
2634 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2635 Parcel data = Parcel.obtain();
2636 Parcel reply = Parcel.obtain();
2637 data.writeInterfaceToken(IActivityManager.descriptor);
2638 data.writeString(packageName);
2639 data.writeStrongBinder(agent);
2640 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2641 reply.recycle();
2642 data.recycle();
2643 }
2644
2645 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2646 Parcel data = Parcel.obtain();
2647 Parcel reply = Parcel.obtain();
2648 data.writeInterfaceToken(IActivityManager.descriptor);
2649 app.writeToParcel(data, 0);
2650 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2651 reply.readException();
2652 reply.recycle();
2653 data.recycle();
2654 }
2655
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 public boolean startInstrumentation(ComponentName className, String profileFile,
2657 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2658 throws RemoteException {
2659 Parcel data = Parcel.obtain();
2660 Parcel reply = Parcel.obtain();
2661 data.writeInterfaceToken(IActivityManager.descriptor);
2662 ComponentName.writeToParcel(className, data);
2663 data.writeString(profileFile);
2664 data.writeInt(flags);
2665 data.writeBundle(arguments);
2666 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2667 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2668 reply.readException();
2669 boolean res = reply.readInt() != 0;
2670 reply.recycle();
2671 data.recycle();
2672 return res;
2673 }
2674
2675 public void finishInstrumentation(IApplicationThread target,
2676 int resultCode, Bundle results) throws RemoteException {
2677 Parcel data = Parcel.obtain();
2678 Parcel reply = Parcel.obtain();
2679 data.writeInterfaceToken(IActivityManager.descriptor);
2680 data.writeStrongBinder(target != null ? target.asBinder() : null);
2681 data.writeInt(resultCode);
2682 data.writeBundle(results);
2683 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2684 reply.readException();
2685 data.recycle();
2686 reply.recycle();
2687 }
2688 public Configuration getConfiguration() throws RemoteException
2689 {
2690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
2692 data.writeInterfaceToken(IActivityManager.descriptor);
2693 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2694 reply.readException();
2695 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2696 reply.recycle();
2697 data.recycle();
2698 return res;
2699 }
2700 public void updateConfiguration(Configuration values) throws RemoteException
2701 {
2702 Parcel data = Parcel.obtain();
2703 Parcel reply = Parcel.obtain();
2704 data.writeInterfaceToken(IActivityManager.descriptor);
2705 values.writeToParcel(data, 0);
2706 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2707 reply.readException();
2708 data.recycle();
2709 reply.recycle();
2710 }
2711 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2712 throws RemoteException {
2713 Parcel data = Parcel.obtain();
2714 Parcel reply = Parcel.obtain();
2715 data.writeInterfaceToken(IActivityManager.descriptor);
2716 data.writeStrongBinder(token);
2717 data.writeInt(requestedOrientation);
2718 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2719 reply.readException();
2720 data.recycle();
2721 reply.recycle();
2722 }
2723 public int getRequestedOrientation(IBinder token) throws RemoteException {
2724 Parcel data = Parcel.obtain();
2725 Parcel reply = Parcel.obtain();
2726 data.writeInterfaceToken(IActivityManager.descriptor);
2727 data.writeStrongBinder(token);
2728 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2729 reply.readException();
2730 int res = reply.readInt();
2731 data.recycle();
2732 reply.recycle();
2733 return res;
2734 }
2735 public ComponentName getActivityClassForToken(IBinder token)
2736 throws RemoteException {
2737 Parcel data = Parcel.obtain();
2738 Parcel reply = Parcel.obtain();
2739 data.writeInterfaceToken(IActivityManager.descriptor);
2740 data.writeStrongBinder(token);
2741 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2742 reply.readException();
2743 ComponentName res = ComponentName.readFromParcel(reply);
2744 data.recycle();
2745 reply.recycle();
2746 return res;
2747 }
2748 public String getPackageForToken(IBinder token) throws RemoteException
2749 {
2750 Parcel data = Parcel.obtain();
2751 Parcel reply = Parcel.obtain();
2752 data.writeInterfaceToken(IActivityManager.descriptor);
2753 data.writeStrongBinder(token);
2754 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2755 reply.readException();
2756 String res = reply.readString();
2757 data.recycle();
2758 reply.recycle();
2759 return res;
2760 }
2761 public IIntentSender getIntentSender(int type,
2762 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002763 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
2764 Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002765 Parcel data = Parcel.obtain();
2766 Parcel reply = Parcel.obtain();
2767 data.writeInterfaceToken(IActivityManager.descriptor);
2768 data.writeInt(type);
2769 data.writeString(packageName);
2770 data.writeStrongBinder(token);
2771 data.writeString(resultWho);
2772 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002773 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002774 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002775 data.writeTypedArray(intents, 0);
2776 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002777 } else {
2778 data.writeInt(0);
2779 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002780 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002781 if (options != null) {
2782 data.writeInt(1);
2783 options.writeToParcel(data, 0);
2784 } else {
2785 data.writeInt(0);
2786 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002787 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2788 reply.readException();
2789 IIntentSender res = IIntentSender.Stub.asInterface(
2790 reply.readStrongBinder());
2791 data.recycle();
2792 reply.recycle();
2793 return res;
2794 }
2795 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2796 Parcel data = Parcel.obtain();
2797 Parcel reply = Parcel.obtain();
2798 data.writeInterfaceToken(IActivityManager.descriptor);
2799 data.writeStrongBinder(sender.asBinder());
2800 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2801 reply.readException();
2802 data.recycle();
2803 reply.recycle();
2804 }
2805 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2806 Parcel data = Parcel.obtain();
2807 Parcel reply = Parcel.obtain();
2808 data.writeInterfaceToken(IActivityManager.descriptor);
2809 data.writeStrongBinder(sender.asBinder());
2810 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2811 reply.readException();
2812 String res = reply.readString();
2813 data.recycle();
2814 reply.recycle();
2815 return res;
2816 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002817 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2818 Parcel data = Parcel.obtain();
2819 Parcel reply = Parcel.obtain();
2820 data.writeInterfaceToken(IActivityManager.descriptor);
2821 data.writeStrongBinder(sender.asBinder());
2822 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2823 reply.readException();
2824 int res = reply.readInt();
2825 data.recycle();
2826 reply.recycle();
2827 return res;
2828 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002829 public void setProcessLimit(int max) throws RemoteException
2830 {
2831 Parcel data = Parcel.obtain();
2832 Parcel reply = Parcel.obtain();
2833 data.writeInterfaceToken(IActivityManager.descriptor);
2834 data.writeInt(max);
2835 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2836 reply.readException();
2837 data.recycle();
2838 reply.recycle();
2839 }
2840 public int getProcessLimit() throws RemoteException
2841 {
2842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2846 reply.readException();
2847 int res = reply.readInt();
2848 data.recycle();
2849 reply.recycle();
2850 return res;
2851 }
2852 public void setProcessForeground(IBinder token, int pid,
2853 boolean isForeground) throws RemoteException {
2854 Parcel data = Parcel.obtain();
2855 Parcel reply = Parcel.obtain();
2856 data.writeInterfaceToken(IActivityManager.descriptor);
2857 data.writeStrongBinder(token);
2858 data.writeInt(pid);
2859 data.writeInt(isForeground ? 1 : 0);
2860 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2861 reply.readException();
2862 data.recycle();
2863 reply.recycle();
2864 }
2865 public int checkPermission(String permission, int pid, int uid)
2866 throws RemoteException {
2867 Parcel data = Parcel.obtain();
2868 Parcel reply = Parcel.obtain();
2869 data.writeInterfaceToken(IActivityManager.descriptor);
2870 data.writeString(permission);
2871 data.writeInt(pid);
2872 data.writeInt(uid);
2873 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2874 reply.readException();
2875 int res = reply.readInt();
2876 data.recycle();
2877 reply.recycle();
2878 return res;
2879 }
2880 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002881 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
2884 data.writeInterfaceToken(IActivityManager.descriptor);
2885 data.writeString(packageName);
2886 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002887 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002888 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2889 reply.readException();
2890 boolean res = reply.readInt() != 0;
2891 data.recycle();
2892 reply.recycle();
2893 return res;
2894 }
2895 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2896 throws RemoteException {
2897 Parcel data = Parcel.obtain();
2898 Parcel reply = Parcel.obtain();
2899 data.writeInterfaceToken(IActivityManager.descriptor);
2900 uri.writeToParcel(data, 0);
2901 data.writeInt(pid);
2902 data.writeInt(uid);
2903 data.writeInt(mode);
2904 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2905 reply.readException();
2906 int res = reply.readInt();
2907 data.recycle();
2908 reply.recycle();
2909 return res;
2910 }
2911 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2912 Uri uri, int mode) throws RemoteException {
2913 Parcel data = Parcel.obtain();
2914 Parcel reply = Parcel.obtain();
2915 data.writeInterfaceToken(IActivityManager.descriptor);
2916 data.writeStrongBinder(caller.asBinder());
2917 data.writeString(targetPkg);
2918 uri.writeToParcel(data, 0);
2919 data.writeInt(mode);
2920 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2921 reply.readException();
2922 data.recycle();
2923 reply.recycle();
2924 }
2925 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2926 int mode) throws RemoteException {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 data.writeStrongBinder(caller.asBinder());
2931 uri.writeToParcel(data, 0);
2932 data.writeInt(mode);
2933 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2934 reply.readException();
2935 data.recycle();
2936 reply.recycle();
2937 }
2938 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2939 throws RemoteException {
2940 Parcel data = Parcel.obtain();
2941 Parcel reply = Parcel.obtain();
2942 data.writeInterfaceToken(IActivityManager.descriptor);
2943 data.writeStrongBinder(who.asBinder());
2944 data.writeInt(waiting ? 1 : 0);
2945 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2946 reply.readException();
2947 data.recycle();
2948 reply.recycle();
2949 }
2950 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2951 Parcel data = Parcel.obtain();
2952 Parcel reply = Parcel.obtain();
2953 data.writeInterfaceToken(IActivityManager.descriptor);
2954 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 outInfo.readFromParcel(reply);
2957 data.recycle();
2958 reply.recycle();
2959 }
2960 public void unhandledBack() throws RemoteException
2961 {
2962 Parcel data = Parcel.obtain();
2963 Parcel reply = Parcel.obtain();
2964 data.writeInterfaceToken(IActivityManager.descriptor);
2965 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2966 reply.readException();
2967 data.recycle();
2968 reply.recycle();
2969 }
2970 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2971 {
2972 Parcel data = Parcel.obtain();
2973 Parcel reply = Parcel.obtain();
2974 data.writeInterfaceToken(IActivityManager.descriptor);
2975 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2976 reply.readException();
2977 ParcelFileDescriptor pfd = null;
2978 if (reply.readInt() != 0) {
2979 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2980 }
2981 data.recycle();
2982 reply.recycle();
2983 return pfd;
2984 }
2985 public void goingToSleep() throws RemoteException
2986 {
2987 Parcel data = Parcel.obtain();
2988 Parcel reply = Parcel.obtain();
2989 data.writeInterfaceToken(IActivityManager.descriptor);
2990 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2991 reply.readException();
2992 data.recycle();
2993 reply.recycle();
2994 }
2995 public void wakingUp() throws RemoteException
2996 {
2997 Parcel data = Parcel.obtain();
2998 Parcel reply = Parcel.obtain();
2999 data.writeInterfaceToken(IActivityManager.descriptor);
3000 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3001 reply.readException();
3002 data.recycle();
3003 reply.recycle();
3004 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003005 public void setLockScreenShown(boolean shown) throws RemoteException
3006 {
3007 Parcel data = Parcel.obtain();
3008 Parcel reply = Parcel.obtain();
3009 data.writeInterfaceToken(IActivityManager.descriptor);
3010 data.writeInt(shown ? 1 : 0);
3011 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3012 reply.readException();
3013 data.recycle();
3014 reply.recycle();
3015 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 public void setDebugApp(
3017 String packageName, boolean waitForDebugger, boolean persistent)
3018 throws RemoteException
3019 {
3020 Parcel data = Parcel.obtain();
3021 Parcel reply = Parcel.obtain();
3022 data.writeInterfaceToken(IActivityManager.descriptor);
3023 data.writeString(packageName);
3024 data.writeInt(waitForDebugger ? 1 : 0);
3025 data.writeInt(persistent ? 1 : 0);
3026 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3027 reply.readException();
3028 data.recycle();
3029 reply.recycle();
3030 }
3031 public void setAlwaysFinish(boolean enabled) throws RemoteException
3032 {
3033 Parcel data = Parcel.obtain();
3034 Parcel reply = Parcel.obtain();
3035 data.writeInterfaceToken(IActivityManager.descriptor);
3036 data.writeInt(enabled ? 1 : 0);
3037 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3038 reply.readException();
3039 data.recycle();
3040 reply.recycle();
3041 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003042 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003043 {
3044 Parcel data = Parcel.obtain();
3045 Parcel reply = Parcel.obtain();
3046 data.writeInterfaceToken(IActivityManager.descriptor);
3047 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003048 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003049 reply.readException();
3050 data.recycle();
3051 reply.recycle();
3052 }
3053 public void enterSafeMode() throws RemoteException {
3054 Parcel data = Parcel.obtain();
3055 data.writeInterfaceToken(IActivityManager.descriptor);
3056 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3057 data.recycle();
3058 }
3059 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3060 Parcel data = Parcel.obtain();
3061 data.writeStrongBinder(sender.asBinder());
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3064 data.recycle();
3065 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003066 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003071 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003072 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003073 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003074 boolean res = reply.readInt() != 0;
3075 data.recycle();
3076 reply.recycle();
3077 return res;
3078 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003079 @Override
3080 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3081 Parcel data = Parcel.obtain();
3082 Parcel reply = Parcel.obtain();
3083 data.writeInterfaceToken(IActivityManager.descriptor);
3084 data.writeString(reason);
3085 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3086 boolean res = reply.readInt() != 0;
3087 data.recycle();
3088 reply.recycle();
3089 return res;
3090 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003091 public void startRunning(String pkg, String cls, String action,
3092 String indata) throws RemoteException {
3093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 data.writeString(pkg);
3097 data.writeString(cls);
3098 data.writeString(action);
3099 data.writeString(indata);
3100 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3101 reply.readException();
3102 data.recycle();
3103 reply.recycle();
3104 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003105 public boolean testIsSystemReady()
3106 {
3107 /* this base class version is never called */
3108 return true;
3109 }
Dan Egnor60d87622009-12-16 16:32:58 -08003110 public void handleApplicationCrash(IBinder app,
3111 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3112 {
3113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeStrongBinder(app);
3117 crashInfo.writeToParcel(data, 0);
3118 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3119 reply.readException();
3120 reply.recycle();
3121 data.recycle();
3122 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003123
Dan Egnor60d87622009-12-16 16:32:58 -08003124 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003125 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003126 {
3127 Parcel data = Parcel.obtain();
3128 Parcel reply = Parcel.obtain();
3129 data.writeInterfaceToken(IActivityManager.descriptor);
3130 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003131 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003132 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003133 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003134 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003135 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003136 reply.recycle();
3137 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003138 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003139 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003140
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003141 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003142 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003143 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003144 {
3145 Parcel data = Parcel.obtain();
3146 Parcel reply = Parcel.obtain();
3147 data.writeInterfaceToken(IActivityManager.descriptor);
3148 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003149 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003150 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003151 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3152 reply.readException();
3153 reply.recycle();
3154 data.recycle();
3155 }
3156
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003157 public void signalPersistentProcesses(int sig) throws RemoteException {
3158 Parcel data = Parcel.obtain();
3159 Parcel reply = Parcel.obtain();
3160 data.writeInterfaceToken(IActivityManager.descriptor);
3161 data.writeInt(sig);
3162 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 data.recycle();
3165 reply.recycle();
3166 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003167
Dianne Hackborn03abb812010-01-04 18:43:19 -08003168 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003169 Parcel data = Parcel.obtain();
3170 Parcel reply = Parcel.obtain();
3171 data.writeInterfaceToken(IActivityManager.descriptor);
3172 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003173 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3174 reply.readException();
3175 data.recycle();
3176 reply.recycle();
3177 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003178
3179 public void killAllBackgroundProcesses() throws RemoteException {
3180 Parcel data = Parcel.obtain();
3181 Parcel reply = Parcel.obtain();
3182 data.writeInterfaceToken(IActivityManager.descriptor);
3183 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3184 reply.readException();
3185 data.recycle();
3186 reply.recycle();
3187 }
3188
Dianne Hackborn03abb812010-01-04 18:43:19 -08003189 public void forceStopPackage(String packageName) throws RemoteException {
3190 Parcel data = Parcel.obtain();
3191 Parcel reply = Parcel.obtain();
3192 data.writeInterfaceToken(IActivityManager.descriptor);
3193 data.writeString(packageName);
3194 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003195 reply.readException();
3196 data.recycle();
3197 reply.recycle();
3198 }
3199
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003200 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3201 throws RemoteException
3202 {
3203 Parcel data = Parcel.obtain();
3204 Parcel reply = Parcel.obtain();
3205 data.writeInterfaceToken(IActivityManager.descriptor);
3206 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3207 reply.readException();
3208 outInfo.readFromParcel(reply);
3209 reply.recycle();
3210 data.recycle();
3211 }
3212
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003213 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3214 {
3215 Parcel data = Parcel.obtain();
3216 Parcel reply = Parcel.obtain();
3217 data.writeInterfaceToken(IActivityManager.descriptor);
3218 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3219 reply.readException();
3220 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3221 reply.recycle();
3222 data.recycle();
3223 return res;
3224 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003225
3226 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003227 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003228 {
3229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 data.writeString(process);
3233 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003234 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003235 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003236 if (fd != null) {
3237 data.writeInt(1);
3238 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3239 } else {
3240 data.writeInt(0);
3241 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003242 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3243 reply.readException();
3244 boolean res = reply.readInt() != 0;
3245 reply.recycle();
3246 data.recycle();
3247 return res;
3248 }
3249
Dianne Hackborn55280a92009-05-07 15:53:46 -07003250 public boolean shutdown(int timeout) throws RemoteException
3251 {
3252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 data.writeInt(timeout);
3256 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3257 reply.readException();
3258 boolean res = reply.readInt() != 0;
3259 reply.recycle();
3260 data.recycle();
3261 return res;
3262 }
3263
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003264 public void stopAppSwitches() throws RemoteException {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3269 reply.readException();
3270 reply.recycle();
3271 data.recycle();
3272 }
3273
3274 public void resumeAppSwitches() throws RemoteException {
3275 Parcel data = Parcel.obtain();
3276 Parcel reply = Parcel.obtain();
3277 data.writeInterfaceToken(IActivityManager.descriptor);
3278 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3279 reply.readException();
3280 reply.recycle();
3281 data.recycle();
3282 }
3283
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003284 public int startActivityInPackage(int uid,
3285 Intent intent, String resolvedType, IBinder resultTo,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003286 String resultWho, int requestCode, int startFlags, Bundle options)
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003287 throws RemoteException {
3288 Parcel data = Parcel.obtain();
3289 Parcel reply = Parcel.obtain();
3290 data.writeInterfaceToken(IActivityManager.descriptor);
3291 data.writeInt(uid);
3292 intent.writeToParcel(data, 0);
3293 data.writeString(resolvedType);
3294 data.writeStrongBinder(resultTo);
3295 data.writeString(resultWho);
3296 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003297 data.writeInt(startFlags);
3298 if (options != null) {
3299 data.writeInt(1);
3300 options.writeToParcel(data, 0);
3301 } else {
3302 data.writeInt(0);
3303 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003304 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3305 reply.readException();
3306 int result = reply.readInt();
3307 reply.recycle();
3308 data.recycle();
3309 return result;
3310 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003311
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003312 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3313 Parcel data = Parcel.obtain();
3314 Parcel reply = Parcel.obtain();
3315 data.writeInterfaceToken(IActivityManager.descriptor);
3316 data.writeString(pkg);
3317 data.writeInt(uid);
3318 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3319 reply.readException();
3320 data.recycle();
3321 reply.recycle();
3322 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003323
3324 public void closeSystemDialogs(String reason) throws RemoteException {
3325 Parcel data = Parcel.obtain();
3326 Parcel reply = Parcel.obtain();
3327 data.writeInterfaceToken(IActivityManager.descriptor);
3328 data.writeString(reason);
3329 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 data.recycle();
3332 reply.recycle();
3333 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003334
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003335 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003336 throws RemoteException {
3337 Parcel data = Parcel.obtain();
3338 Parcel reply = Parcel.obtain();
3339 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003340 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003341 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3342 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003343 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003344 data.recycle();
3345 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003346 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003347 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003348
3349 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3350 Parcel data = Parcel.obtain();
3351 Parcel reply = Parcel.obtain();
3352 data.writeInterfaceToken(IActivityManager.descriptor);
3353 data.writeString(processName);
3354 data.writeInt(uid);
3355 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3356 reply.readException();
3357 data.recycle();
3358 reply.recycle();
3359 }
3360
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003361 public void overridePendingTransition(IBinder token, String packageName,
3362 int enterAnim, int exitAnim) throws RemoteException {
3363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 data.writeStrongBinder(token);
3367 data.writeString(packageName);
3368 data.writeInt(enterAnim);
3369 data.writeInt(exitAnim);
3370 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3371 reply.readException();
3372 data.recycle();
3373 reply.recycle();
3374 }
3375
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003376 public boolean isUserAMonkey() throws RemoteException {
3377 Parcel data = Parcel.obtain();
3378 Parcel reply = Parcel.obtain();
3379 data.writeInterfaceToken(IActivityManager.descriptor);
3380 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3381 reply.readException();
3382 boolean res = reply.readInt() != 0;
3383 data.recycle();
3384 reply.recycle();
3385 return res;
3386 }
3387
Dianne Hackborn860755f2010-06-03 18:47:52 -07003388 public void finishHeavyWeightApp() throws RemoteException {
3389 Parcel data = Parcel.obtain();
3390 Parcel reply = Parcel.obtain();
3391 data.writeInterfaceToken(IActivityManager.descriptor);
3392 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3393 reply.readException();
3394 data.recycle();
3395 reply.recycle();
3396 }
3397
Daniel Sandler69a48172010-06-23 16:29:36 -04003398 public void setImmersive(IBinder token, boolean immersive)
3399 throws RemoteException {
3400 Parcel data = Parcel.obtain();
3401 Parcel reply = Parcel.obtain();
3402 data.writeInterfaceToken(IActivityManager.descriptor);
3403 data.writeStrongBinder(token);
3404 data.writeInt(immersive ? 1 : 0);
3405 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3406 reply.readException();
3407 data.recycle();
3408 reply.recycle();
3409 }
3410
3411 public boolean isImmersive(IBinder token)
3412 throws RemoteException {
3413 Parcel data = Parcel.obtain();
3414 Parcel reply = Parcel.obtain();
3415 data.writeInterfaceToken(IActivityManager.descriptor);
3416 data.writeStrongBinder(token);
3417 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003418 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003419 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003420 data.recycle();
3421 reply.recycle();
3422 return res;
3423 }
3424
3425 public boolean isTopActivityImmersive()
3426 throws RemoteException {
3427 Parcel data = Parcel.obtain();
3428 Parcel reply = Parcel.obtain();
3429 data.writeInterfaceToken(IActivityManager.descriptor);
3430 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003431 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003432 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003433 data.recycle();
3434 reply.recycle();
3435 return res;
3436 }
3437
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003438 public void crashApplication(int uid, int initialPid, String packageName,
3439 String message) throws RemoteException {
3440 Parcel data = Parcel.obtain();
3441 Parcel reply = Parcel.obtain();
3442 data.writeInterfaceToken(IActivityManager.descriptor);
3443 data.writeInt(uid);
3444 data.writeInt(initialPid);
3445 data.writeString(packageName);
3446 data.writeString(message);
3447 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3448 reply.readException();
3449 data.recycle();
3450 reply.recycle();
3451 }
Andy McFadden824c5102010-07-09 16:26:57 -07003452
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003453 public String getProviderMimeType(Uri uri)
3454 throws RemoteException {
3455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 uri.writeToParcel(data, 0);
3459 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3460 reply.readException();
3461 String res = reply.readString();
3462 data.recycle();
3463 reply.recycle();
3464 return res;
3465 }
3466
Dianne Hackborn7e269642010-08-25 19:50:20 -07003467 public IBinder newUriPermissionOwner(String name)
3468 throws RemoteException {
3469 Parcel data = Parcel.obtain();
3470 Parcel reply = Parcel.obtain();
3471 data.writeInterfaceToken(IActivityManager.descriptor);
3472 data.writeString(name);
3473 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3474 reply.readException();
3475 IBinder res = reply.readStrongBinder();
3476 data.recycle();
3477 reply.recycle();
3478 return res;
3479 }
3480
3481 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3482 Uri uri, int mode) throws RemoteException {
3483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 data.writeStrongBinder(owner);
3487 data.writeInt(fromUid);
3488 data.writeString(targetPkg);
3489 uri.writeToParcel(data, 0);
3490 data.writeInt(mode);
3491 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3492 reply.readException();
3493 data.recycle();
3494 reply.recycle();
3495 }
3496
3497 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3498 int mode) throws RemoteException {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 data.writeStrongBinder(owner);
3503 if (uri != null) {
3504 data.writeInt(1);
3505 uri.writeToParcel(data, 0);
3506 } else {
3507 data.writeInt(0);
3508 }
3509 data.writeInt(mode);
3510 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3511 reply.readException();
3512 data.recycle();
3513 reply.recycle();
3514 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003515
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003516 public int checkGrantUriPermission(int callingUid, String targetPkg,
3517 Uri uri, int modeFlags) throws RemoteException {
3518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeInt(callingUid);
3522 data.writeString(targetPkg);
3523 uri.writeToParcel(data, 0);
3524 data.writeInt(modeFlags);
3525 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 int res = reply.readInt();
3528 data.recycle();
3529 reply.recycle();
3530 return res;
3531 }
3532
Andy McFadden824c5102010-07-09 16:26:57 -07003533 public boolean dumpHeap(String process, boolean managed,
3534 String path, ParcelFileDescriptor fd) throws RemoteException {
3535 Parcel data = Parcel.obtain();
3536 Parcel reply = Parcel.obtain();
3537 data.writeInterfaceToken(IActivityManager.descriptor);
3538 data.writeString(process);
3539 data.writeInt(managed ? 1 : 0);
3540 data.writeString(path);
3541 if (fd != null) {
3542 data.writeInt(1);
3543 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3544 } else {
3545 data.writeInt(0);
3546 }
3547 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3548 reply.readException();
3549 boolean res = reply.readInt() != 0;
3550 reply.recycle();
3551 data.recycle();
3552 return res;
3553 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003554
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003555 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003556 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3557 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003558 Parcel data = Parcel.obtain();
3559 Parcel reply = Parcel.obtain();
3560 data.writeInterfaceToken(IActivityManager.descriptor);
3561 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3562 data.writeTypedArray(intents, 0);
3563 data.writeStringArray(resolvedTypes);
3564 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003565 if (options != null) {
3566 data.writeInt(1);
3567 options.writeToParcel(data, 0);
3568 } else {
3569 data.writeInt(0);
3570 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003571 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3572 reply.readException();
3573 int result = reply.readInt();
3574 reply.recycle();
3575 data.recycle();
3576 return result;
3577 }
3578
3579 public int startActivitiesInPackage(int uid,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003580 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3581 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 data.writeInt(uid);
3586 data.writeTypedArray(intents, 0);
3587 data.writeStringArray(resolvedTypes);
3588 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003589 if (options != null) {
3590 data.writeInt(1);
3591 options.writeToParcel(data, 0);
3592 } else {
3593 data.writeInt(0);
3594 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003595 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3596 reply.readException();
3597 int result = reply.readInt();
3598 reply.recycle();
3599 data.recycle();
3600 return result;
3601 }
3602
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003603 public int getFrontActivityScreenCompatMode() throws RemoteException {
3604 Parcel data = Parcel.obtain();
3605 Parcel reply = Parcel.obtain();
3606 data.writeInterfaceToken(IActivityManager.descriptor);
3607 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3608 reply.readException();
3609 int mode = reply.readInt();
3610 reply.recycle();
3611 data.recycle();
3612 return mode;
3613 }
3614
3615 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3616 Parcel data = Parcel.obtain();
3617 Parcel reply = Parcel.obtain();
3618 data.writeInterfaceToken(IActivityManager.descriptor);
3619 data.writeInt(mode);
3620 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3621 reply.readException();
3622 reply.recycle();
3623 data.recycle();
3624 }
3625
3626 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3627 Parcel data = Parcel.obtain();
3628 Parcel reply = Parcel.obtain();
3629 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003630 data.writeString(packageName);
3631 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003632 reply.readException();
3633 int mode = reply.readInt();
3634 reply.recycle();
3635 data.recycle();
3636 return mode;
3637 }
3638
3639 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003640 throws RemoteException {
3641 Parcel data = Parcel.obtain();
3642 Parcel reply = Parcel.obtain();
3643 data.writeInterfaceToken(IActivityManager.descriptor);
3644 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003645 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003646 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 reply.recycle();
3649 data.recycle();
3650 }
3651
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003652 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 data.writeString(packageName);
3657 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 boolean ask = reply.readInt() != 0;
3660 reply.recycle();
3661 data.recycle();
3662 return ask;
3663 }
3664
3665 public void setPackageAskScreenCompat(String packageName, boolean ask)
3666 throws RemoteException {
3667 Parcel data = Parcel.obtain();
3668 Parcel reply = Parcel.obtain();
3669 data.writeInterfaceToken(IActivityManager.descriptor);
3670 data.writeString(packageName);
3671 data.writeInt(ask ? 1 : 0);
3672 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3673 reply.readException();
3674 reply.recycle();
3675 data.recycle();
3676 }
3677
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003678 public boolean switchUser(int userid) throws RemoteException {
3679 Parcel data = Parcel.obtain();
3680 Parcel reply = Parcel.obtain();
3681 data.writeInterfaceToken(IActivityManager.descriptor);
3682 data.writeInt(userid);
3683 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 boolean result = reply.readInt() != 0;
3686 reply.recycle();
3687 data.recycle();
3688 return result;
3689 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003690
3691 public UserInfo getCurrentUser() throws RemoteException {
3692 Parcel data = Parcel.obtain();
3693 Parcel reply = Parcel.obtain();
3694 data.writeInterfaceToken(IActivityManager.descriptor);
3695 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3696 reply.readException();
3697 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3698 reply.recycle();
3699 data.recycle();
3700 return userInfo;
3701 }
3702
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003703 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 data.writeInt(taskId);
3708 data.writeInt(subTaskIndex);
3709 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3710 reply.readException();
3711 boolean result = reply.readInt() != 0;
3712 reply.recycle();
3713 data.recycle();
3714 return result;
3715 }
3716
3717 public boolean removeTask(int taskId, int flags) throws RemoteException {
3718 Parcel data = Parcel.obtain();
3719 Parcel reply = Parcel.obtain();
3720 data.writeInterfaceToken(IActivityManager.descriptor);
3721 data.writeInt(taskId);
3722 data.writeInt(flags);
3723 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3724 reply.readException();
3725 boolean result = reply.readInt() != 0;
3726 reply.recycle();
3727 data.recycle();
3728 return result;
3729 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003730
Jeff Sharkeya4620792011-05-20 15:29:23 -07003731 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3732 Parcel data = Parcel.obtain();
3733 Parcel reply = Parcel.obtain();
3734 data.writeInterfaceToken(IActivityManager.descriptor);
3735 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3736 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3737 reply.readException();
3738 data.recycle();
3739 reply.recycle();
3740 }
3741
3742 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3743 Parcel data = Parcel.obtain();
3744 Parcel reply = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3747 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3748 reply.readException();
3749 data.recycle();
3750 reply.recycle();
3751 }
3752
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003753 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3754 Parcel data = Parcel.obtain();
3755 Parcel reply = Parcel.obtain();
3756 data.writeInterfaceToken(IActivityManager.descriptor);
3757 data.writeStrongBinder(sender.asBinder());
3758 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3759 reply.readException();
3760 boolean res = reply.readInt() != 0;
3761 data.recycle();
3762 reply.recycle();
3763 return res;
3764 }
3765
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003766 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3767 Parcel data = Parcel.obtain();
3768 Parcel reply = Parcel.obtain();
3769 data.writeInterfaceToken(IActivityManager.descriptor);
3770 data.writeStrongBinder(sender.asBinder());
3771 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3772 reply.readException();
3773 boolean res = reply.readInt() != 0;
3774 data.recycle();
3775 reply.recycle();
3776 return res;
3777 }
3778
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003779 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3780 {
3781 Parcel data = Parcel.obtain();
3782 Parcel reply = Parcel.obtain();
3783 data.writeInterfaceToken(IActivityManager.descriptor);
3784 values.writeToParcel(data, 0);
3785 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3786 reply.readException();
3787 data.recycle();
3788 reply.recycle();
3789 }
3790
Dianne Hackbornb437e092011-08-05 17:50:29 -07003791 public long[] getProcessPss(int[] pids) throws RemoteException {
3792 Parcel data = Parcel.obtain();
3793 Parcel reply = Parcel.obtain();
3794 data.writeInterfaceToken(IActivityManager.descriptor);
3795 data.writeIntArray(pids);
3796 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3797 reply.readException();
3798 long[] res = reply.createLongArray();
3799 data.recycle();
3800 reply.recycle();
3801 return res;
3802 }
3803
Dianne Hackborn661cd522011-08-22 00:26:20 -07003804 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
3808 TextUtils.writeToParcel(msg, data, 0);
3809 data.writeInt(always ? 1 : 0);
3810 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3811 reply.readException();
3812 data.recycle();
3813 reply.recycle();
3814 }
3815
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003816 public void dismissKeyguardOnNextActivity() throws RemoteException {
3817 Parcel data = Parcel.obtain();
3818 Parcel reply = Parcel.obtain();
3819 data.writeInterfaceToken(IActivityManager.descriptor);
3820 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3821 reply.readException();
3822 data.recycle();
3823 reply.recycle();
3824 }
3825
Adam Powelldd8fab22012-03-22 17:47:27 -07003826 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3827 throws RemoteException {
3828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
3831 data.writeStrongBinder(token);
3832 data.writeString(destAffinity);
3833 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3834 reply.readException();
3835 boolean result = reply.readInt() != 0;
3836 data.recycle();
3837 reply.recycle();
3838 return result;
3839 }
3840
3841 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3842 throws RemoteException {
3843 Parcel data = Parcel.obtain();
3844 Parcel reply = Parcel.obtain();
3845 data.writeInterfaceToken(IActivityManager.descriptor);
3846 data.writeStrongBinder(token);
3847 target.writeToParcel(data, 0);
3848 data.writeInt(resultCode);
3849 if (resultData != null) {
3850 data.writeInt(1);
3851 resultData.writeToParcel(data, 0);
3852 } else {
3853 data.writeInt(0);
3854 }
3855 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3856 reply.readException();
3857 boolean result = reply.readInt() != 0;
3858 data.recycle();
3859 reply.recycle();
3860 return result;
3861 }
3862
Dianne Hackborn5320eb82012-05-18 12:05:04 -07003863 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
3864 Parcel data = Parcel.obtain();
3865 Parcel reply = Parcel.obtain();
3866 data.writeInterfaceToken(IActivityManager.descriptor);
3867 data.writeStrongBinder(activityToken);
3868 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
3869 reply.readException();
3870 int result = reply.readInt();
3871 data.recycle();
3872 reply.recycle();
3873 return result;
3874 }
3875
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003876 private IBinder mRemote;
3877}