blob: 2ed93f49e1b6e5cb5ea531f3ecfd3d860094fd44 [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 Hackborn31ca8542011-07-19 14:58:28 -07001620 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1621 data.enforceInterface(IActivityManager.descriptor);
1622 Configuration config = Configuration.CREATOR.createFromParcel(data);
1623 updatePersistentConfiguration(config);
1624 reply.writeNoException();
1625 return true;
1626 }
1627
Dianne Hackbornb437e092011-08-05 17:50:29 -07001628 case GET_PROCESS_PSS_TRANSACTION: {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 int[] pids = data.createIntArray();
1631 long[] pss = getProcessPss(pids);
1632 reply.writeNoException();
1633 reply.writeLongArray(pss);
1634 return true;
1635 }
1636
Dianne Hackborn661cd522011-08-22 00:26:20 -07001637 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1638 data.enforceInterface(IActivityManager.descriptor);
1639 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1640 boolean always = data.readInt() != 0;
1641 showBootMessage(msg, always);
1642 reply.writeNoException();
1643 return true;
1644 }
1645
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001646 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1647 data.enforceInterface(IActivityManager.descriptor);
1648 dismissKeyguardOnNextActivity();
1649 reply.writeNoException();
1650 return true;
1651 }
1652
Adam Powelldd8fab22012-03-22 17:47:27 -07001653 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1654 data.enforceInterface(IActivityManager.descriptor);
1655 IBinder token = data.readStrongBinder();
1656 String destAffinity = data.readString();
1657 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1658 reply.writeNoException();
1659 reply.writeInt(res ? 1 : 0);
1660 return true;
1661 }
1662
1663 case NAVIGATE_UP_TO_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 IBinder token = data.readStrongBinder();
1666 Intent target = Intent.CREATOR.createFromParcel(data);
1667 int resultCode = data.readInt();
1668 Intent resultData = null;
1669 if (data.readInt() != 0) {
1670 resultData = Intent.CREATOR.createFromParcel(data);
1671 }
1672 boolean res = navigateUpTo(token, target, resultCode, resultData);
1673 reply.writeNoException();
1674 reply.writeInt(res ? 1 : 0);
1675 return true;
1676 }
1677
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001678 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1679 data.enforceInterface(IActivityManager.descriptor);
1680 IBinder token = data.readStrongBinder();
1681 int res = getLaunchedFromUid(token);
1682 reply.writeNoException();
1683 reply.writeInt(res);
1684 return true;
1685 }
1686
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001687 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001688
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001689 return super.onTransact(code, data, reply, flags);
1690 }
1691
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001692 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001693 return this;
1694 }
1695
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001696 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1697 protected IActivityManager create() {
1698 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001699 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001700 Log.v("ActivityManager", "default service binder = " + b);
1701 }
1702 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001703 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001704 Log.v("ActivityManager", "default service = " + am);
1705 }
1706 return am;
1707 }
1708 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001709}
1710
1711class ActivityManagerProxy implements IActivityManager
1712{
1713 public ActivityManagerProxy(IBinder remote)
1714 {
1715 mRemote = remote;
1716 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001718 public IBinder asBinder()
1719 {
1720 return mRemote;
1721 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001722
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001723 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001724 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1725 int startFlags, String profileFile,
1726 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001727 Parcel data = Parcel.obtain();
1728 Parcel reply = Parcel.obtain();
1729 data.writeInterfaceToken(IActivityManager.descriptor);
1730 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1731 intent.writeToParcel(data, 0);
1732 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001733 data.writeStrongBinder(resultTo);
1734 data.writeString(resultWho);
1735 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001736 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001737 data.writeString(profileFile);
1738 if (profileFd != null) {
1739 data.writeInt(1);
1740 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1741 } else {
1742 data.writeInt(0);
1743 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001744 if (options != null) {
1745 data.writeInt(1);
1746 options.writeToParcel(data, 0);
1747 } else {
1748 data.writeInt(0);
1749 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001750 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1751 reply.readException();
1752 int result = reply.readInt();
1753 reply.recycle();
1754 data.recycle();
1755 return result;
1756 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001757 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001758 String resolvedType, IBinder resultTo, String resultWho,
1759 int requestCode, int startFlags, String profileFile,
1760 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001761 Parcel data = Parcel.obtain();
1762 Parcel reply = Parcel.obtain();
1763 data.writeInterfaceToken(IActivityManager.descriptor);
1764 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1765 intent.writeToParcel(data, 0);
1766 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001767 data.writeStrongBinder(resultTo);
1768 data.writeString(resultWho);
1769 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001770 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001771 data.writeString(profileFile);
1772 if (profileFd != null) {
1773 data.writeInt(1);
1774 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1775 } else {
1776 data.writeInt(0);
1777 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001778 if (options != null) {
1779 data.writeInt(1);
1780 options.writeToParcel(data, 0);
1781 } else {
1782 data.writeInt(0);
1783 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001784 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1785 reply.readException();
1786 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1787 reply.recycle();
1788 data.recycle();
1789 return result;
1790 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001791 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001792 String resolvedType, IBinder resultTo, String resultWho,
1793 int requestCode, int startFlags, Configuration config,
1794 Bundle options) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001795 Parcel data = Parcel.obtain();
1796 Parcel reply = Parcel.obtain();
1797 data.writeInterfaceToken(IActivityManager.descriptor);
1798 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1799 intent.writeToParcel(data, 0);
1800 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001801 data.writeStrongBinder(resultTo);
1802 data.writeString(resultWho);
1803 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001804 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001805 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001806 if (options != null) {
1807 data.writeInt(1);
1808 options.writeToParcel(data, 0);
1809 } else {
1810 data.writeInt(0);
1811 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001812 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1813 reply.readException();
1814 int result = reply.readInt();
1815 reply.recycle();
1816 data.recycle();
1817 return result;
1818 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001819 public int startActivityIntentSender(IApplicationThread caller,
1820 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001821 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001822 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001823 Parcel data = Parcel.obtain();
1824 Parcel reply = Parcel.obtain();
1825 data.writeInterfaceToken(IActivityManager.descriptor);
1826 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1827 intent.writeToParcel(data, 0);
1828 if (fillInIntent != null) {
1829 data.writeInt(1);
1830 fillInIntent.writeToParcel(data, 0);
1831 } else {
1832 data.writeInt(0);
1833 }
1834 data.writeString(resolvedType);
1835 data.writeStrongBinder(resultTo);
1836 data.writeString(resultWho);
1837 data.writeInt(requestCode);
1838 data.writeInt(flagsMask);
1839 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001840 if (options != null) {
1841 data.writeInt(1);
1842 options.writeToParcel(data, 0);
1843 } else {
1844 data.writeInt(0);
1845 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001846 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001847 reply.readException();
1848 int result = reply.readInt();
1849 reply.recycle();
1850 data.recycle();
1851 return result;
1852 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001853 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001854 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001855 Parcel data = Parcel.obtain();
1856 Parcel reply = Parcel.obtain();
1857 data.writeInterfaceToken(IActivityManager.descriptor);
1858 data.writeStrongBinder(callingActivity);
1859 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001860 if (options != null) {
1861 data.writeInt(1);
1862 options.writeToParcel(data, 0);
1863 } else {
1864 data.writeInt(0);
1865 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001866 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1867 reply.readException();
1868 int result = reply.readInt();
1869 reply.recycle();
1870 data.recycle();
1871 return result != 0;
1872 }
1873 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1874 throws RemoteException {
1875 Parcel data = Parcel.obtain();
1876 Parcel reply = Parcel.obtain();
1877 data.writeInterfaceToken(IActivityManager.descriptor);
1878 data.writeStrongBinder(token);
1879 data.writeInt(resultCode);
1880 if (resultData != null) {
1881 data.writeInt(1);
1882 resultData.writeToParcel(data, 0);
1883 } else {
1884 data.writeInt(0);
1885 }
1886 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1887 reply.readException();
1888 boolean res = reply.readInt() != 0;
1889 data.recycle();
1890 reply.recycle();
1891 return res;
1892 }
1893 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1894 {
1895 Parcel data = Parcel.obtain();
1896 Parcel reply = Parcel.obtain();
1897 data.writeInterfaceToken(IActivityManager.descriptor);
1898 data.writeStrongBinder(token);
1899 data.writeString(resultWho);
1900 data.writeInt(requestCode);
1901 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1902 reply.readException();
1903 data.recycle();
1904 reply.recycle();
1905 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07001906 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
1907 Parcel data = Parcel.obtain();
1908 Parcel reply = Parcel.obtain();
1909 data.writeInterfaceToken(IActivityManager.descriptor);
1910 data.writeStrongBinder(token);
1911 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
1912 reply.readException();
1913 boolean res = reply.readInt() != 0;
1914 data.recycle();
1915 reply.recycle();
1916 return res;
1917 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001918 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1919 Parcel data = Parcel.obtain();
1920 Parcel reply = Parcel.obtain();
1921 data.writeInterfaceToken(IActivityManager.descriptor);
1922 data.writeStrongBinder(token);
1923 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1924 reply.readException();
1925 boolean res = reply.readInt() != 0;
1926 data.recycle();
1927 reply.recycle();
1928 return res;
1929 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001930 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001931 IIntentReceiver receiver,
1932 IntentFilter filter, String perm) throws RemoteException
1933 {
1934 Parcel data = Parcel.obtain();
1935 Parcel reply = Parcel.obtain();
1936 data.writeInterfaceToken(IActivityManager.descriptor);
1937 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001938 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001939 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1940 filter.writeToParcel(data, 0);
1941 data.writeString(perm);
1942 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1943 reply.readException();
1944 Intent intent = null;
1945 int haveIntent = reply.readInt();
1946 if (haveIntent != 0) {
1947 intent = Intent.CREATOR.createFromParcel(reply);
1948 }
1949 reply.recycle();
1950 data.recycle();
1951 return intent;
1952 }
1953 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1954 {
1955 Parcel data = Parcel.obtain();
1956 Parcel reply = Parcel.obtain();
1957 data.writeInterfaceToken(IActivityManager.descriptor);
1958 data.writeStrongBinder(receiver.asBinder());
1959 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1960 reply.readException();
1961 data.recycle();
1962 reply.recycle();
1963 }
1964 public int broadcastIntent(IApplicationThread caller,
1965 Intent intent, String resolvedType, IIntentReceiver resultTo,
1966 int resultCode, String resultData, Bundle map,
1967 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07001968 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001969 {
1970 Parcel data = Parcel.obtain();
1971 Parcel reply = Parcel.obtain();
1972 data.writeInterfaceToken(IActivityManager.descriptor);
1973 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1974 intent.writeToParcel(data, 0);
1975 data.writeString(resolvedType);
1976 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1977 data.writeInt(resultCode);
1978 data.writeString(resultData);
1979 data.writeBundle(map);
1980 data.writeString(requiredPermission);
1981 data.writeInt(serialized ? 1 : 0);
1982 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001983 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001984 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1985 reply.readException();
1986 int res = reply.readInt();
1987 reply.recycle();
1988 data.recycle();
1989 return res;
1990 }
Amith Yamasani742a6712011-05-04 14:49:28 -07001991 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
1992 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001993 {
1994 Parcel data = Parcel.obtain();
1995 Parcel reply = Parcel.obtain();
1996 data.writeInterfaceToken(IActivityManager.descriptor);
1997 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1998 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001999 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002000 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2001 reply.readException();
2002 data.recycle();
2003 reply.recycle();
2004 }
2005 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2006 {
2007 Parcel data = Parcel.obtain();
2008 Parcel reply = Parcel.obtain();
2009 data.writeInterfaceToken(IActivityManager.descriptor);
2010 data.writeStrongBinder(who);
2011 data.writeInt(resultCode);
2012 data.writeString(resultData);
2013 data.writeBundle(map);
2014 data.writeInt(abortBroadcast ? 1 : 0);
2015 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2016 reply.readException();
2017 data.recycle();
2018 reply.recycle();
2019 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002020 public void attachApplication(IApplicationThread app) throws RemoteException
2021 {
2022 Parcel data = Parcel.obtain();
2023 Parcel reply = Parcel.obtain();
2024 data.writeInterfaceToken(IActivityManager.descriptor);
2025 data.writeStrongBinder(app.asBinder());
2026 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2027 reply.readException();
2028 data.recycle();
2029 reply.recycle();
2030 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002031 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2032 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002033 {
2034 Parcel data = Parcel.obtain();
2035 Parcel reply = Parcel.obtain();
2036 data.writeInterfaceToken(IActivityManager.descriptor);
2037 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002038 if (config != null) {
2039 data.writeInt(1);
2040 config.writeToParcel(data, 0);
2041 } else {
2042 data.writeInt(0);
2043 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002044 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002045 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2046 reply.readException();
2047 data.recycle();
2048 reply.recycle();
2049 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002050 public void activityPaused(IBinder token) throws RemoteException
2051 {
2052 Parcel data = Parcel.obtain();
2053 Parcel reply = Parcel.obtain();
2054 data.writeInterfaceToken(IActivityManager.descriptor);
2055 data.writeStrongBinder(token);
2056 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2057 reply.readException();
2058 data.recycle();
2059 reply.recycle();
2060 }
2061 public void activityStopped(IBinder token, Bundle state,
2062 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002063 {
2064 Parcel data = Parcel.obtain();
2065 Parcel reply = Parcel.obtain();
2066 data.writeInterfaceToken(IActivityManager.descriptor);
2067 data.writeStrongBinder(token);
2068 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002069 if (thumbnail != null) {
2070 data.writeInt(1);
2071 thumbnail.writeToParcel(data, 0);
2072 } else {
2073 data.writeInt(0);
2074 }
2075 TextUtils.writeToParcel(description, data, 0);
2076 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2077 reply.readException();
2078 data.recycle();
2079 reply.recycle();
2080 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002081 public void activitySlept(IBinder token) throws RemoteException
2082 {
2083 Parcel data = Parcel.obtain();
2084 Parcel reply = Parcel.obtain();
2085 data.writeInterfaceToken(IActivityManager.descriptor);
2086 data.writeStrongBinder(token);
2087 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2088 reply.readException();
2089 data.recycle();
2090 reply.recycle();
2091 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002092 public void activityDestroyed(IBinder token) throws RemoteException
2093 {
2094 Parcel data = Parcel.obtain();
2095 Parcel reply = Parcel.obtain();
2096 data.writeInterfaceToken(IActivityManager.descriptor);
2097 data.writeStrongBinder(token);
2098 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2099 reply.readException();
2100 data.recycle();
2101 reply.recycle();
2102 }
2103 public String getCallingPackage(IBinder token) throws RemoteException
2104 {
2105 Parcel data = Parcel.obtain();
2106 Parcel reply = Parcel.obtain();
2107 data.writeInterfaceToken(IActivityManager.descriptor);
2108 data.writeStrongBinder(token);
2109 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2110 reply.readException();
2111 String res = reply.readString();
2112 data.recycle();
2113 reply.recycle();
2114 return res;
2115 }
2116 public ComponentName getCallingActivity(IBinder token)
2117 throws RemoteException {
2118 Parcel data = Parcel.obtain();
2119 Parcel reply = Parcel.obtain();
2120 data.writeInterfaceToken(IActivityManager.descriptor);
2121 data.writeStrongBinder(token);
2122 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2123 reply.readException();
2124 ComponentName res = ComponentName.readFromParcel(reply);
2125 data.recycle();
2126 reply.recycle();
2127 return res;
2128 }
2129 public List getTasks(int maxNum, int flags,
2130 IThumbnailReceiver receiver) throws RemoteException {
2131 Parcel data = Parcel.obtain();
2132 Parcel reply = Parcel.obtain();
2133 data.writeInterfaceToken(IActivityManager.descriptor);
2134 data.writeInt(maxNum);
2135 data.writeInt(flags);
2136 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2137 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2138 reply.readException();
2139 ArrayList list = null;
2140 int N = reply.readInt();
2141 if (N >= 0) {
2142 list = new ArrayList();
2143 while (N > 0) {
2144 ActivityManager.RunningTaskInfo info =
2145 ActivityManager.RunningTaskInfo.CREATOR
2146 .createFromParcel(reply);
2147 list.add(info);
2148 N--;
2149 }
2150 }
2151 data.recycle();
2152 reply.recycle();
2153 return list;
2154 }
2155 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2156 int flags) throws RemoteException {
2157 Parcel data = Parcel.obtain();
2158 Parcel reply = Parcel.obtain();
2159 data.writeInterfaceToken(IActivityManager.descriptor);
2160 data.writeInt(maxNum);
2161 data.writeInt(flags);
2162 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2163 reply.readException();
2164 ArrayList<ActivityManager.RecentTaskInfo> list
2165 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2166 data.recycle();
2167 reply.recycle();
2168 return list;
2169 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002170 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002171 Parcel data = Parcel.obtain();
2172 Parcel reply = Parcel.obtain();
2173 data.writeInterfaceToken(IActivityManager.descriptor);
2174 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002175 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002176 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002177 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002178 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002179 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002180 }
2181 data.recycle();
2182 reply.recycle();
2183 return bm;
2184 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002185 public List getServices(int maxNum, int flags) throws RemoteException {
2186 Parcel data = Parcel.obtain();
2187 Parcel reply = Parcel.obtain();
2188 data.writeInterfaceToken(IActivityManager.descriptor);
2189 data.writeInt(maxNum);
2190 data.writeInt(flags);
2191 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2192 reply.readException();
2193 ArrayList list = null;
2194 int N = reply.readInt();
2195 if (N >= 0) {
2196 list = new ArrayList();
2197 while (N > 0) {
2198 ActivityManager.RunningServiceInfo info =
2199 ActivityManager.RunningServiceInfo.CREATOR
2200 .createFromParcel(reply);
2201 list.add(info);
2202 N--;
2203 }
2204 }
2205 data.recycle();
2206 reply.recycle();
2207 return list;
2208 }
2209 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2210 throws RemoteException {
2211 Parcel data = Parcel.obtain();
2212 Parcel reply = Parcel.obtain();
2213 data.writeInterfaceToken(IActivityManager.descriptor);
2214 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2215 reply.readException();
2216 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2217 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2218 data.recycle();
2219 reply.recycle();
2220 return list;
2221 }
2222 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2223 throws RemoteException {
2224 Parcel data = Parcel.obtain();
2225 Parcel reply = Parcel.obtain();
2226 data.writeInterfaceToken(IActivityManager.descriptor);
2227 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2228 reply.readException();
2229 ArrayList<ActivityManager.RunningAppProcessInfo> list
2230 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2231 data.recycle();
2232 reply.recycle();
2233 return list;
2234 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002235 public List<ApplicationInfo> getRunningExternalApplications()
2236 throws RemoteException {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2241 reply.readException();
2242 ArrayList<ApplicationInfo> list
2243 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2244 data.recycle();
2245 reply.recycle();
2246 return list;
2247 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002248 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002249 {
2250 Parcel data = Parcel.obtain();
2251 Parcel reply = Parcel.obtain();
2252 data.writeInterfaceToken(IActivityManager.descriptor);
2253 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002254 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002255 if (options != null) {
2256 data.writeInt(1);
2257 options.writeToParcel(data, 0);
2258 } else {
2259 data.writeInt(0);
2260 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002261 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2262 reply.readException();
2263 data.recycle();
2264 reply.recycle();
2265 }
2266 public void moveTaskToBack(int task) throws RemoteException
2267 {
2268 Parcel data = Parcel.obtain();
2269 Parcel reply = Parcel.obtain();
2270 data.writeInterfaceToken(IActivityManager.descriptor);
2271 data.writeInt(task);
2272 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2273 reply.readException();
2274 data.recycle();
2275 reply.recycle();
2276 }
2277 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2278 throws RemoteException {
2279 Parcel data = Parcel.obtain();
2280 Parcel reply = Parcel.obtain();
2281 data.writeInterfaceToken(IActivityManager.descriptor);
2282 data.writeStrongBinder(token);
2283 data.writeInt(nonRoot ? 1 : 0);
2284 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2285 reply.readException();
2286 boolean res = reply.readInt() != 0;
2287 data.recycle();
2288 reply.recycle();
2289 return res;
2290 }
2291 public void moveTaskBackwards(int task) throws RemoteException
2292 {
2293 Parcel data = Parcel.obtain();
2294 Parcel reply = Parcel.obtain();
2295 data.writeInterfaceToken(IActivityManager.descriptor);
2296 data.writeInt(task);
2297 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2298 reply.readException();
2299 data.recycle();
2300 reply.recycle();
2301 }
2302 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2303 {
2304 Parcel data = Parcel.obtain();
2305 Parcel reply = Parcel.obtain();
2306 data.writeInterfaceToken(IActivityManager.descriptor);
2307 data.writeStrongBinder(token);
2308 data.writeInt(onlyRoot ? 1 : 0);
2309 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2310 reply.readException();
2311 int res = reply.readInt();
2312 data.recycle();
2313 reply.recycle();
2314 return res;
2315 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002316 public void reportThumbnail(IBinder token,
2317 Bitmap thumbnail, CharSequence description) throws RemoteException
2318 {
2319 Parcel data = Parcel.obtain();
2320 Parcel reply = Parcel.obtain();
2321 data.writeInterfaceToken(IActivityManager.descriptor);
2322 data.writeStrongBinder(token);
2323 if (thumbnail != null) {
2324 data.writeInt(1);
2325 thumbnail.writeToParcel(data, 0);
2326 } else {
2327 data.writeInt(0);
2328 }
2329 TextUtils.writeToParcel(description, data, 0);
2330 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2331 reply.readException();
2332 data.recycle();
2333 reply.recycle();
2334 }
2335 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002336 String name, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002337 Parcel data = Parcel.obtain();
2338 Parcel reply = Parcel.obtain();
2339 data.writeInterfaceToken(IActivityManager.descriptor);
2340 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2341 data.writeString(name);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002342 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002343 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2344 reply.readException();
2345 int res = reply.readInt();
2346 ContentProviderHolder cph = null;
2347 if (res != 0) {
2348 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2349 }
2350 data.recycle();
2351 reply.recycle();
2352 return cph;
2353 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002354 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2355 throws RemoteException
2356 {
2357 Parcel data = Parcel.obtain();
2358 Parcel reply = Parcel.obtain();
2359 data.writeInterfaceToken(IActivityManager.descriptor);
2360 data.writeString(name);
2361 data.writeStrongBinder(token);
2362 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2363 reply.readException();
2364 int res = reply.readInt();
2365 ContentProviderHolder cph = null;
2366 if (res != 0) {
2367 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2368 }
2369 data.recycle();
2370 reply.recycle();
2371 return cph;
2372 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002373 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002374 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002375 {
2376 Parcel data = Parcel.obtain();
2377 Parcel reply = Parcel.obtain();
2378 data.writeInterfaceToken(IActivityManager.descriptor);
2379 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2380 data.writeTypedList(providers);
2381 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2382 reply.readException();
2383 data.recycle();
2384 reply.recycle();
2385 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002386 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2387 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002388 Parcel data = Parcel.obtain();
2389 Parcel reply = Parcel.obtain();
2390 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002391 data.writeStrongBinder(connection);
2392 data.writeInt(stable);
2393 data.writeInt(unstable);
2394 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2395 reply.readException();
2396 boolean res = reply.readInt() != 0;
2397 data.recycle();
2398 reply.recycle();
2399 return res;
2400 }
2401 public void unstableProviderDied(IBinder connection) throws RemoteException {
2402 Parcel data = Parcel.obtain();
2403 Parcel reply = Parcel.obtain();
2404 data.writeInterfaceToken(IActivityManager.descriptor);
2405 data.writeStrongBinder(connection);
2406 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2407 reply.readException();
2408 data.recycle();
2409 reply.recycle();
2410 }
2411
2412 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2413 Parcel data = Parcel.obtain();
2414 Parcel reply = Parcel.obtain();
2415 data.writeInterfaceToken(IActivityManager.descriptor);
2416 data.writeStrongBinder(connection);
2417 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002418 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2419 reply.readException();
2420 data.recycle();
2421 reply.recycle();
2422 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002423
2424 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2425 Parcel data = Parcel.obtain();
2426 Parcel reply = Parcel.obtain();
2427 data.writeInterfaceToken(IActivityManager.descriptor);
2428 data.writeString(name);
2429 data.writeStrongBinder(token);
2430 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2431 reply.readException();
2432 data.recycle();
2433 reply.recycle();
2434 }
2435
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002436 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2437 throws RemoteException
2438 {
2439 Parcel data = Parcel.obtain();
2440 Parcel reply = Parcel.obtain();
2441 data.writeInterfaceToken(IActivityManager.descriptor);
2442 service.writeToParcel(data, 0);
2443 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2444 reply.readException();
2445 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2446 data.recycle();
2447 reply.recycle();
2448 return res;
2449 }
2450
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002451 public ComponentName startService(IApplicationThread caller, Intent service,
2452 String resolvedType) throws RemoteException
2453 {
2454 Parcel data = Parcel.obtain();
2455 Parcel reply = Parcel.obtain();
2456 data.writeInterfaceToken(IActivityManager.descriptor);
2457 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2458 service.writeToParcel(data, 0);
2459 data.writeString(resolvedType);
2460 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2461 reply.readException();
2462 ComponentName res = ComponentName.readFromParcel(reply);
2463 data.recycle();
2464 reply.recycle();
2465 return res;
2466 }
2467 public int stopService(IApplicationThread caller, Intent service,
2468 String resolvedType) throws RemoteException
2469 {
2470 Parcel data = Parcel.obtain();
2471 Parcel reply = Parcel.obtain();
2472 data.writeInterfaceToken(IActivityManager.descriptor);
2473 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2474 service.writeToParcel(data, 0);
2475 data.writeString(resolvedType);
2476 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2477 reply.readException();
2478 int res = reply.readInt();
2479 reply.recycle();
2480 data.recycle();
2481 return res;
2482 }
2483 public boolean stopServiceToken(ComponentName className, IBinder token,
2484 int startId) throws RemoteException {
2485 Parcel data = Parcel.obtain();
2486 Parcel reply = Parcel.obtain();
2487 data.writeInterfaceToken(IActivityManager.descriptor);
2488 ComponentName.writeToParcel(className, data);
2489 data.writeStrongBinder(token);
2490 data.writeInt(startId);
2491 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2492 reply.readException();
2493 boolean res = reply.readInt() != 0;
2494 data.recycle();
2495 reply.recycle();
2496 return res;
2497 }
2498 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002499 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002500 Parcel data = Parcel.obtain();
2501 Parcel reply = Parcel.obtain();
2502 data.writeInterfaceToken(IActivityManager.descriptor);
2503 ComponentName.writeToParcel(className, data);
2504 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002505 data.writeInt(id);
2506 if (notification != null) {
2507 data.writeInt(1);
2508 notification.writeToParcel(data, 0);
2509 } else {
2510 data.writeInt(0);
2511 }
2512 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002513 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2514 reply.readException();
2515 data.recycle();
2516 reply.recycle();
2517 }
2518 public int bindService(IApplicationThread caller, IBinder token,
2519 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002520 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002521 Parcel data = Parcel.obtain();
2522 Parcel reply = Parcel.obtain();
2523 data.writeInterfaceToken(IActivityManager.descriptor);
2524 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2525 data.writeStrongBinder(token);
2526 service.writeToParcel(data, 0);
2527 data.writeString(resolvedType);
2528 data.writeStrongBinder(connection.asBinder());
2529 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002530 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002531 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2532 reply.readException();
2533 int res = reply.readInt();
2534 data.recycle();
2535 reply.recycle();
2536 return res;
2537 }
2538 public boolean unbindService(IServiceConnection connection) throws RemoteException
2539 {
2540 Parcel data = Parcel.obtain();
2541 Parcel reply = Parcel.obtain();
2542 data.writeInterfaceToken(IActivityManager.descriptor);
2543 data.writeStrongBinder(connection.asBinder());
2544 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2545 reply.readException();
2546 boolean res = reply.readInt() != 0;
2547 data.recycle();
2548 reply.recycle();
2549 return res;
2550 }
2551
2552 public void publishService(IBinder token,
2553 Intent intent, IBinder service) throws RemoteException {
2554 Parcel data = Parcel.obtain();
2555 Parcel reply = Parcel.obtain();
2556 data.writeInterfaceToken(IActivityManager.descriptor);
2557 data.writeStrongBinder(token);
2558 intent.writeToParcel(data, 0);
2559 data.writeStrongBinder(service);
2560 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2561 reply.readException();
2562 data.recycle();
2563 reply.recycle();
2564 }
2565
2566 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2567 throws RemoteException {
2568 Parcel data = Parcel.obtain();
2569 Parcel reply = Parcel.obtain();
2570 data.writeInterfaceToken(IActivityManager.descriptor);
2571 data.writeStrongBinder(token);
2572 intent.writeToParcel(data, 0);
2573 data.writeInt(doRebind ? 1 : 0);
2574 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2575 reply.readException();
2576 data.recycle();
2577 reply.recycle();
2578 }
2579
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002580 public void serviceDoneExecuting(IBinder token, int type, int startId,
2581 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002582 Parcel data = Parcel.obtain();
2583 Parcel reply = Parcel.obtain();
2584 data.writeInterfaceToken(IActivityManager.descriptor);
2585 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002586 data.writeInt(type);
2587 data.writeInt(startId);
2588 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002589 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2590 reply.readException();
2591 data.recycle();
2592 reply.recycle();
2593 }
2594
2595 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 service.writeToParcel(data, 0);
2600 data.writeString(resolvedType);
2601 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2602 reply.readException();
2603 IBinder binder = reply.readStrongBinder();
2604 reply.recycle();
2605 data.recycle();
2606 return binder;
2607 }
2608
Christopher Tate181fafa2009-05-14 11:12:14 -07002609 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2610 throws RemoteException {
2611 Parcel data = Parcel.obtain();
2612 Parcel reply = Parcel.obtain();
2613 data.writeInterfaceToken(IActivityManager.descriptor);
2614 app.writeToParcel(data, 0);
2615 data.writeInt(backupRestoreMode);
2616 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2617 reply.readException();
2618 boolean success = reply.readInt() != 0;
2619 reply.recycle();
2620 data.recycle();
2621 return success;
2622 }
2623
2624 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2625 Parcel data = Parcel.obtain();
2626 Parcel reply = Parcel.obtain();
2627 data.writeInterfaceToken(IActivityManager.descriptor);
2628 data.writeString(packageName);
2629 data.writeStrongBinder(agent);
2630 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2631 reply.recycle();
2632 data.recycle();
2633 }
2634
2635 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2636 Parcel data = Parcel.obtain();
2637 Parcel reply = Parcel.obtain();
2638 data.writeInterfaceToken(IActivityManager.descriptor);
2639 app.writeToParcel(data, 0);
2640 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2641 reply.readException();
2642 reply.recycle();
2643 data.recycle();
2644 }
2645
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002646 public boolean startInstrumentation(ComponentName className, String profileFile,
2647 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2648 throws RemoteException {
2649 Parcel data = Parcel.obtain();
2650 Parcel reply = Parcel.obtain();
2651 data.writeInterfaceToken(IActivityManager.descriptor);
2652 ComponentName.writeToParcel(className, data);
2653 data.writeString(profileFile);
2654 data.writeInt(flags);
2655 data.writeBundle(arguments);
2656 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2657 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2658 reply.readException();
2659 boolean res = reply.readInt() != 0;
2660 reply.recycle();
2661 data.recycle();
2662 return res;
2663 }
2664
2665 public void finishInstrumentation(IApplicationThread target,
2666 int resultCode, Bundle results) throws RemoteException {
2667 Parcel data = Parcel.obtain();
2668 Parcel reply = Parcel.obtain();
2669 data.writeInterfaceToken(IActivityManager.descriptor);
2670 data.writeStrongBinder(target != null ? target.asBinder() : null);
2671 data.writeInt(resultCode);
2672 data.writeBundle(results);
2673 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2674 reply.readException();
2675 data.recycle();
2676 reply.recycle();
2677 }
2678 public Configuration getConfiguration() throws RemoteException
2679 {
2680 Parcel data = Parcel.obtain();
2681 Parcel reply = Parcel.obtain();
2682 data.writeInterfaceToken(IActivityManager.descriptor);
2683 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2684 reply.readException();
2685 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2686 reply.recycle();
2687 data.recycle();
2688 return res;
2689 }
2690 public void updateConfiguration(Configuration values) throws RemoteException
2691 {
2692 Parcel data = Parcel.obtain();
2693 Parcel reply = Parcel.obtain();
2694 data.writeInterfaceToken(IActivityManager.descriptor);
2695 values.writeToParcel(data, 0);
2696 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2697 reply.readException();
2698 data.recycle();
2699 reply.recycle();
2700 }
2701 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2702 throws RemoteException {
2703 Parcel data = Parcel.obtain();
2704 Parcel reply = Parcel.obtain();
2705 data.writeInterfaceToken(IActivityManager.descriptor);
2706 data.writeStrongBinder(token);
2707 data.writeInt(requestedOrientation);
2708 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2709 reply.readException();
2710 data.recycle();
2711 reply.recycle();
2712 }
2713 public int getRequestedOrientation(IBinder token) throws RemoteException {
2714 Parcel data = Parcel.obtain();
2715 Parcel reply = Parcel.obtain();
2716 data.writeInterfaceToken(IActivityManager.descriptor);
2717 data.writeStrongBinder(token);
2718 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2719 reply.readException();
2720 int res = reply.readInt();
2721 data.recycle();
2722 reply.recycle();
2723 return res;
2724 }
2725 public ComponentName getActivityClassForToken(IBinder token)
2726 throws RemoteException {
2727 Parcel data = Parcel.obtain();
2728 Parcel reply = Parcel.obtain();
2729 data.writeInterfaceToken(IActivityManager.descriptor);
2730 data.writeStrongBinder(token);
2731 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2732 reply.readException();
2733 ComponentName res = ComponentName.readFromParcel(reply);
2734 data.recycle();
2735 reply.recycle();
2736 return res;
2737 }
2738 public String getPackageForToken(IBinder token) throws RemoteException
2739 {
2740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 data.writeStrongBinder(token);
2744 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2745 reply.readException();
2746 String res = reply.readString();
2747 data.recycle();
2748 reply.recycle();
2749 return res;
2750 }
2751 public IIntentSender getIntentSender(int type,
2752 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002753 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
2754 Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002755 Parcel data = Parcel.obtain();
2756 Parcel reply = Parcel.obtain();
2757 data.writeInterfaceToken(IActivityManager.descriptor);
2758 data.writeInt(type);
2759 data.writeString(packageName);
2760 data.writeStrongBinder(token);
2761 data.writeString(resultWho);
2762 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002763 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002764 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002765 data.writeTypedArray(intents, 0);
2766 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002767 } else {
2768 data.writeInt(0);
2769 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002770 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002771 if (options != null) {
2772 data.writeInt(1);
2773 options.writeToParcel(data, 0);
2774 } else {
2775 data.writeInt(0);
2776 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002777 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2778 reply.readException();
2779 IIntentSender res = IIntentSender.Stub.asInterface(
2780 reply.readStrongBinder());
2781 data.recycle();
2782 reply.recycle();
2783 return res;
2784 }
2785 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2786 Parcel data = Parcel.obtain();
2787 Parcel reply = Parcel.obtain();
2788 data.writeInterfaceToken(IActivityManager.descriptor);
2789 data.writeStrongBinder(sender.asBinder());
2790 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2791 reply.readException();
2792 data.recycle();
2793 reply.recycle();
2794 }
2795 public String getPackageForIntentSender(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(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2801 reply.readException();
2802 String res = reply.readString();
2803 data.recycle();
2804 reply.recycle();
2805 return res;
2806 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002807 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2808 Parcel data = Parcel.obtain();
2809 Parcel reply = Parcel.obtain();
2810 data.writeInterfaceToken(IActivityManager.descriptor);
2811 data.writeStrongBinder(sender.asBinder());
2812 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2813 reply.readException();
2814 int res = reply.readInt();
2815 data.recycle();
2816 reply.recycle();
2817 return res;
2818 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002819 public void setProcessLimit(int max) throws RemoteException
2820 {
2821 Parcel data = Parcel.obtain();
2822 Parcel reply = Parcel.obtain();
2823 data.writeInterfaceToken(IActivityManager.descriptor);
2824 data.writeInt(max);
2825 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2826 reply.readException();
2827 data.recycle();
2828 reply.recycle();
2829 }
2830 public int getProcessLimit() throws RemoteException
2831 {
2832 Parcel data = Parcel.obtain();
2833 Parcel reply = Parcel.obtain();
2834 data.writeInterfaceToken(IActivityManager.descriptor);
2835 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2836 reply.readException();
2837 int res = reply.readInt();
2838 data.recycle();
2839 reply.recycle();
2840 return res;
2841 }
2842 public void setProcessForeground(IBinder token, int pid,
2843 boolean isForeground) throws RemoteException {
2844 Parcel data = Parcel.obtain();
2845 Parcel reply = Parcel.obtain();
2846 data.writeInterfaceToken(IActivityManager.descriptor);
2847 data.writeStrongBinder(token);
2848 data.writeInt(pid);
2849 data.writeInt(isForeground ? 1 : 0);
2850 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2851 reply.readException();
2852 data.recycle();
2853 reply.recycle();
2854 }
2855 public int checkPermission(String permission, int pid, int uid)
2856 throws RemoteException {
2857 Parcel data = Parcel.obtain();
2858 Parcel reply = Parcel.obtain();
2859 data.writeInterfaceToken(IActivityManager.descriptor);
2860 data.writeString(permission);
2861 data.writeInt(pid);
2862 data.writeInt(uid);
2863 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2864 reply.readException();
2865 int res = reply.readInt();
2866 data.recycle();
2867 reply.recycle();
2868 return res;
2869 }
2870 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002871 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeString(packageName);
2876 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002877 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002878 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2879 reply.readException();
2880 boolean res = reply.readInt() != 0;
2881 data.recycle();
2882 reply.recycle();
2883 return res;
2884 }
2885 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2886 throws RemoteException {
2887 Parcel data = Parcel.obtain();
2888 Parcel reply = Parcel.obtain();
2889 data.writeInterfaceToken(IActivityManager.descriptor);
2890 uri.writeToParcel(data, 0);
2891 data.writeInt(pid);
2892 data.writeInt(uid);
2893 data.writeInt(mode);
2894 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2895 reply.readException();
2896 int res = reply.readInt();
2897 data.recycle();
2898 reply.recycle();
2899 return res;
2900 }
2901 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2902 Uri uri, int mode) throws RemoteException {
2903 Parcel data = Parcel.obtain();
2904 Parcel reply = Parcel.obtain();
2905 data.writeInterfaceToken(IActivityManager.descriptor);
2906 data.writeStrongBinder(caller.asBinder());
2907 data.writeString(targetPkg);
2908 uri.writeToParcel(data, 0);
2909 data.writeInt(mode);
2910 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2911 reply.readException();
2912 data.recycle();
2913 reply.recycle();
2914 }
2915 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2916 int mode) throws RemoteException {
2917 Parcel data = Parcel.obtain();
2918 Parcel reply = Parcel.obtain();
2919 data.writeInterfaceToken(IActivityManager.descriptor);
2920 data.writeStrongBinder(caller.asBinder());
2921 uri.writeToParcel(data, 0);
2922 data.writeInt(mode);
2923 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2924 reply.readException();
2925 data.recycle();
2926 reply.recycle();
2927 }
2928 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2929 throws RemoteException {
2930 Parcel data = Parcel.obtain();
2931 Parcel reply = Parcel.obtain();
2932 data.writeInterfaceToken(IActivityManager.descriptor);
2933 data.writeStrongBinder(who.asBinder());
2934 data.writeInt(waiting ? 1 : 0);
2935 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2936 reply.readException();
2937 data.recycle();
2938 reply.recycle();
2939 }
2940 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
2944 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2945 reply.readException();
2946 outInfo.readFromParcel(reply);
2947 data.recycle();
2948 reply.recycle();
2949 }
2950 public void unhandledBack() throws RemoteException
2951 {
2952 Parcel data = Parcel.obtain();
2953 Parcel reply = Parcel.obtain();
2954 data.writeInterfaceToken(IActivityManager.descriptor);
2955 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2956 reply.readException();
2957 data.recycle();
2958 reply.recycle();
2959 }
2960 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2961 {
2962 Parcel data = Parcel.obtain();
2963 Parcel reply = Parcel.obtain();
2964 data.writeInterfaceToken(IActivityManager.descriptor);
2965 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2966 reply.readException();
2967 ParcelFileDescriptor pfd = null;
2968 if (reply.readInt() != 0) {
2969 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2970 }
2971 data.recycle();
2972 reply.recycle();
2973 return pfd;
2974 }
2975 public void goingToSleep() throws RemoteException
2976 {
2977 Parcel data = Parcel.obtain();
2978 Parcel reply = Parcel.obtain();
2979 data.writeInterfaceToken(IActivityManager.descriptor);
2980 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 data.recycle();
2983 reply.recycle();
2984 }
2985 public void wakingUp() throws RemoteException
2986 {
2987 Parcel data = Parcel.obtain();
2988 Parcel reply = Parcel.obtain();
2989 data.writeInterfaceToken(IActivityManager.descriptor);
2990 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2991 reply.readException();
2992 data.recycle();
2993 reply.recycle();
2994 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07002995 public void setLockScreenShown(boolean shown) throws RemoteException
2996 {
2997 Parcel data = Parcel.obtain();
2998 Parcel reply = Parcel.obtain();
2999 data.writeInterfaceToken(IActivityManager.descriptor);
3000 data.writeInt(shown ? 1 : 0);
3001 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3002 reply.readException();
3003 data.recycle();
3004 reply.recycle();
3005 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 public void setDebugApp(
3007 String packageName, boolean waitForDebugger, boolean persistent)
3008 throws RemoteException
3009 {
3010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
3013 data.writeString(packageName);
3014 data.writeInt(waitForDebugger ? 1 : 0);
3015 data.writeInt(persistent ? 1 : 0);
3016 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3017 reply.readException();
3018 data.recycle();
3019 reply.recycle();
3020 }
3021 public void setAlwaysFinish(boolean enabled) throws RemoteException
3022 {
3023 Parcel data = Parcel.obtain();
3024 Parcel reply = Parcel.obtain();
3025 data.writeInterfaceToken(IActivityManager.descriptor);
3026 data.writeInt(enabled ? 1 : 0);
3027 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 data.recycle();
3030 reply.recycle();
3031 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003032 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003033 {
3034 Parcel data = Parcel.obtain();
3035 Parcel reply = Parcel.obtain();
3036 data.writeInterfaceToken(IActivityManager.descriptor);
3037 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003038 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003039 reply.readException();
3040 data.recycle();
3041 reply.recycle();
3042 }
3043 public void enterSafeMode() throws RemoteException {
3044 Parcel data = Parcel.obtain();
3045 data.writeInterfaceToken(IActivityManager.descriptor);
3046 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3047 data.recycle();
3048 }
3049 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3050 Parcel data = Parcel.obtain();
3051 data.writeStrongBinder(sender.asBinder());
3052 data.writeInterfaceToken(IActivityManager.descriptor);
3053 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3054 data.recycle();
3055 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003056 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003057 Parcel data = Parcel.obtain();
3058 Parcel reply = Parcel.obtain();
3059 data.writeInterfaceToken(IActivityManager.descriptor);
3060 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003061 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003062 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003063 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003064 boolean res = reply.readInt() != 0;
3065 data.recycle();
3066 reply.recycle();
3067 return res;
3068 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003069 @Override
3070 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3071 Parcel data = Parcel.obtain();
3072 Parcel reply = Parcel.obtain();
3073 data.writeInterfaceToken(IActivityManager.descriptor);
3074 data.writeString(reason);
3075 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3076 boolean res = reply.readInt() != 0;
3077 data.recycle();
3078 reply.recycle();
3079 return res;
3080 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003081 public void startRunning(String pkg, String cls, String action,
3082 String indata) throws RemoteException {
3083 Parcel data = Parcel.obtain();
3084 Parcel reply = Parcel.obtain();
3085 data.writeInterfaceToken(IActivityManager.descriptor);
3086 data.writeString(pkg);
3087 data.writeString(cls);
3088 data.writeString(action);
3089 data.writeString(indata);
3090 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3091 reply.readException();
3092 data.recycle();
3093 reply.recycle();
3094 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003095 public boolean testIsSystemReady()
3096 {
3097 /* this base class version is never called */
3098 return true;
3099 }
Dan Egnor60d87622009-12-16 16:32:58 -08003100 public void handleApplicationCrash(IBinder app,
3101 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3102 {
3103 Parcel data = Parcel.obtain();
3104 Parcel reply = Parcel.obtain();
3105 data.writeInterfaceToken(IActivityManager.descriptor);
3106 data.writeStrongBinder(app);
3107 crashInfo.writeToParcel(data, 0);
3108 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3109 reply.readException();
3110 reply.recycle();
3111 data.recycle();
3112 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003113
Dan Egnor60d87622009-12-16 16:32:58 -08003114 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003115 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003116 {
3117 Parcel data = Parcel.obtain();
3118 Parcel reply = Parcel.obtain();
3119 data.writeInterfaceToken(IActivityManager.descriptor);
3120 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003121 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003122 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003123 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003124 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003125 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003126 reply.recycle();
3127 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003128 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003129 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003130
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003131 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003132 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003133 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003134 {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003139 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003140 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003141 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3142 reply.readException();
3143 reply.recycle();
3144 data.recycle();
3145 }
3146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003147 public void signalPersistentProcesses(int sig) throws RemoteException {
3148 Parcel data = Parcel.obtain();
3149 Parcel reply = Parcel.obtain();
3150 data.writeInterfaceToken(IActivityManager.descriptor);
3151 data.writeInt(sig);
3152 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3153 reply.readException();
3154 data.recycle();
3155 reply.recycle();
3156 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003157
Dianne Hackborn03abb812010-01-04 18:43:19 -08003158 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003159 Parcel data = Parcel.obtain();
3160 Parcel reply = Parcel.obtain();
3161 data.writeInterfaceToken(IActivityManager.descriptor);
3162 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003163 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3164 reply.readException();
3165 data.recycle();
3166 reply.recycle();
3167 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003168
3169 public void killAllBackgroundProcesses() throws RemoteException {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3174 reply.readException();
3175 data.recycle();
3176 reply.recycle();
3177 }
3178
Dianne Hackborn03abb812010-01-04 18:43:19 -08003179 public void forceStopPackage(String packageName) throws RemoteException {
3180 Parcel data = Parcel.obtain();
3181 Parcel reply = Parcel.obtain();
3182 data.writeInterfaceToken(IActivityManager.descriptor);
3183 data.writeString(packageName);
3184 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003185 reply.readException();
3186 data.recycle();
3187 reply.recycle();
3188 }
3189
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003190 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3191 throws RemoteException
3192 {
3193 Parcel data = Parcel.obtain();
3194 Parcel reply = Parcel.obtain();
3195 data.writeInterfaceToken(IActivityManager.descriptor);
3196 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3197 reply.readException();
3198 outInfo.readFromParcel(reply);
3199 reply.recycle();
3200 data.recycle();
3201 }
3202
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003203 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3204 {
3205 Parcel data = Parcel.obtain();
3206 Parcel reply = Parcel.obtain();
3207 data.writeInterfaceToken(IActivityManager.descriptor);
3208 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3209 reply.readException();
3210 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3211 reply.recycle();
3212 data.recycle();
3213 return res;
3214 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003215
3216 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003217 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003218 {
3219 Parcel data = Parcel.obtain();
3220 Parcel reply = Parcel.obtain();
3221 data.writeInterfaceToken(IActivityManager.descriptor);
3222 data.writeString(process);
3223 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003224 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003225 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003226 if (fd != null) {
3227 data.writeInt(1);
3228 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3229 } else {
3230 data.writeInt(0);
3231 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003232 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3233 reply.readException();
3234 boolean res = reply.readInt() != 0;
3235 reply.recycle();
3236 data.recycle();
3237 return res;
3238 }
3239
Dianne Hackborn55280a92009-05-07 15:53:46 -07003240 public boolean shutdown(int timeout) throws RemoteException
3241 {
3242 Parcel data = Parcel.obtain();
3243 Parcel reply = Parcel.obtain();
3244 data.writeInterfaceToken(IActivityManager.descriptor);
3245 data.writeInt(timeout);
3246 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 boolean res = reply.readInt() != 0;
3249 reply.recycle();
3250 data.recycle();
3251 return res;
3252 }
3253
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003254 public void stopAppSwitches() throws RemoteException {
3255 Parcel data = Parcel.obtain();
3256 Parcel reply = Parcel.obtain();
3257 data.writeInterfaceToken(IActivityManager.descriptor);
3258 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3259 reply.readException();
3260 reply.recycle();
3261 data.recycle();
3262 }
3263
3264 public void resumeAppSwitches() throws RemoteException {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3269 reply.readException();
3270 reply.recycle();
3271 data.recycle();
3272 }
3273
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003274 public int startActivityInPackage(int uid,
3275 Intent intent, String resolvedType, IBinder resultTo,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003276 String resultWho, int requestCode, int startFlags, Bundle options)
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003277 throws RemoteException {
3278 Parcel data = Parcel.obtain();
3279 Parcel reply = Parcel.obtain();
3280 data.writeInterfaceToken(IActivityManager.descriptor);
3281 data.writeInt(uid);
3282 intent.writeToParcel(data, 0);
3283 data.writeString(resolvedType);
3284 data.writeStrongBinder(resultTo);
3285 data.writeString(resultWho);
3286 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003287 data.writeInt(startFlags);
3288 if (options != null) {
3289 data.writeInt(1);
3290 options.writeToParcel(data, 0);
3291 } else {
3292 data.writeInt(0);
3293 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003294 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3295 reply.readException();
3296 int result = reply.readInt();
3297 reply.recycle();
3298 data.recycle();
3299 return result;
3300 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003301
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003302 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3303 Parcel data = Parcel.obtain();
3304 Parcel reply = Parcel.obtain();
3305 data.writeInterfaceToken(IActivityManager.descriptor);
3306 data.writeString(pkg);
3307 data.writeInt(uid);
3308 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3309 reply.readException();
3310 data.recycle();
3311 reply.recycle();
3312 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003313
3314 public void closeSystemDialogs(String reason) throws RemoteException {
3315 Parcel data = Parcel.obtain();
3316 Parcel reply = Parcel.obtain();
3317 data.writeInterfaceToken(IActivityManager.descriptor);
3318 data.writeString(reason);
3319 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3320 reply.readException();
3321 data.recycle();
3322 reply.recycle();
3323 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003324
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003325 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003326 throws RemoteException {
3327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003330 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003331 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3332 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003333 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003334 data.recycle();
3335 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003336 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003337 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003338
3339 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3340 Parcel data = Parcel.obtain();
3341 Parcel reply = Parcel.obtain();
3342 data.writeInterfaceToken(IActivityManager.descriptor);
3343 data.writeString(processName);
3344 data.writeInt(uid);
3345 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 data.recycle();
3348 reply.recycle();
3349 }
3350
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003351 public void overridePendingTransition(IBinder token, String packageName,
3352 int enterAnim, int exitAnim) throws RemoteException {
3353 Parcel data = Parcel.obtain();
3354 Parcel reply = Parcel.obtain();
3355 data.writeInterfaceToken(IActivityManager.descriptor);
3356 data.writeStrongBinder(token);
3357 data.writeString(packageName);
3358 data.writeInt(enterAnim);
3359 data.writeInt(exitAnim);
3360 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3361 reply.readException();
3362 data.recycle();
3363 reply.recycle();
3364 }
3365
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003366 public boolean isUserAMonkey() throws RemoteException {
3367 Parcel data = Parcel.obtain();
3368 Parcel reply = Parcel.obtain();
3369 data.writeInterfaceToken(IActivityManager.descriptor);
3370 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3371 reply.readException();
3372 boolean res = reply.readInt() != 0;
3373 data.recycle();
3374 reply.recycle();
3375 return res;
3376 }
3377
Dianne Hackborn860755f2010-06-03 18:47:52 -07003378 public void finishHeavyWeightApp() throws RemoteException {
3379 Parcel data = Parcel.obtain();
3380 Parcel reply = Parcel.obtain();
3381 data.writeInterfaceToken(IActivityManager.descriptor);
3382 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 data.recycle();
3385 reply.recycle();
3386 }
3387
Daniel Sandler69a48172010-06-23 16:29:36 -04003388 public void setImmersive(IBinder token, boolean immersive)
3389 throws RemoteException {
3390 Parcel data = Parcel.obtain();
3391 Parcel reply = Parcel.obtain();
3392 data.writeInterfaceToken(IActivityManager.descriptor);
3393 data.writeStrongBinder(token);
3394 data.writeInt(immersive ? 1 : 0);
3395 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3396 reply.readException();
3397 data.recycle();
3398 reply.recycle();
3399 }
3400
3401 public boolean isImmersive(IBinder token)
3402 throws RemoteException {
3403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 data.writeStrongBinder(token);
3407 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003408 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003409 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003410 data.recycle();
3411 reply.recycle();
3412 return res;
3413 }
3414
3415 public boolean isTopActivityImmersive()
3416 throws RemoteException {
3417 Parcel data = Parcel.obtain();
3418 Parcel reply = Parcel.obtain();
3419 data.writeInterfaceToken(IActivityManager.descriptor);
3420 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003421 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003422 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003423 data.recycle();
3424 reply.recycle();
3425 return res;
3426 }
3427
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003428 public void crashApplication(int uid, int initialPid, String packageName,
3429 String message) throws RemoteException {
3430 Parcel data = Parcel.obtain();
3431 Parcel reply = Parcel.obtain();
3432 data.writeInterfaceToken(IActivityManager.descriptor);
3433 data.writeInt(uid);
3434 data.writeInt(initialPid);
3435 data.writeString(packageName);
3436 data.writeString(message);
3437 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3438 reply.readException();
3439 data.recycle();
3440 reply.recycle();
3441 }
Andy McFadden824c5102010-07-09 16:26:57 -07003442
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003443 public String getProviderMimeType(Uri uri)
3444 throws RemoteException {
3445 Parcel data = Parcel.obtain();
3446 Parcel reply = Parcel.obtain();
3447 data.writeInterfaceToken(IActivityManager.descriptor);
3448 uri.writeToParcel(data, 0);
3449 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3450 reply.readException();
3451 String res = reply.readString();
3452 data.recycle();
3453 reply.recycle();
3454 return res;
3455 }
3456
Dianne Hackborn7e269642010-08-25 19:50:20 -07003457 public IBinder newUriPermissionOwner(String name)
3458 throws RemoteException {
3459 Parcel data = Parcel.obtain();
3460 Parcel reply = Parcel.obtain();
3461 data.writeInterfaceToken(IActivityManager.descriptor);
3462 data.writeString(name);
3463 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3464 reply.readException();
3465 IBinder res = reply.readStrongBinder();
3466 data.recycle();
3467 reply.recycle();
3468 return res;
3469 }
3470
3471 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3472 Uri uri, int mode) throws RemoteException {
3473 Parcel data = Parcel.obtain();
3474 Parcel reply = Parcel.obtain();
3475 data.writeInterfaceToken(IActivityManager.descriptor);
3476 data.writeStrongBinder(owner);
3477 data.writeInt(fromUid);
3478 data.writeString(targetPkg);
3479 uri.writeToParcel(data, 0);
3480 data.writeInt(mode);
3481 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3482 reply.readException();
3483 data.recycle();
3484 reply.recycle();
3485 }
3486
3487 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3488 int mode) throws RemoteException {
3489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
3492 data.writeStrongBinder(owner);
3493 if (uri != null) {
3494 data.writeInt(1);
3495 uri.writeToParcel(data, 0);
3496 } else {
3497 data.writeInt(0);
3498 }
3499 data.writeInt(mode);
3500 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3501 reply.readException();
3502 data.recycle();
3503 reply.recycle();
3504 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003505
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003506 public int checkGrantUriPermission(int callingUid, String targetPkg,
3507 Uri uri, int modeFlags) throws RemoteException {
3508 Parcel data = Parcel.obtain();
3509 Parcel reply = Parcel.obtain();
3510 data.writeInterfaceToken(IActivityManager.descriptor);
3511 data.writeInt(callingUid);
3512 data.writeString(targetPkg);
3513 uri.writeToParcel(data, 0);
3514 data.writeInt(modeFlags);
3515 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3516 reply.readException();
3517 int res = reply.readInt();
3518 data.recycle();
3519 reply.recycle();
3520 return res;
3521 }
3522
Andy McFadden824c5102010-07-09 16:26:57 -07003523 public boolean dumpHeap(String process, boolean managed,
3524 String path, ParcelFileDescriptor fd) throws RemoteException {
3525 Parcel data = Parcel.obtain();
3526 Parcel reply = Parcel.obtain();
3527 data.writeInterfaceToken(IActivityManager.descriptor);
3528 data.writeString(process);
3529 data.writeInt(managed ? 1 : 0);
3530 data.writeString(path);
3531 if (fd != null) {
3532 data.writeInt(1);
3533 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3534 } else {
3535 data.writeInt(0);
3536 }
3537 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 boolean res = reply.readInt() != 0;
3540 reply.recycle();
3541 data.recycle();
3542 return res;
3543 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003544
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003545 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003546 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3547 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003548 Parcel data = Parcel.obtain();
3549 Parcel reply = Parcel.obtain();
3550 data.writeInterfaceToken(IActivityManager.descriptor);
3551 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3552 data.writeTypedArray(intents, 0);
3553 data.writeStringArray(resolvedTypes);
3554 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003555 if (options != null) {
3556 data.writeInt(1);
3557 options.writeToParcel(data, 0);
3558 } else {
3559 data.writeInt(0);
3560 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003561 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 int result = reply.readInt();
3564 reply.recycle();
3565 data.recycle();
3566 return result;
3567 }
3568
3569 public int startActivitiesInPackage(int uid,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003570 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3571 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003572 Parcel data = Parcel.obtain();
3573 Parcel reply = Parcel.obtain();
3574 data.writeInterfaceToken(IActivityManager.descriptor);
3575 data.writeInt(uid);
3576 data.writeTypedArray(intents, 0);
3577 data.writeStringArray(resolvedTypes);
3578 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003579 if (options != null) {
3580 data.writeInt(1);
3581 options.writeToParcel(data, 0);
3582 } else {
3583 data.writeInt(0);
3584 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003585 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3586 reply.readException();
3587 int result = reply.readInt();
3588 reply.recycle();
3589 data.recycle();
3590 return result;
3591 }
3592
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003593 public int getFrontActivityScreenCompatMode() throws RemoteException {
3594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3598 reply.readException();
3599 int mode = reply.readInt();
3600 reply.recycle();
3601 data.recycle();
3602 return mode;
3603 }
3604
3605 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeInt(mode);
3610 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3611 reply.readException();
3612 reply.recycle();
3613 data.recycle();
3614 }
3615
3616 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3617 Parcel data = Parcel.obtain();
3618 Parcel reply = Parcel.obtain();
3619 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003620 data.writeString(packageName);
3621 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003622 reply.readException();
3623 int mode = reply.readInt();
3624 reply.recycle();
3625 data.recycle();
3626 return mode;
3627 }
3628
3629 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003630 throws RemoteException {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003635 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003636 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3637 reply.readException();
3638 reply.recycle();
3639 data.recycle();
3640 }
3641
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003642 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 data.writeString(packageName);
3647 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3648 reply.readException();
3649 boolean ask = reply.readInt() != 0;
3650 reply.recycle();
3651 data.recycle();
3652 return ask;
3653 }
3654
3655 public void setPackageAskScreenCompat(String packageName, boolean ask)
3656 throws RemoteException {
3657 Parcel data = Parcel.obtain();
3658 Parcel reply = Parcel.obtain();
3659 data.writeInterfaceToken(IActivityManager.descriptor);
3660 data.writeString(packageName);
3661 data.writeInt(ask ? 1 : 0);
3662 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3663 reply.readException();
3664 reply.recycle();
3665 data.recycle();
3666 }
3667
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003668 public boolean switchUser(int userid) throws RemoteException {
3669 Parcel data = Parcel.obtain();
3670 Parcel reply = Parcel.obtain();
3671 data.writeInterfaceToken(IActivityManager.descriptor);
3672 data.writeInt(userid);
3673 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3674 reply.readException();
3675 boolean result = reply.readInt() != 0;
3676 reply.recycle();
3677 data.recycle();
3678 return result;
3679 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003680
3681 public UserInfo getCurrentUser() throws RemoteException {
3682 Parcel data = Parcel.obtain();
3683 Parcel reply = Parcel.obtain();
3684 data.writeInterfaceToken(IActivityManager.descriptor);
3685 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3686 reply.readException();
3687 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3688 reply.recycle();
3689 data.recycle();
3690 return userInfo;
3691 }
3692
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003693 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3694 Parcel data = Parcel.obtain();
3695 Parcel reply = Parcel.obtain();
3696 data.writeInterfaceToken(IActivityManager.descriptor);
3697 data.writeInt(taskId);
3698 data.writeInt(subTaskIndex);
3699 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3700 reply.readException();
3701 boolean result = reply.readInt() != 0;
3702 reply.recycle();
3703 data.recycle();
3704 return result;
3705 }
3706
3707 public boolean removeTask(int taskId, int flags) throws RemoteException {
3708 Parcel data = Parcel.obtain();
3709 Parcel reply = Parcel.obtain();
3710 data.writeInterfaceToken(IActivityManager.descriptor);
3711 data.writeInt(taskId);
3712 data.writeInt(flags);
3713 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3714 reply.readException();
3715 boolean result = reply.readInt() != 0;
3716 reply.recycle();
3717 data.recycle();
3718 return result;
3719 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003720
Jeff Sharkeya4620792011-05-20 15:29:23 -07003721 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3722 Parcel data = Parcel.obtain();
3723 Parcel reply = Parcel.obtain();
3724 data.writeInterfaceToken(IActivityManager.descriptor);
3725 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3726 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3727 reply.readException();
3728 data.recycle();
3729 reply.recycle();
3730 }
3731
3732 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3733 Parcel data = Parcel.obtain();
3734 Parcel reply = Parcel.obtain();
3735 data.writeInterfaceToken(IActivityManager.descriptor);
3736 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3737 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3738 reply.readException();
3739 data.recycle();
3740 reply.recycle();
3741 }
3742
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003743 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3744 Parcel data = Parcel.obtain();
3745 Parcel reply = Parcel.obtain();
3746 data.writeInterfaceToken(IActivityManager.descriptor);
3747 data.writeStrongBinder(sender.asBinder());
3748 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 boolean res = reply.readInt() != 0;
3751 data.recycle();
3752 reply.recycle();
3753 return res;
3754 }
3755
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003756 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3757 {
3758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
3761 values.writeToParcel(data, 0);
3762 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3763 reply.readException();
3764 data.recycle();
3765 reply.recycle();
3766 }
3767
Dianne Hackbornb437e092011-08-05 17:50:29 -07003768 public long[] getProcessPss(int[] pids) throws RemoteException {
3769 Parcel data = Parcel.obtain();
3770 Parcel reply = Parcel.obtain();
3771 data.writeInterfaceToken(IActivityManager.descriptor);
3772 data.writeIntArray(pids);
3773 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3774 reply.readException();
3775 long[] res = reply.createLongArray();
3776 data.recycle();
3777 reply.recycle();
3778 return res;
3779 }
3780
Dianne Hackborn661cd522011-08-22 00:26:20 -07003781 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3782 Parcel data = Parcel.obtain();
3783 Parcel reply = Parcel.obtain();
3784 data.writeInterfaceToken(IActivityManager.descriptor);
3785 TextUtils.writeToParcel(msg, data, 0);
3786 data.writeInt(always ? 1 : 0);
3787 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3788 reply.readException();
3789 data.recycle();
3790 reply.recycle();
3791 }
3792
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003793 public void dismissKeyguardOnNextActivity() throws RemoteException {
3794 Parcel data = Parcel.obtain();
3795 Parcel reply = Parcel.obtain();
3796 data.writeInterfaceToken(IActivityManager.descriptor);
3797 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3798 reply.readException();
3799 data.recycle();
3800 reply.recycle();
3801 }
3802
Adam Powelldd8fab22012-03-22 17:47:27 -07003803 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3804 throws RemoteException {
3805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
3808 data.writeStrongBinder(token);
3809 data.writeString(destAffinity);
3810 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3811 reply.readException();
3812 boolean result = reply.readInt() != 0;
3813 data.recycle();
3814 reply.recycle();
3815 return result;
3816 }
3817
3818 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3819 throws RemoteException {
3820 Parcel data = Parcel.obtain();
3821 Parcel reply = Parcel.obtain();
3822 data.writeInterfaceToken(IActivityManager.descriptor);
3823 data.writeStrongBinder(token);
3824 target.writeToParcel(data, 0);
3825 data.writeInt(resultCode);
3826 if (resultData != null) {
3827 data.writeInt(1);
3828 resultData.writeToParcel(data, 0);
3829 } else {
3830 data.writeInt(0);
3831 }
3832 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3833 reply.readException();
3834 boolean result = reply.readInt() != 0;
3835 data.recycle();
3836 reply.recycle();
3837 return result;
3838 }
3839
Dianne Hackborn5320eb82012-05-18 12:05:04 -07003840 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
3841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
3843 data.writeInterfaceToken(IActivityManager.descriptor);
3844 data.writeStrongBinder(activityToken);
3845 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
3846 reply.readException();
3847 int result = reply.readInt();
3848 data.recycle();
3849 reply.recycle();
3850 return result;
3851 }
3852
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853 private IBinder mRemote;
3854}