blob: c9930e96618f746003d88307238be31f8578ff47 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070020import android.content.IIntentReceiver;
21import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Intent;
23import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070028import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.res.Configuration;
30import android.graphics.Bitmap;
31import android.net.Uri;
32import android.os.Binder;
33import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070034import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.os.IBinder;
36import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070037import android.os.ParcelFileDescriptor;
38import android.os.Parcelable;
39import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070041import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080044import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import java.util.ArrayList;
47import java.util.List;
48
49/** {@hide} */
50public abstract class ActivityManagerNative extends Binder implements IActivityManager
51{
52 /**
53 * Cast a Binder object into an activity manager interface, generating
54 * a proxy if needed.
55 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080056 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 if (obj == null) {
58 return null;
59 }
60 IActivityManager in =
61 (IActivityManager)obj.queryLocalInterface(descriptor);
62 if (in != null) {
63 return in;
64 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 return new ActivityManagerProxy(obj);
67 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 /**
70 * Retrieve the system's default/global activity manager.
71 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072 static public IActivityManager getDefault() {
73 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 }
75
76 /**
77 * Convenience for checking whether the system is ready. For internal use only.
78 */
79 static public boolean isSystemReady() {
80 if (!sSystemReady) {
81 sSystemReady = getDefault().testIsSystemReady();
82 }
83 return sSystemReady;
84 }
85 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 /**
88 * Convenience for sending a sticky broadcast. For internal use only.
89 * If you don't care about permission, use null.
90 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070091 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 try {
93 getDefault().broadcastIntent(
94 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070095 null /*permission*/, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 } catch (RemoteException ex) {
97 }
98 }
99
100 static public void noteWakeupAlarm(PendingIntent ps) {
101 try {
102 getDefault().noteWakeupAlarm(ps.getTarget());
103 } catch (RemoteException ex) {
104 }
105 }
106
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800107 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 attachInterface(this, descriptor);
109 }
110
111 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
112 throws RemoteException {
113 switch (code) {
114 case START_ACTIVITY_TRANSACTION:
115 {
116 data.enforceInterface(IActivityManager.descriptor);
117 IBinder b = data.readStrongBinder();
118 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800119 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 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;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800131 int result = startActivity(app, callingPackage, 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);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800144 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700145 Intent intent = Intent.CREATOR.createFromParcel(data);
146 String resolvedType = data.readString();
147 IBinder resultTo = data.readStrongBinder();
148 String resultWho = data.readString();
149 int requestCode = data.readInt();
150 int startFlags = data.readInt();
151 String profileFile = data.readString();
152 ParcelFileDescriptor profileFd = data.readInt() != 0
153 ? data.readFileDescriptor() : null;
154 Bundle options = data.readInt() != 0
155 ? Bundle.CREATOR.createFromParcel(data) : null;
156 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800157 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700158 resultTo, resultWho, requestCode, startFlags,
159 profileFile, profileFd, options, userId);
160 reply.writeNoException();
161 reply.writeInt(result);
162 return true;
163 }
164
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800165 case START_ACTIVITY_AND_WAIT_TRANSACTION:
166 {
167 data.enforceInterface(IActivityManager.descriptor);
168 IBinder b = data.readStrongBinder();
169 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800170 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800171 Intent intent = Intent.CREATOR.createFromParcel(data);
172 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800174 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800175 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700176 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700177 String profileFile = data.readString();
178 ParcelFileDescriptor profileFd = data.readInt() != 0
179 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700180 Bundle options = data.readInt() != 0
181 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700182 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800183 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700185 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800186 reply.writeNoException();
187 result.writeToParcel(reply, 0);
188 return true;
189 }
190
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700191 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
192 {
193 data.enforceInterface(IActivityManager.descriptor);
194 IBinder b = data.readStrongBinder();
195 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800196 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700197 Intent intent = Intent.CREATOR.createFromParcel(data);
198 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 IBinder resultTo = data.readStrongBinder();
200 String resultWho = data.readString();
201 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700202 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700204 Bundle options = data.readInt() != 0
205 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700206 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800207 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700208 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700209 reply.writeNoException();
210 reply.writeInt(result);
211 return true;
212 }
213
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700214 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700215 {
216 data.enforceInterface(IActivityManager.descriptor);
217 IBinder b = data.readStrongBinder();
218 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700219 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700220 Intent fillInIntent = null;
221 if (data.readInt() != 0) {
222 fillInIntent = Intent.CREATOR.createFromParcel(data);
223 }
224 String resolvedType = data.readString();
225 IBinder resultTo = data.readStrongBinder();
226 String resultWho = data.readString();
227 int requestCode = data.readInt();
228 int flagsMask = data.readInt();
229 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 Bundle options = data.readInt() != 0
231 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700232 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700233 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 reply.writeNoException();
236 reply.writeInt(result);
237 return true;
238 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239
240 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
241 {
242 data.enforceInterface(IActivityManager.descriptor);
243 IBinder callingActivity = data.readStrongBinder();
244 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700245 Bundle options = data.readInt() != 0
246 ? Bundle.CREATOR.createFromParcel(data) : null;
247 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 reply.writeNoException();
249 reply.writeInt(result ? 1 : 0);
250 return true;
251 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 case FINISH_ACTIVITY_TRANSACTION: {
254 data.enforceInterface(IActivityManager.descriptor);
255 IBinder token = data.readStrongBinder();
256 Intent resultData = null;
257 int resultCode = data.readInt();
258 if (data.readInt() != 0) {
259 resultData = Intent.CREATOR.createFromParcel(data);
260 }
261 boolean res = finishActivity(token, resultCode, resultData);
262 reply.writeNoException();
263 reply.writeInt(res ? 1 : 0);
264 return true;
265 }
266
267 case FINISH_SUB_ACTIVITY_TRANSACTION: {
268 data.enforceInterface(IActivityManager.descriptor);
269 IBinder token = data.readStrongBinder();
270 String resultWho = data.readString();
271 int requestCode = data.readInt();
272 finishSubActivity(token, resultWho, requestCode);
273 reply.writeNoException();
274 return true;
275 }
276
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700277 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
278 data.enforceInterface(IActivityManager.descriptor);
279 IBinder token = data.readStrongBinder();
280 boolean res = finishActivityAffinity(token);
281 reply.writeNoException();
282 reply.writeInt(res ? 1 : 0);
283 return true;
284 }
285
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800286 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
287 data.enforceInterface(IActivityManager.descriptor);
288 IBinder token = data.readStrongBinder();
289 boolean res = willActivityBeVisible(token);
290 reply.writeNoException();
291 reply.writeInt(res ? 1 : 0);
292 return true;
293 }
294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 case REGISTER_RECEIVER_TRANSACTION:
296 {
297 data.enforceInterface(IActivityManager.descriptor);
298 IBinder b = data.readStrongBinder();
299 IApplicationThread app =
300 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700301 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800302 b = data.readStrongBinder();
303 IIntentReceiver rec
304 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
305 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
306 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700307 int userId = data.readInt();
308 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800309 reply.writeNoException();
310 if (intent != null) {
311 reply.writeInt(1);
312 intent.writeToParcel(reply, 0);
313 } else {
314 reply.writeInt(0);
315 }
316 return true;
317 }
318
319 case UNREGISTER_RECEIVER_TRANSACTION:
320 {
321 data.enforceInterface(IActivityManager.descriptor);
322 IBinder b = data.readStrongBinder();
323 if (b == null) {
324 return true;
325 }
326 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
327 unregisterReceiver(rec);
328 reply.writeNoException();
329 return true;
330 }
331
332 case BROADCAST_INTENT_TRANSACTION:
333 {
334 data.enforceInterface(IActivityManager.descriptor);
335 IBinder b = data.readStrongBinder();
336 IApplicationThread app =
337 b != null ? ApplicationThreadNative.asInterface(b) : null;
338 Intent intent = Intent.CREATOR.createFromParcel(data);
339 String resolvedType = data.readString();
340 b = data.readStrongBinder();
341 IIntentReceiver resultTo =
342 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
343 int resultCode = data.readInt();
344 String resultData = data.readString();
345 Bundle resultExtras = data.readBundle();
346 String perm = data.readString();
347 boolean serialized = data.readInt() != 0;
348 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700349 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 int res = broadcastIntent(app, intent, resolvedType, resultTo,
351 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700352 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 reply.writeNoException();
354 reply.writeInt(res);
355 return true;
356 }
357
358 case UNBROADCAST_INTENT_TRANSACTION:
359 {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder b = data.readStrongBinder();
362 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
363 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700364 int userId = data.readInt();
365 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366 reply.writeNoException();
367 return true;
368 }
369
370 case FINISH_RECEIVER_TRANSACTION: {
371 data.enforceInterface(IActivityManager.descriptor);
372 IBinder who = data.readStrongBinder();
373 int resultCode = data.readInt();
374 String resultData = data.readString();
375 Bundle resultExtras = data.readBundle();
376 boolean resultAbort = data.readInt() != 0;
377 if (who != null) {
378 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
379 }
380 reply.writeNoException();
381 return true;
382 }
383
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 case ATTACH_APPLICATION_TRANSACTION: {
385 data.enforceInterface(IActivityManager.descriptor);
386 IApplicationThread app = ApplicationThreadNative.asInterface(
387 data.readStrongBinder());
388 if (app != null) {
389 attachApplication(app);
390 }
391 reply.writeNoException();
392 return true;
393 }
394
395 case ACTIVITY_IDLE_TRANSACTION: {
396 data.enforceInterface(IActivityManager.descriptor);
397 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700398 Configuration config = null;
399 if (data.readInt() != 0) {
400 config = Configuration.CREATOR.createFromParcel(data);
401 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700402 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700404 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800405 }
406 reply.writeNoException();
407 return true;
408 }
409
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700410 case ACTIVITY_RESUMED_TRANSACTION: {
411 data.enforceInterface(IActivityManager.descriptor);
412 IBinder token = data.readStrongBinder();
413 activityResumed(token);
414 reply.writeNoException();
415 return true;
416 }
417
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 case ACTIVITY_PAUSED_TRANSACTION: {
419 data.enforceInterface(IActivityManager.descriptor);
420 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800421 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800422 reply.writeNoException();
423 return true;
424 }
425
426 case ACTIVITY_STOPPED_TRANSACTION: {
427 data.enforceInterface(IActivityManager.descriptor);
428 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800429 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430 Bitmap thumbnail = data.readInt() != 0
431 ? Bitmap.CREATOR.createFromParcel(data) : null;
432 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800433 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 reply.writeNoException();
435 return true;
436 }
437
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800438 case ACTIVITY_SLEPT_TRANSACTION: {
439 data.enforceInterface(IActivityManager.descriptor);
440 IBinder token = data.readStrongBinder();
441 activitySlept(token);
442 reply.writeNoException();
443 return true;
444 }
445
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800446 case ACTIVITY_DESTROYED_TRANSACTION: {
447 data.enforceInterface(IActivityManager.descriptor);
448 IBinder token = data.readStrongBinder();
449 activityDestroyed(token);
450 reply.writeNoException();
451 return true;
452 }
453
454 case GET_CALLING_PACKAGE_TRANSACTION: {
455 data.enforceInterface(IActivityManager.descriptor);
456 IBinder token = data.readStrongBinder();
457 String res = token != null ? getCallingPackage(token) : null;
458 reply.writeNoException();
459 reply.writeString(res);
460 return true;
461 }
462
463 case GET_CALLING_ACTIVITY_TRANSACTION: {
464 data.enforceInterface(IActivityManager.descriptor);
465 IBinder token = data.readStrongBinder();
466 ComponentName cn = getCallingActivity(token);
467 reply.writeNoException();
468 ComponentName.writeToParcel(cn, reply);
469 return true;
470 }
471
472 case GET_TASKS_TRANSACTION: {
473 data.enforceInterface(IActivityManager.descriptor);
474 int maxNum = data.readInt();
475 int fl = data.readInt();
476 IBinder receiverBinder = data.readStrongBinder();
477 IThumbnailReceiver receiver = receiverBinder != null
478 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
479 : null;
480 List list = getTasks(maxNum, fl, receiver);
481 reply.writeNoException();
482 int N = list != null ? list.size() : -1;
483 reply.writeInt(N);
484 int i;
485 for (i=0; i<N; i++) {
486 ActivityManager.RunningTaskInfo info =
487 (ActivityManager.RunningTaskInfo)list.get(i);
488 info.writeToParcel(reply, 0);
489 }
490 return true;
491 }
492
493 case GET_RECENT_TASKS_TRANSACTION: {
494 data.enforceInterface(IActivityManager.descriptor);
495 int maxNum = data.readInt();
496 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700497 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700499 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 reply.writeNoException();
501 reply.writeTypedList(list);
502 return true;
503 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700504
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700505 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800506 data.enforceInterface(IActivityManager.descriptor);
507 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700508 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800509 reply.writeNoException();
510 if (bm != null) {
511 reply.writeInt(1);
512 bm.writeToParcel(reply, 0);
513 } else {
514 reply.writeInt(0);
515 }
516 return true;
517 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700518
519 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
520 data.enforceInterface(IActivityManager.descriptor);
521 int id = data.readInt();
522 Bitmap bm = getTaskTopThumbnail(id);
523 reply.writeNoException();
524 if (bm != null) {
525 reply.writeInt(1);
526 bm.writeToParcel(reply, 0);
527 } else {
528 reply.writeInt(0);
529 }
530 return true;
531 }
532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800533 case GET_SERVICES_TRANSACTION: {
534 data.enforceInterface(IActivityManager.descriptor);
535 int maxNum = data.readInt();
536 int fl = data.readInt();
537 List list = getServices(maxNum, fl);
538 reply.writeNoException();
539 int N = list != null ? list.size() : -1;
540 reply.writeInt(N);
541 int i;
542 for (i=0; i<N; i++) {
543 ActivityManager.RunningServiceInfo info =
544 (ActivityManager.RunningServiceInfo)list.get(i);
545 info.writeToParcel(reply, 0);
546 }
547 return true;
548 }
549
550 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
551 data.enforceInterface(IActivityManager.descriptor);
552 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
553 reply.writeNoException();
554 reply.writeTypedList(list);
555 return true;
556 }
557
558 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
561 reply.writeNoException();
562 reply.writeTypedList(list);
563 return true;
564 }
565
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700566 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 List<ApplicationInfo> list = getRunningExternalApplications();
569 reply.writeNoException();
570 reply.writeTypedList(list);
571 return true;
572 }
573
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800574 case MOVE_TASK_TO_FRONT_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800577 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700578 Bundle options = data.readInt() != 0
579 ? Bundle.CREATOR.createFromParcel(data) : null;
580 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 reply.writeNoException();
582 return true;
583 }
584
585 case MOVE_TASK_TO_BACK_TRANSACTION: {
586 data.enforceInterface(IActivityManager.descriptor);
587 int task = data.readInt();
588 moveTaskToBack(task);
589 reply.writeNoException();
590 return true;
591 }
592
593 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
594 data.enforceInterface(IActivityManager.descriptor);
595 IBinder token = data.readStrongBinder();
596 boolean nonRoot = data.readInt() != 0;
597 boolean res = moveActivityTaskToBack(token, nonRoot);
598 reply.writeNoException();
599 reply.writeInt(res ? 1 : 0);
600 return true;
601 }
602
603 case MOVE_TASK_BACKWARDS_TRANSACTION: {
604 data.enforceInterface(IActivityManager.descriptor);
605 int task = data.readInt();
606 moveTaskBackwards(task);
607 reply.writeNoException();
608 return true;
609 }
610
611 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
612 data.enforceInterface(IActivityManager.descriptor);
613 IBinder token = data.readStrongBinder();
614 boolean onlyRoot = data.readInt() != 0;
615 int res = token != null
616 ? getTaskForActivity(token, onlyRoot) : -1;
617 reply.writeNoException();
618 reply.writeInt(res);
619 return true;
620 }
621
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 case REPORT_THUMBNAIL_TRANSACTION: {
623 data.enforceInterface(IActivityManager.descriptor);
624 IBinder token = data.readStrongBinder();
625 Bitmap thumbnail = data.readInt() != 0
626 ? Bitmap.CREATOR.createFromParcel(data) : null;
627 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
628 reportThumbnail(token, thumbnail, description);
629 reply.writeNoException();
630 return true;
631 }
632
633 case GET_CONTENT_PROVIDER_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 IBinder b = data.readStrongBinder();
636 IApplicationThread app = ApplicationThreadNative.asInterface(b);
637 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700638 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700639 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700640 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 reply.writeNoException();
642 if (cph != null) {
643 reply.writeInt(1);
644 cph.writeToParcel(reply, 0);
645 } else {
646 reply.writeInt(0);
647 }
648 return true;
649 }
650
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800651 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700654 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800655 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700656 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800657 reply.writeNoException();
658 if (cph != null) {
659 reply.writeInt(1);
660 cph.writeToParcel(reply, 0);
661 } else {
662 reply.writeInt(0);
663 }
664 return true;
665 }
666
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
668 data.enforceInterface(IActivityManager.descriptor);
669 IBinder b = data.readStrongBinder();
670 IApplicationThread app = ApplicationThreadNative.asInterface(b);
671 ArrayList<ContentProviderHolder> providers =
672 data.createTypedArrayList(ContentProviderHolder.CREATOR);
673 publishContentProviders(app, providers);
674 reply.writeNoException();
675 return true;
676 }
677
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700678 case REF_CONTENT_PROVIDER_TRANSACTION: {
679 data.enforceInterface(IActivityManager.descriptor);
680 IBinder b = data.readStrongBinder();
681 int stable = data.readInt();
682 int unstable = data.readInt();
683 boolean res = refContentProvider(b, stable, unstable);
684 reply.writeNoException();
685 reply.writeInt(res ? 1 : 0);
686 return true;
687 }
688
689 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
690 data.enforceInterface(IActivityManager.descriptor);
691 IBinder b = data.readStrongBinder();
692 unstableProviderDied(b);
693 reply.writeNoException();
694 return true;
695 }
696
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
698 data.enforceInterface(IActivityManager.descriptor);
699 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700700 boolean stable = data.readInt() != 0;
701 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800702 reply.writeNoException();
703 return true;
704 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800705
706 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
707 data.enforceInterface(IActivityManager.descriptor);
708 String name = data.readString();
709 IBinder token = data.readStrongBinder();
710 removeContentProviderExternal(name, token);
711 reply.writeNoException();
712 return true;
713 }
714
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700715 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
716 data.enforceInterface(IActivityManager.descriptor);
717 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
718 PendingIntent pi = getRunningServiceControlPanel(comp);
719 reply.writeNoException();
720 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
721 return true;
722 }
723
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 case START_SERVICE_TRANSACTION: {
725 data.enforceInterface(IActivityManager.descriptor);
726 IBinder b = data.readStrongBinder();
727 IApplicationThread app = ApplicationThreadNative.asInterface(b);
728 Intent service = Intent.CREATOR.createFromParcel(data);
729 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700730 int userId = data.readInt();
731 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800732 reply.writeNoException();
733 ComponentName.writeToParcel(cn, reply);
734 return true;
735 }
736
737 case STOP_SERVICE_TRANSACTION: {
738 data.enforceInterface(IActivityManager.descriptor);
739 IBinder b = data.readStrongBinder();
740 IApplicationThread app = ApplicationThreadNative.asInterface(b);
741 Intent service = Intent.CREATOR.createFromParcel(data);
742 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700743 int userId = data.readInt();
744 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 reply.writeNoException();
746 reply.writeInt(res);
747 return true;
748 }
749
750 case STOP_SERVICE_TOKEN_TRANSACTION: {
751 data.enforceInterface(IActivityManager.descriptor);
752 ComponentName className = ComponentName.readFromParcel(data);
753 IBinder token = data.readStrongBinder();
754 int startId = data.readInt();
755 boolean res = stopServiceToken(className, token, startId);
756 reply.writeNoException();
757 reply.writeInt(res ? 1 : 0);
758 return true;
759 }
760
761 case SET_SERVICE_FOREGROUND_TRANSACTION: {
762 data.enforceInterface(IActivityManager.descriptor);
763 ComponentName className = ComponentName.readFromParcel(data);
764 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700765 int id = data.readInt();
766 Notification notification = null;
767 if (data.readInt() != 0) {
768 notification = Notification.CREATOR.createFromParcel(data);
769 }
770 boolean removeNotification = data.readInt() != 0;
771 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800772 reply.writeNoException();
773 return true;
774 }
775
776 case BIND_SERVICE_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder b = data.readStrongBinder();
779 IApplicationThread app = ApplicationThreadNative.asInterface(b);
780 IBinder token = data.readStrongBinder();
781 Intent service = Intent.CREATOR.createFromParcel(data);
782 String resolvedType = data.readString();
783 b = data.readStrongBinder();
784 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800785 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800787 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 reply.writeNoException();
789 reply.writeInt(res);
790 return true;
791 }
792
793 case UNBIND_SERVICE_TRANSACTION: {
794 data.enforceInterface(IActivityManager.descriptor);
795 IBinder b = data.readStrongBinder();
796 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
797 boolean res = unbindService(conn);
798 reply.writeNoException();
799 reply.writeInt(res ? 1 : 0);
800 return true;
801 }
802
803 case PUBLISH_SERVICE_TRANSACTION: {
804 data.enforceInterface(IActivityManager.descriptor);
805 IBinder token = data.readStrongBinder();
806 Intent intent = Intent.CREATOR.createFromParcel(data);
807 IBinder service = data.readStrongBinder();
808 publishService(token, intent, service);
809 reply.writeNoException();
810 return true;
811 }
812
813 case UNBIND_FINISHED_TRANSACTION: {
814 data.enforceInterface(IActivityManager.descriptor);
815 IBinder token = data.readStrongBinder();
816 Intent intent = Intent.CREATOR.createFromParcel(data);
817 boolean doRebind = data.readInt() != 0;
818 unbindFinished(token, intent, doRebind);
819 reply.writeNoException();
820 return true;
821 }
822
823 case SERVICE_DONE_EXECUTING_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700826 int type = data.readInt();
827 int startId = data.readInt();
828 int res = data.readInt();
829 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800830 reply.writeNoException();
831 return true;
832 }
833
834 case START_INSTRUMENTATION_TRANSACTION: {
835 data.enforceInterface(IActivityManager.descriptor);
836 ComponentName className = ComponentName.readFromParcel(data);
837 String profileFile = data.readString();
838 int fl = data.readInt();
839 Bundle arguments = data.readBundle();
840 IBinder b = data.readStrongBinder();
841 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800842 b = data.readStrongBinder();
843 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700844 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800845 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800846 reply.writeNoException();
847 reply.writeInt(res ? 1 : 0);
848 return true;
849 }
850
851
852 case FINISH_INSTRUMENTATION_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder b = data.readStrongBinder();
855 IApplicationThread app = ApplicationThreadNative.asInterface(b);
856 int resultCode = data.readInt();
857 Bundle results = data.readBundle();
858 finishInstrumentation(app, resultCode, results);
859 reply.writeNoException();
860 return true;
861 }
862
863 case GET_CONFIGURATION_TRANSACTION: {
864 data.enforceInterface(IActivityManager.descriptor);
865 Configuration config = getConfiguration();
866 reply.writeNoException();
867 config.writeToParcel(reply, 0);
868 return true;
869 }
870
871 case UPDATE_CONFIGURATION_TRANSACTION: {
872 data.enforceInterface(IActivityManager.descriptor);
873 Configuration config = Configuration.CREATOR.createFromParcel(data);
874 updateConfiguration(config);
875 reply.writeNoException();
876 return true;
877 }
878
879 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
880 data.enforceInterface(IActivityManager.descriptor);
881 IBinder token = data.readStrongBinder();
882 int requestedOrientation = data.readInt();
883 setRequestedOrientation(token, requestedOrientation);
884 reply.writeNoException();
885 return true;
886 }
887
888 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
889 data.enforceInterface(IActivityManager.descriptor);
890 IBinder token = data.readStrongBinder();
891 int req = getRequestedOrientation(token);
892 reply.writeNoException();
893 reply.writeInt(req);
894 return true;
895 }
896
897 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
898 data.enforceInterface(IActivityManager.descriptor);
899 IBinder token = data.readStrongBinder();
900 ComponentName cn = getActivityClassForToken(token);
901 reply.writeNoException();
902 ComponentName.writeToParcel(cn, reply);
903 return true;
904 }
905
906 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
907 data.enforceInterface(IActivityManager.descriptor);
908 IBinder token = data.readStrongBinder();
909 reply.writeNoException();
910 reply.writeString(getPackageForToken(token));
911 return true;
912 }
913
914 case GET_INTENT_SENDER_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 int type = data.readInt();
917 String packageName = data.readString();
918 IBinder token = data.readStrongBinder();
919 String resultWho = data.readString();
920 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800921 Intent[] requestIntents;
922 String[] requestResolvedTypes;
923 if (data.readInt() != 0) {
924 requestIntents = data.createTypedArray(Intent.CREATOR);
925 requestResolvedTypes = data.createStringArray();
926 } else {
927 requestIntents = null;
928 requestResolvedTypes = null;
929 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800930 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700931 Bundle options = data.readInt() != 0
932 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700933 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800934 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800935 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700936 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800937 reply.writeNoException();
938 reply.writeStrongBinder(res != null ? res.asBinder() : null);
939 return true;
940 }
941
942 case CANCEL_INTENT_SENDER_TRANSACTION: {
943 data.enforceInterface(IActivityManager.descriptor);
944 IIntentSender r = IIntentSender.Stub.asInterface(
945 data.readStrongBinder());
946 cancelIntentSender(r);
947 reply.writeNoException();
948 return true;
949 }
950
951 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
952 data.enforceInterface(IActivityManager.descriptor);
953 IIntentSender r = IIntentSender.Stub.asInterface(
954 data.readStrongBinder());
955 String res = getPackageForIntentSender(r);
956 reply.writeNoException();
957 reply.writeString(res);
958 return true;
959 }
960
Christopher Tatec4a07d12012-04-06 14:19:13 -0700961 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
962 data.enforceInterface(IActivityManager.descriptor);
963 IIntentSender r = IIntentSender.Stub.asInterface(
964 data.readStrongBinder());
965 int res = getUidForIntentSender(r);
966 reply.writeNoException();
967 reply.writeInt(res);
968 return true;
969 }
970
Dianne Hackborn41203752012-08-31 14:05:51 -0700971 case HANDLE_INCOMING_USER_TRANSACTION: {
972 data.enforceInterface(IActivityManager.descriptor);
973 int callingPid = data.readInt();
974 int callingUid = data.readInt();
975 int userId = data.readInt();
976 boolean allowAll = data.readInt() != 0 ;
977 boolean requireFull = data.readInt() != 0;
978 String name = data.readString();
979 String callerPackage = data.readString();
980 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
981 requireFull, name, callerPackage);
982 reply.writeNoException();
983 reply.writeInt(res);
984 return true;
985 }
986
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 case SET_PROCESS_LIMIT_TRANSACTION: {
988 data.enforceInterface(IActivityManager.descriptor);
989 int max = data.readInt();
990 setProcessLimit(max);
991 reply.writeNoException();
992 return true;
993 }
994
995 case GET_PROCESS_LIMIT_TRANSACTION: {
996 data.enforceInterface(IActivityManager.descriptor);
997 int limit = getProcessLimit();
998 reply.writeNoException();
999 reply.writeInt(limit);
1000 return true;
1001 }
1002
1003 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1004 data.enforceInterface(IActivityManager.descriptor);
1005 IBinder token = data.readStrongBinder();
1006 int pid = data.readInt();
1007 boolean isForeground = data.readInt() != 0;
1008 setProcessForeground(token, pid, isForeground);
1009 reply.writeNoException();
1010 return true;
1011 }
1012
1013 case CHECK_PERMISSION_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 String perm = data.readString();
1016 int pid = data.readInt();
1017 int uid = data.readInt();
1018 int res = checkPermission(perm, pid, uid);
1019 reply.writeNoException();
1020 reply.writeInt(res);
1021 return true;
1022 }
1023
1024 case CHECK_URI_PERMISSION_TRANSACTION: {
1025 data.enforceInterface(IActivityManager.descriptor);
1026 Uri uri = Uri.CREATOR.createFromParcel(data);
1027 int pid = data.readInt();
1028 int uid = data.readInt();
1029 int mode = data.readInt();
1030 int res = checkUriPermission(uri, pid, uid, mode);
1031 reply.writeNoException();
1032 reply.writeInt(res);
1033 return true;
1034 }
1035
1036 case CLEAR_APP_DATA_TRANSACTION: {
1037 data.enforceInterface(IActivityManager.descriptor);
1038 String packageName = data.readString();
1039 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1040 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001041 int userId = data.readInt();
1042 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001043 reply.writeNoException();
1044 reply.writeInt(res ? 1 : 0);
1045 return true;
1046 }
1047
1048 case GRANT_URI_PERMISSION_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 IBinder b = data.readStrongBinder();
1051 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1052 String targetPkg = data.readString();
1053 Uri uri = Uri.CREATOR.createFromParcel(data);
1054 int mode = data.readInt();
1055 grantUriPermission(app, targetPkg, uri, mode);
1056 reply.writeNoException();
1057 return true;
1058 }
1059
1060 case REVOKE_URI_PERMISSION_TRANSACTION: {
1061 data.enforceInterface(IActivityManager.descriptor);
1062 IBinder b = data.readStrongBinder();
1063 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1064 Uri uri = Uri.CREATOR.createFromParcel(data);
1065 int mode = data.readInt();
1066 revokeUriPermission(app, uri, mode);
1067 reply.writeNoException();
1068 return true;
1069 }
1070
1071 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 IBinder b = data.readStrongBinder();
1074 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1075 boolean waiting = data.readInt() != 0;
1076 showWaitingForDebugger(app, waiting);
1077 reply.writeNoException();
1078 return true;
1079 }
1080
1081 case GET_MEMORY_INFO_TRANSACTION: {
1082 data.enforceInterface(IActivityManager.descriptor);
1083 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1084 getMemoryInfo(mi);
1085 reply.writeNoException();
1086 mi.writeToParcel(reply, 0);
1087 return true;
1088 }
1089
1090 case UNHANDLED_BACK_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 unhandledBack();
1093 reply.writeNoException();
1094 return true;
1095 }
1096
1097 case OPEN_CONTENT_URI_TRANSACTION: {
1098 data.enforceInterface(IActivityManager.descriptor);
1099 Uri uri = Uri.parse(data.readString());
1100 ParcelFileDescriptor pfd = openContentUri(uri);
1101 reply.writeNoException();
1102 if (pfd != null) {
1103 reply.writeInt(1);
1104 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1105 } else {
1106 reply.writeInt(0);
1107 }
1108 return true;
1109 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001110
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001111 case GOING_TO_SLEEP_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 goingToSleep();
1114 reply.writeNoException();
1115 return true;
1116 }
1117
1118 case WAKING_UP_TRANSACTION: {
1119 data.enforceInterface(IActivityManager.descriptor);
1120 wakingUp();
1121 reply.writeNoException();
1122 return true;
1123 }
1124
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001125 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 setLockScreenShown(data.readInt() != 0);
1128 reply.writeNoException();
1129 return true;
1130 }
1131
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001132 case SET_DEBUG_APP_TRANSACTION: {
1133 data.enforceInterface(IActivityManager.descriptor);
1134 String pn = data.readString();
1135 boolean wfd = data.readInt() != 0;
1136 boolean per = data.readInt() != 0;
1137 setDebugApp(pn, wfd, per);
1138 reply.writeNoException();
1139 return true;
1140 }
1141
1142 case SET_ALWAYS_FINISH_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 boolean enabled = data.readInt() != 0;
1145 setAlwaysFinish(enabled);
1146 reply.writeNoException();
1147 return true;
1148 }
1149
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001150 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001152 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001153 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001154 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 return true;
1156 }
1157
1158 case ENTER_SAFE_MODE_TRANSACTION: {
1159 data.enforceInterface(IActivityManager.descriptor);
1160 enterSafeMode();
1161 reply.writeNoException();
1162 return true;
1163 }
1164
1165 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1166 data.enforceInterface(IActivityManager.descriptor);
1167 IIntentSender is = IIntentSender.Stub.asInterface(
1168 data.readStrongBinder());
1169 noteWakeupAlarm(is);
1170 reply.writeNoException();
1171 return true;
1172 }
1173
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001174 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175 data.enforceInterface(IActivityManager.descriptor);
1176 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001177 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001178 boolean secure = data.readInt() != 0;
1179 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001180 reply.writeNoException();
1181 reply.writeInt(res ? 1 : 0);
1182 return true;
1183 }
1184
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001185 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1186 data.enforceInterface(IActivityManager.descriptor);
1187 String reason = data.readString();
1188 boolean res = killProcessesBelowForeground(reason);
1189 reply.writeNoException();
1190 reply.writeInt(res ? 1 : 0);
1191 return true;
1192 }
1193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 case START_RUNNING_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 String pkg = data.readString();
1197 String cls = data.readString();
1198 String action = data.readString();
1199 String indata = data.readString();
1200 startRunning(pkg, cls, action, indata);
1201 reply.writeNoException();
1202 return true;
1203 }
1204
Dan Egnor60d87622009-12-16 16:32:58 -08001205 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1206 data.enforceInterface(IActivityManager.descriptor);
1207 IBinder app = data.readStrongBinder();
1208 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1209 handleApplicationCrash(app, ci);
1210 reply.writeNoException();
1211 return true;
1212 }
1213
1214 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 data.enforceInterface(IActivityManager.descriptor);
1216 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001217 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001218 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001219 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001220 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001221 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 return true;
1223 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001224
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001225 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001228 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001229 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1230 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001231 reply.writeNoException();
1232 return true;
1233 }
1234
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 int sig = data.readInt();
1238 signalPersistentProcesses(sig);
1239 reply.writeNoException();
1240 return true;
1241 }
1242
Dianne Hackborn03abb812010-01-04 18:43:19 -08001243 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1244 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001246 int userId = data.readInt();
1247 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001248 reply.writeNoException();
1249 return true;
1250 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001251
1252 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1253 data.enforceInterface(IActivityManager.descriptor);
1254 killAllBackgroundProcesses();
1255 reply.writeNoException();
1256 return true;
1257 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001258
1259 case FORCE_STOP_PACKAGE_TRANSACTION: {
1260 data.enforceInterface(IActivityManager.descriptor);
1261 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001262 int userId = data.readInt();
1263 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001264 reply.writeNoException();
1265 return true;
1266 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001267
1268 case GET_MY_MEMORY_STATE_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 ActivityManager.RunningAppProcessInfo info =
1271 new ActivityManager.RunningAppProcessInfo();
1272 getMyMemoryState(info);
1273 reply.writeNoException();
1274 info.writeToParcel(reply, 0);
1275 return true;
1276 }
1277
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1279 data.enforceInterface(IActivityManager.descriptor);
1280 ConfigurationInfo config = getDeviceConfigurationInfo();
1281 reply.writeNoException();
1282 config.writeToParcel(reply, 0);
1283 return true;
1284 }
1285
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001286 case PROFILE_CONTROL_TRANSACTION: {
1287 data.enforceInterface(IActivityManager.descriptor);
1288 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001289 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001290 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001291 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001292 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001293 ParcelFileDescriptor fd = data.readInt() != 0
1294 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001295 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001296 reply.writeNoException();
1297 reply.writeInt(res ? 1 : 0);
1298 return true;
1299 }
1300
Dianne Hackborn55280a92009-05-07 15:53:46 -07001301 case SHUTDOWN_TRANSACTION: {
1302 data.enforceInterface(IActivityManager.descriptor);
1303 boolean res = shutdown(data.readInt());
1304 reply.writeNoException();
1305 reply.writeInt(res ? 1 : 0);
1306 return true;
1307 }
1308
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001309 case STOP_APP_SWITCHES_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 stopAppSwitches();
1312 reply.writeNoException();
1313 return true;
1314 }
1315
1316 case RESUME_APP_SWITCHES_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 resumeAppSwitches();
1319 reply.writeNoException();
1320 return true;
1321 }
1322
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001323 case PEEK_SERVICE_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 Intent service = Intent.CREATOR.createFromParcel(data);
1326 String resolvedType = data.readString();
1327 IBinder binder = peekService(service, resolvedType);
1328 reply.writeNoException();
1329 reply.writeStrongBinder(binder);
1330 return true;
1331 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001332
1333 case START_BACKUP_AGENT_TRANSACTION: {
1334 data.enforceInterface(IActivityManager.descriptor);
1335 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1336 int backupRestoreMode = data.readInt();
1337 boolean success = bindBackupAgent(info, backupRestoreMode);
1338 reply.writeNoException();
1339 reply.writeInt(success ? 1 : 0);
1340 return true;
1341 }
1342
1343 case BACKUP_AGENT_CREATED_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
1345 String packageName = data.readString();
1346 IBinder agent = data.readStrongBinder();
1347 backupAgentCreated(packageName, agent);
1348 reply.writeNoException();
1349 return true;
1350 }
1351
1352 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1353 data.enforceInterface(IActivityManager.descriptor);
1354 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1355 unbindBackupAgent(info);
1356 reply.writeNoException();
1357 return true;
1358 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001359
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001360 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001361 data.enforceInterface(IActivityManager.descriptor);
1362 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001363 int appid = data.readInt();
1364 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001365 reply.writeNoException();
1366 return true;
1367 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001368
1369 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1370 data.enforceInterface(IActivityManager.descriptor);
1371 String reason = data.readString();
1372 closeSystemDialogs(reason);
1373 reply.writeNoException();
1374 return true;
1375 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001376
1377 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1378 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001379 int[] pids = data.createIntArray();
1380 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001381 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001382 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001383 return true;
1384 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001385
1386 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1387 data.enforceInterface(IActivityManager.descriptor);
1388 String processName = data.readString();
1389 int uid = data.readInt();
1390 killApplicationProcess(processName, uid);
1391 reply.writeNoException();
1392 return true;
1393 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001394
1395 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 IBinder token = data.readStrongBinder();
1398 String packageName = data.readString();
1399 int enterAnim = data.readInt();
1400 int exitAnim = data.readInt();
1401 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001402 reply.writeNoException();
1403 return true;
1404 }
1405
1406 case IS_USER_A_MONKEY_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001408 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001409 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001410 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001411 return true;
1412 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001413
1414 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1415 data.enforceInterface(IActivityManager.descriptor);
1416 finishHeavyWeightApp();
1417 reply.writeNoException();
1418 return true;
1419 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001420
1421 case IS_IMMERSIVE_TRANSACTION: {
1422 data.enforceInterface(IActivityManager.descriptor);
1423 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001424 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001425 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001426 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001427 return true;
1428 }
1429
1430 case SET_IMMERSIVE_TRANSACTION: {
1431 data.enforceInterface(IActivityManager.descriptor);
1432 IBinder token = data.readStrongBinder();
1433 boolean imm = data.readInt() == 1;
1434 setImmersive(token, imm);
1435 reply.writeNoException();
1436 return true;
1437 }
1438
1439 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1440 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001441 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001442 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001443 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001444 return true;
1445 }
1446
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001447 case CRASH_APPLICATION_TRANSACTION: {
1448 data.enforceInterface(IActivityManager.descriptor);
1449 int uid = data.readInt();
1450 int initialPid = data.readInt();
1451 String packageName = data.readString();
1452 String message = data.readString();
1453 crashApplication(uid, initialPid, packageName, message);
1454 reply.writeNoException();
1455 return true;
1456 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001457
1458 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1459 data.enforceInterface(IActivityManager.descriptor);
1460 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001461 int userId = data.readInt();
1462 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001463 reply.writeNoException();
1464 reply.writeString(type);
1465 return true;
1466 }
1467
Dianne Hackborn7e269642010-08-25 19:50:20 -07001468 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1469 data.enforceInterface(IActivityManager.descriptor);
1470 String name = data.readString();
1471 IBinder perm = newUriPermissionOwner(name);
1472 reply.writeNoException();
1473 reply.writeStrongBinder(perm);
1474 return true;
1475 }
1476
1477 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1478 data.enforceInterface(IActivityManager.descriptor);
1479 IBinder owner = data.readStrongBinder();
1480 int fromUid = data.readInt();
1481 String targetPkg = data.readString();
1482 Uri uri = Uri.CREATOR.createFromParcel(data);
1483 int mode = data.readInt();
1484 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1485 reply.writeNoException();
1486 return true;
1487 }
1488
1489 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1490 data.enforceInterface(IActivityManager.descriptor);
1491 IBinder owner = data.readStrongBinder();
1492 Uri uri = null;
1493 if (data.readInt() != 0) {
1494 Uri.CREATOR.createFromParcel(data);
1495 }
1496 int mode = data.readInt();
1497 revokeUriPermissionFromOwner(owner, uri, mode);
1498 reply.writeNoException();
1499 return true;
1500 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001501
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001502 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1503 data.enforceInterface(IActivityManager.descriptor);
1504 int callingUid = data.readInt();
1505 String targetPkg = data.readString();
1506 Uri uri = Uri.CREATOR.createFromParcel(data);
1507 int modeFlags = data.readInt();
1508 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1509 reply.writeNoException();
1510 reply.writeInt(res);
1511 return true;
1512 }
1513
Andy McFadden824c5102010-07-09 16:26:57 -07001514 case DUMP_HEAP_TRANSACTION: {
1515 data.enforceInterface(IActivityManager.descriptor);
1516 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001517 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001518 boolean managed = data.readInt() != 0;
1519 String path = data.readString();
1520 ParcelFileDescriptor fd = data.readInt() != 0
1521 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001522 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001523 reply.writeNoException();
1524 reply.writeInt(res ? 1 : 0);
1525 return true;
1526 }
1527
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001528 case START_ACTIVITIES_TRANSACTION:
1529 {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 IBinder b = data.readStrongBinder();
1532 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001533 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001534 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1535 String[] resolvedTypes = data.createStringArray();
1536 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001537 Bundle options = data.readInt() != 0
1538 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001539 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001540 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001541 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001542 reply.writeNoException();
1543 reply.writeInt(result);
1544 return true;
1545 }
1546
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001547 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1548 {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 int mode = getFrontActivityScreenCompatMode();
1551 reply.writeNoException();
1552 reply.writeInt(mode);
1553 return true;
1554 }
1555
1556 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1557 {
1558 data.enforceInterface(IActivityManager.descriptor);
1559 int mode = data.readInt();
1560 setFrontActivityScreenCompatMode(mode);
1561 reply.writeNoException();
1562 reply.writeInt(mode);
1563 return true;
1564 }
1565
1566 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1567 {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 String pkg = data.readString();
1570 int mode = getPackageScreenCompatMode(pkg);
1571 reply.writeNoException();
1572 reply.writeInt(mode);
1573 return true;
1574 }
1575
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001576 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1577 {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001580 int mode = data.readInt();
1581 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001582 reply.writeNoException();
1583 return true;
1584 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001585
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001586 case SWITCH_USER_TRANSACTION: {
1587 data.enforceInterface(IActivityManager.descriptor);
1588 int userid = data.readInt();
1589 boolean result = switchUser(userid);
1590 reply.writeNoException();
1591 reply.writeInt(result ? 1 : 0);
1592 return true;
1593 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001594
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001595 case STOP_USER_TRANSACTION: {
1596 data.enforceInterface(IActivityManager.descriptor);
1597 int userid = data.readInt();
1598 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1599 data.readStrongBinder());
1600 int result = stopUser(userid, callback);
1601 reply.writeNoException();
1602 reply.writeInt(result);
1603 return true;
1604 }
1605
Amith Yamasani52f1d752012-03-28 18:19:29 -07001606 case GET_CURRENT_USER_TRANSACTION: {
1607 data.enforceInterface(IActivityManager.descriptor);
1608 UserInfo userInfo = getCurrentUser();
1609 reply.writeNoException();
1610 userInfo.writeToParcel(reply, 0);
1611 return true;
1612 }
1613
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001614 case IS_USER_RUNNING_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001617 boolean orStopping = data.readInt() != 0;
1618 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001619 reply.writeNoException();
1620 reply.writeInt(result ? 1 : 0);
1621 return true;
1622 }
1623
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001624 case GET_RUNNING_USER_IDS_TRANSACTION: {
1625 data.enforceInterface(IActivityManager.descriptor);
1626 int[] result = getRunningUserIds();
1627 reply.writeNoException();
1628 reply.writeIntArray(result);
1629 return true;
1630 }
1631
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001632 case REMOVE_SUB_TASK_TRANSACTION:
1633 {
1634 data.enforceInterface(IActivityManager.descriptor);
1635 int taskId = data.readInt();
1636 int subTaskIndex = data.readInt();
1637 boolean result = removeSubTask(taskId, subTaskIndex);
1638 reply.writeNoException();
1639 reply.writeInt(result ? 1 : 0);
1640 return true;
1641 }
1642
1643 case REMOVE_TASK_TRANSACTION:
1644 {
1645 data.enforceInterface(IActivityManager.descriptor);
1646 int taskId = data.readInt();
1647 int fl = data.readInt();
1648 boolean result = removeTask(taskId, fl);
1649 reply.writeNoException();
1650 reply.writeInt(result ? 1 : 0);
1651 return true;
1652 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001653
Jeff Sharkeya4620792011-05-20 15:29:23 -07001654 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1657 data.readStrongBinder());
1658 registerProcessObserver(observer);
1659 return true;
1660 }
1661
1662 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1663 data.enforceInterface(IActivityManager.descriptor);
1664 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1665 data.readStrongBinder());
1666 unregisterProcessObserver(observer);
1667 return true;
1668 }
1669
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001670 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1671 {
1672 data.enforceInterface(IActivityManager.descriptor);
1673 String pkg = data.readString();
1674 boolean ask = getPackageAskScreenCompat(pkg);
1675 reply.writeNoException();
1676 reply.writeInt(ask ? 1 : 0);
1677 return true;
1678 }
1679
1680 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1681 {
1682 data.enforceInterface(IActivityManager.descriptor);
1683 String pkg = data.readString();
1684 boolean ask = data.readInt() != 0;
1685 setPackageAskScreenCompat(pkg, ask);
1686 reply.writeNoException();
1687 return true;
1688 }
1689
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001690 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1691 data.enforceInterface(IActivityManager.descriptor);
1692 IIntentSender r = IIntentSender.Stub.asInterface(
1693 data.readStrongBinder());
1694 boolean res = isIntentSenderTargetedToPackage(r);
1695 reply.writeNoException();
1696 reply.writeInt(res ? 1 : 0);
1697 return true;
1698 }
1699
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001700 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1701 data.enforceInterface(IActivityManager.descriptor);
1702 IIntentSender r = IIntentSender.Stub.asInterface(
1703 data.readStrongBinder());
1704 boolean res = isIntentSenderAnActivity(r);
1705 reply.writeNoException();
1706 reply.writeInt(res ? 1 : 0);
1707 return true;
1708 }
1709
Dianne Hackborn81038902012-11-26 17:04:09 -08001710 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1711 data.enforceInterface(IActivityManager.descriptor);
1712 IIntentSender r = IIntentSender.Stub.asInterface(
1713 data.readStrongBinder());
1714 Intent intent = getIntentForIntentSender(r);
1715 reply.writeNoException();
1716 if (intent != null) {
1717 reply.writeInt(1);
1718 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1719 } else {
1720 reply.writeInt(0);
1721 }
1722 return true;
1723 }
1724
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001725 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 Configuration config = Configuration.CREATOR.createFromParcel(data);
1728 updatePersistentConfiguration(config);
1729 reply.writeNoException();
1730 return true;
1731 }
1732
Dianne Hackbornb437e092011-08-05 17:50:29 -07001733 case GET_PROCESS_PSS_TRANSACTION: {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 int[] pids = data.createIntArray();
1736 long[] pss = getProcessPss(pids);
1737 reply.writeNoException();
1738 reply.writeLongArray(pss);
1739 return true;
1740 }
1741
Dianne Hackborn661cd522011-08-22 00:26:20 -07001742 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1745 boolean always = data.readInt() != 0;
1746 showBootMessage(msg, always);
1747 reply.writeNoException();
1748 return true;
1749 }
1750
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001751 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 dismissKeyguardOnNextActivity();
1754 reply.writeNoException();
1755 return true;
1756 }
1757
Adam Powelldd8fab22012-03-22 17:47:27 -07001758 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1759 data.enforceInterface(IActivityManager.descriptor);
1760 IBinder token = data.readStrongBinder();
1761 String destAffinity = data.readString();
1762 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1763 reply.writeNoException();
1764 reply.writeInt(res ? 1 : 0);
1765 return true;
1766 }
1767
1768 case NAVIGATE_UP_TO_TRANSACTION: {
1769 data.enforceInterface(IActivityManager.descriptor);
1770 IBinder token = data.readStrongBinder();
1771 Intent target = Intent.CREATOR.createFromParcel(data);
1772 int resultCode = data.readInt();
1773 Intent resultData = null;
1774 if (data.readInt() != 0) {
1775 resultData = Intent.CREATOR.createFromParcel(data);
1776 }
1777 boolean res = navigateUpTo(token, target, resultCode, resultData);
1778 reply.writeNoException();
1779 reply.writeInt(res ? 1 : 0);
1780 return true;
1781 }
1782
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001783 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1784 data.enforceInterface(IActivityManager.descriptor);
1785 IBinder token = data.readStrongBinder();
1786 int res = getLaunchedFromUid(token);
1787 reply.writeNoException();
1788 reply.writeInt(res);
1789 return true;
1790 }
1791
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001792 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1793 data.enforceInterface(IActivityManager.descriptor);
1794 IBinder token = data.readStrongBinder();
1795 String res = getLaunchedFromPackage(token);
1796 reply.writeNoException();
1797 reply.writeString(res);
1798 return true;
1799 }
1800
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001801 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1802 data.enforceInterface(IActivityManager.descriptor);
1803 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1804 data.readStrongBinder());
1805 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001806 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001807 return true;
1808 }
1809
1810 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1811 data.enforceInterface(IActivityManager.descriptor);
1812 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1813 data.readStrongBinder());
1814 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001815 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001816 return true;
1817 }
1818
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001819 case REQUEST_BUG_REPORT_TRANSACTION: {
1820 data.enforceInterface(IActivityManager.descriptor);
1821 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001822 reply.writeNoException();
1823 return true;
1824 }
1825
1826 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1827 data.enforceInterface(IActivityManager.descriptor);
1828 int pid = data.readInt();
1829 boolean aboveSystem = data.readInt() != 0;
1830 long res = inputDispatchingTimedOut(pid, aboveSystem);
1831 reply.writeNoException();
1832 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001833 return true;
1834 }
1835
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001836 case GET_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1837 data.enforceInterface(IActivityManager.descriptor);
1838 int requestType = data.readInt();
1839 Bundle res = getTopActivityExtras(requestType);
1840 reply.writeNoException();
1841 reply.writeBundle(res);
1842 return true;
1843 }
1844
1845 case REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1846 data.enforceInterface(IActivityManager.descriptor);
1847 IBinder token = data.readStrongBinder();
1848 Bundle extras = data.readBundle();
1849 reportTopActivityExtras(token, extras);
1850 reply.writeNoException();
1851 return true;
1852 }
1853
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001854 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001855
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001856 return super.onTransact(code, data, reply, flags);
1857 }
1858
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001859 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001860 return this;
1861 }
1862
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001863 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1864 protected IActivityManager create() {
1865 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001866 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001867 Log.v("ActivityManager", "default service binder = " + b);
1868 }
1869 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001870 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001871 Log.v("ActivityManager", "default service = " + am);
1872 }
1873 return am;
1874 }
1875 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001876}
1877
1878class ActivityManagerProxy implements IActivityManager
1879{
1880 public ActivityManagerProxy(IBinder remote)
1881 {
1882 mRemote = remote;
1883 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001884
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001885 public IBinder asBinder()
1886 {
1887 return mRemote;
1888 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001889
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001890 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001891 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1892 int startFlags, String profileFile,
1893 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001894 Parcel data = Parcel.obtain();
1895 Parcel reply = Parcel.obtain();
1896 data.writeInterfaceToken(IActivityManager.descriptor);
1897 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001898 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001899 intent.writeToParcel(data, 0);
1900 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001901 data.writeStrongBinder(resultTo);
1902 data.writeString(resultWho);
1903 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001904 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001905 data.writeString(profileFile);
1906 if (profileFd != null) {
1907 data.writeInt(1);
1908 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1909 } else {
1910 data.writeInt(0);
1911 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001912 if (options != null) {
1913 data.writeInt(1);
1914 options.writeToParcel(data, 0);
1915 } else {
1916 data.writeInt(0);
1917 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001918 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1919 reply.readException();
1920 int result = reply.readInt();
1921 reply.recycle();
1922 data.recycle();
1923 return result;
1924 }
Amith Yamasani82644082012-08-03 13:09:11 -07001925
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001926 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07001927 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1928 int startFlags, String profileFile,
1929 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1930 Parcel data = Parcel.obtain();
1931 Parcel reply = Parcel.obtain();
1932 data.writeInterfaceToken(IActivityManager.descriptor);
1933 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001934 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07001935 intent.writeToParcel(data, 0);
1936 data.writeString(resolvedType);
1937 data.writeStrongBinder(resultTo);
1938 data.writeString(resultWho);
1939 data.writeInt(requestCode);
1940 data.writeInt(startFlags);
1941 data.writeString(profileFile);
1942 if (profileFd != null) {
1943 data.writeInt(1);
1944 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1945 } else {
1946 data.writeInt(0);
1947 }
1948 if (options != null) {
1949 data.writeInt(1);
1950 options.writeToParcel(data, 0);
1951 } else {
1952 data.writeInt(0);
1953 }
1954 data.writeInt(userId);
1955 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1956 reply.readException();
1957 int result = reply.readInt();
1958 reply.recycle();
1959 data.recycle();
1960 return result;
1961 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001962 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
1963 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001964 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001965 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001966 Parcel data = Parcel.obtain();
1967 Parcel reply = Parcel.obtain();
1968 data.writeInterfaceToken(IActivityManager.descriptor);
1969 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001970 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001971 intent.writeToParcel(data, 0);
1972 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001973 data.writeStrongBinder(resultTo);
1974 data.writeString(resultWho);
1975 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001976 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001977 data.writeString(profileFile);
1978 if (profileFd != null) {
1979 data.writeInt(1);
1980 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1981 } else {
1982 data.writeInt(0);
1983 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001984 if (options != null) {
1985 data.writeInt(1);
1986 options.writeToParcel(data, 0);
1987 } else {
1988 data.writeInt(0);
1989 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001990 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001991 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1992 reply.readException();
1993 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1994 reply.recycle();
1995 data.recycle();
1996 return result;
1997 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001998 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
1999 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002000 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002001 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002002 Parcel data = Parcel.obtain();
2003 Parcel reply = Parcel.obtain();
2004 data.writeInterfaceToken(IActivityManager.descriptor);
2005 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002006 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002007 intent.writeToParcel(data, 0);
2008 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002009 data.writeStrongBinder(resultTo);
2010 data.writeString(resultWho);
2011 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002012 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002013 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002014 if (options != null) {
2015 data.writeInt(1);
2016 options.writeToParcel(data, 0);
2017 } else {
2018 data.writeInt(0);
2019 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002020 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002021 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2022 reply.readException();
2023 int result = reply.readInt();
2024 reply.recycle();
2025 data.recycle();
2026 return result;
2027 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002028 public int startActivityIntentSender(IApplicationThread caller,
2029 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002030 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002031 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002032 Parcel data = Parcel.obtain();
2033 Parcel reply = Parcel.obtain();
2034 data.writeInterfaceToken(IActivityManager.descriptor);
2035 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2036 intent.writeToParcel(data, 0);
2037 if (fillInIntent != null) {
2038 data.writeInt(1);
2039 fillInIntent.writeToParcel(data, 0);
2040 } else {
2041 data.writeInt(0);
2042 }
2043 data.writeString(resolvedType);
2044 data.writeStrongBinder(resultTo);
2045 data.writeString(resultWho);
2046 data.writeInt(requestCode);
2047 data.writeInt(flagsMask);
2048 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002049 if (options != null) {
2050 data.writeInt(1);
2051 options.writeToParcel(data, 0);
2052 } else {
2053 data.writeInt(0);
2054 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002055 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002056 reply.readException();
2057 int result = reply.readInt();
2058 reply.recycle();
2059 data.recycle();
2060 return result;
2061 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002062 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002063 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002064 Parcel data = Parcel.obtain();
2065 Parcel reply = Parcel.obtain();
2066 data.writeInterfaceToken(IActivityManager.descriptor);
2067 data.writeStrongBinder(callingActivity);
2068 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002069 if (options != null) {
2070 data.writeInt(1);
2071 options.writeToParcel(data, 0);
2072 } else {
2073 data.writeInt(0);
2074 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002075 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2076 reply.readException();
2077 int result = reply.readInt();
2078 reply.recycle();
2079 data.recycle();
2080 return result != 0;
2081 }
2082 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2083 throws RemoteException {
2084 Parcel data = Parcel.obtain();
2085 Parcel reply = Parcel.obtain();
2086 data.writeInterfaceToken(IActivityManager.descriptor);
2087 data.writeStrongBinder(token);
2088 data.writeInt(resultCode);
2089 if (resultData != null) {
2090 data.writeInt(1);
2091 resultData.writeToParcel(data, 0);
2092 } else {
2093 data.writeInt(0);
2094 }
2095 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2096 reply.readException();
2097 boolean res = reply.readInt() != 0;
2098 data.recycle();
2099 reply.recycle();
2100 return res;
2101 }
2102 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2103 {
2104 Parcel data = Parcel.obtain();
2105 Parcel reply = Parcel.obtain();
2106 data.writeInterfaceToken(IActivityManager.descriptor);
2107 data.writeStrongBinder(token);
2108 data.writeString(resultWho);
2109 data.writeInt(requestCode);
2110 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2111 reply.readException();
2112 data.recycle();
2113 reply.recycle();
2114 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002115 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2116 Parcel data = Parcel.obtain();
2117 Parcel reply = Parcel.obtain();
2118 data.writeInterfaceToken(IActivityManager.descriptor);
2119 data.writeStrongBinder(token);
2120 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2121 reply.readException();
2122 boolean res = reply.readInt() != 0;
2123 data.recycle();
2124 reply.recycle();
2125 return res;
2126 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002127 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2128 Parcel data = Parcel.obtain();
2129 Parcel reply = Parcel.obtain();
2130 data.writeInterfaceToken(IActivityManager.descriptor);
2131 data.writeStrongBinder(token);
2132 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2133 reply.readException();
2134 boolean res = reply.readInt() != 0;
2135 data.recycle();
2136 reply.recycle();
2137 return res;
2138 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002139 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002140 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002141 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002142 {
2143 Parcel data = Parcel.obtain();
2144 Parcel reply = Parcel.obtain();
2145 data.writeInterfaceToken(IActivityManager.descriptor);
2146 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002147 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002148 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2149 filter.writeToParcel(data, 0);
2150 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002151 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002152 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2153 reply.readException();
2154 Intent intent = null;
2155 int haveIntent = reply.readInt();
2156 if (haveIntent != 0) {
2157 intent = Intent.CREATOR.createFromParcel(reply);
2158 }
2159 reply.recycle();
2160 data.recycle();
2161 return intent;
2162 }
2163 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2164 {
2165 Parcel data = Parcel.obtain();
2166 Parcel reply = Parcel.obtain();
2167 data.writeInterfaceToken(IActivityManager.descriptor);
2168 data.writeStrongBinder(receiver.asBinder());
2169 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2170 reply.readException();
2171 data.recycle();
2172 reply.recycle();
2173 }
2174 public int broadcastIntent(IApplicationThread caller,
2175 Intent intent, String resolvedType, IIntentReceiver resultTo,
2176 int resultCode, String resultData, Bundle map,
2177 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002178 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002179 {
2180 Parcel data = Parcel.obtain();
2181 Parcel reply = Parcel.obtain();
2182 data.writeInterfaceToken(IActivityManager.descriptor);
2183 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2184 intent.writeToParcel(data, 0);
2185 data.writeString(resolvedType);
2186 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2187 data.writeInt(resultCode);
2188 data.writeString(resultData);
2189 data.writeBundle(map);
2190 data.writeString(requiredPermission);
2191 data.writeInt(serialized ? 1 : 0);
2192 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002193 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002194 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2195 reply.readException();
2196 int res = reply.readInt();
2197 reply.recycle();
2198 data.recycle();
2199 return res;
2200 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002201 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2202 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002203 {
2204 Parcel data = Parcel.obtain();
2205 Parcel reply = Parcel.obtain();
2206 data.writeInterfaceToken(IActivityManager.descriptor);
2207 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2208 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002209 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002210 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2211 reply.readException();
2212 data.recycle();
2213 reply.recycle();
2214 }
2215 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2216 {
2217 Parcel data = Parcel.obtain();
2218 Parcel reply = Parcel.obtain();
2219 data.writeInterfaceToken(IActivityManager.descriptor);
2220 data.writeStrongBinder(who);
2221 data.writeInt(resultCode);
2222 data.writeString(resultData);
2223 data.writeBundle(map);
2224 data.writeInt(abortBroadcast ? 1 : 0);
2225 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2226 reply.readException();
2227 data.recycle();
2228 reply.recycle();
2229 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002230 public void attachApplication(IApplicationThread app) throws RemoteException
2231 {
2232 Parcel data = Parcel.obtain();
2233 Parcel reply = Parcel.obtain();
2234 data.writeInterfaceToken(IActivityManager.descriptor);
2235 data.writeStrongBinder(app.asBinder());
2236 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2237 reply.readException();
2238 data.recycle();
2239 reply.recycle();
2240 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002241 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2242 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002243 {
2244 Parcel data = Parcel.obtain();
2245 Parcel reply = Parcel.obtain();
2246 data.writeInterfaceToken(IActivityManager.descriptor);
2247 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002248 if (config != null) {
2249 data.writeInt(1);
2250 config.writeToParcel(data, 0);
2251 } else {
2252 data.writeInt(0);
2253 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002254 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002255 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2256 reply.readException();
2257 data.recycle();
2258 reply.recycle();
2259 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002260 public void activityResumed(IBinder token) throws RemoteException
2261 {
2262 Parcel data = Parcel.obtain();
2263 Parcel reply = Parcel.obtain();
2264 data.writeInterfaceToken(IActivityManager.descriptor);
2265 data.writeStrongBinder(token);
2266 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2267 reply.readException();
2268 data.recycle();
2269 reply.recycle();
2270 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002271 public void activityPaused(IBinder token) throws RemoteException
2272 {
2273 Parcel data = Parcel.obtain();
2274 Parcel reply = Parcel.obtain();
2275 data.writeInterfaceToken(IActivityManager.descriptor);
2276 data.writeStrongBinder(token);
2277 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2278 reply.readException();
2279 data.recycle();
2280 reply.recycle();
2281 }
2282 public void activityStopped(IBinder token, Bundle state,
2283 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002284 {
2285 Parcel data = Parcel.obtain();
2286 Parcel reply = Parcel.obtain();
2287 data.writeInterfaceToken(IActivityManager.descriptor);
2288 data.writeStrongBinder(token);
2289 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002290 if (thumbnail != null) {
2291 data.writeInt(1);
2292 thumbnail.writeToParcel(data, 0);
2293 } else {
2294 data.writeInt(0);
2295 }
2296 TextUtils.writeToParcel(description, data, 0);
2297 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2298 reply.readException();
2299 data.recycle();
2300 reply.recycle();
2301 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002302 public void activitySlept(IBinder token) throws RemoteException
2303 {
2304 Parcel data = Parcel.obtain();
2305 Parcel reply = Parcel.obtain();
2306 data.writeInterfaceToken(IActivityManager.descriptor);
2307 data.writeStrongBinder(token);
2308 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2309 reply.readException();
2310 data.recycle();
2311 reply.recycle();
2312 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002313 public void activityDestroyed(IBinder token) throws RemoteException
2314 {
2315 Parcel data = Parcel.obtain();
2316 Parcel reply = Parcel.obtain();
2317 data.writeInterfaceToken(IActivityManager.descriptor);
2318 data.writeStrongBinder(token);
2319 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2320 reply.readException();
2321 data.recycle();
2322 reply.recycle();
2323 }
2324 public String getCallingPackage(IBinder token) throws RemoteException
2325 {
2326 Parcel data = Parcel.obtain();
2327 Parcel reply = Parcel.obtain();
2328 data.writeInterfaceToken(IActivityManager.descriptor);
2329 data.writeStrongBinder(token);
2330 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2331 reply.readException();
2332 String res = reply.readString();
2333 data.recycle();
2334 reply.recycle();
2335 return res;
2336 }
2337 public ComponentName getCallingActivity(IBinder token)
2338 throws RemoteException {
2339 Parcel data = Parcel.obtain();
2340 Parcel reply = Parcel.obtain();
2341 data.writeInterfaceToken(IActivityManager.descriptor);
2342 data.writeStrongBinder(token);
2343 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2344 reply.readException();
2345 ComponentName res = ComponentName.readFromParcel(reply);
2346 data.recycle();
2347 reply.recycle();
2348 return res;
2349 }
2350 public List getTasks(int maxNum, int flags,
2351 IThumbnailReceiver receiver) throws RemoteException {
2352 Parcel data = Parcel.obtain();
2353 Parcel reply = Parcel.obtain();
2354 data.writeInterfaceToken(IActivityManager.descriptor);
2355 data.writeInt(maxNum);
2356 data.writeInt(flags);
2357 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2358 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2359 reply.readException();
2360 ArrayList list = null;
2361 int N = reply.readInt();
2362 if (N >= 0) {
2363 list = new ArrayList();
2364 while (N > 0) {
2365 ActivityManager.RunningTaskInfo info =
2366 ActivityManager.RunningTaskInfo.CREATOR
2367 .createFromParcel(reply);
2368 list.add(info);
2369 N--;
2370 }
2371 }
2372 data.recycle();
2373 reply.recycle();
2374 return list;
2375 }
2376 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002377 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002378 Parcel data = Parcel.obtain();
2379 Parcel reply = Parcel.obtain();
2380 data.writeInterfaceToken(IActivityManager.descriptor);
2381 data.writeInt(maxNum);
2382 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002383 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002384 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2385 reply.readException();
2386 ArrayList<ActivityManager.RecentTaskInfo> list
2387 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2388 data.recycle();
2389 reply.recycle();
2390 return list;
2391 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002392 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002393 Parcel data = Parcel.obtain();
2394 Parcel reply = Parcel.obtain();
2395 data.writeInterfaceToken(IActivityManager.descriptor);
2396 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002397 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002398 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002399 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002400 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002401 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002402 }
2403 data.recycle();
2404 reply.recycle();
2405 return bm;
2406 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002407 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2408 Parcel data = Parcel.obtain();
2409 Parcel reply = Parcel.obtain();
2410 data.writeInterfaceToken(IActivityManager.descriptor);
2411 data.writeInt(id);
2412 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2413 reply.readException();
2414 Bitmap bm = null;
2415 if (reply.readInt() != 0) {
2416 bm = Bitmap.CREATOR.createFromParcel(reply);
2417 }
2418 data.recycle();
2419 reply.recycle();
2420 return bm;
2421 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002422 public List getServices(int maxNum, int flags) throws RemoteException {
2423 Parcel data = Parcel.obtain();
2424 Parcel reply = Parcel.obtain();
2425 data.writeInterfaceToken(IActivityManager.descriptor);
2426 data.writeInt(maxNum);
2427 data.writeInt(flags);
2428 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2429 reply.readException();
2430 ArrayList list = null;
2431 int N = reply.readInt();
2432 if (N >= 0) {
2433 list = new ArrayList();
2434 while (N > 0) {
2435 ActivityManager.RunningServiceInfo info =
2436 ActivityManager.RunningServiceInfo.CREATOR
2437 .createFromParcel(reply);
2438 list.add(info);
2439 N--;
2440 }
2441 }
2442 data.recycle();
2443 reply.recycle();
2444 return list;
2445 }
2446 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2447 throws RemoteException {
2448 Parcel data = Parcel.obtain();
2449 Parcel reply = Parcel.obtain();
2450 data.writeInterfaceToken(IActivityManager.descriptor);
2451 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2452 reply.readException();
2453 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2454 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2455 data.recycle();
2456 reply.recycle();
2457 return list;
2458 }
2459 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2460 throws RemoteException {
2461 Parcel data = Parcel.obtain();
2462 Parcel reply = Parcel.obtain();
2463 data.writeInterfaceToken(IActivityManager.descriptor);
2464 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2465 reply.readException();
2466 ArrayList<ActivityManager.RunningAppProcessInfo> list
2467 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2468 data.recycle();
2469 reply.recycle();
2470 return list;
2471 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002472 public List<ApplicationInfo> getRunningExternalApplications()
2473 throws RemoteException {
2474 Parcel data = Parcel.obtain();
2475 Parcel reply = Parcel.obtain();
2476 data.writeInterfaceToken(IActivityManager.descriptor);
2477 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2478 reply.readException();
2479 ArrayList<ApplicationInfo> list
2480 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2481 data.recycle();
2482 reply.recycle();
2483 return list;
2484 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002485 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002486 {
2487 Parcel data = Parcel.obtain();
2488 Parcel reply = Parcel.obtain();
2489 data.writeInterfaceToken(IActivityManager.descriptor);
2490 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002491 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002492 if (options != null) {
2493 data.writeInt(1);
2494 options.writeToParcel(data, 0);
2495 } else {
2496 data.writeInt(0);
2497 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002498 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2499 reply.readException();
2500 data.recycle();
2501 reply.recycle();
2502 }
2503 public void moveTaskToBack(int task) throws RemoteException
2504 {
2505 Parcel data = Parcel.obtain();
2506 Parcel reply = Parcel.obtain();
2507 data.writeInterfaceToken(IActivityManager.descriptor);
2508 data.writeInt(task);
2509 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2510 reply.readException();
2511 data.recycle();
2512 reply.recycle();
2513 }
2514 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2515 throws RemoteException {
2516 Parcel data = Parcel.obtain();
2517 Parcel reply = Parcel.obtain();
2518 data.writeInterfaceToken(IActivityManager.descriptor);
2519 data.writeStrongBinder(token);
2520 data.writeInt(nonRoot ? 1 : 0);
2521 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2522 reply.readException();
2523 boolean res = reply.readInt() != 0;
2524 data.recycle();
2525 reply.recycle();
2526 return res;
2527 }
2528 public void moveTaskBackwards(int task) throws RemoteException
2529 {
2530 Parcel data = Parcel.obtain();
2531 Parcel reply = Parcel.obtain();
2532 data.writeInterfaceToken(IActivityManager.descriptor);
2533 data.writeInt(task);
2534 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2535 reply.readException();
2536 data.recycle();
2537 reply.recycle();
2538 }
2539 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2540 {
2541 Parcel data = Parcel.obtain();
2542 Parcel reply = Parcel.obtain();
2543 data.writeInterfaceToken(IActivityManager.descriptor);
2544 data.writeStrongBinder(token);
2545 data.writeInt(onlyRoot ? 1 : 0);
2546 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2547 reply.readException();
2548 int res = reply.readInt();
2549 data.recycle();
2550 reply.recycle();
2551 return res;
2552 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002553 public void reportThumbnail(IBinder token,
2554 Bitmap thumbnail, CharSequence description) throws RemoteException
2555 {
2556 Parcel data = Parcel.obtain();
2557 Parcel reply = Parcel.obtain();
2558 data.writeInterfaceToken(IActivityManager.descriptor);
2559 data.writeStrongBinder(token);
2560 if (thumbnail != null) {
2561 data.writeInt(1);
2562 thumbnail.writeToParcel(data, 0);
2563 } else {
2564 data.writeInt(0);
2565 }
2566 TextUtils.writeToParcel(description, data, 0);
2567 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2568 reply.readException();
2569 data.recycle();
2570 reply.recycle();
2571 }
2572 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002573 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002574 Parcel data = Parcel.obtain();
2575 Parcel reply = Parcel.obtain();
2576 data.writeInterfaceToken(IActivityManager.descriptor);
2577 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2578 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002579 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002580 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002581 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2582 reply.readException();
2583 int res = reply.readInt();
2584 ContentProviderHolder cph = null;
2585 if (res != 0) {
2586 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2587 }
2588 data.recycle();
2589 reply.recycle();
2590 return cph;
2591 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002592 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2593 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002594 Parcel data = Parcel.obtain();
2595 Parcel reply = Parcel.obtain();
2596 data.writeInterfaceToken(IActivityManager.descriptor);
2597 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002598 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002599 data.writeStrongBinder(token);
2600 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2601 reply.readException();
2602 int res = reply.readInt();
2603 ContentProviderHolder cph = null;
2604 if (res != 0) {
2605 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2606 }
2607 data.recycle();
2608 reply.recycle();
2609 return cph;
2610 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002611 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002612 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002613 {
2614 Parcel data = Parcel.obtain();
2615 Parcel reply = Parcel.obtain();
2616 data.writeInterfaceToken(IActivityManager.descriptor);
2617 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2618 data.writeTypedList(providers);
2619 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2620 reply.readException();
2621 data.recycle();
2622 reply.recycle();
2623 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002624 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2625 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002626 Parcel data = Parcel.obtain();
2627 Parcel reply = Parcel.obtain();
2628 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002629 data.writeStrongBinder(connection);
2630 data.writeInt(stable);
2631 data.writeInt(unstable);
2632 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2633 reply.readException();
2634 boolean res = reply.readInt() != 0;
2635 data.recycle();
2636 reply.recycle();
2637 return res;
2638 }
2639 public void unstableProviderDied(IBinder connection) throws RemoteException {
2640 Parcel data = Parcel.obtain();
2641 Parcel reply = Parcel.obtain();
2642 data.writeInterfaceToken(IActivityManager.descriptor);
2643 data.writeStrongBinder(connection);
2644 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2645 reply.readException();
2646 data.recycle();
2647 reply.recycle();
2648 }
2649
2650 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2651 Parcel data = Parcel.obtain();
2652 Parcel reply = Parcel.obtain();
2653 data.writeInterfaceToken(IActivityManager.descriptor);
2654 data.writeStrongBinder(connection);
2655 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2657 reply.readException();
2658 data.recycle();
2659 reply.recycle();
2660 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002661
2662 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2663 Parcel data = Parcel.obtain();
2664 Parcel reply = Parcel.obtain();
2665 data.writeInterfaceToken(IActivityManager.descriptor);
2666 data.writeString(name);
2667 data.writeStrongBinder(token);
2668 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2669 reply.readException();
2670 data.recycle();
2671 reply.recycle();
2672 }
2673
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002674 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2675 throws RemoteException
2676 {
2677 Parcel data = Parcel.obtain();
2678 Parcel reply = Parcel.obtain();
2679 data.writeInterfaceToken(IActivityManager.descriptor);
2680 service.writeToParcel(data, 0);
2681 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2682 reply.readException();
2683 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2684 data.recycle();
2685 reply.recycle();
2686 return res;
2687 }
2688
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002689 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002690 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002691 {
2692 Parcel data = Parcel.obtain();
2693 Parcel reply = Parcel.obtain();
2694 data.writeInterfaceToken(IActivityManager.descriptor);
2695 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2696 service.writeToParcel(data, 0);
2697 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002698 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2700 reply.readException();
2701 ComponentName res = ComponentName.readFromParcel(reply);
2702 data.recycle();
2703 reply.recycle();
2704 return res;
2705 }
2706 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002707 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002708 {
2709 Parcel data = Parcel.obtain();
2710 Parcel reply = Parcel.obtain();
2711 data.writeInterfaceToken(IActivityManager.descriptor);
2712 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2713 service.writeToParcel(data, 0);
2714 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002715 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002716 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2717 reply.readException();
2718 int res = reply.readInt();
2719 reply.recycle();
2720 data.recycle();
2721 return res;
2722 }
2723 public boolean stopServiceToken(ComponentName className, IBinder token,
2724 int startId) throws RemoteException {
2725 Parcel data = Parcel.obtain();
2726 Parcel reply = Parcel.obtain();
2727 data.writeInterfaceToken(IActivityManager.descriptor);
2728 ComponentName.writeToParcel(className, data);
2729 data.writeStrongBinder(token);
2730 data.writeInt(startId);
2731 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2732 reply.readException();
2733 boolean res = reply.readInt() != 0;
2734 data.recycle();
2735 reply.recycle();
2736 return res;
2737 }
2738 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002739 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 ComponentName.writeToParcel(className, data);
2744 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002745 data.writeInt(id);
2746 if (notification != null) {
2747 data.writeInt(1);
2748 notification.writeToParcel(data, 0);
2749 } else {
2750 data.writeInt(0);
2751 }
2752 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002753 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2754 reply.readException();
2755 data.recycle();
2756 reply.recycle();
2757 }
2758 public int bindService(IApplicationThread caller, IBinder token,
2759 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002760 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002761 Parcel data = Parcel.obtain();
2762 Parcel reply = Parcel.obtain();
2763 data.writeInterfaceToken(IActivityManager.descriptor);
2764 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2765 data.writeStrongBinder(token);
2766 service.writeToParcel(data, 0);
2767 data.writeString(resolvedType);
2768 data.writeStrongBinder(connection.asBinder());
2769 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002770 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2772 reply.readException();
2773 int res = reply.readInt();
2774 data.recycle();
2775 reply.recycle();
2776 return res;
2777 }
2778 public boolean unbindService(IServiceConnection connection) throws RemoteException
2779 {
2780 Parcel data = Parcel.obtain();
2781 Parcel reply = Parcel.obtain();
2782 data.writeInterfaceToken(IActivityManager.descriptor);
2783 data.writeStrongBinder(connection.asBinder());
2784 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2785 reply.readException();
2786 boolean res = reply.readInt() != 0;
2787 data.recycle();
2788 reply.recycle();
2789 return res;
2790 }
2791
2792 public void publishService(IBinder token,
2793 Intent intent, IBinder service) throws RemoteException {
2794 Parcel data = Parcel.obtain();
2795 Parcel reply = Parcel.obtain();
2796 data.writeInterfaceToken(IActivityManager.descriptor);
2797 data.writeStrongBinder(token);
2798 intent.writeToParcel(data, 0);
2799 data.writeStrongBinder(service);
2800 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2801 reply.readException();
2802 data.recycle();
2803 reply.recycle();
2804 }
2805
2806 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2807 throws RemoteException {
2808 Parcel data = Parcel.obtain();
2809 Parcel reply = Parcel.obtain();
2810 data.writeInterfaceToken(IActivityManager.descriptor);
2811 data.writeStrongBinder(token);
2812 intent.writeToParcel(data, 0);
2813 data.writeInt(doRebind ? 1 : 0);
2814 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2815 reply.readException();
2816 data.recycle();
2817 reply.recycle();
2818 }
2819
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002820 public void serviceDoneExecuting(IBinder token, int type, int startId,
2821 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002822 Parcel data = Parcel.obtain();
2823 Parcel reply = Parcel.obtain();
2824 data.writeInterfaceToken(IActivityManager.descriptor);
2825 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002826 data.writeInt(type);
2827 data.writeInt(startId);
2828 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002829 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2830 reply.readException();
2831 data.recycle();
2832 reply.recycle();
2833 }
2834
2835 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2836 Parcel data = Parcel.obtain();
2837 Parcel reply = Parcel.obtain();
2838 data.writeInterfaceToken(IActivityManager.descriptor);
2839 service.writeToParcel(data, 0);
2840 data.writeString(resolvedType);
2841 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2842 reply.readException();
2843 IBinder binder = reply.readStrongBinder();
2844 reply.recycle();
2845 data.recycle();
2846 return binder;
2847 }
2848
Christopher Tate181fafa2009-05-14 11:12:14 -07002849 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2850 throws RemoteException {
2851 Parcel data = Parcel.obtain();
2852 Parcel reply = Parcel.obtain();
2853 data.writeInterfaceToken(IActivityManager.descriptor);
2854 app.writeToParcel(data, 0);
2855 data.writeInt(backupRestoreMode);
2856 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2857 reply.readException();
2858 boolean success = reply.readInt() != 0;
2859 reply.recycle();
2860 data.recycle();
2861 return success;
2862 }
2863
Christopher Tate346acb12012-10-15 19:20:25 -07002864 public void clearPendingBackup() throws RemoteException {
2865 Parcel data = Parcel.obtain();
2866 Parcel reply = Parcel.obtain();
2867 data.writeInterfaceToken(IActivityManager.descriptor);
2868 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
2869 reply.recycle();
2870 data.recycle();
2871 }
2872
Christopher Tate181fafa2009-05-14 11:12:14 -07002873 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2874 Parcel data = Parcel.obtain();
2875 Parcel reply = Parcel.obtain();
2876 data.writeInterfaceToken(IActivityManager.descriptor);
2877 data.writeString(packageName);
2878 data.writeStrongBinder(agent);
2879 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2880 reply.recycle();
2881 data.recycle();
2882 }
2883
2884 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2885 Parcel data = Parcel.obtain();
2886 Parcel reply = Parcel.obtain();
2887 data.writeInterfaceToken(IActivityManager.descriptor);
2888 app.writeToParcel(data, 0);
2889 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2890 reply.readException();
2891 reply.recycle();
2892 data.recycle();
2893 }
2894
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002895 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002896 int flags, Bundle arguments, IInstrumentationWatcher watcher,
2897 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002898 Parcel data = Parcel.obtain();
2899 Parcel reply = Parcel.obtain();
2900 data.writeInterfaceToken(IActivityManager.descriptor);
2901 ComponentName.writeToParcel(className, data);
2902 data.writeString(profileFile);
2903 data.writeInt(flags);
2904 data.writeBundle(arguments);
2905 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002906 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002907 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002908 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2909 reply.readException();
2910 boolean res = reply.readInt() != 0;
2911 reply.recycle();
2912 data.recycle();
2913 return res;
2914 }
2915
2916 public void finishInstrumentation(IApplicationThread target,
2917 int resultCode, Bundle results) throws RemoteException {
2918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 data.writeStrongBinder(target != null ? target.asBinder() : null);
2922 data.writeInt(resultCode);
2923 data.writeBundle(results);
2924 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2925 reply.readException();
2926 data.recycle();
2927 reply.recycle();
2928 }
2929 public Configuration getConfiguration() throws RemoteException
2930 {
2931 Parcel data = Parcel.obtain();
2932 Parcel reply = Parcel.obtain();
2933 data.writeInterfaceToken(IActivityManager.descriptor);
2934 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2935 reply.readException();
2936 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2937 reply.recycle();
2938 data.recycle();
2939 return res;
2940 }
2941 public void updateConfiguration(Configuration values) throws RemoteException
2942 {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 values.writeToParcel(data, 0);
2947 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 data.recycle();
2950 reply.recycle();
2951 }
2952 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2953 throws RemoteException {
2954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeStrongBinder(token);
2958 data.writeInt(requestedOrientation);
2959 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2960 reply.readException();
2961 data.recycle();
2962 reply.recycle();
2963 }
2964 public int getRequestedOrientation(IBinder token) throws RemoteException {
2965 Parcel data = Parcel.obtain();
2966 Parcel reply = Parcel.obtain();
2967 data.writeInterfaceToken(IActivityManager.descriptor);
2968 data.writeStrongBinder(token);
2969 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2970 reply.readException();
2971 int res = reply.readInt();
2972 data.recycle();
2973 reply.recycle();
2974 return res;
2975 }
2976 public ComponentName getActivityClassForToken(IBinder token)
2977 throws RemoteException {
2978 Parcel data = Parcel.obtain();
2979 Parcel reply = Parcel.obtain();
2980 data.writeInterfaceToken(IActivityManager.descriptor);
2981 data.writeStrongBinder(token);
2982 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2983 reply.readException();
2984 ComponentName res = ComponentName.readFromParcel(reply);
2985 data.recycle();
2986 reply.recycle();
2987 return res;
2988 }
2989 public String getPackageForToken(IBinder token) throws RemoteException
2990 {
2991 Parcel data = Parcel.obtain();
2992 Parcel reply = Parcel.obtain();
2993 data.writeInterfaceToken(IActivityManager.descriptor);
2994 data.writeStrongBinder(token);
2995 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2996 reply.readException();
2997 String res = reply.readString();
2998 data.recycle();
2999 reply.recycle();
3000 return res;
3001 }
3002 public IIntentSender getIntentSender(int type,
3003 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003004 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003005 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 Parcel data = Parcel.obtain();
3007 Parcel reply = Parcel.obtain();
3008 data.writeInterfaceToken(IActivityManager.descriptor);
3009 data.writeInt(type);
3010 data.writeString(packageName);
3011 data.writeStrongBinder(token);
3012 data.writeString(resultWho);
3013 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003014 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003015 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003016 data.writeTypedArray(intents, 0);
3017 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003018 } else {
3019 data.writeInt(0);
3020 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003021 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003022 if (options != null) {
3023 data.writeInt(1);
3024 options.writeToParcel(data, 0);
3025 } else {
3026 data.writeInt(0);
3027 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003028 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003029 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3030 reply.readException();
3031 IIntentSender res = IIntentSender.Stub.asInterface(
3032 reply.readStrongBinder());
3033 data.recycle();
3034 reply.recycle();
3035 return res;
3036 }
3037 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 data.writeStrongBinder(sender.asBinder());
3042 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3043 reply.readException();
3044 data.recycle();
3045 reply.recycle();
3046 }
3047 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3048 Parcel data = Parcel.obtain();
3049 Parcel reply = Parcel.obtain();
3050 data.writeInterfaceToken(IActivityManager.descriptor);
3051 data.writeStrongBinder(sender.asBinder());
3052 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3053 reply.readException();
3054 String res = reply.readString();
3055 data.recycle();
3056 reply.recycle();
3057 return res;
3058 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003059 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3060 Parcel data = Parcel.obtain();
3061 Parcel reply = Parcel.obtain();
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 data.writeStrongBinder(sender.asBinder());
3064 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3065 reply.readException();
3066 int res = reply.readInt();
3067 data.recycle();
3068 reply.recycle();
3069 return res;
3070 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003071 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3072 boolean requireFull, String name, String callerPackage) throws RemoteException {
3073 Parcel data = Parcel.obtain();
3074 Parcel reply = Parcel.obtain();
3075 data.writeInterfaceToken(IActivityManager.descriptor);
3076 data.writeInt(callingPid);
3077 data.writeInt(callingUid);
3078 data.writeInt(userId);
3079 data.writeInt(allowAll ? 1 : 0);
3080 data.writeInt(requireFull ? 1 : 0);
3081 data.writeString(name);
3082 data.writeString(callerPackage);
3083 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3084 reply.readException();
3085 int res = reply.readInt();
3086 data.recycle();
3087 reply.recycle();
3088 return res;
3089 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003090 public void setProcessLimit(int max) throws RemoteException
3091 {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeInt(max);
3096 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 data.recycle();
3099 reply.recycle();
3100 }
3101 public int getProcessLimit() throws RemoteException
3102 {
3103 Parcel data = Parcel.obtain();
3104 Parcel reply = Parcel.obtain();
3105 data.writeInterfaceToken(IActivityManager.descriptor);
3106 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3107 reply.readException();
3108 int res = reply.readInt();
3109 data.recycle();
3110 reply.recycle();
3111 return res;
3112 }
3113 public void setProcessForeground(IBinder token, int pid,
3114 boolean isForeground) throws RemoteException {
3115 Parcel data = Parcel.obtain();
3116 Parcel reply = Parcel.obtain();
3117 data.writeInterfaceToken(IActivityManager.descriptor);
3118 data.writeStrongBinder(token);
3119 data.writeInt(pid);
3120 data.writeInt(isForeground ? 1 : 0);
3121 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3122 reply.readException();
3123 data.recycle();
3124 reply.recycle();
3125 }
3126 public int checkPermission(String permission, int pid, int uid)
3127 throws RemoteException {
3128 Parcel data = Parcel.obtain();
3129 Parcel reply = Parcel.obtain();
3130 data.writeInterfaceToken(IActivityManager.descriptor);
3131 data.writeString(permission);
3132 data.writeInt(pid);
3133 data.writeInt(uid);
3134 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3135 reply.readException();
3136 int res = reply.readInt();
3137 data.recycle();
3138 reply.recycle();
3139 return res;
3140 }
3141 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003142 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003143 Parcel data = Parcel.obtain();
3144 Parcel reply = Parcel.obtain();
3145 data.writeInterfaceToken(IActivityManager.descriptor);
3146 data.writeString(packageName);
3147 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003148 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003149 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3150 reply.readException();
3151 boolean res = reply.readInt() != 0;
3152 data.recycle();
3153 reply.recycle();
3154 return res;
3155 }
3156 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3157 throws RemoteException {
3158 Parcel data = Parcel.obtain();
3159 Parcel reply = Parcel.obtain();
3160 data.writeInterfaceToken(IActivityManager.descriptor);
3161 uri.writeToParcel(data, 0);
3162 data.writeInt(pid);
3163 data.writeInt(uid);
3164 data.writeInt(mode);
3165 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3166 reply.readException();
3167 int res = reply.readInt();
3168 data.recycle();
3169 reply.recycle();
3170 return res;
3171 }
3172 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3173 Uri uri, int mode) throws RemoteException {
3174 Parcel data = Parcel.obtain();
3175 Parcel reply = Parcel.obtain();
3176 data.writeInterfaceToken(IActivityManager.descriptor);
3177 data.writeStrongBinder(caller.asBinder());
3178 data.writeString(targetPkg);
3179 uri.writeToParcel(data, 0);
3180 data.writeInt(mode);
3181 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3182 reply.readException();
3183 data.recycle();
3184 reply.recycle();
3185 }
3186 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3187 int mode) throws RemoteException {
3188 Parcel data = Parcel.obtain();
3189 Parcel reply = Parcel.obtain();
3190 data.writeInterfaceToken(IActivityManager.descriptor);
3191 data.writeStrongBinder(caller.asBinder());
3192 uri.writeToParcel(data, 0);
3193 data.writeInt(mode);
3194 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3195 reply.readException();
3196 data.recycle();
3197 reply.recycle();
3198 }
3199 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3200 throws RemoteException {
3201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeStrongBinder(who.asBinder());
3205 data.writeInt(waiting ? 1 : 0);
3206 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3207 reply.readException();
3208 data.recycle();
3209 reply.recycle();
3210 }
3211 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3216 reply.readException();
3217 outInfo.readFromParcel(reply);
3218 data.recycle();
3219 reply.recycle();
3220 }
3221 public void unhandledBack() throws RemoteException
3222 {
3223 Parcel data = Parcel.obtain();
3224 Parcel reply = Parcel.obtain();
3225 data.writeInterfaceToken(IActivityManager.descriptor);
3226 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3227 reply.readException();
3228 data.recycle();
3229 reply.recycle();
3230 }
3231 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3232 {
3233 Parcel data = Parcel.obtain();
3234 Parcel reply = Parcel.obtain();
3235 data.writeInterfaceToken(IActivityManager.descriptor);
3236 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 ParcelFileDescriptor pfd = null;
3239 if (reply.readInt() != 0) {
3240 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3241 }
3242 data.recycle();
3243 reply.recycle();
3244 return pfd;
3245 }
3246 public void goingToSleep() throws RemoteException
3247 {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3252 reply.readException();
3253 data.recycle();
3254 reply.recycle();
3255 }
3256 public void wakingUp() throws RemoteException
3257 {
3258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3262 reply.readException();
3263 data.recycle();
3264 reply.recycle();
3265 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003266 public void setLockScreenShown(boolean shown) throws RemoteException
3267 {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 data.writeInt(shown ? 1 : 0);
3272 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3273 reply.readException();
3274 data.recycle();
3275 reply.recycle();
3276 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003277 public void setDebugApp(
3278 String packageName, boolean waitForDebugger, boolean persistent)
3279 throws RemoteException
3280 {
3281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 data.writeString(packageName);
3285 data.writeInt(waitForDebugger ? 1 : 0);
3286 data.writeInt(persistent ? 1 : 0);
3287 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3288 reply.readException();
3289 data.recycle();
3290 reply.recycle();
3291 }
3292 public void setAlwaysFinish(boolean enabled) throws RemoteException
3293 {
3294 Parcel data = Parcel.obtain();
3295 Parcel reply = Parcel.obtain();
3296 data.writeInterfaceToken(IActivityManager.descriptor);
3297 data.writeInt(enabled ? 1 : 0);
3298 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3299 reply.readException();
3300 data.recycle();
3301 reply.recycle();
3302 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003303 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003304 {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003309 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003310 reply.readException();
3311 data.recycle();
3312 reply.recycle();
3313 }
3314 public void enterSafeMode() throws RemoteException {
3315 Parcel data = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3318 data.recycle();
3319 }
3320 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 data.writeStrongBinder(sender.asBinder());
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3325 data.recycle();
3326 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003327 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003332 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003333 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003334 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003335 boolean res = reply.readInt() != 0;
3336 data.recycle();
3337 reply.recycle();
3338 return res;
3339 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003340 @Override
3341 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3342 Parcel data = Parcel.obtain();
3343 Parcel reply = Parcel.obtain();
3344 data.writeInterfaceToken(IActivityManager.descriptor);
3345 data.writeString(reason);
3346 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3347 boolean res = reply.readInt() != 0;
3348 data.recycle();
3349 reply.recycle();
3350 return res;
3351 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003352 public void startRunning(String pkg, String cls, String action,
3353 String indata) throws RemoteException {
3354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
3356 data.writeInterfaceToken(IActivityManager.descriptor);
3357 data.writeString(pkg);
3358 data.writeString(cls);
3359 data.writeString(action);
3360 data.writeString(indata);
3361 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3362 reply.readException();
3363 data.recycle();
3364 reply.recycle();
3365 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003366 public boolean testIsSystemReady()
3367 {
3368 /* this base class version is never called */
3369 return true;
3370 }
Dan Egnor60d87622009-12-16 16:32:58 -08003371 public void handleApplicationCrash(IBinder app,
3372 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3373 {
3374 Parcel data = Parcel.obtain();
3375 Parcel reply = Parcel.obtain();
3376 data.writeInterfaceToken(IActivityManager.descriptor);
3377 data.writeStrongBinder(app);
3378 crashInfo.writeToParcel(data, 0);
3379 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3380 reply.readException();
3381 reply.recycle();
3382 data.recycle();
3383 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003384
Dan Egnor60d87622009-12-16 16:32:58 -08003385 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003386 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003387 {
3388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003392 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003393 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003394 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003395 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003396 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003397 reply.recycle();
3398 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003399 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003400 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003401
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003402 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003403 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003404 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003405 {
3406 Parcel data = Parcel.obtain();
3407 Parcel reply = Parcel.obtain();
3408 data.writeInterfaceToken(IActivityManager.descriptor);
3409 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003410 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003411 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003412 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3413 reply.readException();
3414 reply.recycle();
3415 data.recycle();
3416 }
3417
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003418 public void signalPersistentProcesses(int sig) throws RemoteException {
3419 Parcel data = Parcel.obtain();
3420 Parcel reply = Parcel.obtain();
3421 data.writeInterfaceToken(IActivityManager.descriptor);
3422 data.writeInt(sig);
3423 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3424 reply.readException();
3425 data.recycle();
3426 reply.recycle();
3427 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003428
Dianne Hackborn1676c852012-09-10 14:52:30 -07003429 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003430 Parcel data = Parcel.obtain();
3431 Parcel reply = Parcel.obtain();
3432 data.writeInterfaceToken(IActivityManager.descriptor);
3433 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003434 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003435 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3436 reply.readException();
3437 data.recycle();
3438 reply.recycle();
3439 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003440
3441 public void killAllBackgroundProcesses() throws RemoteException {
3442 Parcel data = Parcel.obtain();
3443 Parcel reply = Parcel.obtain();
3444 data.writeInterfaceToken(IActivityManager.descriptor);
3445 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3446 reply.readException();
3447 data.recycle();
3448 reply.recycle();
3449 }
3450
Dianne Hackborn1676c852012-09-10 14:52:30 -07003451 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003452 Parcel data = Parcel.obtain();
3453 Parcel reply = Parcel.obtain();
3454 data.writeInterfaceToken(IActivityManager.descriptor);
3455 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003456 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003457 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003458 reply.readException();
3459 data.recycle();
3460 reply.recycle();
3461 }
3462
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003463 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3464 throws RemoteException
3465 {
3466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
3468 data.writeInterfaceToken(IActivityManager.descriptor);
3469 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3470 reply.readException();
3471 outInfo.readFromParcel(reply);
3472 reply.recycle();
3473 data.recycle();
3474 }
3475
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003476 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3477 {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3482 reply.readException();
3483 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3484 reply.recycle();
3485 data.recycle();
3486 return res;
3487 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003488
Dianne Hackborn1676c852012-09-10 14:52:30 -07003489 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003490 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003491 {
3492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003496 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003497 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003498 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003499 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003500 if (fd != null) {
3501 data.writeInt(1);
3502 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3503 } else {
3504 data.writeInt(0);
3505 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003506 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 boolean res = reply.readInt() != 0;
3509 reply.recycle();
3510 data.recycle();
3511 return res;
3512 }
3513
Dianne Hackborn55280a92009-05-07 15:53:46 -07003514 public boolean shutdown(int timeout) throws RemoteException
3515 {
3516 Parcel data = Parcel.obtain();
3517 Parcel reply = Parcel.obtain();
3518 data.writeInterfaceToken(IActivityManager.descriptor);
3519 data.writeInt(timeout);
3520 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3521 reply.readException();
3522 boolean res = reply.readInt() != 0;
3523 reply.recycle();
3524 data.recycle();
3525 return res;
3526 }
3527
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003528 public void stopAppSwitches() throws RemoteException {
3529 Parcel data = Parcel.obtain();
3530 Parcel reply = Parcel.obtain();
3531 data.writeInterfaceToken(IActivityManager.descriptor);
3532 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3533 reply.readException();
3534 reply.recycle();
3535 data.recycle();
3536 }
3537
3538 public void resumeAppSwitches() throws RemoteException {
3539 Parcel data = Parcel.obtain();
3540 Parcel reply = Parcel.obtain();
3541 data.writeInterfaceToken(IActivityManager.descriptor);
3542 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3543 reply.readException();
3544 reply.recycle();
3545 data.recycle();
3546 }
3547
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003548 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003549 Parcel data = Parcel.obtain();
3550 Parcel reply = Parcel.obtain();
3551 data.writeInterfaceToken(IActivityManager.descriptor);
3552 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003553 data.writeInt(appid);
3554 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003555 reply.readException();
3556 data.recycle();
3557 reply.recycle();
3558 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003559
3560 public void closeSystemDialogs(String reason) throws RemoteException {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 data.writeString(reason);
3565 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3566 reply.readException();
3567 data.recycle();
3568 reply.recycle();
3569 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003570
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003571 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003572 throws RemoteException {
3573 Parcel data = Parcel.obtain();
3574 Parcel reply = Parcel.obtain();
3575 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003576 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003577 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3578 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003579 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003580 data.recycle();
3581 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003582 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003583 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003584
3585 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3586 Parcel data = Parcel.obtain();
3587 Parcel reply = Parcel.obtain();
3588 data.writeInterfaceToken(IActivityManager.descriptor);
3589 data.writeString(processName);
3590 data.writeInt(uid);
3591 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3592 reply.readException();
3593 data.recycle();
3594 reply.recycle();
3595 }
3596
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003597 public void overridePendingTransition(IBinder token, String packageName,
3598 int enterAnim, int exitAnim) throws RemoteException {
3599 Parcel data = Parcel.obtain();
3600 Parcel reply = Parcel.obtain();
3601 data.writeInterfaceToken(IActivityManager.descriptor);
3602 data.writeStrongBinder(token);
3603 data.writeString(packageName);
3604 data.writeInt(enterAnim);
3605 data.writeInt(exitAnim);
3606 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3607 reply.readException();
3608 data.recycle();
3609 reply.recycle();
3610 }
3611
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003612 public boolean isUserAMonkey() throws RemoteException {
3613 Parcel data = Parcel.obtain();
3614 Parcel reply = Parcel.obtain();
3615 data.writeInterfaceToken(IActivityManager.descriptor);
3616 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3617 reply.readException();
3618 boolean res = reply.readInt() != 0;
3619 data.recycle();
3620 reply.recycle();
3621 return res;
3622 }
3623
Dianne Hackborn860755f2010-06-03 18:47:52 -07003624 public void finishHeavyWeightApp() throws RemoteException {
3625 Parcel data = Parcel.obtain();
3626 Parcel reply = Parcel.obtain();
3627 data.writeInterfaceToken(IActivityManager.descriptor);
3628 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3629 reply.readException();
3630 data.recycle();
3631 reply.recycle();
3632 }
3633
Daniel Sandler69a48172010-06-23 16:29:36 -04003634 public void setImmersive(IBinder token, boolean immersive)
3635 throws RemoteException {
3636 Parcel data = Parcel.obtain();
3637 Parcel reply = Parcel.obtain();
3638 data.writeInterfaceToken(IActivityManager.descriptor);
3639 data.writeStrongBinder(token);
3640 data.writeInt(immersive ? 1 : 0);
3641 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3642 reply.readException();
3643 data.recycle();
3644 reply.recycle();
3645 }
3646
3647 public boolean isImmersive(IBinder token)
3648 throws RemoteException {
3649 Parcel data = Parcel.obtain();
3650 Parcel reply = Parcel.obtain();
3651 data.writeInterfaceToken(IActivityManager.descriptor);
3652 data.writeStrongBinder(token);
3653 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003654 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003655 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003656 data.recycle();
3657 reply.recycle();
3658 return res;
3659 }
3660
3661 public boolean isTopActivityImmersive()
3662 throws RemoteException {
3663 Parcel data = Parcel.obtain();
3664 Parcel reply = Parcel.obtain();
3665 data.writeInterfaceToken(IActivityManager.descriptor);
3666 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003667 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003668 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003669 data.recycle();
3670 reply.recycle();
3671 return res;
3672 }
3673
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003674 public void crashApplication(int uid, int initialPid, String packageName,
3675 String message) throws RemoteException {
3676 Parcel data = Parcel.obtain();
3677 Parcel reply = Parcel.obtain();
3678 data.writeInterfaceToken(IActivityManager.descriptor);
3679 data.writeInt(uid);
3680 data.writeInt(initialPid);
3681 data.writeString(packageName);
3682 data.writeString(message);
3683 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 data.recycle();
3686 reply.recycle();
3687 }
Andy McFadden824c5102010-07-09 16:26:57 -07003688
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003689 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003694 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003695 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3696 reply.readException();
3697 String res = reply.readString();
3698 data.recycle();
3699 reply.recycle();
3700 return res;
3701 }
3702
Dianne Hackborn7e269642010-08-25 19:50:20 -07003703 public IBinder newUriPermissionOwner(String name)
3704 throws RemoteException {
3705 Parcel data = Parcel.obtain();
3706 Parcel reply = Parcel.obtain();
3707 data.writeInterfaceToken(IActivityManager.descriptor);
3708 data.writeString(name);
3709 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3710 reply.readException();
3711 IBinder res = reply.readStrongBinder();
3712 data.recycle();
3713 reply.recycle();
3714 return res;
3715 }
3716
3717 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3718 Uri uri, int mode) throws RemoteException {
3719 Parcel data = Parcel.obtain();
3720 Parcel reply = Parcel.obtain();
3721 data.writeInterfaceToken(IActivityManager.descriptor);
3722 data.writeStrongBinder(owner);
3723 data.writeInt(fromUid);
3724 data.writeString(targetPkg);
3725 uri.writeToParcel(data, 0);
3726 data.writeInt(mode);
3727 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3728 reply.readException();
3729 data.recycle();
3730 reply.recycle();
3731 }
3732
3733 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3734 int mode) throws RemoteException {
3735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 data.writeStrongBinder(owner);
3739 if (uri != null) {
3740 data.writeInt(1);
3741 uri.writeToParcel(data, 0);
3742 } else {
3743 data.writeInt(0);
3744 }
3745 data.writeInt(mode);
3746 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3747 reply.readException();
3748 data.recycle();
3749 reply.recycle();
3750 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003751
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003752 public int checkGrantUriPermission(int callingUid, String targetPkg,
3753 Uri uri, int modeFlags) throws RemoteException {
3754 Parcel data = Parcel.obtain();
3755 Parcel reply = Parcel.obtain();
3756 data.writeInterfaceToken(IActivityManager.descriptor);
3757 data.writeInt(callingUid);
3758 data.writeString(targetPkg);
3759 uri.writeToParcel(data, 0);
3760 data.writeInt(modeFlags);
3761 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3762 reply.readException();
3763 int res = reply.readInt();
3764 data.recycle();
3765 reply.recycle();
3766 return res;
3767 }
3768
Dianne Hackborn1676c852012-09-10 14:52:30 -07003769 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003770 String path, ParcelFileDescriptor fd) throws RemoteException {
3771 Parcel data = Parcel.obtain();
3772 Parcel reply = Parcel.obtain();
3773 data.writeInterfaceToken(IActivityManager.descriptor);
3774 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003775 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003776 data.writeInt(managed ? 1 : 0);
3777 data.writeString(path);
3778 if (fd != null) {
3779 data.writeInt(1);
3780 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3781 } else {
3782 data.writeInt(0);
3783 }
3784 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3785 reply.readException();
3786 boolean res = reply.readInt() != 0;
3787 reply.recycle();
3788 data.recycle();
3789 return res;
3790 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003791
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003792 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003793 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003794 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003795 Parcel data = Parcel.obtain();
3796 Parcel reply = Parcel.obtain();
3797 data.writeInterfaceToken(IActivityManager.descriptor);
3798 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003799 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003800 data.writeTypedArray(intents, 0);
3801 data.writeStringArray(resolvedTypes);
3802 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003803 if (options != null) {
3804 data.writeInt(1);
3805 options.writeToParcel(data, 0);
3806 } else {
3807 data.writeInt(0);
3808 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003809 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003810 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3811 reply.readException();
3812 int result = reply.readInt();
3813 reply.recycle();
3814 data.recycle();
3815 return result;
3816 }
3817
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003818 public int getFrontActivityScreenCompatMode() throws RemoteException {
3819 Parcel data = Parcel.obtain();
3820 Parcel reply = Parcel.obtain();
3821 data.writeInterfaceToken(IActivityManager.descriptor);
3822 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3823 reply.readException();
3824 int mode = reply.readInt();
3825 reply.recycle();
3826 data.recycle();
3827 return mode;
3828 }
3829
3830 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3831 Parcel data = Parcel.obtain();
3832 Parcel reply = Parcel.obtain();
3833 data.writeInterfaceToken(IActivityManager.descriptor);
3834 data.writeInt(mode);
3835 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3836 reply.readException();
3837 reply.recycle();
3838 data.recycle();
3839 }
3840
3841 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3842 Parcel data = Parcel.obtain();
3843 Parcel reply = Parcel.obtain();
3844 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003845 data.writeString(packageName);
3846 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003847 reply.readException();
3848 int mode = reply.readInt();
3849 reply.recycle();
3850 data.recycle();
3851 return mode;
3852 }
3853
3854 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003855 throws RemoteException {
3856 Parcel data = Parcel.obtain();
3857 Parcel reply = Parcel.obtain();
3858 data.writeInterfaceToken(IActivityManager.descriptor);
3859 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003860 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003861 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3862 reply.readException();
3863 reply.recycle();
3864 data.recycle();
3865 }
3866
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003867 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3868 Parcel data = Parcel.obtain();
3869 Parcel reply = Parcel.obtain();
3870 data.writeInterfaceToken(IActivityManager.descriptor);
3871 data.writeString(packageName);
3872 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3873 reply.readException();
3874 boolean ask = reply.readInt() != 0;
3875 reply.recycle();
3876 data.recycle();
3877 return ask;
3878 }
3879
3880 public void setPackageAskScreenCompat(String packageName, boolean ask)
3881 throws RemoteException {
3882 Parcel data = Parcel.obtain();
3883 Parcel reply = Parcel.obtain();
3884 data.writeInterfaceToken(IActivityManager.descriptor);
3885 data.writeString(packageName);
3886 data.writeInt(ask ? 1 : 0);
3887 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3888 reply.readException();
3889 reply.recycle();
3890 data.recycle();
3891 }
3892
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003893 public boolean switchUser(int userid) throws RemoteException {
3894 Parcel data = Parcel.obtain();
3895 Parcel reply = Parcel.obtain();
3896 data.writeInterfaceToken(IActivityManager.descriptor);
3897 data.writeInt(userid);
3898 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3899 reply.readException();
3900 boolean result = reply.readInt() != 0;
3901 reply.recycle();
3902 data.recycle();
3903 return result;
3904 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003905
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003906 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3907 Parcel data = Parcel.obtain();
3908 Parcel reply = Parcel.obtain();
3909 data.writeInterfaceToken(IActivityManager.descriptor);
3910 data.writeInt(userid);
3911 data.writeStrongInterface(callback);
3912 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3913 reply.readException();
3914 int result = reply.readInt();
3915 reply.recycle();
3916 data.recycle();
3917 return result;
3918 }
3919
Amith Yamasani52f1d752012-03-28 18:19:29 -07003920 public UserInfo getCurrentUser() throws RemoteException {
3921 Parcel data = Parcel.obtain();
3922 Parcel reply = Parcel.obtain();
3923 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003924 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003925 reply.readException();
3926 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3927 reply.recycle();
3928 data.recycle();
3929 return userInfo;
3930 }
3931
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003932 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003933 Parcel data = Parcel.obtain();
3934 Parcel reply = Parcel.obtain();
3935 data.writeInterfaceToken(IActivityManager.descriptor);
3936 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003937 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003938 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3939 reply.readException();
3940 boolean result = reply.readInt() != 0;
3941 reply.recycle();
3942 data.recycle();
3943 return result;
3944 }
3945
Dianne Hackbornc72fc672012-09-20 13:12:03 -07003946 public int[] getRunningUserIds() throws RemoteException {
3947 Parcel data = Parcel.obtain();
3948 Parcel reply = Parcel.obtain();
3949 data.writeInterfaceToken(IActivityManager.descriptor);
3950 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
3951 reply.readException();
3952 int[] result = reply.createIntArray();
3953 reply.recycle();
3954 data.recycle();
3955 return result;
3956 }
3957
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003958 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3959 Parcel data = Parcel.obtain();
3960 Parcel reply = Parcel.obtain();
3961 data.writeInterfaceToken(IActivityManager.descriptor);
3962 data.writeInt(taskId);
3963 data.writeInt(subTaskIndex);
3964 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3965 reply.readException();
3966 boolean result = reply.readInt() != 0;
3967 reply.recycle();
3968 data.recycle();
3969 return result;
3970 }
3971
3972 public boolean removeTask(int taskId, int flags) throws RemoteException {
3973 Parcel data = Parcel.obtain();
3974 Parcel reply = Parcel.obtain();
3975 data.writeInterfaceToken(IActivityManager.descriptor);
3976 data.writeInt(taskId);
3977 data.writeInt(flags);
3978 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3979 reply.readException();
3980 boolean result = reply.readInt() != 0;
3981 reply.recycle();
3982 data.recycle();
3983 return result;
3984 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003985
Jeff Sharkeya4620792011-05-20 15:29:23 -07003986 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3987 Parcel data = Parcel.obtain();
3988 Parcel reply = Parcel.obtain();
3989 data.writeInterfaceToken(IActivityManager.descriptor);
3990 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3991 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3992 reply.readException();
3993 data.recycle();
3994 reply.recycle();
3995 }
3996
3997 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3998 Parcel data = Parcel.obtain();
3999 Parcel reply = Parcel.obtain();
4000 data.writeInterfaceToken(IActivityManager.descriptor);
4001 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4002 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4003 reply.readException();
4004 data.recycle();
4005 reply.recycle();
4006 }
4007
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004008 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4009 Parcel data = Parcel.obtain();
4010 Parcel reply = Parcel.obtain();
4011 data.writeInterfaceToken(IActivityManager.descriptor);
4012 data.writeStrongBinder(sender.asBinder());
4013 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4014 reply.readException();
4015 boolean res = reply.readInt() != 0;
4016 data.recycle();
4017 reply.recycle();
4018 return res;
4019 }
4020
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004021 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4022 Parcel data = Parcel.obtain();
4023 Parcel reply = Parcel.obtain();
4024 data.writeInterfaceToken(IActivityManager.descriptor);
4025 data.writeStrongBinder(sender.asBinder());
4026 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4027 reply.readException();
4028 boolean res = reply.readInt() != 0;
4029 data.recycle();
4030 reply.recycle();
4031 return res;
4032 }
4033
Dianne Hackborn81038902012-11-26 17:04:09 -08004034 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4035 Parcel data = Parcel.obtain();
4036 Parcel reply = Parcel.obtain();
4037 data.writeInterfaceToken(IActivityManager.descriptor);
4038 data.writeStrongBinder(sender.asBinder());
4039 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4040 reply.readException();
4041 Intent res = reply.readInt() != 0
4042 ? Intent.CREATOR.createFromParcel(reply) : null;
4043 data.recycle();
4044 reply.recycle();
4045 return res;
4046 }
4047
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004048 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4049 {
4050 Parcel data = Parcel.obtain();
4051 Parcel reply = Parcel.obtain();
4052 data.writeInterfaceToken(IActivityManager.descriptor);
4053 values.writeToParcel(data, 0);
4054 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4055 reply.readException();
4056 data.recycle();
4057 reply.recycle();
4058 }
4059
Dianne Hackbornb437e092011-08-05 17:50:29 -07004060 public long[] getProcessPss(int[] pids) throws RemoteException {
4061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 data.writeIntArray(pids);
4065 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 long[] res = reply.createLongArray();
4068 data.recycle();
4069 reply.recycle();
4070 return res;
4071 }
4072
Dianne Hackborn661cd522011-08-22 00:26:20 -07004073 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4074 Parcel data = Parcel.obtain();
4075 Parcel reply = Parcel.obtain();
4076 data.writeInterfaceToken(IActivityManager.descriptor);
4077 TextUtils.writeToParcel(msg, data, 0);
4078 data.writeInt(always ? 1 : 0);
4079 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4080 reply.readException();
4081 data.recycle();
4082 reply.recycle();
4083 }
4084
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004085 public void dismissKeyguardOnNextActivity() throws RemoteException {
4086 Parcel data = Parcel.obtain();
4087 Parcel reply = Parcel.obtain();
4088 data.writeInterfaceToken(IActivityManager.descriptor);
4089 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4090 reply.readException();
4091 data.recycle();
4092 reply.recycle();
4093 }
4094
Adam Powelldd8fab22012-03-22 17:47:27 -07004095 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4096 throws RemoteException {
4097 Parcel data = Parcel.obtain();
4098 Parcel reply = Parcel.obtain();
4099 data.writeInterfaceToken(IActivityManager.descriptor);
4100 data.writeStrongBinder(token);
4101 data.writeString(destAffinity);
4102 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4103 reply.readException();
4104 boolean result = reply.readInt() != 0;
4105 data.recycle();
4106 reply.recycle();
4107 return result;
4108 }
4109
4110 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4111 throws RemoteException {
4112 Parcel data = Parcel.obtain();
4113 Parcel reply = Parcel.obtain();
4114 data.writeInterfaceToken(IActivityManager.descriptor);
4115 data.writeStrongBinder(token);
4116 target.writeToParcel(data, 0);
4117 data.writeInt(resultCode);
4118 if (resultData != null) {
4119 data.writeInt(1);
4120 resultData.writeToParcel(data, 0);
4121 } else {
4122 data.writeInt(0);
4123 }
4124 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4125 reply.readException();
4126 boolean result = reply.readInt() != 0;
4127 data.recycle();
4128 reply.recycle();
4129 return result;
4130 }
4131
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004132 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4133 Parcel data = Parcel.obtain();
4134 Parcel reply = Parcel.obtain();
4135 data.writeInterfaceToken(IActivityManager.descriptor);
4136 data.writeStrongBinder(activityToken);
4137 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4138 reply.readException();
4139 int result = reply.readInt();
4140 data.recycle();
4141 reply.recycle();
4142 return result;
4143 }
4144
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004145 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4146 Parcel data = Parcel.obtain();
4147 Parcel reply = Parcel.obtain();
4148 data.writeInterfaceToken(IActivityManager.descriptor);
4149 data.writeStrongBinder(activityToken);
4150 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4151 reply.readException();
4152 String result = reply.readString();
4153 data.recycle();
4154 reply.recycle();
4155 return result;
4156 }
4157
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004158 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4159 Parcel data = Parcel.obtain();
4160 Parcel reply = Parcel.obtain();
4161 data.writeInterfaceToken(IActivityManager.descriptor);
4162 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4163 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4164 reply.readException();
4165 data.recycle();
4166 reply.recycle();
4167 }
4168
4169 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4170 Parcel data = Parcel.obtain();
4171 Parcel reply = Parcel.obtain();
4172 data.writeInterfaceToken(IActivityManager.descriptor);
4173 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4174 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4175 reply.readException();
4176 data.recycle();
4177 reply.recycle();
4178 }
4179
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004180 public void requestBugReport() throws RemoteException {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4185 reply.readException();
4186 data.recycle();
4187 reply.recycle();
4188 }
4189
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004190 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4191 Parcel data = Parcel.obtain();
4192 Parcel reply = Parcel.obtain();
4193 data.writeInterfaceToken(IActivityManager.descriptor);
4194 data.writeInt(pid);
4195 data.writeInt(aboveSystem ? 1 : 0);
4196 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4197 reply.readException();
4198 long res = reply.readInt();
4199 data.recycle();
4200 reply.recycle();
4201 return res;
4202 }
4203
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004204 public Bundle getTopActivityExtras(int requestType) throws RemoteException {
4205 Parcel data = Parcel.obtain();
4206 Parcel reply = Parcel.obtain();
4207 data.writeInterfaceToken(IActivityManager.descriptor);
4208 data.writeInt(requestType);
4209 mRemote.transact(GET_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4210 reply.readException();
4211 Bundle res = reply.readBundle();
4212 data.recycle();
4213 reply.recycle();
4214 return res;
4215 }
4216
4217 public void reportTopActivityExtras(IBinder token, Bundle extras) throws RemoteException {
4218 Parcel data = Parcel.obtain();
4219 Parcel reply = Parcel.obtain();
4220 data.writeInterfaceToken(IActivityManager.descriptor);
4221 data.writeStrongBinder(token);
4222 data.writeBundle(extras);
4223 mRemote.transact(REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4224 reply.readException();
4225 data.recycle();
4226 reply.recycle();
4227 }
4228
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004229 private IBinder mRemote;
4230}