blob: d4478bf046d6d4c8f55d0ab42de6a696e8457172 [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
612 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
614 IBinder token = data.readStrongBinder();
615 boolean onlyRoot = data.readInt() != 0;
616 int res = token != null
617 ? getTaskForActivity(token, onlyRoot) : -1;
618 reply.writeNoException();
619 reply.writeInt(res);
620 return true;
621 }
622
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 case REPORT_THUMBNAIL_TRANSACTION: {
624 data.enforceInterface(IActivityManager.descriptor);
625 IBinder token = data.readStrongBinder();
626 Bitmap thumbnail = data.readInt() != 0
627 ? Bitmap.CREATOR.createFromParcel(data) : null;
628 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
629 reportThumbnail(token, thumbnail, description);
630 reply.writeNoException();
631 return true;
632 }
633
634 case GET_CONTENT_PROVIDER_TRANSACTION: {
635 data.enforceInterface(IActivityManager.descriptor);
636 IBinder b = data.readStrongBinder();
637 IApplicationThread app = ApplicationThreadNative.asInterface(b);
638 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700639 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700640 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700641 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 reply.writeNoException();
643 if (cph != null) {
644 reply.writeInt(1);
645 cph.writeToParcel(reply, 0);
646 } else {
647 reply.writeInt(0);
648 }
649 return true;
650 }
651
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800652 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
653 data.enforceInterface(IActivityManager.descriptor);
654 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700655 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800656 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700657 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800658 reply.writeNoException();
659 if (cph != null) {
660 reply.writeInt(1);
661 cph.writeToParcel(reply, 0);
662 } else {
663 reply.writeInt(0);
664 }
665 return true;
666 }
667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
669 data.enforceInterface(IActivityManager.descriptor);
670 IBinder b = data.readStrongBinder();
671 IApplicationThread app = ApplicationThreadNative.asInterface(b);
672 ArrayList<ContentProviderHolder> providers =
673 data.createTypedArrayList(ContentProviderHolder.CREATOR);
674 publishContentProviders(app, providers);
675 reply.writeNoException();
676 return true;
677 }
678
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700679 case REF_CONTENT_PROVIDER_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 IBinder b = data.readStrongBinder();
682 int stable = data.readInt();
683 int unstable = data.readInt();
684 boolean res = refContentProvider(b, stable, unstable);
685 reply.writeNoException();
686 reply.writeInt(res ? 1 : 0);
687 return true;
688 }
689
690 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
691 data.enforceInterface(IActivityManager.descriptor);
692 IBinder b = data.readStrongBinder();
693 unstableProviderDied(b);
694 reply.writeNoException();
695 return true;
696 }
697
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
699 data.enforceInterface(IActivityManager.descriptor);
700 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700701 boolean stable = data.readInt() != 0;
702 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 reply.writeNoException();
704 return true;
705 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800706
707 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 String name = data.readString();
710 IBinder token = data.readStrongBinder();
711 removeContentProviderExternal(name, token);
712 reply.writeNoException();
713 return true;
714 }
715
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700716 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
717 data.enforceInterface(IActivityManager.descriptor);
718 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
719 PendingIntent pi = getRunningServiceControlPanel(comp);
720 reply.writeNoException();
721 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
722 return true;
723 }
724
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800725 case START_SERVICE_TRANSACTION: {
726 data.enforceInterface(IActivityManager.descriptor);
727 IBinder b = data.readStrongBinder();
728 IApplicationThread app = ApplicationThreadNative.asInterface(b);
729 Intent service = Intent.CREATOR.createFromParcel(data);
730 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700731 int userId = data.readInt();
732 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800733 reply.writeNoException();
734 ComponentName.writeToParcel(cn, reply);
735 return true;
736 }
737
738 case STOP_SERVICE_TRANSACTION: {
739 data.enforceInterface(IActivityManager.descriptor);
740 IBinder b = data.readStrongBinder();
741 IApplicationThread app = ApplicationThreadNative.asInterface(b);
742 Intent service = Intent.CREATOR.createFromParcel(data);
743 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700744 int userId = data.readInt();
745 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 reply.writeNoException();
747 reply.writeInt(res);
748 return true;
749 }
750
751 case STOP_SERVICE_TOKEN_TRANSACTION: {
752 data.enforceInterface(IActivityManager.descriptor);
753 ComponentName className = ComponentName.readFromParcel(data);
754 IBinder token = data.readStrongBinder();
755 int startId = data.readInt();
756 boolean res = stopServiceToken(className, token, startId);
757 reply.writeNoException();
758 reply.writeInt(res ? 1 : 0);
759 return true;
760 }
761
762 case SET_SERVICE_FOREGROUND_TRANSACTION: {
763 data.enforceInterface(IActivityManager.descriptor);
764 ComponentName className = ComponentName.readFromParcel(data);
765 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700766 int id = data.readInt();
767 Notification notification = null;
768 if (data.readInt() != 0) {
769 notification = Notification.CREATOR.createFromParcel(data);
770 }
771 boolean removeNotification = data.readInt() != 0;
772 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 reply.writeNoException();
774 return true;
775 }
776
777 case BIND_SERVICE_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder b = data.readStrongBinder();
780 IApplicationThread app = ApplicationThreadNative.asInterface(b);
781 IBinder token = data.readStrongBinder();
782 Intent service = Intent.CREATOR.createFromParcel(data);
783 String resolvedType = data.readString();
784 b = data.readStrongBinder();
785 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800786 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800788 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 reply.writeNoException();
790 reply.writeInt(res);
791 return true;
792 }
793
794 case UNBIND_SERVICE_TRANSACTION: {
795 data.enforceInterface(IActivityManager.descriptor);
796 IBinder b = data.readStrongBinder();
797 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
798 boolean res = unbindService(conn);
799 reply.writeNoException();
800 reply.writeInt(res ? 1 : 0);
801 return true;
802 }
803
804 case PUBLISH_SERVICE_TRANSACTION: {
805 data.enforceInterface(IActivityManager.descriptor);
806 IBinder token = data.readStrongBinder();
807 Intent intent = Intent.CREATOR.createFromParcel(data);
808 IBinder service = data.readStrongBinder();
809 publishService(token, intent, service);
810 reply.writeNoException();
811 return true;
812 }
813
814 case UNBIND_FINISHED_TRANSACTION: {
815 data.enforceInterface(IActivityManager.descriptor);
816 IBinder token = data.readStrongBinder();
817 Intent intent = Intent.CREATOR.createFromParcel(data);
818 boolean doRebind = data.readInt() != 0;
819 unbindFinished(token, intent, doRebind);
820 reply.writeNoException();
821 return true;
822 }
823
824 case SERVICE_DONE_EXECUTING_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700827 int type = data.readInt();
828 int startId = data.readInt();
829 int res = data.readInt();
830 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800831 reply.writeNoException();
832 return true;
833 }
834
835 case START_INSTRUMENTATION_TRANSACTION: {
836 data.enforceInterface(IActivityManager.descriptor);
837 ComponentName className = ComponentName.readFromParcel(data);
838 String profileFile = data.readString();
839 int fl = data.readInt();
840 Bundle arguments = data.readBundle();
841 IBinder b = data.readStrongBinder();
842 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800843 b = data.readStrongBinder();
844 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700845 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800846 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800847 reply.writeNoException();
848 reply.writeInt(res ? 1 : 0);
849 return true;
850 }
851
852
853 case FINISH_INSTRUMENTATION_TRANSACTION: {
854 data.enforceInterface(IActivityManager.descriptor);
855 IBinder b = data.readStrongBinder();
856 IApplicationThread app = ApplicationThreadNative.asInterface(b);
857 int resultCode = data.readInt();
858 Bundle results = data.readBundle();
859 finishInstrumentation(app, resultCode, results);
860 reply.writeNoException();
861 return true;
862 }
863
864 case GET_CONFIGURATION_TRANSACTION: {
865 data.enforceInterface(IActivityManager.descriptor);
866 Configuration config = getConfiguration();
867 reply.writeNoException();
868 config.writeToParcel(reply, 0);
869 return true;
870 }
871
872 case UPDATE_CONFIGURATION_TRANSACTION: {
873 data.enforceInterface(IActivityManager.descriptor);
874 Configuration config = Configuration.CREATOR.createFromParcel(data);
875 updateConfiguration(config);
876 reply.writeNoException();
877 return true;
878 }
879
880 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
881 data.enforceInterface(IActivityManager.descriptor);
882 IBinder token = data.readStrongBinder();
883 int requestedOrientation = data.readInt();
884 setRequestedOrientation(token, requestedOrientation);
885 reply.writeNoException();
886 return true;
887 }
888
889 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
890 data.enforceInterface(IActivityManager.descriptor);
891 IBinder token = data.readStrongBinder();
892 int req = getRequestedOrientation(token);
893 reply.writeNoException();
894 reply.writeInt(req);
895 return true;
896 }
897
898 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
899 data.enforceInterface(IActivityManager.descriptor);
900 IBinder token = data.readStrongBinder();
901 ComponentName cn = getActivityClassForToken(token);
902 reply.writeNoException();
903 ComponentName.writeToParcel(cn, reply);
904 return true;
905 }
906
907 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 IBinder token = data.readStrongBinder();
910 reply.writeNoException();
911 reply.writeString(getPackageForToken(token));
912 return true;
913 }
914
915 case GET_INTENT_SENDER_TRANSACTION: {
916 data.enforceInterface(IActivityManager.descriptor);
917 int type = data.readInt();
918 String packageName = data.readString();
919 IBinder token = data.readStrongBinder();
920 String resultWho = data.readString();
921 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800922 Intent[] requestIntents;
923 String[] requestResolvedTypes;
924 if (data.readInt() != 0) {
925 requestIntents = data.createTypedArray(Intent.CREATOR);
926 requestResolvedTypes = data.createStringArray();
927 } else {
928 requestIntents = null;
929 requestResolvedTypes = null;
930 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700932 Bundle options = data.readInt() != 0
933 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700934 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800935 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800936 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700937 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 reply.writeNoException();
939 reply.writeStrongBinder(res != null ? res.asBinder() : null);
940 return true;
941 }
942
943 case CANCEL_INTENT_SENDER_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 IIntentSender r = IIntentSender.Stub.asInterface(
946 data.readStrongBinder());
947 cancelIntentSender(r);
948 reply.writeNoException();
949 return true;
950 }
951
952 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
953 data.enforceInterface(IActivityManager.descriptor);
954 IIntentSender r = IIntentSender.Stub.asInterface(
955 data.readStrongBinder());
956 String res = getPackageForIntentSender(r);
957 reply.writeNoException();
958 reply.writeString(res);
959 return true;
960 }
961
Christopher Tatec4a07d12012-04-06 14:19:13 -0700962 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
963 data.enforceInterface(IActivityManager.descriptor);
964 IIntentSender r = IIntentSender.Stub.asInterface(
965 data.readStrongBinder());
966 int res = getUidForIntentSender(r);
967 reply.writeNoException();
968 reply.writeInt(res);
969 return true;
970 }
971
Dianne Hackborn41203752012-08-31 14:05:51 -0700972 case HANDLE_INCOMING_USER_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 int callingPid = data.readInt();
975 int callingUid = data.readInt();
976 int userId = data.readInt();
977 boolean allowAll = data.readInt() != 0 ;
978 boolean requireFull = data.readInt() != 0;
979 String name = data.readString();
980 String callerPackage = data.readString();
981 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
982 requireFull, name, callerPackage);
983 reply.writeNoException();
984 reply.writeInt(res);
985 return true;
986 }
987
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800988 case SET_PROCESS_LIMIT_TRANSACTION: {
989 data.enforceInterface(IActivityManager.descriptor);
990 int max = data.readInt();
991 setProcessLimit(max);
992 reply.writeNoException();
993 return true;
994 }
995
996 case GET_PROCESS_LIMIT_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 int limit = getProcessLimit();
999 reply.writeNoException();
1000 reply.writeInt(limit);
1001 return true;
1002 }
1003
1004 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IBinder token = data.readStrongBinder();
1007 int pid = data.readInt();
1008 boolean isForeground = data.readInt() != 0;
1009 setProcessForeground(token, pid, isForeground);
1010 reply.writeNoException();
1011 return true;
1012 }
1013
1014 case CHECK_PERMISSION_TRANSACTION: {
1015 data.enforceInterface(IActivityManager.descriptor);
1016 String perm = data.readString();
1017 int pid = data.readInt();
1018 int uid = data.readInt();
1019 int res = checkPermission(perm, pid, uid);
1020 reply.writeNoException();
1021 reply.writeInt(res);
1022 return true;
1023 }
1024
1025 case CHECK_URI_PERMISSION_TRANSACTION: {
1026 data.enforceInterface(IActivityManager.descriptor);
1027 Uri uri = Uri.CREATOR.createFromParcel(data);
1028 int pid = data.readInt();
1029 int uid = data.readInt();
1030 int mode = data.readInt();
1031 int res = checkUriPermission(uri, pid, uid, mode);
1032 reply.writeNoException();
1033 reply.writeInt(res);
1034 return true;
1035 }
1036
1037 case CLEAR_APP_DATA_TRANSACTION: {
1038 data.enforceInterface(IActivityManager.descriptor);
1039 String packageName = data.readString();
1040 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1041 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001042 int userId = data.readInt();
1043 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001044 reply.writeNoException();
1045 reply.writeInt(res ? 1 : 0);
1046 return true;
1047 }
1048
1049 case GRANT_URI_PERMISSION_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 IBinder b = data.readStrongBinder();
1052 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1053 String targetPkg = data.readString();
1054 Uri uri = Uri.CREATOR.createFromParcel(data);
1055 int mode = data.readInt();
1056 grantUriPermission(app, targetPkg, uri, mode);
1057 reply.writeNoException();
1058 return true;
1059 }
1060
1061 case REVOKE_URI_PERMISSION_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder b = data.readStrongBinder();
1064 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1065 Uri uri = Uri.CREATOR.createFromParcel(data);
1066 int mode = data.readInt();
1067 revokeUriPermission(app, uri, mode);
1068 reply.writeNoException();
1069 return true;
1070 }
1071
1072 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1073 data.enforceInterface(IActivityManager.descriptor);
1074 IBinder b = data.readStrongBinder();
1075 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1076 boolean waiting = data.readInt() != 0;
1077 showWaitingForDebugger(app, waiting);
1078 reply.writeNoException();
1079 return true;
1080 }
1081
1082 case GET_MEMORY_INFO_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
1084 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1085 getMemoryInfo(mi);
1086 reply.writeNoException();
1087 mi.writeToParcel(reply, 0);
1088 return true;
1089 }
1090
1091 case UNHANDLED_BACK_TRANSACTION: {
1092 data.enforceInterface(IActivityManager.descriptor);
1093 unhandledBack();
1094 reply.writeNoException();
1095 return true;
1096 }
1097
1098 case OPEN_CONTENT_URI_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 Uri uri = Uri.parse(data.readString());
1101 ParcelFileDescriptor pfd = openContentUri(uri);
1102 reply.writeNoException();
1103 if (pfd != null) {
1104 reply.writeInt(1);
1105 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1106 } else {
1107 reply.writeInt(0);
1108 }
1109 return true;
1110 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001111
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001112 case GOING_TO_SLEEP_TRANSACTION: {
1113 data.enforceInterface(IActivityManager.descriptor);
1114 goingToSleep();
1115 reply.writeNoException();
1116 return true;
1117 }
1118
1119 case WAKING_UP_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
1121 wakingUp();
1122 reply.writeNoException();
1123 return true;
1124 }
1125
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001126 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 setLockScreenShown(data.readInt() != 0);
1129 reply.writeNoException();
1130 return true;
1131 }
1132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 case SET_DEBUG_APP_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 String pn = data.readString();
1136 boolean wfd = data.readInt() != 0;
1137 boolean per = data.readInt() != 0;
1138 setDebugApp(pn, wfd, per);
1139 reply.writeNoException();
1140 return true;
1141 }
1142
1143 case SET_ALWAYS_FINISH_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 boolean enabled = data.readInt() != 0;
1146 setAlwaysFinish(enabled);
1147 reply.writeNoException();
1148 return true;
1149 }
1150
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001151 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001153 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001154 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001155 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001156 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 return true;
1158 }
1159
1160 case ENTER_SAFE_MODE_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 enterSafeMode();
1163 reply.writeNoException();
1164 return true;
1165 }
1166
1167 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 IIntentSender is = IIntentSender.Stub.asInterface(
1170 data.readStrongBinder());
1171 noteWakeupAlarm(is);
1172 reply.writeNoException();
1173 return true;
1174 }
1175
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001176 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001177 data.enforceInterface(IActivityManager.descriptor);
1178 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001179 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001180 boolean secure = data.readInt() != 0;
1181 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 reply.writeNoException();
1183 reply.writeInt(res ? 1 : 0);
1184 return true;
1185 }
1186
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001187 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 String reason = data.readString();
1190 boolean res = killProcessesBelowForeground(reason);
1191 reply.writeNoException();
1192 reply.writeInt(res ? 1 : 0);
1193 return true;
1194 }
1195
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 case START_RUNNING_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 String pkg = data.readString();
1199 String cls = data.readString();
1200 String action = data.readString();
1201 String indata = data.readString();
1202 startRunning(pkg, cls, action, indata);
1203 reply.writeNoException();
1204 return true;
1205 }
1206
Dan Egnor60d87622009-12-16 16:32:58 -08001207 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1208 data.enforceInterface(IActivityManager.descriptor);
1209 IBinder app = data.readStrongBinder();
1210 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1211 handleApplicationCrash(app, ci);
1212 reply.writeNoException();
1213 return true;
1214 }
1215
1216 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001217 data.enforceInterface(IActivityManager.descriptor);
1218 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001219 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001220 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001221 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001223 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 return true;
1225 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001226
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001227 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001230 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001231 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1232 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001233 reply.writeNoException();
1234 return true;
1235 }
1236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001237 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 int sig = data.readInt();
1240 signalPersistentProcesses(sig);
1241 reply.writeNoException();
1242 return true;
1243 }
1244
Dianne Hackborn03abb812010-01-04 18:43:19 -08001245 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1246 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001248 int userId = data.readInt();
1249 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001250 reply.writeNoException();
1251 return true;
1252 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001253
1254 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
1256 killAllBackgroundProcesses();
1257 reply.writeNoException();
1258 return true;
1259 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001260
1261 case FORCE_STOP_PACKAGE_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001264 int userId = data.readInt();
1265 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001266 reply.writeNoException();
1267 return true;
1268 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001269
1270 case GET_MY_MEMORY_STATE_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 ActivityManager.RunningAppProcessInfo info =
1273 new ActivityManager.RunningAppProcessInfo();
1274 getMyMemoryState(info);
1275 reply.writeNoException();
1276 info.writeToParcel(reply, 0);
1277 return true;
1278 }
1279
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 ConfigurationInfo config = getDeviceConfigurationInfo();
1283 reply.writeNoException();
1284 config.writeToParcel(reply, 0);
1285 return true;
1286 }
1287
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001288 case PROFILE_CONTROL_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001291 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001292 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001293 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001294 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001295 ParcelFileDescriptor fd = data.readInt() != 0
1296 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001297 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001298 reply.writeNoException();
1299 reply.writeInt(res ? 1 : 0);
1300 return true;
1301 }
1302
Dianne Hackborn55280a92009-05-07 15:53:46 -07001303 case SHUTDOWN_TRANSACTION: {
1304 data.enforceInterface(IActivityManager.descriptor);
1305 boolean res = shutdown(data.readInt());
1306 reply.writeNoException();
1307 reply.writeInt(res ? 1 : 0);
1308 return true;
1309 }
1310
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001311 case STOP_APP_SWITCHES_TRANSACTION: {
1312 data.enforceInterface(IActivityManager.descriptor);
1313 stopAppSwitches();
1314 reply.writeNoException();
1315 return true;
1316 }
1317
1318 case RESUME_APP_SWITCHES_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 resumeAppSwitches();
1321 reply.writeNoException();
1322 return true;
1323 }
1324
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001325 case PEEK_SERVICE_TRANSACTION: {
1326 data.enforceInterface(IActivityManager.descriptor);
1327 Intent service = Intent.CREATOR.createFromParcel(data);
1328 String resolvedType = data.readString();
1329 IBinder binder = peekService(service, resolvedType);
1330 reply.writeNoException();
1331 reply.writeStrongBinder(binder);
1332 return true;
1333 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001334
1335 case START_BACKUP_AGENT_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1338 int backupRestoreMode = data.readInt();
1339 boolean success = bindBackupAgent(info, backupRestoreMode);
1340 reply.writeNoException();
1341 reply.writeInt(success ? 1 : 0);
1342 return true;
1343 }
1344
1345 case BACKUP_AGENT_CREATED_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 String packageName = data.readString();
1348 IBinder agent = data.readStrongBinder();
1349 backupAgentCreated(packageName, agent);
1350 reply.writeNoException();
1351 return true;
1352 }
1353
1354 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1355 data.enforceInterface(IActivityManager.descriptor);
1356 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1357 unbindBackupAgent(info);
1358 reply.writeNoException();
1359 return true;
1360 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001361
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001362 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001363 data.enforceInterface(IActivityManager.descriptor);
1364 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001365 int appid = data.readInt();
1366 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001367 reply.writeNoException();
1368 return true;
1369 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001370
1371 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
1373 String reason = data.readString();
1374 closeSystemDialogs(reason);
1375 reply.writeNoException();
1376 return true;
1377 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001378
1379 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1380 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001381 int[] pids = data.createIntArray();
1382 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001383 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001384 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001385 return true;
1386 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001387
1388 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1389 data.enforceInterface(IActivityManager.descriptor);
1390 String processName = data.readString();
1391 int uid = data.readInt();
1392 killApplicationProcess(processName, uid);
1393 reply.writeNoException();
1394 return true;
1395 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001396
1397 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1398 data.enforceInterface(IActivityManager.descriptor);
1399 IBinder token = data.readStrongBinder();
1400 String packageName = data.readString();
1401 int enterAnim = data.readInt();
1402 int exitAnim = data.readInt();
1403 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001404 reply.writeNoException();
1405 return true;
1406 }
1407
1408 case IS_USER_A_MONKEY_TRANSACTION: {
1409 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001410 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001411 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001412 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001413 return true;
1414 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001415
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001416 case SET_USER_IS_MONKEY_TRANSACTION: {
1417 data.enforceInterface(IActivityManager.descriptor);
1418 final boolean monkey = (data.readInt() == 1);
1419 setUserIsMonkey(monkey);
1420 reply.writeNoException();
1421 return true;
1422 }
1423
Dianne Hackborn860755f2010-06-03 18:47:52 -07001424 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1425 data.enforceInterface(IActivityManager.descriptor);
1426 finishHeavyWeightApp();
1427 reply.writeNoException();
1428 return true;
1429 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001430
1431 case IS_IMMERSIVE_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001434 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001435 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001436 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001437 return true;
1438 }
1439
1440 case SET_IMMERSIVE_TRANSACTION: {
1441 data.enforceInterface(IActivityManager.descriptor);
1442 IBinder token = data.readStrongBinder();
1443 boolean imm = data.readInt() == 1;
1444 setImmersive(token, imm);
1445 reply.writeNoException();
1446 return true;
1447 }
1448
1449 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1450 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001451 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001452 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001453 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001454 return true;
1455 }
1456
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001457 case CRASH_APPLICATION_TRANSACTION: {
1458 data.enforceInterface(IActivityManager.descriptor);
1459 int uid = data.readInt();
1460 int initialPid = data.readInt();
1461 String packageName = data.readString();
1462 String message = data.readString();
1463 crashApplication(uid, initialPid, packageName, message);
1464 reply.writeNoException();
1465 return true;
1466 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001467
1468 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1469 data.enforceInterface(IActivityManager.descriptor);
1470 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001471 int userId = data.readInt();
1472 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001473 reply.writeNoException();
1474 reply.writeString(type);
1475 return true;
1476 }
1477
Dianne Hackborn7e269642010-08-25 19:50:20 -07001478 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 String name = data.readString();
1481 IBinder perm = newUriPermissionOwner(name);
1482 reply.writeNoException();
1483 reply.writeStrongBinder(perm);
1484 return true;
1485 }
1486
1487 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
1489 IBinder owner = data.readStrongBinder();
1490 int fromUid = data.readInt();
1491 String targetPkg = data.readString();
1492 Uri uri = Uri.CREATOR.createFromParcel(data);
1493 int mode = data.readInt();
1494 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1495 reply.writeNoException();
1496 return true;
1497 }
1498
1499 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 IBinder owner = data.readStrongBinder();
1502 Uri uri = null;
1503 if (data.readInt() != 0) {
1504 Uri.CREATOR.createFromParcel(data);
1505 }
1506 int mode = data.readInt();
1507 revokeUriPermissionFromOwner(owner, uri, mode);
1508 reply.writeNoException();
1509 return true;
1510 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001511
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001512 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1513 data.enforceInterface(IActivityManager.descriptor);
1514 int callingUid = data.readInt();
1515 String targetPkg = data.readString();
1516 Uri uri = Uri.CREATOR.createFromParcel(data);
1517 int modeFlags = data.readInt();
1518 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1519 reply.writeNoException();
1520 reply.writeInt(res);
1521 return true;
1522 }
1523
Andy McFadden824c5102010-07-09 16:26:57 -07001524 case DUMP_HEAP_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001527 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001528 boolean managed = data.readInt() != 0;
1529 String path = data.readString();
1530 ParcelFileDescriptor fd = data.readInt() != 0
1531 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001532 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001533 reply.writeNoException();
1534 reply.writeInt(res ? 1 : 0);
1535 return true;
1536 }
1537
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001538 case START_ACTIVITIES_TRANSACTION:
1539 {
1540 data.enforceInterface(IActivityManager.descriptor);
1541 IBinder b = data.readStrongBinder();
1542 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001543 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001544 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1545 String[] resolvedTypes = data.createStringArray();
1546 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001547 Bundle options = data.readInt() != 0
1548 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001549 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001550 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001551 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001552 reply.writeNoException();
1553 reply.writeInt(result);
1554 return true;
1555 }
1556
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001557 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1558 {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 int mode = getFrontActivityScreenCompatMode();
1561 reply.writeNoException();
1562 reply.writeInt(mode);
1563 return true;
1564 }
1565
1566 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1567 {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 int mode = data.readInt();
1570 setFrontActivityScreenCompatMode(mode);
1571 reply.writeNoException();
1572 reply.writeInt(mode);
1573 return true;
1574 }
1575
1576 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1577 {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 String pkg = data.readString();
1580 int mode = getPackageScreenCompatMode(pkg);
1581 reply.writeNoException();
1582 reply.writeInt(mode);
1583 return true;
1584 }
1585
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001586 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1587 {
1588 data.enforceInterface(IActivityManager.descriptor);
1589 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001590 int mode = data.readInt();
1591 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001592 reply.writeNoException();
1593 return true;
1594 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001595
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001596 case SWITCH_USER_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 int userid = data.readInt();
1599 boolean result = switchUser(userid);
1600 reply.writeNoException();
1601 reply.writeInt(result ? 1 : 0);
1602 return true;
1603 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001604
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001605 case STOP_USER_TRANSACTION: {
1606 data.enforceInterface(IActivityManager.descriptor);
1607 int userid = data.readInt();
1608 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1609 data.readStrongBinder());
1610 int result = stopUser(userid, callback);
1611 reply.writeNoException();
1612 reply.writeInt(result);
1613 return true;
1614 }
1615
Amith Yamasani52f1d752012-03-28 18:19:29 -07001616 case GET_CURRENT_USER_TRANSACTION: {
1617 data.enforceInterface(IActivityManager.descriptor);
1618 UserInfo userInfo = getCurrentUser();
1619 reply.writeNoException();
1620 userInfo.writeToParcel(reply, 0);
1621 return true;
1622 }
1623
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001624 case IS_USER_RUNNING_TRANSACTION: {
1625 data.enforceInterface(IActivityManager.descriptor);
1626 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001627 boolean orStopping = data.readInt() != 0;
1628 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001629 reply.writeNoException();
1630 reply.writeInt(result ? 1 : 0);
1631 return true;
1632 }
1633
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001634 case GET_RUNNING_USER_IDS_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 int[] result = getRunningUserIds();
1637 reply.writeNoException();
1638 reply.writeIntArray(result);
1639 return true;
1640 }
1641
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001642 case REMOVE_SUB_TASK_TRANSACTION:
1643 {
1644 data.enforceInterface(IActivityManager.descriptor);
1645 int taskId = data.readInt();
1646 int subTaskIndex = data.readInt();
1647 boolean result = removeSubTask(taskId, subTaskIndex);
1648 reply.writeNoException();
1649 reply.writeInt(result ? 1 : 0);
1650 return true;
1651 }
1652
1653 case REMOVE_TASK_TRANSACTION:
1654 {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 int taskId = data.readInt();
1657 int fl = data.readInt();
1658 boolean result = removeTask(taskId, fl);
1659 reply.writeNoException();
1660 reply.writeInt(result ? 1 : 0);
1661 return true;
1662 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001663
Jeff Sharkeya4620792011-05-20 15:29:23 -07001664 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1665 data.enforceInterface(IActivityManager.descriptor);
1666 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1667 data.readStrongBinder());
1668 registerProcessObserver(observer);
1669 return true;
1670 }
1671
1672 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1675 data.readStrongBinder());
1676 unregisterProcessObserver(observer);
1677 return true;
1678 }
1679
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001680 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1681 {
1682 data.enforceInterface(IActivityManager.descriptor);
1683 String pkg = data.readString();
1684 boolean ask = getPackageAskScreenCompat(pkg);
1685 reply.writeNoException();
1686 reply.writeInt(ask ? 1 : 0);
1687 return true;
1688 }
1689
1690 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1691 {
1692 data.enforceInterface(IActivityManager.descriptor);
1693 String pkg = data.readString();
1694 boolean ask = data.readInt() != 0;
1695 setPackageAskScreenCompat(pkg, ask);
1696 reply.writeNoException();
1697 return true;
1698 }
1699
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001700 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1701 data.enforceInterface(IActivityManager.descriptor);
1702 IIntentSender r = IIntentSender.Stub.asInterface(
1703 data.readStrongBinder());
1704 boolean res = isIntentSenderTargetedToPackage(r);
1705 reply.writeNoException();
1706 reply.writeInt(res ? 1 : 0);
1707 return true;
1708 }
1709
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001710 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1711 data.enforceInterface(IActivityManager.descriptor);
1712 IIntentSender r = IIntentSender.Stub.asInterface(
1713 data.readStrongBinder());
1714 boolean res = isIntentSenderAnActivity(r);
1715 reply.writeNoException();
1716 reply.writeInt(res ? 1 : 0);
1717 return true;
1718 }
1719
Dianne Hackborn81038902012-11-26 17:04:09 -08001720 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1721 data.enforceInterface(IActivityManager.descriptor);
1722 IIntentSender r = IIntentSender.Stub.asInterface(
1723 data.readStrongBinder());
1724 Intent intent = getIntentForIntentSender(r);
1725 reply.writeNoException();
1726 if (intent != null) {
1727 reply.writeInt(1);
1728 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1729 } else {
1730 reply.writeInt(0);
1731 }
1732 return true;
1733 }
1734
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001735 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
1737 Configuration config = Configuration.CREATOR.createFromParcel(data);
1738 updatePersistentConfiguration(config);
1739 reply.writeNoException();
1740 return true;
1741 }
1742
Dianne Hackbornb437e092011-08-05 17:50:29 -07001743 case GET_PROCESS_PSS_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 int[] pids = data.createIntArray();
1746 long[] pss = getProcessPss(pids);
1747 reply.writeNoException();
1748 reply.writeLongArray(pss);
1749 return true;
1750 }
1751
Dianne Hackborn661cd522011-08-22 00:26:20 -07001752 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1753 data.enforceInterface(IActivityManager.descriptor);
1754 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1755 boolean always = data.readInt() != 0;
1756 showBootMessage(msg, always);
1757 reply.writeNoException();
1758 return true;
1759 }
1760
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001761 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 dismissKeyguardOnNextActivity();
1764 reply.writeNoException();
1765 return true;
1766 }
1767
Adam Powelldd8fab22012-03-22 17:47:27 -07001768 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1769 data.enforceInterface(IActivityManager.descriptor);
1770 IBinder token = data.readStrongBinder();
1771 String destAffinity = data.readString();
1772 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1773 reply.writeNoException();
1774 reply.writeInt(res ? 1 : 0);
1775 return true;
1776 }
1777
1778 case NAVIGATE_UP_TO_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 IBinder token = data.readStrongBinder();
1781 Intent target = Intent.CREATOR.createFromParcel(data);
1782 int resultCode = data.readInt();
1783 Intent resultData = null;
1784 if (data.readInt() != 0) {
1785 resultData = Intent.CREATOR.createFromParcel(data);
1786 }
1787 boolean res = navigateUpTo(token, target, resultCode, resultData);
1788 reply.writeNoException();
1789 reply.writeInt(res ? 1 : 0);
1790 return true;
1791 }
1792
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001793 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1794 data.enforceInterface(IActivityManager.descriptor);
1795 IBinder token = data.readStrongBinder();
1796 int res = getLaunchedFromUid(token);
1797 reply.writeNoException();
1798 reply.writeInt(res);
1799 return true;
1800 }
1801
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001802 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1803 data.enforceInterface(IActivityManager.descriptor);
1804 IBinder token = data.readStrongBinder();
1805 String res = getLaunchedFromPackage(token);
1806 reply.writeNoException();
1807 reply.writeString(res);
1808 return true;
1809 }
1810
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001811 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1812 data.enforceInterface(IActivityManager.descriptor);
1813 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1814 data.readStrongBinder());
1815 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001816 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001817 return true;
1818 }
1819
1820 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1823 data.readStrongBinder());
1824 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001825 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001826 return true;
1827 }
1828
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001829 case REQUEST_BUG_REPORT_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001832 reply.writeNoException();
1833 return true;
1834 }
1835
1836 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1837 data.enforceInterface(IActivityManager.descriptor);
1838 int pid = data.readInt();
1839 boolean aboveSystem = data.readInt() != 0;
1840 long res = inputDispatchingTimedOut(pid, aboveSystem);
1841 reply.writeNoException();
1842 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001843 return true;
1844 }
1845
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001846 case GET_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 int requestType = data.readInt();
1849 Bundle res = getTopActivityExtras(requestType);
1850 reply.writeNoException();
1851 reply.writeBundle(res);
1852 return true;
1853 }
1854
1855 case REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1856 data.enforceInterface(IActivityManager.descriptor);
1857 IBinder token = data.readStrongBinder();
1858 Bundle extras = data.readBundle();
1859 reportTopActivityExtras(token, extras);
1860 reply.writeNoException();
1861 return true;
1862 }
1863
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001864 case KILL_UID_TRANSACTION: {
1865 data.enforceInterface(IActivityManager.descriptor);
1866 int uid = data.readInt();
1867 String reason = data.readString();
1868 killUid(uid, reason);
1869 reply.writeNoException();
1870 return true;
1871 }
1872
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07001873 case HANG_TRANSACTION: {
1874 data.enforceInterface(IActivityManager.descriptor);
1875 IBinder who = data.readStrongBinder();
1876 boolean allowRestart = data.readInt() != 0;
1877 hang(who, allowRestart);
1878 reply.writeNoException();
1879 return true;
1880 }
1881
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001882 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001883
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001884 return super.onTransact(code, data, reply, flags);
1885 }
1886
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001887 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001888 return this;
1889 }
1890
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001891 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1892 protected IActivityManager create() {
1893 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001894 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001895 Log.v("ActivityManager", "default service binder = " + b);
1896 }
1897 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001898 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001899 Log.v("ActivityManager", "default service = " + am);
1900 }
1901 return am;
1902 }
1903 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001904}
1905
1906class ActivityManagerProxy implements IActivityManager
1907{
1908 public ActivityManagerProxy(IBinder remote)
1909 {
1910 mRemote = remote;
1911 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001912
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001913 public IBinder asBinder()
1914 {
1915 return mRemote;
1916 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001917
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001918 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001919 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1920 int startFlags, String profileFile,
1921 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001922 Parcel data = Parcel.obtain();
1923 Parcel reply = Parcel.obtain();
1924 data.writeInterfaceToken(IActivityManager.descriptor);
1925 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001926 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001927 intent.writeToParcel(data, 0);
1928 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001929 data.writeStrongBinder(resultTo);
1930 data.writeString(resultWho);
1931 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001932 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001933 data.writeString(profileFile);
1934 if (profileFd != null) {
1935 data.writeInt(1);
1936 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1937 } else {
1938 data.writeInt(0);
1939 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001940 if (options != null) {
1941 data.writeInt(1);
1942 options.writeToParcel(data, 0);
1943 } else {
1944 data.writeInt(0);
1945 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001946 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1947 reply.readException();
1948 int result = reply.readInt();
1949 reply.recycle();
1950 data.recycle();
1951 return result;
1952 }
Amith Yamasani82644082012-08-03 13:09:11 -07001953
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001954 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07001955 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1956 int startFlags, String profileFile,
1957 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1958 Parcel data = Parcel.obtain();
1959 Parcel reply = Parcel.obtain();
1960 data.writeInterfaceToken(IActivityManager.descriptor);
1961 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001962 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07001963 intent.writeToParcel(data, 0);
1964 data.writeString(resolvedType);
1965 data.writeStrongBinder(resultTo);
1966 data.writeString(resultWho);
1967 data.writeInt(requestCode);
1968 data.writeInt(startFlags);
1969 data.writeString(profileFile);
1970 if (profileFd != null) {
1971 data.writeInt(1);
1972 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1973 } else {
1974 data.writeInt(0);
1975 }
1976 if (options != null) {
1977 data.writeInt(1);
1978 options.writeToParcel(data, 0);
1979 } else {
1980 data.writeInt(0);
1981 }
1982 data.writeInt(userId);
1983 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1984 reply.readException();
1985 int result = reply.readInt();
1986 reply.recycle();
1987 data.recycle();
1988 return result;
1989 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001990 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
1991 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001992 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001993 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001994 Parcel data = Parcel.obtain();
1995 Parcel reply = Parcel.obtain();
1996 data.writeInterfaceToken(IActivityManager.descriptor);
1997 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001998 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001999 intent.writeToParcel(data, 0);
2000 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002001 data.writeStrongBinder(resultTo);
2002 data.writeString(resultWho);
2003 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002004 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002005 data.writeString(profileFile);
2006 if (profileFd != null) {
2007 data.writeInt(1);
2008 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2009 } else {
2010 data.writeInt(0);
2011 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002012 if (options != null) {
2013 data.writeInt(1);
2014 options.writeToParcel(data, 0);
2015 } else {
2016 data.writeInt(0);
2017 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002018 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002019 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2020 reply.readException();
2021 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2022 reply.recycle();
2023 data.recycle();
2024 return result;
2025 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002026 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2027 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002028 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002029 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002030 Parcel data = Parcel.obtain();
2031 Parcel reply = Parcel.obtain();
2032 data.writeInterfaceToken(IActivityManager.descriptor);
2033 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002034 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002035 intent.writeToParcel(data, 0);
2036 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002037 data.writeStrongBinder(resultTo);
2038 data.writeString(resultWho);
2039 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002040 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002041 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002042 if (options != null) {
2043 data.writeInt(1);
2044 options.writeToParcel(data, 0);
2045 } else {
2046 data.writeInt(0);
2047 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002048 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002049 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2050 reply.readException();
2051 int result = reply.readInt();
2052 reply.recycle();
2053 data.recycle();
2054 return result;
2055 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002056 public int startActivityIntentSender(IApplicationThread caller,
2057 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002058 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002059 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002060 Parcel data = Parcel.obtain();
2061 Parcel reply = Parcel.obtain();
2062 data.writeInterfaceToken(IActivityManager.descriptor);
2063 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2064 intent.writeToParcel(data, 0);
2065 if (fillInIntent != null) {
2066 data.writeInt(1);
2067 fillInIntent.writeToParcel(data, 0);
2068 } else {
2069 data.writeInt(0);
2070 }
2071 data.writeString(resolvedType);
2072 data.writeStrongBinder(resultTo);
2073 data.writeString(resultWho);
2074 data.writeInt(requestCode);
2075 data.writeInt(flagsMask);
2076 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002077 if (options != null) {
2078 data.writeInt(1);
2079 options.writeToParcel(data, 0);
2080 } else {
2081 data.writeInt(0);
2082 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002083 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002084 reply.readException();
2085 int result = reply.readInt();
2086 reply.recycle();
2087 data.recycle();
2088 return result;
2089 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002090 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002091 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002092 Parcel data = Parcel.obtain();
2093 Parcel reply = Parcel.obtain();
2094 data.writeInterfaceToken(IActivityManager.descriptor);
2095 data.writeStrongBinder(callingActivity);
2096 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002097 if (options != null) {
2098 data.writeInt(1);
2099 options.writeToParcel(data, 0);
2100 } else {
2101 data.writeInt(0);
2102 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002103 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2104 reply.readException();
2105 int result = reply.readInt();
2106 reply.recycle();
2107 data.recycle();
2108 return result != 0;
2109 }
2110 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2111 throws RemoteException {
2112 Parcel data = Parcel.obtain();
2113 Parcel reply = Parcel.obtain();
2114 data.writeInterfaceToken(IActivityManager.descriptor);
2115 data.writeStrongBinder(token);
2116 data.writeInt(resultCode);
2117 if (resultData != null) {
2118 data.writeInt(1);
2119 resultData.writeToParcel(data, 0);
2120 } else {
2121 data.writeInt(0);
2122 }
2123 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2124 reply.readException();
2125 boolean res = reply.readInt() != 0;
2126 data.recycle();
2127 reply.recycle();
2128 return res;
2129 }
2130 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2131 {
2132 Parcel data = Parcel.obtain();
2133 Parcel reply = Parcel.obtain();
2134 data.writeInterfaceToken(IActivityManager.descriptor);
2135 data.writeStrongBinder(token);
2136 data.writeString(resultWho);
2137 data.writeInt(requestCode);
2138 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2139 reply.readException();
2140 data.recycle();
2141 reply.recycle();
2142 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002143 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2144 Parcel data = Parcel.obtain();
2145 Parcel reply = Parcel.obtain();
2146 data.writeInterfaceToken(IActivityManager.descriptor);
2147 data.writeStrongBinder(token);
2148 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2149 reply.readException();
2150 boolean res = reply.readInt() != 0;
2151 data.recycle();
2152 reply.recycle();
2153 return res;
2154 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002155 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2156 Parcel data = Parcel.obtain();
2157 Parcel reply = Parcel.obtain();
2158 data.writeInterfaceToken(IActivityManager.descriptor);
2159 data.writeStrongBinder(token);
2160 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2161 reply.readException();
2162 boolean res = reply.readInt() != 0;
2163 data.recycle();
2164 reply.recycle();
2165 return res;
2166 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002167 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002168 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002169 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002170 {
2171 Parcel data = Parcel.obtain();
2172 Parcel reply = Parcel.obtain();
2173 data.writeInterfaceToken(IActivityManager.descriptor);
2174 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002175 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002176 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2177 filter.writeToParcel(data, 0);
2178 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002179 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002180 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2181 reply.readException();
2182 Intent intent = null;
2183 int haveIntent = reply.readInt();
2184 if (haveIntent != 0) {
2185 intent = Intent.CREATOR.createFromParcel(reply);
2186 }
2187 reply.recycle();
2188 data.recycle();
2189 return intent;
2190 }
2191 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2192 {
2193 Parcel data = Parcel.obtain();
2194 Parcel reply = Parcel.obtain();
2195 data.writeInterfaceToken(IActivityManager.descriptor);
2196 data.writeStrongBinder(receiver.asBinder());
2197 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2198 reply.readException();
2199 data.recycle();
2200 reply.recycle();
2201 }
2202 public int broadcastIntent(IApplicationThread caller,
2203 Intent intent, String resolvedType, IIntentReceiver resultTo,
2204 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002205 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002206 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002207 {
2208 Parcel data = Parcel.obtain();
2209 Parcel reply = Parcel.obtain();
2210 data.writeInterfaceToken(IActivityManager.descriptor);
2211 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2212 intent.writeToParcel(data, 0);
2213 data.writeString(resolvedType);
2214 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2215 data.writeInt(resultCode);
2216 data.writeString(resultData);
2217 data.writeBundle(map);
2218 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002219 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002220 data.writeInt(serialized ? 1 : 0);
2221 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002222 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002223 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2224 reply.readException();
2225 int res = reply.readInt();
2226 reply.recycle();
2227 data.recycle();
2228 return res;
2229 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002230 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2231 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002232 {
2233 Parcel data = Parcel.obtain();
2234 Parcel reply = Parcel.obtain();
2235 data.writeInterfaceToken(IActivityManager.descriptor);
2236 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2237 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002238 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002239 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2240 reply.readException();
2241 data.recycle();
2242 reply.recycle();
2243 }
2244 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2245 {
2246 Parcel data = Parcel.obtain();
2247 Parcel reply = Parcel.obtain();
2248 data.writeInterfaceToken(IActivityManager.descriptor);
2249 data.writeStrongBinder(who);
2250 data.writeInt(resultCode);
2251 data.writeString(resultData);
2252 data.writeBundle(map);
2253 data.writeInt(abortBroadcast ? 1 : 0);
2254 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2255 reply.readException();
2256 data.recycle();
2257 reply.recycle();
2258 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002259 public void attachApplication(IApplicationThread app) throws RemoteException
2260 {
2261 Parcel data = Parcel.obtain();
2262 Parcel reply = Parcel.obtain();
2263 data.writeInterfaceToken(IActivityManager.descriptor);
2264 data.writeStrongBinder(app.asBinder());
2265 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2266 reply.readException();
2267 data.recycle();
2268 reply.recycle();
2269 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002270 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2271 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002272 {
2273 Parcel data = Parcel.obtain();
2274 Parcel reply = Parcel.obtain();
2275 data.writeInterfaceToken(IActivityManager.descriptor);
2276 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002277 if (config != null) {
2278 data.writeInt(1);
2279 config.writeToParcel(data, 0);
2280 } else {
2281 data.writeInt(0);
2282 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002283 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002284 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2285 reply.readException();
2286 data.recycle();
2287 reply.recycle();
2288 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002289 public void activityResumed(IBinder token) throws RemoteException
2290 {
2291 Parcel data = Parcel.obtain();
2292 Parcel reply = Parcel.obtain();
2293 data.writeInterfaceToken(IActivityManager.descriptor);
2294 data.writeStrongBinder(token);
2295 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2296 reply.readException();
2297 data.recycle();
2298 reply.recycle();
2299 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002300 public void activityPaused(IBinder token) throws RemoteException
2301 {
2302 Parcel data = Parcel.obtain();
2303 Parcel reply = Parcel.obtain();
2304 data.writeInterfaceToken(IActivityManager.descriptor);
2305 data.writeStrongBinder(token);
2306 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2307 reply.readException();
2308 data.recycle();
2309 reply.recycle();
2310 }
2311 public void activityStopped(IBinder token, Bundle state,
2312 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002313 {
2314 Parcel data = Parcel.obtain();
2315 Parcel reply = Parcel.obtain();
2316 data.writeInterfaceToken(IActivityManager.descriptor);
2317 data.writeStrongBinder(token);
2318 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002319 if (thumbnail != null) {
2320 data.writeInt(1);
2321 thumbnail.writeToParcel(data, 0);
2322 } else {
2323 data.writeInt(0);
2324 }
2325 TextUtils.writeToParcel(description, data, 0);
2326 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2327 reply.readException();
2328 data.recycle();
2329 reply.recycle();
2330 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002331 public void activitySlept(IBinder token) throws RemoteException
2332 {
2333 Parcel data = Parcel.obtain();
2334 Parcel reply = Parcel.obtain();
2335 data.writeInterfaceToken(IActivityManager.descriptor);
2336 data.writeStrongBinder(token);
2337 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2338 reply.readException();
2339 data.recycle();
2340 reply.recycle();
2341 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 public void activityDestroyed(IBinder token) throws RemoteException
2343 {
2344 Parcel data = Parcel.obtain();
2345 Parcel reply = Parcel.obtain();
2346 data.writeInterfaceToken(IActivityManager.descriptor);
2347 data.writeStrongBinder(token);
2348 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2349 reply.readException();
2350 data.recycle();
2351 reply.recycle();
2352 }
2353 public String getCallingPackage(IBinder token) throws RemoteException
2354 {
2355 Parcel data = Parcel.obtain();
2356 Parcel reply = Parcel.obtain();
2357 data.writeInterfaceToken(IActivityManager.descriptor);
2358 data.writeStrongBinder(token);
2359 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2360 reply.readException();
2361 String res = reply.readString();
2362 data.recycle();
2363 reply.recycle();
2364 return res;
2365 }
2366 public ComponentName getCallingActivity(IBinder token)
2367 throws RemoteException {
2368 Parcel data = Parcel.obtain();
2369 Parcel reply = Parcel.obtain();
2370 data.writeInterfaceToken(IActivityManager.descriptor);
2371 data.writeStrongBinder(token);
2372 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2373 reply.readException();
2374 ComponentName res = ComponentName.readFromParcel(reply);
2375 data.recycle();
2376 reply.recycle();
2377 return res;
2378 }
2379 public List getTasks(int maxNum, int flags,
2380 IThumbnailReceiver receiver) throws RemoteException {
2381 Parcel data = Parcel.obtain();
2382 Parcel reply = Parcel.obtain();
2383 data.writeInterfaceToken(IActivityManager.descriptor);
2384 data.writeInt(maxNum);
2385 data.writeInt(flags);
2386 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2387 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2388 reply.readException();
2389 ArrayList list = null;
2390 int N = reply.readInt();
2391 if (N >= 0) {
2392 list = new ArrayList();
2393 while (N > 0) {
2394 ActivityManager.RunningTaskInfo info =
2395 ActivityManager.RunningTaskInfo.CREATOR
2396 .createFromParcel(reply);
2397 list.add(info);
2398 N--;
2399 }
2400 }
2401 data.recycle();
2402 reply.recycle();
2403 return list;
2404 }
2405 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002406 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002407 Parcel data = Parcel.obtain();
2408 Parcel reply = Parcel.obtain();
2409 data.writeInterfaceToken(IActivityManager.descriptor);
2410 data.writeInt(maxNum);
2411 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002412 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002413 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2414 reply.readException();
2415 ArrayList<ActivityManager.RecentTaskInfo> list
2416 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2417 data.recycle();
2418 reply.recycle();
2419 return list;
2420 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002421 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002422 Parcel data = Parcel.obtain();
2423 Parcel reply = Parcel.obtain();
2424 data.writeInterfaceToken(IActivityManager.descriptor);
2425 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002426 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002427 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002428 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002429 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002430 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002431 }
2432 data.recycle();
2433 reply.recycle();
2434 return bm;
2435 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002436 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2437 Parcel data = Parcel.obtain();
2438 Parcel reply = Parcel.obtain();
2439 data.writeInterfaceToken(IActivityManager.descriptor);
2440 data.writeInt(id);
2441 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2442 reply.readException();
2443 Bitmap bm = null;
2444 if (reply.readInt() != 0) {
2445 bm = Bitmap.CREATOR.createFromParcel(reply);
2446 }
2447 data.recycle();
2448 reply.recycle();
2449 return bm;
2450 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002451 public List getServices(int maxNum, int flags) throws RemoteException {
2452 Parcel data = Parcel.obtain();
2453 Parcel reply = Parcel.obtain();
2454 data.writeInterfaceToken(IActivityManager.descriptor);
2455 data.writeInt(maxNum);
2456 data.writeInt(flags);
2457 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2458 reply.readException();
2459 ArrayList list = null;
2460 int N = reply.readInt();
2461 if (N >= 0) {
2462 list = new ArrayList();
2463 while (N > 0) {
2464 ActivityManager.RunningServiceInfo info =
2465 ActivityManager.RunningServiceInfo.CREATOR
2466 .createFromParcel(reply);
2467 list.add(info);
2468 N--;
2469 }
2470 }
2471 data.recycle();
2472 reply.recycle();
2473 return list;
2474 }
2475 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2476 throws RemoteException {
2477 Parcel data = Parcel.obtain();
2478 Parcel reply = Parcel.obtain();
2479 data.writeInterfaceToken(IActivityManager.descriptor);
2480 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2481 reply.readException();
2482 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2483 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2484 data.recycle();
2485 reply.recycle();
2486 return list;
2487 }
2488 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2489 throws RemoteException {
2490 Parcel data = Parcel.obtain();
2491 Parcel reply = Parcel.obtain();
2492 data.writeInterfaceToken(IActivityManager.descriptor);
2493 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2494 reply.readException();
2495 ArrayList<ActivityManager.RunningAppProcessInfo> list
2496 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2497 data.recycle();
2498 reply.recycle();
2499 return list;
2500 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002501 public List<ApplicationInfo> getRunningExternalApplications()
2502 throws RemoteException {
2503 Parcel data = Parcel.obtain();
2504 Parcel reply = Parcel.obtain();
2505 data.writeInterfaceToken(IActivityManager.descriptor);
2506 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2507 reply.readException();
2508 ArrayList<ApplicationInfo> list
2509 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2510 data.recycle();
2511 reply.recycle();
2512 return list;
2513 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002514 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002515 {
2516 Parcel data = Parcel.obtain();
2517 Parcel reply = Parcel.obtain();
2518 data.writeInterfaceToken(IActivityManager.descriptor);
2519 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002520 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002521 if (options != null) {
2522 data.writeInt(1);
2523 options.writeToParcel(data, 0);
2524 } else {
2525 data.writeInt(0);
2526 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002527 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2528 reply.readException();
2529 data.recycle();
2530 reply.recycle();
2531 }
2532 public void moveTaskToBack(int task) throws RemoteException
2533 {
2534 Parcel data = Parcel.obtain();
2535 Parcel reply = Parcel.obtain();
2536 data.writeInterfaceToken(IActivityManager.descriptor);
2537 data.writeInt(task);
2538 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2539 reply.readException();
2540 data.recycle();
2541 reply.recycle();
2542 }
2543 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2544 throws RemoteException {
2545 Parcel data = Parcel.obtain();
2546 Parcel reply = Parcel.obtain();
2547 data.writeInterfaceToken(IActivityManager.descriptor);
2548 data.writeStrongBinder(token);
2549 data.writeInt(nonRoot ? 1 : 0);
2550 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2551 reply.readException();
2552 boolean res = reply.readInt() != 0;
2553 data.recycle();
2554 reply.recycle();
2555 return res;
2556 }
2557 public void moveTaskBackwards(int task) throws RemoteException
2558 {
2559 Parcel data = Parcel.obtain();
2560 Parcel reply = Parcel.obtain();
2561 data.writeInterfaceToken(IActivityManager.descriptor);
2562 data.writeInt(task);
2563 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2564 reply.readException();
2565 data.recycle();
2566 reply.recycle();
2567 }
2568 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2569 {
2570 Parcel data = Parcel.obtain();
2571 Parcel reply = Parcel.obtain();
2572 data.writeInterfaceToken(IActivityManager.descriptor);
2573 data.writeStrongBinder(token);
2574 data.writeInt(onlyRoot ? 1 : 0);
2575 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2576 reply.readException();
2577 int res = reply.readInt();
2578 data.recycle();
2579 reply.recycle();
2580 return res;
2581 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002582 public void reportThumbnail(IBinder token,
2583 Bitmap thumbnail, CharSequence description) throws RemoteException
2584 {
2585 Parcel data = Parcel.obtain();
2586 Parcel reply = Parcel.obtain();
2587 data.writeInterfaceToken(IActivityManager.descriptor);
2588 data.writeStrongBinder(token);
2589 if (thumbnail != null) {
2590 data.writeInt(1);
2591 thumbnail.writeToParcel(data, 0);
2592 } else {
2593 data.writeInt(0);
2594 }
2595 TextUtils.writeToParcel(description, data, 0);
2596 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2597 reply.readException();
2598 data.recycle();
2599 reply.recycle();
2600 }
2601 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002602 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002603 Parcel data = Parcel.obtain();
2604 Parcel reply = Parcel.obtain();
2605 data.writeInterfaceToken(IActivityManager.descriptor);
2606 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2607 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002608 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002609 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002610 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2611 reply.readException();
2612 int res = reply.readInt();
2613 ContentProviderHolder cph = null;
2614 if (res != 0) {
2615 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2616 }
2617 data.recycle();
2618 reply.recycle();
2619 return cph;
2620 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002621 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2622 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002623 Parcel data = Parcel.obtain();
2624 Parcel reply = Parcel.obtain();
2625 data.writeInterfaceToken(IActivityManager.descriptor);
2626 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002627 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002628 data.writeStrongBinder(token);
2629 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2630 reply.readException();
2631 int res = reply.readInt();
2632 ContentProviderHolder cph = null;
2633 if (res != 0) {
2634 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2635 }
2636 data.recycle();
2637 reply.recycle();
2638 return cph;
2639 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002641 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002642 {
2643 Parcel data = Parcel.obtain();
2644 Parcel reply = Parcel.obtain();
2645 data.writeInterfaceToken(IActivityManager.descriptor);
2646 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2647 data.writeTypedList(providers);
2648 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2649 reply.readException();
2650 data.recycle();
2651 reply.recycle();
2652 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002653 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2654 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002658 data.writeStrongBinder(connection);
2659 data.writeInt(stable);
2660 data.writeInt(unstable);
2661 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2662 reply.readException();
2663 boolean res = reply.readInt() != 0;
2664 data.recycle();
2665 reply.recycle();
2666 return res;
2667 }
2668 public void unstableProviderDied(IBinder connection) throws RemoteException {
2669 Parcel data = Parcel.obtain();
2670 Parcel reply = Parcel.obtain();
2671 data.writeInterfaceToken(IActivityManager.descriptor);
2672 data.writeStrongBinder(connection);
2673 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2674 reply.readException();
2675 data.recycle();
2676 reply.recycle();
2677 }
2678
2679 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2680 Parcel data = Parcel.obtain();
2681 Parcel reply = Parcel.obtain();
2682 data.writeInterfaceToken(IActivityManager.descriptor);
2683 data.writeStrongBinder(connection);
2684 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002685 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2686 reply.readException();
2687 data.recycle();
2688 reply.recycle();
2689 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002690
2691 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2692 Parcel data = Parcel.obtain();
2693 Parcel reply = Parcel.obtain();
2694 data.writeInterfaceToken(IActivityManager.descriptor);
2695 data.writeString(name);
2696 data.writeStrongBinder(token);
2697 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2698 reply.readException();
2699 data.recycle();
2700 reply.recycle();
2701 }
2702
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002703 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2704 throws RemoteException
2705 {
2706 Parcel data = Parcel.obtain();
2707 Parcel reply = Parcel.obtain();
2708 data.writeInterfaceToken(IActivityManager.descriptor);
2709 service.writeToParcel(data, 0);
2710 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2711 reply.readException();
2712 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2713 data.recycle();
2714 reply.recycle();
2715 return res;
2716 }
2717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002718 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002719 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002720 {
2721 Parcel data = Parcel.obtain();
2722 Parcel reply = Parcel.obtain();
2723 data.writeInterfaceToken(IActivityManager.descriptor);
2724 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2725 service.writeToParcel(data, 0);
2726 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002727 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002728 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2729 reply.readException();
2730 ComponentName res = ComponentName.readFromParcel(reply);
2731 data.recycle();
2732 reply.recycle();
2733 return res;
2734 }
2735 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002736 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002737 {
2738 Parcel data = Parcel.obtain();
2739 Parcel reply = Parcel.obtain();
2740 data.writeInterfaceToken(IActivityManager.descriptor);
2741 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2742 service.writeToParcel(data, 0);
2743 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002744 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002745 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2746 reply.readException();
2747 int res = reply.readInt();
2748 reply.recycle();
2749 data.recycle();
2750 return res;
2751 }
2752 public boolean stopServiceToken(ComponentName className, IBinder token,
2753 int startId) throws RemoteException {
2754 Parcel data = Parcel.obtain();
2755 Parcel reply = Parcel.obtain();
2756 data.writeInterfaceToken(IActivityManager.descriptor);
2757 ComponentName.writeToParcel(className, data);
2758 data.writeStrongBinder(token);
2759 data.writeInt(startId);
2760 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2761 reply.readException();
2762 boolean res = reply.readInt() != 0;
2763 data.recycle();
2764 reply.recycle();
2765 return res;
2766 }
2767 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002768 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002769 Parcel data = Parcel.obtain();
2770 Parcel reply = Parcel.obtain();
2771 data.writeInterfaceToken(IActivityManager.descriptor);
2772 ComponentName.writeToParcel(className, data);
2773 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002774 data.writeInt(id);
2775 if (notification != null) {
2776 data.writeInt(1);
2777 notification.writeToParcel(data, 0);
2778 } else {
2779 data.writeInt(0);
2780 }
2781 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002782 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2783 reply.readException();
2784 data.recycle();
2785 reply.recycle();
2786 }
2787 public int bindService(IApplicationThread caller, IBinder token,
2788 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002789 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002790 Parcel data = Parcel.obtain();
2791 Parcel reply = Parcel.obtain();
2792 data.writeInterfaceToken(IActivityManager.descriptor);
2793 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2794 data.writeStrongBinder(token);
2795 service.writeToParcel(data, 0);
2796 data.writeString(resolvedType);
2797 data.writeStrongBinder(connection.asBinder());
2798 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002799 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002800 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2801 reply.readException();
2802 int res = reply.readInt();
2803 data.recycle();
2804 reply.recycle();
2805 return res;
2806 }
2807 public boolean unbindService(IServiceConnection connection) throws RemoteException
2808 {
2809 Parcel data = Parcel.obtain();
2810 Parcel reply = Parcel.obtain();
2811 data.writeInterfaceToken(IActivityManager.descriptor);
2812 data.writeStrongBinder(connection.asBinder());
2813 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2814 reply.readException();
2815 boolean res = reply.readInt() != 0;
2816 data.recycle();
2817 reply.recycle();
2818 return res;
2819 }
2820
2821 public void publishService(IBinder token,
2822 Intent intent, IBinder service) throws RemoteException {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 data.writeStrongBinder(token);
2827 intent.writeToParcel(data, 0);
2828 data.writeStrongBinder(service);
2829 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2830 reply.readException();
2831 data.recycle();
2832 reply.recycle();
2833 }
2834
2835 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2836 throws RemoteException {
2837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeStrongBinder(token);
2841 intent.writeToParcel(data, 0);
2842 data.writeInt(doRebind ? 1 : 0);
2843 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2844 reply.readException();
2845 data.recycle();
2846 reply.recycle();
2847 }
2848
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002849 public void serviceDoneExecuting(IBinder token, int type, int startId,
2850 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002851 Parcel data = Parcel.obtain();
2852 Parcel reply = Parcel.obtain();
2853 data.writeInterfaceToken(IActivityManager.descriptor);
2854 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002855 data.writeInt(type);
2856 data.writeInt(startId);
2857 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002858 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2859 reply.readException();
2860 data.recycle();
2861 reply.recycle();
2862 }
2863
2864 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2865 Parcel data = Parcel.obtain();
2866 Parcel reply = Parcel.obtain();
2867 data.writeInterfaceToken(IActivityManager.descriptor);
2868 service.writeToParcel(data, 0);
2869 data.writeString(resolvedType);
2870 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2871 reply.readException();
2872 IBinder binder = reply.readStrongBinder();
2873 reply.recycle();
2874 data.recycle();
2875 return binder;
2876 }
2877
Christopher Tate181fafa2009-05-14 11:12:14 -07002878 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2879 throws RemoteException {
2880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 app.writeToParcel(data, 0);
2884 data.writeInt(backupRestoreMode);
2885 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2886 reply.readException();
2887 boolean success = reply.readInt() != 0;
2888 reply.recycle();
2889 data.recycle();
2890 return success;
2891 }
2892
Christopher Tate346acb12012-10-15 19:20:25 -07002893 public void clearPendingBackup() throws RemoteException {
2894 Parcel data = Parcel.obtain();
2895 Parcel reply = Parcel.obtain();
2896 data.writeInterfaceToken(IActivityManager.descriptor);
2897 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
2898 reply.recycle();
2899 data.recycle();
2900 }
2901
Christopher Tate181fafa2009-05-14 11:12:14 -07002902 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2903 Parcel data = Parcel.obtain();
2904 Parcel reply = Parcel.obtain();
2905 data.writeInterfaceToken(IActivityManager.descriptor);
2906 data.writeString(packageName);
2907 data.writeStrongBinder(agent);
2908 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2909 reply.recycle();
2910 data.recycle();
2911 }
2912
2913 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2914 Parcel data = Parcel.obtain();
2915 Parcel reply = Parcel.obtain();
2916 data.writeInterfaceToken(IActivityManager.descriptor);
2917 app.writeToParcel(data, 0);
2918 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2919 reply.readException();
2920 reply.recycle();
2921 data.recycle();
2922 }
2923
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002924 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002925 int flags, Bundle arguments, IInstrumentationWatcher watcher,
2926 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 ComponentName.writeToParcel(className, data);
2931 data.writeString(profileFile);
2932 data.writeInt(flags);
2933 data.writeBundle(arguments);
2934 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002935 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002936 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002937 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2938 reply.readException();
2939 boolean res = reply.readInt() != 0;
2940 reply.recycle();
2941 data.recycle();
2942 return res;
2943 }
2944
2945 public void finishInstrumentation(IApplicationThread target,
2946 int resultCode, Bundle results) throws RemoteException {
2947 Parcel data = Parcel.obtain();
2948 Parcel reply = Parcel.obtain();
2949 data.writeInterfaceToken(IActivityManager.descriptor);
2950 data.writeStrongBinder(target != null ? target.asBinder() : null);
2951 data.writeInt(resultCode);
2952 data.writeBundle(results);
2953 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2954 reply.readException();
2955 data.recycle();
2956 reply.recycle();
2957 }
2958 public Configuration getConfiguration() throws RemoteException
2959 {
2960 Parcel data = Parcel.obtain();
2961 Parcel reply = Parcel.obtain();
2962 data.writeInterfaceToken(IActivityManager.descriptor);
2963 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2964 reply.readException();
2965 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2966 reply.recycle();
2967 data.recycle();
2968 return res;
2969 }
2970 public void updateConfiguration(Configuration values) throws RemoteException
2971 {
2972 Parcel data = Parcel.obtain();
2973 Parcel reply = Parcel.obtain();
2974 data.writeInterfaceToken(IActivityManager.descriptor);
2975 values.writeToParcel(data, 0);
2976 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2977 reply.readException();
2978 data.recycle();
2979 reply.recycle();
2980 }
2981 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2982 throws RemoteException {
2983 Parcel data = Parcel.obtain();
2984 Parcel reply = Parcel.obtain();
2985 data.writeInterfaceToken(IActivityManager.descriptor);
2986 data.writeStrongBinder(token);
2987 data.writeInt(requestedOrientation);
2988 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2989 reply.readException();
2990 data.recycle();
2991 reply.recycle();
2992 }
2993 public int getRequestedOrientation(IBinder token) throws RemoteException {
2994 Parcel data = Parcel.obtain();
2995 Parcel reply = Parcel.obtain();
2996 data.writeInterfaceToken(IActivityManager.descriptor);
2997 data.writeStrongBinder(token);
2998 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2999 reply.readException();
3000 int res = reply.readInt();
3001 data.recycle();
3002 reply.recycle();
3003 return res;
3004 }
3005 public ComponentName getActivityClassForToken(IBinder token)
3006 throws RemoteException {
3007 Parcel data = Parcel.obtain();
3008 Parcel reply = Parcel.obtain();
3009 data.writeInterfaceToken(IActivityManager.descriptor);
3010 data.writeStrongBinder(token);
3011 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3012 reply.readException();
3013 ComponentName res = ComponentName.readFromParcel(reply);
3014 data.recycle();
3015 reply.recycle();
3016 return res;
3017 }
3018 public String getPackageForToken(IBinder token) throws RemoteException
3019 {
3020 Parcel data = Parcel.obtain();
3021 Parcel reply = Parcel.obtain();
3022 data.writeInterfaceToken(IActivityManager.descriptor);
3023 data.writeStrongBinder(token);
3024 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3025 reply.readException();
3026 String res = reply.readString();
3027 data.recycle();
3028 reply.recycle();
3029 return res;
3030 }
3031 public IIntentSender getIntentSender(int type,
3032 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003033 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003034 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 data.writeInt(type);
3039 data.writeString(packageName);
3040 data.writeStrongBinder(token);
3041 data.writeString(resultWho);
3042 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003043 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003044 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003045 data.writeTypedArray(intents, 0);
3046 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003047 } else {
3048 data.writeInt(0);
3049 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003050 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003051 if (options != null) {
3052 data.writeInt(1);
3053 options.writeToParcel(data, 0);
3054 } else {
3055 data.writeInt(0);
3056 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003057 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003058 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3059 reply.readException();
3060 IIntentSender res = IIntentSender.Stub.asInterface(
3061 reply.readStrongBinder());
3062 data.recycle();
3063 reply.recycle();
3064 return res;
3065 }
3066 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 data.writeStrongBinder(sender.asBinder());
3071 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3072 reply.readException();
3073 data.recycle();
3074 reply.recycle();
3075 }
3076 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3077 Parcel data = Parcel.obtain();
3078 Parcel reply = Parcel.obtain();
3079 data.writeInterfaceToken(IActivityManager.descriptor);
3080 data.writeStrongBinder(sender.asBinder());
3081 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3082 reply.readException();
3083 String res = reply.readString();
3084 data.recycle();
3085 reply.recycle();
3086 return res;
3087 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003088 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3089 Parcel data = Parcel.obtain();
3090 Parcel reply = Parcel.obtain();
3091 data.writeInterfaceToken(IActivityManager.descriptor);
3092 data.writeStrongBinder(sender.asBinder());
3093 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3094 reply.readException();
3095 int res = reply.readInt();
3096 data.recycle();
3097 reply.recycle();
3098 return res;
3099 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003100 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3101 boolean requireFull, String name, String callerPackage) throws RemoteException {
3102 Parcel data = Parcel.obtain();
3103 Parcel reply = Parcel.obtain();
3104 data.writeInterfaceToken(IActivityManager.descriptor);
3105 data.writeInt(callingPid);
3106 data.writeInt(callingUid);
3107 data.writeInt(userId);
3108 data.writeInt(allowAll ? 1 : 0);
3109 data.writeInt(requireFull ? 1 : 0);
3110 data.writeString(name);
3111 data.writeString(callerPackage);
3112 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3113 reply.readException();
3114 int res = reply.readInt();
3115 data.recycle();
3116 reply.recycle();
3117 return res;
3118 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003119 public void setProcessLimit(int max) throws RemoteException
3120 {
3121 Parcel data = Parcel.obtain();
3122 Parcel reply = Parcel.obtain();
3123 data.writeInterfaceToken(IActivityManager.descriptor);
3124 data.writeInt(max);
3125 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3126 reply.readException();
3127 data.recycle();
3128 reply.recycle();
3129 }
3130 public int getProcessLimit() throws RemoteException
3131 {
3132 Parcel data = Parcel.obtain();
3133 Parcel reply = Parcel.obtain();
3134 data.writeInterfaceToken(IActivityManager.descriptor);
3135 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3136 reply.readException();
3137 int res = reply.readInt();
3138 data.recycle();
3139 reply.recycle();
3140 return res;
3141 }
3142 public void setProcessForeground(IBinder token, int pid,
3143 boolean isForeground) throws RemoteException {
3144 Parcel data = Parcel.obtain();
3145 Parcel reply = Parcel.obtain();
3146 data.writeInterfaceToken(IActivityManager.descriptor);
3147 data.writeStrongBinder(token);
3148 data.writeInt(pid);
3149 data.writeInt(isForeground ? 1 : 0);
3150 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3151 reply.readException();
3152 data.recycle();
3153 reply.recycle();
3154 }
3155 public int checkPermission(String permission, int pid, int uid)
3156 throws RemoteException {
3157 Parcel data = Parcel.obtain();
3158 Parcel reply = Parcel.obtain();
3159 data.writeInterfaceToken(IActivityManager.descriptor);
3160 data.writeString(permission);
3161 data.writeInt(pid);
3162 data.writeInt(uid);
3163 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3164 reply.readException();
3165 int res = reply.readInt();
3166 data.recycle();
3167 reply.recycle();
3168 return res;
3169 }
3170 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003171 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003172 Parcel data = Parcel.obtain();
3173 Parcel reply = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 data.writeString(packageName);
3176 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003177 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003178 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3179 reply.readException();
3180 boolean res = reply.readInt() != 0;
3181 data.recycle();
3182 reply.recycle();
3183 return res;
3184 }
3185 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3186 throws RemoteException {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 uri.writeToParcel(data, 0);
3191 data.writeInt(pid);
3192 data.writeInt(uid);
3193 data.writeInt(mode);
3194 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3195 reply.readException();
3196 int res = reply.readInt();
3197 data.recycle();
3198 reply.recycle();
3199 return res;
3200 }
3201 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3202 Uri uri, int mode) throws RemoteException {
3203 Parcel data = Parcel.obtain();
3204 Parcel reply = Parcel.obtain();
3205 data.writeInterfaceToken(IActivityManager.descriptor);
3206 data.writeStrongBinder(caller.asBinder());
3207 data.writeString(targetPkg);
3208 uri.writeToParcel(data, 0);
3209 data.writeInt(mode);
3210 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3211 reply.readException();
3212 data.recycle();
3213 reply.recycle();
3214 }
3215 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3216 int mode) throws RemoteException {
3217 Parcel data = Parcel.obtain();
3218 Parcel reply = Parcel.obtain();
3219 data.writeInterfaceToken(IActivityManager.descriptor);
3220 data.writeStrongBinder(caller.asBinder());
3221 uri.writeToParcel(data, 0);
3222 data.writeInt(mode);
3223 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3224 reply.readException();
3225 data.recycle();
3226 reply.recycle();
3227 }
3228 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3229 throws RemoteException {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(who.asBinder());
3234 data.writeInt(waiting ? 1 : 0);
3235 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3236 reply.readException();
3237 data.recycle();
3238 reply.recycle();
3239 }
3240 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3245 reply.readException();
3246 outInfo.readFromParcel(reply);
3247 data.recycle();
3248 reply.recycle();
3249 }
3250 public void unhandledBack() throws RemoteException
3251 {
3252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3256 reply.readException();
3257 data.recycle();
3258 reply.recycle();
3259 }
3260 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3261 {
3262 Parcel data = Parcel.obtain();
3263 Parcel reply = Parcel.obtain();
3264 data.writeInterfaceToken(IActivityManager.descriptor);
3265 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3266 reply.readException();
3267 ParcelFileDescriptor pfd = null;
3268 if (reply.readInt() != 0) {
3269 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3270 }
3271 data.recycle();
3272 reply.recycle();
3273 return pfd;
3274 }
3275 public void goingToSleep() throws RemoteException
3276 {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3281 reply.readException();
3282 data.recycle();
3283 reply.recycle();
3284 }
3285 public void wakingUp() throws RemoteException
3286 {
3287 Parcel data = Parcel.obtain();
3288 Parcel reply = Parcel.obtain();
3289 data.writeInterfaceToken(IActivityManager.descriptor);
3290 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3291 reply.readException();
3292 data.recycle();
3293 reply.recycle();
3294 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003295 public void setLockScreenShown(boolean shown) throws RemoteException
3296 {
3297 Parcel data = Parcel.obtain();
3298 Parcel reply = Parcel.obtain();
3299 data.writeInterfaceToken(IActivityManager.descriptor);
3300 data.writeInt(shown ? 1 : 0);
3301 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3302 reply.readException();
3303 data.recycle();
3304 reply.recycle();
3305 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306 public void setDebugApp(
3307 String packageName, boolean waitForDebugger, boolean persistent)
3308 throws RemoteException
3309 {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeString(packageName);
3314 data.writeInt(waitForDebugger ? 1 : 0);
3315 data.writeInt(persistent ? 1 : 0);
3316 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 data.recycle();
3319 reply.recycle();
3320 }
3321 public void setAlwaysFinish(boolean enabled) throws RemoteException
3322 {
3323 Parcel data = Parcel.obtain();
3324 Parcel reply = Parcel.obtain();
3325 data.writeInterfaceToken(IActivityManager.descriptor);
3326 data.writeInt(enabled ? 1 : 0);
3327 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3328 reply.readException();
3329 data.recycle();
3330 reply.recycle();
3331 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003332 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003338 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003339 reply.readException();
3340 data.recycle();
3341 reply.recycle();
3342 }
3343 public void enterSafeMode() throws RemoteException {
3344 Parcel data = Parcel.obtain();
3345 data.writeInterfaceToken(IActivityManager.descriptor);
3346 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3347 data.recycle();
3348 }
3349 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3350 Parcel data = Parcel.obtain();
3351 data.writeStrongBinder(sender.asBinder());
3352 data.writeInterfaceToken(IActivityManager.descriptor);
3353 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3354 data.recycle();
3355 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003356 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003357 Parcel data = Parcel.obtain();
3358 Parcel reply = Parcel.obtain();
3359 data.writeInterfaceToken(IActivityManager.descriptor);
3360 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003361 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003362 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003363 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003364 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003365 boolean res = reply.readInt() != 0;
3366 data.recycle();
3367 reply.recycle();
3368 return res;
3369 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003370 @Override
3371 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3372 Parcel data = Parcel.obtain();
3373 Parcel reply = Parcel.obtain();
3374 data.writeInterfaceToken(IActivityManager.descriptor);
3375 data.writeString(reason);
3376 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3377 boolean res = reply.readInt() != 0;
3378 data.recycle();
3379 reply.recycle();
3380 return res;
3381 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003382 public void startRunning(String pkg, String cls, String action,
3383 String indata) throws RemoteException {
3384 Parcel data = Parcel.obtain();
3385 Parcel reply = Parcel.obtain();
3386 data.writeInterfaceToken(IActivityManager.descriptor);
3387 data.writeString(pkg);
3388 data.writeString(cls);
3389 data.writeString(action);
3390 data.writeString(indata);
3391 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3392 reply.readException();
3393 data.recycle();
3394 reply.recycle();
3395 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003396 public boolean testIsSystemReady()
3397 {
3398 /* this base class version is never called */
3399 return true;
3400 }
Dan Egnor60d87622009-12-16 16:32:58 -08003401 public void handleApplicationCrash(IBinder app,
3402 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3403 {
3404 Parcel data = Parcel.obtain();
3405 Parcel reply = Parcel.obtain();
3406 data.writeInterfaceToken(IActivityManager.descriptor);
3407 data.writeStrongBinder(app);
3408 crashInfo.writeToParcel(data, 0);
3409 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 reply.recycle();
3412 data.recycle();
3413 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003414
Dan Egnor60d87622009-12-16 16:32:58 -08003415 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003416 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003417 {
3418 Parcel data = Parcel.obtain();
3419 Parcel reply = Parcel.obtain();
3420 data.writeInterfaceToken(IActivityManager.descriptor);
3421 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003422 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003423 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003424 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003425 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003426 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003427 reply.recycle();
3428 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003429 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003430 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003431
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003432 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003433 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003434 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003435 {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003440 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003441 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003442 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3443 reply.readException();
3444 reply.recycle();
3445 data.recycle();
3446 }
3447
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003448 public void signalPersistentProcesses(int sig) throws RemoteException {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
3452 data.writeInt(sig);
3453 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3454 reply.readException();
3455 data.recycle();
3456 reply.recycle();
3457 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003458
Dianne Hackborn1676c852012-09-10 14:52:30 -07003459 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 Parcel data = Parcel.obtain();
3461 Parcel reply = Parcel.obtain();
3462 data.writeInterfaceToken(IActivityManager.descriptor);
3463 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003464 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003465 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3466 reply.readException();
3467 data.recycle();
3468 reply.recycle();
3469 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003470
3471 public void killAllBackgroundProcesses() throws RemoteException {
3472 Parcel data = Parcel.obtain();
3473 Parcel reply = Parcel.obtain();
3474 data.writeInterfaceToken(IActivityManager.descriptor);
3475 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3476 reply.readException();
3477 data.recycle();
3478 reply.recycle();
3479 }
3480
Dianne Hackborn1676c852012-09-10 14:52:30 -07003481 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003482 Parcel data = Parcel.obtain();
3483 Parcel reply = Parcel.obtain();
3484 data.writeInterfaceToken(IActivityManager.descriptor);
3485 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003486 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003487 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003488 reply.readException();
3489 data.recycle();
3490 reply.recycle();
3491 }
3492
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003493 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3494 throws RemoteException
3495 {
3496 Parcel data = Parcel.obtain();
3497 Parcel reply = Parcel.obtain();
3498 data.writeInterfaceToken(IActivityManager.descriptor);
3499 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3500 reply.readException();
3501 outInfo.readFromParcel(reply);
3502 reply.recycle();
3503 data.recycle();
3504 }
3505
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003506 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3507 {
3508 Parcel data = Parcel.obtain();
3509 Parcel reply = Parcel.obtain();
3510 data.writeInterfaceToken(IActivityManager.descriptor);
3511 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3514 reply.recycle();
3515 data.recycle();
3516 return res;
3517 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003518
Dianne Hackborn1676c852012-09-10 14:52:30 -07003519 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003520 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003521 {
3522 Parcel data = Parcel.obtain();
3523 Parcel reply = Parcel.obtain();
3524 data.writeInterfaceToken(IActivityManager.descriptor);
3525 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003526 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003527 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003528 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003529 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003530 if (fd != null) {
3531 data.writeInt(1);
3532 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3533 } else {
3534 data.writeInt(0);
3535 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003536 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3537 reply.readException();
3538 boolean res = reply.readInt() != 0;
3539 reply.recycle();
3540 data.recycle();
3541 return res;
3542 }
3543
Dianne Hackborn55280a92009-05-07 15:53:46 -07003544 public boolean shutdown(int timeout) throws RemoteException
3545 {
3546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 data.writeInt(timeout);
3550 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3551 reply.readException();
3552 boolean res = reply.readInt() != 0;
3553 reply.recycle();
3554 data.recycle();
3555 return res;
3556 }
3557
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003558 public void stopAppSwitches() throws RemoteException {
3559 Parcel data = Parcel.obtain();
3560 Parcel reply = Parcel.obtain();
3561 data.writeInterfaceToken(IActivityManager.descriptor);
3562 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3563 reply.readException();
3564 reply.recycle();
3565 data.recycle();
3566 }
3567
3568 public void resumeAppSwitches() throws RemoteException {
3569 Parcel data = Parcel.obtain();
3570 Parcel reply = Parcel.obtain();
3571 data.writeInterfaceToken(IActivityManager.descriptor);
3572 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3573 reply.readException();
3574 reply.recycle();
3575 data.recycle();
3576 }
3577
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003578 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003579 Parcel data = Parcel.obtain();
3580 Parcel reply = Parcel.obtain();
3581 data.writeInterfaceToken(IActivityManager.descriptor);
3582 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003583 data.writeInt(appid);
3584 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003585 reply.readException();
3586 data.recycle();
3587 reply.recycle();
3588 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003589
3590 public void closeSystemDialogs(String reason) throws RemoteException {
3591 Parcel data = Parcel.obtain();
3592 Parcel reply = Parcel.obtain();
3593 data.writeInterfaceToken(IActivityManager.descriptor);
3594 data.writeString(reason);
3595 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3596 reply.readException();
3597 data.recycle();
3598 reply.recycle();
3599 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003600
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003601 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003602 throws RemoteException {
3603 Parcel data = Parcel.obtain();
3604 Parcel reply = Parcel.obtain();
3605 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003606 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003607 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3608 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003609 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003610 data.recycle();
3611 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003612 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003613 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003614
3615 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3616 Parcel data = Parcel.obtain();
3617 Parcel reply = Parcel.obtain();
3618 data.writeInterfaceToken(IActivityManager.descriptor);
3619 data.writeString(processName);
3620 data.writeInt(uid);
3621 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3622 reply.readException();
3623 data.recycle();
3624 reply.recycle();
3625 }
3626
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003627 public void overridePendingTransition(IBinder token, String packageName,
3628 int enterAnim, int exitAnim) throws RemoteException {
3629 Parcel data = Parcel.obtain();
3630 Parcel reply = Parcel.obtain();
3631 data.writeInterfaceToken(IActivityManager.descriptor);
3632 data.writeStrongBinder(token);
3633 data.writeString(packageName);
3634 data.writeInt(enterAnim);
3635 data.writeInt(exitAnim);
3636 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3637 reply.readException();
3638 data.recycle();
3639 reply.recycle();
3640 }
3641
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003642 public boolean isUserAMonkey() throws RemoteException {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 boolean res = reply.readInt() != 0;
3649 data.recycle();
3650 reply.recycle();
3651 return res;
3652 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003653
3654 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3655 Parcel data = Parcel.obtain();
3656 Parcel reply = Parcel.obtain();
3657 data.writeInterfaceToken(IActivityManager.descriptor);
3658 data.writeInt(monkey ? 1 : 0);
3659 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3660 reply.readException();
3661 data.recycle();
3662 reply.recycle();
3663 }
3664
Dianne Hackborn860755f2010-06-03 18:47:52 -07003665 public void finishHeavyWeightApp() throws RemoteException {
3666 Parcel data = Parcel.obtain();
3667 Parcel reply = Parcel.obtain();
3668 data.writeInterfaceToken(IActivityManager.descriptor);
3669 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3670 reply.readException();
3671 data.recycle();
3672 reply.recycle();
3673 }
3674
Daniel Sandler69a48172010-06-23 16:29:36 -04003675 public void setImmersive(IBinder token, boolean immersive)
3676 throws RemoteException {
3677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 data.writeStrongBinder(token);
3681 data.writeInt(immersive ? 1 : 0);
3682 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3683 reply.readException();
3684 data.recycle();
3685 reply.recycle();
3686 }
3687
3688 public boolean isImmersive(IBinder token)
3689 throws RemoteException {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 data.writeStrongBinder(token);
3694 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003695 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003696 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003697 data.recycle();
3698 reply.recycle();
3699 return res;
3700 }
3701
3702 public boolean isTopActivityImmersive()
3703 throws RemoteException {
3704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003708 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003709 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003710 data.recycle();
3711 reply.recycle();
3712 return res;
3713 }
3714
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003715 public void crashApplication(int uid, int initialPid, String packageName,
3716 String message) throws RemoteException {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 data.writeInt(uid);
3721 data.writeInt(initialPid);
3722 data.writeString(packageName);
3723 data.writeString(message);
3724 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3725 reply.readException();
3726 data.recycle();
3727 reply.recycle();
3728 }
Andy McFadden824c5102010-07-09 16:26:57 -07003729
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003730 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003731 Parcel data = Parcel.obtain();
3732 Parcel reply = Parcel.obtain();
3733 data.writeInterfaceToken(IActivityManager.descriptor);
3734 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003735 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003736 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3737 reply.readException();
3738 String res = reply.readString();
3739 data.recycle();
3740 reply.recycle();
3741 return res;
3742 }
3743
Dianne Hackborn7e269642010-08-25 19:50:20 -07003744 public IBinder newUriPermissionOwner(String name)
3745 throws RemoteException {
3746 Parcel data = Parcel.obtain();
3747 Parcel reply = Parcel.obtain();
3748 data.writeInterfaceToken(IActivityManager.descriptor);
3749 data.writeString(name);
3750 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 IBinder res = reply.readStrongBinder();
3753 data.recycle();
3754 reply.recycle();
3755 return res;
3756 }
3757
3758 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3759 Uri uri, int mode) throws RemoteException {
3760 Parcel data = Parcel.obtain();
3761 Parcel reply = Parcel.obtain();
3762 data.writeInterfaceToken(IActivityManager.descriptor);
3763 data.writeStrongBinder(owner);
3764 data.writeInt(fromUid);
3765 data.writeString(targetPkg);
3766 uri.writeToParcel(data, 0);
3767 data.writeInt(mode);
3768 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 data.recycle();
3771 reply.recycle();
3772 }
3773
3774 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3775 int mode) throws RemoteException {
3776 Parcel data = Parcel.obtain();
3777 Parcel reply = Parcel.obtain();
3778 data.writeInterfaceToken(IActivityManager.descriptor);
3779 data.writeStrongBinder(owner);
3780 if (uri != null) {
3781 data.writeInt(1);
3782 uri.writeToParcel(data, 0);
3783 } else {
3784 data.writeInt(0);
3785 }
3786 data.writeInt(mode);
3787 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3788 reply.readException();
3789 data.recycle();
3790 reply.recycle();
3791 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003792
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003793 public int checkGrantUriPermission(int callingUid, String targetPkg,
3794 Uri uri, int modeFlags) throws RemoteException {
3795 Parcel data = Parcel.obtain();
3796 Parcel reply = Parcel.obtain();
3797 data.writeInterfaceToken(IActivityManager.descriptor);
3798 data.writeInt(callingUid);
3799 data.writeString(targetPkg);
3800 uri.writeToParcel(data, 0);
3801 data.writeInt(modeFlags);
3802 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3803 reply.readException();
3804 int res = reply.readInt();
3805 data.recycle();
3806 reply.recycle();
3807 return res;
3808 }
3809
Dianne Hackborn1676c852012-09-10 14:52:30 -07003810 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003811 String path, ParcelFileDescriptor fd) throws RemoteException {
3812 Parcel data = Parcel.obtain();
3813 Parcel reply = Parcel.obtain();
3814 data.writeInterfaceToken(IActivityManager.descriptor);
3815 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003816 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003817 data.writeInt(managed ? 1 : 0);
3818 data.writeString(path);
3819 if (fd != null) {
3820 data.writeInt(1);
3821 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3822 } else {
3823 data.writeInt(0);
3824 }
3825 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3826 reply.readException();
3827 boolean res = reply.readInt() != 0;
3828 reply.recycle();
3829 data.recycle();
3830 return res;
3831 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003832
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003833 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003834 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003835 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
3839 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003840 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003841 data.writeTypedArray(intents, 0);
3842 data.writeStringArray(resolvedTypes);
3843 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003844 if (options != null) {
3845 data.writeInt(1);
3846 options.writeToParcel(data, 0);
3847 } else {
3848 data.writeInt(0);
3849 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003850 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003851 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3852 reply.readException();
3853 int result = reply.readInt();
3854 reply.recycle();
3855 data.recycle();
3856 return result;
3857 }
3858
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003859 public int getFrontActivityScreenCompatMode() throws RemoteException {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3864 reply.readException();
3865 int mode = reply.readInt();
3866 reply.recycle();
3867 data.recycle();
3868 return mode;
3869 }
3870
3871 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3872 Parcel data = Parcel.obtain();
3873 Parcel reply = Parcel.obtain();
3874 data.writeInterfaceToken(IActivityManager.descriptor);
3875 data.writeInt(mode);
3876 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3877 reply.readException();
3878 reply.recycle();
3879 data.recycle();
3880 }
3881
3882 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3883 Parcel data = Parcel.obtain();
3884 Parcel reply = Parcel.obtain();
3885 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003886 data.writeString(packageName);
3887 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003888 reply.readException();
3889 int mode = reply.readInt();
3890 reply.recycle();
3891 data.recycle();
3892 return mode;
3893 }
3894
3895 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003896 throws RemoteException {
3897 Parcel data = Parcel.obtain();
3898 Parcel reply = Parcel.obtain();
3899 data.writeInterfaceToken(IActivityManager.descriptor);
3900 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003901 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003902 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3903 reply.readException();
3904 reply.recycle();
3905 data.recycle();
3906 }
3907
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003908 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3909 Parcel data = Parcel.obtain();
3910 Parcel reply = Parcel.obtain();
3911 data.writeInterfaceToken(IActivityManager.descriptor);
3912 data.writeString(packageName);
3913 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3914 reply.readException();
3915 boolean ask = reply.readInt() != 0;
3916 reply.recycle();
3917 data.recycle();
3918 return ask;
3919 }
3920
3921 public void setPackageAskScreenCompat(String packageName, boolean ask)
3922 throws RemoteException {
3923 Parcel data = Parcel.obtain();
3924 Parcel reply = Parcel.obtain();
3925 data.writeInterfaceToken(IActivityManager.descriptor);
3926 data.writeString(packageName);
3927 data.writeInt(ask ? 1 : 0);
3928 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3929 reply.readException();
3930 reply.recycle();
3931 data.recycle();
3932 }
3933
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003934 public boolean switchUser(int userid) throws RemoteException {
3935 Parcel data = Parcel.obtain();
3936 Parcel reply = Parcel.obtain();
3937 data.writeInterfaceToken(IActivityManager.descriptor);
3938 data.writeInt(userid);
3939 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3940 reply.readException();
3941 boolean result = reply.readInt() != 0;
3942 reply.recycle();
3943 data.recycle();
3944 return result;
3945 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003946
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003947 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3948 Parcel data = Parcel.obtain();
3949 Parcel reply = Parcel.obtain();
3950 data.writeInterfaceToken(IActivityManager.descriptor);
3951 data.writeInt(userid);
3952 data.writeStrongInterface(callback);
3953 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 int result = reply.readInt();
3956 reply.recycle();
3957 data.recycle();
3958 return result;
3959 }
3960
Amith Yamasani52f1d752012-03-28 18:19:29 -07003961 public UserInfo getCurrentUser() throws RemoteException {
3962 Parcel data = Parcel.obtain();
3963 Parcel reply = Parcel.obtain();
3964 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003965 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003966 reply.readException();
3967 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3968 reply.recycle();
3969 data.recycle();
3970 return userInfo;
3971 }
3972
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003973 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003974 Parcel data = Parcel.obtain();
3975 Parcel reply = Parcel.obtain();
3976 data.writeInterfaceToken(IActivityManager.descriptor);
3977 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003978 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003979 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3980 reply.readException();
3981 boolean result = reply.readInt() != 0;
3982 reply.recycle();
3983 data.recycle();
3984 return result;
3985 }
3986
Dianne Hackbornc72fc672012-09-20 13:12:03 -07003987 public int[] getRunningUserIds() throws RemoteException {
3988 Parcel data = Parcel.obtain();
3989 Parcel reply = Parcel.obtain();
3990 data.writeInterfaceToken(IActivityManager.descriptor);
3991 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
3992 reply.readException();
3993 int[] result = reply.createIntArray();
3994 reply.recycle();
3995 data.recycle();
3996 return result;
3997 }
3998
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003999 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4000 Parcel data = Parcel.obtain();
4001 Parcel reply = Parcel.obtain();
4002 data.writeInterfaceToken(IActivityManager.descriptor);
4003 data.writeInt(taskId);
4004 data.writeInt(subTaskIndex);
4005 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4006 reply.readException();
4007 boolean result = reply.readInt() != 0;
4008 reply.recycle();
4009 data.recycle();
4010 return result;
4011 }
4012
4013 public boolean removeTask(int taskId, int flags) throws RemoteException {
4014 Parcel data = Parcel.obtain();
4015 Parcel reply = Parcel.obtain();
4016 data.writeInterfaceToken(IActivityManager.descriptor);
4017 data.writeInt(taskId);
4018 data.writeInt(flags);
4019 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4020 reply.readException();
4021 boolean result = reply.readInt() != 0;
4022 reply.recycle();
4023 data.recycle();
4024 return result;
4025 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004026
Jeff Sharkeya4620792011-05-20 15:29:23 -07004027 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4028 Parcel data = Parcel.obtain();
4029 Parcel reply = Parcel.obtain();
4030 data.writeInterfaceToken(IActivityManager.descriptor);
4031 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4032 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4033 reply.readException();
4034 data.recycle();
4035 reply.recycle();
4036 }
4037
4038 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4039 Parcel data = Parcel.obtain();
4040 Parcel reply = Parcel.obtain();
4041 data.writeInterfaceToken(IActivityManager.descriptor);
4042 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4043 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4044 reply.readException();
4045 data.recycle();
4046 reply.recycle();
4047 }
4048
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004049 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4050 Parcel data = Parcel.obtain();
4051 Parcel reply = Parcel.obtain();
4052 data.writeInterfaceToken(IActivityManager.descriptor);
4053 data.writeStrongBinder(sender.asBinder());
4054 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4055 reply.readException();
4056 boolean res = reply.readInt() != 0;
4057 data.recycle();
4058 reply.recycle();
4059 return res;
4060 }
4061
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004062 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4063 Parcel data = Parcel.obtain();
4064 Parcel reply = Parcel.obtain();
4065 data.writeInterfaceToken(IActivityManager.descriptor);
4066 data.writeStrongBinder(sender.asBinder());
4067 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4068 reply.readException();
4069 boolean res = reply.readInt() != 0;
4070 data.recycle();
4071 reply.recycle();
4072 return res;
4073 }
4074
Dianne Hackborn81038902012-11-26 17:04:09 -08004075 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4076 Parcel data = Parcel.obtain();
4077 Parcel reply = Parcel.obtain();
4078 data.writeInterfaceToken(IActivityManager.descriptor);
4079 data.writeStrongBinder(sender.asBinder());
4080 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4081 reply.readException();
4082 Intent res = reply.readInt() != 0
4083 ? Intent.CREATOR.createFromParcel(reply) : null;
4084 data.recycle();
4085 reply.recycle();
4086 return res;
4087 }
4088
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004089 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4090 {
4091 Parcel data = Parcel.obtain();
4092 Parcel reply = Parcel.obtain();
4093 data.writeInterfaceToken(IActivityManager.descriptor);
4094 values.writeToParcel(data, 0);
4095 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4096 reply.readException();
4097 data.recycle();
4098 reply.recycle();
4099 }
4100
Dianne Hackbornb437e092011-08-05 17:50:29 -07004101 public long[] getProcessPss(int[] pids) throws RemoteException {
4102 Parcel data = Parcel.obtain();
4103 Parcel reply = Parcel.obtain();
4104 data.writeInterfaceToken(IActivityManager.descriptor);
4105 data.writeIntArray(pids);
4106 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4107 reply.readException();
4108 long[] res = reply.createLongArray();
4109 data.recycle();
4110 reply.recycle();
4111 return res;
4112 }
4113
Dianne Hackborn661cd522011-08-22 00:26:20 -07004114 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4115 Parcel data = Parcel.obtain();
4116 Parcel reply = Parcel.obtain();
4117 data.writeInterfaceToken(IActivityManager.descriptor);
4118 TextUtils.writeToParcel(msg, data, 0);
4119 data.writeInt(always ? 1 : 0);
4120 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4121 reply.readException();
4122 data.recycle();
4123 reply.recycle();
4124 }
4125
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004126 public void dismissKeyguardOnNextActivity() throws RemoteException {
4127 Parcel data = Parcel.obtain();
4128 Parcel reply = Parcel.obtain();
4129 data.writeInterfaceToken(IActivityManager.descriptor);
4130 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4131 reply.readException();
4132 data.recycle();
4133 reply.recycle();
4134 }
4135
Adam Powelldd8fab22012-03-22 17:47:27 -07004136 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4137 throws RemoteException {
4138 Parcel data = Parcel.obtain();
4139 Parcel reply = Parcel.obtain();
4140 data.writeInterfaceToken(IActivityManager.descriptor);
4141 data.writeStrongBinder(token);
4142 data.writeString(destAffinity);
4143 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 boolean result = reply.readInt() != 0;
4146 data.recycle();
4147 reply.recycle();
4148 return result;
4149 }
4150
4151 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4152 throws RemoteException {
4153 Parcel data = Parcel.obtain();
4154 Parcel reply = Parcel.obtain();
4155 data.writeInterfaceToken(IActivityManager.descriptor);
4156 data.writeStrongBinder(token);
4157 target.writeToParcel(data, 0);
4158 data.writeInt(resultCode);
4159 if (resultData != null) {
4160 data.writeInt(1);
4161 resultData.writeToParcel(data, 0);
4162 } else {
4163 data.writeInt(0);
4164 }
4165 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4166 reply.readException();
4167 boolean result = reply.readInt() != 0;
4168 data.recycle();
4169 reply.recycle();
4170 return result;
4171 }
4172
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004173 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4174 Parcel data = Parcel.obtain();
4175 Parcel reply = Parcel.obtain();
4176 data.writeInterfaceToken(IActivityManager.descriptor);
4177 data.writeStrongBinder(activityToken);
4178 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4179 reply.readException();
4180 int result = reply.readInt();
4181 data.recycle();
4182 reply.recycle();
4183 return result;
4184 }
4185
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004186 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4187 Parcel data = Parcel.obtain();
4188 Parcel reply = Parcel.obtain();
4189 data.writeInterfaceToken(IActivityManager.descriptor);
4190 data.writeStrongBinder(activityToken);
4191 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4192 reply.readException();
4193 String result = reply.readString();
4194 data.recycle();
4195 reply.recycle();
4196 return result;
4197 }
4198
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004199 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4200 Parcel data = Parcel.obtain();
4201 Parcel reply = Parcel.obtain();
4202 data.writeInterfaceToken(IActivityManager.descriptor);
4203 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4204 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4205 reply.readException();
4206 data.recycle();
4207 reply.recycle();
4208 }
4209
4210 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4211 Parcel data = Parcel.obtain();
4212 Parcel reply = Parcel.obtain();
4213 data.writeInterfaceToken(IActivityManager.descriptor);
4214 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4215 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4216 reply.readException();
4217 data.recycle();
4218 reply.recycle();
4219 }
4220
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004221 public void requestBugReport() throws RemoteException {
4222 Parcel data = Parcel.obtain();
4223 Parcel reply = Parcel.obtain();
4224 data.writeInterfaceToken(IActivityManager.descriptor);
4225 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4226 reply.readException();
4227 data.recycle();
4228 reply.recycle();
4229 }
4230
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004231 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 data.writeInt(pid);
4236 data.writeInt(aboveSystem ? 1 : 0);
4237 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4238 reply.readException();
4239 long res = reply.readInt();
4240 data.recycle();
4241 reply.recycle();
4242 return res;
4243 }
4244
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004245 public Bundle getTopActivityExtras(int requestType) throws RemoteException {
4246 Parcel data = Parcel.obtain();
4247 Parcel reply = Parcel.obtain();
4248 data.writeInterfaceToken(IActivityManager.descriptor);
4249 data.writeInt(requestType);
4250 mRemote.transact(GET_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4251 reply.readException();
4252 Bundle res = reply.readBundle();
4253 data.recycle();
4254 reply.recycle();
4255 return res;
4256 }
4257
4258 public void reportTopActivityExtras(IBinder token, Bundle extras) throws RemoteException {
4259 Parcel data = Parcel.obtain();
4260 Parcel reply = Parcel.obtain();
4261 data.writeInterfaceToken(IActivityManager.descriptor);
4262 data.writeStrongBinder(token);
4263 data.writeBundle(extras);
4264 mRemote.transact(REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4265 reply.readException();
4266 data.recycle();
4267 reply.recycle();
4268 }
4269
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004270 public void killUid(int uid, String reason) throws RemoteException {
4271 Parcel data = Parcel.obtain();
4272 Parcel reply = Parcel.obtain();
4273 data.writeInterfaceToken(IActivityManager.descriptor);
4274 data.writeInt(uid);
4275 data.writeString(reason);
4276 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4277 reply.readException();
4278 data.recycle();
4279 reply.recycle();
4280 }
4281
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004282 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4283 Parcel data = Parcel.obtain();
4284 Parcel reply = Parcel.obtain();
4285 data.writeInterfaceToken(IActivityManager.descriptor);
4286 data.writeStrongBinder(who);
4287 data.writeInt(allowRestart ? 1 : 0);
4288 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4289 reply.readException();
4290 data.recycle();
4291 reply.recycle();
4292 }
4293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004294 private IBinder mRemote;
4295}