blob: eed9254646f59c920409e4703b8edef626cb4b85 [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;
Dianne Hackbornf02b60a2012-08-16 10:48:27 -070042import android.os.UserHandle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080045import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.ArrayList;
48import java.util.List;
49
50/** {@hide} */
51public abstract class ActivityManagerNative extends Binder implements IActivityManager
52{
53 /**
54 * Cast a Binder object into an activity manager interface, generating
55 * a proxy if needed.
56 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080057 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 if (obj == null) {
59 return null;
60 }
61 IActivityManager in =
62 (IActivityManager)obj.queryLocalInterface(descriptor);
63 if (in != null) {
64 return in;
65 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 return new ActivityManagerProxy(obj);
68 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 /**
71 * Retrieve the system's default/global activity manager.
72 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080073 static public IActivityManager getDefault() {
74 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 }
76
77 /**
78 * Convenience for checking whether the system is ready. For internal use only.
79 */
80 static public boolean isSystemReady() {
81 if (!sSystemReady) {
82 sSystemReady = getDefault().testIsSystemReady();
83 }
84 return sSystemReady;
85 }
86 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 /**
89 * Convenience for sending a sticky broadcast. For internal use only.
90 * If you don't care about permission, use null.
91 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070092 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 try {
94 getDefault().broadcastIntent(
95 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070096 null /*permission*/, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 } catch (RemoteException ex) {
98 }
99 }
100
101 static public void noteWakeupAlarm(PendingIntent ps) {
102 try {
103 getDefault().noteWakeupAlarm(ps.getTarget());
104 } catch (RemoteException ex) {
105 }
106 }
107
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800108 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 attachInterface(this, descriptor);
110 }
111
112 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
113 throws RemoteException {
114 switch (code) {
115 case START_ACTIVITY_TRANSACTION:
116 {
117 data.enforceInterface(IActivityManager.descriptor);
118 IBinder b = data.readStrongBinder();
119 IApplicationThread app = ApplicationThreadNative.asInterface(b);
120 Intent intent = Intent.CREATOR.createFromParcel(data);
121 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800123 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700125 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700126 String profileFile = data.readString();
127 ParcelFileDescriptor profileFd = data.readInt() != 0
128 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700129 Bundle options = data.readInt() != 0
130 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 int result = startActivity(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 resultTo, resultWho, requestCode, startFlags,
133 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 reply.writeNoException();
135 reply.writeInt(result);
136 return true;
137 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700138
Amith Yamasani82644082012-08-03 13:09:11 -0700139 case START_ACTIVITY_AS_USER_TRANSACTION:
140 {
141 data.enforceInterface(IActivityManager.descriptor);
142 IBinder b = data.readStrongBinder();
143 IApplicationThread app = ApplicationThreadNative.asInterface(b);
144 Intent intent = Intent.CREATOR.createFromParcel(data);
145 String resolvedType = data.readString();
146 IBinder resultTo = data.readStrongBinder();
147 String resultWho = data.readString();
148 int requestCode = data.readInt();
149 int startFlags = data.readInt();
150 String profileFile = data.readString();
151 ParcelFileDescriptor profileFd = data.readInt() != 0
152 ? data.readFileDescriptor() : null;
153 Bundle options = data.readInt() != 0
154 ? Bundle.CREATOR.createFromParcel(data) : null;
155 int userId = data.readInt();
156 int result = startActivityAsUser(app, intent, resolvedType,
157 resultTo, resultWho, requestCode, startFlags,
158 profileFile, profileFd, options, userId);
159 reply.writeNoException();
160 reply.writeInt(result);
161 return true;
162 }
163
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800164 case START_ACTIVITY_AND_WAIT_TRANSACTION:
165 {
166 data.enforceInterface(IActivityManager.descriptor);
167 IBinder b = data.readStrongBinder();
168 IApplicationThread app = ApplicationThreadNative.asInterface(b);
169 Intent intent = Intent.CREATOR.createFromParcel(data);
170 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800171 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800172 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700174 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700175 String profileFile = data.readString();
176 ParcelFileDescriptor profileFd = data.readInt() != 0
177 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700178 Bundle options = data.readInt() != 0
179 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800180 WaitResult result = startActivityAndWait(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700181 resultTo, resultWho, requestCode, startFlags,
182 profileFile, profileFd, options);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800183 reply.writeNoException();
184 result.writeToParcel(reply, 0);
185 return true;
186 }
187
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700188 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
189 {
190 data.enforceInterface(IActivityManager.descriptor);
191 IBinder b = data.readStrongBinder();
192 IApplicationThread app = ApplicationThreadNative.asInterface(b);
193 Intent intent = Intent.CREATOR.createFromParcel(data);
194 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700195 IBinder resultTo = data.readStrongBinder();
196 String resultWho = data.readString();
197 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700198 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700200 Bundle options = data.readInt() != 0
201 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700202 int userId = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 int result = startActivityWithConfig(app, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700204 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 reply.writeNoException();
206 reply.writeInt(result);
207 return true;
208 }
209
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700210 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700211 {
212 data.enforceInterface(IActivityManager.descriptor);
213 IBinder b = data.readStrongBinder();
214 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700215 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700216 Intent fillInIntent = null;
217 if (data.readInt() != 0) {
218 fillInIntent = Intent.CREATOR.createFromParcel(data);
219 }
220 String resolvedType = data.readString();
221 IBinder resultTo = data.readStrongBinder();
222 String resultWho = data.readString();
223 int requestCode = data.readInt();
224 int flagsMask = data.readInt();
225 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700226 Bundle options = data.readInt() != 0
227 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700228 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700229 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700231 reply.writeNoException();
232 reply.writeInt(result);
233 return true;
234 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800235
236 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
237 {
238 data.enforceInterface(IActivityManager.descriptor);
239 IBinder callingActivity = data.readStrongBinder();
240 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700241 Bundle options = data.readInt() != 0
242 ? Bundle.CREATOR.createFromParcel(data) : null;
243 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800244 reply.writeNoException();
245 reply.writeInt(result ? 1 : 0);
246 return true;
247 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 case FINISH_ACTIVITY_TRANSACTION: {
250 data.enforceInterface(IActivityManager.descriptor);
251 IBinder token = data.readStrongBinder();
252 Intent resultData = null;
253 int resultCode = data.readInt();
254 if (data.readInt() != 0) {
255 resultData = Intent.CREATOR.createFromParcel(data);
256 }
257 boolean res = finishActivity(token, resultCode, resultData);
258 reply.writeNoException();
259 reply.writeInt(res ? 1 : 0);
260 return true;
261 }
262
263 case FINISH_SUB_ACTIVITY_TRANSACTION: {
264 data.enforceInterface(IActivityManager.descriptor);
265 IBinder token = data.readStrongBinder();
266 String resultWho = data.readString();
267 int requestCode = data.readInt();
268 finishSubActivity(token, resultWho, requestCode);
269 reply.writeNoException();
270 return true;
271 }
272
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700273 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
274 data.enforceInterface(IActivityManager.descriptor);
275 IBinder token = data.readStrongBinder();
276 boolean res = finishActivityAffinity(token);
277 reply.writeNoException();
278 reply.writeInt(res ? 1 : 0);
279 return true;
280 }
281
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800282 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
283 data.enforceInterface(IActivityManager.descriptor);
284 IBinder token = data.readStrongBinder();
285 boolean res = willActivityBeVisible(token);
286 reply.writeNoException();
287 reply.writeInt(res ? 1 : 0);
288 return true;
289 }
290
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800291 case REGISTER_RECEIVER_TRANSACTION:
292 {
293 data.enforceInterface(IActivityManager.descriptor);
294 IBinder b = data.readStrongBinder();
295 IApplicationThread app =
296 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700297 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 b = data.readStrongBinder();
299 IIntentReceiver rec
300 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
301 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
302 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700303 int userId = data.readInt();
304 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800305 reply.writeNoException();
306 if (intent != null) {
307 reply.writeInt(1);
308 intent.writeToParcel(reply, 0);
309 } else {
310 reply.writeInt(0);
311 }
312 return true;
313 }
314
315 case UNREGISTER_RECEIVER_TRANSACTION:
316 {
317 data.enforceInterface(IActivityManager.descriptor);
318 IBinder b = data.readStrongBinder();
319 if (b == null) {
320 return true;
321 }
322 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
323 unregisterReceiver(rec);
324 reply.writeNoException();
325 return true;
326 }
327
328 case BROADCAST_INTENT_TRANSACTION:
329 {
330 data.enforceInterface(IActivityManager.descriptor);
331 IBinder b = data.readStrongBinder();
332 IApplicationThread app =
333 b != null ? ApplicationThreadNative.asInterface(b) : null;
334 Intent intent = Intent.CREATOR.createFromParcel(data);
335 String resolvedType = data.readString();
336 b = data.readStrongBinder();
337 IIntentReceiver resultTo =
338 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
339 int resultCode = data.readInt();
340 String resultData = data.readString();
341 Bundle resultExtras = data.readBundle();
342 String perm = data.readString();
343 boolean serialized = data.readInt() != 0;
344 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700345 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800346 int res = broadcastIntent(app, intent, resolvedType, resultTo,
347 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700348 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800349 reply.writeNoException();
350 reply.writeInt(res);
351 return true;
352 }
353
354 case UNBROADCAST_INTENT_TRANSACTION:
355 {
356 data.enforceInterface(IActivityManager.descriptor);
357 IBinder b = data.readStrongBinder();
358 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
359 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700360 int userId = data.readInt();
361 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 reply.writeNoException();
363 return true;
364 }
365
366 case FINISH_RECEIVER_TRANSACTION: {
367 data.enforceInterface(IActivityManager.descriptor);
368 IBinder who = data.readStrongBinder();
369 int resultCode = data.readInt();
370 String resultData = data.readString();
371 Bundle resultExtras = data.readBundle();
372 boolean resultAbort = data.readInt() != 0;
373 if (who != null) {
374 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
375 }
376 reply.writeNoException();
377 return true;
378 }
379
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 case ATTACH_APPLICATION_TRANSACTION: {
381 data.enforceInterface(IActivityManager.descriptor);
382 IApplicationThread app = ApplicationThreadNative.asInterface(
383 data.readStrongBinder());
384 if (app != null) {
385 attachApplication(app);
386 }
387 reply.writeNoException();
388 return true;
389 }
390
391 case ACTIVITY_IDLE_TRANSACTION: {
392 data.enforceInterface(IActivityManager.descriptor);
393 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700394 Configuration config = null;
395 if (data.readInt() != 0) {
396 config = Configuration.CREATOR.createFromParcel(data);
397 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700398 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700400 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800401 }
402 reply.writeNoException();
403 return true;
404 }
405
406 case ACTIVITY_PAUSED_TRANSACTION: {
407 data.enforceInterface(IActivityManager.descriptor);
408 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800409 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800410 reply.writeNoException();
411 return true;
412 }
413
414 case ACTIVITY_STOPPED_TRANSACTION: {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800417 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 Bitmap thumbnail = data.readInt() != 0
419 ? Bitmap.CREATOR.createFromParcel(data) : null;
420 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800421 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800422 reply.writeNoException();
423 return true;
424 }
425
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800426 case ACTIVITY_SLEPT_TRANSACTION: {
427 data.enforceInterface(IActivityManager.descriptor);
428 IBinder token = data.readStrongBinder();
429 activitySlept(token);
430 reply.writeNoException();
431 return true;
432 }
433
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 case ACTIVITY_DESTROYED_TRANSACTION: {
435 data.enforceInterface(IActivityManager.descriptor);
436 IBinder token = data.readStrongBinder();
437 activityDestroyed(token);
438 reply.writeNoException();
439 return true;
440 }
441
442 case GET_CALLING_PACKAGE_TRANSACTION: {
443 data.enforceInterface(IActivityManager.descriptor);
444 IBinder token = data.readStrongBinder();
445 String res = token != null ? getCallingPackage(token) : null;
446 reply.writeNoException();
447 reply.writeString(res);
448 return true;
449 }
450
451 case GET_CALLING_ACTIVITY_TRANSACTION: {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder token = data.readStrongBinder();
454 ComponentName cn = getCallingActivity(token);
455 reply.writeNoException();
456 ComponentName.writeToParcel(cn, reply);
457 return true;
458 }
459
460 case GET_TASKS_TRANSACTION: {
461 data.enforceInterface(IActivityManager.descriptor);
462 int maxNum = data.readInt();
463 int fl = data.readInt();
464 IBinder receiverBinder = data.readStrongBinder();
465 IThumbnailReceiver receiver = receiverBinder != null
466 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
467 : null;
468 List list = getTasks(maxNum, fl, receiver);
469 reply.writeNoException();
470 int N = list != null ? list.size() : -1;
471 reply.writeInt(N);
472 int i;
473 for (i=0; i<N; i++) {
474 ActivityManager.RunningTaskInfo info =
475 (ActivityManager.RunningTaskInfo)list.get(i);
476 info.writeToParcel(reply, 0);
477 }
478 return true;
479 }
480
481 case GET_RECENT_TASKS_TRANSACTION: {
482 data.enforceInterface(IActivityManager.descriptor);
483 int maxNum = data.readInt();
484 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700485 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700487 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800488 reply.writeNoException();
489 reply.writeTypedList(list);
490 return true;
491 }
492
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700493 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800494 data.enforceInterface(IActivityManager.descriptor);
495 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700496 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800497 reply.writeNoException();
498 if (bm != null) {
499 reply.writeInt(1);
500 bm.writeToParcel(reply, 0);
501 } else {
502 reply.writeInt(0);
503 }
504 return true;
505 }
506
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800507 case GET_SERVICES_TRANSACTION: {
508 data.enforceInterface(IActivityManager.descriptor);
509 int maxNum = data.readInt();
510 int fl = data.readInt();
511 List list = getServices(maxNum, fl);
512 reply.writeNoException();
513 int N = list != null ? list.size() : -1;
514 reply.writeInt(N);
515 int i;
516 for (i=0; i<N; i++) {
517 ActivityManager.RunningServiceInfo info =
518 (ActivityManager.RunningServiceInfo)list.get(i);
519 info.writeToParcel(reply, 0);
520 }
521 return true;
522 }
523
524 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
525 data.enforceInterface(IActivityManager.descriptor);
526 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
527 reply.writeNoException();
528 reply.writeTypedList(list);
529 return true;
530 }
531
532 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
533 data.enforceInterface(IActivityManager.descriptor);
534 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
535 reply.writeNoException();
536 reply.writeTypedList(list);
537 return true;
538 }
539
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700540 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
541 data.enforceInterface(IActivityManager.descriptor);
542 List<ApplicationInfo> list = getRunningExternalApplications();
543 reply.writeNoException();
544 reply.writeTypedList(list);
545 return true;
546 }
547
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800548 case MOVE_TASK_TO_FRONT_TRANSACTION: {
549 data.enforceInterface(IActivityManager.descriptor);
550 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800551 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700552 Bundle options = data.readInt() != 0
553 ? Bundle.CREATOR.createFromParcel(data) : null;
554 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800555 reply.writeNoException();
556 return true;
557 }
558
559 case MOVE_TASK_TO_BACK_TRANSACTION: {
560 data.enforceInterface(IActivityManager.descriptor);
561 int task = data.readInt();
562 moveTaskToBack(task);
563 reply.writeNoException();
564 return true;
565 }
566
567 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 IBinder token = data.readStrongBinder();
570 boolean nonRoot = data.readInt() != 0;
571 boolean res = moveActivityTaskToBack(token, nonRoot);
572 reply.writeNoException();
573 reply.writeInt(res ? 1 : 0);
574 return true;
575 }
576
577 case MOVE_TASK_BACKWARDS_TRANSACTION: {
578 data.enforceInterface(IActivityManager.descriptor);
579 int task = data.readInt();
580 moveTaskBackwards(task);
581 reply.writeNoException();
582 return true;
583 }
584
585 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
586 data.enforceInterface(IActivityManager.descriptor);
587 IBinder token = data.readStrongBinder();
588 boolean onlyRoot = data.readInt() != 0;
589 int res = token != null
590 ? getTaskForActivity(token, onlyRoot) : -1;
591 reply.writeNoException();
592 reply.writeInt(res);
593 return true;
594 }
595
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800596 case REPORT_THUMBNAIL_TRANSACTION: {
597 data.enforceInterface(IActivityManager.descriptor);
598 IBinder token = data.readStrongBinder();
599 Bitmap thumbnail = data.readInt() != 0
600 ? Bitmap.CREATOR.createFromParcel(data) : null;
601 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
602 reportThumbnail(token, thumbnail, description);
603 reply.writeNoException();
604 return true;
605 }
606
607 case GET_CONTENT_PROVIDER_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 IBinder b = data.readStrongBinder();
610 IApplicationThread app = ApplicationThreadNative.asInterface(b);
611 String name = data.readString();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700612 boolean stable = data.readInt() != 0;
613 ContentProviderHolder cph = getContentProvider(app, name, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800614 reply.writeNoException();
615 if (cph != null) {
616 reply.writeInt(1);
617 cph.writeToParcel(reply, 0);
618 } else {
619 reply.writeInt(0);
620 }
621 return true;
622 }
623
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800624 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 String name = data.readString();
627 IBinder token = data.readStrongBinder();
628 ContentProviderHolder cph = getContentProviderExternal(name, token);
629 reply.writeNoException();
630 if (cph != null) {
631 reply.writeInt(1);
632 cph.writeToParcel(reply, 0);
633 } else {
634 reply.writeInt(0);
635 }
636 return true;
637 }
638
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
640 data.enforceInterface(IActivityManager.descriptor);
641 IBinder b = data.readStrongBinder();
642 IApplicationThread app = ApplicationThreadNative.asInterface(b);
643 ArrayList<ContentProviderHolder> providers =
644 data.createTypedArrayList(ContentProviderHolder.CREATOR);
645 publishContentProviders(app, providers);
646 reply.writeNoException();
647 return true;
648 }
649
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700650 case REF_CONTENT_PROVIDER_TRANSACTION: {
651 data.enforceInterface(IActivityManager.descriptor);
652 IBinder b = data.readStrongBinder();
653 int stable = data.readInt();
654 int unstable = data.readInt();
655 boolean res = refContentProvider(b, stable, unstable);
656 reply.writeNoException();
657 reply.writeInt(res ? 1 : 0);
658 return true;
659 }
660
661 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
662 data.enforceInterface(IActivityManager.descriptor);
663 IBinder b = data.readStrongBinder();
664 unstableProviderDied(b);
665 reply.writeNoException();
666 return true;
667 }
668
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800669 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
670 data.enforceInterface(IActivityManager.descriptor);
671 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700672 boolean stable = data.readInt() != 0;
673 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800674 reply.writeNoException();
675 return true;
676 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800677
678 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
679 data.enforceInterface(IActivityManager.descriptor);
680 String name = data.readString();
681 IBinder token = data.readStrongBinder();
682 removeContentProviderExternal(name, token);
683 reply.writeNoException();
684 return true;
685 }
686
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700687 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
688 data.enforceInterface(IActivityManager.descriptor);
689 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
690 PendingIntent pi = getRunningServiceControlPanel(comp);
691 reply.writeNoException();
692 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
693 return true;
694 }
695
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 case START_SERVICE_TRANSACTION: {
697 data.enforceInterface(IActivityManager.descriptor);
698 IBinder b = data.readStrongBinder();
699 IApplicationThread app = ApplicationThreadNative.asInterface(b);
700 Intent service = Intent.CREATOR.createFromParcel(data);
701 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700702 int userId = data.readInt();
703 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 reply.writeNoException();
705 ComponentName.writeToParcel(cn, reply);
706 return true;
707 }
708
709 case STOP_SERVICE_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 IBinder b = data.readStrongBinder();
712 IApplicationThread app = ApplicationThreadNative.asInterface(b);
713 Intent service = Intent.CREATOR.createFromParcel(data);
714 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700715 int userId = data.readInt();
716 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 reply.writeNoException();
718 reply.writeInt(res);
719 return true;
720 }
721
722 case STOP_SERVICE_TOKEN_TRANSACTION: {
723 data.enforceInterface(IActivityManager.descriptor);
724 ComponentName className = ComponentName.readFromParcel(data);
725 IBinder token = data.readStrongBinder();
726 int startId = data.readInt();
727 boolean res = stopServiceToken(className, token, startId);
728 reply.writeNoException();
729 reply.writeInt(res ? 1 : 0);
730 return true;
731 }
732
733 case SET_SERVICE_FOREGROUND_TRANSACTION: {
734 data.enforceInterface(IActivityManager.descriptor);
735 ComponentName className = ComponentName.readFromParcel(data);
736 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700737 int id = data.readInt();
738 Notification notification = null;
739 if (data.readInt() != 0) {
740 notification = Notification.CREATOR.createFromParcel(data);
741 }
742 boolean removeNotification = data.readInt() != 0;
743 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800744 reply.writeNoException();
745 return true;
746 }
747
748 case BIND_SERVICE_TRANSACTION: {
749 data.enforceInterface(IActivityManager.descriptor);
750 IBinder b = data.readStrongBinder();
751 IApplicationThread app = ApplicationThreadNative.asInterface(b);
752 IBinder token = data.readStrongBinder();
753 Intent service = Intent.CREATOR.createFromParcel(data);
754 String resolvedType = data.readString();
755 b = data.readStrongBinder();
756 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800757 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800758 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800759 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800760 reply.writeNoException();
761 reply.writeInt(res);
762 return true;
763 }
764
765 case UNBIND_SERVICE_TRANSACTION: {
766 data.enforceInterface(IActivityManager.descriptor);
767 IBinder b = data.readStrongBinder();
768 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
769 boolean res = unbindService(conn);
770 reply.writeNoException();
771 reply.writeInt(res ? 1 : 0);
772 return true;
773 }
774
775 case PUBLISH_SERVICE_TRANSACTION: {
776 data.enforceInterface(IActivityManager.descriptor);
777 IBinder token = data.readStrongBinder();
778 Intent intent = Intent.CREATOR.createFromParcel(data);
779 IBinder service = data.readStrongBinder();
780 publishService(token, intent, service);
781 reply.writeNoException();
782 return true;
783 }
784
785 case UNBIND_FINISHED_TRANSACTION: {
786 data.enforceInterface(IActivityManager.descriptor);
787 IBinder token = data.readStrongBinder();
788 Intent intent = Intent.CREATOR.createFromParcel(data);
789 boolean doRebind = data.readInt() != 0;
790 unbindFinished(token, intent, doRebind);
791 reply.writeNoException();
792 return true;
793 }
794
795 case SERVICE_DONE_EXECUTING_TRANSACTION: {
796 data.enforceInterface(IActivityManager.descriptor);
797 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700798 int type = data.readInt();
799 int startId = data.readInt();
800 int res = data.readInt();
801 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800802 reply.writeNoException();
803 return true;
804 }
805
806 case START_INSTRUMENTATION_TRANSACTION: {
807 data.enforceInterface(IActivityManager.descriptor);
808 ComponentName className = ComponentName.readFromParcel(data);
809 String profileFile = data.readString();
810 int fl = data.readInt();
811 Bundle arguments = data.readBundle();
812 IBinder b = data.readStrongBinder();
813 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
814 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
815 reply.writeNoException();
816 reply.writeInt(res ? 1 : 0);
817 return true;
818 }
819
820
821 case FINISH_INSTRUMENTATION_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 IBinder b = data.readStrongBinder();
824 IApplicationThread app = ApplicationThreadNative.asInterface(b);
825 int resultCode = data.readInt();
826 Bundle results = data.readBundle();
827 finishInstrumentation(app, resultCode, results);
828 reply.writeNoException();
829 return true;
830 }
831
832 case GET_CONFIGURATION_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 Configuration config = getConfiguration();
835 reply.writeNoException();
836 config.writeToParcel(reply, 0);
837 return true;
838 }
839
840 case UPDATE_CONFIGURATION_TRANSACTION: {
841 data.enforceInterface(IActivityManager.descriptor);
842 Configuration config = Configuration.CREATOR.createFromParcel(data);
843 updateConfiguration(config);
844 reply.writeNoException();
845 return true;
846 }
847
848 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 IBinder token = data.readStrongBinder();
851 int requestedOrientation = data.readInt();
852 setRequestedOrientation(token, requestedOrientation);
853 reply.writeNoException();
854 return true;
855 }
856
857 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
858 data.enforceInterface(IActivityManager.descriptor);
859 IBinder token = data.readStrongBinder();
860 int req = getRequestedOrientation(token);
861 reply.writeNoException();
862 reply.writeInt(req);
863 return true;
864 }
865
866 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
867 data.enforceInterface(IActivityManager.descriptor);
868 IBinder token = data.readStrongBinder();
869 ComponentName cn = getActivityClassForToken(token);
870 reply.writeNoException();
871 ComponentName.writeToParcel(cn, reply);
872 return true;
873 }
874
875 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 IBinder token = data.readStrongBinder();
878 reply.writeNoException();
879 reply.writeString(getPackageForToken(token));
880 return true;
881 }
882
883 case GET_INTENT_SENDER_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 int type = data.readInt();
886 String packageName = data.readString();
887 IBinder token = data.readStrongBinder();
888 String resultWho = data.readString();
889 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800890 Intent[] requestIntents;
891 String[] requestResolvedTypes;
892 if (data.readInt() != 0) {
893 requestIntents = data.createTypedArray(Intent.CREATOR);
894 requestResolvedTypes = data.createStringArray();
895 } else {
896 requestIntents = null;
897 requestResolvedTypes = null;
898 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800899 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700900 Bundle options = data.readInt() != 0
901 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700902 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800903 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800904 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700905 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800906 reply.writeNoException();
907 reply.writeStrongBinder(res != null ? res.asBinder() : null);
908 return true;
909 }
910
911 case CANCEL_INTENT_SENDER_TRANSACTION: {
912 data.enforceInterface(IActivityManager.descriptor);
913 IIntentSender r = IIntentSender.Stub.asInterface(
914 data.readStrongBinder());
915 cancelIntentSender(r);
916 reply.writeNoException();
917 return true;
918 }
919
920 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
921 data.enforceInterface(IActivityManager.descriptor);
922 IIntentSender r = IIntentSender.Stub.asInterface(
923 data.readStrongBinder());
924 String res = getPackageForIntentSender(r);
925 reply.writeNoException();
926 reply.writeString(res);
927 return true;
928 }
929
Christopher Tatec4a07d12012-04-06 14:19:13 -0700930 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
931 data.enforceInterface(IActivityManager.descriptor);
932 IIntentSender r = IIntentSender.Stub.asInterface(
933 data.readStrongBinder());
934 int res = getUidForIntentSender(r);
935 reply.writeNoException();
936 reply.writeInt(res);
937 return true;
938 }
939
Dianne Hackborn41203752012-08-31 14:05:51 -0700940 case HANDLE_INCOMING_USER_TRANSACTION: {
941 data.enforceInterface(IActivityManager.descriptor);
942 int callingPid = data.readInt();
943 int callingUid = data.readInt();
944 int userId = data.readInt();
945 boolean allowAll = data.readInt() != 0 ;
946 boolean requireFull = data.readInt() != 0;
947 String name = data.readString();
948 String callerPackage = data.readString();
949 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
950 requireFull, name, callerPackage);
951 reply.writeNoException();
952 reply.writeInt(res);
953 return true;
954 }
955
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800956 case SET_PROCESS_LIMIT_TRANSACTION: {
957 data.enforceInterface(IActivityManager.descriptor);
958 int max = data.readInt();
959 setProcessLimit(max);
960 reply.writeNoException();
961 return true;
962 }
963
964 case GET_PROCESS_LIMIT_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 int limit = getProcessLimit();
967 reply.writeNoException();
968 reply.writeInt(limit);
969 return true;
970 }
971
972 case SET_PROCESS_FOREGROUND_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 IBinder token = data.readStrongBinder();
975 int pid = data.readInt();
976 boolean isForeground = data.readInt() != 0;
977 setProcessForeground(token, pid, isForeground);
978 reply.writeNoException();
979 return true;
980 }
981
982 case CHECK_PERMISSION_TRANSACTION: {
983 data.enforceInterface(IActivityManager.descriptor);
984 String perm = data.readString();
985 int pid = data.readInt();
986 int uid = data.readInt();
987 int res = checkPermission(perm, pid, uid);
988 reply.writeNoException();
989 reply.writeInt(res);
990 return true;
991 }
992
993 case CHECK_URI_PERMISSION_TRANSACTION: {
994 data.enforceInterface(IActivityManager.descriptor);
995 Uri uri = Uri.CREATOR.createFromParcel(data);
996 int pid = data.readInt();
997 int uid = data.readInt();
998 int mode = data.readInt();
999 int res = checkUriPermission(uri, pid, uid, mode);
1000 reply.writeNoException();
1001 reply.writeInt(res);
1002 return true;
1003 }
1004
1005 case CLEAR_APP_DATA_TRANSACTION: {
1006 data.enforceInterface(IActivityManager.descriptor);
1007 String packageName = data.readString();
1008 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1009 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001010 int userId = data.readInt();
1011 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001012 reply.writeNoException();
1013 reply.writeInt(res ? 1 : 0);
1014 return true;
1015 }
1016
1017 case GRANT_URI_PERMISSION_TRANSACTION: {
1018 data.enforceInterface(IActivityManager.descriptor);
1019 IBinder b = data.readStrongBinder();
1020 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1021 String targetPkg = data.readString();
1022 Uri uri = Uri.CREATOR.createFromParcel(data);
1023 int mode = data.readInt();
1024 grantUriPermission(app, targetPkg, uri, mode);
1025 reply.writeNoException();
1026 return true;
1027 }
1028
1029 case REVOKE_URI_PERMISSION_TRANSACTION: {
1030 data.enforceInterface(IActivityManager.descriptor);
1031 IBinder b = data.readStrongBinder();
1032 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1033 Uri uri = Uri.CREATOR.createFromParcel(data);
1034 int mode = data.readInt();
1035 revokeUriPermission(app, uri, mode);
1036 reply.writeNoException();
1037 return true;
1038 }
1039
1040 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IBinder b = data.readStrongBinder();
1043 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1044 boolean waiting = data.readInt() != 0;
1045 showWaitingForDebugger(app, waiting);
1046 reply.writeNoException();
1047 return true;
1048 }
1049
1050 case GET_MEMORY_INFO_TRANSACTION: {
1051 data.enforceInterface(IActivityManager.descriptor);
1052 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1053 getMemoryInfo(mi);
1054 reply.writeNoException();
1055 mi.writeToParcel(reply, 0);
1056 return true;
1057 }
1058
1059 case UNHANDLED_BACK_TRANSACTION: {
1060 data.enforceInterface(IActivityManager.descriptor);
1061 unhandledBack();
1062 reply.writeNoException();
1063 return true;
1064 }
1065
1066 case OPEN_CONTENT_URI_TRANSACTION: {
1067 data.enforceInterface(IActivityManager.descriptor);
1068 Uri uri = Uri.parse(data.readString());
1069 ParcelFileDescriptor pfd = openContentUri(uri);
1070 reply.writeNoException();
1071 if (pfd != null) {
1072 reply.writeInt(1);
1073 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1074 } else {
1075 reply.writeInt(0);
1076 }
1077 return true;
1078 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001080 case GOING_TO_SLEEP_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 goingToSleep();
1083 reply.writeNoException();
1084 return true;
1085 }
1086
1087 case WAKING_UP_TRANSACTION: {
1088 data.enforceInterface(IActivityManager.descriptor);
1089 wakingUp();
1090 reply.writeNoException();
1091 return true;
1092 }
1093
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001094 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1095 data.enforceInterface(IActivityManager.descriptor);
1096 setLockScreenShown(data.readInt() != 0);
1097 reply.writeNoException();
1098 return true;
1099 }
1100
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001101 case SET_DEBUG_APP_TRANSACTION: {
1102 data.enforceInterface(IActivityManager.descriptor);
1103 String pn = data.readString();
1104 boolean wfd = data.readInt() != 0;
1105 boolean per = data.readInt() != 0;
1106 setDebugApp(pn, wfd, per);
1107 reply.writeNoException();
1108 return true;
1109 }
1110
1111 case SET_ALWAYS_FINISH_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 boolean enabled = data.readInt() != 0;
1114 setAlwaysFinish(enabled);
1115 reply.writeNoException();
1116 return true;
1117 }
1118
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001119 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001120 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001121 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001123 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001124 return true;
1125 }
1126
1127 case ENTER_SAFE_MODE_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 enterSafeMode();
1130 reply.writeNoException();
1131 return true;
1132 }
1133
1134 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 IIntentSender is = IIntentSender.Stub.asInterface(
1137 data.readStrongBinder());
1138 noteWakeupAlarm(is);
1139 reply.writeNoException();
1140 return true;
1141 }
1142
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001143 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001144 data.enforceInterface(IActivityManager.descriptor);
1145 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001146 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001147 boolean secure = data.readInt() != 0;
1148 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001149 reply.writeNoException();
1150 reply.writeInt(res ? 1 : 0);
1151 return true;
1152 }
1153
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001154 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1155 data.enforceInterface(IActivityManager.descriptor);
1156 String reason = data.readString();
1157 boolean res = killProcessesBelowForeground(reason);
1158 reply.writeNoException();
1159 reply.writeInt(res ? 1 : 0);
1160 return true;
1161 }
1162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001163 case START_RUNNING_TRANSACTION: {
1164 data.enforceInterface(IActivityManager.descriptor);
1165 String pkg = data.readString();
1166 String cls = data.readString();
1167 String action = data.readString();
1168 String indata = data.readString();
1169 startRunning(pkg, cls, action, indata);
1170 reply.writeNoException();
1171 return true;
1172 }
1173
Dan Egnor60d87622009-12-16 16:32:58 -08001174 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1175 data.enforceInterface(IActivityManager.descriptor);
1176 IBinder app = data.readStrongBinder();
1177 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1178 handleApplicationCrash(app, ci);
1179 reply.writeNoException();
1180 return true;
1181 }
1182
1183 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 data.enforceInterface(IActivityManager.descriptor);
1185 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001187 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001188 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001189 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001190 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001191 return true;
1192 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001193
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001194 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001197 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001198 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1199 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001200 reply.writeNoException();
1201 return true;
1202 }
1203
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 int sig = data.readInt();
1207 signalPersistentProcesses(sig);
1208 reply.writeNoException();
1209 return true;
1210 }
1211
Dianne Hackborn03abb812010-01-04 18:43:19 -08001212 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1213 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001215 killBackgroundProcesses(packageName);
1216 reply.writeNoException();
1217 return true;
1218 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001219
1220 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1221 data.enforceInterface(IActivityManager.descriptor);
1222 killAllBackgroundProcesses();
1223 reply.writeNoException();
1224 return true;
1225 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001226
1227 case FORCE_STOP_PACKAGE_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 String packageName = data.readString();
1230 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 reply.writeNoException();
1232 return true;
1233 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001234
1235 case GET_MY_MEMORY_STATE_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 ActivityManager.RunningAppProcessInfo info =
1238 new ActivityManager.RunningAppProcessInfo();
1239 getMyMemoryState(info);
1240 reply.writeNoException();
1241 info.writeToParcel(reply, 0);
1242 return true;
1243 }
1244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1246 data.enforceInterface(IActivityManager.descriptor);
1247 ConfigurationInfo config = getDeviceConfigurationInfo();
1248 reply.writeNoException();
1249 config.writeToParcel(reply, 0);
1250 return true;
1251 }
1252
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001253 case PROFILE_CONTROL_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
1255 String process = data.readString();
1256 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001257 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001258 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001259 ParcelFileDescriptor fd = data.readInt() != 0
1260 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001261 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001262 reply.writeNoException();
1263 reply.writeInt(res ? 1 : 0);
1264 return true;
1265 }
1266
Dianne Hackborn55280a92009-05-07 15:53:46 -07001267 case SHUTDOWN_TRANSACTION: {
1268 data.enforceInterface(IActivityManager.descriptor);
1269 boolean res = shutdown(data.readInt());
1270 reply.writeNoException();
1271 reply.writeInt(res ? 1 : 0);
1272 return true;
1273 }
1274
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001275 case STOP_APP_SWITCHES_TRANSACTION: {
1276 data.enforceInterface(IActivityManager.descriptor);
1277 stopAppSwitches();
1278 reply.writeNoException();
1279 return true;
1280 }
1281
1282 case RESUME_APP_SWITCHES_TRANSACTION: {
1283 data.enforceInterface(IActivityManager.descriptor);
1284 resumeAppSwitches();
1285 reply.writeNoException();
1286 return true;
1287 }
1288
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001289 case PEEK_SERVICE_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 Intent service = Intent.CREATOR.createFromParcel(data);
1292 String resolvedType = data.readString();
1293 IBinder binder = peekService(service, resolvedType);
1294 reply.writeNoException();
1295 reply.writeStrongBinder(binder);
1296 return true;
1297 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001298
1299 case START_BACKUP_AGENT_TRANSACTION: {
1300 data.enforceInterface(IActivityManager.descriptor);
1301 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1302 int backupRestoreMode = data.readInt();
1303 boolean success = bindBackupAgent(info, backupRestoreMode);
1304 reply.writeNoException();
1305 reply.writeInt(success ? 1 : 0);
1306 return true;
1307 }
1308
1309 case BACKUP_AGENT_CREATED_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 String packageName = data.readString();
1312 IBinder agent = data.readStrongBinder();
1313 backupAgentCreated(packageName, agent);
1314 reply.writeNoException();
1315 return true;
1316 }
1317
1318 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1321 unbindBackupAgent(info);
1322 reply.writeNoException();
1323 return true;
1324 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001325
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001326 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 String pkg = data.readString();
1329 int uid = data.readInt();
1330 killApplicationWithUid(pkg, uid);
1331 reply.writeNoException();
1332 return true;
1333 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001334
1335 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 String reason = data.readString();
1338 closeSystemDialogs(reason);
1339 reply.writeNoException();
1340 return true;
1341 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001342
1343 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001345 int[] pids = data.createIntArray();
1346 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001347 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001348 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001349 return true;
1350 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001351
1352 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1353 data.enforceInterface(IActivityManager.descriptor);
1354 String processName = data.readString();
1355 int uid = data.readInt();
1356 killApplicationProcess(processName, uid);
1357 reply.writeNoException();
1358 return true;
1359 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001360
1361 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1362 data.enforceInterface(IActivityManager.descriptor);
1363 IBinder token = data.readStrongBinder();
1364 String packageName = data.readString();
1365 int enterAnim = data.readInt();
1366 int exitAnim = data.readInt();
1367 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001368 reply.writeNoException();
1369 return true;
1370 }
1371
1372 case IS_USER_A_MONKEY_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001374 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001375 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001376 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001377 return true;
1378 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001379
1380 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 finishHeavyWeightApp();
1383 reply.writeNoException();
1384 return true;
1385 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001386
1387 case IS_IMMERSIVE_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001390 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001391 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001392 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001393 return true;
1394 }
1395
1396 case SET_IMMERSIVE_TRANSACTION: {
1397 data.enforceInterface(IActivityManager.descriptor);
1398 IBinder token = data.readStrongBinder();
1399 boolean imm = data.readInt() == 1;
1400 setImmersive(token, imm);
1401 reply.writeNoException();
1402 return true;
1403 }
1404
1405 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1406 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001407 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001408 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001409 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001410 return true;
1411 }
1412
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001413 case CRASH_APPLICATION_TRANSACTION: {
1414 data.enforceInterface(IActivityManager.descriptor);
1415 int uid = data.readInt();
1416 int initialPid = data.readInt();
1417 String packageName = data.readString();
1418 String message = data.readString();
1419 crashApplication(uid, initialPid, packageName, message);
1420 reply.writeNoException();
1421 return true;
1422 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001423
1424 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1425 data.enforceInterface(IActivityManager.descriptor);
1426 Uri uri = Uri.CREATOR.createFromParcel(data);
1427 String type = getProviderMimeType(uri);
1428 reply.writeNoException();
1429 reply.writeString(type);
1430 return true;
1431 }
1432
Dianne Hackborn7e269642010-08-25 19:50:20 -07001433 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1434 data.enforceInterface(IActivityManager.descriptor);
1435 String name = data.readString();
1436 IBinder perm = newUriPermissionOwner(name);
1437 reply.writeNoException();
1438 reply.writeStrongBinder(perm);
1439 return true;
1440 }
1441
1442 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1443 data.enforceInterface(IActivityManager.descriptor);
1444 IBinder owner = data.readStrongBinder();
1445 int fromUid = data.readInt();
1446 String targetPkg = data.readString();
1447 Uri uri = Uri.CREATOR.createFromParcel(data);
1448 int mode = data.readInt();
1449 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1450 reply.writeNoException();
1451 return true;
1452 }
1453
1454 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1455 data.enforceInterface(IActivityManager.descriptor);
1456 IBinder owner = data.readStrongBinder();
1457 Uri uri = null;
1458 if (data.readInt() != 0) {
1459 Uri.CREATOR.createFromParcel(data);
1460 }
1461 int mode = data.readInt();
1462 revokeUriPermissionFromOwner(owner, uri, mode);
1463 reply.writeNoException();
1464 return true;
1465 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001466
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001467 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1468 data.enforceInterface(IActivityManager.descriptor);
1469 int callingUid = data.readInt();
1470 String targetPkg = data.readString();
1471 Uri uri = Uri.CREATOR.createFromParcel(data);
1472 int modeFlags = data.readInt();
1473 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1474 reply.writeNoException();
1475 reply.writeInt(res);
1476 return true;
1477 }
1478
Andy McFadden824c5102010-07-09 16:26:57 -07001479 case DUMP_HEAP_TRANSACTION: {
1480 data.enforceInterface(IActivityManager.descriptor);
1481 String process = data.readString();
1482 boolean managed = data.readInt() != 0;
1483 String path = data.readString();
1484 ParcelFileDescriptor fd = data.readInt() != 0
1485 ? data.readFileDescriptor() : null;
1486 boolean res = dumpHeap(process, managed, path, fd);
1487 reply.writeNoException();
1488 reply.writeInt(res ? 1 : 0);
1489 return true;
1490 }
1491
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001492 case START_ACTIVITIES_TRANSACTION:
1493 {
1494 data.enforceInterface(IActivityManager.descriptor);
1495 IBinder b = data.readStrongBinder();
1496 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1497 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1498 String[] resolvedTypes = data.createStringArray();
1499 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001500 Bundle options = data.readInt() != 0
1501 ? Bundle.CREATOR.createFromParcel(data) : null;
1502 int result = startActivities(app, intents, resolvedTypes, resultTo,
1503 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001504 reply.writeNoException();
1505 reply.writeInt(result);
1506 return true;
1507 }
1508
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001509 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1510 {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 int mode = getFrontActivityScreenCompatMode();
1513 reply.writeNoException();
1514 reply.writeInt(mode);
1515 return true;
1516 }
1517
1518 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1519 {
1520 data.enforceInterface(IActivityManager.descriptor);
1521 int mode = data.readInt();
1522 setFrontActivityScreenCompatMode(mode);
1523 reply.writeNoException();
1524 reply.writeInt(mode);
1525 return true;
1526 }
1527
1528 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1529 {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 String pkg = data.readString();
1532 int mode = getPackageScreenCompatMode(pkg);
1533 reply.writeNoException();
1534 reply.writeInt(mode);
1535 return true;
1536 }
1537
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001538 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1539 {
1540 data.enforceInterface(IActivityManager.descriptor);
1541 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001542 int mode = data.readInt();
1543 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001544 reply.writeNoException();
1545 return true;
1546 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001547
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001548 case SWITCH_USER_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 int userid = data.readInt();
1551 boolean result = switchUser(userid);
1552 reply.writeNoException();
1553 reply.writeInt(result ? 1 : 0);
1554 return true;
1555 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001556
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001557 case STOP_USER_TRANSACTION: {
1558 data.enforceInterface(IActivityManager.descriptor);
1559 int userid = data.readInt();
1560 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1561 data.readStrongBinder());
1562 int result = stopUser(userid, callback);
1563 reply.writeNoException();
1564 reply.writeInt(result);
1565 return true;
1566 }
1567
Amith Yamasani52f1d752012-03-28 18:19:29 -07001568 case GET_CURRENT_USER_TRANSACTION: {
1569 data.enforceInterface(IActivityManager.descriptor);
1570 UserInfo userInfo = getCurrentUser();
1571 reply.writeNoException();
1572 userInfo.writeToParcel(reply, 0);
1573 return true;
1574 }
1575
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001576 case REMOVE_SUB_TASK_TRANSACTION:
1577 {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 int taskId = data.readInt();
1580 int subTaskIndex = data.readInt();
1581 boolean result = removeSubTask(taskId, subTaskIndex);
1582 reply.writeNoException();
1583 reply.writeInt(result ? 1 : 0);
1584 return true;
1585 }
1586
1587 case REMOVE_TASK_TRANSACTION:
1588 {
1589 data.enforceInterface(IActivityManager.descriptor);
1590 int taskId = data.readInt();
1591 int fl = data.readInt();
1592 boolean result = removeTask(taskId, fl);
1593 reply.writeNoException();
1594 reply.writeInt(result ? 1 : 0);
1595 return true;
1596 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001597
Jeff Sharkeya4620792011-05-20 15:29:23 -07001598 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1599 data.enforceInterface(IActivityManager.descriptor);
1600 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1601 data.readStrongBinder());
1602 registerProcessObserver(observer);
1603 return true;
1604 }
1605
1606 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1607 data.enforceInterface(IActivityManager.descriptor);
1608 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1609 data.readStrongBinder());
1610 unregisterProcessObserver(observer);
1611 return true;
1612 }
1613
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001614 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1615 {
1616 data.enforceInterface(IActivityManager.descriptor);
1617 String pkg = data.readString();
1618 boolean ask = getPackageAskScreenCompat(pkg);
1619 reply.writeNoException();
1620 reply.writeInt(ask ? 1 : 0);
1621 return true;
1622 }
1623
1624 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1625 {
1626 data.enforceInterface(IActivityManager.descriptor);
1627 String pkg = data.readString();
1628 boolean ask = data.readInt() != 0;
1629 setPackageAskScreenCompat(pkg, ask);
1630 reply.writeNoException();
1631 return true;
1632 }
1633
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001634 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 IIntentSender r = IIntentSender.Stub.asInterface(
1637 data.readStrongBinder());
1638 boolean res = isIntentSenderTargetedToPackage(r);
1639 reply.writeNoException();
1640 reply.writeInt(res ? 1 : 0);
1641 return true;
1642 }
1643
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001644 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1645 data.enforceInterface(IActivityManager.descriptor);
1646 IIntentSender r = IIntentSender.Stub.asInterface(
1647 data.readStrongBinder());
1648 boolean res = isIntentSenderAnActivity(r);
1649 reply.writeNoException();
1650 reply.writeInt(res ? 1 : 0);
1651 return true;
1652 }
1653
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001654 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 Configuration config = Configuration.CREATOR.createFromParcel(data);
1657 updatePersistentConfiguration(config);
1658 reply.writeNoException();
1659 return true;
1660 }
1661
Dianne Hackbornb437e092011-08-05 17:50:29 -07001662 case GET_PROCESS_PSS_TRANSACTION: {
1663 data.enforceInterface(IActivityManager.descriptor);
1664 int[] pids = data.createIntArray();
1665 long[] pss = getProcessPss(pids);
1666 reply.writeNoException();
1667 reply.writeLongArray(pss);
1668 return true;
1669 }
1670
Dianne Hackborn661cd522011-08-22 00:26:20 -07001671 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1672 data.enforceInterface(IActivityManager.descriptor);
1673 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1674 boolean always = data.readInt() != 0;
1675 showBootMessage(msg, always);
1676 reply.writeNoException();
1677 return true;
1678 }
1679
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001680 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1681 data.enforceInterface(IActivityManager.descriptor);
1682 dismissKeyguardOnNextActivity();
1683 reply.writeNoException();
1684 return true;
1685 }
1686
Adam Powelldd8fab22012-03-22 17:47:27 -07001687 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1688 data.enforceInterface(IActivityManager.descriptor);
1689 IBinder token = data.readStrongBinder();
1690 String destAffinity = data.readString();
1691 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1692 reply.writeNoException();
1693 reply.writeInt(res ? 1 : 0);
1694 return true;
1695 }
1696
1697 case NAVIGATE_UP_TO_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
1699 IBinder token = data.readStrongBinder();
1700 Intent target = Intent.CREATOR.createFromParcel(data);
1701 int resultCode = data.readInt();
1702 Intent resultData = null;
1703 if (data.readInt() != 0) {
1704 resultData = Intent.CREATOR.createFromParcel(data);
1705 }
1706 boolean res = navigateUpTo(token, target, resultCode, resultData);
1707 reply.writeNoException();
1708 reply.writeInt(res ? 1 : 0);
1709 return true;
1710 }
1711
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001712 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1713 data.enforceInterface(IActivityManager.descriptor);
1714 IBinder token = data.readStrongBinder();
1715 int res = getLaunchedFromUid(token);
1716 reply.writeNoException();
1717 reply.writeInt(res);
1718 return true;
1719 }
1720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001721 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001722
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001723 return super.onTransact(code, data, reply, flags);
1724 }
1725
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001726 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001727 return this;
1728 }
1729
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001730 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1731 protected IActivityManager create() {
1732 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001733 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001734 Log.v("ActivityManager", "default service binder = " + b);
1735 }
1736 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001737 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001738 Log.v("ActivityManager", "default service = " + am);
1739 }
1740 return am;
1741 }
1742 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001743}
1744
1745class ActivityManagerProxy implements IActivityManager
1746{
1747 public ActivityManagerProxy(IBinder remote)
1748 {
1749 mRemote = remote;
1750 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001751
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001752 public IBinder asBinder()
1753 {
1754 return mRemote;
1755 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001756
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001757 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001758 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1759 int startFlags, String profileFile,
1760 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -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);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -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 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001784 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1785 reply.readException();
1786 int result = reply.readInt();
1787 reply.recycle();
1788 data.recycle();
1789 return result;
1790 }
Amith Yamasani82644082012-08-03 13:09:11 -07001791
1792 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1793 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1794 int startFlags, String profileFile,
1795 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1796 Parcel data = Parcel.obtain();
1797 Parcel reply = Parcel.obtain();
1798 data.writeInterfaceToken(IActivityManager.descriptor);
1799 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1800 intent.writeToParcel(data, 0);
1801 data.writeString(resolvedType);
1802 data.writeStrongBinder(resultTo);
1803 data.writeString(resultWho);
1804 data.writeInt(requestCode);
1805 data.writeInt(startFlags);
1806 data.writeString(profileFile);
1807 if (profileFd != null) {
1808 data.writeInt(1);
1809 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1810 } else {
1811 data.writeInt(0);
1812 }
1813 if (options != null) {
1814 data.writeInt(1);
1815 options.writeToParcel(data, 0);
1816 } else {
1817 data.writeInt(0);
1818 }
1819 data.writeInt(userId);
1820 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1821 reply.readException();
1822 int result = reply.readInt();
1823 reply.recycle();
1824 data.recycle();
1825 return result;
1826 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001827 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001828 String resolvedType, IBinder resultTo, String resultWho,
1829 int requestCode, int startFlags, String profileFile,
1830 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001831 Parcel data = Parcel.obtain();
1832 Parcel reply = Parcel.obtain();
1833 data.writeInterfaceToken(IActivityManager.descriptor);
1834 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1835 intent.writeToParcel(data, 0);
1836 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001837 data.writeStrongBinder(resultTo);
1838 data.writeString(resultWho);
1839 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001840 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001841 data.writeString(profileFile);
1842 if (profileFd != null) {
1843 data.writeInt(1);
1844 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1845 } else {
1846 data.writeInt(0);
1847 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001848 if (options != null) {
1849 data.writeInt(1);
1850 options.writeToParcel(data, 0);
1851 } else {
1852 data.writeInt(0);
1853 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001854 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1855 reply.readException();
1856 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1857 reply.recycle();
1858 data.recycle();
1859 return result;
1860 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001861 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001862 String resolvedType, IBinder resultTo, String resultWho,
1863 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001864 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001865 Parcel data = Parcel.obtain();
1866 Parcel reply = Parcel.obtain();
1867 data.writeInterfaceToken(IActivityManager.descriptor);
1868 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1869 intent.writeToParcel(data, 0);
1870 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001871 data.writeStrongBinder(resultTo);
1872 data.writeString(resultWho);
1873 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001874 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001875 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001876 if (options != null) {
1877 data.writeInt(1);
1878 options.writeToParcel(data, 0);
1879 } else {
1880 data.writeInt(0);
1881 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001882 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001883 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1884 reply.readException();
1885 int result = reply.readInt();
1886 reply.recycle();
1887 data.recycle();
1888 return result;
1889 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001890 public int startActivityIntentSender(IApplicationThread caller,
1891 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001892 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001893 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001894 Parcel data = Parcel.obtain();
1895 Parcel reply = Parcel.obtain();
1896 data.writeInterfaceToken(IActivityManager.descriptor);
1897 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1898 intent.writeToParcel(data, 0);
1899 if (fillInIntent != null) {
1900 data.writeInt(1);
1901 fillInIntent.writeToParcel(data, 0);
1902 } else {
1903 data.writeInt(0);
1904 }
1905 data.writeString(resolvedType);
1906 data.writeStrongBinder(resultTo);
1907 data.writeString(resultWho);
1908 data.writeInt(requestCode);
1909 data.writeInt(flagsMask);
1910 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001911 if (options != null) {
1912 data.writeInt(1);
1913 options.writeToParcel(data, 0);
1914 } else {
1915 data.writeInt(0);
1916 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001917 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001918 reply.readException();
1919 int result = reply.readInt();
1920 reply.recycle();
1921 data.recycle();
1922 return result;
1923 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001924 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001925 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001926 Parcel data = Parcel.obtain();
1927 Parcel reply = Parcel.obtain();
1928 data.writeInterfaceToken(IActivityManager.descriptor);
1929 data.writeStrongBinder(callingActivity);
1930 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001931 if (options != null) {
1932 data.writeInt(1);
1933 options.writeToParcel(data, 0);
1934 } else {
1935 data.writeInt(0);
1936 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001937 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1938 reply.readException();
1939 int result = reply.readInt();
1940 reply.recycle();
1941 data.recycle();
1942 return result != 0;
1943 }
1944 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1945 throws RemoteException {
1946 Parcel data = Parcel.obtain();
1947 Parcel reply = Parcel.obtain();
1948 data.writeInterfaceToken(IActivityManager.descriptor);
1949 data.writeStrongBinder(token);
1950 data.writeInt(resultCode);
1951 if (resultData != null) {
1952 data.writeInt(1);
1953 resultData.writeToParcel(data, 0);
1954 } else {
1955 data.writeInt(0);
1956 }
1957 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1958 reply.readException();
1959 boolean res = reply.readInt() != 0;
1960 data.recycle();
1961 reply.recycle();
1962 return res;
1963 }
1964 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1965 {
1966 Parcel data = Parcel.obtain();
1967 Parcel reply = Parcel.obtain();
1968 data.writeInterfaceToken(IActivityManager.descriptor);
1969 data.writeStrongBinder(token);
1970 data.writeString(resultWho);
1971 data.writeInt(requestCode);
1972 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1973 reply.readException();
1974 data.recycle();
1975 reply.recycle();
1976 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07001977 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
1978 Parcel data = Parcel.obtain();
1979 Parcel reply = Parcel.obtain();
1980 data.writeInterfaceToken(IActivityManager.descriptor);
1981 data.writeStrongBinder(token);
1982 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
1983 reply.readException();
1984 boolean res = reply.readInt() != 0;
1985 data.recycle();
1986 reply.recycle();
1987 return res;
1988 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001989 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1990 Parcel data = Parcel.obtain();
1991 Parcel reply = Parcel.obtain();
1992 data.writeInterfaceToken(IActivityManager.descriptor);
1993 data.writeStrongBinder(token);
1994 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1995 reply.readException();
1996 boolean res = reply.readInt() != 0;
1997 data.recycle();
1998 reply.recycle();
1999 return res;
2000 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002001 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002002 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002003 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002004 {
2005 Parcel data = Parcel.obtain();
2006 Parcel reply = Parcel.obtain();
2007 data.writeInterfaceToken(IActivityManager.descriptor);
2008 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002009 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002010 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2011 filter.writeToParcel(data, 0);
2012 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002013 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002014 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2015 reply.readException();
2016 Intent intent = null;
2017 int haveIntent = reply.readInt();
2018 if (haveIntent != 0) {
2019 intent = Intent.CREATOR.createFromParcel(reply);
2020 }
2021 reply.recycle();
2022 data.recycle();
2023 return intent;
2024 }
2025 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2026 {
2027 Parcel data = Parcel.obtain();
2028 Parcel reply = Parcel.obtain();
2029 data.writeInterfaceToken(IActivityManager.descriptor);
2030 data.writeStrongBinder(receiver.asBinder());
2031 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2032 reply.readException();
2033 data.recycle();
2034 reply.recycle();
2035 }
2036 public int broadcastIntent(IApplicationThread caller,
2037 Intent intent, String resolvedType, IIntentReceiver resultTo,
2038 int resultCode, String resultData, Bundle map,
2039 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002040 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002041 {
2042 Parcel data = Parcel.obtain();
2043 Parcel reply = Parcel.obtain();
2044 data.writeInterfaceToken(IActivityManager.descriptor);
2045 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2046 intent.writeToParcel(data, 0);
2047 data.writeString(resolvedType);
2048 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2049 data.writeInt(resultCode);
2050 data.writeString(resultData);
2051 data.writeBundle(map);
2052 data.writeString(requiredPermission);
2053 data.writeInt(serialized ? 1 : 0);
2054 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002055 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002056 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2057 reply.readException();
2058 int res = reply.readInt();
2059 reply.recycle();
2060 data.recycle();
2061 return res;
2062 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002063 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2064 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002065 {
2066 Parcel data = Parcel.obtain();
2067 Parcel reply = Parcel.obtain();
2068 data.writeInterfaceToken(IActivityManager.descriptor);
2069 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2070 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002071 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002072 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2073 reply.readException();
2074 data.recycle();
2075 reply.recycle();
2076 }
2077 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2078 {
2079 Parcel data = Parcel.obtain();
2080 Parcel reply = Parcel.obtain();
2081 data.writeInterfaceToken(IActivityManager.descriptor);
2082 data.writeStrongBinder(who);
2083 data.writeInt(resultCode);
2084 data.writeString(resultData);
2085 data.writeBundle(map);
2086 data.writeInt(abortBroadcast ? 1 : 0);
2087 mRemote.transact(FINISH_RECEIVER_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 attachApplication(IApplicationThread app) throws RemoteException
2093 {
2094 Parcel data = Parcel.obtain();
2095 Parcel reply = Parcel.obtain();
2096 data.writeInterfaceToken(IActivityManager.descriptor);
2097 data.writeStrongBinder(app.asBinder());
2098 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2099 reply.readException();
2100 data.recycle();
2101 reply.recycle();
2102 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002103 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2104 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002105 {
2106 Parcel data = Parcel.obtain();
2107 Parcel reply = Parcel.obtain();
2108 data.writeInterfaceToken(IActivityManager.descriptor);
2109 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002110 if (config != null) {
2111 data.writeInt(1);
2112 config.writeToParcel(data, 0);
2113 } else {
2114 data.writeInt(0);
2115 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002116 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002117 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2118 reply.readException();
2119 data.recycle();
2120 reply.recycle();
2121 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002122 public void activityPaused(IBinder token) throws RemoteException
2123 {
2124 Parcel data = Parcel.obtain();
2125 Parcel reply = Parcel.obtain();
2126 data.writeInterfaceToken(IActivityManager.descriptor);
2127 data.writeStrongBinder(token);
2128 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2129 reply.readException();
2130 data.recycle();
2131 reply.recycle();
2132 }
2133 public void activityStopped(IBinder token, Bundle state,
2134 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002135 {
2136 Parcel data = Parcel.obtain();
2137 Parcel reply = Parcel.obtain();
2138 data.writeInterfaceToken(IActivityManager.descriptor);
2139 data.writeStrongBinder(token);
2140 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002141 if (thumbnail != null) {
2142 data.writeInt(1);
2143 thumbnail.writeToParcel(data, 0);
2144 } else {
2145 data.writeInt(0);
2146 }
2147 TextUtils.writeToParcel(description, data, 0);
2148 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2149 reply.readException();
2150 data.recycle();
2151 reply.recycle();
2152 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002153 public void activitySlept(IBinder token) throws RemoteException
2154 {
2155 Parcel data = Parcel.obtain();
2156 Parcel reply = Parcel.obtain();
2157 data.writeInterfaceToken(IActivityManager.descriptor);
2158 data.writeStrongBinder(token);
2159 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2160 reply.readException();
2161 data.recycle();
2162 reply.recycle();
2163 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002164 public void activityDestroyed(IBinder token) throws RemoteException
2165 {
2166 Parcel data = Parcel.obtain();
2167 Parcel reply = Parcel.obtain();
2168 data.writeInterfaceToken(IActivityManager.descriptor);
2169 data.writeStrongBinder(token);
2170 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2171 reply.readException();
2172 data.recycle();
2173 reply.recycle();
2174 }
2175 public String getCallingPackage(IBinder token) throws RemoteException
2176 {
2177 Parcel data = Parcel.obtain();
2178 Parcel reply = Parcel.obtain();
2179 data.writeInterfaceToken(IActivityManager.descriptor);
2180 data.writeStrongBinder(token);
2181 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2182 reply.readException();
2183 String res = reply.readString();
2184 data.recycle();
2185 reply.recycle();
2186 return res;
2187 }
2188 public ComponentName getCallingActivity(IBinder token)
2189 throws RemoteException {
2190 Parcel data = Parcel.obtain();
2191 Parcel reply = Parcel.obtain();
2192 data.writeInterfaceToken(IActivityManager.descriptor);
2193 data.writeStrongBinder(token);
2194 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2195 reply.readException();
2196 ComponentName res = ComponentName.readFromParcel(reply);
2197 data.recycle();
2198 reply.recycle();
2199 return res;
2200 }
2201 public List getTasks(int maxNum, int flags,
2202 IThumbnailReceiver receiver) throws RemoteException {
2203 Parcel data = Parcel.obtain();
2204 Parcel reply = Parcel.obtain();
2205 data.writeInterfaceToken(IActivityManager.descriptor);
2206 data.writeInt(maxNum);
2207 data.writeInt(flags);
2208 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2209 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2210 reply.readException();
2211 ArrayList list = null;
2212 int N = reply.readInt();
2213 if (N >= 0) {
2214 list = new ArrayList();
2215 while (N > 0) {
2216 ActivityManager.RunningTaskInfo info =
2217 ActivityManager.RunningTaskInfo.CREATOR
2218 .createFromParcel(reply);
2219 list.add(info);
2220 N--;
2221 }
2222 }
2223 data.recycle();
2224 reply.recycle();
2225 return list;
2226 }
2227 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002228 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002229 Parcel data = Parcel.obtain();
2230 Parcel reply = Parcel.obtain();
2231 data.writeInterfaceToken(IActivityManager.descriptor);
2232 data.writeInt(maxNum);
2233 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002234 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002235 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2236 reply.readException();
2237 ArrayList<ActivityManager.RecentTaskInfo> list
2238 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2239 data.recycle();
2240 reply.recycle();
2241 return list;
2242 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002243 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002244 Parcel data = Parcel.obtain();
2245 Parcel reply = Parcel.obtain();
2246 data.writeInterfaceToken(IActivityManager.descriptor);
2247 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002248 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002249 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002250 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002251 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002252 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002253 }
2254 data.recycle();
2255 reply.recycle();
2256 return bm;
2257 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002258 public List getServices(int maxNum, int flags) throws RemoteException {
2259 Parcel data = Parcel.obtain();
2260 Parcel reply = Parcel.obtain();
2261 data.writeInterfaceToken(IActivityManager.descriptor);
2262 data.writeInt(maxNum);
2263 data.writeInt(flags);
2264 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2265 reply.readException();
2266 ArrayList list = null;
2267 int N = reply.readInt();
2268 if (N >= 0) {
2269 list = new ArrayList();
2270 while (N > 0) {
2271 ActivityManager.RunningServiceInfo info =
2272 ActivityManager.RunningServiceInfo.CREATOR
2273 .createFromParcel(reply);
2274 list.add(info);
2275 N--;
2276 }
2277 }
2278 data.recycle();
2279 reply.recycle();
2280 return list;
2281 }
2282 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2283 throws RemoteException {
2284 Parcel data = Parcel.obtain();
2285 Parcel reply = Parcel.obtain();
2286 data.writeInterfaceToken(IActivityManager.descriptor);
2287 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2288 reply.readException();
2289 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2290 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2291 data.recycle();
2292 reply.recycle();
2293 return list;
2294 }
2295 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2296 throws RemoteException {
2297 Parcel data = Parcel.obtain();
2298 Parcel reply = Parcel.obtain();
2299 data.writeInterfaceToken(IActivityManager.descriptor);
2300 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2301 reply.readException();
2302 ArrayList<ActivityManager.RunningAppProcessInfo> list
2303 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2304 data.recycle();
2305 reply.recycle();
2306 return list;
2307 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002308 public List<ApplicationInfo> getRunningExternalApplications()
2309 throws RemoteException {
2310 Parcel data = Parcel.obtain();
2311 Parcel reply = Parcel.obtain();
2312 data.writeInterfaceToken(IActivityManager.descriptor);
2313 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2314 reply.readException();
2315 ArrayList<ApplicationInfo> list
2316 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2317 data.recycle();
2318 reply.recycle();
2319 return list;
2320 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002321 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002322 {
2323 Parcel data = Parcel.obtain();
2324 Parcel reply = Parcel.obtain();
2325 data.writeInterfaceToken(IActivityManager.descriptor);
2326 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002327 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002328 if (options != null) {
2329 data.writeInt(1);
2330 options.writeToParcel(data, 0);
2331 } else {
2332 data.writeInt(0);
2333 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002334 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2335 reply.readException();
2336 data.recycle();
2337 reply.recycle();
2338 }
2339 public void moveTaskToBack(int task) throws RemoteException
2340 {
2341 Parcel data = Parcel.obtain();
2342 Parcel reply = Parcel.obtain();
2343 data.writeInterfaceToken(IActivityManager.descriptor);
2344 data.writeInt(task);
2345 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2346 reply.readException();
2347 data.recycle();
2348 reply.recycle();
2349 }
2350 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2351 throws RemoteException {
2352 Parcel data = Parcel.obtain();
2353 Parcel reply = Parcel.obtain();
2354 data.writeInterfaceToken(IActivityManager.descriptor);
2355 data.writeStrongBinder(token);
2356 data.writeInt(nonRoot ? 1 : 0);
2357 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2358 reply.readException();
2359 boolean res = reply.readInt() != 0;
2360 data.recycle();
2361 reply.recycle();
2362 return res;
2363 }
2364 public void moveTaskBackwards(int task) throws RemoteException
2365 {
2366 Parcel data = Parcel.obtain();
2367 Parcel reply = Parcel.obtain();
2368 data.writeInterfaceToken(IActivityManager.descriptor);
2369 data.writeInt(task);
2370 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2371 reply.readException();
2372 data.recycle();
2373 reply.recycle();
2374 }
2375 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2376 {
2377 Parcel data = Parcel.obtain();
2378 Parcel reply = Parcel.obtain();
2379 data.writeInterfaceToken(IActivityManager.descriptor);
2380 data.writeStrongBinder(token);
2381 data.writeInt(onlyRoot ? 1 : 0);
2382 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2383 reply.readException();
2384 int res = reply.readInt();
2385 data.recycle();
2386 reply.recycle();
2387 return res;
2388 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002389 public void reportThumbnail(IBinder token,
2390 Bitmap thumbnail, CharSequence description) throws RemoteException
2391 {
2392 Parcel data = Parcel.obtain();
2393 Parcel reply = Parcel.obtain();
2394 data.writeInterfaceToken(IActivityManager.descriptor);
2395 data.writeStrongBinder(token);
2396 if (thumbnail != null) {
2397 data.writeInt(1);
2398 thumbnail.writeToParcel(data, 0);
2399 } else {
2400 data.writeInt(0);
2401 }
2402 TextUtils.writeToParcel(description, data, 0);
2403 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2404 reply.readException();
2405 data.recycle();
2406 reply.recycle();
2407 }
2408 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002409 String name, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002410 Parcel data = Parcel.obtain();
2411 Parcel reply = Parcel.obtain();
2412 data.writeInterfaceToken(IActivityManager.descriptor);
2413 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2414 data.writeString(name);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002415 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002416 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2417 reply.readException();
2418 int res = reply.readInt();
2419 ContentProviderHolder cph = null;
2420 if (res != 0) {
2421 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2422 }
2423 data.recycle();
2424 reply.recycle();
2425 return cph;
2426 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002427 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2428 throws RemoteException
2429 {
2430 Parcel data = Parcel.obtain();
2431 Parcel reply = Parcel.obtain();
2432 data.writeInterfaceToken(IActivityManager.descriptor);
2433 data.writeString(name);
2434 data.writeStrongBinder(token);
2435 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2436 reply.readException();
2437 int res = reply.readInt();
2438 ContentProviderHolder cph = null;
2439 if (res != 0) {
2440 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2441 }
2442 data.recycle();
2443 reply.recycle();
2444 return cph;
2445 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002446 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002447 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002448 {
2449 Parcel data = Parcel.obtain();
2450 Parcel reply = Parcel.obtain();
2451 data.writeInterfaceToken(IActivityManager.descriptor);
2452 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2453 data.writeTypedList(providers);
2454 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2455 reply.readException();
2456 data.recycle();
2457 reply.recycle();
2458 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002459 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2460 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002461 Parcel data = Parcel.obtain();
2462 Parcel reply = Parcel.obtain();
2463 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002464 data.writeStrongBinder(connection);
2465 data.writeInt(stable);
2466 data.writeInt(unstable);
2467 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2468 reply.readException();
2469 boolean res = reply.readInt() != 0;
2470 data.recycle();
2471 reply.recycle();
2472 return res;
2473 }
2474 public void unstableProviderDied(IBinder connection) throws RemoteException {
2475 Parcel data = Parcel.obtain();
2476 Parcel reply = Parcel.obtain();
2477 data.writeInterfaceToken(IActivityManager.descriptor);
2478 data.writeStrongBinder(connection);
2479 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2480 reply.readException();
2481 data.recycle();
2482 reply.recycle();
2483 }
2484
2485 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2486 Parcel data = Parcel.obtain();
2487 Parcel reply = Parcel.obtain();
2488 data.writeInterfaceToken(IActivityManager.descriptor);
2489 data.writeStrongBinder(connection);
2490 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002491 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2492 reply.readException();
2493 data.recycle();
2494 reply.recycle();
2495 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002496
2497 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2498 Parcel data = Parcel.obtain();
2499 Parcel reply = Parcel.obtain();
2500 data.writeInterfaceToken(IActivityManager.descriptor);
2501 data.writeString(name);
2502 data.writeStrongBinder(token);
2503 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2504 reply.readException();
2505 data.recycle();
2506 reply.recycle();
2507 }
2508
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002509 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2510 throws RemoteException
2511 {
2512 Parcel data = Parcel.obtain();
2513 Parcel reply = Parcel.obtain();
2514 data.writeInterfaceToken(IActivityManager.descriptor);
2515 service.writeToParcel(data, 0);
2516 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2517 reply.readException();
2518 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2519 data.recycle();
2520 reply.recycle();
2521 return res;
2522 }
2523
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002524 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002525 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002526 {
2527 Parcel data = Parcel.obtain();
2528 Parcel reply = Parcel.obtain();
2529 data.writeInterfaceToken(IActivityManager.descriptor);
2530 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2531 service.writeToParcel(data, 0);
2532 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002533 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002534 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2535 reply.readException();
2536 ComponentName res = ComponentName.readFromParcel(reply);
2537 data.recycle();
2538 reply.recycle();
2539 return res;
2540 }
2541 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002542 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002543 {
2544 Parcel data = Parcel.obtain();
2545 Parcel reply = Parcel.obtain();
2546 data.writeInterfaceToken(IActivityManager.descriptor);
2547 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2548 service.writeToParcel(data, 0);
2549 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002550 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002551 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2552 reply.readException();
2553 int res = reply.readInt();
2554 reply.recycle();
2555 data.recycle();
2556 return res;
2557 }
2558 public boolean stopServiceToken(ComponentName className, IBinder token,
2559 int startId) throws RemoteException {
2560 Parcel data = Parcel.obtain();
2561 Parcel reply = Parcel.obtain();
2562 data.writeInterfaceToken(IActivityManager.descriptor);
2563 ComponentName.writeToParcel(className, data);
2564 data.writeStrongBinder(token);
2565 data.writeInt(startId);
2566 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2567 reply.readException();
2568 boolean res = reply.readInt() != 0;
2569 data.recycle();
2570 reply.recycle();
2571 return res;
2572 }
2573 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002574 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002575 Parcel data = Parcel.obtain();
2576 Parcel reply = Parcel.obtain();
2577 data.writeInterfaceToken(IActivityManager.descriptor);
2578 ComponentName.writeToParcel(className, data);
2579 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002580 data.writeInt(id);
2581 if (notification != null) {
2582 data.writeInt(1);
2583 notification.writeToParcel(data, 0);
2584 } else {
2585 data.writeInt(0);
2586 }
2587 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002588 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2589 reply.readException();
2590 data.recycle();
2591 reply.recycle();
2592 }
2593 public int bindService(IApplicationThread caller, IBinder token,
2594 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002595 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2600 data.writeStrongBinder(token);
2601 service.writeToParcel(data, 0);
2602 data.writeString(resolvedType);
2603 data.writeStrongBinder(connection.asBinder());
2604 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002605 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002606 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2607 reply.readException();
2608 int res = reply.readInt();
2609 data.recycle();
2610 reply.recycle();
2611 return res;
2612 }
2613 public boolean unbindService(IServiceConnection connection) throws RemoteException
2614 {
2615 Parcel data = Parcel.obtain();
2616 Parcel reply = Parcel.obtain();
2617 data.writeInterfaceToken(IActivityManager.descriptor);
2618 data.writeStrongBinder(connection.asBinder());
2619 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2620 reply.readException();
2621 boolean res = reply.readInt() != 0;
2622 data.recycle();
2623 reply.recycle();
2624 return res;
2625 }
2626
2627 public void publishService(IBinder token,
2628 Intent intent, IBinder service) throws RemoteException {
2629 Parcel data = Parcel.obtain();
2630 Parcel reply = Parcel.obtain();
2631 data.writeInterfaceToken(IActivityManager.descriptor);
2632 data.writeStrongBinder(token);
2633 intent.writeToParcel(data, 0);
2634 data.writeStrongBinder(service);
2635 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2636 reply.readException();
2637 data.recycle();
2638 reply.recycle();
2639 }
2640
2641 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2642 throws RemoteException {
2643 Parcel data = Parcel.obtain();
2644 Parcel reply = Parcel.obtain();
2645 data.writeInterfaceToken(IActivityManager.descriptor);
2646 data.writeStrongBinder(token);
2647 intent.writeToParcel(data, 0);
2648 data.writeInt(doRebind ? 1 : 0);
2649 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2650 reply.readException();
2651 data.recycle();
2652 reply.recycle();
2653 }
2654
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002655 public void serviceDoneExecuting(IBinder token, int type, int startId,
2656 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002657 Parcel data = Parcel.obtain();
2658 Parcel reply = Parcel.obtain();
2659 data.writeInterfaceToken(IActivityManager.descriptor);
2660 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002661 data.writeInt(type);
2662 data.writeInt(startId);
2663 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002664 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2665 reply.readException();
2666 data.recycle();
2667 reply.recycle();
2668 }
2669
2670 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2671 Parcel data = Parcel.obtain();
2672 Parcel reply = Parcel.obtain();
2673 data.writeInterfaceToken(IActivityManager.descriptor);
2674 service.writeToParcel(data, 0);
2675 data.writeString(resolvedType);
2676 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2677 reply.readException();
2678 IBinder binder = reply.readStrongBinder();
2679 reply.recycle();
2680 data.recycle();
2681 return binder;
2682 }
2683
Christopher Tate181fafa2009-05-14 11:12:14 -07002684 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2685 throws RemoteException {
2686 Parcel data = Parcel.obtain();
2687 Parcel reply = Parcel.obtain();
2688 data.writeInterfaceToken(IActivityManager.descriptor);
2689 app.writeToParcel(data, 0);
2690 data.writeInt(backupRestoreMode);
2691 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2692 reply.readException();
2693 boolean success = reply.readInt() != 0;
2694 reply.recycle();
2695 data.recycle();
2696 return success;
2697 }
2698
2699 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2700 Parcel data = Parcel.obtain();
2701 Parcel reply = Parcel.obtain();
2702 data.writeInterfaceToken(IActivityManager.descriptor);
2703 data.writeString(packageName);
2704 data.writeStrongBinder(agent);
2705 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2706 reply.recycle();
2707 data.recycle();
2708 }
2709
2710 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2711 Parcel data = Parcel.obtain();
2712 Parcel reply = Parcel.obtain();
2713 data.writeInterfaceToken(IActivityManager.descriptor);
2714 app.writeToParcel(data, 0);
2715 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2716 reply.readException();
2717 reply.recycle();
2718 data.recycle();
2719 }
2720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002721 public boolean startInstrumentation(ComponentName className, String profileFile,
2722 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2723 throws RemoteException {
2724 Parcel data = Parcel.obtain();
2725 Parcel reply = Parcel.obtain();
2726 data.writeInterfaceToken(IActivityManager.descriptor);
2727 ComponentName.writeToParcel(className, data);
2728 data.writeString(profileFile);
2729 data.writeInt(flags);
2730 data.writeBundle(arguments);
2731 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2732 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2733 reply.readException();
2734 boolean res = reply.readInt() != 0;
2735 reply.recycle();
2736 data.recycle();
2737 return res;
2738 }
2739
2740 public void finishInstrumentation(IApplicationThread target,
2741 int resultCode, Bundle results) throws RemoteException {
2742 Parcel data = Parcel.obtain();
2743 Parcel reply = Parcel.obtain();
2744 data.writeInterfaceToken(IActivityManager.descriptor);
2745 data.writeStrongBinder(target != null ? target.asBinder() : null);
2746 data.writeInt(resultCode);
2747 data.writeBundle(results);
2748 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2749 reply.readException();
2750 data.recycle();
2751 reply.recycle();
2752 }
2753 public Configuration getConfiguration() throws RemoteException
2754 {
2755 Parcel data = Parcel.obtain();
2756 Parcel reply = Parcel.obtain();
2757 data.writeInterfaceToken(IActivityManager.descriptor);
2758 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2759 reply.readException();
2760 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2761 reply.recycle();
2762 data.recycle();
2763 return res;
2764 }
2765 public void updateConfiguration(Configuration values) throws RemoteException
2766 {
2767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 values.writeToParcel(data, 0);
2771 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2772 reply.readException();
2773 data.recycle();
2774 reply.recycle();
2775 }
2776 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2777 throws RemoteException {
2778 Parcel data = Parcel.obtain();
2779 Parcel reply = Parcel.obtain();
2780 data.writeInterfaceToken(IActivityManager.descriptor);
2781 data.writeStrongBinder(token);
2782 data.writeInt(requestedOrientation);
2783 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2784 reply.readException();
2785 data.recycle();
2786 reply.recycle();
2787 }
2788 public int getRequestedOrientation(IBinder token) throws RemoteException {
2789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
2791 data.writeInterfaceToken(IActivityManager.descriptor);
2792 data.writeStrongBinder(token);
2793 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2794 reply.readException();
2795 int res = reply.readInt();
2796 data.recycle();
2797 reply.recycle();
2798 return res;
2799 }
2800 public ComponentName getActivityClassForToken(IBinder token)
2801 throws RemoteException {
2802 Parcel data = Parcel.obtain();
2803 Parcel reply = Parcel.obtain();
2804 data.writeInterfaceToken(IActivityManager.descriptor);
2805 data.writeStrongBinder(token);
2806 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2807 reply.readException();
2808 ComponentName res = ComponentName.readFromParcel(reply);
2809 data.recycle();
2810 reply.recycle();
2811 return res;
2812 }
2813 public String getPackageForToken(IBinder token) throws RemoteException
2814 {
2815 Parcel data = Parcel.obtain();
2816 Parcel reply = Parcel.obtain();
2817 data.writeInterfaceToken(IActivityManager.descriptor);
2818 data.writeStrongBinder(token);
2819 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2820 reply.readException();
2821 String res = reply.readString();
2822 data.recycle();
2823 reply.recycle();
2824 return res;
2825 }
2826 public IIntentSender getIntentSender(int type,
2827 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002828 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002829 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002830 Parcel data = Parcel.obtain();
2831 Parcel reply = Parcel.obtain();
2832 data.writeInterfaceToken(IActivityManager.descriptor);
2833 data.writeInt(type);
2834 data.writeString(packageName);
2835 data.writeStrongBinder(token);
2836 data.writeString(resultWho);
2837 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002838 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002839 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002840 data.writeTypedArray(intents, 0);
2841 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002842 } else {
2843 data.writeInt(0);
2844 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002845 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002846 if (options != null) {
2847 data.writeInt(1);
2848 options.writeToParcel(data, 0);
2849 } else {
2850 data.writeInt(0);
2851 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002852 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002853 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2854 reply.readException();
2855 IIntentSender res = IIntentSender.Stub.asInterface(
2856 reply.readStrongBinder());
2857 data.recycle();
2858 reply.recycle();
2859 return res;
2860 }
2861 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2862 Parcel data = Parcel.obtain();
2863 Parcel reply = Parcel.obtain();
2864 data.writeInterfaceToken(IActivityManager.descriptor);
2865 data.writeStrongBinder(sender.asBinder());
2866 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2867 reply.readException();
2868 data.recycle();
2869 reply.recycle();
2870 }
2871 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeStrongBinder(sender.asBinder());
2876 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2877 reply.readException();
2878 String res = reply.readString();
2879 data.recycle();
2880 reply.recycle();
2881 return res;
2882 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002883 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2884 Parcel data = Parcel.obtain();
2885 Parcel reply = Parcel.obtain();
2886 data.writeInterfaceToken(IActivityManager.descriptor);
2887 data.writeStrongBinder(sender.asBinder());
2888 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2889 reply.readException();
2890 int res = reply.readInt();
2891 data.recycle();
2892 reply.recycle();
2893 return res;
2894 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002895 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
2896 boolean requireFull, String name, String callerPackage) throws RemoteException {
2897 Parcel data = Parcel.obtain();
2898 Parcel reply = Parcel.obtain();
2899 data.writeInterfaceToken(IActivityManager.descriptor);
2900 data.writeInt(callingPid);
2901 data.writeInt(callingUid);
2902 data.writeInt(userId);
2903 data.writeInt(allowAll ? 1 : 0);
2904 data.writeInt(requireFull ? 1 : 0);
2905 data.writeString(name);
2906 data.writeString(callerPackage);
2907 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
2908 reply.readException();
2909 int res = reply.readInt();
2910 data.recycle();
2911 reply.recycle();
2912 return res;
2913 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002914 public void setProcessLimit(int max) throws RemoteException
2915 {
2916 Parcel data = Parcel.obtain();
2917 Parcel reply = Parcel.obtain();
2918 data.writeInterfaceToken(IActivityManager.descriptor);
2919 data.writeInt(max);
2920 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2921 reply.readException();
2922 data.recycle();
2923 reply.recycle();
2924 }
2925 public int getProcessLimit() throws RemoteException
2926 {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2931 reply.readException();
2932 int res = reply.readInt();
2933 data.recycle();
2934 reply.recycle();
2935 return res;
2936 }
2937 public void setProcessForeground(IBinder token, int pid,
2938 boolean isForeground) throws RemoteException {
2939 Parcel data = Parcel.obtain();
2940 Parcel reply = Parcel.obtain();
2941 data.writeInterfaceToken(IActivityManager.descriptor);
2942 data.writeStrongBinder(token);
2943 data.writeInt(pid);
2944 data.writeInt(isForeground ? 1 : 0);
2945 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2946 reply.readException();
2947 data.recycle();
2948 reply.recycle();
2949 }
2950 public int checkPermission(String permission, int pid, int uid)
2951 throws RemoteException {
2952 Parcel data = Parcel.obtain();
2953 Parcel reply = Parcel.obtain();
2954 data.writeInterfaceToken(IActivityManager.descriptor);
2955 data.writeString(permission);
2956 data.writeInt(pid);
2957 data.writeInt(uid);
2958 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2959 reply.readException();
2960 int res = reply.readInt();
2961 data.recycle();
2962 reply.recycle();
2963 return res;
2964 }
2965 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002966 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002967 Parcel data = Parcel.obtain();
2968 Parcel reply = Parcel.obtain();
2969 data.writeInterfaceToken(IActivityManager.descriptor);
2970 data.writeString(packageName);
2971 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002972 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2974 reply.readException();
2975 boolean res = reply.readInt() != 0;
2976 data.recycle();
2977 reply.recycle();
2978 return res;
2979 }
2980 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2981 throws RemoteException {
2982 Parcel data = Parcel.obtain();
2983 Parcel reply = Parcel.obtain();
2984 data.writeInterfaceToken(IActivityManager.descriptor);
2985 uri.writeToParcel(data, 0);
2986 data.writeInt(pid);
2987 data.writeInt(uid);
2988 data.writeInt(mode);
2989 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 int res = reply.readInt();
2992 data.recycle();
2993 reply.recycle();
2994 return res;
2995 }
2996 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2997 Uri uri, int mode) throws RemoteException {
2998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 data.writeStrongBinder(caller.asBinder());
3002 data.writeString(targetPkg);
3003 uri.writeToParcel(data, 0);
3004 data.writeInt(mode);
3005 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3006 reply.readException();
3007 data.recycle();
3008 reply.recycle();
3009 }
3010 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3011 int mode) throws RemoteException {
3012 Parcel data = Parcel.obtain();
3013 Parcel reply = Parcel.obtain();
3014 data.writeInterfaceToken(IActivityManager.descriptor);
3015 data.writeStrongBinder(caller.asBinder());
3016 uri.writeToParcel(data, 0);
3017 data.writeInt(mode);
3018 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3019 reply.readException();
3020 data.recycle();
3021 reply.recycle();
3022 }
3023 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3024 throws RemoteException {
3025 Parcel data = Parcel.obtain();
3026 Parcel reply = Parcel.obtain();
3027 data.writeInterfaceToken(IActivityManager.descriptor);
3028 data.writeStrongBinder(who.asBinder());
3029 data.writeInt(waiting ? 1 : 0);
3030 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3031 reply.readException();
3032 data.recycle();
3033 reply.recycle();
3034 }
3035 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3036 Parcel data = Parcel.obtain();
3037 Parcel reply = Parcel.obtain();
3038 data.writeInterfaceToken(IActivityManager.descriptor);
3039 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3040 reply.readException();
3041 outInfo.readFromParcel(reply);
3042 data.recycle();
3043 reply.recycle();
3044 }
3045 public void unhandledBack() throws RemoteException
3046 {
3047 Parcel data = Parcel.obtain();
3048 Parcel reply = Parcel.obtain();
3049 data.writeInterfaceToken(IActivityManager.descriptor);
3050 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3051 reply.readException();
3052 data.recycle();
3053 reply.recycle();
3054 }
3055 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3056 {
3057 Parcel data = Parcel.obtain();
3058 Parcel reply = Parcel.obtain();
3059 data.writeInterfaceToken(IActivityManager.descriptor);
3060 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3061 reply.readException();
3062 ParcelFileDescriptor pfd = null;
3063 if (reply.readInt() != 0) {
3064 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3065 }
3066 data.recycle();
3067 reply.recycle();
3068 return pfd;
3069 }
3070 public void goingToSleep() throws RemoteException
3071 {
3072 Parcel data = Parcel.obtain();
3073 Parcel reply = Parcel.obtain();
3074 data.writeInterfaceToken(IActivityManager.descriptor);
3075 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3076 reply.readException();
3077 data.recycle();
3078 reply.recycle();
3079 }
3080 public void wakingUp() throws RemoteException
3081 {
3082 Parcel data = Parcel.obtain();
3083 Parcel reply = Parcel.obtain();
3084 data.writeInterfaceToken(IActivityManager.descriptor);
3085 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3086 reply.readException();
3087 data.recycle();
3088 reply.recycle();
3089 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003090 public void setLockScreenShown(boolean shown) throws RemoteException
3091 {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeInt(shown ? 1 : 0);
3096 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 data.recycle();
3099 reply.recycle();
3100 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003101 public void setDebugApp(
3102 String packageName, boolean waitForDebugger, boolean persistent)
3103 throws RemoteException
3104 {
3105 Parcel data = Parcel.obtain();
3106 Parcel reply = Parcel.obtain();
3107 data.writeInterfaceToken(IActivityManager.descriptor);
3108 data.writeString(packageName);
3109 data.writeInt(waitForDebugger ? 1 : 0);
3110 data.writeInt(persistent ? 1 : 0);
3111 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3112 reply.readException();
3113 data.recycle();
3114 reply.recycle();
3115 }
3116 public void setAlwaysFinish(boolean enabled) throws RemoteException
3117 {
3118 Parcel data = Parcel.obtain();
3119 Parcel reply = Parcel.obtain();
3120 data.writeInterfaceToken(IActivityManager.descriptor);
3121 data.writeInt(enabled ? 1 : 0);
3122 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3123 reply.readException();
3124 data.recycle();
3125 reply.recycle();
3126 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003127 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003133 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003134 reply.readException();
3135 data.recycle();
3136 reply.recycle();
3137 }
3138 public void enterSafeMode() throws RemoteException {
3139 Parcel data = Parcel.obtain();
3140 data.writeInterfaceToken(IActivityManager.descriptor);
3141 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3142 data.recycle();
3143 }
3144 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3145 Parcel data = Parcel.obtain();
3146 data.writeStrongBinder(sender.asBinder());
3147 data.writeInterfaceToken(IActivityManager.descriptor);
3148 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3149 data.recycle();
3150 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003151 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003152 Parcel data = Parcel.obtain();
3153 Parcel reply = Parcel.obtain();
3154 data.writeInterfaceToken(IActivityManager.descriptor);
3155 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003156 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003157 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003158 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003159 boolean res = reply.readInt() != 0;
3160 data.recycle();
3161 reply.recycle();
3162 return res;
3163 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003164 @Override
3165 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3166 Parcel data = Parcel.obtain();
3167 Parcel reply = Parcel.obtain();
3168 data.writeInterfaceToken(IActivityManager.descriptor);
3169 data.writeString(reason);
3170 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3171 boolean res = reply.readInt() != 0;
3172 data.recycle();
3173 reply.recycle();
3174 return res;
3175 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003176 public void startRunning(String pkg, String cls, String action,
3177 String indata) throws RemoteException {
3178 Parcel data = Parcel.obtain();
3179 Parcel reply = Parcel.obtain();
3180 data.writeInterfaceToken(IActivityManager.descriptor);
3181 data.writeString(pkg);
3182 data.writeString(cls);
3183 data.writeString(action);
3184 data.writeString(indata);
3185 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3186 reply.readException();
3187 data.recycle();
3188 reply.recycle();
3189 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003190 public boolean testIsSystemReady()
3191 {
3192 /* this base class version is never called */
3193 return true;
3194 }
Dan Egnor60d87622009-12-16 16:32:58 -08003195 public void handleApplicationCrash(IBinder app,
3196 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3197 {
3198 Parcel data = Parcel.obtain();
3199 Parcel reply = Parcel.obtain();
3200 data.writeInterfaceToken(IActivityManager.descriptor);
3201 data.writeStrongBinder(app);
3202 crashInfo.writeToParcel(data, 0);
3203 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3204 reply.readException();
3205 reply.recycle();
3206 data.recycle();
3207 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003208
Dan Egnor60d87622009-12-16 16:32:58 -08003209 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003210 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003211 {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003217 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003218 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003219 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003220 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003221 reply.recycle();
3222 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003223 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003224 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003225
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003226 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003227 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003228 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003229 {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003234 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003235 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003236 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 reply.recycle();
3239 data.recycle();
3240 }
3241
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003242 public void signalPersistentProcesses(int sig) throws RemoteException {
3243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 data.writeInt(sig);
3247 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3248 reply.readException();
3249 data.recycle();
3250 reply.recycle();
3251 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003252
Dianne Hackborn03abb812010-01-04 18:43:19 -08003253 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003254 Parcel data = Parcel.obtain();
3255 Parcel reply = Parcel.obtain();
3256 data.writeInterfaceToken(IActivityManager.descriptor);
3257 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003258 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3259 reply.readException();
3260 data.recycle();
3261 reply.recycle();
3262 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003263
3264 public void killAllBackgroundProcesses() throws RemoteException {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3269 reply.readException();
3270 data.recycle();
3271 reply.recycle();
3272 }
3273
Dianne Hackborn03abb812010-01-04 18:43:19 -08003274 public void forceStopPackage(String packageName) throws RemoteException {
3275 Parcel data = Parcel.obtain();
3276 Parcel reply = Parcel.obtain();
3277 data.writeInterfaceToken(IActivityManager.descriptor);
3278 data.writeString(packageName);
3279 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003280 reply.readException();
3281 data.recycle();
3282 reply.recycle();
3283 }
3284
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003285 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3286 throws RemoteException
3287 {
3288 Parcel data = Parcel.obtain();
3289 Parcel reply = Parcel.obtain();
3290 data.writeInterfaceToken(IActivityManager.descriptor);
3291 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3292 reply.readException();
3293 outInfo.readFromParcel(reply);
3294 reply.recycle();
3295 data.recycle();
3296 }
3297
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003298 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3299 {
3300 Parcel data = Parcel.obtain();
3301 Parcel reply = Parcel.obtain();
3302 data.writeInterfaceToken(IActivityManager.descriptor);
3303 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3304 reply.readException();
3305 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3306 reply.recycle();
3307 data.recycle();
3308 return res;
3309 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003310
3311 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003312 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003313 {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 data.writeString(process);
3318 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003319 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003320 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003321 if (fd != null) {
3322 data.writeInt(1);
3323 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3324 } else {
3325 data.writeInt(0);
3326 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003327 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3328 reply.readException();
3329 boolean res = reply.readInt() != 0;
3330 reply.recycle();
3331 data.recycle();
3332 return res;
3333 }
3334
Dianne Hackborn55280a92009-05-07 15:53:46 -07003335 public boolean shutdown(int timeout) throws RemoteException
3336 {
3337 Parcel data = Parcel.obtain();
3338 Parcel reply = Parcel.obtain();
3339 data.writeInterfaceToken(IActivityManager.descriptor);
3340 data.writeInt(timeout);
3341 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 boolean res = reply.readInt() != 0;
3344 reply.recycle();
3345 data.recycle();
3346 return res;
3347 }
3348
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003349 public void stopAppSwitches() throws RemoteException {
3350 Parcel data = Parcel.obtain();
3351 Parcel reply = Parcel.obtain();
3352 data.writeInterfaceToken(IActivityManager.descriptor);
3353 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3354 reply.readException();
3355 reply.recycle();
3356 data.recycle();
3357 }
3358
3359 public void resumeAppSwitches() throws RemoteException {
3360 Parcel data = Parcel.obtain();
3361 Parcel reply = Parcel.obtain();
3362 data.writeInterfaceToken(IActivityManager.descriptor);
3363 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 reply.recycle();
3366 data.recycle();
3367 }
3368
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003369 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
3372 data.writeInterfaceToken(IActivityManager.descriptor);
3373 data.writeString(pkg);
3374 data.writeInt(uid);
3375 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3376 reply.readException();
3377 data.recycle();
3378 reply.recycle();
3379 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003380
3381 public void closeSystemDialogs(String reason) throws RemoteException {
3382 Parcel data = Parcel.obtain();
3383 Parcel reply = Parcel.obtain();
3384 data.writeInterfaceToken(IActivityManager.descriptor);
3385 data.writeString(reason);
3386 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 data.recycle();
3389 reply.recycle();
3390 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003391
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003392 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003393 throws RemoteException {
3394 Parcel data = Parcel.obtain();
3395 Parcel reply = Parcel.obtain();
3396 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003397 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003398 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3399 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003400 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003401 data.recycle();
3402 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003403 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003404 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003405
3406 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3407 Parcel data = Parcel.obtain();
3408 Parcel reply = Parcel.obtain();
3409 data.writeInterfaceToken(IActivityManager.descriptor);
3410 data.writeString(processName);
3411 data.writeInt(uid);
3412 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3413 reply.readException();
3414 data.recycle();
3415 reply.recycle();
3416 }
3417
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003418 public void overridePendingTransition(IBinder token, String packageName,
3419 int enterAnim, int exitAnim) throws RemoteException {
3420 Parcel data = Parcel.obtain();
3421 Parcel reply = Parcel.obtain();
3422 data.writeInterfaceToken(IActivityManager.descriptor);
3423 data.writeStrongBinder(token);
3424 data.writeString(packageName);
3425 data.writeInt(enterAnim);
3426 data.writeInt(exitAnim);
3427 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 data.recycle();
3430 reply.recycle();
3431 }
3432
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003433 public boolean isUserAMonkey() throws RemoteException {
3434 Parcel data = Parcel.obtain();
3435 Parcel reply = Parcel.obtain();
3436 data.writeInterfaceToken(IActivityManager.descriptor);
3437 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3438 reply.readException();
3439 boolean res = reply.readInt() != 0;
3440 data.recycle();
3441 reply.recycle();
3442 return res;
3443 }
3444
Dianne Hackborn860755f2010-06-03 18:47:52 -07003445 public void finishHeavyWeightApp() throws RemoteException {
3446 Parcel data = Parcel.obtain();
3447 Parcel reply = Parcel.obtain();
3448 data.writeInterfaceToken(IActivityManager.descriptor);
3449 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3450 reply.readException();
3451 data.recycle();
3452 reply.recycle();
3453 }
3454
Daniel Sandler69a48172010-06-23 16:29:36 -04003455 public void setImmersive(IBinder token, boolean immersive)
3456 throws RemoteException {
3457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 data.writeStrongBinder(token);
3461 data.writeInt(immersive ? 1 : 0);
3462 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3463 reply.readException();
3464 data.recycle();
3465 reply.recycle();
3466 }
3467
3468 public boolean isImmersive(IBinder token)
3469 throws RemoteException {
3470 Parcel data = Parcel.obtain();
3471 Parcel reply = Parcel.obtain();
3472 data.writeInterfaceToken(IActivityManager.descriptor);
3473 data.writeStrongBinder(token);
3474 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003475 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003476 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003477 data.recycle();
3478 reply.recycle();
3479 return res;
3480 }
3481
3482 public boolean isTopActivityImmersive()
3483 throws RemoteException {
3484 Parcel data = Parcel.obtain();
3485 Parcel reply = Parcel.obtain();
3486 data.writeInterfaceToken(IActivityManager.descriptor);
3487 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003488 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003489 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003490 data.recycle();
3491 reply.recycle();
3492 return res;
3493 }
3494
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003495 public void crashApplication(int uid, int initialPid, String packageName,
3496 String message) throws RemoteException {
3497 Parcel data = Parcel.obtain();
3498 Parcel reply = Parcel.obtain();
3499 data.writeInterfaceToken(IActivityManager.descriptor);
3500 data.writeInt(uid);
3501 data.writeInt(initialPid);
3502 data.writeString(packageName);
3503 data.writeString(message);
3504 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3505 reply.readException();
3506 data.recycle();
3507 reply.recycle();
3508 }
Andy McFadden824c5102010-07-09 16:26:57 -07003509
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003510 public String getProviderMimeType(Uri uri)
3511 throws RemoteException {
3512 Parcel data = Parcel.obtain();
3513 Parcel reply = Parcel.obtain();
3514 data.writeInterfaceToken(IActivityManager.descriptor);
3515 uri.writeToParcel(data, 0);
3516 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3517 reply.readException();
3518 String res = reply.readString();
3519 data.recycle();
3520 reply.recycle();
3521 return res;
3522 }
3523
Dianne Hackborn7e269642010-08-25 19:50:20 -07003524 public IBinder newUriPermissionOwner(String name)
3525 throws RemoteException {
3526 Parcel data = Parcel.obtain();
3527 Parcel reply = Parcel.obtain();
3528 data.writeInterfaceToken(IActivityManager.descriptor);
3529 data.writeString(name);
3530 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3531 reply.readException();
3532 IBinder res = reply.readStrongBinder();
3533 data.recycle();
3534 reply.recycle();
3535 return res;
3536 }
3537
3538 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3539 Uri uri, int mode) throws RemoteException {
3540 Parcel data = Parcel.obtain();
3541 Parcel reply = Parcel.obtain();
3542 data.writeInterfaceToken(IActivityManager.descriptor);
3543 data.writeStrongBinder(owner);
3544 data.writeInt(fromUid);
3545 data.writeString(targetPkg);
3546 uri.writeToParcel(data, 0);
3547 data.writeInt(mode);
3548 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3549 reply.readException();
3550 data.recycle();
3551 reply.recycle();
3552 }
3553
3554 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3555 int mode) throws RemoteException {
3556 Parcel data = Parcel.obtain();
3557 Parcel reply = Parcel.obtain();
3558 data.writeInterfaceToken(IActivityManager.descriptor);
3559 data.writeStrongBinder(owner);
3560 if (uri != null) {
3561 data.writeInt(1);
3562 uri.writeToParcel(data, 0);
3563 } else {
3564 data.writeInt(0);
3565 }
3566 data.writeInt(mode);
3567 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 data.recycle();
3570 reply.recycle();
3571 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003572
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003573 public int checkGrantUriPermission(int callingUid, String targetPkg,
3574 Uri uri, int modeFlags) throws RemoteException {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
3578 data.writeInt(callingUid);
3579 data.writeString(targetPkg);
3580 uri.writeToParcel(data, 0);
3581 data.writeInt(modeFlags);
3582 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3583 reply.readException();
3584 int res = reply.readInt();
3585 data.recycle();
3586 reply.recycle();
3587 return res;
3588 }
3589
Andy McFadden824c5102010-07-09 16:26:57 -07003590 public boolean dumpHeap(String process, boolean managed,
3591 String path, ParcelFileDescriptor fd) throws RemoteException {
3592 Parcel data = Parcel.obtain();
3593 Parcel reply = Parcel.obtain();
3594 data.writeInterfaceToken(IActivityManager.descriptor);
3595 data.writeString(process);
3596 data.writeInt(managed ? 1 : 0);
3597 data.writeString(path);
3598 if (fd != null) {
3599 data.writeInt(1);
3600 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3601 } else {
3602 data.writeInt(0);
3603 }
3604 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3605 reply.readException();
3606 boolean res = reply.readInt() != 0;
3607 reply.recycle();
3608 data.recycle();
3609 return res;
3610 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003611
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003612 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003613 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3614 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003615 Parcel data = Parcel.obtain();
3616 Parcel reply = Parcel.obtain();
3617 data.writeInterfaceToken(IActivityManager.descriptor);
3618 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3619 data.writeTypedArray(intents, 0);
3620 data.writeStringArray(resolvedTypes);
3621 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003622 if (options != null) {
3623 data.writeInt(1);
3624 options.writeToParcel(data, 0);
3625 } else {
3626 data.writeInt(0);
3627 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003628 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3629 reply.readException();
3630 int result = reply.readInt();
3631 reply.recycle();
3632 data.recycle();
3633 return result;
3634 }
3635
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003636 public int getFrontActivityScreenCompatMode() throws RemoteException {
3637 Parcel data = Parcel.obtain();
3638 Parcel reply = Parcel.obtain();
3639 data.writeInterfaceToken(IActivityManager.descriptor);
3640 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3641 reply.readException();
3642 int mode = reply.readInt();
3643 reply.recycle();
3644 data.recycle();
3645 return mode;
3646 }
3647
3648 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3649 Parcel data = Parcel.obtain();
3650 Parcel reply = Parcel.obtain();
3651 data.writeInterfaceToken(IActivityManager.descriptor);
3652 data.writeInt(mode);
3653 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3654 reply.readException();
3655 reply.recycle();
3656 data.recycle();
3657 }
3658
3659 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3660 Parcel data = Parcel.obtain();
3661 Parcel reply = Parcel.obtain();
3662 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003663 data.writeString(packageName);
3664 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003665 reply.readException();
3666 int mode = reply.readInt();
3667 reply.recycle();
3668 data.recycle();
3669 return mode;
3670 }
3671
3672 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003673 throws RemoteException {
3674 Parcel data = Parcel.obtain();
3675 Parcel reply = Parcel.obtain();
3676 data.writeInterfaceToken(IActivityManager.descriptor);
3677 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003678 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003679 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3680 reply.readException();
3681 reply.recycle();
3682 data.recycle();
3683 }
3684
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003685 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3686 Parcel data = Parcel.obtain();
3687 Parcel reply = Parcel.obtain();
3688 data.writeInterfaceToken(IActivityManager.descriptor);
3689 data.writeString(packageName);
3690 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3691 reply.readException();
3692 boolean ask = reply.readInt() != 0;
3693 reply.recycle();
3694 data.recycle();
3695 return ask;
3696 }
3697
3698 public void setPackageAskScreenCompat(String packageName, boolean ask)
3699 throws RemoteException {
3700 Parcel data = Parcel.obtain();
3701 Parcel reply = Parcel.obtain();
3702 data.writeInterfaceToken(IActivityManager.descriptor);
3703 data.writeString(packageName);
3704 data.writeInt(ask ? 1 : 0);
3705 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3706 reply.readException();
3707 reply.recycle();
3708 data.recycle();
3709 }
3710
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003711 public boolean switchUser(int userid) throws RemoteException {
3712 Parcel data = Parcel.obtain();
3713 Parcel reply = Parcel.obtain();
3714 data.writeInterfaceToken(IActivityManager.descriptor);
3715 data.writeInt(userid);
3716 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3717 reply.readException();
3718 boolean result = reply.readInt() != 0;
3719 reply.recycle();
3720 data.recycle();
3721 return result;
3722 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003723
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003724 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3725 Parcel data = Parcel.obtain();
3726 Parcel reply = Parcel.obtain();
3727 data.writeInterfaceToken(IActivityManager.descriptor);
3728 data.writeInt(userid);
3729 data.writeStrongInterface(callback);
3730 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3731 reply.readException();
3732 int result = reply.readInt();
3733 reply.recycle();
3734 data.recycle();
3735 return result;
3736 }
3737
Amith Yamasani52f1d752012-03-28 18:19:29 -07003738 public UserInfo getCurrentUser() throws RemoteException {
3739 Parcel data = Parcel.obtain();
3740 Parcel reply = Parcel.obtain();
3741 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003742 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003743 reply.readException();
3744 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3745 reply.recycle();
3746 data.recycle();
3747 return userInfo;
3748 }
3749
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003750 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeInt(taskId);
3755 data.writeInt(subTaskIndex);
3756 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3757 reply.readException();
3758 boolean result = reply.readInt() != 0;
3759 reply.recycle();
3760 data.recycle();
3761 return result;
3762 }
3763
3764 public boolean removeTask(int taskId, int flags) throws RemoteException {
3765 Parcel data = Parcel.obtain();
3766 Parcel reply = Parcel.obtain();
3767 data.writeInterfaceToken(IActivityManager.descriptor);
3768 data.writeInt(taskId);
3769 data.writeInt(flags);
3770 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3771 reply.readException();
3772 boolean result = reply.readInt() != 0;
3773 reply.recycle();
3774 data.recycle();
3775 return result;
3776 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003777
Jeff Sharkeya4620792011-05-20 15:29:23 -07003778 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3779 Parcel data = Parcel.obtain();
3780 Parcel reply = Parcel.obtain();
3781 data.writeInterfaceToken(IActivityManager.descriptor);
3782 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3783 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 data.recycle();
3786 reply.recycle();
3787 }
3788
3789 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3790 Parcel data = Parcel.obtain();
3791 Parcel reply = Parcel.obtain();
3792 data.writeInterfaceToken(IActivityManager.descriptor);
3793 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3794 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3795 reply.readException();
3796 data.recycle();
3797 reply.recycle();
3798 }
3799
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003800 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3801 Parcel data = Parcel.obtain();
3802 Parcel reply = Parcel.obtain();
3803 data.writeInterfaceToken(IActivityManager.descriptor);
3804 data.writeStrongBinder(sender.asBinder());
3805 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3806 reply.readException();
3807 boolean res = reply.readInt() != 0;
3808 data.recycle();
3809 reply.recycle();
3810 return res;
3811 }
3812
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003813 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3814 Parcel data = Parcel.obtain();
3815 Parcel reply = Parcel.obtain();
3816 data.writeInterfaceToken(IActivityManager.descriptor);
3817 data.writeStrongBinder(sender.asBinder());
3818 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3819 reply.readException();
3820 boolean res = reply.readInt() != 0;
3821 data.recycle();
3822 reply.recycle();
3823 return res;
3824 }
3825
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003826 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3827 {
3828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
3831 values.writeToParcel(data, 0);
3832 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3833 reply.readException();
3834 data.recycle();
3835 reply.recycle();
3836 }
3837
Dianne Hackbornb437e092011-08-05 17:50:29 -07003838 public long[] getProcessPss(int[] pids) throws RemoteException {
3839 Parcel data = Parcel.obtain();
3840 Parcel reply = Parcel.obtain();
3841 data.writeInterfaceToken(IActivityManager.descriptor);
3842 data.writeIntArray(pids);
3843 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3844 reply.readException();
3845 long[] res = reply.createLongArray();
3846 data.recycle();
3847 reply.recycle();
3848 return res;
3849 }
3850
Dianne Hackborn661cd522011-08-22 00:26:20 -07003851 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3852 Parcel data = Parcel.obtain();
3853 Parcel reply = Parcel.obtain();
3854 data.writeInterfaceToken(IActivityManager.descriptor);
3855 TextUtils.writeToParcel(msg, data, 0);
3856 data.writeInt(always ? 1 : 0);
3857 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3858 reply.readException();
3859 data.recycle();
3860 reply.recycle();
3861 }
3862
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003863 public void dismissKeyguardOnNextActivity() throws RemoteException {
3864 Parcel data = Parcel.obtain();
3865 Parcel reply = Parcel.obtain();
3866 data.writeInterfaceToken(IActivityManager.descriptor);
3867 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3868 reply.readException();
3869 data.recycle();
3870 reply.recycle();
3871 }
3872
Adam Powelldd8fab22012-03-22 17:47:27 -07003873 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3874 throws RemoteException {
3875 Parcel data = Parcel.obtain();
3876 Parcel reply = Parcel.obtain();
3877 data.writeInterfaceToken(IActivityManager.descriptor);
3878 data.writeStrongBinder(token);
3879 data.writeString(destAffinity);
3880 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3881 reply.readException();
3882 boolean result = reply.readInt() != 0;
3883 data.recycle();
3884 reply.recycle();
3885 return result;
3886 }
3887
3888 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3889 throws RemoteException {
3890 Parcel data = Parcel.obtain();
3891 Parcel reply = Parcel.obtain();
3892 data.writeInterfaceToken(IActivityManager.descriptor);
3893 data.writeStrongBinder(token);
3894 target.writeToParcel(data, 0);
3895 data.writeInt(resultCode);
3896 if (resultData != null) {
3897 data.writeInt(1);
3898 resultData.writeToParcel(data, 0);
3899 } else {
3900 data.writeInt(0);
3901 }
3902 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3903 reply.readException();
3904 boolean result = reply.readInt() != 0;
3905 data.recycle();
3906 reply.recycle();
3907 return result;
3908 }
3909
Dianne Hackborn5320eb82012-05-18 12:05:04 -07003910 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
3911 Parcel data = Parcel.obtain();
3912 Parcel reply = Parcel.obtain();
3913 data.writeInterfaceToken(IActivityManager.descriptor);
3914 data.writeStrongBinder(activityToken);
3915 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
3916 reply.readException();
3917 int result = reply.readInt();
3918 data.recycle();
3919 reply.recycle();
3920 return result;
3921 }
3922
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003923 private IBinder mRemote;
3924}