blob: b089e2ae231413f89a3f3ac48f80588eb98e7fa0 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070020import android.content.IIntentReceiver;
21import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Intent;
23import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070028import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.res.Configuration;
30import android.graphics.Bitmap;
31import android.net.Uri;
32import android.os.Binder;
33import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070034import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.os.IBinder;
36import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070037import android.os.ParcelFileDescriptor;
38import android.os.Parcelable;
39import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070041import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080044import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import java.util.ArrayList;
47import java.util.List;
48
49/** {@hide} */
50public abstract class ActivityManagerNative extends Binder implements IActivityManager
51{
52 /**
53 * Cast a Binder object into an activity manager interface, generating
54 * a proxy if needed.
55 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080056 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 if (obj == null) {
58 return null;
59 }
60 IActivityManager in =
61 (IActivityManager)obj.queryLocalInterface(descriptor);
62 if (in != null) {
63 return in;
64 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 return new ActivityManagerProxy(obj);
67 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 /**
70 * Retrieve the system's default/global activity manager.
71 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072 static public IActivityManager getDefault() {
73 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 }
75
76 /**
77 * Convenience for checking whether the system is ready. For internal use only.
78 */
79 static public boolean isSystemReady() {
80 if (!sSystemReady) {
81 sSystemReady = getDefault().testIsSystemReady();
82 }
83 return sSystemReady;
84 }
85 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 /**
88 * Convenience for sending a sticky broadcast. For internal use only.
89 * If you don't care about permission, use null.
90 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070091 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 try {
93 getDefault().broadcastIntent(
94 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -080095 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 } catch (RemoteException ex) {
97 }
98 }
99
100 static public void noteWakeupAlarm(PendingIntent ps) {
101 try {
102 getDefault().noteWakeupAlarm(ps.getTarget());
103 } catch (RemoteException ex) {
104 }
105 }
106
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800107 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 attachInterface(this, descriptor);
109 }
110
111 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
112 throws RemoteException {
113 switch (code) {
114 case START_ACTIVITY_TRANSACTION:
115 {
116 data.enforceInterface(IActivityManager.descriptor);
117 IBinder b = data.readStrongBinder();
118 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800119 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 Intent intent = Intent.CREATOR.createFromParcel(data);
121 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800123 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700125 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700126 String profileFile = data.readString();
127 ParcelFileDescriptor profileFd = data.readInt() != 0
128 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700129 Bundle options = data.readInt() != 0
130 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800131 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 resultTo, resultWho, requestCode, startFlags,
133 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 reply.writeNoException();
135 reply.writeInt(result);
136 return true;
137 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700138
Amith Yamasani82644082012-08-03 13:09:11 -0700139 case START_ACTIVITY_AS_USER_TRANSACTION:
140 {
141 data.enforceInterface(IActivityManager.descriptor);
142 IBinder b = data.readStrongBinder();
143 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800144 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700145 Intent intent = Intent.CREATOR.createFromParcel(data);
146 String resolvedType = data.readString();
147 IBinder resultTo = data.readStrongBinder();
148 String resultWho = data.readString();
149 int requestCode = data.readInt();
150 int startFlags = data.readInt();
151 String profileFile = data.readString();
152 ParcelFileDescriptor profileFd = data.readInt() != 0
153 ? data.readFileDescriptor() : null;
154 Bundle options = data.readInt() != 0
155 ? Bundle.CREATOR.createFromParcel(data) : null;
156 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800157 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700158 resultTo, resultWho, requestCode, startFlags,
159 profileFile, profileFd, options, userId);
160 reply.writeNoException();
161 reply.writeInt(result);
162 return true;
163 }
164
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800165 case START_ACTIVITY_AND_WAIT_TRANSACTION:
166 {
167 data.enforceInterface(IActivityManager.descriptor);
168 IBinder b = data.readStrongBinder();
169 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800170 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800171 Intent intent = Intent.CREATOR.createFromParcel(data);
172 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800174 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800175 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700176 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700177 String profileFile = data.readString();
178 ParcelFileDescriptor profileFd = data.readInt() != 0
179 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700180 Bundle options = data.readInt() != 0
181 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700182 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800183 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700185 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800186 reply.writeNoException();
187 result.writeToParcel(reply, 0);
188 return true;
189 }
190
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700191 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
192 {
193 data.enforceInterface(IActivityManager.descriptor);
194 IBinder b = data.readStrongBinder();
195 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800196 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700197 Intent intent = Intent.CREATOR.createFromParcel(data);
198 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 IBinder resultTo = data.readStrongBinder();
200 String resultWho = data.readString();
201 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700202 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700204 Bundle options = data.readInt() != 0
205 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700206 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800207 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700208 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700209 reply.writeNoException();
210 reply.writeInt(result);
211 return true;
212 }
213
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700214 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700215 {
216 data.enforceInterface(IActivityManager.descriptor);
217 IBinder b = data.readStrongBinder();
218 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700219 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700220 Intent fillInIntent = null;
221 if (data.readInt() != 0) {
222 fillInIntent = Intent.CREATOR.createFromParcel(data);
223 }
224 String resolvedType = data.readString();
225 IBinder resultTo = data.readStrongBinder();
226 String resultWho = data.readString();
227 int requestCode = data.readInt();
228 int flagsMask = data.readInt();
229 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 Bundle options = data.readInt() != 0
231 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700232 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700233 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 reply.writeNoException();
236 reply.writeInt(result);
237 return true;
238 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239
240 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
241 {
242 data.enforceInterface(IActivityManager.descriptor);
243 IBinder callingActivity = data.readStrongBinder();
244 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700245 Bundle options = data.readInt() != 0
246 ? Bundle.CREATOR.createFromParcel(data) : null;
247 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 reply.writeNoException();
249 reply.writeInt(result ? 1 : 0);
250 return true;
251 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 case FINISH_ACTIVITY_TRANSACTION: {
254 data.enforceInterface(IActivityManager.descriptor);
255 IBinder token = data.readStrongBinder();
256 Intent resultData = null;
257 int resultCode = data.readInt();
258 if (data.readInt() != 0) {
259 resultData = Intent.CREATOR.createFromParcel(data);
260 }
261 boolean res = finishActivity(token, resultCode, resultData);
262 reply.writeNoException();
263 reply.writeInt(res ? 1 : 0);
264 return true;
265 }
266
267 case FINISH_SUB_ACTIVITY_TRANSACTION: {
268 data.enforceInterface(IActivityManager.descriptor);
269 IBinder token = data.readStrongBinder();
270 String resultWho = data.readString();
271 int requestCode = data.readInt();
272 finishSubActivity(token, resultWho, requestCode);
273 reply.writeNoException();
274 return true;
275 }
276
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700277 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
278 data.enforceInterface(IActivityManager.descriptor);
279 IBinder token = data.readStrongBinder();
280 boolean res = finishActivityAffinity(token);
281 reply.writeNoException();
282 reply.writeInt(res ? 1 : 0);
283 return true;
284 }
285
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800286 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
287 data.enforceInterface(IActivityManager.descriptor);
288 IBinder token = data.readStrongBinder();
289 boolean res = willActivityBeVisible(token);
290 reply.writeNoException();
291 reply.writeInt(res ? 1 : 0);
292 return true;
293 }
294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 case REGISTER_RECEIVER_TRANSACTION:
296 {
297 data.enforceInterface(IActivityManager.descriptor);
298 IBinder b = data.readStrongBinder();
299 IApplicationThread app =
300 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700301 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800302 b = data.readStrongBinder();
303 IIntentReceiver rec
304 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
305 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
306 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700307 int userId = data.readInt();
308 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800309 reply.writeNoException();
310 if (intent != null) {
311 reply.writeInt(1);
312 intent.writeToParcel(reply, 0);
313 } else {
314 reply.writeInt(0);
315 }
316 return true;
317 }
318
319 case UNREGISTER_RECEIVER_TRANSACTION:
320 {
321 data.enforceInterface(IActivityManager.descriptor);
322 IBinder b = data.readStrongBinder();
323 if (b == null) {
324 return true;
325 }
326 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
327 unregisterReceiver(rec);
328 reply.writeNoException();
329 return true;
330 }
331
332 case BROADCAST_INTENT_TRANSACTION:
333 {
334 data.enforceInterface(IActivityManager.descriptor);
335 IBinder b = data.readStrongBinder();
336 IApplicationThread app =
337 b != null ? ApplicationThreadNative.asInterface(b) : null;
338 Intent intent = Intent.CREATOR.createFromParcel(data);
339 String resolvedType = data.readString();
340 b = data.readStrongBinder();
341 IIntentReceiver resultTo =
342 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
343 int resultCode = data.readInt();
344 String resultData = data.readString();
345 Bundle resultExtras = data.readBundle();
346 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800347 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 boolean serialized = data.readInt() != 0;
349 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700350 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800352 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700353 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res);
356 return true;
357 }
358
359 case UNBROADCAST_INTENT_TRANSACTION:
360 {
361 data.enforceInterface(IActivityManager.descriptor);
362 IBinder b = data.readStrongBinder();
363 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
364 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700365 int userId = data.readInt();
366 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800367 reply.writeNoException();
368 return true;
369 }
370
371 case FINISH_RECEIVER_TRANSACTION: {
372 data.enforceInterface(IActivityManager.descriptor);
373 IBinder who = data.readStrongBinder();
374 int resultCode = data.readInt();
375 String resultData = data.readString();
376 Bundle resultExtras = data.readBundle();
377 boolean resultAbort = data.readInt() != 0;
378 if (who != null) {
379 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
380 }
381 reply.writeNoException();
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case ATTACH_APPLICATION_TRANSACTION: {
386 data.enforceInterface(IActivityManager.descriptor);
387 IApplicationThread app = ApplicationThreadNative.asInterface(
388 data.readStrongBinder());
389 if (app != null) {
390 attachApplication(app);
391 }
392 reply.writeNoException();
393 return true;
394 }
395
396 case ACTIVITY_IDLE_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700399 Configuration config = null;
400 if (data.readInt() != 0) {
401 config = Configuration.CREATOR.createFromParcel(data);
402 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700403 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800404 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700405 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 }
407 reply.writeNoException();
408 return true;
409 }
410
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700411 case ACTIVITY_RESUMED_TRANSACTION: {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder token = data.readStrongBinder();
414 activityResumed(token);
415 reply.writeNoException();
416 return true;
417 }
418
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 case ACTIVITY_PAUSED_TRANSACTION: {
420 data.enforceInterface(IActivityManager.descriptor);
421 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800422 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 reply.writeNoException();
424 return true;
425 }
426
427 case ACTIVITY_STOPPED_TRANSACTION: {
428 data.enforceInterface(IActivityManager.descriptor);
429 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800430 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 Bitmap thumbnail = data.readInt() != 0
432 ? Bitmap.CREATOR.createFromParcel(data) : null;
433 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800434 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800435 reply.writeNoException();
436 return true;
437 }
438
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800439 case ACTIVITY_SLEPT_TRANSACTION: {
440 data.enforceInterface(IActivityManager.descriptor);
441 IBinder token = data.readStrongBinder();
442 activitySlept(token);
443 reply.writeNoException();
444 return true;
445 }
446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 case ACTIVITY_DESTROYED_TRANSACTION: {
448 data.enforceInterface(IActivityManager.descriptor);
449 IBinder token = data.readStrongBinder();
450 activityDestroyed(token);
451 reply.writeNoException();
452 return true;
453 }
454
455 case GET_CALLING_PACKAGE_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
458 String res = token != null ? getCallingPackage(token) : null;
459 reply.writeNoException();
460 reply.writeString(res);
461 return true;
462 }
463
464 case GET_CALLING_ACTIVITY_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
467 ComponentName cn = getCallingActivity(token);
468 reply.writeNoException();
469 ComponentName.writeToParcel(cn, reply);
470 return true;
471 }
472
473 case GET_TASKS_TRANSACTION: {
474 data.enforceInterface(IActivityManager.descriptor);
475 int maxNum = data.readInt();
476 int fl = data.readInt();
477 IBinder receiverBinder = data.readStrongBinder();
478 IThumbnailReceiver receiver = receiverBinder != null
479 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
480 : null;
481 List list = getTasks(maxNum, fl, receiver);
482 reply.writeNoException();
483 int N = list != null ? list.size() : -1;
484 reply.writeInt(N);
485 int i;
486 for (i=0; i<N; i++) {
487 ActivityManager.RunningTaskInfo info =
488 (ActivityManager.RunningTaskInfo)list.get(i);
489 info.writeToParcel(reply, 0);
490 }
491 return true;
492 }
493
494 case GET_RECENT_TASKS_TRANSACTION: {
495 data.enforceInterface(IActivityManager.descriptor);
496 int maxNum = data.readInt();
497 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700498 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700500 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 reply.writeNoException();
502 reply.writeTypedList(list);
503 return true;
504 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700505
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700506 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800507 data.enforceInterface(IActivityManager.descriptor);
508 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700509 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800510 reply.writeNoException();
511 if (bm != null) {
512 reply.writeInt(1);
513 bm.writeToParcel(reply, 0);
514 } else {
515 reply.writeInt(0);
516 }
517 return true;
518 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700519
520 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
521 data.enforceInterface(IActivityManager.descriptor);
522 int id = data.readInt();
523 Bitmap bm = getTaskTopThumbnail(id);
524 reply.writeNoException();
525 if (bm != null) {
526 reply.writeInt(1);
527 bm.writeToParcel(reply, 0);
528 } else {
529 reply.writeInt(0);
530 }
531 return true;
532 }
533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 case GET_SERVICES_TRANSACTION: {
535 data.enforceInterface(IActivityManager.descriptor);
536 int maxNum = data.readInt();
537 int fl = data.readInt();
538 List list = getServices(maxNum, fl);
539 reply.writeNoException();
540 int N = list != null ? list.size() : -1;
541 reply.writeInt(N);
542 int i;
543 for (i=0; i<N; i++) {
544 ActivityManager.RunningServiceInfo info =
545 (ActivityManager.RunningServiceInfo)list.get(i);
546 info.writeToParcel(reply, 0);
547 }
548 return true;
549 }
550
551 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
552 data.enforceInterface(IActivityManager.descriptor);
553 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
554 reply.writeNoException();
555 reply.writeTypedList(list);
556 return true;
557 }
558
559 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
560 data.enforceInterface(IActivityManager.descriptor);
561 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
562 reply.writeNoException();
563 reply.writeTypedList(list);
564 return true;
565 }
566
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700567 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 List<ApplicationInfo> list = getRunningExternalApplications();
570 reply.writeNoException();
571 reply.writeTypedList(list);
572 return true;
573 }
574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 case MOVE_TASK_TO_FRONT_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800578 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700579 Bundle options = data.readInt() != 0
580 ? Bundle.CREATOR.createFromParcel(data) : null;
581 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 reply.writeNoException();
583 return true;
584 }
585
586 case MOVE_TASK_TO_BACK_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 int task = data.readInt();
589 moveTaskToBack(task);
590 reply.writeNoException();
591 return true;
592 }
593
594 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder token = data.readStrongBinder();
597 boolean nonRoot = data.readInt() != 0;
598 boolean res = moveActivityTaskToBack(token, nonRoot);
599 reply.writeNoException();
600 reply.writeInt(res ? 1 : 0);
601 return true;
602 }
603
604 case MOVE_TASK_BACKWARDS_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 int task = data.readInt();
607 moveTaskBackwards(task);
608 reply.writeNoException();
609 return true;
610 }
611
Craig Mautnerc00204b2013-03-05 15:02:14 -0800612 case CREATE_STACK_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
614 int position = data.readInt();
615 int relativeStackId = data.readInt();
616 float weight = data.readFloat();
617 int res = createStack(position, relativeStackId, weight);
618 reply.writeNoException();
619 reply.writeInt(res);
620 return true;
621 }
622
623 case MOVE_TASK_TO_STACK_TRANSACTION: {
624 data.enforceInterface(IActivityManager.descriptor);
625 int taskId = data.readInt();
626 int stackId = data.readInt();
627 boolean toTop = data.readInt() != 0;
628 moveTaskToStack(taskId, stackId, toTop);
629 reply.writeNoException();
630 return true;
631 }
632
633 case RESIZE_STACK_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 int stackId = data.readInt();
636 float weight = data.readFloat();
637 resizeStack(stackId, weight);
638 reply.writeNoException();
639 return true;
640 }
641
Craig Mautner967212c2013-04-13 21:10:58 -0700642 case GET_STACKS_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 List<ActivityManager.StackInfo> list = getStacks();
645 reply.writeNoException();
646 reply.writeTypedList(list);
647 return true;
648 }
649
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800650 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
651 data.enforceInterface(IActivityManager.descriptor);
652 IBinder token = data.readStrongBinder();
653 boolean onlyRoot = data.readInt() != 0;
654 int res = token != null
655 ? getTaskForActivity(token, onlyRoot) : -1;
656 reply.writeNoException();
657 reply.writeInt(res);
658 return true;
659 }
660
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800661 case REPORT_THUMBNAIL_TRANSACTION: {
662 data.enforceInterface(IActivityManager.descriptor);
663 IBinder token = data.readStrongBinder();
664 Bitmap thumbnail = data.readInt() != 0
665 ? Bitmap.CREATOR.createFromParcel(data) : null;
666 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
667 reportThumbnail(token, thumbnail, description);
668 reply.writeNoException();
669 return true;
670 }
671
672 case GET_CONTENT_PROVIDER_TRANSACTION: {
673 data.enforceInterface(IActivityManager.descriptor);
674 IBinder b = data.readStrongBinder();
675 IApplicationThread app = ApplicationThreadNative.asInterface(b);
676 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700677 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700678 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700679 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 reply.writeNoException();
681 if (cph != null) {
682 reply.writeInt(1);
683 cph.writeToParcel(reply, 0);
684 } else {
685 reply.writeInt(0);
686 }
687 return true;
688 }
689
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800690 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
691 data.enforceInterface(IActivityManager.descriptor);
692 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700693 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800694 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700695 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800696 reply.writeNoException();
697 if (cph != null) {
698 reply.writeInt(1);
699 cph.writeToParcel(reply, 0);
700 } else {
701 reply.writeInt(0);
702 }
703 return true;
704 }
705
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800706 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
707 data.enforceInterface(IActivityManager.descriptor);
708 IBinder b = data.readStrongBinder();
709 IApplicationThread app = ApplicationThreadNative.asInterface(b);
710 ArrayList<ContentProviderHolder> providers =
711 data.createTypedArrayList(ContentProviderHolder.CREATOR);
712 publishContentProviders(app, providers);
713 reply.writeNoException();
714 return true;
715 }
716
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700717 case REF_CONTENT_PROVIDER_TRANSACTION: {
718 data.enforceInterface(IActivityManager.descriptor);
719 IBinder b = data.readStrongBinder();
720 int stable = data.readInt();
721 int unstable = data.readInt();
722 boolean res = refContentProvider(b, stable, unstable);
723 reply.writeNoException();
724 reply.writeInt(res ? 1 : 0);
725 return true;
726 }
727
728 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 IBinder b = data.readStrongBinder();
731 unstableProviderDied(b);
732 reply.writeNoException();
733 return true;
734 }
735
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800736 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
737 data.enforceInterface(IActivityManager.descriptor);
738 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700739 boolean stable = data.readInt() != 0;
740 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800741 reply.writeNoException();
742 return true;
743 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800744
745 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 String name = data.readString();
748 IBinder token = data.readStrongBinder();
749 removeContentProviderExternal(name, token);
750 reply.writeNoException();
751 return true;
752 }
753
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700754 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
755 data.enforceInterface(IActivityManager.descriptor);
756 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
757 PendingIntent pi = getRunningServiceControlPanel(comp);
758 reply.writeNoException();
759 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
760 return true;
761 }
762
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800763 case START_SERVICE_TRANSACTION: {
764 data.enforceInterface(IActivityManager.descriptor);
765 IBinder b = data.readStrongBinder();
766 IApplicationThread app = ApplicationThreadNative.asInterface(b);
767 Intent service = Intent.CREATOR.createFromParcel(data);
768 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700769 int userId = data.readInt();
770 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800771 reply.writeNoException();
772 ComponentName.writeToParcel(cn, reply);
773 return true;
774 }
775
776 case STOP_SERVICE_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder b = data.readStrongBinder();
779 IApplicationThread app = ApplicationThreadNative.asInterface(b);
780 Intent service = Intent.CREATOR.createFromParcel(data);
781 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700782 int userId = data.readInt();
783 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800784 reply.writeNoException();
785 reply.writeInt(res);
786 return true;
787 }
788
789 case STOP_SERVICE_TOKEN_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 ComponentName className = ComponentName.readFromParcel(data);
792 IBinder token = data.readStrongBinder();
793 int startId = data.readInt();
794 boolean res = stopServiceToken(className, token, startId);
795 reply.writeNoException();
796 reply.writeInt(res ? 1 : 0);
797 return true;
798 }
799
800 case SET_SERVICE_FOREGROUND_TRANSACTION: {
801 data.enforceInterface(IActivityManager.descriptor);
802 ComponentName className = ComponentName.readFromParcel(data);
803 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700804 int id = data.readInt();
805 Notification notification = null;
806 if (data.readInt() != 0) {
807 notification = Notification.CREATOR.createFromParcel(data);
808 }
809 boolean removeNotification = data.readInt() != 0;
810 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 reply.writeNoException();
812 return true;
813 }
814
815 case BIND_SERVICE_TRANSACTION: {
816 data.enforceInterface(IActivityManager.descriptor);
817 IBinder b = data.readStrongBinder();
818 IApplicationThread app = ApplicationThreadNative.asInterface(b);
819 IBinder token = data.readStrongBinder();
820 Intent service = Intent.CREATOR.createFromParcel(data);
821 String resolvedType = data.readString();
822 b = data.readStrongBinder();
823 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800824 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800825 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800826 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 reply.writeNoException();
828 reply.writeInt(res);
829 return true;
830 }
831
832 case UNBIND_SERVICE_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 IBinder b = data.readStrongBinder();
835 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
836 boolean res = unbindService(conn);
837 reply.writeNoException();
838 reply.writeInt(res ? 1 : 0);
839 return true;
840 }
841
842 case PUBLISH_SERVICE_TRANSACTION: {
843 data.enforceInterface(IActivityManager.descriptor);
844 IBinder token = data.readStrongBinder();
845 Intent intent = Intent.CREATOR.createFromParcel(data);
846 IBinder service = data.readStrongBinder();
847 publishService(token, intent, service);
848 reply.writeNoException();
849 return true;
850 }
851
852 case UNBIND_FINISHED_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder token = data.readStrongBinder();
855 Intent intent = Intent.CREATOR.createFromParcel(data);
856 boolean doRebind = data.readInt() != 0;
857 unbindFinished(token, intent, doRebind);
858 reply.writeNoException();
859 return true;
860 }
861
862 case SERVICE_DONE_EXECUTING_TRANSACTION: {
863 data.enforceInterface(IActivityManager.descriptor);
864 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700865 int type = data.readInt();
866 int startId = data.readInt();
867 int res = data.readInt();
868 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800869 reply.writeNoException();
870 return true;
871 }
872
873 case START_INSTRUMENTATION_TRANSACTION: {
874 data.enforceInterface(IActivityManager.descriptor);
875 ComponentName className = ComponentName.readFromParcel(data);
876 String profileFile = data.readString();
877 int fl = data.readInt();
878 Bundle arguments = data.readBundle();
879 IBinder b = data.readStrongBinder();
880 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800881 b = data.readStrongBinder();
882 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700883 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800884 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800885 reply.writeNoException();
886 reply.writeInt(res ? 1 : 0);
887 return true;
888 }
889
890
891 case FINISH_INSTRUMENTATION_TRANSACTION: {
892 data.enforceInterface(IActivityManager.descriptor);
893 IBinder b = data.readStrongBinder();
894 IApplicationThread app = ApplicationThreadNative.asInterface(b);
895 int resultCode = data.readInt();
896 Bundle results = data.readBundle();
897 finishInstrumentation(app, resultCode, results);
898 reply.writeNoException();
899 return true;
900 }
901
902 case GET_CONFIGURATION_TRANSACTION: {
903 data.enforceInterface(IActivityManager.descriptor);
904 Configuration config = getConfiguration();
905 reply.writeNoException();
906 config.writeToParcel(reply, 0);
907 return true;
908 }
909
910 case UPDATE_CONFIGURATION_TRANSACTION: {
911 data.enforceInterface(IActivityManager.descriptor);
912 Configuration config = Configuration.CREATOR.createFromParcel(data);
913 updateConfiguration(config);
914 reply.writeNoException();
915 return true;
916 }
917
918 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
919 data.enforceInterface(IActivityManager.descriptor);
920 IBinder token = data.readStrongBinder();
921 int requestedOrientation = data.readInt();
922 setRequestedOrientation(token, requestedOrientation);
923 reply.writeNoException();
924 return true;
925 }
926
927 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
928 data.enforceInterface(IActivityManager.descriptor);
929 IBinder token = data.readStrongBinder();
930 int req = getRequestedOrientation(token);
931 reply.writeNoException();
932 reply.writeInt(req);
933 return true;
934 }
935
936 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
937 data.enforceInterface(IActivityManager.descriptor);
938 IBinder token = data.readStrongBinder();
939 ComponentName cn = getActivityClassForToken(token);
940 reply.writeNoException();
941 ComponentName.writeToParcel(cn, reply);
942 return true;
943 }
944
945 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
946 data.enforceInterface(IActivityManager.descriptor);
947 IBinder token = data.readStrongBinder();
948 reply.writeNoException();
949 reply.writeString(getPackageForToken(token));
950 return true;
951 }
952
953 case GET_INTENT_SENDER_TRANSACTION: {
954 data.enforceInterface(IActivityManager.descriptor);
955 int type = data.readInt();
956 String packageName = data.readString();
957 IBinder token = data.readStrongBinder();
958 String resultWho = data.readString();
959 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800960 Intent[] requestIntents;
961 String[] requestResolvedTypes;
962 if (data.readInt() != 0) {
963 requestIntents = data.createTypedArray(Intent.CREATOR);
964 requestResolvedTypes = data.createStringArray();
965 } else {
966 requestIntents = null;
967 requestResolvedTypes = null;
968 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800969 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700970 Bundle options = data.readInt() != 0
971 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700972 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800973 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800974 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700975 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800976 reply.writeNoException();
977 reply.writeStrongBinder(res != null ? res.asBinder() : null);
978 return true;
979 }
980
981 case CANCEL_INTENT_SENDER_TRANSACTION: {
982 data.enforceInterface(IActivityManager.descriptor);
983 IIntentSender r = IIntentSender.Stub.asInterface(
984 data.readStrongBinder());
985 cancelIntentSender(r);
986 reply.writeNoException();
987 return true;
988 }
989
990 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
991 data.enforceInterface(IActivityManager.descriptor);
992 IIntentSender r = IIntentSender.Stub.asInterface(
993 data.readStrongBinder());
994 String res = getPackageForIntentSender(r);
995 reply.writeNoException();
996 reply.writeString(res);
997 return true;
998 }
999
Christopher Tatec4a07d12012-04-06 14:19:13 -07001000 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1001 data.enforceInterface(IActivityManager.descriptor);
1002 IIntentSender r = IIntentSender.Stub.asInterface(
1003 data.readStrongBinder());
1004 int res = getUidForIntentSender(r);
1005 reply.writeNoException();
1006 reply.writeInt(res);
1007 return true;
1008 }
1009
Dianne Hackborn41203752012-08-31 14:05:51 -07001010 case HANDLE_INCOMING_USER_TRANSACTION: {
1011 data.enforceInterface(IActivityManager.descriptor);
1012 int callingPid = data.readInt();
1013 int callingUid = data.readInt();
1014 int userId = data.readInt();
1015 boolean allowAll = data.readInt() != 0 ;
1016 boolean requireFull = data.readInt() != 0;
1017 String name = data.readString();
1018 String callerPackage = data.readString();
1019 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1020 requireFull, name, callerPackage);
1021 reply.writeNoException();
1022 reply.writeInt(res);
1023 return true;
1024 }
1025
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001026 case SET_PROCESS_LIMIT_TRANSACTION: {
1027 data.enforceInterface(IActivityManager.descriptor);
1028 int max = data.readInt();
1029 setProcessLimit(max);
1030 reply.writeNoException();
1031 return true;
1032 }
1033
1034 case GET_PROCESS_LIMIT_TRANSACTION: {
1035 data.enforceInterface(IActivityManager.descriptor);
1036 int limit = getProcessLimit();
1037 reply.writeNoException();
1038 reply.writeInt(limit);
1039 return true;
1040 }
1041
1042 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1043 data.enforceInterface(IActivityManager.descriptor);
1044 IBinder token = data.readStrongBinder();
1045 int pid = data.readInt();
1046 boolean isForeground = data.readInt() != 0;
1047 setProcessForeground(token, pid, isForeground);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
1052 case CHECK_PERMISSION_TRANSACTION: {
1053 data.enforceInterface(IActivityManager.descriptor);
1054 String perm = data.readString();
1055 int pid = data.readInt();
1056 int uid = data.readInt();
1057 int res = checkPermission(perm, pid, uid);
1058 reply.writeNoException();
1059 reply.writeInt(res);
1060 return true;
1061 }
1062
1063 case CHECK_URI_PERMISSION_TRANSACTION: {
1064 data.enforceInterface(IActivityManager.descriptor);
1065 Uri uri = Uri.CREATOR.createFromParcel(data);
1066 int pid = data.readInt();
1067 int uid = data.readInt();
1068 int mode = data.readInt();
1069 int res = checkUriPermission(uri, pid, uid, mode);
1070 reply.writeNoException();
1071 reply.writeInt(res);
1072 return true;
1073 }
1074
1075 case CLEAR_APP_DATA_TRANSACTION: {
1076 data.enforceInterface(IActivityManager.descriptor);
1077 String packageName = data.readString();
1078 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1079 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001080 int userId = data.readInt();
1081 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001082 reply.writeNoException();
1083 reply.writeInt(res ? 1 : 0);
1084 return true;
1085 }
1086
1087 case GRANT_URI_PERMISSION_TRANSACTION: {
1088 data.enforceInterface(IActivityManager.descriptor);
1089 IBinder b = data.readStrongBinder();
1090 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1091 String targetPkg = data.readString();
1092 Uri uri = Uri.CREATOR.createFromParcel(data);
1093 int mode = data.readInt();
1094 grantUriPermission(app, targetPkg, uri, mode);
1095 reply.writeNoException();
1096 return true;
1097 }
1098
1099 case REVOKE_URI_PERMISSION_TRANSACTION: {
1100 data.enforceInterface(IActivityManager.descriptor);
1101 IBinder b = data.readStrongBinder();
1102 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1103 Uri uri = Uri.CREATOR.createFromParcel(data);
1104 int mode = data.readInt();
1105 revokeUriPermission(app, uri, mode);
1106 reply.writeNoException();
1107 return true;
1108 }
1109
1110 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 IBinder b = data.readStrongBinder();
1113 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1114 boolean waiting = data.readInt() != 0;
1115 showWaitingForDebugger(app, waiting);
1116 reply.writeNoException();
1117 return true;
1118 }
1119
1120 case GET_MEMORY_INFO_TRANSACTION: {
1121 data.enforceInterface(IActivityManager.descriptor);
1122 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1123 getMemoryInfo(mi);
1124 reply.writeNoException();
1125 mi.writeToParcel(reply, 0);
1126 return true;
1127 }
1128
1129 case UNHANDLED_BACK_TRANSACTION: {
1130 data.enforceInterface(IActivityManager.descriptor);
1131 unhandledBack();
1132 reply.writeNoException();
1133 return true;
1134 }
1135
1136 case OPEN_CONTENT_URI_TRANSACTION: {
1137 data.enforceInterface(IActivityManager.descriptor);
1138 Uri uri = Uri.parse(data.readString());
1139 ParcelFileDescriptor pfd = openContentUri(uri);
1140 reply.writeNoException();
1141 if (pfd != null) {
1142 reply.writeInt(1);
1143 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1144 } else {
1145 reply.writeInt(0);
1146 }
1147 return true;
1148 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001149
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001150 case GOING_TO_SLEEP_TRANSACTION: {
1151 data.enforceInterface(IActivityManager.descriptor);
1152 goingToSleep();
1153 reply.writeNoException();
1154 return true;
1155 }
1156
1157 case WAKING_UP_TRANSACTION: {
1158 data.enforceInterface(IActivityManager.descriptor);
1159 wakingUp();
1160 reply.writeNoException();
1161 return true;
1162 }
1163
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001164 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1165 data.enforceInterface(IActivityManager.descriptor);
1166 setLockScreenShown(data.readInt() != 0);
1167 reply.writeNoException();
1168 return true;
1169 }
1170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 case SET_DEBUG_APP_TRANSACTION: {
1172 data.enforceInterface(IActivityManager.descriptor);
1173 String pn = data.readString();
1174 boolean wfd = data.readInt() != 0;
1175 boolean per = data.readInt() != 0;
1176 setDebugApp(pn, wfd, per);
1177 reply.writeNoException();
1178 return true;
1179 }
1180
1181 case SET_ALWAYS_FINISH_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 boolean enabled = data.readInt() != 0;
1184 setAlwaysFinish(enabled);
1185 reply.writeNoException();
1186 return true;
1187 }
1188
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001189 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001191 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001192 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001193 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001194 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001195 return true;
1196 }
1197
1198 case ENTER_SAFE_MODE_TRANSACTION: {
1199 data.enforceInterface(IActivityManager.descriptor);
1200 enterSafeMode();
1201 reply.writeNoException();
1202 return true;
1203 }
1204
1205 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1206 data.enforceInterface(IActivityManager.descriptor);
1207 IIntentSender is = IIntentSender.Stub.asInterface(
1208 data.readStrongBinder());
1209 noteWakeupAlarm(is);
1210 reply.writeNoException();
1211 return true;
1212 }
1213
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001214 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 data.enforceInterface(IActivityManager.descriptor);
1216 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001217 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001218 boolean secure = data.readInt() != 0;
1219 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001220 reply.writeNoException();
1221 reply.writeInt(res ? 1 : 0);
1222 return true;
1223 }
1224
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001225 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 String reason = data.readString();
1228 boolean res = killProcessesBelowForeground(reason);
1229 reply.writeNoException();
1230 reply.writeInt(res ? 1 : 0);
1231 return true;
1232 }
1233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 case START_RUNNING_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 String pkg = data.readString();
1237 String cls = data.readString();
1238 String action = data.readString();
1239 String indata = data.readString();
1240 startRunning(pkg, cls, action, indata);
1241 reply.writeNoException();
1242 return true;
1243 }
1244
Dan Egnor60d87622009-12-16 16:32:58 -08001245 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1246 data.enforceInterface(IActivityManager.descriptor);
1247 IBinder app = data.readStrongBinder();
1248 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1249 handleApplicationCrash(app, ci);
1250 reply.writeNoException();
1251 return true;
1252 }
1253
1254 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001255 data.enforceInterface(IActivityManager.descriptor);
1256 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001258 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001259 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001260 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001261 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001262 return true;
1263 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001264
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001265 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1266 data.enforceInterface(IActivityManager.descriptor);
1267 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001268 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001269 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1270 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001271 reply.writeNoException();
1272 return true;
1273 }
1274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001275 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1276 data.enforceInterface(IActivityManager.descriptor);
1277 int sig = data.readInt();
1278 signalPersistentProcesses(sig);
1279 reply.writeNoException();
1280 return true;
1281 }
1282
Dianne Hackborn03abb812010-01-04 18:43:19 -08001283 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1284 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001286 int userId = data.readInt();
1287 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001288 reply.writeNoException();
1289 return true;
1290 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001291
1292 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1293 data.enforceInterface(IActivityManager.descriptor);
1294 killAllBackgroundProcesses();
1295 reply.writeNoException();
1296 return true;
1297 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001298
1299 case FORCE_STOP_PACKAGE_TRANSACTION: {
1300 data.enforceInterface(IActivityManager.descriptor);
1301 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001302 int userId = data.readInt();
1303 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001304 reply.writeNoException();
1305 return true;
1306 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001307
1308 case GET_MY_MEMORY_STATE_TRANSACTION: {
1309 data.enforceInterface(IActivityManager.descriptor);
1310 ActivityManager.RunningAppProcessInfo info =
1311 new ActivityManager.RunningAppProcessInfo();
1312 getMyMemoryState(info);
1313 reply.writeNoException();
1314 info.writeToParcel(reply, 0);
1315 return true;
1316 }
1317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 ConfigurationInfo config = getDeviceConfigurationInfo();
1321 reply.writeNoException();
1322 config.writeToParcel(reply, 0);
1323 return true;
1324 }
1325
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001326 case PROFILE_CONTROL_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001329 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001330 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001331 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001332 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001333 ParcelFileDescriptor fd = data.readInt() != 0
1334 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001335 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001336 reply.writeNoException();
1337 reply.writeInt(res ? 1 : 0);
1338 return true;
1339 }
1340
Dianne Hackborn55280a92009-05-07 15:53:46 -07001341 case SHUTDOWN_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
1343 boolean res = shutdown(data.readInt());
1344 reply.writeNoException();
1345 reply.writeInt(res ? 1 : 0);
1346 return true;
1347 }
1348
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001349 case STOP_APP_SWITCHES_TRANSACTION: {
1350 data.enforceInterface(IActivityManager.descriptor);
1351 stopAppSwitches();
1352 reply.writeNoException();
1353 return true;
1354 }
1355
1356 case RESUME_APP_SWITCHES_TRANSACTION: {
1357 data.enforceInterface(IActivityManager.descriptor);
1358 resumeAppSwitches();
1359 reply.writeNoException();
1360 return true;
1361 }
1362
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001363 case PEEK_SERVICE_TRANSACTION: {
1364 data.enforceInterface(IActivityManager.descriptor);
1365 Intent service = Intent.CREATOR.createFromParcel(data);
1366 String resolvedType = data.readString();
1367 IBinder binder = peekService(service, resolvedType);
1368 reply.writeNoException();
1369 reply.writeStrongBinder(binder);
1370 return true;
1371 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001372
1373 case START_BACKUP_AGENT_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
1375 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1376 int backupRestoreMode = data.readInt();
1377 boolean success = bindBackupAgent(info, backupRestoreMode);
1378 reply.writeNoException();
1379 reply.writeInt(success ? 1 : 0);
1380 return true;
1381 }
1382
1383 case BACKUP_AGENT_CREATED_TRANSACTION: {
1384 data.enforceInterface(IActivityManager.descriptor);
1385 String packageName = data.readString();
1386 IBinder agent = data.readStrongBinder();
1387 backupAgentCreated(packageName, agent);
1388 reply.writeNoException();
1389 return true;
1390 }
1391
1392 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1393 data.enforceInterface(IActivityManager.descriptor);
1394 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1395 unbindBackupAgent(info);
1396 reply.writeNoException();
1397 return true;
1398 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001399
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001400 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001401 data.enforceInterface(IActivityManager.descriptor);
1402 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001403 int appid = data.readInt();
1404 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001405 reply.writeNoException();
1406 return true;
1407 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001408
1409 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1410 data.enforceInterface(IActivityManager.descriptor);
1411 String reason = data.readString();
1412 closeSystemDialogs(reason);
1413 reply.writeNoException();
1414 return true;
1415 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001416
1417 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001419 int[] pids = data.createIntArray();
1420 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001421 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001422 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001423 return true;
1424 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001425
1426 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1427 data.enforceInterface(IActivityManager.descriptor);
1428 String processName = data.readString();
1429 int uid = data.readInt();
1430 killApplicationProcess(processName, uid);
1431 reply.writeNoException();
1432 return true;
1433 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001434
1435 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1436 data.enforceInterface(IActivityManager.descriptor);
1437 IBinder token = data.readStrongBinder();
1438 String packageName = data.readString();
1439 int enterAnim = data.readInt();
1440 int exitAnim = data.readInt();
1441 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001442 reply.writeNoException();
1443 return true;
1444 }
1445
1446 case IS_USER_A_MONKEY_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001448 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001449 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001450 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001451 return true;
1452 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001453
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001454 case SET_USER_IS_MONKEY_TRANSACTION: {
1455 data.enforceInterface(IActivityManager.descriptor);
1456 final boolean monkey = (data.readInt() == 1);
1457 setUserIsMonkey(monkey);
1458 reply.writeNoException();
1459 return true;
1460 }
1461
Dianne Hackborn860755f2010-06-03 18:47:52 -07001462 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1463 data.enforceInterface(IActivityManager.descriptor);
1464 finishHeavyWeightApp();
1465 reply.writeNoException();
1466 return true;
1467 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001468
1469 case IS_IMMERSIVE_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001472 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001473 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001474 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001475 return true;
1476 }
1477
1478 case SET_IMMERSIVE_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 IBinder token = data.readStrongBinder();
1481 boolean imm = data.readInt() == 1;
1482 setImmersive(token, imm);
1483 reply.writeNoException();
1484 return true;
1485 }
1486
1487 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001489 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001490 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001491 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001492 return true;
1493 }
1494
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001495 case CRASH_APPLICATION_TRANSACTION: {
1496 data.enforceInterface(IActivityManager.descriptor);
1497 int uid = data.readInt();
1498 int initialPid = data.readInt();
1499 String packageName = data.readString();
1500 String message = data.readString();
1501 crashApplication(uid, initialPid, packageName, message);
1502 reply.writeNoException();
1503 return true;
1504 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001505
1506 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1507 data.enforceInterface(IActivityManager.descriptor);
1508 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001509 int userId = data.readInt();
1510 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001511 reply.writeNoException();
1512 reply.writeString(type);
1513 return true;
1514 }
1515
Dianne Hackborn7e269642010-08-25 19:50:20 -07001516 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1517 data.enforceInterface(IActivityManager.descriptor);
1518 String name = data.readString();
1519 IBinder perm = newUriPermissionOwner(name);
1520 reply.writeNoException();
1521 reply.writeStrongBinder(perm);
1522 return true;
1523 }
1524
1525 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1526 data.enforceInterface(IActivityManager.descriptor);
1527 IBinder owner = data.readStrongBinder();
1528 int fromUid = data.readInt();
1529 String targetPkg = data.readString();
1530 Uri uri = Uri.CREATOR.createFromParcel(data);
1531 int mode = data.readInt();
1532 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1533 reply.writeNoException();
1534 return true;
1535 }
1536
1537 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 IBinder owner = data.readStrongBinder();
1540 Uri uri = null;
1541 if (data.readInt() != 0) {
1542 Uri.CREATOR.createFromParcel(data);
1543 }
1544 int mode = data.readInt();
1545 revokeUriPermissionFromOwner(owner, uri, mode);
1546 reply.writeNoException();
1547 return true;
1548 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001549
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001550 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1551 data.enforceInterface(IActivityManager.descriptor);
1552 int callingUid = data.readInt();
1553 String targetPkg = data.readString();
1554 Uri uri = Uri.CREATOR.createFromParcel(data);
1555 int modeFlags = data.readInt();
1556 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1557 reply.writeNoException();
1558 reply.writeInt(res);
1559 return true;
1560 }
1561
Andy McFadden824c5102010-07-09 16:26:57 -07001562 case DUMP_HEAP_TRANSACTION: {
1563 data.enforceInterface(IActivityManager.descriptor);
1564 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001565 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001566 boolean managed = data.readInt() != 0;
1567 String path = data.readString();
1568 ParcelFileDescriptor fd = data.readInt() != 0
1569 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001570 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001571 reply.writeNoException();
1572 reply.writeInt(res ? 1 : 0);
1573 return true;
1574 }
1575
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001576 case START_ACTIVITIES_TRANSACTION:
1577 {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 IBinder b = data.readStrongBinder();
1580 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001581 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001582 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1583 String[] resolvedTypes = data.createStringArray();
1584 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001585 Bundle options = data.readInt() != 0
1586 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001587 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001588 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001589 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001590 reply.writeNoException();
1591 reply.writeInt(result);
1592 return true;
1593 }
1594
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001595 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1596 {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 int mode = getFrontActivityScreenCompatMode();
1599 reply.writeNoException();
1600 reply.writeInt(mode);
1601 return true;
1602 }
1603
1604 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1605 {
1606 data.enforceInterface(IActivityManager.descriptor);
1607 int mode = data.readInt();
1608 setFrontActivityScreenCompatMode(mode);
1609 reply.writeNoException();
1610 reply.writeInt(mode);
1611 return true;
1612 }
1613
1614 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1615 {
1616 data.enforceInterface(IActivityManager.descriptor);
1617 String pkg = data.readString();
1618 int mode = getPackageScreenCompatMode(pkg);
1619 reply.writeNoException();
1620 reply.writeInt(mode);
1621 return true;
1622 }
1623
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001624 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1625 {
1626 data.enforceInterface(IActivityManager.descriptor);
1627 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001628 int mode = data.readInt();
1629 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001630 reply.writeNoException();
1631 return true;
1632 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001633
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001634 case SWITCH_USER_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 int userid = data.readInt();
1637 boolean result = switchUser(userid);
1638 reply.writeNoException();
1639 reply.writeInt(result ? 1 : 0);
1640 return true;
1641 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001642
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001643 case STOP_USER_TRANSACTION: {
1644 data.enforceInterface(IActivityManager.descriptor);
1645 int userid = data.readInt();
1646 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1647 data.readStrongBinder());
1648 int result = stopUser(userid, callback);
1649 reply.writeNoException();
1650 reply.writeInt(result);
1651 return true;
1652 }
1653
Amith Yamasani52f1d752012-03-28 18:19:29 -07001654 case GET_CURRENT_USER_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 UserInfo userInfo = getCurrentUser();
1657 reply.writeNoException();
1658 userInfo.writeToParcel(reply, 0);
1659 return true;
1660 }
1661
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001662 case IS_USER_RUNNING_TRANSACTION: {
1663 data.enforceInterface(IActivityManager.descriptor);
1664 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001665 boolean orStopping = data.readInt() != 0;
1666 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001667 reply.writeNoException();
1668 reply.writeInt(result ? 1 : 0);
1669 return true;
1670 }
1671
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001672 case GET_RUNNING_USER_IDS_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 int[] result = getRunningUserIds();
1675 reply.writeNoException();
1676 reply.writeIntArray(result);
1677 return true;
1678 }
1679
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001680 case REMOVE_SUB_TASK_TRANSACTION:
1681 {
1682 data.enforceInterface(IActivityManager.descriptor);
1683 int taskId = data.readInt();
1684 int subTaskIndex = data.readInt();
1685 boolean result = removeSubTask(taskId, subTaskIndex);
1686 reply.writeNoException();
1687 reply.writeInt(result ? 1 : 0);
1688 return true;
1689 }
1690
1691 case REMOVE_TASK_TRANSACTION:
1692 {
1693 data.enforceInterface(IActivityManager.descriptor);
1694 int taskId = data.readInt();
1695 int fl = data.readInt();
1696 boolean result = removeTask(taskId, fl);
1697 reply.writeNoException();
1698 reply.writeInt(result ? 1 : 0);
1699 return true;
1700 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001701
Jeff Sharkeya4620792011-05-20 15:29:23 -07001702 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1703 data.enforceInterface(IActivityManager.descriptor);
1704 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1705 data.readStrongBinder());
1706 registerProcessObserver(observer);
1707 return true;
1708 }
1709
1710 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1711 data.enforceInterface(IActivityManager.descriptor);
1712 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1713 data.readStrongBinder());
1714 unregisterProcessObserver(observer);
1715 return true;
1716 }
1717
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001718 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1719 {
1720 data.enforceInterface(IActivityManager.descriptor);
1721 String pkg = data.readString();
1722 boolean ask = getPackageAskScreenCompat(pkg);
1723 reply.writeNoException();
1724 reply.writeInt(ask ? 1 : 0);
1725 return true;
1726 }
1727
1728 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1729 {
1730 data.enforceInterface(IActivityManager.descriptor);
1731 String pkg = data.readString();
1732 boolean ask = data.readInt() != 0;
1733 setPackageAskScreenCompat(pkg, ask);
1734 reply.writeNoException();
1735 return true;
1736 }
1737
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001738 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1739 data.enforceInterface(IActivityManager.descriptor);
1740 IIntentSender r = IIntentSender.Stub.asInterface(
1741 data.readStrongBinder());
1742 boolean res = isIntentSenderTargetedToPackage(r);
1743 reply.writeNoException();
1744 reply.writeInt(res ? 1 : 0);
1745 return true;
1746 }
1747
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001748 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1749 data.enforceInterface(IActivityManager.descriptor);
1750 IIntentSender r = IIntentSender.Stub.asInterface(
1751 data.readStrongBinder());
1752 boolean res = isIntentSenderAnActivity(r);
1753 reply.writeNoException();
1754 reply.writeInt(res ? 1 : 0);
1755 return true;
1756 }
1757
Dianne Hackborn81038902012-11-26 17:04:09 -08001758 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1759 data.enforceInterface(IActivityManager.descriptor);
1760 IIntentSender r = IIntentSender.Stub.asInterface(
1761 data.readStrongBinder());
1762 Intent intent = getIntentForIntentSender(r);
1763 reply.writeNoException();
1764 if (intent != null) {
1765 reply.writeInt(1);
1766 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1767 } else {
1768 reply.writeInt(0);
1769 }
1770 return true;
1771 }
1772
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001773 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1774 data.enforceInterface(IActivityManager.descriptor);
1775 Configuration config = Configuration.CREATOR.createFromParcel(data);
1776 updatePersistentConfiguration(config);
1777 reply.writeNoException();
1778 return true;
1779 }
1780
Dianne Hackbornb437e092011-08-05 17:50:29 -07001781 case GET_PROCESS_PSS_TRANSACTION: {
1782 data.enforceInterface(IActivityManager.descriptor);
1783 int[] pids = data.createIntArray();
1784 long[] pss = getProcessPss(pids);
1785 reply.writeNoException();
1786 reply.writeLongArray(pss);
1787 return true;
1788 }
1789
Dianne Hackborn661cd522011-08-22 00:26:20 -07001790 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1793 boolean always = data.readInt() != 0;
1794 showBootMessage(msg, always);
1795 reply.writeNoException();
1796 return true;
1797 }
1798
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001799 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1800 data.enforceInterface(IActivityManager.descriptor);
1801 dismissKeyguardOnNextActivity();
1802 reply.writeNoException();
1803 return true;
1804 }
1805
Adam Powelldd8fab22012-03-22 17:47:27 -07001806 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1807 data.enforceInterface(IActivityManager.descriptor);
1808 IBinder token = data.readStrongBinder();
1809 String destAffinity = data.readString();
1810 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1811 reply.writeNoException();
1812 reply.writeInt(res ? 1 : 0);
1813 return true;
1814 }
1815
1816 case NAVIGATE_UP_TO_TRANSACTION: {
1817 data.enforceInterface(IActivityManager.descriptor);
1818 IBinder token = data.readStrongBinder();
1819 Intent target = Intent.CREATOR.createFromParcel(data);
1820 int resultCode = data.readInt();
1821 Intent resultData = null;
1822 if (data.readInt() != 0) {
1823 resultData = Intent.CREATOR.createFromParcel(data);
1824 }
1825 boolean res = navigateUpTo(token, target, resultCode, resultData);
1826 reply.writeNoException();
1827 reply.writeInt(res ? 1 : 0);
1828 return true;
1829 }
1830
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001831 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1832 data.enforceInterface(IActivityManager.descriptor);
1833 IBinder token = data.readStrongBinder();
1834 int res = getLaunchedFromUid(token);
1835 reply.writeNoException();
1836 reply.writeInt(res);
1837 return true;
1838 }
1839
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001840 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1841 data.enforceInterface(IActivityManager.descriptor);
1842 IBinder token = data.readStrongBinder();
1843 String res = getLaunchedFromPackage(token);
1844 reply.writeNoException();
1845 reply.writeString(res);
1846 return true;
1847 }
1848
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001849 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1852 data.readStrongBinder());
1853 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001854 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001855 return true;
1856 }
1857
1858 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1859 data.enforceInterface(IActivityManager.descriptor);
1860 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1861 data.readStrongBinder());
1862 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001863 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001864 return true;
1865 }
1866
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001867 case REQUEST_BUG_REPORT_TRANSACTION: {
1868 data.enforceInterface(IActivityManager.descriptor);
1869 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001870 reply.writeNoException();
1871 return true;
1872 }
1873
1874 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1875 data.enforceInterface(IActivityManager.descriptor);
1876 int pid = data.readInt();
1877 boolean aboveSystem = data.readInt() != 0;
1878 long res = inputDispatchingTimedOut(pid, aboveSystem);
1879 reply.writeNoException();
1880 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001881 return true;
1882 }
1883
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001884 case GET_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1885 data.enforceInterface(IActivityManager.descriptor);
1886 int requestType = data.readInt();
1887 Bundle res = getTopActivityExtras(requestType);
1888 reply.writeNoException();
1889 reply.writeBundle(res);
1890 return true;
1891 }
1892
1893 case REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1894 data.enforceInterface(IActivityManager.descriptor);
1895 IBinder token = data.readStrongBinder();
1896 Bundle extras = data.readBundle();
1897 reportTopActivityExtras(token, extras);
1898 reply.writeNoException();
1899 return true;
1900 }
1901
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001902 case KILL_UID_TRANSACTION: {
1903 data.enforceInterface(IActivityManager.descriptor);
1904 int uid = data.readInt();
1905 String reason = data.readString();
1906 killUid(uid, reason);
1907 reply.writeNoException();
1908 return true;
1909 }
1910
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001911 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001912
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001913 return super.onTransact(code, data, reply, flags);
1914 }
1915
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001916 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001917 return this;
1918 }
1919
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001920 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1921 protected IActivityManager create() {
1922 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001923 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001924 Log.v("ActivityManager", "default service binder = " + b);
1925 }
1926 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001927 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001928 Log.v("ActivityManager", "default service = " + am);
1929 }
1930 return am;
1931 }
1932 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001933}
1934
1935class ActivityManagerProxy implements IActivityManager
1936{
1937 public ActivityManagerProxy(IBinder remote)
1938 {
1939 mRemote = remote;
1940 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001941
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001942 public IBinder asBinder()
1943 {
1944 return mRemote;
1945 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001946
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001947 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001948 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1949 int startFlags, String profileFile,
1950 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001951 Parcel data = Parcel.obtain();
1952 Parcel reply = Parcel.obtain();
1953 data.writeInterfaceToken(IActivityManager.descriptor);
1954 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001955 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001956 intent.writeToParcel(data, 0);
1957 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001958 data.writeStrongBinder(resultTo);
1959 data.writeString(resultWho);
1960 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001961 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001962 data.writeString(profileFile);
1963 if (profileFd != null) {
1964 data.writeInt(1);
1965 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1966 } else {
1967 data.writeInt(0);
1968 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001969 if (options != null) {
1970 data.writeInt(1);
1971 options.writeToParcel(data, 0);
1972 } else {
1973 data.writeInt(0);
1974 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001975 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1976 reply.readException();
1977 int result = reply.readInt();
1978 reply.recycle();
1979 data.recycle();
1980 return result;
1981 }
Amith Yamasani82644082012-08-03 13:09:11 -07001982
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001983 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07001984 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1985 int startFlags, String profileFile,
1986 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1987 Parcel data = Parcel.obtain();
1988 Parcel reply = Parcel.obtain();
1989 data.writeInterfaceToken(IActivityManager.descriptor);
1990 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001991 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07001992 intent.writeToParcel(data, 0);
1993 data.writeString(resolvedType);
1994 data.writeStrongBinder(resultTo);
1995 data.writeString(resultWho);
1996 data.writeInt(requestCode);
1997 data.writeInt(startFlags);
1998 data.writeString(profileFile);
1999 if (profileFd != null) {
2000 data.writeInt(1);
2001 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2002 } else {
2003 data.writeInt(0);
2004 }
2005 if (options != null) {
2006 data.writeInt(1);
2007 options.writeToParcel(data, 0);
2008 } else {
2009 data.writeInt(0);
2010 }
2011 data.writeInt(userId);
2012 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2013 reply.readException();
2014 int result = reply.readInt();
2015 reply.recycle();
2016 data.recycle();
2017 return result;
2018 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002019 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2020 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002021 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002022 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002023 Parcel data = Parcel.obtain();
2024 Parcel reply = Parcel.obtain();
2025 data.writeInterfaceToken(IActivityManager.descriptor);
2026 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002027 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002028 intent.writeToParcel(data, 0);
2029 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002030 data.writeStrongBinder(resultTo);
2031 data.writeString(resultWho);
2032 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002033 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002034 data.writeString(profileFile);
2035 if (profileFd != null) {
2036 data.writeInt(1);
2037 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2038 } else {
2039 data.writeInt(0);
2040 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002041 if (options != null) {
2042 data.writeInt(1);
2043 options.writeToParcel(data, 0);
2044 } else {
2045 data.writeInt(0);
2046 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002047 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002048 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2049 reply.readException();
2050 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2051 reply.recycle();
2052 data.recycle();
2053 return result;
2054 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002055 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2056 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002057 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002058 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002059 Parcel data = Parcel.obtain();
2060 Parcel reply = Parcel.obtain();
2061 data.writeInterfaceToken(IActivityManager.descriptor);
2062 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002063 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002064 intent.writeToParcel(data, 0);
2065 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002066 data.writeStrongBinder(resultTo);
2067 data.writeString(resultWho);
2068 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002069 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002070 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002071 if (options != null) {
2072 data.writeInt(1);
2073 options.writeToParcel(data, 0);
2074 } else {
2075 data.writeInt(0);
2076 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002077 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002078 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2079 reply.readException();
2080 int result = reply.readInt();
2081 reply.recycle();
2082 data.recycle();
2083 return result;
2084 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002085 public int startActivityIntentSender(IApplicationThread caller,
2086 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002087 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002088 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002089 Parcel data = Parcel.obtain();
2090 Parcel reply = Parcel.obtain();
2091 data.writeInterfaceToken(IActivityManager.descriptor);
2092 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2093 intent.writeToParcel(data, 0);
2094 if (fillInIntent != null) {
2095 data.writeInt(1);
2096 fillInIntent.writeToParcel(data, 0);
2097 } else {
2098 data.writeInt(0);
2099 }
2100 data.writeString(resolvedType);
2101 data.writeStrongBinder(resultTo);
2102 data.writeString(resultWho);
2103 data.writeInt(requestCode);
2104 data.writeInt(flagsMask);
2105 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002106 if (options != null) {
2107 data.writeInt(1);
2108 options.writeToParcel(data, 0);
2109 } else {
2110 data.writeInt(0);
2111 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002112 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002113 reply.readException();
2114 int result = reply.readInt();
2115 reply.recycle();
2116 data.recycle();
2117 return result;
2118 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002119 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002120 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002121 Parcel data = Parcel.obtain();
2122 Parcel reply = Parcel.obtain();
2123 data.writeInterfaceToken(IActivityManager.descriptor);
2124 data.writeStrongBinder(callingActivity);
2125 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002126 if (options != null) {
2127 data.writeInt(1);
2128 options.writeToParcel(data, 0);
2129 } else {
2130 data.writeInt(0);
2131 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002132 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2133 reply.readException();
2134 int result = reply.readInt();
2135 reply.recycle();
2136 data.recycle();
2137 return result != 0;
2138 }
2139 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2140 throws RemoteException {
2141 Parcel data = Parcel.obtain();
2142 Parcel reply = Parcel.obtain();
2143 data.writeInterfaceToken(IActivityManager.descriptor);
2144 data.writeStrongBinder(token);
2145 data.writeInt(resultCode);
2146 if (resultData != null) {
2147 data.writeInt(1);
2148 resultData.writeToParcel(data, 0);
2149 } else {
2150 data.writeInt(0);
2151 }
2152 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2153 reply.readException();
2154 boolean res = reply.readInt() != 0;
2155 data.recycle();
2156 reply.recycle();
2157 return res;
2158 }
2159 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2160 {
2161 Parcel data = Parcel.obtain();
2162 Parcel reply = Parcel.obtain();
2163 data.writeInterfaceToken(IActivityManager.descriptor);
2164 data.writeStrongBinder(token);
2165 data.writeString(resultWho);
2166 data.writeInt(requestCode);
2167 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2168 reply.readException();
2169 data.recycle();
2170 reply.recycle();
2171 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002172 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2173 Parcel data = Parcel.obtain();
2174 Parcel reply = Parcel.obtain();
2175 data.writeInterfaceToken(IActivityManager.descriptor);
2176 data.writeStrongBinder(token);
2177 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2178 reply.readException();
2179 boolean res = reply.readInt() != 0;
2180 data.recycle();
2181 reply.recycle();
2182 return res;
2183 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002184 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2185 Parcel data = Parcel.obtain();
2186 Parcel reply = Parcel.obtain();
2187 data.writeInterfaceToken(IActivityManager.descriptor);
2188 data.writeStrongBinder(token);
2189 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2190 reply.readException();
2191 boolean res = reply.readInt() != 0;
2192 data.recycle();
2193 reply.recycle();
2194 return res;
2195 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002196 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002197 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002198 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002199 {
2200 Parcel data = Parcel.obtain();
2201 Parcel reply = Parcel.obtain();
2202 data.writeInterfaceToken(IActivityManager.descriptor);
2203 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002204 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002205 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2206 filter.writeToParcel(data, 0);
2207 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002208 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002209 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2210 reply.readException();
2211 Intent intent = null;
2212 int haveIntent = reply.readInt();
2213 if (haveIntent != 0) {
2214 intent = Intent.CREATOR.createFromParcel(reply);
2215 }
2216 reply.recycle();
2217 data.recycle();
2218 return intent;
2219 }
2220 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2221 {
2222 Parcel data = Parcel.obtain();
2223 Parcel reply = Parcel.obtain();
2224 data.writeInterfaceToken(IActivityManager.descriptor);
2225 data.writeStrongBinder(receiver.asBinder());
2226 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2227 reply.readException();
2228 data.recycle();
2229 reply.recycle();
2230 }
2231 public int broadcastIntent(IApplicationThread caller,
2232 Intent intent, String resolvedType, IIntentReceiver resultTo,
2233 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002234 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002235 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002236 {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2241 intent.writeToParcel(data, 0);
2242 data.writeString(resolvedType);
2243 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2244 data.writeInt(resultCode);
2245 data.writeString(resultData);
2246 data.writeBundle(map);
2247 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002248 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002249 data.writeInt(serialized ? 1 : 0);
2250 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002251 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002252 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2253 reply.readException();
2254 int res = reply.readInt();
2255 reply.recycle();
2256 data.recycle();
2257 return res;
2258 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002259 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2260 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002261 {
2262 Parcel data = Parcel.obtain();
2263 Parcel reply = Parcel.obtain();
2264 data.writeInterfaceToken(IActivityManager.descriptor);
2265 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2266 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002267 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002268 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2269 reply.readException();
2270 data.recycle();
2271 reply.recycle();
2272 }
2273 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2274 {
2275 Parcel data = Parcel.obtain();
2276 Parcel reply = Parcel.obtain();
2277 data.writeInterfaceToken(IActivityManager.descriptor);
2278 data.writeStrongBinder(who);
2279 data.writeInt(resultCode);
2280 data.writeString(resultData);
2281 data.writeBundle(map);
2282 data.writeInt(abortBroadcast ? 1 : 0);
2283 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2284 reply.readException();
2285 data.recycle();
2286 reply.recycle();
2287 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002288 public void attachApplication(IApplicationThread app) throws RemoteException
2289 {
2290 Parcel data = Parcel.obtain();
2291 Parcel reply = Parcel.obtain();
2292 data.writeInterfaceToken(IActivityManager.descriptor);
2293 data.writeStrongBinder(app.asBinder());
2294 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2295 reply.readException();
2296 data.recycle();
2297 reply.recycle();
2298 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002299 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2300 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002301 {
2302 Parcel data = Parcel.obtain();
2303 Parcel reply = Parcel.obtain();
2304 data.writeInterfaceToken(IActivityManager.descriptor);
2305 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002306 if (config != null) {
2307 data.writeInt(1);
2308 config.writeToParcel(data, 0);
2309 } else {
2310 data.writeInt(0);
2311 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002312 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002313 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2314 reply.readException();
2315 data.recycle();
2316 reply.recycle();
2317 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002318 public void activityResumed(IBinder token) throws RemoteException
2319 {
2320 Parcel data = Parcel.obtain();
2321 Parcel reply = Parcel.obtain();
2322 data.writeInterfaceToken(IActivityManager.descriptor);
2323 data.writeStrongBinder(token);
2324 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2325 reply.readException();
2326 data.recycle();
2327 reply.recycle();
2328 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002329 public void activityPaused(IBinder token) throws RemoteException
2330 {
2331 Parcel data = Parcel.obtain();
2332 Parcel reply = Parcel.obtain();
2333 data.writeInterfaceToken(IActivityManager.descriptor);
2334 data.writeStrongBinder(token);
2335 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2336 reply.readException();
2337 data.recycle();
2338 reply.recycle();
2339 }
2340 public void activityStopped(IBinder token, Bundle state,
2341 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 {
2343 Parcel data = Parcel.obtain();
2344 Parcel reply = Parcel.obtain();
2345 data.writeInterfaceToken(IActivityManager.descriptor);
2346 data.writeStrongBinder(token);
2347 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002348 if (thumbnail != null) {
2349 data.writeInt(1);
2350 thumbnail.writeToParcel(data, 0);
2351 } else {
2352 data.writeInt(0);
2353 }
2354 TextUtils.writeToParcel(description, data, 0);
2355 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2356 reply.readException();
2357 data.recycle();
2358 reply.recycle();
2359 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002360 public void activitySlept(IBinder token) throws RemoteException
2361 {
2362 Parcel data = Parcel.obtain();
2363 Parcel reply = Parcel.obtain();
2364 data.writeInterfaceToken(IActivityManager.descriptor);
2365 data.writeStrongBinder(token);
2366 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2367 reply.readException();
2368 data.recycle();
2369 reply.recycle();
2370 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002371 public void activityDestroyed(IBinder token) throws RemoteException
2372 {
2373 Parcel data = Parcel.obtain();
2374 Parcel reply = Parcel.obtain();
2375 data.writeInterfaceToken(IActivityManager.descriptor);
2376 data.writeStrongBinder(token);
2377 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2378 reply.readException();
2379 data.recycle();
2380 reply.recycle();
2381 }
2382 public String getCallingPackage(IBinder token) throws RemoteException
2383 {
2384 Parcel data = Parcel.obtain();
2385 Parcel reply = Parcel.obtain();
2386 data.writeInterfaceToken(IActivityManager.descriptor);
2387 data.writeStrongBinder(token);
2388 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2389 reply.readException();
2390 String res = reply.readString();
2391 data.recycle();
2392 reply.recycle();
2393 return res;
2394 }
2395 public ComponentName getCallingActivity(IBinder token)
2396 throws RemoteException {
2397 Parcel data = Parcel.obtain();
2398 Parcel reply = Parcel.obtain();
2399 data.writeInterfaceToken(IActivityManager.descriptor);
2400 data.writeStrongBinder(token);
2401 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2402 reply.readException();
2403 ComponentName res = ComponentName.readFromParcel(reply);
2404 data.recycle();
2405 reply.recycle();
2406 return res;
2407 }
2408 public List getTasks(int maxNum, int flags,
2409 IThumbnailReceiver receiver) throws RemoteException {
2410 Parcel data = Parcel.obtain();
2411 Parcel reply = Parcel.obtain();
2412 data.writeInterfaceToken(IActivityManager.descriptor);
2413 data.writeInt(maxNum);
2414 data.writeInt(flags);
2415 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2416 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2417 reply.readException();
2418 ArrayList list = null;
2419 int N = reply.readInt();
2420 if (N >= 0) {
2421 list = new ArrayList();
2422 while (N > 0) {
2423 ActivityManager.RunningTaskInfo info =
2424 ActivityManager.RunningTaskInfo.CREATOR
2425 .createFromParcel(reply);
2426 list.add(info);
2427 N--;
2428 }
2429 }
2430 data.recycle();
2431 reply.recycle();
2432 return list;
2433 }
2434 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002435 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002436 Parcel data = Parcel.obtain();
2437 Parcel reply = Parcel.obtain();
2438 data.writeInterfaceToken(IActivityManager.descriptor);
2439 data.writeInt(maxNum);
2440 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002441 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002442 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2443 reply.readException();
2444 ArrayList<ActivityManager.RecentTaskInfo> list
2445 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2446 data.recycle();
2447 reply.recycle();
2448 return list;
2449 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002450 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002451 Parcel data = Parcel.obtain();
2452 Parcel reply = Parcel.obtain();
2453 data.writeInterfaceToken(IActivityManager.descriptor);
2454 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002455 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002456 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002457 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002458 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002459 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002460 }
2461 data.recycle();
2462 reply.recycle();
2463 return bm;
2464 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002465 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2466 Parcel data = Parcel.obtain();
2467 Parcel reply = Parcel.obtain();
2468 data.writeInterfaceToken(IActivityManager.descriptor);
2469 data.writeInt(id);
2470 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2471 reply.readException();
2472 Bitmap bm = null;
2473 if (reply.readInt() != 0) {
2474 bm = Bitmap.CREATOR.createFromParcel(reply);
2475 }
2476 data.recycle();
2477 reply.recycle();
2478 return bm;
2479 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002480 public List getServices(int maxNum, int flags) throws RemoteException {
2481 Parcel data = Parcel.obtain();
2482 Parcel reply = Parcel.obtain();
2483 data.writeInterfaceToken(IActivityManager.descriptor);
2484 data.writeInt(maxNum);
2485 data.writeInt(flags);
2486 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2487 reply.readException();
2488 ArrayList list = null;
2489 int N = reply.readInt();
2490 if (N >= 0) {
2491 list = new ArrayList();
2492 while (N > 0) {
2493 ActivityManager.RunningServiceInfo info =
2494 ActivityManager.RunningServiceInfo.CREATOR
2495 .createFromParcel(reply);
2496 list.add(info);
2497 N--;
2498 }
2499 }
2500 data.recycle();
2501 reply.recycle();
2502 return list;
2503 }
2504 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2505 throws RemoteException {
2506 Parcel data = Parcel.obtain();
2507 Parcel reply = Parcel.obtain();
2508 data.writeInterfaceToken(IActivityManager.descriptor);
2509 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2510 reply.readException();
2511 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2512 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2513 data.recycle();
2514 reply.recycle();
2515 return list;
2516 }
2517 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2518 throws RemoteException {
2519 Parcel data = Parcel.obtain();
2520 Parcel reply = Parcel.obtain();
2521 data.writeInterfaceToken(IActivityManager.descriptor);
2522 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2523 reply.readException();
2524 ArrayList<ActivityManager.RunningAppProcessInfo> list
2525 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2526 data.recycle();
2527 reply.recycle();
2528 return list;
2529 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002530 public List<ApplicationInfo> getRunningExternalApplications()
2531 throws RemoteException {
2532 Parcel data = Parcel.obtain();
2533 Parcel reply = Parcel.obtain();
2534 data.writeInterfaceToken(IActivityManager.descriptor);
2535 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2536 reply.readException();
2537 ArrayList<ApplicationInfo> list
2538 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2539 data.recycle();
2540 reply.recycle();
2541 return list;
2542 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002543 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002544 {
2545 Parcel data = Parcel.obtain();
2546 Parcel reply = Parcel.obtain();
2547 data.writeInterfaceToken(IActivityManager.descriptor);
2548 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002549 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002550 if (options != null) {
2551 data.writeInt(1);
2552 options.writeToParcel(data, 0);
2553 } else {
2554 data.writeInt(0);
2555 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002556 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2557 reply.readException();
2558 data.recycle();
2559 reply.recycle();
2560 }
2561 public void moveTaskToBack(int task) throws RemoteException
2562 {
2563 Parcel data = Parcel.obtain();
2564 Parcel reply = Parcel.obtain();
2565 data.writeInterfaceToken(IActivityManager.descriptor);
2566 data.writeInt(task);
2567 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2568 reply.readException();
2569 data.recycle();
2570 reply.recycle();
2571 }
2572 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2573 throws RemoteException {
2574 Parcel data = Parcel.obtain();
2575 Parcel reply = Parcel.obtain();
2576 data.writeInterfaceToken(IActivityManager.descriptor);
2577 data.writeStrongBinder(token);
2578 data.writeInt(nonRoot ? 1 : 0);
2579 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2580 reply.readException();
2581 boolean res = reply.readInt() != 0;
2582 data.recycle();
2583 reply.recycle();
2584 return res;
2585 }
2586 public void moveTaskBackwards(int task) throws RemoteException
2587 {
2588 Parcel data = Parcel.obtain();
2589 Parcel reply = Parcel.obtain();
2590 data.writeInterfaceToken(IActivityManager.descriptor);
2591 data.writeInt(task);
2592 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2593 reply.readException();
2594 data.recycle();
2595 reply.recycle();
2596 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002597 @Override
2598 public int createStack(int position, int relativeStackId, float weight) throws RemoteException
2599 {
2600 Parcel data = Parcel.obtain();
2601 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002602 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002603 data.writeInt(position);
2604 data.writeInt(relativeStackId);
2605 data.writeFloat(weight);
2606 mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
2607 reply.readException();
2608 int res = reply.readInt();
2609 data.recycle();
2610 reply.recycle();
2611 return res;
2612 }
2613 @Override
2614 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2615 {
2616 Parcel data = Parcel.obtain();
2617 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002618 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002619 data.writeInt(taskId);
2620 data.writeInt(stackId);
2621 data.writeInt(toTop ? 1 : 0);
2622 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2623 reply.readException();
2624 data.recycle();
2625 reply.recycle();
2626 }
2627 @Override
2628 public void resizeStack(int stackId, float weight) throws RemoteException
2629 {
2630 Parcel data = Parcel.obtain();
2631 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002632 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002633 data.writeInt(stackId);
2634 data.writeFloat(weight);
2635 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
2636 reply.readException();
2637 data.recycle();
2638 reply.recycle();
2639 }
Craig Mautner967212c2013-04-13 21:10:58 -07002640 @Override
2641 public List<ActivityManager.StackInfo> getStacks() throws RemoteException
2642 {
2643 Parcel data = Parcel.obtain();
2644 Parcel reply = Parcel.obtain();
2645 data.writeInterfaceToken(IActivityManager.descriptor);
2646 mRemote.transact(GET_STACKS_TRANSACTION, data, reply, 0);
2647 reply.readException();
2648 ArrayList<ActivityManager.StackInfo> list
2649 = reply.createTypedArrayList(ActivityManager.StackInfo.CREATOR);
2650 data.recycle();
2651 reply.recycle();
2652 return list;
2653 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002654 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2655 {
2656 Parcel data = Parcel.obtain();
2657 Parcel reply = Parcel.obtain();
2658 data.writeInterfaceToken(IActivityManager.descriptor);
2659 data.writeStrongBinder(token);
2660 data.writeInt(onlyRoot ? 1 : 0);
2661 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2662 reply.readException();
2663 int res = reply.readInt();
2664 data.recycle();
2665 reply.recycle();
2666 return res;
2667 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002668 public void reportThumbnail(IBinder token,
2669 Bitmap thumbnail, CharSequence description) throws RemoteException
2670 {
2671 Parcel data = Parcel.obtain();
2672 Parcel reply = Parcel.obtain();
2673 data.writeInterfaceToken(IActivityManager.descriptor);
2674 data.writeStrongBinder(token);
2675 if (thumbnail != null) {
2676 data.writeInt(1);
2677 thumbnail.writeToParcel(data, 0);
2678 } else {
2679 data.writeInt(0);
2680 }
2681 TextUtils.writeToParcel(description, data, 0);
2682 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2683 reply.readException();
2684 data.recycle();
2685 reply.recycle();
2686 }
2687 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002688 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002689 Parcel data = Parcel.obtain();
2690 Parcel reply = Parcel.obtain();
2691 data.writeInterfaceToken(IActivityManager.descriptor);
2692 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2693 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002694 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002695 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002696 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2697 reply.readException();
2698 int res = reply.readInt();
2699 ContentProviderHolder cph = null;
2700 if (res != 0) {
2701 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2702 }
2703 data.recycle();
2704 reply.recycle();
2705 return cph;
2706 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002707 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2708 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002709 Parcel data = Parcel.obtain();
2710 Parcel reply = Parcel.obtain();
2711 data.writeInterfaceToken(IActivityManager.descriptor);
2712 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002713 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002714 data.writeStrongBinder(token);
2715 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2716 reply.readException();
2717 int res = reply.readInt();
2718 ContentProviderHolder cph = null;
2719 if (res != 0) {
2720 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2721 }
2722 data.recycle();
2723 reply.recycle();
2724 return cph;
2725 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002726 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002727 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002728 {
2729 Parcel data = Parcel.obtain();
2730 Parcel reply = Parcel.obtain();
2731 data.writeInterfaceToken(IActivityManager.descriptor);
2732 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2733 data.writeTypedList(providers);
2734 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2735 reply.readException();
2736 data.recycle();
2737 reply.recycle();
2738 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002739 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2740 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002741 Parcel data = Parcel.obtain();
2742 Parcel reply = Parcel.obtain();
2743 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002744 data.writeStrongBinder(connection);
2745 data.writeInt(stable);
2746 data.writeInt(unstable);
2747 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2748 reply.readException();
2749 boolean res = reply.readInt() != 0;
2750 data.recycle();
2751 reply.recycle();
2752 return res;
2753 }
2754 public void unstableProviderDied(IBinder connection) throws RemoteException {
2755 Parcel data = Parcel.obtain();
2756 Parcel reply = Parcel.obtain();
2757 data.writeInterfaceToken(IActivityManager.descriptor);
2758 data.writeStrongBinder(connection);
2759 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2760 reply.readException();
2761 data.recycle();
2762 reply.recycle();
2763 }
2764
2765 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2766 Parcel data = Parcel.obtain();
2767 Parcel reply = Parcel.obtain();
2768 data.writeInterfaceToken(IActivityManager.descriptor);
2769 data.writeStrongBinder(connection);
2770 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2772 reply.readException();
2773 data.recycle();
2774 reply.recycle();
2775 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002776
2777 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2778 Parcel data = Parcel.obtain();
2779 Parcel reply = Parcel.obtain();
2780 data.writeInterfaceToken(IActivityManager.descriptor);
2781 data.writeString(name);
2782 data.writeStrongBinder(token);
2783 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2784 reply.readException();
2785 data.recycle();
2786 reply.recycle();
2787 }
2788
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002789 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2790 throws RemoteException
2791 {
2792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 service.writeToParcel(data, 0);
2796 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2797 reply.readException();
2798 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2799 data.recycle();
2800 reply.recycle();
2801 return res;
2802 }
2803
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002804 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002805 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002806 {
2807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2811 service.writeToParcel(data, 0);
2812 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002813 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002814 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2815 reply.readException();
2816 ComponentName res = ComponentName.readFromParcel(reply);
2817 data.recycle();
2818 reply.recycle();
2819 return res;
2820 }
2821 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002822 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002823 {
2824 Parcel data = Parcel.obtain();
2825 Parcel reply = Parcel.obtain();
2826 data.writeInterfaceToken(IActivityManager.descriptor);
2827 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2828 service.writeToParcel(data, 0);
2829 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002830 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002831 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2832 reply.readException();
2833 int res = reply.readInt();
2834 reply.recycle();
2835 data.recycle();
2836 return res;
2837 }
2838 public boolean stopServiceToken(ComponentName className, IBinder token,
2839 int startId) throws RemoteException {
2840 Parcel data = Parcel.obtain();
2841 Parcel reply = Parcel.obtain();
2842 data.writeInterfaceToken(IActivityManager.descriptor);
2843 ComponentName.writeToParcel(className, data);
2844 data.writeStrongBinder(token);
2845 data.writeInt(startId);
2846 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2847 reply.readException();
2848 boolean res = reply.readInt() != 0;
2849 data.recycle();
2850 reply.recycle();
2851 return res;
2852 }
2853 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002854 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002855 Parcel data = Parcel.obtain();
2856 Parcel reply = Parcel.obtain();
2857 data.writeInterfaceToken(IActivityManager.descriptor);
2858 ComponentName.writeToParcel(className, data);
2859 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002860 data.writeInt(id);
2861 if (notification != null) {
2862 data.writeInt(1);
2863 notification.writeToParcel(data, 0);
2864 } else {
2865 data.writeInt(0);
2866 }
2867 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002868 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2869 reply.readException();
2870 data.recycle();
2871 reply.recycle();
2872 }
2873 public int bindService(IApplicationThread caller, IBinder token,
2874 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002875 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002876 Parcel data = Parcel.obtain();
2877 Parcel reply = Parcel.obtain();
2878 data.writeInterfaceToken(IActivityManager.descriptor);
2879 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2880 data.writeStrongBinder(token);
2881 service.writeToParcel(data, 0);
2882 data.writeString(resolvedType);
2883 data.writeStrongBinder(connection.asBinder());
2884 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002885 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002886 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 int res = reply.readInt();
2889 data.recycle();
2890 reply.recycle();
2891 return res;
2892 }
2893 public boolean unbindService(IServiceConnection connection) throws RemoteException
2894 {
2895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 data.writeStrongBinder(connection.asBinder());
2899 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2900 reply.readException();
2901 boolean res = reply.readInt() != 0;
2902 data.recycle();
2903 reply.recycle();
2904 return res;
2905 }
2906
2907 public void publishService(IBinder token,
2908 Intent intent, IBinder service) throws RemoteException {
2909 Parcel data = Parcel.obtain();
2910 Parcel reply = Parcel.obtain();
2911 data.writeInterfaceToken(IActivityManager.descriptor);
2912 data.writeStrongBinder(token);
2913 intent.writeToParcel(data, 0);
2914 data.writeStrongBinder(service);
2915 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2916 reply.readException();
2917 data.recycle();
2918 reply.recycle();
2919 }
2920
2921 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2922 throws RemoteException {
2923 Parcel data = Parcel.obtain();
2924 Parcel reply = Parcel.obtain();
2925 data.writeInterfaceToken(IActivityManager.descriptor);
2926 data.writeStrongBinder(token);
2927 intent.writeToParcel(data, 0);
2928 data.writeInt(doRebind ? 1 : 0);
2929 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2930 reply.readException();
2931 data.recycle();
2932 reply.recycle();
2933 }
2934
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002935 public void serviceDoneExecuting(IBinder token, int type, int startId,
2936 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002937 Parcel data = Parcel.obtain();
2938 Parcel reply = Parcel.obtain();
2939 data.writeInterfaceToken(IActivityManager.descriptor);
2940 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002941 data.writeInt(type);
2942 data.writeInt(startId);
2943 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002944 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2945 reply.readException();
2946 data.recycle();
2947 reply.recycle();
2948 }
2949
2950 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2951 Parcel data = Parcel.obtain();
2952 Parcel reply = Parcel.obtain();
2953 data.writeInterfaceToken(IActivityManager.descriptor);
2954 service.writeToParcel(data, 0);
2955 data.writeString(resolvedType);
2956 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2957 reply.readException();
2958 IBinder binder = reply.readStrongBinder();
2959 reply.recycle();
2960 data.recycle();
2961 return binder;
2962 }
2963
Christopher Tate181fafa2009-05-14 11:12:14 -07002964 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2965 throws RemoteException {
2966 Parcel data = Parcel.obtain();
2967 Parcel reply = Parcel.obtain();
2968 data.writeInterfaceToken(IActivityManager.descriptor);
2969 app.writeToParcel(data, 0);
2970 data.writeInt(backupRestoreMode);
2971 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 boolean success = reply.readInt() != 0;
2974 reply.recycle();
2975 data.recycle();
2976 return success;
2977 }
2978
Christopher Tate346acb12012-10-15 19:20:25 -07002979 public void clearPendingBackup() throws RemoteException {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
2984 reply.recycle();
2985 data.recycle();
2986 }
2987
Christopher Tate181fafa2009-05-14 11:12:14 -07002988 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2989 Parcel data = Parcel.obtain();
2990 Parcel reply = Parcel.obtain();
2991 data.writeInterfaceToken(IActivityManager.descriptor);
2992 data.writeString(packageName);
2993 data.writeStrongBinder(agent);
2994 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2995 reply.recycle();
2996 data.recycle();
2997 }
2998
2999 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3000 Parcel data = Parcel.obtain();
3001 Parcel reply = Parcel.obtain();
3002 data.writeInterfaceToken(IActivityManager.descriptor);
3003 app.writeToParcel(data, 0);
3004 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3005 reply.readException();
3006 reply.recycle();
3007 data.recycle();
3008 }
3009
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003010 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003011 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3012 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003013 Parcel data = Parcel.obtain();
3014 Parcel reply = Parcel.obtain();
3015 data.writeInterfaceToken(IActivityManager.descriptor);
3016 ComponentName.writeToParcel(className, data);
3017 data.writeString(profileFile);
3018 data.writeInt(flags);
3019 data.writeBundle(arguments);
3020 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003021 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003022 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003023 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3024 reply.readException();
3025 boolean res = reply.readInt() != 0;
3026 reply.recycle();
3027 data.recycle();
3028 return res;
3029 }
3030
3031 public void finishInstrumentation(IApplicationThread target,
3032 int resultCode, Bundle results) throws RemoteException {
3033 Parcel data = Parcel.obtain();
3034 Parcel reply = Parcel.obtain();
3035 data.writeInterfaceToken(IActivityManager.descriptor);
3036 data.writeStrongBinder(target != null ? target.asBinder() : null);
3037 data.writeInt(resultCode);
3038 data.writeBundle(results);
3039 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3040 reply.readException();
3041 data.recycle();
3042 reply.recycle();
3043 }
3044 public Configuration getConfiguration() throws RemoteException
3045 {
3046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3050 reply.readException();
3051 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3052 reply.recycle();
3053 data.recycle();
3054 return res;
3055 }
3056 public void updateConfiguration(Configuration values) throws RemoteException
3057 {
3058 Parcel data = Parcel.obtain();
3059 Parcel reply = Parcel.obtain();
3060 data.writeInterfaceToken(IActivityManager.descriptor);
3061 values.writeToParcel(data, 0);
3062 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3063 reply.readException();
3064 data.recycle();
3065 reply.recycle();
3066 }
3067 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3068 throws RemoteException {
3069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 data.writeStrongBinder(token);
3073 data.writeInt(requestedOrientation);
3074 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 data.recycle();
3077 reply.recycle();
3078 }
3079 public int getRequestedOrientation(IBinder token) throws RemoteException {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeStrongBinder(token);
3084 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 int res = reply.readInt();
3087 data.recycle();
3088 reply.recycle();
3089 return res;
3090 }
3091 public ComponentName getActivityClassForToken(IBinder token)
3092 throws RemoteException {
3093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 data.writeStrongBinder(token);
3097 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3098 reply.readException();
3099 ComponentName res = ComponentName.readFromParcel(reply);
3100 data.recycle();
3101 reply.recycle();
3102 return res;
3103 }
3104 public String getPackageForToken(IBinder token) throws RemoteException
3105 {
3106 Parcel data = Parcel.obtain();
3107 Parcel reply = Parcel.obtain();
3108 data.writeInterfaceToken(IActivityManager.descriptor);
3109 data.writeStrongBinder(token);
3110 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3111 reply.readException();
3112 String res = reply.readString();
3113 data.recycle();
3114 reply.recycle();
3115 return res;
3116 }
3117 public IIntentSender getIntentSender(int type,
3118 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003119 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003120 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003121 Parcel data = Parcel.obtain();
3122 Parcel reply = Parcel.obtain();
3123 data.writeInterfaceToken(IActivityManager.descriptor);
3124 data.writeInt(type);
3125 data.writeString(packageName);
3126 data.writeStrongBinder(token);
3127 data.writeString(resultWho);
3128 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003129 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003130 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003131 data.writeTypedArray(intents, 0);
3132 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003133 } else {
3134 data.writeInt(0);
3135 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003136 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003137 if (options != null) {
3138 data.writeInt(1);
3139 options.writeToParcel(data, 0);
3140 } else {
3141 data.writeInt(0);
3142 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003143 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003144 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 IIntentSender res = IIntentSender.Stub.asInterface(
3147 reply.readStrongBinder());
3148 data.recycle();
3149 reply.recycle();
3150 return res;
3151 }
3152 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3153 Parcel data = Parcel.obtain();
3154 Parcel reply = Parcel.obtain();
3155 data.writeInterfaceToken(IActivityManager.descriptor);
3156 data.writeStrongBinder(sender.asBinder());
3157 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3158 reply.readException();
3159 data.recycle();
3160 reply.recycle();
3161 }
3162 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3163 Parcel data = Parcel.obtain();
3164 Parcel reply = Parcel.obtain();
3165 data.writeInterfaceToken(IActivityManager.descriptor);
3166 data.writeStrongBinder(sender.asBinder());
3167 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3168 reply.readException();
3169 String res = reply.readString();
3170 data.recycle();
3171 reply.recycle();
3172 return res;
3173 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003174 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3175 Parcel data = Parcel.obtain();
3176 Parcel reply = Parcel.obtain();
3177 data.writeInterfaceToken(IActivityManager.descriptor);
3178 data.writeStrongBinder(sender.asBinder());
3179 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3180 reply.readException();
3181 int res = reply.readInt();
3182 data.recycle();
3183 reply.recycle();
3184 return res;
3185 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003186 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3187 boolean requireFull, String name, String callerPackage) throws RemoteException {
3188 Parcel data = Parcel.obtain();
3189 Parcel reply = Parcel.obtain();
3190 data.writeInterfaceToken(IActivityManager.descriptor);
3191 data.writeInt(callingPid);
3192 data.writeInt(callingUid);
3193 data.writeInt(userId);
3194 data.writeInt(allowAll ? 1 : 0);
3195 data.writeInt(requireFull ? 1 : 0);
3196 data.writeString(name);
3197 data.writeString(callerPackage);
3198 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 int res = reply.readInt();
3201 data.recycle();
3202 reply.recycle();
3203 return res;
3204 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003205 public void setProcessLimit(int max) throws RemoteException
3206 {
3207 Parcel data = Parcel.obtain();
3208 Parcel reply = Parcel.obtain();
3209 data.writeInterfaceToken(IActivityManager.descriptor);
3210 data.writeInt(max);
3211 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3212 reply.readException();
3213 data.recycle();
3214 reply.recycle();
3215 }
3216 public int getProcessLimit() throws RemoteException
3217 {
3218 Parcel data = Parcel.obtain();
3219 Parcel reply = Parcel.obtain();
3220 data.writeInterfaceToken(IActivityManager.descriptor);
3221 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3222 reply.readException();
3223 int res = reply.readInt();
3224 data.recycle();
3225 reply.recycle();
3226 return res;
3227 }
3228 public void setProcessForeground(IBinder token, int pid,
3229 boolean isForeground) throws RemoteException {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(token);
3234 data.writeInt(pid);
3235 data.writeInt(isForeground ? 1 : 0);
3236 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 data.recycle();
3239 reply.recycle();
3240 }
3241 public int checkPermission(String permission, int pid, int uid)
3242 throws RemoteException {
3243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 data.writeString(permission);
3247 data.writeInt(pid);
3248 data.writeInt(uid);
3249 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3250 reply.readException();
3251 int res = reply.readInt();
3252 data.recycle();
3253 reply.recycle();
3254 return res;
3255 }
3256 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003257 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 data.writeString(packageName);
3262 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003263 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003264 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3265 reply.readException();
3266 boolean res = reply.readInt() != 0;
3267 data.recycle();
3268 reply.recycle();
3269 return res;
3270 }
3271 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3272 throws RemoteException {
3273 Parcel data = Parcel.obtain();
3274 Parcel reply = Parcel.obtain();
3275 data.writeInterfaceToken(IActivityManager.descriptor);
3276 uri.writeToParcel(data, 0);
3277 data.writeInt(pid);
3278 data.writeInt(uid);
3279 data.writeInt(mode);
3280 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3281 reply.readException();
3282 int res = reply.readInt();
3283 data.recycle();
3284 reply.recycle();
3285 return res;
3286 }
3287 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3288 Uri uri, int mode) throws RemoteException {
3289 Parcel data = Parcel.obtain();
3290 Parcel reply = Parcel.obtain();
3291 data.writeInterfaceToken(IActivityManager.descriptor);
3292 data.writeStrongBinder(caller.asBinder());
3293 data.writeString(targetPkg);
3294 uri.writeToParcel(data, 0);
3295 data.writeInt(mode);
3296 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3297 reply.readException();
3298 data.recycle();
3299 reply.recycle();
3300 }
3301 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3302 int mode) throws RemoteException {
3303 Parcel data = Parcel.obtain();
3304 Parcel reply = Parcel.obtain();
3305 data.writeInterfaceToken(IActivityManager.descriptor);
3306 data.writeStrongBinder(caller.asBinder());
3307 uri.writeToParcel(data, 0);
3308 data.writeInt(mode);
3309 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3310 reply.readException();
3311 data.recycle();
3312 reply.recycle();
3313 }
3314 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3315 throws RemoteException {
3316 Parcel data = Parcel.obtain();
3317 Parcel reply = Parcel.obtain();
3318 data.writeInterfaceToken(IActivityManager.descriptor);
3319 data.writeStrongBinder(who.asBinder());
3320 data.writeInt(waiting ? 1 : 0);
3321 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3322 reply.readException();
3323 data.recycle();
3324 reply.recycle();
3325 }
3326 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
3330 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3331 reply.readException();
3332 outInfo.readFromParcel(reply);
3333 data.recycle();
3334 reply.recycle();
3335 }
3336 public void unhandledBack() throws RemoteException
3337 {
3338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 data.recycle();
3344 reply.recycle();
3345 }
3346 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3347 {
3348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3352 reply.readException();
3353 ParcelFileDescriptor pfd = null;
3354 if (reply.readInt() != 0) {
3355 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3356 }
3357 data.recycle();
3358 reply.recycle();
3359 return pfd;
3360 }
3361 public void goingToSleep() throws RemoteException
3362 {
3363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3367 reply.readException();
3368 data.recycle();
3369 reply.recycle();
3370 }
3371 public void wakingUp() throws RemoteException
3372 {
3373 Parcel data = Parcel.obtain();
3374 Parcel reply = Parcel.obtain();
3375 data.writeInterfaceToken(IActivityManager.descriptor);
3376 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3377 reply.readException();
3378 data.recycle();
3379 reply.recycle();
3380 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003381 public void setLockScreenShown(boolean shown) throws RemoteException
3382 {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
3386 data.writeInt(shown ? 1 : 0);
3387 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3388 reply.readException();
3389 data.recycle();
3390 reply.recycle();
3391 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003392 public void setDebugApp(
3393 String packageName, boolean waitForDebugger, boolean persistent)
3394 throws RemoteException
3395 {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 data.writeString(packageName);
3400 data.writeInt(waitForDebugger ? 1 : 0);
3401 data.writeInt(persistent ? 1 : 0);
3402 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3403 reply.readException();
3404 data.recycle();
3405 reply.recycle();
3406 }
3407 public void setAlwaysFinish(boolean enabled) throws RemoteException
3408 {
3409 Parcel data = Parcel.obtain();
3410 Parcel reply = Parcel.obtain();
3411 data.writeInterfaceToken(IActivityManager.descriptor);
3412 data.writeInt(enabled ? 1 : 0);
3413 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3414 reply.readException();
3415 data.recycle();
3416 reply.recycle();
3417 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003418 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003419 {
3420 Parcel data = Parcel.obtain();
3421 Parcel reply = Parcel.obtain();
3422 data.writeInterfaceToken(IActivityManager.descriptor);
3423 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003424 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003425 reply.readException();
3426 data.recycle();
3427 reply.recycle();
3428 }
3429 public void enterSafeMode() throws RemoteException {
3430 Parcel data = Parcel.obtain();
3431 data.writeInterfaceToken(IActivityManager.descriptor);
3432 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3433 data.recycle();
3434 }
3435 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3436 Parcel data = Parcel.obtain();
3437 data.writeStrongBinder(sender.asBinder());
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3440 data.recycle();
3441 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003442 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003443 Parcel data = Parcel.obtain();
3444 Parcel reply = Parcel.obtain();
3445 data.writeInterfaceToken(IActivityManager.descriptor);
3446 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003447 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003448 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003449 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003450 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003451 boolean res = reply.readInt() != 0;
3452 data.recycle();
3453 reply.recycle();
3454 return res;
3455 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003456 @Override
3457 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3458 Parcel data = Parcel.obtain();
3459 Parcel reply = Parcel.obtain();
3460 data.writeInterfaceToken(IActivityManager.descriptor);
3461 data.writeString(reason);
3462 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3463 boolean res = reply.readInt() != 0;
3464 data.recycle();
3465 reply.recycle();
3466 return res;
3467 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003468 public void startRunning(String pkg, String cls, String action,
3469 String indata) throws RemoteException {
3470 Parcel data = Parcel.obtain();
3471 Parcel reply = Parcel.obtain();
3472 data.writeInterfaceToken(IActivityManager.descriptor);
3473 data.writeString(pkg);
3474 data.writeString(cls);
3475 data.writeString(action);
3476 data.writeString(indata);
3477 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3478 reply.readException();
3479 data.recycle();
3480 reply.recycle();
3481 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003482 public boolean testIsSystemReady()
3483 {
3484 /* this base class version is never called */
3485 return true;
3486 }
Dan Egnor60d87622009-12-16 16:32:58 -08003487 public void handleApplicationCrash(IBinder app,
3488 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3489 {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 data.writeStrongBinder(app);
3494 crashInfo.writeToParcel(data, 0);
3495 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3496 reply.readException();
3497 reply.recycle();
3498 data.recycle();
3499 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003500
Dan Egnor60d87622009-12-16 16:32:58 -08003501 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003502 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003503 {
3504 Parcel data = Parcel.obtain();
3505 Parcel reply = Parcel.obtain();
3506 data.writeInterfaceToken(IActivityManager.descriptor);
3507 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003508 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003509 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003510 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003511 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003512 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003513 reply.recycle();
3514 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003515 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003516 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003517
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003518 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003519 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003520 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003521 {
3522 Parcel data = Parcel.obtain();
3523 Parcel reply = Parcel.obtain();
3524 data.writeInterfaceToken(IActivityManager.descriptor);
3525 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003526 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003527 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003528 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3529 reply.readException();
3530 reply.recycle();
3531 data.recycle();
3532 }
3533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003534 public void signalPersistentProcesses(int sig) throws RemoteException {
3535 Parcel data = Parcel.obtain();
3536 Parcel reply = Parcel.obtain();
3537 data.writeInterfaceToken(IActivityManager.descriptor);
3538 data.writeInt(sig);
3539 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3540 reply.readException();
3541 data.recycle();
3542 reply.recycle();
3543 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003544
Dianne Hackborn1676c852012-09-10 14:52:30 -07003545 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003550 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003551 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3552 reply.readException();
3553 data.recycle();
3554 reply.recycle();
3555 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003556
3557 public void killAllBackgroundProcesses() throws RemoteException {
3558 Parcel data = Parcel.obtain();
3559 Parcel reply = Parcel.obtain();
3560 data.writeInterfaceToken(IActivityManager.descriptor);
3561 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 data.recycle();
3564 reply.recycle();
3565 }
3566
Dianne Hackborn1676c852012-09-10 14:52:30 -07003567 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003568 Parcel data = Parcel.obtain();
3569 Parcel reply = Parcel.obtain();
3570 data.writeInterfaceToken(IActivityManager.descriptor);
3571 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003572 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003573 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003574 reply.readException();
3575 data.recycle();
3576 reply.recycle();
3577 }
3578
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003579 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3580 throws RemoteException
3581 {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3586 reply.readException();
3587 outInfo.readFromParcel(reply);
3588 reply.recycle();
3589 data.recycle();
3590 }
3591
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003592 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3593 {
3594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3598 reply.readException();
3599 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3600 reply.recycle();
3601 data.recycle();
3602 return res;
3603 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003604
Dianne Hackborn1676c852012-09-10 14:52:30 -07003605 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003606 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003607 {
3608 Parcel data = Parcel.obtain();
3609 Parcel reply = Parcel.obtain();
3610 data.writeInterfaceToken(IActivityManager.descriptor);
3611 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003612 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003613 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003614 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003615 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003616 if (fd != null) {
3617 data.writeInt(1);
3618 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3619 } else {
3620 data.writeInt(0);
3621 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003622 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3623 reply.readException();
3624 boolean res = reply.readInt() != 0;
3625 reply.recycle();
3626 data.recycle();
3627 return res;
3628 }
3629
Dianne Hackborn55280a92009-05-07 15:53:46 -07003630 public boolean shutdown(int timeout) throws RemoteException
3631 {
3632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeInt(timeout);
3636 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3637 reply.readException();
3638 boolean res = reply.readInt() != 0;
3639 reply.recycle();
3640 data.recycle();
3641 return res;
3642 }
3643
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003644 public void stopAppSwitches() throws RemoteException {
3645 Parcel data = Parcel.obtain();
3646 Parcel reply = Parcel.obtain();
3647 data.writeInterfaceToken(IActivityManager.descriptor);
3648 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3649 reply.readException();
3650 reply.recycle();
3651 data.recycle();
3652 }
3653
3654 public void resumeAppSwitches() throws RemoteException {
3655 Parcel data = Parcel.obtain();
3656 Parcel reply = Parcel.obtain();
3657 data.writeInterfaceToken(IActivityManager.descriptor);
3658 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3659 reply.readException();
3660 reply.recycle();
3661 data.recycle();
3662 }
3663
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003664 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003665 Parcel data = Parcel.obtain();
3666 Parcel reply = Parcel.obtain();
3667 data.writeInterfaceToken(IActivityManager.descriptor);
3668 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003669 data.writeInt(appid);
3670 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003671 reply.readException();
3672 data.recycle();
3673 reply.recycle();
3674 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003675
3676 public void closeSystemDialogs(String reason) throws RemoteException {
3677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 data.writeString(reason);
3681 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3682 reply.readException();
3683 data.recycle();
3684 reply.recycle();
3685 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003686
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003687 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003688 throws RemoteException {
3689 Parcel data = Parcel.obtain();
3690 Parcel reply = Parcel.obtain();
3691 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003692 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003693 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3694 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003695 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003696 data.recycle();
3697 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003698 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003699 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003700
3701 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3702 Parcel data = Parcel.obtain();
3703 Parcel reply = Parcel.obtain();
3704 data.writeInterfaceToken(IActivityManager.descriptor);
3705 data.writeString(processName);
3706 data.writeInt(uid);
3707 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3708 reply.readException();
3709 data.recycle();
3710 reply.recycle();
3711 }
3712
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003713 public void overridePendingTransition(IBinder token, String packageName,
3714 int enterAnim, int exitAnim) throws RemoteException {
3715 Parcel data = Parcel.obtain();
3716 Parcel reply = Parcel.obtain();
3717 data.writeInterfaceToken(IActivityManager.descriptor);
3718 data.writeStrongBinder(token);
3719 data.writeString(packageName);
3720 data.writeInt(enterAnim);
3721 data.writeInt(exitAnim);
3722 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3723 reply.readException();
3724 data.recycle();
3725 reply.recycle();
3726 }
3727
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003728 public boolean isUserAMonkey() throws RemoteException {
3729 Parcel data = Parcel.obtain();
3730 Parcel reply = Parcel.obtain();
3731 data.writeInterfaceToken(IActivityManager.descriptor);
3732 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3733 reply.readException();
3734 boolean res = reply.readInt() != 0;
3735 data.recycle();
3736 reply.recycle();
3737 return res;
3738 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003739
3740 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3741 Parcel data = Parcel.obtain();
3742 Parcel reply = Parcel.obtain();
3743 data.writeInterfaceToken(IActivityManager.descriptor);
3744 data.writeInt(monkey ? 1 : 0);
3745 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3746 reply.readException();
3747 data.recycle();
3748 reply.recycle();
3749 }
3750
Dianne Hackborn860755f2010-06-03 18:47:52 -07003751 public void finishHeavyWeightApp() throws RemoteException {
3752 Parcel data = Parcel.obtain();
3753 Parcel reply = Parcel.obtain();
3754 data.writeInterfaceToken(IActivityManager.descriptor);
3755 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3756 reply.readException();
3757 data.recycle();
3758 reply.recycle();
3759 }
3760
Daniel Sandler69a48172010-06-23 16:29:36 -04003761 public void setImmersive(IBinder token, boolean immersive)
3762 throws RemoteException {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 data.writeStrongBinder(token);
3767 data.writeInt(immersive ? 1 : 0);
3768 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 data.recycle();
3771 reply.recycle();
3772 }
3773
3774 public boolean isImmersive(IBinder token)
3775 throws RemoteException {
3776 Parcel data = Parcel.obtain();
3777 Parcel reply = Parcel.obtain();
3778 data.writeInterfaceToken(IActivityManager.descriptor);
3779 data.writeStrongBinder(token);
3780 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003781 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003782 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003783 data.recycle();
3784 reply.recycle();
3785 return res;
3786 }
3787
3788 public boolean isTopActivityImmersive()
3789 throws RemoteException {
3790 Parcel data = Parcel.obtain();
3791 Parcel reply = Parcel.obtain();
3792 data.writeInterfaceToken(IActivityManager.descriptor);
3793 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003794 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003795 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003796 data.recycle();
3797 reply.recycle();
3798 return res;
3799 }
3800
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003801 public void crashApplication(int uid, int initialPid, String packageName,
3802 String message) throws RemoteException {
3803 Parcel data = Parcel.obtain();
3804 Parcel reply = Parcel.obtain();
3805 data.writeInterfaceToken(IActivityManager.descriptor);
3806 data.writeInt(uid);
3807 data.writeInt(initialPid);
3808 data.writeString(packageName);
3809 data.writeString(message);
3810 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3811 reply.readException();
3812 data.recycle();
3813 reply.recycle();
3814 }
Andy McFadden824c5102010-07-09 16:26:57 -07003815
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003816 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003817 Parcel data = Parcel.obtain();
3818 Parcel reply = Parcel.obtain();
3819 data.writeInterfaceToken(IActivityManager.descriptor);
3820 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003821 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003822 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3823 reply.readException();
3824 String res = reply.readString();
3825 data.recycle();
3826 reply.recycle();
3827 return res;
3828 }
3829
Dianne Hackborn7e269642010-08-25 19:50:20 -07003830 public IBinder newUriPermissionOwner(String name)
3831 throws RemoteException {
3832 Parcel data = Parcel.obtain();
3833 Parcel reply = Parcel.obtain();
3834 data.writeInterfaceToken(IActivityManager.descriptor);
3835 data.writeString(name);
3836 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3837 reply.readException();
3838 IBinder res = reply.readStrongBinder();
3839 data.recycle();
3840 reply.recycle();
3841 return res;
3842 }
3843
3844 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3845 Uri uri, int mode) throws RemoteException {
3846 Parcel data = Parcel.obtain();
3847 Parcel reply = Parcel.obtain();
3848 data.writeInterfaceToken(IActivityManager.descriptor);
3849 data.writeStrongBinder(owner);
3850 data.writeInt(fromUid);
3851 data.writeString(targetPkg);
3852 uri.writeToParcel(data, 0);
3853 data.writeInt(mode);
3854 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3855 reply.readException();
3856 data.recycle();
3857 reply.recycle();
3858 }
3859
3860 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3861 int mode) throws RemoteException {
3862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 data.writeStrongBinder(owner);
3866 if (uri != null) {
3867 data.writeInt(1);
3868 uri.writeToParcel(data, 0);
3869 } else {
3870 data.writeInt(0);
3871 }
3872 data.writeInt(mode);
3873 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3874 reply.readException();
3875 data.recycle();
3876 reply.recycle();
3877 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003878
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003879 public int checkGrantUriPermission(int callingUid, String targetPkg,
3880 Uri uri, int modeFlags) throws RemoteException {
3881 Parcel data = Parcel.obtain();
3882 Parcel reply = Parcel.obtain();
3883 data.writeInterfaceToken(IActivityManager.descriptor);
3884 data.writeInt(callingUid);
3885 data.writeString(targetPkg);
3886 uri.writeToParcel(data, 0);
3887 data.writeInt(modeFlags);
3888 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3889 reply.readException();
3890 int res = reply.readInt();
3891 data.recycle();
3892 reply.recycle();
3893 return res;
3894 }
3895
Dianne Hackborn1676c852012-09-10 14:52:30 -07003896 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003897 String path, ParcelFileDescriptor fd) throws RemoteException {
3898 Parcel data = Parcel.obtain();
3899 Parcel reply = Parcel.obtain();
3900 data.writeInterfaceToken(IActivityManager.descriptor);
3901 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003902 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003903 data.writeInt(managed ? 1 : 0);
3904 data.writeString(path);
3905 if (fd != null) {
3906 data.writeInt(1);
3907 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3908 } else {
3909 data.writeInt(0);
3910 }
3911 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 boolean res = reply.readInt() != 0;
3914 reply.recycle();
3915 data.recycle();
3916 return res;
3917 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003918
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003919 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003920 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003921 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003922 Parcel data = Parcel.obtain();
3923 Parcel reply = Parcel.obtain();
3924 data.writeInterfaceToken(IActivityManager.descriptor);
3925 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003926 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003927 data.writeTypedArray(intents, 0);
3928 data.writeStringArray(resolvedTypes);
3929 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003930 if (options != null) {
3931 data.writeInt(1);
3932 options.writeToParcel(data, 0);
3933 } else {
3934 data.writeInt(0);
3935 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003936 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003937 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3938 reply.readException();
3939 int result = reply.readInt();
3940 reply.recycle();
3941 data.recycle();
3942 return result;
3943 }
3944
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003945 public int getFrontActivityScreenCompatMode() throws RemoteException {
3946 Parcel data = Parcel.obtain();
3947 Parcel reply = Parcel.obtain();
3948 data.writeInterfaceToken(IActivityManager.descriptor);
3949 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3950 reply.readException();
3951 int mode = reply.readInt();
3952 reply.recycle();
3953 data.recycle();
3954 return mode;
3955 }
3956
3957 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3958 Parcel data = Parcel.obtain();
3959 Parcel reply = Parcel.obtain();
3960 data.writeInterfaceToken(IActivityManager.descriptor);
3961 data.writeInt(mode);
3962 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3963 reply.readException();
3964 reply.recycle();
3965 data.recycle();
3966 }
3967
3968 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3969 Parcel data = Parcel.obtain();
3970 Parcel reply = Parcel.obtain();
3971 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003972 data.writeString(packageName);
3973 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003974 reply.readException();
3975 int mode = reply.readInt();
3976 reply.recycle();
3977 data.recycle();
3978 return mode;
3979 }
3980
3981 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003982 throws RemoteException {
3983 Parcel data = Parcel.obtain();
3984 Parcel reply = Parcel.obtain();
3985 data.writeInterfaceToken(IActivityManager.descriptor);
3986 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003987 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003988 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3989 reply.readException();
3990 reply.recycle();
3991 data.recycle();
3992 }
3993
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003994 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3995 Parcel data = Parcel.obtain();
3996 Parcel reply = Parcel.obtain();
3997 data.writeInterfaceToken(IActivityManager.descriptor);
3998 data.writeString(packageName);
3999 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4000 reply.readException();
4001 boolean ask = reply.readInt() != 0;
4002 reply.recycle();
4003 data.recycle();
4004 return ask;
4005 }
4006
4007 public void setPackageAskScreenCompat(String packageName, boolean ask)
4008 throws RemoteException {
4009 Parcel data = Parcel.obtain();
4010 Parcel reply = Parcel.obtain();
4011 data.writeInterfaceToken(IActivityManager.descriptor);
4012 data.writeString(packageName);
4013 data.writeInt(ask ? 1 : 0);
4014 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4015 reply.readException();
4016 reply.recycle();
4017 data.recycle();
4018 }
4019
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004020 public boolean switchUser(int userid) throws RemoteException {
4021 Parcel data = Parcel.obtain();
4022 Parcel reply = Parcel.obtain();
4023 data.writeInterfaceToken(IActivityManager.descriptor);
4024 data.writeInt(userid);
4025 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4026 reply.readException();
4027 boolean result = reply.readInt() != 0;
4028 reply.recycle();
4029 data.recycle();
4030 return result;
4031 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004032
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004033 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4034 Parcel data = Parcel.obtain();
4035 Parcel reply = Parcel.obtain();
4036 data.writeInterfaceToken(IActivityManager.descriptor);
4037 data.writeInt(userid);
4038 data.writeStrongInterface(callback);
4039 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4040 reply.readException();
4041 int result = reply.readInt();
4042 reply.recycle();
4043 data.recycle();
4044 return result;
4045 }
4046
Amith Yamasani52f1d752012-03-28 18:19:29 -07004047 public UserInfo getCurrentUser() throws RemoteException {
4048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004051 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004052 reply.readException();
4053 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4054 reply.recycle();
4055 data.recycle();
4056 return userInfo;
4057 }
4058
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004059 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004064 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004065 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 boolean result = reply.readInt() != 0;
4068 reply.recycle();
4069 data.recycle();
4070 return result;
4071 }
4072
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004073 public int[] getRunningUserIds() throws RemoteException {
4074 Parcel data = Parcel.obtain();
4075 Parcel reply = Parcel.obtain();
4076 data.writeInterfaceToken(IActivityManager.descriptor);
4077 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4078 reply.readException();
4079 int[] result = reply.createIntArray();
4080 reply.recycle();
4081 data.recycle();
4082 return result;
4083 }
4084
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004085 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4086 Parcel data = Parcel.obtain();
4087 Parcel reply = Parcel.obtain();
4088 data.writeInterfaceToken(IActivityManager.descriptor);
4089 data.writeInt(taskId);
4090 data.writeInt(subTaskIndex);
4091 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4092 reply.readException();
4093 boolean result = reply.readInt() != 0;
4094 reply.recycle();
4095 data.recycle();
4096 return result;
4097 }
4098
4099 public boolean removeTask(int taskId, int flags) throws RemoteException {
4100 Parcel data = Parcel.obtain();
4101 Parcel reply = Parcel.obtain();
4102 data.writeInterfaceToken(IActivityManager.descriptor);
4103 data.writeInt(taskId);
4104 data.writeInt(flags);
4105 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4106 reply.readException();
4107 boolean result = reply.readInt() != 0;
4108 reply.recycle();
4109 data.recycle();
4110 return result;
4111 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004112
Jeff Sharkeya4620792011-05-20 15:29:23 -07004113 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4114 Parcel data = Parcel.obtain();
4115 Parcel reply = Parcel.obtain();
4116 data.writeInterfaceToken(IActivityManager.descriptor);
4117 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4118 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4119 reply.readException();
4120 data.recycle();
4121 reply.recycle();
4122 }
4123
4124 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4125 Parcel data = Parcel.obtain();
4126 Parcel reply = Parcel.obtain();
4127 data.writeInterfaceToken(IActivityManager.descriptor);
4128 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4129 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4130 reply.readException();
4131 data.recycle();
4132 reply.recycle();
4133 }
4134
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004135 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4136 Parcel data = Parcel.obtain();
4137 Parcel reply = Parcel.obtain();
4138 data.writeInterfaceToken(IActivityManager.descriptor);
4139 data.writeStrongBinder(sender.asBinder());
4140 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4141 reply.readException();
4142 boolean res = reply.readInt() != 0;
4143 data.recycle();
4144 reply.recycle();
4145 return res;
4146 }
4147
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004148 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4149 Parcel data = Parcel.obtain();
4150 Parcel reply = Parcel.obtain();
4151 data.writeInterfaceToken(IActivityManager.descriptor);
4152 data.writeStrongBinder(sender.asBinder());
4153 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4154 reply.readException();
4155 boolean res = reply.readInt() != 0;
4156 data.recycle();
4157 reply.recycle();
4158 return res;
4159 }
4160
Dianne Hackborn81038902012-11-26 17:04:09 -08004161 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4162 Parcel data = Parcel.obtain();
4163 Parcel reply = Parcel.obtain();
4164 data.writeInterfaceToken(IActivityManager.descriptor);
4165 data.writeStrongBinder(sender.asBinder());
4166 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4167 reply.readException();
4168 Intent res = reply.readInt() != 0
4169 ? Intent.CREATOR.createFromParcel(reply) : null;
4170 data.recycle();
4171 reply.recycle();
4172 return res;
4173 }
4174
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004175 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4176 {
4177 Parcel data = Parcel.obtain();
4178 Parcel reply = Parcel.obtain();
4179 data.writeInterfaceToken(IActivityManager.descriptor);
4180 values.writeToParcel(data, 0);
4181 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4182 reply.readException();
4183 data.recycle();
4184 reply.recycle();
4185 }
4186
Dianne Hackbornb437e092011-08-05 17:50:29 -07004187 public long[] getProcessPss(int[] pids) throws RemoteException {
4188 Parcel data = Parcel.obtain();
4189 Parcel reply = Parcel.obtain();
4190 data.writeInterfaceToken(IActivityManager.descriptor);
4191 data.writeIntArray(pids);
4192 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4193 reply.readException();
4194 long[] res = reply.createLongArray();
4195 data.recycle();
4196 reply.recycle();
4197 return res;
4198 }
4199
Dianne Hackborn661cd522011-08-22 00:26:20 -07004200 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4201 Parcel data = Parcel.obtain();
4202 Parcel reply = Parcel.obtain();
4203 data.writeInterfaceToken(IActivityManager.descriptor);
4204 TextUtils.writeToParcel(msg, data, 0);
4205 data.writeInt(always ? 1 : 0);
4206 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4207 reply.readException();
4208 data.recycle();
4209 reply.recycle();
4210 }
4211
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004212 public void dismissKeyguardOnNextActivity() throws RemoteException {
4213 Parcel data = Parcel.obtain();
4214 Parcel reply = Parcel.obtain();
4215 data.writeInterfaceToken(IActivityManager.descriptor);
4216 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4217 reply.readException();
4218 data.recycle();
4219 reply.recycle();
4220 }
4221
Adam Powelldd8fab22012-03-22 17:47:27 -07004222 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4223 throws RemoteException {
4224 Parcel data = Parcel.obtain();
4225 Parcel reply = Parcel.obtain();
4226 data.writeInterfaceToken(IActivityManager.descriptor);
4227 data.writeStrongBinder(token);
4228 data.writeString(destAffinity);
4229 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4230 reply.readException();
4231 boolean result = reply.readInt() != 0;
4232 data.recycle();
4233 reply.recycle();
4234 return result;
4235 }
4236
4237 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4238 throws RemoteException {
4239 Parcel data = Parcel.obtain();
4240 Parcel reply = Parcel.obtain();
4241 data.writeInterfaceToken(IActivityManager.descriptor);
4242 data.writeStrongBinder(token);
4243 target.writeToParcel(data, 0);
4244 data.writeInt(resultCode);
4245 if (resultData != null) {
4246 data.writeInt(1);
4247 resultData.writeToParcel(data, 0);
4248 } else {
4249 data.writeInt(0);
4250 }
4251 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4252 reply.readException();
4253 boolean result = reply.readInt() != 0;
4254 data.recycle();
4255 reply.recycle();
4256 return result;
4257 }
4258
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004259 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4260 Parcel data = Parcel.obtain();
4261 Parcel reply = Parcel.obtain();
4262 data.writeInterfaceToken(IActivityManager.descriptor);
4263 data.writeStrongBinder(activityToken);
4264 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4265 reply.readException();
4266 int result = reply.readInt();
4267 data.recycle();
4268 reply.recycle();
4269 return result;
4270 }
4271
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004272 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 data.writeStrongBinder(activityToken);
4277 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4278 reply.readException();
4279 String result = reply.readString();
4280 data.recycle();
4281 reply.recycle();
4282 return result;
4283 }
4284
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004285 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4286 Parcel data = Parcel.obtain();
4287 Parcel reply = Parcel.obtain();
4288 data.writeInterfaceToken(IActivityManager.descriptor);
4289 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4290 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4291 reply.readException();
4292 data.recycle();
4293 reply.recycle();
4294 }
4295
4296 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4297 Parcel data = Parcel.obtain();
4298 Parcel reply = Parcel.obtain();
4299 data.writeInterfaceToken(IActivityManager.descriptor);
4300 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4301 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4302 reply.readException();
4303 data.recycle();
4304 reply.recycle();
4305 }
4306
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004307 public void requestBugReport() throws RemoteException {
4308 Parcel data = Parcel.obtain();
4309 Parcel reply = Parcel.obtain();
4310 data.writeInterfaceToken(IActivityManager.descriptor);
4311 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4312 reply.readException();
4313 data.recycle();
4314 reply.recycle();
4315 }
4316
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004317 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4318 Parcel data = Parcel.obtain();
4319 Parcel reply = Parcel.obtain();
4320 data.writeInterfaceToken(IActivityManager.descriptor);
4321 data.writeInt(pid);
4322 data.writeInt(aboveSystem ? 1 : 0);
4323 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4324 reply.readException();
4325 long res = reply.readInt();
4326 data.recycle();
4327 reply.recycle();
4328 return res;
4329 }
4330
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004331 public Bundle getTopActivityExtras(int requestType) throws RemoteException {
4332 Parcel data = Parcel.obtain();
4333 Parcel reply = Parcel.obtain();
4334 data.writeInterfaceToken(IActivityManager.descriptor);
4335 data.writeInt(requestType);
4336 mRemote.transact(GET_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4337 reply.readException();
4338 Bundle res = reply.readBundle();
4339 data.recycle();
4340 reply.recycle();
4341 return res;
4342 }
4343
4344 public void reportTopActivityExtras(IBinder token, Bundle extras) throws RemoteException {
4345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 data.writeStrongBinder(token);
4349 data.writeBundle(extras);
4350 mRemote.transact(REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4351 reply.readException();
4352 data.recycle();
4353 reply.recycle();
4354 }
4355
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004356 public void killUid(int uid, String reason) throws RemoteException {
4357 Parcel data = Parcel.obtain();
4358 Parcel reply = Parcel.obtain();
4359 data.writeInterfaceToken(IActivityManager.descriptor);
4360 data.writeInt(uid);
4361 data.writeString(reason);
4362 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4363 reply.readException();
4364 data.recycle();
4365 reply.recycle();
4366 }
4367
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004368 private IBinder mRemote;
4369}