blob: 83be92b864bd91a2cc3779f51631072b7b640091 [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 Hackbornf51f6122013-02-04 18:23:34 -080095 null /*permission*/, AppOpsManager.OP_NONE, 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();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800347 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 boolean serialized = data.readInt() != 0;
349 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700350 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800352 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700353 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res);
356 return true;
357 }
358
359 case UNBROADCAST_INTENT_TRANSACTION:
360 {
361 data.enforceInterface(IActivityManager.descriptor);
362 IBinder b = data.readStrongBinder();
363 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
364 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700365 int userId = data.readInt();
366 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800367 reply.writeNoException();
368 return true;
369 }
370
371 case FINISH_RECEIVER_TRANSACTION: {
372 data.enforceInterface(IActivityManager.descriptor);
373 IBinder who = data.readStrongBinder();
374 int resultCode = data.readInt();
375 String resultData = data.readString();
376 Bundle resultExtras = data.readBundle();
377 boolean resultAbort = data.readInt() != 0;
378 if (who != null) {
379 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
380 }
381 reply.writeNoException();
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case ATTACH_APPLICATION_TRANSACTION: {
386 data.enforceInterface(IActivityManager.descriptor);
387 IApplicationThread app = ApplicationThreadNative.asInterface(
388 data.readStrongBinder());
389 if (app != null) {
390 attachApplication(app);
391 }
392 reply.writeNoException();
393 return true;
394 }
395
396 case ACTIVITY_IDLE_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700399 Configuration config = null;
400 if (data.readInt() != 0) {
401 config = Configuration.CREATOR.createFromParcel(data);
402 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700403 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800404 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700405 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 }
407 reply.writeNoException();
408 return true;
409 }
410
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700411 case ACTIVITY_RESUMED_TRANSACTION: {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder token = data.readStrongBinder();
414 activityResumed(token);
415 reply.writeNoException();
416 return true;
417 }
418
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 case ACTIVITY_PAUSED_TRANSACTION: {
420 data.enforceInterface(IActivityManager.descriptor);
421 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800422 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 reply.writeNoException();
424 return true;
425 }
426
427 case ACTIVITY_STOPPED_TRANSACTION: {
428 data.enforceInterface(IActivityManager.descriptor);
429 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800430 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 Bitmap thumbnail = data.readInt() != 0
432 ? Bitmap.CREATOR.createFromParcel(data) : null;
433 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800434 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800435 reply.writeNoException();
436 return true;
437 }
438
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800439 case ACTIVITY_SLEPT_TRANSACTION: {
440 data.enforceInterface(IActivityManager.descriptor);
441 IBinder token = data.readStrongBinder();
442 activitySlept(token);
443 reply.writeNoException();
444 return true;
445 }
446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 case ACTIVITY_DESTROYED_TRANSACTION: {
448 data.enforceInterface(IActivityManager.descriptor);
449 IBinder token = data.readStrongBinder();
450 activityDestroyed(token);
451 reply.writeNoException();
452 return true;
453 }
454
455 case GET_CALLING_PACKAGE_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
458 String res = token != null ? getCallingPackage(token) : null;
459 reply.writeNoException();
460 reply.writeString(res);
461 return true;
462 }
463
464 case GET_CALLING_ACTIVITY_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
467 ComponentName cn = getCallingActivity(token);
468 reply.writeNoException();
469 ComponentName.writeToParcel(cn, reply);
470 return true;
471 }
472
473 case GET_TASKS_TRANSACTION: {
474 data.enforceInterface(IActivityManager.descriptor);
475 int maxNum = data.readInt();
476 int fl = data.readInt();
477 IBinder receiverBinder = data.readStrongBinder();
478 IThumbnailReceiver receiver = receiverBinder != null
479 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
480 : null;
481 List list = getTasks(maxNum, fl, receiver);
482 reply.writeNoException();
483 int N = list != null ? list.size() : -1;
484 reply.writeInt(N);
485 int i;
486 for (i=0; i<N; i++) {
487 ActivityManager.RunningTaskInfo info =
488 (ActivityManager.RunningTaskInfo)list.get(i);
489 info.writeToParcel(reply, 0);
490 }
491 return true;
492 }
493
494 case GET_RECENT_TASKS_TRANSACTION: {
495 data.enforceInterface(IActivityManager.descriptor);
496 int maxNum = data.readInt();
497 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700498 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700500 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 reply.writeNoException();
502 reply.writeTypedList(list);
503 return true;
504 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700505
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700506 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800507 data.enforceInterface(IActivityManager.descriptor);
508 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700509 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800510 reply.writeNoException();
511 if (bm != null) {
512 reply.writeInt(1);
513 bm.writeToParcel(reply, 0);
514 } else {
515 reply.writeInt(0);
516 }
517 return true;
518 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700519
520 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
521 data.enforceInterface(IActivityManager.descriptor);
522 int id = data.readInt();
523 Bitmap bm = getTaskTopThumbnail(id);
524 reply.writeNoException();
525 if (bm != null) {
526 reply.writeInt(1);
527 bm.writeToParcel(reply, 0);
528 } else {
529 reply.writeInt(0);
530 }
531 return true;
532 }
533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 case GET_SERVICES_TRANSACTION: {
535 data.enforceInterface(IActivityManager.descriptor);
536 int maxNum = data.readInt();
537 int fl = data.readInt();
538 List list = getServices(maxNum, fl);
539 reply.writeNoException();
540 int N = list != null ? list.size() : -1;
541 reply.writeInt(N);
542 int i;
543 for (i=0; i<N; i++) {
544 ActivityManager.RunningServiceInfo info =
545 (ActivityManager.RunningServiceInfo)list.get(i);
546 info.writeToParcel(reply, 0);
547 }
548 return true;
549 }
550
551 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
552 data.enforceInterface(IActivityManager.descriptor);
553 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
554 reply.writeNoException();
555 reply.writeTypedList(list);
556 return true;
557 }
558
559 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
560 data.enforceInterface(IActivityManager.descriptor);
561 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
562 reply.writeNoException();
563 reply.writeTypedList(list);
564 return true;
565 }
566
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700567 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 List<ApplicationInfo> list = getRunningExternalApplications();
570 reply.writeNoException();
571 reply.writeTypedList(list);
572 return true;
573 }
574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 case MOVE_TASK_TO_FRONT_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800578 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700579 Bundle options = data.readInt() != 0
580 ? Bundle.CREATOR.createFromParcel(data) : null;
581 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 reply.writeNoException();
583 return true;
584 }
585
586 case MOVE_TASK_TO_BACK_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 int task = data.readInt();
589 moveTaskToBack(task);
590 reply.writeNoException();
591 return true;
592 }
593
594 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder token = data.readStrongBinder();
597 boolean nonRoot = data.readInt() != 0;
598 boolean res = moveActivityTaskToBack(token, nonRoot);
599 reply.writeNoException();
600 reply.writeInt(res ? 1 : 0);
601 return true;
602 }
603
604 case MOVE_TASK_BACKWARDS_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 int task = data.readInt();
607 moveTaskBackwards(task);
608 reply.writeNoException();
609 return true;
610 }
611
Craig Mautnerc00204b2013-03-05 15:02:14 -0800612 case CREATE_STACK_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
614 int position = data.readInt();
615 int relativeStackId = data.readInt();
616 float weight = data.readFloat();
617 int res = createStack(position, relativeStackId, weight);
618 reply.writeNoException();
619 reply.writeInt(res);
620 return true;
621 }
622
623 case MOVE_TASK_TO_STACK_TRANSACTION: {
624 data.enforceInterface(IActivityManager.descriptor);
625 int taskId = data.readInt();
626 int stackId = data.readInt();
627 boolean toTop = data.readInt() != 0;
628 moveTaskToStack(taskId, stackId, toTop);
629 reply.writeNoException();
630 return true;
631 }
632
633 case RESIZE_STACK_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 int stackId = data.readInt();
636 float weight = data.readFloat();
637 resizeStack(stackId, weight);
638 reply.writeNoException();
639 return true;
640 }
641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 IBinder token = data.readStrongBinder();
645 boolean onlyRoot = data.readInt() != 0;
646 int res = token != null
647 ? getTaskForActivity(token, onlyRoot) : -1;
648 reply.writeNoException();
649 reply.writeInt(res);
650 return true;
651 }
652
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800653 case REPORT_THUMBNAIL_TRANSACTION: {
654 data.enforceInterface(IActivityManager.descriptor);
655 IBinder token = data.readStrongBinder();
656 Bitmap thumbnail = data.readInt() != 0
657 ? Bitmap.CREATOR.createFromParcel(data) : null;
658 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
659 reportThumbnail(token, thumbnail, description);
660 reply.writeNoException();
661 return true;
662 }
663
664 case GET_CONTENT_PROVIDER_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 IBinder b = data.readStrongBinder();
667 IApplicationThread app = ApplicationThreadNative.asInterface(b);
668 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700669 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700670 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700671 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 reply.writeNoException();
673 if (cph != null) {
674 reply.writeInt(1);
675 cph.writeToParcel(reply, 0);
676 } else {
677 reply.writeInt(0);
678 }
679 return true;
680 }
681
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800682 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
683 data.enforceInterface(IActivityManager.descriptor);
684 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700685 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800686 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700687 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800688 reply.writeNoException();
689 if (cph != null) {
690 reply.writeInt(1);
691 cph.writeToParcel(reply, 0);
692 } else {
693 reply.writeInt(0);
694 }
695 return true;
696 }
697
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
699 data.enforceInterface(IActivityManager.descriptor);
700 IBinder b = data.readStrongBinder();
701 IApplicationThread app = ApplicationThreadNative.asInterface(b);
702 ArrayList<ContentProviderHolder> providers =
703 data.createTypedArrayList(ContentProviderHolder.CREATOR);
704 publishContentProviders(app, providers);
705 reply.writeNoException();
706 return true;
707 }
708
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700709 case REF_CONTENT_PROVIDER_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 IBinder b = data.readStrongBinder();
712 int stable = data.readInt();
713 int unstable = data.readInt();
714 boolean res = refContentProvider(b, stable, unstable);
715 reply.writeNoException();
716 reply.writeInt(res ? 1 : 0);
717 return true;
718 }
719
720 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
721 data.enforceInterface(IActivityManager.descriptor);
722 IBinder b = data.readStrongBinder();
723 unstableProviderDied(b);
724 reply.writeNoException();
725 return true;
726 }
727
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700731 boolean stable = data.readInt() != 0;
732 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800733 reply.writeNoException();
734 return true;
735 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800736
737 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
738 data.enforceInterface(IActivityManager.descriptor);
739 String name = data.readString();
740 IBinder token = data.readStrongBinder();
741 removeContentProviderExternal(name, token);
742 reply.writeNoException();
743 return true;
744 }
745
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700746 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
749 PendingIntent pi = getRunningServiceControlPanel(comp);
750 reply.writeNoException();
751 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
752 return true;
753 }
754
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800755 case START_SERVICE_TRANSACTION: {
756 data.enforceInterface(IActivityManager.descriptor);
757 IBinder b = data.readStrongBinder();
758 IApplicationThread app = ApplicationThreadNative.asInterface(b);
759 Intent service = Intent.CREATOR.createFromParcel(data);
760 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700761 int userId = data.readInt();
762 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800763 reply.writeNoException();
764 ComponentName.writeToParcel(cn, reply);
765 return true;
766 }
767
768 case STOP_SERVICE_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 IBinder b = data.readStrongBinder();
771 IApplicationThread app = ApplicationThreadNative.asInterface(b);
772 Intent service = Intent.CREATOR.createFromParcel(data);
773 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700774 int userId = data.readInt();
775 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776 reply.writeNoException();
777 reply.writeInt(res);
778 return true;
779 }
780
781 case STOP_SERVICE_TOKEN_TRANSACTION: {
782 data.enforceInterface(IActivityManager.descriptor);
783 ComponentName className = ComponentName.readFromParcel(data);
784 IBinder token = data.readStrongBinder();
785 int startId = data.readInt();
786 boolean res = stopServiceToken(className, token, startId);
787 reply.writeNoException();
788 reply.writeInt(res ? 1 : 0);
789 return true;
790 }
791
792 case SET_SERVICE_FOREGROUND_TRANSACTION: {
793 data.enforceInterface(IActivityManager.descriptor);
794 ComponentName className = ComponentName.readFromParcel(data);
795 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700796 int id = data.readInt();
797 Notification notification = null;
798 if (data.readInt() != 0) {
799 notification = Notification.CREATOR.createFromParcel(data);
800 }
801 boolean removeNotification = data.readInt() != 0;
802 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800803 reply.writeNoException();
804 return true;
805 }
806
807 case BIND_SERVICE_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 IBinder b = data.readStrongBinder();
810 IApplicationThread app = ApplicationThreadNative.asInterface(b);
811 IBinder token = data.readStrongBinder();
812 Intent service = Intent.CREATOR.createFromParcel(data);
813 String resolvedType = data.readString();
814 b = data.readStrongBinder();
815 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800816 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800817 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800818 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 reply.writeNoException();
820 reply.writeInt(res);
821 return true;
822 }
823
824 case UNBIND_SERVICE_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 IBinder b = data.readStrongBinder();
827 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
828 boolean res = unbindService(conn);
829 reply.writeNoException();
830 reply.writeInt(res ? 1 : 0);
831 return true;
832 }
833
834 case PUBLISH_SERVICE_TRANSACTION: {
835 data.enforceInterface(IActivityManager.descriptor);
836 IBinder token = data.readStrongBinder();
837 Intent intent = Intent.CREATOR.createFromParcel(data);
838 IBinder service = data.readStrongBinder();
839 publishService(token, intent, service);
840 reply.writeNoException();
841 return true;
842 }
843
844 case UNBIND_FINISHED_TRANSACTION: {
845 data.enforceInterface(IActivityManager.descriptor);
846 IBinder token = data.readStrongBinder();
847 Intent intent = Intent.CREATOR.createFromParcel(data);
848 boolean doRebind = data.readInt() != 0;
849 unbindFinished(token, intent, doRebind);
850 reply.writeNoException();
851 return true;
852 }
853
854 case SERVICE_DONE_EXECUTING_TRANSACTION: {
855 data.enforceInterface(IActivityManager.descriptor);
856 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700857 int type = data.readInt();
858 int startId = data.readInt();
859 int res = data.readInt();
860 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800861 reply.writeNoException();
862 return true;
863 }
864
865 case START_INSTRUMENTATION_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 ComponentName className = ComponentName.readFromParcel(data);
868 String profileFile = data.readString();
869 int fl = data.readInt();
870 Bundle arguments = data.readBundle();
871 IBinder b = data.readStrongBinder();
872 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800873 b = data.readStrongBinder();
874 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700875 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800876 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800877 reply.writeNoException();
878 reply.writeInt(res ? 1 : 0);
879 return true;
880 }
881
882
883 case FINISH_INSTRUMENTATION_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 IBinder b = data.readStrongBinder();
886 IApplicationThread app = ApplicationThreadNative.asInterface(b);
887 int resultCode = data.readInt();
888 Bundle results = data.readBundle();
889 finishInstrumentation(app, resultCode, results);
890 reply.writeNoException();
891 return true;
892 }
893
894 case GET_CONFIGURATION_TRANSACTION: {
895 data.enforceInterface(IActivityManager.descriptor);
896 Configuration config = getConfiguration();
897 reply.writeNoException();
898 config.writeToParcel(reply, 0);
899 return true;
900 }
901
902 case UPDATE_CONFIGURATION_TRANSACTION: {
903 data.enforceInterface(IActivityManager.descriptor);
904 Configuration config = Configuration.CREATOR.createFromParcel(data);
905 updateConfiguration(config);
906 reply.writeNoException();
907 return true;
908 }
909
910 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
911 data.enforceInterface(IActivityManager.descriptor);
912 IBinder token = data.readStrongBinder();
913 int requestedOrientation = data.readInt();
914 setRequestedOrientation(token, requestedOrientation);
915 reply.writeNoException();
916 return true;
917 }
918
919 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
920 data.enforceInterface(IActivityManager.descriptor);
921 IBinder token = data.readStrongBinder();
922 int req = getRequestedOrientation(token);
923 reply.writeNoException();
924 reply.writeInt(req);
925 return true;
926 }
927
928 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
929 data.enforceInterface(IActivityManager.descriptor);
930 IBinder token = data.readStrongBinder();
931 ComponentName cn = getActivityClassForToken(token);
932 reply.writeNoException();
933 ComponentName.writeToParcel(cn, reply);
934 return true;
935 }
936
937 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
938 data.enforceInterface(IActivityManager.descriptor);
939 IBinder token = data.readStrongBinder();
940 reply.writeNoException();
941 reply.writeString(getPackageForToken(token));
942 return true;
943 }
944
945 case GET_INTENT_SENDER_TRANSACTION: {
946 data.enforceInterface(IActivityManager.descriptor);
947 int type = data.readInt();
948 String packageName = data.readString();
949 IBinder token = data.readStrongBinder();
950 String resultWho = data.readString();
951 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800952 Intent[] requestIntents;
953 String[] requestResolvedTypes;
954 if (data.readInt() != 0) {
955 requestIntents = data.createTypedArray(Intent.CREATOR);
956 requestResolvedTypes = data.createStringArray();
957 } else {
958 requestIntents = null;
959 requestResolvedTypes = null;
960 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800961 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700962 Bundle options = data.readInt() != 0
963 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700964 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800965 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800966 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700967 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800968 reply.writeNoException();
969 reply.writeStrongBinder(res != null ? res.asBinder() : null);
970 return true;
971 }
972
973 case CANCEL_INTENT_SENDER_TRANSACTION: {
974 data.enforceInterface(IActivityManager.descriptor);
975 IIntentSender r = IIntentSender.Stub.asInterface(
976 data.readStrongBinder());
977 cancelIntentSender(r);
978 reply.writeNoException();
979 return true;
980 }
981
982 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
983 data.enforceInterface(IActivityManager.descriptor);
984 IIntentSender r = IIntentSender.Stub.asInterface(
985 data.readStrongBinder());
986 String res = getPackageForIntentSender(r);
987 reply.writeNoException();
988 reply.writeString(res);
989 return true;
990 }
991
Christopher Tatec4a07d12012-04-06 14:19:13 -0700992 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
993 data.enforceInterface(IActivityManager.descriptor);
994 IIntentSender r = IIntentSender.Stub.asInterface(
995 data.readStrongBinder());
996 int res = getUidForIntentSender(r);
997 reply.writeNoException();
998 reply.writeInt(res);
999 return true;
1000 }
1001
Dianne Hackborn41203752012-08-31 14:05:51 -07001002 case HANDLE_INCOMING_USER_TRANSACTION: {
1003 data.enforceInterface(IActivityManager.descriptor);
1004 int callingPid = data.readInt();
1005 int callingUid = data.readInt();
1006 int userId = data.readInt();
1007 boolean allowAll = data.readInt() != 0 ;
1008 boolean requireFull = data.readInt() != 0;
1009 String name = data.readString();
1010 String callerPackage = data.readString();
1011 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1012 requireFull, name, callerPackage);
1013 reply.writeNoException();
1014 reply.writeInt(res);
1015 return true;
1016 }
1017
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001018 case SET_PROCESS_LIMIT_TRANSACTION: {
1019 data.enforceInterface(IActivityManager.descriptor);
1020 int max = data.readInt();
1021 setProcessLimit(max);
1022 reply.writeNoException();
1023 return true;
1024 }
1025
1026 case GET_PROCESS_LIMIT_TRANSACTION: {
1027 data.enforceInterface(IActivityManager.descriptor);
1028 int limit = getProcessLimit();
1029 reply.writeNoException();
1030 reply.writeInt(limit);
1031 return true;
1032 }
1033
1034 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1035 data.enforceInterface(IActivityManager.descriptor);
1036 IBinder token = data.readStrongBinder();
1037 int pid = data.readInt();
1038 boolean isForeground = data.readInt() != 0;
1039 setProcessForeground(token, pid, isForeground);
1040 reply.writeNoException();
1041 return true;
1042 }
1043
1044 case CHECK_PERMISSION_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 String perm = data.readString();
1047 int pid = data.readInt();
1048 int uid = data.readInt();
1049 int res = checkPermission(perm, pid, uid);
1050 reply.writeNoException();
1051 reply.writeInt(res);
1052 return true;
1053 }
1054
1055 case CHECK_URI_PERMISSION_TRANSACTION: {
1056 data.enforceInterface(IActivityManager.descriptor);
1057 Uri uri = Uri.CREATOR.createFromParcel(data);
1058 int pid = data.readInt();
1059 int uid = data.readInt();
1060 int mode = data.readInt();
1061 int res = checkUriPermission(uri, pid, uid, mode);
1062 reply.writeNoException();
1063 reply.writeInt(res);
1064 return true;
1065 }
1066
1067 case CLEAR_APP_DATA_TRANSACTION: {
1068 data.enforceInterface(IActivityManager.descriptor);
1069 String packageName = data.readString();
1070 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1071 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001072 int userId = data.readInt();
1073 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001074 reply.writeNoException();
1075 reply.writeInt(res ? 1 : 0);
1076 return true;
1077 }
1078
1079 case GRANT_URI_PERMISSION_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 IBinder b = data.readStrongBinder();
1082 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1083 String targetPkg = data.readString();
1084 Uri uri = Uri.CREATOR.createFromParcel(data);
1085 int mode = data.readInt();
1086 grantUriPermission(app, targetPkg, uri, mode);
1087 reply.writeNoException();
1088 return true;
1089 }
1090
1091 case REVOKE_URI_PERMISSION_TRANSACTION: {
1092 data.enforceInterface(IActivityManager.descriptor);
1093 IBinder b = data.readStrongBinder();
1094 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1095 Uri uri = Uri.CREATOR.createFromParcel(data);
1096 int mode = data.readInt();
1097 revokeUriPermission(app, uri, mode);
1098 reply.writeNoException();
1099 return true;
1100 }
1101
1102 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1103 data.enforceInterface(IActivityManager.descriptor);
1104 IBinder b = data.readStrongBinder();
1105 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1106 boolean waiting = data.readInt() != 0;
1107 showWaitingForDebugger(app, waiting);
1108 reply.writeNoException();
1109 return true;
1110 }
1111
1112 case GET_MEMORY_INFO_TRANSACTION: {
1113 data.enforceInterface(IActivityManager.descriptor);
1114 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1115 getMemoryInfo(mi);
1116 reply.writeNoException();
1117 mi.writeToParcel(reply, 0);
1118 return true;
1119 }
1120
1121 case UNHANDLED_BACK_TRANSACTION: {
1122 data.enforceInterface(IActivityManager.descriptor);
1123 unhandledBack();
1124 reply.writeNoException();
1125 return true;
1126 }
1127
1128 case OPEN_CONTENT_URI_TRANSACTION: {
1129 data.enforceInterface(IActivityManager.descriptor);
1130 Uri uri = Uri.parse(data.readString());
1131 ParcelFileDescriptor pfd = openContentUri(uri);
1132 reply.writeNoException();
1133 if (pfd != null) {
1134 reply.writeInt(1);
1135 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1136 } else {
1137 reply.writeInt(0);
1138 }
1139 return true;
1140 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001141
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 case GOING_TO_SLEEP_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 goingToSleep();
1145 reply.writeNoException();
1146 return true;
1147 }
1148
1149 case WAKING_UP_TRANSACTION: {
1150 data.enforceInterface(IActivityManager.descriptor);
1151 wakingUp();
1152 reply.writeNoException();
1153 return true;
1154 }
1155
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001156 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1157 data.enforceInterface(IActivityManager.descriptor);
1158 setLockScreenShown(data.readInt() != 0);
1159 reply.writeNoException();
1160 return true;
1161 }
1162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001163 case SET_DEBUG_APP_TRANSACTION: {
1164 data.enforceInterface(IActivityManager.descriptor);
1165 String pn = data.readString();
1166 boolean wfd = data.readInt() != 0;
1167 boolean per = data.readInt() != 0;
1168 setDebugApp(pn, wfd, per);
1169 reply.writeNoException();
1170 return true;
1171 }
1172
1173 case SET_ALWAYS_FINISH_TRANSACTION: {
1174 data.enforceInterface(IActivityManager.descriptor);
1175 boolean enabled = data.readInt() != 0;
1176 setAlwaysFinish(enabled);
1177 reply.writeNoException();
1178 return true;
1179 }
1180
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001181 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001183 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001185 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001186 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001187 return true;
1188 }
1189
1190 case ENTER_SAFE_MODE_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 enterSafeMode();
1193 reply.writeNoException();
1194 return true;
1195 }
1196
1197 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1198 data.enforceInterface(IActivityManager.descriptor);
1199 IIntentSender is = IIntentSender.Stub.asInterface(
1200 data.readStrongBinder());
1201 noteWakeupAlarm(is);
1202 reply.writeNoException();
1203 return true;
1204 }
1205
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001206 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001207 data.enforceInterface(IActivityManager.descriptor);
1208 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001209 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001210 boolean secure = data.readInt() != 0;
1211 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001212 reply.writeNoException();
1213 reply.writeInt(res ? 1 : 0);
1214 return true;
1215 }
1216
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001217 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1218 data.enforceInterface(IActivityManager.descriptor);
1219 String reason = data.readString();
1220 boolean res = killProcessesBelowForeground(reason);
1221 reply.writeNoException();
1222 reply.writeInt(res ? 1 : 0);
1223 return true;
1224 }
1225
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001226 case START_RUNNING_TRANSACTION: {
1227 data.enforceInterface(IActivityManager.descriptor);
1228 String pkg = data.readString();
1229 String cls = data.readString();
1230 String action = data.readString();
1231 String indata = data.readString();
1232 startRunning(pkg, cls, action, indata);
1233 reply.writeNoException();
1234 return true;
1235 }
1236
Dan Egnor60d87622009-12-16 16:32:58 -08001237 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 IBinder app = data.readStrongBinder();
1240 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1241 handleApplicationCrash(app, ci);
1242 reply.writeNoException();
1243 return true;
1244 }
1245
1246 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 data.enforceInterface(IActivityManager.descriptor);
1248 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001250 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001251 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001252 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001253 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001254 return true;
1255 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001256
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001257 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001260 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001261 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1262 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001263 reply.writeNoException();
1264 return true;
1265 }
1266
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001267 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1268 data.enforceInterface(IActivityManager.descriptor);
1269 int sig = data.readInt();
1270 signalPersistentProcesses(sig);
1271 reply.writeNoException();
1272 return true;
1273 }
1274
Dianne Hackborn03abb812010-01-04 18:43:19 -08001275 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1276 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001277 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001278 int userId = data.readInt();
1279 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001280 reply.writeNoException();
1281 return true;
1282 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001283
1284 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1285 data.enforceInterface(IActivityManager.descriptor);
1286 killAllBackgroundProcesses();
1287 reply.writeNoException();
1288 return true;
1289 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001290
1291 case FORCE_STOP_PACKAGE_TRANSACTION: {
1292 data.enforceInterface(IActivityManager.descriptor);
1293 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001294 int userId = data.readInt();
1295 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001296 reply.writeNoException();
1297 return true;
1298 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001299
1300 case GET_MY_MEMORY_STATE_TRANSACTION: {
1301 data.enforceInterface(IActivityManager.descriptor);
1302 ActivityManager.RunningAppProcessInfo info =
1303 new ActivityManager.RunningAppProcessInfo();
1304 getMyMemoryState(info);
1305 reply.writeNoException();
1306 info.writeToParcel(reply, 0);
1307 return true;
1308 }
1309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 ConfigurationInfo config = getDeviceConfigurationInfo();
1313 reply.writeNoException();
1314 config.writeToParcel(reply, 0);
1315 return true;
1316 }
1317
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001318 case PROFILE_CONTROL_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001321 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001322 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001323 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001324 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001325 ParcelFileDescriptor fd = data.readInt() != 0
1326 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001327 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001328 reply.writeNoException();
1329 reply.writeInt(res ? 1 : 0);
1330 return true;
1331 }
1332
Dianne Hackborn55280a92009-05-07 15:53:46 -07001333 case SHUTDOWN_TRANSACTION: {
1334 data.enforceInterface(IActivityManager.descriptor);
1335 boolean res = shutdown(data.readInt());
1336 reply.writeNoException();
1337 reply.writeInt(res ? 1 : 0);
1338 return true;
1339 }
1340
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001341 case STOP_APP_SWITCHES_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
1343 stopAppSwitches();
1344 reply.writeNoException();
1345 return true;
1346 }
1347
1348 case RESUME_APP_SWITCHES_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 resumeAppSwitches();
1351 reply.writeNoException();
1352 return true;
1353 }
1354
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001355 case PEEK_SERVICE_TRANSACTION: {
1356 data.enforceInterface(IActivityManager.descriptor);
1357 Intent service = Intent.CREATOR.createFromParcel(data);
1358 String resolvedType = data.readString();
1359 IBinder binder = peekService(service, resolvedType);
1360 reply.writeNoException();
1361 reply.writeStrongBinder(binder);
1362 return true;
1363 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001364
1365 case START_BACKUP_AGENT_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1368 int backupRestoreMode = data.readInt();
1369 boolean success = bindBackupAgent(info, backupRestoreMode);
1370 reply.writeNoException();
1371 reply.writeInt(success ? 1 : 0);
1372 return true;
1373 }
1374
1375 case BACKUP_AGENT_CREATED_TRANSACTION: {
1376 data.enforceInterface(IActivityManager.descriptor);
1377 String packageName = data.readString();
1378 IBinder agent = data.readStrongBinder();
1379 backupAgentCreated(packageName, agent);
1380 reply.writeNoException();
1381 return true;
1382 }
1383
1384 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1385 data.enforceInterface(IActivityManager.descriptor);
1386 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1387 unbindBackupAgent(info);
1388 reply.writeNoException();
1389 return true;
1390 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001391
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001392 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001393 data.enforceInterface(IActivityManager.descriptor);
1394 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001395 int appid = data.readInt();
1396 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001397 reply.writeNoException();
1398 return true;
1399 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001400
1401 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1402 data.enforceInterface(IActivityManager.descriptor);
1403 String reason = data.readString();
1404 closeSystemDialogs(reason);
1405 reply.writeNoException();
1406 return true;
1407 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001408
1409 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1410 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001411 int[] pids = data.createIntArray();
1412 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001413 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001414 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001415 return true;
1416 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001417
1418 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 String processName = data.readString();
1421 int uid = data.readInt();
1422 killApplicationProcess(processName, uid);
1423 reply.writeNoException();
1424 return true;
1425 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001426
1427 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1428 data.enforceInterface(IActivityManager.descriptor);
1429 IBinder token = data.readStrongBinder();
1430 String packageName = data.readString();
1431 int enterAnim = data.readInt();
1432 int exitAnim = data.readInt();
1433 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001434 reply.writeNoException();
1435 return true;
1436 }
1437
1438 case IS_USER_A_MONKEY_TRANSACTION: {
1439 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001440 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001441 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001442 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001443 return true;
1444 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001445
1446 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 finishHeavyWeightApp();
1449 reply.writeNoException();
1450 return true;
1451 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001452
1453 case IS_IMMERSIVE_TRANSACTION: {
1454 data.enforceInterface(IActivityManager.descriptor);
1455 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001456 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001457 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001458 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001459 return true;
1460 }
1461
1462 case SET_IMMERSIVE_TRANSACTION: {
1463 data.enforceInterface(IActivityManager.descriptor);
1464 IBinder token = data.readStrongBinder();
1465 boolean imm = data.readInt() == 1;
1466 setImmersive(token, imm);
1467 reply.writeNoException();
1468 return true;
1469 }
1470
1471 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1472 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001473 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001474 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001475 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001476 return true;
1477 }
1478
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001479 case CRASH_APPLICATION_TRANSACTION: {
1480 data.enforceInterface(IActivityManager.descriptor);
1481 int uid = data.readInt();
1482 int initialPid = data.readInt();
1483 String packageName = data.readString();
1484 String message = data.readString();
1485 crashApplication(uid, initialPid, packageName, message);
1486 reply.writeNoException();
1487 return true;
1488 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001489
1490 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001493 int userId = data.readInt();
1494 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001495 reply.writeNoException();
1496 reply.writeString(type);
1497 return true;
1498 }
1499
Dianne Hackborn7e269642010-08-25 19:50:20 -07001500 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 String name = data.readString();
1503 IBinder perm = newUriPermissionOwner(name);
1504 reply.writeNoException();
1505 reply.writeStrongBinder(perm);
1506 return true;
1507 }
1508
1509 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 IBinder owner = data.readStrongBinder();
1512 int fromUid = data.readInt();
1513 String targetPkg = data.readString();
1514 Uri uri = Uri.CREATOR.createFromParcel(data);
1515 int mode = data.readInt();
1516 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1517 reply.writeNoException();
1518 return true;
1519 }
1520
1521 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 IBinder owner = data.readStrongBinder();
1524 Uri uri = null;
1525 if (data.readInt() != 0) {
1526 Uri.CREATOR.createFromParcel(data);
1527 }
1528 int mode = data.readInt();
1529 revokeUriPermissionFromOwner(owner, uri, mode);
1530 reply.writeNoException();
1531 return true;
1532 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001533
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001534 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1535 data.enforceInterface(IActivityManager.descriptor);
1536 int callingUid = data.readInt();
1537 String targetPkg = data.readString();
1538 Uri uri = Uri.CREATOR.createFromParcel(data);
1539 int modeFlags = data.readInt();
1540 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1541 reply.writeNoException();
1542 reply.writeInt(res);
1543 return true;
1544 }
1545
Andy McFadden824c5102010-07-09 16:26:57 -07001546 case DUMP_HEAP_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001549 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001550 boolean managed = data.readInt() != 0;
1551 String path = data.readString();
1552 ParcelFileDescriptor fd = data.readInt() != 0
1553 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001554 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001555 reply.writeNoException();
1556 reply.writeInt(res ? 1 : 0);
1557 return true;
1558 }
1559
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001560 case START_ACTIVITIES_TRANSACTION:
1561 {
1562 data.enforceInterface(IActivityManager.descriptor);
1563 IBinder b = data.readStrongBinder();
1564 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001565 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001566 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1567 String[] resolvedTypes = data.createStringArray();
1568 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001569 Bundle options = data.readInt() != 0
1570 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001571 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001572 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001573 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001574 reply.writeNoException();
1575 reply.writeInt(result);
1576 return true;
1577 }
1578
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001579 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1580 {
1581 data.enforceInterface(IActivityManager.descriptor);
1582 int mode = getFrontActivityScreenCompatMode();
1583 reply.writeNoException();
1584 reply.writeInt(mode);
1585 return true;
1586 }
1587
1588 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1589 {
1590 data.enforceInterface(IActivityManager.descriptor);
1591 int mode = data.readInt();
1592 setFrontActivityScreenCompatMode(mode);
1593 reply.writeNoException();
1594 reply.writeInt(mode);
1595 return true;
1596 }
1597
1598 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1599 {
1600 data.enforceInterface(IActivityManager.descriptor);
1601 String pkg = data.readString();
1602 int mode = getPackageScreenCompatMode(pkg);
1603 reply.writeNoException();
1604 reply.writeInt(mode);
1605 return true;
1606 }
1607
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001608 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1609 {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001612 int mode = data.readInt();
1613 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001614 reply.writeNoException();
1615 return true;
1616 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001617
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001618 case SWITCH_USER_TRANSACTION: {
1619 data.enforceInterface(IActivityManager.descriptor);
1620 int userid = data.readInt();
1621 boolean result = switchUser(userid);
1622 reply.writeNoException();
1623 reply.writeInt(result ? 1 : 0);
1624 return true;
1625 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001626
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001627 case STOP_USER_TRANSACTION: {
1628 data.enforceInterface(IActivityManager.descriptor);
1629 int userid = data.readInt();
1630 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1631 data.readStrongBinder());
1632 int result = stopUser(userid, callback);
1633 reply.writeNoException();
1634 reply.writeInt(result);
1635 return true;
1636 }
1637
Amith Yamasani52f1d752012-03-28 18:19:29 -07001638 case GET_CURRENT_USER_TRANSACTION: {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 UserInfo userInfo = getCurrentUser();
1641 reply.writeNoException();
1642 userInfo.writeToParcel(reply, 0);
1643 return true;
1644 }
1645
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001646 case IS_USER_RUNNING_TRANSACTION: {
1647 data.enforceInterface(IActivityManager.descriptor);
1648 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001649 boolean orStopping = data.readInt() != 0;
1650 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001651 reply.writeNoException();
1652 reply.writeInt(result ? 1 : 0);
1653 return true;
1654 }
1655
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001656 case GET_RUNNING_USER_IDS_TRANSACTION: {
1657 data.enforceInterface(IActivityManager.descriptor);
1658 int[] result = getRunningUserIds();
1659 reply.writeNoException();
1660 reply.writeIntArray(result);
1661 return true;
1662 }
1663
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001664 case REMOVE_SUB_TASK_TRANSACTION:
1665 {
1666 data.enforceInterface(IActivityManager.descriptor);
1667 int taskId = data.readInt();
1668 int subTaskIndex = data.readInt();
1669 boolean result = removeSubTask(taskId, subTaskIndex);
1670 reply.writeNoException();
1671 reply.writeInt(result ? 1 : 0);
1672 return true;
1673 }
1674
1675 case REMOVE_TASK_TRANSACTION:
1676 {
1677 data.enforceInterface(IActivityManager.descriptor);
1678 int taskId = data.readInt();
1679 int fl = data.readInt();
1680 boolean result = removeTask(taskId, fl);
1681 reply.writeNoException();
1682 reply.writeInt(result ? 1 : 0);
1683 return true;
1684 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001685
Jeff Sharkeya4620792011-05-20 15:29:23 -07001686 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1689 data.readStrongBinder());
1690 registerProcessObserver(observer);
1691 return true;
1692 }
1693
1694 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1697 data.readStrongBinder());
1698 unregisterProcessObserver(observer);
1699 return true;
1700 }
1701
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001702 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1703 {
1704 data.enforceInterface(IActivityManager.descriptor);
1705 String pkg = data.readString();
1706 boolean ask = getPackageAskScreenCompat(pkg);
1707 reply.writeNoException();
1708 reply.writeInt(ask ? 1 : 0);
1709 return true;
1710 }
1711
1712 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1713 {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 String pkg = data.readString();
1716 boolean ask = data.readInt() != 0;
1717 setPackageAskScreenCompat(pkg, ask);
1718 reply.writeNoException();
1719 return true;
1720 }
1721
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001722 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1723 data.enforceInterface(IActivityManager.descriptor);
1724 IIntentSender r = IIntentSender.Stub.asInterface(
1725 data.readStrongBinder());
1726 boolean res = isIntentSenderTargetedToPackage(r);
1727 reply.writeNoException();
1728 reply.writeInt(res ? 1 : 0);
1729 return true;
1730 }
1731
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001732 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1733 data.enforceInterface(IActivityManager.descriptor);
1734 IIntentSender r = IIntentSender.Stub.asInterface(
1735 data.readStrongBinder());
1736 boolean res = isIntentSenderAnActivity(r);
1737 reply.writeNoException();
1738 reply.writeInt(res ? 1 : 0);
1739 return true;
1740 }
1741
Dianne Hackborn81038902012-11-26 17:04:09 -08001742 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 IIntentSender r = IIntentSender.Stub.asInterface(
1745 data.readStrongBinder());
1746 Intent intent = getIntentForIntentSender(r);
1747 reply.writeNoException();
1748 if (intent != null) {
1749 reply.writeInt(1);
1750 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1751 } else {
1752 reply.writeInt(0);
1753 }
1754 return true;
1755 }
1756
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001757 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1758 data.enforceInterface(IActivityManager.descriptor);
1759 Configuration config = Configuration.CREATOR.createFromParcel(data);
1760 updatePersistentConfiguration(config);
1761 reply.writeNoException();
1762 return true;
1763 }
1764
Dianne Hackbornb437e092011-08-05 17:50:29 -07001765 case GET_PROCESS_PSS_TRANSACTION: {
1766 data.enforceInterface(IActivityManager.descriptor);
1767 int[] pids = data.createIntArray();
1768 long[] pss = getProcessPss(pids);
1769 reply.writeNoException();
1770 reply.writeLongArray(pss);
1771 return true;
1772 }
1773
Dianne Hackborn661cd522011-08-22 00:26:20 -07001774 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1775 data.enforceInterface(IActivityManager.descriptor);
1776 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1777 boolean always = data.readInt() != 0;
1778 showBootMessage(msg, always);
1779 reply.writeNoException();
1780 return true;
1781 }
1782
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001783 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1784 data.enforceInterface(IActivityManager.descriptor);
1785 dismissKeyguardOnNextActivity();
1786 reply.writeNoException();
1787 return true;
1788 }
1789
Adam Powelldd8fab22012-03-22 17:47:27 -07001790 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 IBinder token = data.readStrongBinder();
1793 String destAffinity = data.readString();
1794 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1795 reply.writeNoException();
1796 reply.writeInt(res ? 1 : 0);
1797 return true;
1798 }
1799
1800 case NAVIGATE_UP_TO_TRANSACTION: {
1801 data.enforceInterface(IActivityManager.descriptor);
1802 IBinder token = data.readStrongBinder();
1803 Intent target = Intent.CREATOR.createFromParcel(data);
1804 int resultCode = data.readInt();
1805 Intent resultData = null;
1806 if (data.readInt() != 0) {
1807 resultData = Intent.CREATOR.createFromParcel(data);
1808 }
1809 boolean res = navigateUpTo(token, target, resultCode, resultData);
1810 reply.writeNoException();
1811 reply.writeInt(res ? 1 : 0);
1812 return true;
1813 }
1814
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001815 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1816 data.enforceInterface(IActivityManager.descriptor);
1817 IBinder token = data.readStrongBinder();
1818 int res = getLaunchedFromUid(token);
1819 reply.writeNoException();
1820 reply.writeInt(res);
1821 return true;
1822 }
1823
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001824 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1825 data.enforceInterface(IActivityManager.descriptor);
1826 IBinder token = data.readStrongBinder();
1827 String res = getLaunchedFromPackage(token);
1828 reply.writeNoException();
1829 reply.writeString(res);
1830 return true;
1831 }
1832
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001833 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1834 data.enforceInterface(IActivityManager.descriptor);
1835 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1836 data.readStrongBinder());
1837 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001838 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001839 return true;
1840 }
1841
1842 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1843 data.enforceInterface(IActivityManager.descriptor);
1844 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1845 data.readStrongBinder());
1846 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001847 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001848 return true;
1849 }
1850
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001851 case REQUEST_BUG_REPORT_TRANSACTION: {
1852 data.enforceInterface(IActivityManager.descriptor);
1853 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001854 reply.writeNoException();
1855 return true;
1856 }
1857
1858 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1859 data.enforceInterface(IActivityManager.descriptor);
1860 int pid = data.readInt();
1861 boolean aboveSystem = data.readInt() != 0;
1862 long res = inputDispatchingTimedOut(pid, aboveSystem);
1863 reply.writeNoException();
1864 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001865 return true;
1866 }
1867
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001868 case GET_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1869 data.enforceInterface(IActivityManager.descriptor);
1870 int requestType = data.readInt();
1871 Bundle res = getTopActivityExtras(requestType);
1872 reply.writeNoException();
1873 reply.writeBundle(res);
1874 return true;
1875 }
1876
1877 case REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1878 data.enforceInterface(IActivityManager.descriptor);
1879 IBinder token = data.readStrongBinder();
1880 Bundle extras = data.readBundle();
1881 reportTopActivityExtras(token, extras);
1882 reply.writeNoException();
1883 return true;
1884 }
1885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001886 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001887
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001888 return super.onTransact(code, data, reply, flags);
1889 }
1890
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001891 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001892 return this;
1893 }
1894
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001895 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1896 protected IActivityManager create() {
1897 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001898 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001899 Log.v("ActivityManager", "default service binder = " + b);
1900 }
1901 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001902 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001903 Log.v("ActivityManager", "default service = " + am);
1904 }
1905 return am;
1906 }
1907 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001908}
1909
1910class ActivityManagerProxy implements IActivityManager
1911{
1912 public ActivityManagerProxy(IBinder remote)
1913 {
1914 mRemote = remote;
1915 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001916
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001917 public IBinder asBinder()
1918 {
1919 return mRemote;
1920 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001921
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001922 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001923 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1924 int startFlags, String profileFile,
1925 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001926 Parcel data = Parcel.obtain();
1927 Parcel reply = Parcel.obtain();
1928 data.writeInterfaceToken(IActivityManager.descriptor);
1929 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001930 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001931 intent.writeToParcel(data, 0);
1932 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001933 data.writeStrongBinder(resultTo);
1934 data.writeString(resultWho);
1935 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001936 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001937 data.writeString(profileFile);
1938 if (profileFd != null) {
1939 data.writeInt(1);
1940 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1941 } else {
1942 data.writeInt(0);
1943 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001944 if (options != null) {
1945 data.writeInt(1);
1946 options.writeToParcel(data, 0);
1947 } else {
1948 data.writeInt(0);
1949 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001950 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1951 reply.readException();
1952 int result = reply.readInt();
1953 reply.recycle();
1954 data.recycle();
1955 return result;
1956 }
Amith Yamasani82644082012-08-03 13:09:11 -07001957
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001958 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07001959 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1960 int startFlags, String profileFile,
1961 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1962 Parcel data = Parcel.obtain();
1963 Parcel reply = Parcel.obtain();
1964 data.writeInterfaceToken(IActivityManager.descriptor);
1965 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001966 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07001967 intent.writeToParcel(data, 0);
1968 data.writeString(resolvedType);
1969 data.writeStrongBinder(resultTo);
1970 data.writeString(resultWho);
1971 data.writeInt(requestCode);
1972 data.writeInt(startFlags);
1973 data.writeString(profileFile);
1974 if (profileFd != null) {
1975 data.writeInt(1);
1976 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1977 } else {
1978 data.writeInt(0);
1979 }
1980 if (options != null) {
1981 data.writeInt(1);
1982 options.writeToParcel(data, 0);
1983 } else {
1984 data.writeInt(0);
1985 }
1986 data.writeInt(userId);
1987 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1988 reply.readException();
1989 int result = reply.readInt();
1990 reply.recycle();
1991 data.recycle();
1992 return result;
1993 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001994 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
1995 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001996 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001997 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001998 Parcel data = Parcel.obtain();
1999 Parcel reply = Parcel.obtain();
2000 data.writeInterfaceToken(IActivityManager.descriptor);
2001 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002002 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002003 intent.writeToParcel(data, 0);
2004 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002005 data.writeStrongBinder(resultTo);
2006 data.writeString(resultWho);
2007 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002008 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002009 data.writeString(profileFile);
2010 if (profileFd != null) {
2011 data.writeInt(1);
2012 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2013 } else {
2014 data.writeInt(0);
2015 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002016 if (options != null) {
2017 data.writeInt(1);
2018 options.writeToParcel(data, 0);
2019 } else {
2020 data.writeInt(0);
2021 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002022 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002023 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2024 reply.readException();
2025 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2026 reply.recycle();
2027 data.recycle();
2028 return result;
2029 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002030 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2031 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002032 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002033 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002034 Parcel data = Parcel.obtain();
2035 Parcel reply = Parcel.obtain();
2036 data.writeInterfaceToken(IActivityManager.descriptor);
2037 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002038 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002039 intent.writeToParcel(data, 0);
2040 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002041 data.writeStrongBinder(resultTo);
2042 data.writeString(resultWho);
2043 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002044 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002045 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002046 if (options != null) {
2047 data.writeInt(1);
2048 options.writeToParcel(data, 0);
2049 } else {
2050 data.writeInt(0);
2051 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002052 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002053 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2054 reply.readException();
2055 int result = reply.readInt();
2056 reply.recycle();
2057 data.recycle();
2058 return result;
2059 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002060 public int startActivityIntentSender(IApplicationThread caller,
2061 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002062 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002063 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002064 Parcel data = Parcel.obtain();
2065 Parcel reply = Parcel.obtain();
2066 data.writeInterfaceToken(IActivityManager.descriptor);
2067 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2068 intent.writeToParcel(data, 0);
2069 if (fillInIntent != null) {
2070 data.writeInt(1);
2071 fillInIntent.writeToParcel(data, 0);
2072 } else {
2073 data.writeInt(0);
2074 }
2075 data.writeString(resolvedType);
2076 data.writeStrongBinder(resultTo);
2077 data.writeString(resultWho);
2078 data.writeInt(requestCode);
2079 data.writeInt(flagsMask);
2080 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002081 if (options != null) {
2082 data.writeInt(1);
2083 options.writeToParcel(data, 0);
2084 } else {
2085 data.writeInt(0);
2086 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002087 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002088 reply.readException();
2089 int result = reply.readInt();
2090 reply.recycle();
2091 data.recycle();
2092 return result;
2093 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002094 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002095 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002096 Parcel data = Parcel.obtain();
2097 Parcel reply = Parcel.obtain();
2098 data.writeInterfaceToken(IActivityManager.descriptor);
2099 data.writeStrongBinder(callingActivity);
2100 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002101 if (options != null) {
2102 data.writeInt(1);
2103 options.writeToParcel(data, 0);
2104 } else {
2105 data.writeInt(0);
2106 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002107 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2108 reply.readException();
2109 int result = reply.readInt();
2110 reply.recycle();
2111 data.recycle();
2112 return result != 0;
2113 }
2114 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2115 throws RemoteException {
2116 Parcel data = Parcel.obtain();
2117 Parcel reply = Parcel.obtain();
2118 data.writeInterfaceToken(IActivityManager.descriptor);
2119 data.writeStrongBinder(token);
2120 data.writeInt(resultCode);
2121 if (resultData != null) {
2122 data.writeInt(1);
2123 resultData.writeToParcel(data, 0);
2124 } else {
2125 data.writeInt(0);
2126 }
2127 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2128 reply.readException();
2129 boolean res = reply.readInt() != 0;
2130 data.recycle();
2131 reply.recycle();
2132 return res;
2133 }
2134 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2135 {
2136 Parcel data = Parcel.obtain();
2137 Parcel reply = Parcel.obtain();
2138 data.writeInterfaceToken(IActivityManager.descriptor);
2139 data.writeStrongBinder(token);
2140 data.writeString(resultWho);
2141 data.writeInt(requestCode);
2142 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2143 reply.readException();
2144 data.recycle();
2145 reply.recycle();
2146 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002147 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2148 Parcel data = Parcel.obtain();
2149 Parcel reply = Parcel.obtain();
2150 data.writeInterfaceToken(IActivityManager.descriptor);
2151 data.writeStrongBinder(token);
2152 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2153 reply.readException();
2154 boolean res = reply.readInt() != 0;
2155 data.recycle();
2156 reply.recycle();
2157 return res;
2158 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002159 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2160 Parcel data = Parcel.obtain();
2161 Parcel reply = Parcel.obtain();
2162 data.writeInterfaceToken(IActivityManager.descriptor);
2163 data.writeStrongBinder(token);
2164 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2165 reply.readException();
2166 boolean res = reply.readInt() != 0;
2167 data.recycle();
2168 reply.recycle();
2169 return res;
2170 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002171 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002172 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002173 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002174 {
2175 Parcel data = Parcel.obtain();
2176 Parcel reply = Parcel.obtain();
2177 data.writeInterfaceToken(IActivityManager.descriptor);
2178 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002179 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002180 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2181 filter.writeToParcel(data, 0);
2182 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002183 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002184 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2185 reply.readException();
2186 Intent intent = null;
2187 int haveIntent = reply.readInt();
2188 if (haveIntent != 0) {
2189 intent = Intent.CREATOR.createFromParcel(reply);
2190 }
2191 reply.recycle();
2192 data.recycle();
2193 return intent;
2194 }
2195 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2196 {
2197 Parcel data = Parcel.obtain();
2198 Parcel reply = Parcel.obtain();
2199 data.writeInterfaceToken(IActivityManager.descriptor);
2200 data.writeStrongBinder(receiver.asBinder());
2201 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2202 reply.readException();
2203 data.recycle();
2204 reply.recycle();
2205 }
2206 public int broadcastIntent(IApplicationThread caller,
2207 Intent intent, String resolvedType, IIntentReceiver resultTo,
2208 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002209 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002210 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002211 {
2212 Parcel data = Parcel.obtain();
2213 Parcel reply = Parcel.obtain();
2214 data.writeInterfaceToken(IActivityManager.descriptor);
2215 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2216 intent.writeToParcel(data, 0);
2217 data.writeString(resolvedType);
2218 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2219 data.writeInt(resultCode);
2220 data.writeString(resultData);
2221 data.writeBundle(map);
2222 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002223 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002224 data.writeInt(serialized ? 1 : 0);
2225 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002226 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002227 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2228 reply.readException();
2229 int res = reply.readInt();
2230 reply.recycle();
2231 data.recycle();
2232 return res;
2233 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002234 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2235 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002236 {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2241 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002242 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002243 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2244 reply.readException();
2245 data.recycle();
2246 reply.recycle();
2247 }
2248 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2249 {
2250 Parcel data = Parcel.obtain();
2251 Parcel reply = Parcel.obtain();
2252 data.writeInterfaceToken(IActivityManager.descriptor);
2253 data.writeStrongBinder(who);
2254 data.writeInt(resultCode);
2255 data.writeString(resultData);
2256 data.writeBundle(map);
2257 data.writeInt(abortBroadcast ? 1 : 0);
2258 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2259 reply.readException();
2260 data.recycle();
2261 reply.recycle();
2262 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002263 public void attachApplication(IApplicationThread app) throws RemoteException
2264 {
2265 Parcel data = Parcel.obtain();
2266 Parcel reply = Parcel.obtain();
2267 data.writeInterfaceToken(IActivityManager.descriptor);
2268 data.writeStrongBinder(app.asBinder());
2269 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2270 reply.readException();
2271 data.recycle();
2272 reply.recycle();
2273 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002274 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2275 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002276 {
2277 Parcel data = Parcel.obtain();
2278 Parcel reply = Parcel.obtain();
2279 data.writeInterfaceToken(IActivityManager.descriptor);
2280 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002281 if (config != null) {
2282 data.writeInt(1);
2283 config.writeToParcel(data, 0);
2284 } else {
2285 data.writeInt(0);
2286 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002287 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002288 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2289 reply.readException();
2290 data.recycle();
2291 reply.recycle();
2292 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002293 public void activityResumed(IBinder token) throws RemoteException
2294 {
2295 Parcel data = Parcel.obtain();
2296 Parcel reply = Parcel.obtain();
2297 data.writeInterfaceToken(IActivityManager.descriptor);
2298 data.writeStrongBinder(token);
2299 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2300 reply.readException();
2301 data.recycle();
2302 reply.recycle();
2303 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002304 public void activityPaused(IBinder token) throws RemoteException
2305 {
2306 Parcel data = Parcel.obtain();
2307 Parcel reply = Parcel.obtain();
2308 data.writeInterfaceToken(IActivityManager.descriptor);
2309 data.writeStrongBinder(token);
2310 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2311 reply.readException();
2312 data.recycle();
2313 reply.recycle();
2314 }
2315 public void activityStopped(IBinder token, Bundle state,
2316 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002317 {
2318 Parcel data = Parcel.obtain();
2319 Parcel reply = Parcel.obtain();
2320 data.writeInterfaceToken(IActivityManager.descriptor);
2321 data.writeStrongBinder(token);
2322 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002323 if (thumbnail != null) {
2324 data.writeInt(1);
2325 thumbnail.writeToParcel(data, 0);
2326 } else {
2327 data.writeInt(0);
2328 }
2329 TextUtils.writeToParcel(description, data, 0);
2330 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2331 reply.readException();
2332 data.recycle();
2333 reply.recycle();
2334 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002335 public void activitySlept(IBinder token) throws RemoteException
2336 {
2337 Parcel data = Parcel.obtain();
2338 Parcel reply = Parcel.obtain();
2339 data.writeInterfaceToken(IActivityManager.descriptor);
2340 data.writeStrongBinder(token);
2341 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2342 reply.readException();
2343 data.recycle();
2344 reply.recycle();
2345 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002346 public void activityDestroyed(IBinder token) throws RemoteException
2347 {
2348 Parcel data = Parcel.obtain();
2349 Parcel reply = Parcel.obtain();
2350 data.writeInterfaceToken(IActivityManager.descriptor);
2351 data.writeStrongBinder(token);
2352 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2353 reply.readException();
2354 data.recycle();
2355 reply.recycle();
2356 }
2357 public String getCallingPackage(IBinder token) throws RemoteException
2358 {
2359 Parcel data = Parcel.obtain();
2360 Parcel reply = Parcel.obtain();
2361 data.writeInterfaceToken(IActivityManager.descriptor);
2362 data.writeStrongBinder(token);
2363 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2364 reply.readException();
2365 String res = reply.readString();
2366 data.recycle();
2367 reply.recycle();
2368 return res;
2369 }
2370 public ComponentName getCallingActivity(IBinder token)
2371 throws RemoteException {
2372 Parcel data = Parcel.obtain();
2373 Parcel reply = Parcel.obtain();
2374 data.writeInterfaceToken(IActivityManager.descriptor);
2375 data.writeStrongBinder(token);
2376 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2377 reply.readException();
2378 ComponentName res = ComponentName.readFromParcel(reply);
2379 data.recycle();
2380 reply.recycle();
2381 return res;
2382 }
2383 public List getTasks(int maxNum, int flags,
2384 IThumbnailReceiver receiver) throws RemoteException {
2385 Parcel data = Parcel.obtain();
2386 Parcel reply = Parcel.obtain();
2387 data.writeInterfaceToken(IActivityManager.descriptor);
2388 data.writeInt(maxNum);
2389 data.writeInt(flags);
2390 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2391 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2392 reply.readException();
2393 ArrayList list = null;
2394 int N = reply.readInt();
2395 if (N >= 0) {
2396 list = new ArrayList();
2397 while (N > 0) {
2398 ActivityManager.RunningTaskInfo info =
2399 ActivityManager.RunningTaskInfo.CREATOR
2400 .createFromParcel(reply);
2401 list.add(info);
2402 N--;
2403 }
2404 }
2405 data.recycle();
2406 reply.recycle();
2407 return list;
2408 }
2409 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002410 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002411 Parcel data = Parcel.obtain();
2412 Parcel reply = Parcel.obtain();
2413 data.writeInterfaceToken(IActivityManager.descriptor);
2414 data.writeInt(maxNum);
2415 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002416 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002417 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2418 reply.readException();
2419 ArrayList<ActivityManager.RecentTaskInfo> list
2420 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2421 data.recycle();
2422 reply.recycle();
2423 return list;
2424 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002425 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002426 Parcel data = Parcel.obtain();
2427 Parcel reply = Parcel.obtain();
2428 data.writeInterfaceToken(IActivityManager.descriptor);
2429 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002430 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002431 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002432 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002433 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002434 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002435 }
2436 data.recycle();
2437 reply.recycle();
2438 return bm;
2439 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002440 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2441 Parcel data = Parcel.obtain();
2442 Parcel reply = Parcel.obtain();
2443 data.writeInterfaceToken(IActivityManager.descriptor);
2444 data.writeInt(id);
2445 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2446 reply.readException();
2447 Bitmap bm = null;
2448 if (reply.readInt() != 0) {
2449 bm = Bitmap.CREATOR.createFromParcel(reply);
2450 }
2451 data.recycle();
2452 reply.recycle();
2453 return bm;
2454 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002455 public List getServices(int maxNum, int flags) throws RemoteException {
2456 Parcel data = Parcel.obtain();
2457 Parcel reply = Parcel.obtain();
2458 data.writeInterfaceToken(IActivityManager.descriptor);
2459 data.writeInt(maxNum);
2460 data.writeInt(flags);
2461 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2462 reply.readException();
2463 ArrayList list = null;
2464 int N = reply.readInt();
2465 if (N >= 0) {
2466 list = new ArrayList();
2467 while (N > 0) {
2468 ActivityManager.RunningServiceInfo info =
2469 ActivityManager.RunningServiceInfo.CREATOR
2470 .createFromParcel(reply);
2471 list.add(info);
2472 N--;
2473 }
2474 }
2475 data.recycle();
2476 reply.recycle();
2477 return list;
2478 }
2479 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2480 throws RemoteException {
2481 Parcel data = Parcel.obtain();
2482 Parcel reply = Parcel.obtain();
2483 data.writeInterfaceToken(IActivityManager.descriptor);
2484 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2485 reply.readException();
2486 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2487 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2488 data.recycle();
2489 reply.recycle();
2490 return list;
2491 }
2492 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2493 throws RemoteException {
2494 Parcel data = Parcel.obtain();
2495 Parcel reply = Parcel.obtain();
2496 data.writeInterfaceToken(IActivityManager.descriptor);
2497 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2498 reply.readException();
2499 ArrayList<ActivityManager.RunningAppProcessInfo> list
2500 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2501 data.recycle();
2502 reply.recycle();
2503 return list;
2504 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002505 public List<ApplicationInfo> getRunningExternalApplications()
2506 throws RemoteException {
2507 Parcel data = Parcel.obtain();
2508 Parcel reply = Parcel.obtain();
2509 data.writeInterfaceToken(IActivityManager.descriptor);
2510 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2511 reply.readException();
2512 ArrayList<ApplicationInfo> list
2513 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2514 data.recycle();
2515 reply.recycle();
2516 return list;
2517 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002518 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002519 {
2520 Parcel data = Parcel.obtain();
2521 Parcel reply = Parcel.obtain();
2522 data.writeInterfaceToken(IActivityManager.descriptor);
2523 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002524 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002525 if (options != null) {
2526 data.writeInt(1);
2527 options.writeToParcel(data, 0);
2528 } else {
2529 data.writeInt(0);
2530 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002531 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2532 reply.readException();
2533 data.recycle();
2534 reply.recycle();
2535 }
2536 public void moveTaskToBack(int task) throws RemoteException
2537 {
2538 Parcel data = Parcel.obtain();
2539 Parcel reply = Parcel.obtain();
2540 data.writeInterfaceToken(IActivityManager.descriptor);
2541 data.writeInt(task);
2542 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2543 reply.readException();
2544 data.recycle();
2545 reply.recycle();
2546 }
2547 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2548 throws RemoteException {
2549 Parcel data = Parcel.obtain();
2550 Parcel reply = Parcel.obtain();
2551 data.writeInterfaceToken(IActivityManager.descriptor);
2552 data.writeStrongBinder(token);
2553 data.writeInt(nonRoot ? 1 : 0);
2554 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2555 reply.readException();
2556 boolean res = reply.readInt() != 0;
2557 data.recycle();
2558 reply.recycle();
2559 return res;
2560 }
2561 public void moveTaskBackwards(int task) throws RemoteException
2562 {
2563 Parcel data = Parcel.obtain();
2564 Parcel reply = Parcel.obtain();
2565 data.writeInterfaceToken(IActivityManager.descriptor);
2566 data.writeInt(task);
2567 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2568 reply.readException();
2569 data.recycle();
2570 reply.recycle();
2571 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002572 @Override
2573 public int createStack(int position, int relativeStackId, float weight) throws RemoteException
2574 {
2575 Parcel data = Parcel.obtain();
2576 Parcel reply = Parcel.obtain();
2577 data.writeInt(position);
2578 data.writeInt(relativeStackId);
2579 data.writeFloat(weight);
2580 mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
2581 reply.readException();
2582 int res = reply.readInt();
2583 data.recycle();
2584 reply.recycle();
2585 return res;
2586 }
2587 @Override
2588 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2589 {
2590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInt(taskId);
2593 data.writeInt(stackId);
2594 data.writeInt(toTop ? 1 : 0);
2595 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2596 reply.readException();
2597 data.recycle();
2598 reply.recycle();
2599 }
2600 @Override
2601 public void resizeStack(int stackId, float weight) throws RemoteException
2602 {
2603 Parcel data = Parcel.obtain();
2604 Parcel reply = Parcel.obtain();
2605 data.writeInt(stackId);
2606 data.writeFloat(weight);
2607 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
2608 reply.readException();
2609 data.recycle();
2610 reply.recycle();
2611 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002612 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2613 {
2614 Parcel data = Parcel.obtain();
2615 Parcel reply = Parcel.obtain();
2616 data.writeInterfaceToken(IActivityManager.descriptor);
2617 data.writeStrongBinder(token);
2618 data.writeInt(onlyRoot ? 1 : 0);
2619 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2620 reply.readException();
2621 int res = reply.readInt();
2622 data.recycle();
2623 reply.recycle();
2624 return res;
2625 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002626 public void reportThumbnail(IBinder token,
2627 Bitmap thumbnail, CharSequence description) throws RemoteException
2628 {
2629 Parcel data = Parcel.obtain();
2630 Parcel reply = Parcel.obtain();
2631 data.writeInterfaceToken(IActivityManager.descriptor);
2632 data.writeStrongBinder(token);
2633 if (thumbnail != null) {
2634 data.writeInt(1);
2635 thumbnail.writeToParcel(data, 0);
2636 } else {
2637 data.writeInt(0);
2638 }
2639 TextUtils.writeToParcel(description, data, 0);
2640 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2641 reply.readException();
2642 data.recycle();
2643 reply.recycle();
2644 }
2645 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002646 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002647 Parcel data = Parcel.obtain();
2648 Parcel reply = Parcel.obtain();
2649 data.writeInterfaceToken(IActivityManager.descriptor);
2650 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2651 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002652 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002653 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002654 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2655 reply.readException();
2656 int res = reply.readInt();
2657 ContentProviderHolder cph = null;
2658 if (res != 0) {
2659 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2660 }
2661 data.recycle();
2662 reply.recycle();
2663 return cph;
2664 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002665 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2666 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002667 Parcel data = Parcel.obtain();
2668 Parcel reply = Parcel.obtain();
2669 data.writeInterfaceToken(IActivityManager.descriptor);
2670 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002671 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002672 data.writeStrongBinder(token);
2673 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2674 reply.readException();
2675 int res = reply.readInt();
2676 ContentProviderHolder cph = null;
2677 if (res != 0) {
2678 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2679 }
2680 data.recycle();
2681 reply.recycle();
2682 return cph;
2683 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002684 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002685 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002686 {
2687 Parcel data = Parcel.obtain();
2688 Parcel reply = Parcel.obtain();
2689 data.writeInterfaceToken(IActivityManager.descriptor);
2690 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2691 data.writeTypedList(providers);
2692 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2693 reply.readException();
2694 data.recycle();
2695 reply.recycle();
2696 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002697 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2698 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 Parcel data = Parcel.obtain();
2700 Parcel reply = Parcel.obtain();
2701 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002702 data.writeStrongBinder(connection);
2703 data.writeInt(stable);
2704 data.writeInt(unstable);
2705 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2706 reply.readException();
2707 boolean res = reply.readInt() != 0;
2708 data.recycle();
2709 reply.recycle();
2710 return res;
2711 }
2712 public void unstableProviderDied(IBinder connection) throws RemoteException {
2713 Parcel data = Parcel.obtain();
2714 Parcel reply = Parcel.obtain();
2715 data.writeInterfaceToken(IActivityManager.descriptor);
2716 data.writeStrongBinder(connection);
2717 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 data.recycle();
2720 reply.recycle();
2721 }
2722
2723 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2724 Parcel data = Parcel.obtain();
2725 Parcel reply = Parcel.obtain();
2726 data.writeInterfaceToken(IActivityManager.descriptor);
2727 data.writeStrongBinder(connection);
2728 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002729 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2730 reply.readException();
2731 data.recycle();
2732 reply.recycle();
2733 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002734
2735 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2736 Parcel data = Parcel.obtain();
2737 Parcel reply = Parcel.obtain();
2738 data.writeInterfaceToken(IActivityManager.descriptor);
2739 data.writeString(name);
2740 data.writeStrongBinder(token);
2741 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2742 reply.readException();
2743 data.recycle();
2744 reply.recycle();
2745 }
2746
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002747 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2748 throws RemoteException
2749 {
2750 Parcel data = Parcel.obtain();
2751 Parcel reply = Parcel.obtain();
2752 data.writeInterfaceToken(IActivityManager.descriptor);
2753 service.writeToParcel(data, 0);
2754 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2755 reply.readException();
2756 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2757 data.recycle();
2758 reply.recycle();
2759 return res;
2760 }
2761
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002762 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002763 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002764 {
2765 Parcel data = Parcel.obtain();
2766 Parcel reply = Parcel.obtain();
2767 data.writeInterfaceToken(IActivityManager.descriptor);
2768 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2769 service.writeToParcel(data, 0);
2770 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002771 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002772 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2773 reply.readException();
2774 ComponentName res = ComponentName.readFromParcel(reply);
2775 data.recycle();
2776 reply.recycle();
2777 return res;
2778 }
2779 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002780 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002781 {
2782 Parcel data = Parcel.obtain();
2783 Parcel reply = Parcel.obtain();
2784 data.writeInterfaceToken(IActivityManager.descriptor);
2785 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2786 service.writeToParcel(data, 0);
2787 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002788 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002789 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2790 reply.readException();
2791 int res = reply.readInt();
2792 reply.recycle();
2793 data.recycle();
2794 return res;
2795 }
2796 public boolean stopServiceToken(ComponentName className, IBinder token,
2797 int startId) throws RemoteException {
2798 Parcel data = Parcel.obtain();
2799 Parcel reply = Parcel.obtain();
2800 data.writeInterfaceToken(IActivityManager.descriptor);
2801 ComponentName.writeToParcel(className, data);
2802 data.writeStrongBinder(token);
2803 data.writeInt(startId);
2804 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2805 reply.readException();
2806 boolean res = reply.readInt() != 0;
2807 data.recycle();
2808 reply.recycle();
2809 return res;
2810 }
2811 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002812 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 ComponentName.writeToParcel(className, data);
2817 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002818 data.writeInt(id);
2819 if (notification != null) {
2820 data.writeInt(1);
2821 notification.writeToParcel(data, 0);
2822 } else {
2823 data.writeInt(0);
2824 }
2825 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002826 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2827 reply.readException();
2828 data.recycle();
2829 reply.recycle();
2830 }
2831 public int bindService(IApplicationThread caller, IBinder token,
2832 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002833 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002834 Parcel data = Parcel.obtain();
2835 Parcel reply = Parcel.obtain();
2836 data.writeInterfaceToken(IActivityManager.descriptor);
2837 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2838 data.writeStrongBinder(token);
2839 service.writeToParcel(data, 0);
2840 data.writeString(resolvedType);
2841 data.writeStrongBinder(connection.asBinder());
2842 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002843 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002844 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2845 reply.readException();
2846 int res = reply.readInt();
2847 data.recycle();
2848 reply.recycle();
2849 return res;
2850 }
2851 public boolean unbindService(IServiceConnection connection) throws RemoteException
2852 {
2853 Parcel data = Parcel.obtain();
2854 Parcel reply = Parcel.obtain();
2855 data.writeInterfaceToken(IActivityManager.descriptor);
2856 data.writeStrongBinder(connection.asBinder());
2857 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2858 reply.readException();
2859 boolean res = reply.readInt() != 0;
2860 data.recycle();
2861 reply.recycle();
2862 return res;
2863 }
2864
2865 public void publishService(IBinder token,
2866 Intent intent, IBinder service) throws RemoteException {
2867 Parcel data = Parcel.obtain();
2868 Parcel reply = Parcel.obtain();
2869 data.writeInterfaceToken(IActivityManager.descriptor);
2870 data.writeStrongBinder(token);
2871 intent.writeToParcel(data, 0);
2872 data.writeStrongBinder(service);
2873 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2874 reply.readException();
2875 data.recycle();
2876 reply.recycle();
2877 }
2878
2879 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2880 throws RemoteException {
2881 Parcel data = Parcel.obtain();
2882 Parcel reply = Parcel.obtain();
2883 data.writeInterfaceToken(IActivityManager.descriptor);
2884 data.writeStrongBinder(token);
2885 intent.writeToParcel(data, 0);
2886 data.writeInt(doRebind ? 1 : 0);
2887 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2888 reply.readException();
2889 data.recycle();
2890 reply.recycle();
2891 }
2892
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002893 public void serviceDoneExecuting(IBinder token, int type, int startId,
2894 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002899 data.writeInt(type);
2900 data.writeInt(startId);
2901 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002902 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2903 reply.readException();
2904 data.recycle();
2905 reply.recycle();
2906 }
2907
2908 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2909 Parcel data = Parcel.obtain();
2910 Parcel reply = Parcel.obtain();
2911 data.writeInterfaceToken(IActivityManager.descriptor);
2912 service.writeToParcel(data, 0);
2913 data.writeString(resolvedType);
2914 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2915 reply.readException();
2916 IBinder binder = reply.readStrongBinder();
2917 reply.recycle();
2918 data.recycle();
2919 return binder;
2920 }
2921
Christopher Tate181fafa2009-05-14 11:12:14 -07002922 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2923 throws RemoteException {
2924 Parcel data = Parcel.obtain();
2925 Parcel reply = Parcel.obtain();
2926 data.writeInterfaceToken(IActivityManager.descriptor);
2927 app.writeToParcel(data, 0);
2928 data.writeInt(backupRestoreMode);
2929 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2930 reply.readException();
2931 boolean success = reply.readInt() != 0;
2932 reply.recycle();
2933 data.recycle();
2934 return success;
2935 }
2936
Christopher Tate346acb12012-10-15 19:20:25 -07002937 public void clearPendingBackup() throws RemoteException {
2938 Parcel data = Parcel.obtain();
2939 Parcel reply = Parcel.obtain();
2940 data.writeInterfaceToken(IActivityManager.descriptor);
2941 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
2942 reply.recycle();
2943 data.recycle();
2944 }
2945
Christopher Tate181fafa2009-05-14 11:12:14 -07002946 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2947 Parcel data = Parcel.obtain();
2948 Parcel reply = Parcel.obtain();
2949 data.writeInterfaceToken(IActivityManager.descriptor);
2950 data.writeString(packageName);
2951 data.writeStrongBinder(agent);
2952 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2953 reply.recycle();
2954 data.recycle();
2955 }
2956
2957 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2958 Parcel data = Parcel.obtain();
2959 Parcel reply = Parcel.obtain();
2960 data.writeInterfaceToken(IActivityManager.descriptor);
2961 app.writeToParcel(data, 0);
2962 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2963 reply.readException();
2964 reply.recycle();
2965 data.recycle();
2966 }
2967
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002968 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002969 int flags, Bundle arguments, IInstrumentationWatcher watcher,
2970 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 Parcel data = Parcel.obtain();
2972 Parcel reply = Parcel.obtain();
2973 data.writeInterfaceToken(IActivityManager.descriptor);
2974 ComponentName.writeToParcel(className, data);
2975 data.writeString(profileFile);
2976 data.writeInt(flags);
2977 data.writeBundle(arguments);
2978 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002979 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002980 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002981 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2982 reply.readException();
2983 boolean res = reply.readInt() != 0;
2984 reply.recycle();
2985 data.recycle();
2986 return res;
2987 }
2988
2989 public void finishInstrumentation(IApplicationThread target,
2990 int resultCode, Bundle results) throws RemoteException {
2991 Parcel data = Parcel.obtain();
2992 Parcel reply = Parcel.obtain();
2993 data.writeInterfaceToken(IActivityManager.descriptor);
2994 data.writeStrongBinder(target != null ? target.asBinder() : null);
2995 data.writeInt(resultCode);
2996 data.writeBundle(results);
2997 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2998 reply.readException();
2999 data.recycle();
3000 reply.recycle();
3001 }
3002 public Configuration getConfiguration() throws RemoteException
3003 {
3004 Parcel data = Parcel.obtain();
3005 Parcel reply = Parcel.obtain();
3006 data.writeInterfaceToken(IActivityManager.descriptor);
3007 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3008 reply.readException();
3009 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3010 reply.recycle();
3011 data.recycle();
3012 return res;
3013 }
3014 public void updateConfiguration(Configuration values) throws RemoteException
3015 {
3016 Parcel data = Parcel.obtain();
3017 Parcel reply = Parcel.obtain();
3018 data.writeInterfaceToken(IActivityManager.descriptor);
3019 values.writeToParcel(data, 0);
3020 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3021 reply.readException();
3022 data.recycle();
3023 reply.recycle();
3024 }
3025 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3026 throws RemoteException {
3027 Parcel data = Parcel.obtain();
3028 Parcel reply = Parcel.obtain();
3029 data.writeInterfaceToken(IActivityManager.descriptor);
3030 data.writeStrongBinder(token);
3031 data.writeInt(requestedOrientation);
3032 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3033 reply.readException();
3034 data.recycle();
3035 reply.recycle();
3036 }
3037 public int getRequestedOrientation(IBinder token) throws RemoteException {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 data.writeStrongBinder(token);
3042 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3043 reply.readException();
3044 int res = reply.readInt();
3045 data.recycle();
3046 reply.recycle();
3047 return res;
3048 }
3049 public ComponentName getActivityClassForToken(IBinder token)
3050 throws RemoteException {
3051 Parcel data = Parcel.obtain();
3052 Parcel reply = Parcel.obtain();
3053 data.writeInterfaceToken(IActivityManager.descriptor);
3054 data.writeStrongBinder(token);
3055 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 ComponentName res = ComponentName.readFromParcel(reply);
3058 data.recycle();
3059 reply.recycle();
3060 return res;
3061 }
3062 public String getPackageForToken(IBinder token) throws RemoteException
3063 {
3064 Parcel data = Parcel.obtain();
3065 Parcel reply = Parcel.obtain();
3066 data.writeInterfaceToken(IActivityManager.descriptor);
3067 data.writeStrongBinder(token);
3068 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3069 reply.readException();
3070 String res = reply.readString();
3071 data.recycle();
3072 reply.recycle();
3073 return res;
3074 }
3075 public IIntentSender getIntentSender(int type,
3076 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003077 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003078 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 data.writeInt(type);
3083 data.writeString(packageName);
3084 data.writeStrongBinder(token);
3085 data.writeString(resultWho);
3086 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003087 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003088 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003089 data.writeTypedArray(intents, 0);
3090 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003091 } else {
3092 data.writeInt(0);
3093 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003094 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003095 if (options != null) {
3096 data.writeInt(1);
3097 options.writeToParcel(data, 0);
3098 } else {
3099 data.writeInt(0);
3100 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003101 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003102 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3103 reply.readException();
3104 IIntentSender res = IIntentSender.Stub.asInterface(
3105 reply.readStrongBinder());
3106 data.recycle();
3107 reply.recycle();
3108 return res;
3109 }
3110 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3111 Parcel data = Parcel.obtain();
3112 Parcel reply = Parcel.obtain();
3113 data.writeInterfaceToken(IActivityManager.descriptor);
3114 data.writeStrongBinder(sender.asBinder());
3115 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3116 reply.readException();
3117 data.recycle();
3118 reply.recycle();
3119 }
3120 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3121 Parcel data = Parcel.obtain();
3122 Parcel reply = Parcel.obtain();
3123 data.writeInterfaceToken(IActivityManager.descriptor);
3124 data.writeStrongBinder(sender.asBinder());
3125 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3126 reply.readException();
3127 String res = reply.readString();
3128 data.recycle();
3129 reply.recycle();
3130 return res;
3131 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003132 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3133 Parcel data = Parcel.obtain();
3134 Parcel reply = Parcel.obtain();
3135 data.writeInterfaceToken(IActivityManager.descriptor);
3136 data.writeStrongBinder(sender.asBinder());
3137 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3138 reply.readException();
3139 int res = reply.readInt();
3140 data.recycle();
3141 reply.recycle();
3142 return res;
3143 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003144 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3145 boolean requireFull, String name, String callerPackage) throws RemoteException {
3146 Parcel data = Parcel.obtain();
3147 Parcel reply = Parcel.obtain();
3148 data.writeInterfaceToken(IActivityManager.descriptor);
3149 data.writeInt(callingPid);
3150 data.writeInt(callingUid);
3151 data.writeInt(userId);
3152 data.writeInt(allowAll ? 1 : 0);
3153 data.writeInt(requireFull ? 1 : 0);
3154 data.writeString(name);
3155 data.writeString(callerPackage);
3156 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3157 reply.readException();
3158 int res = reply.readInt();
3159 data.recycle();
3160 reply.recycle();
3161 return res;
3162 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003163 public void setProcessLimit(int max) throws RemoteException
3164 {
3165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 data.writeInt(max);
3169 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3170 reply.readException();
3171 data.recycle();
3172 reply.recycle();
3173 }
3174 public int getProcessLimit() throws RemoteException
3175 {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3180 reply.readException();
3181 int res = reply.readInt();
3182 data.recycle();
3183 reply.recycle();
3184 return res;
3185 }
3186 public void setProcessForeground(IBinder token, int pid,
3187 boolean isForeground) throws RemoteException {
3188 Parcel data = Parcel.obtain();
3189 Parcel reply = Parcel.obtain();
3190 data.writeInterfaceToken(IActivityManager.descriptor);
3191 data.writeStrongBinder(token);
3192 data.writeInt(pid);
3193 data.writeInt(isForeground ? 1 : 0);
3194 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3195 reply.readException();
3196 data.recycle();
3197 reply.recycle();
3198 }
3199 public int checkPermission(String permission, int pid, int uid)
3200 throws RemoteException {
3201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeString(permission);
3205 data.writeInt(pid);
3206 data.writeInt(uid);
3207 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3208 reply.readException();
3209 int res = reply.readInt();
3210 data.recycle();
3211 reply.recycle();
3212 return res;
3213 }
3214 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003215 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 Parcel data = Parcel.obtain();
3217 Parcel reply = Parcel.obtain();
3218 data.writeInterfaceToken(IActivityManager.descriptor);
3219 data.writeString(packageName);
3220 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003221 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003222 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3223 reply.readException();
3224 boolean res = reply.readInt() != 0;
3225 data.recycle();
3226 reply.recycle();
3227 return res;
3228 }
3229 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3230 throws RemoteException {
3231 Parcel data = Parcel.obtain();
3232 Parcel reply = Parcel.obtain();
3233 data.writeInterfaceToken(IActivityManager.descriptor);
3234 uri.writeToParcel(data, 0);
3235 data.writeInt(pid);
3236 data.writeInt(uid);
3237 data.writeInt(mode);
3238 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3239 reply.readException();
3240 int res = reply.readInt();
3241 data.recycle();
3242 reply.recycle();
3243 return res;
3244 }
3245 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3246 Uri uri, int mode) throws RemoteException {
3247 Parcel data = Parcel.obtain();
3248 Parcel reply = Parcel.obtain();
3249 data.writeInterfaceToken(IActivityManager.descriptor);
3250 data.writeStrongBinder(caller.asBinder());
3251 data.writeString(targetPkg);
3252 uri.writeToParcel(data, 0);
3253 data.writeInt(mode);
3254 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3255 reply.readException();
3256 data.recycle();
3257 reply.recycle();
3258 }
3259 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3260 int mode) throws RemoteException {
3261 Parcel data = Parcel.obtain();
3262 Parcel reply = Parcel.obtain();
3263 data.writeInterfaceToken(IActivityManager.descriptor);
3264 data.writeStrongBinder(caller.asBinder());
3265 uri.writeToParcel(data, 0);
3266 data.writeInt(mode);
3267 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3268 reply.readException();
3269 data.recycle();
3270 reply.recycle();
3271 }
3272 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3273 throws RemoteException {
3274 Parcel data = Parcel.obtain();
3275 Parcel reply = Parcel.obtain();
3276 data.writeInterfaceToken(IActivityManager.descriptor);
3277 data.writeStrongBinder(who.asBinder());
3278 data.writeInt(waiting ? 1 : 0);
3279 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3280 reply.readException();
3281 data.recycle();
3282 reply.recycle();
3283 }
3284 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3285 Parcel data = Parcel.obtain();
3286 Parcel reply = Parcel.obtain();
3287 data.writeInterfaceToken(IActivityManager.descriptor);
3288 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3289 reply.readException();
3290 outInfo.readFromParcel(reply);
3291 data.recycle();
3292 reply.recycle();
3293 }
3294 public void unhandledBack() throws RemoteException
3295 {
3296 Parcel data = Parcel.obtain();
3297 Parcel reply = Parcel.obtain();
3298 data.writeInterfaceToken(IActivityManager.descriptor);
3299 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3300 reply.readException();
3301 data.recycle();
3302 reply.recycle();
3303 }
3304 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3305 {
3306 Parcel data = Parcel.obtain();
3307 Parcel reply = Parcel.obtain();
3308 data.writeInterfaceToken(IActivityManager.descriptor);
3309 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3310 reply.readException();
3311 ParcelFileDescriptor pfd = null;
3312 if (reply.readInt() != 0) {
3313 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3314 }
3315 data.recycle();
3316 reply.recycle();
3317 return pfd;
3318 }
3319 public void goingToSleep() throws RemoteException
3320 {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3325 reply.readException();
3326 data.recycle();
3327 reply.recycle();
3328 }
3329 public void wakingUp() throws RemoteException
3330 {
3331 Parcel data = Parcel.obtain();
3332 Parcel reply = Parcel.obtain();
3333 data.writeInterfaceToken(IActivityManager.descriptor);
3334 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3335 reply.readException();
3336 data.recycle();
3337 reply.recycle();
3338 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003339 public void setLockScreenShown(boolean shown) throws RemoteException
3340 {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 data.writeInt(shown ? 1 : 0);
3345 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 data.recycle();
3348 reply.recycle();
3349 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 public void setDebugApp(
3351 String packageName, boolean waitForDebugger, boolean persistent)
3352 throws RemoteException
3353 {
3354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
3356 data.writeInterfaceToken(IActivityManager.descriptor);
3357 data.writeString(packageName);
3358 data.writeInt(waitForDebugger ? 1 : 0);
3359 data.writeInt(persistent ? 1 : 0);
3360 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3361 reply.readException();
3362 data.recycle();
3363 reply.recycle();
3364 }
3365 public void setAlwaysFinish(boolean enabled) throws RemoteException
3366 {
3367 Parcel data = Parcel.obtain();
3368 Parcel reply = Parcel.obtain();
3369 data.writeInterfaceToken(IActivityManager.descriptor);
3370 data.writeInt(enabled ? 1 : 0);
3371 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3372 reply.readException();
3373 data.recycle();
3374 reply.recycle();
3375 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003376 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003377 {
3378 Parcel data = Parcel.obtain();
3379 Parcel reply = Parcel.obtain();
3380 data.writeInterfaceToken(IActivityManager.descriptor);
3381 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003382 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003383 reply.readException();
3384 data.recycle();
3385 reply.recycle();
3386 }
3387 public void enterSafeMode() throws RemoteException {
3388 Parcel data = Parcel.obtain();
3389 data.writeInterfaceToken(IActivityManager.descriptor);
3390 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3391 data.recycle();
3392 }
3393 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3394 Parcel data = Parcel.obtain();
3395 data.writeStrongBinder(sender.asBinder());
3396 data.writeInterfaceToken(IActivityManager.descriptor);
3397 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3398 data.recycle();
3399 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003400 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003401 Parcel data = Parcel.obtain();
3402 Parcel reply = Parcel.obtain();
3403 data.writeInterfaceToken(IActivityManager.descriptor);
3404 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003405 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003406 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003407 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003408 boolean res = reply.readInt() != 0;
3409 data.recycle();
3410 reply.recycle();
3411 return res;
3412 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003413 @Override
3414 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3415 Parcel data = Parcel.obtain();
3416 Parcel reply = Parcel.obtain();
3417 data.writeInterfaceToken(IActivityManager.descriptor);
3418 data.writeString(reason);
3419 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3420 boolean res = reply.readInt() != 0;
3421 data.recycle();
3422 reply.recycle();
3423 return res;
3424 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003425 public void startRunning(String pkg, String cls, String action,
3426 String indata) throws RemoteException {
3427 Parcel data = Parcel.obtain();
3428 Parcel reply = Parcel.obtain();
3429 data.writeInterfaceToken(IActivityManager.descriptor);
3430 data.writeString(pkg);
3431 data.writeString(cls);
3432 data.writeString(action);
3433 data.writeString(indata);
3434 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3435 reply.readException();
3436 data.recycle();
3437 reply.recycle();
3438 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003439 public boolean testIsSystemReady()
3440 {
3441 /* this base class version is never called */
3442 return true;
3443 }
Dan Egnor60d87622009-12-16 16:32:58 -08003444 public void handleApplicationCrash(IBinder app,
3445 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3446 {
3447 Parcel data = Parcel.obtain();
3448 Parcel reply = Parcel.obtain();
3449 data.writeInterfaceToken(IActivityManager.descriptor);
3450 data.writeStrongBinder(app);
3451 crashInfo.writeToParcel(data, 0);
3452 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3453 reply.readException();
3454 reply.recycle();
3455 data.recycle();
3456 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003457
Dan Egnor60d87622009-12-16 16:32:58 -08003458 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003459 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 {
3461 Parcel data = Parcel.obtain();
3462 Parcel reply = Parcel.obtain();
3463 data.writeInterfaceToken(IActivityManager.descriptor);
3464 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003465 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003466 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003467 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003468 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003469 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003470 reply.recycle();
3471 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003472 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003473 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003474
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003475 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003476 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003477 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003478 {
3479 Parcel data = Parcel.obtain();
3480 Parcel reply = Parcel.obtain();
3481 data.writeInterfaceToken(IActivityManager.descriptor);
3482 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003483 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003484 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003485 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3486 reply.readException();
3487 reply.recycle();
3488 data.recycle();
3489 }
3490
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003491 public void signalPersistentProcesses(int sig) throws RemoteException {
3492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 data.writeInt(sig);
3496 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3497 reply.readException();
3498 data.recycle();
3499 reply.recycle();
3500 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003501
Dianne Hackborn1676c852012-09-10 14:52:30 -07003502 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003503 Parcel data = Parcel.obtain();
3504 Parcel reply = Parcel.obtain();
3505 data.writeInterfaceToken(IActivityManager.descriptor);
3506 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003507 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003508 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3509 reply.readException();
3510 data.recycle();
3511 reply.recycle();
3512 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003513
3514 public void killAllBackgroundProcesses() throws RemoteException {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3519 reply.readException();
3520 data.recycle();
3521 reply.recycle();
3522 }
3523
Dianne Hackborn1676c852012-09-10 14:52:30 -07003524 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003525 Parcel data = Parcel.obtain();
3526 Parcel reply = Parcel.obtain();
3527 data.writeInterfaceToken(IActivityManager.descriptor);
3528 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003529 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003530 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003531 reply.readException();
3532 data.recycle();
3533 reply.recycle();
3534 }
3535
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003536 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3537 throws RemoteException
3538 {
3539 Parcel data = Parcel.obtain();
3540 Parcel reply = Parcel.obtain();
3541 data.writeInterfaceToken(IActivityManager.descriptor);
3542 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3543 reply.readException();
3544 outInfo.readFromParcel(reply);
3545 reply.recycle();
3546 data.recycle();
3547 }
3548
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003549 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3550 {
3551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3555 reply.readException();
3556 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3557 reply.recycle();
3558 data.recycle();
3559 return res;
3560 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003561
Dianne Hackborn1676c852012-09-10 14:52:30 -07003562 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003563 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003564 {
3565 Parcel data = Parcel.obtain();
3566 Parcel reply = Parcel.obtain();
3567 data.writeInterfaceToken(IActivityManager.descriptor);
3568 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003569 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003570 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003571 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003572 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003573 if (fd != null) {
3574 data.writeInt(1);
3575 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3576 } else {
3577 data.writeInt(0);
3578 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003579 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3580 reply.readException();
3581 boolean res = reply.readInt() != 0;
3582 reply.recycle();
3583 data.recycle();
3584 return res;
3585 }
3586
Dianne Hackborn55280a92009-05-07 15:53:46 -07003587 public boolean shutdown(int timeout) throws RemoteException
3588 {
3589 Parcel data = Parcel.obtain();
3590 Parcel reply = Parcel.obtain();
3591 data.writeInterfaceToken(IActivityManager.descriptor);
3592 data.writeInt(timeout);
3593 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3594 reply.readException();
3595 boolean res = reply.readInt() != 0;
3596 reply.recycle();
3597 data.recycle();
3598 return res;
3599 }
3600
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003601 public void stopAppSwitches() throws RemoteException {
3602 Parcel data = Parcel.obtain();
3603 Parcel reply = Parcel.obtain();
3604 data.writeInterfaceToken(IActivityManager.descriptor);
3605 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3606 reply.readException();
3607 reply.recycle();
3608 data.recycle();
3609 }
3610
3611 public void resumeAppSwitches() throws RemoteException {
3612 Parcel data = Parcel.obtain();
3613 Parcel reply = Parcel.obtain();
3614 data.writeInterfaceToken(IActivityManager.descriptor);
3615 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3616 reply.readException();
3617 reply.recycle();
3618 data.recycle();
3619 }
3620
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003621 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003622 Parcel data = Parcel.obtain();
3623 Parcel reply = Parcel.obtain();
3624 data.writeInterfaceToken(IActivityManager.descriptor);
3625 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003626 data.writeInt(appid);
3627 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003628 reply.readException();
3629 data.recycle();
3630 reply.recycle();
3631 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003632
3633 public void closeSystemDialogs(String reason) throws RemoteException {
3634 Parcel data = Parcel.obtain();
3635 Parcel reply = Parcel.obtain();
3636 data.writeInterfaceToken(IActivityManager.descriptor);
3637 data.writeString(reason);
3638 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3639 reply.readException();
3640 data.recycle();
3641 reply.recycle();
3642 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003643
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003644 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003645 throws RemoteException {
3646 Parcel data = Parcel.obtain();
3647 Parcel reply = Parcel.obtain();
3648 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003649 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003650 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3651 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003652 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003653 data.recycle();
3654 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003655 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003656 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003657
3658 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3659 Parcel data = Parcel.obtain();
3660 Parcel reply = Parcel.obtain();
3661 data.writeInterfaceToken(IActivityManager.descriptor);
3662 data.writeString(processName);
3663 data.writeInt(uid);
3664 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3665 reply.readException();
3666 data.recycle();
3667 reply.recycle();
3668 }
3669
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003670 public void overridePendingTransition(IBinder token, String packageName,
3671 int enterAnim, int exitAnim) throws RemoteException {
3672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 data.writeStrongBinder(token);
3676 data.writeString(packageName);
3677 data.writeInt(enterAnim);
3678 data.writeInt(exitAnim);
3679 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3680 reply.readException();
3681 data.recycle();
3682 reply.recycle();
3683 }
3684
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003685 public boolean isUserAMonkey() throws RemoteException {
3686 Parcel data = Parcel.obtain();
3687 Parcel reply = Parcel.obtain();
3688 data.writeInterfaceToken(IActivityManager.descriptor);
3689 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3690 reply.readException();
3691 boolean res = reply.readInt() != 0;
3692 data.recycle();
3693 reply.recycle();
3694 return res;
3695 }
3696
Dianne Hackborn860755f2010-06-03 18:47:52 -07003697 public void finishHeavyWeightApp() throws RemoteException {
3698 Parcel data = Parcel.obtain();
3699 Parcel reply = Parcel.obtain();
3700 data.writeInterfaceToken(IActivityManager.descriptor);
3701 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3702 reply.readException();
3703 data.recycle();
3704 reply.recycle();
3705 }
3706
Daniel Sandler69a48172010-06-23 16:29:36 -04003707 public void setImmersive(IBinder token, boolean immersive)
3708 throws RemoteException {
3709 Parcel data = Parcel.obtain();
3710 Parcel reply = Parcel.obtain();
3711 data.writeInterfaceToken(IActivityManager.descriptor);
3712 data.writeStrongBinder(token);
3713 data.writeInt(immersive ? 1 : 0);
3714 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3715 reply.readException();
3716 data.recycle();
3717 reply.recycle();
3718 }
3719
3720 public boolean isImmersive(IBinder token)
3721 throws RemoteException {
3722 Parcel data = Parcel.obtain();
3723 Parcel reply = Parcel.obtain();
3724 data.writeInterfaceToken(IActivityManager.descriptor);
3725 data.writeStrongBinder(token);
3726 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003727 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003728 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003729 data.recycle();
3730 reply.recycle();
3731 return res;
3732 }
3733
3734 public boolean isTopActivityImmersive()
3735 throws RemoteException {
3736 Parcel data = Parcel.obtain();
3737 Parcel reply = Parcel.obtain();
3738 data.writeInterfaceToken(IActivityManager.descriptor);
3739 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003740 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003741 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003742 data.recycle();
3743 reply.recycle();
3744 return res;
3745 }
3746
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003747 public void crashApplication(int uid, int initialPid, String packageName,
3748 String message) throws RemoteException {
3749 Parcel data = Parcel.obtain();
3750 Parcel reply = Parcel.obtain();
3751 data.writeInterfaceToken(IActivityManager.descriptor);
3752 data.writeInt(uid);
3753 data.writeInt(initialPid);
3754 data.writeString(packageName);
3755 data.writeString(message);
3756 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3757 reply.readException();
3758 data.recycle();
3759 reply.recycle();
3760 }
Andy McFadden824c5102010-07-09 16:26:57 -07003761
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003762 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003767 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003768 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 String res = reply.readString();
3771 data.recycle();
3772 reply.recycle();
3773 return res;
3774 }
3775
Dianne Hackborn7e269642010-08-25 19:50:20 -07003776 public IBinder newUriPermissionOwner(String name)
3777 throws RemoteException {
3778 Parcel data = Parcel.obtain();
3779 Parcel reply = Parcel.obtain();
3780 data.writeInterfaceToken(IActivityManager.descriptor);
3781 data.writeString(name);
3782 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3783 reply.readException();
3784 IBinder res = reply.readStrongBinder();
3785 data.recycle();
3786 reply.recycle();
3787 return res;
3788 }
3789
3790 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3791 Uri uri, int mode) throws RemoteException {
3792 Parcel data = Parcel.obtain();
3793 Parcel reply = Parcel.obtain();
3794 data.writeInterfaceToken(IActivityManager.descriptor);
3795 data.writeStrongBinder(owner);
3796 data.writeInt(fromUid);
3797 data.writeString(targetPkg);
3798 uri.writeToParcel(data, 0);
3799 data.writeInt(mode);
3800 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3801 reply.readException();
3802 data.recycle();
3803 reply.recycle();
3804 }
3805
3806 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3807 int mode) throws RemoteException {
3808 Parcel data = Parcel.obtain();
3809 Parcel reply = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 data.writeStrongBinder(owner);
3812 if (uri != null) {
3813 data.writeInt(1);
3814 uri.writeToParcel(data, 0);
3815 } else {
3816 data.writeInt(0);
3817 }
3818 data.writeInt(mode);
3819 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 data.recycle();
3822 reply.recycle();
3823 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003824
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003825 public int checkGrantUriPermission(int callingUid, String targetPkg,
3826 Uri uri, int modeFlags) throws RemoteException {
3827 Parcel data = Parcel.obtain();
3828 Parcel reply = Parcel.obtain();
3829 data.writeInterfaceToken(IActivityManager.descriptor);
3830 data.writeInt(callingUid);
3831 data.writeString(targetPkg);
3832 uri.writeToParcel(data, 0);
3833 data.writeInt(modeFlags);
3834 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3835 reply.readException();
3836 int res = reply.readInt();
3837 data.recycle();
3838 reply.recycle();
3839 return res;
3840 }
3841
Dianne Hackborn1676c852012-09-10 14:52:30 -07003842 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003843 String path, ParcelFileDescriptor fd) throws RemoteException {
3844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
3847 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003848 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003849 data.writeInt(managed ? 1 : 0);
3850 data.writeString(path);
3851 if (fd != null) {
3852 data.writeInt(1);
3853 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3854 } else {
3855 data.writeInt(0);
3856 }
3857 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3858 reply.readException();
3859 boolean res = reply.readInt() != 0;
3860 reply.recycle();
3861 data.recycle();
3862 return res;
3863 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003864
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003865 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003866 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003867 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003868 Parcel data = Parcel.obtain();
3869 Parcel reply = Parcel.obtain();
3870 data.writeInterfaceToken(IActivityManager.descriptor);
3871 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003872 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003873 data.writeTypedArray(intents, 0);
3874 data.writeStringArray(resolvedTypes);
3875 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003876 if (options != null) {
3877 data.writeInt(1);
3878 options.writeToParcel(data, 0);
3879 } else {
3880 data.writeInt(0);
3881 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003882 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003883 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3884 reply.readException();
3885 int result = reply.readInt();
3886 reply.recycle();
3887 data.recycle();
3888 return result;
3889 }
3890
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003891 public int getFrontActivityScreenCompatMode() throws RemoteException {
3892 Parcel data = Parcel.obtain();
3893 Parcel reply = Parcel.obtain();
3894 data.writeInterfaceToken(IActivityManager.descriptor);
3895 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3896 reply.readException();
3897 int mode = reply.readInt();
3898 reply.recycle();
3899 data.recycle();
3900 return mode;
3901 }
3902
3903 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3904 Parcel data = Parcel.obtain();
3905 Parcel reply = Parcel.obtain();
3906 data.writeInterfaceToken(IActivityManager.descriptor);
3907 data.writeInt(mode);
3908 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3909 reply.readException();
3910 reply.recycle();
3911 data.recycle();
3912 }
3913
3914 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3915 Parcel data = Parcel.obtain();
3916 Parcel reply = Parcel.obtain();
3917 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003918 data.writeString(packageName);
3919 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003920 reply.readException();
3921 int mode = reply.readInt();
3922 reply.recycle();
3923 data.recycle();
3924 return mode;
3925 }
3926
3927 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003928 throws RemoteException {
3929 Parcel data = Parcel.obtain();
3930 Parcel reply = Parcel.obtain();
3931 data.writeInterfaceToken(IActivityManager.descriptor);
3932 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003933 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003934 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3935 reply.readException();
3936 reply.recycle();
3937 data.recycle();
3938 }
3939
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003940 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 data.writeString(packageName);
3945 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3946 reply.readException();
3947 boolean ask = reply.readInt() != 0;
3948 reply.recycle();
3949 data.recycle();
3950 return ask;
3951 }
3952
3953 public void setPackageAskScreenCompat(String packageName, boolean ask)
3954 throws RemoteException {
3955 Parcel data = Parcel.obtain();
3956 Parcel reply = Parcel.obtain();
3957 data.writeInterfaceToken(IActivityManager.descriptor);
3958 data.writeString(packageName);
3959 data.writeInt(ask ? 1 : 0);
3960 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3961 reply.readException();
3962 reply.recycle();
3963 data.recycle();
3964 }
3965
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003966 public boolean switchUser(int userid) throws RemoteException {
3967 Parcel data = Parcel.obtain();
3968 Parcel reply = Parcel.obtain();
3969 data.writeInterfaceToken(IActivityManager.descriptor);
3970 data.writeInt(userid);
3971 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3972 reply.readException();
3973 boolean result = reply.readInt() != 0;
3974 reply.recycle();
3975 data.recycle();
3976 return result;
3977 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003978
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003979 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3980 Parcel data = Parcel.obtain();
3981 Parcel reply = Parcel.obtain();
3982 data.writeInterfaceToken(IActivityManager.descriptor);
3983 data.writeInt(userid);
3984 data.writeStrongInterface(callback);
3985 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3986 reply.readException();
3987 int result = reply.readInt();
3988 reply.recycle();
3989 data.recycle();
3990 return result;
3991 }
3992
Amith Yamasani52f1d752012-03-28 18:19:29 -07003993 public UserInfo getCurrentUser() throws RemoteException {
3994 Parcel data = Parcel.obtain();
3995 Parcel reply = Parcel.obtain();
3996 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003997 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003998 reply.readException();
3999 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4000 reply.recycle();
4001 data.recycle();
4002 return userInfo;
4003 }
4004
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004005 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004006 Parcel data = Parcel.obtain();
4007 Parcel reply = Parcel.obtain();
4008 data.writeInterfaceToken(IActivityManager.descriptor);
4009 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004010 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004011 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4012 reply.readException();
4013 boolean result = reply.readInt() != 0;
4014 reply.recycle();
4015 data.recycle();
4016 return result;
4017 }
4018
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004019 public int[] getRunningUserIds() throws RemoteException {
4020 Parcel data = Parcel.obtain();
4021 Parcel reply = Parcel.obtain();
4022 data.writeInterfaceToken(IActivityManager.descriptor);
4023 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4024 reply.readException();
4025 int[] result = reply.createIntArray();
4026 reply.recycle();
4027 data.recycle();
4028 return result;
4029 }
4030
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004031 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 data.writeInt(taskId);
4036 data.writeInt(subTaskIndex);
4037 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4038 reply.readException();
4039 boolean result = reply.readInt() != 0;
4040 reply.recycle();
4041 data.recycle();
4042 return result;
4043 }
4044
4045 public boolean removeTask(int taskId, int flags) throws RemoteException {
4046 Parcel data = Parcel.obtain();
4047 Parcel reply = Parcel.obtain();
4048 data.writeInterfaceToken(IActivityManager.descriptor);
4049 data.writeInt(taskId);
4050 data.writeInt(flags);
4051 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4052 reply.readException();
4053 boolean result = reply.readInt() != 0;
4054 reply.recycle();
4055 data.recycle();
4056 return result;
4057 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004058
Jeff Sharkeya4620792011-05-20 15:29:23 -07004059 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4064 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4065 reply.readException();
4066 data.recycle();
4067 reply.recycle();
4068 }
4069
4070 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4071 Parcel data = Parcel.obtain();
4072 Parcel reply = Parcel.obtain();
4073 data.writeInterfaceToken(IActivityManager.descriptor);
4074 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4075 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4076 reply.readException();
4077 data.recycle();
4078 reply.recycle();
4079 }
4080
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004081 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4082 Parcel data = Parcel.obtain();
4083 Parcel reply = Parcel.obtain();
4084 data.writeInterfaceToken(IActivityManager.descriptor);
4085 data.writeStrongBinder(sender.asBinder());
4086 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4087 reply.readException();
4088 boolean res = reply.readInt() != 0;
4089 data.recycle();
4090 reply.recycle();
4091 return res;
4092 }
4093
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004094 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeStrongBinder(sender.asBinder());
4099 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4100 reply.readException();
4101 boolean res = reply.readInt() != 0;
4102 data.recycle();
4103 reply.recycle();
4104 return res;
4105 }
4106
Dianne Hackborn81038902012-11-26 17:04:09 -08004107 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4108 Parcel data = Parcel.obtain();
4109 Parcel reply = Parcel.obtain();
4110 data.writeInterfaceToken(IActivityManager.descriptor);
4111 data.writeStrongBinder(sender.asBinder());
4112 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4113 reply.readException();
4114 Intent res = reply.readInt() != 0
4115 ? Intent.CREATOR.createFromParcel(reply) : null;
4116 data.recycle();
4117 reply.recycle();
4118 return res;
4119 }
4120
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004121 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4122 {
4123 Parcel data = Parcel.obtain();
4124 Parcel reply = Parcel.obtain();
4125 data.writeInterfaceToken(IActivityManager.descriptor);
4126 values.writeToParcel(data, 0);
4127 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4128 reply.readException();
4129 data.recycle();
4130 reply.recycle();
4131 }
4132
Dianne Hackbornb437e092011-08-05 17:50:29 -07004133 public long[] getProcessPss(int[] pids) throws RemoteException {
4134 Parcel data = Parcel.obtain();
4135 Parcel reply = Parcel.obtain();
4136 data.writeInterfaceToken(IActivityManager.descriptor);
4137 data.writeIntArray(pids);
4138 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4139 reply.readException();
4140 long[] res = reply.createLongArray();
4141 data.recycle();
4142 reply.recycle();
4143 return res;
4144 }
4145
Dianne Hackborn661cd522011-08-22 00:26:20 -07004146 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4147 Parcel data = Parcel.obtain();
4148 Parcel reply = Parcel.obtain();
4149 data.writeInterfaceToken(IActivityManager.descriptor);
4150 TextUtils.writeToParcel(msg, data, 0);
4151 data.writeInt(always ? 1 : 0);
4152 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4153 reply.readException();
4154 data.recycle();
4155 reply.recycle();
4156 }
4157
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004158 public void dismissKeyguardOnNextActivity() throws RemoteException {
4159 Parcel data = Parcel.obtain();
4160 Parcel reply = Parcel.obtain();
4161 data.writeInterfaceToken(IActivityManager.descriptor);
4162 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4163 reply.readException();
4164 data.recycle();
4165 reply.recycle();
4166 }
4167
Adam Powelldd8fab22012-03-22 17:47:27 -07004168 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4169 throws RemoteException {
4170 Parcel data = Parcel.obtain();
4171 Parcel reply = Parcel.obtain();
4172 data.writeInterfaceToken(IActivityManager.descriptor);
4173 data.writeStrongBinder(token);
4174 data.writeString(destAffinity);
4175 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4176 reply.readException();
4177 boolean result = reply.readInt() != 0;
4178 data.recycle();
4179 reply.recycle();
4180 return result;
4181 }
4182
4183 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4184 throws RemoteException {
4185 Parcel data = Parcel.obtain();
4186 Parcel reply = Parcel.obtain();
4187 data.writeInterfaceToken(IActivityManager.descriptor);
4188 data.writeStrongBinder(token);
4189 target.writeToParcel(data, 0);
4190 data.writeInt(resultCode);
4191 if (resultData != null) {
4192 data.writeInt(1);
4193 resultData.writeToParcel(data, 0);
4194 } else {
4195 data.writeInt(0);
4196 }
4197 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4198 reply.readException();
4199 boolean result = reply.readInt() != 0;
4200 data.recycle();
4201 reply.recycle();
4202 return result;
4203 }
4204
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004205 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4206 Parcel data = Parcel.obtain();
4207 Parcel reply = Parcel.obtain();
4208 data.writeInterfaceToken(IActivityManager.descriptor);
4209 data.writeStrongBinder(activityToken);
4210 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4211 reply.readException();
4212 int result = reply.readInt();
4213 data.recycle();
4214 reply.recycle();
4215 return result;
4216 }
4217
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004218 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4219 Parcel data = Parcel.obtain();
4220 Parcel reply = Parcel.obtain();
4221 data.writeInterfaceToken(IActivityManager.descriptor);
4222 data.writeStrongBinder(activityToken);
4223 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4224 reply.readException();
4225 String result = reply.readString();
4226 data.recycle();
4227 reply.recycle();
4228 return result;
4229 }
4230
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004231 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4236 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4237 reply.readException();
4238 data.recycle();
4239 reply.recycle();
4240 }
4241
4242 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4243 Parcel data = Parcel.obtain();
4244 Parcel reply = Parcel.obtain();
4245 data.writeInterfaceToken(IActivityManager.descriptor);
4246 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4247 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4248 reply.readException();
4249 data.recycle();
4250 reply.recycle();
4251 }
4252
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004253 public void requestBugReport() throws RemoteException {
4254 Parcel data = Parcel.obtain();
4255 Parcel reply = Parcel.obtain();
4256 data.writeInterfaceToken(IActivityManager.descriptor);
4257 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4258 reply.readException();
4259 data.recycle();
4260 reply.recycle();
4261 }
4262
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004263 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4264 Parcel data = Parcel.obtain();
4265 Parcel reply = Parcel.obtain();
4266 data.writeInterfaceToken(IActivityManager.descriptor);
4267 data.writeInt(pid);
4268 data.writeInt(aboveSystem ? 1 : 0);
4269 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4270 reply.readException();
4271 long res = reply.readInt();
4272 data.recycle();
4273 reply.recycle();
4274 return res;
4275 }
4276
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004277 public Bundle getTopActivityExtras(int requestType) throws RemoteException {
4278 Parcel data = Parcel.obtain();
4279 Parcel reply = Parcel.obtain();
4280 data.writeInterfaceToken(IActivityManager.descriptor);
4281 data.writeInt(requestType);
4282 mRemote.transact(GET_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 Bundle res = reply.readBundle();
4285 data.recycle();
4286 reply.recycle();
4287 return res;
4288 }
4289
4290 public void reportTopActivityExtras(IBinder token, Bundle extras) throws RemoteException {
4291 Parcel data = Parcel.obtain();
4292 Parcel reply = Parcel.obtain();
4293 data.writeInterfaceToken(IActivityManager.descriptor);
4294 data.writeStrongBinder(token);
4295 data.writeBundle(extras);
4296 mRemote.transact(REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4297 reply.readException();
4298 data.recycle();
4299 reply.recycle();
4300 }
4301
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004302 private IBinder mRemote;
4303}