blob: 50c508c577dceb8e42ebb3b6372c56791c6b8654 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070020import android.content.IIntentReceiver;
21import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Intent;
23import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070028import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.res.Configuration;
30import android.graphics.Bitmap;
31import android.net.Uri;
32import android.os.Binder;
33import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070034import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.os.IBinder;
36import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070037import android.os.ParcelFileDescriptor;
38import android.os.Parcelable;
39import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070041import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080044import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import java.util.ArrayList;
47import java.util.List;
48
49/** {@hide} */
50public abstract class ActivityManagerNative extends Binder implements IActivityManager
51{
52 /**
53 * Cast a Binder object into an activity manager interface, generating
54 * a proxy if needed.
55 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080056 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 if (obj == null) {
58 return null;
59 }
60 IActivityManager in =
61 (IActivityManager)obj.queryLocalInterface(descriptor);
62 if (in != null) {
63 return in;
64 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 return new ActivityManagerProxy(obj);
67 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 /**
70 * Retrieve the system's default/global activity manager.
71 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072 static public IActivityManager getDefault() {
73 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 }
75
76 /**
77 * Convenience for checking whether the system is ready. For internal use only.
78 */
79 static public boolean isSystemReady() {
80 if (!sSystemReady) {
81 sSystemReady = getDefault().testIsSystemReady();
82 }
83 return sSystemReady;
84 }
85 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 /**
88 * Convenience for sending a sticky broadcast. For internal use only.
89 * If you don't care about permission, use null.
90 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070091 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 try {
93 getDefault().broadcastIntent(
94 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -080095 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 } catch (RemoteException ex) {
97 }
98 }
99
100 static public void noteWakeupAlarm(PendingIntent ps) {
101 try {
102 getDefault().noteWakeupAlarm(ps.getTarget());
103 } catch (RemoteException ex) {
104 }
105 }
106
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800107 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 attachInterface(this, descriptor);
109 }
110
111 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
112 throws RemoteException {
113 switch (code) {
114 case START_ACTIVITY_TRANSACTION:
115 {
116 data.enforceInterface(IActivityManager.descriptor);
117 IBinder b = data.readStrongBinder();
118 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800119 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 Intent intent = Intent.CREATOR.createFromParcel(data);
121 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800123 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700125 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700126 String profileFile = data.readString();
127 ParcelFileDescriptor profileFd = data.readInt() != 0
128 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700129 Bundle options = data.readInt() != 0
130 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800131 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 resultTo, resultWho, requestCode, startFlags,
133 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 reply.writeNoException();
135 reply.writeInt(result);
136 return true;
137 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700138
Amith Yamasani82644082012-08-03 13:09:11 -0700139 case START_ACTIVITY_AS_USER_TRANSACTION:
140 {
141 data.enforceInterface(IActivityManager.descriptor);
142 IBinder b = data.readStrongBinder();
143 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800144 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700145 Intent intent = Intent.CREATOR.createFromParcel(data);
146 String resolvedType = data.readString();
147 IBinder resultTo = data.readStrongBinder();
148 String resultWho = data.readString();
149 int requestCode = data.readInt();
150 int startFlags = data.readInt();
151 String profileFile = data.readString();
152 ParcelFileDescriptor profileFd = data.readInt() != 0
153 ? data.readFileDescriptor() : null;
154 Bundle options = data.readInt() != 0
155 ? Bundle.CREATOR.createFromParcel(data) : null;
156 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800157 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700158 resultTo, resultWho, requestCode, startFlags,
159 profileFile, profileFd, options, userId);
160 reply.writeNoException();
161 reply.writeInt(result);
162 return true;
163 }
164
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800165 case START_ACTIVITY_AND_WAIT_TRANSACTION:
166 {
167 data.enforceInterface(IActivityManager.descriptor);
168 IBinder b = data.readStrongBinder();
169 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800170 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800171 Intent intent = Intent.CREATOR.createFromParcel(data);
172 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800174 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800175 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700176 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700177 String profileFile = data.readString();
178 ParcelFileDescriptor profileFd = data.readInt() != 0
179 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700180 Bundle options = data.readInt() != 0
181 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700182 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800183 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700185 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800186 reply.writeNoException();
187 result.writeToParcel(reply, 0);
188 return true;
189 }
190
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700191 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
192 {
193 data.enforceInterface(IActivityManager.descriptor);
194 IBinder b = data.readStrongBinder();
195 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800196 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700197 Intent intent = Intent.CREATOR.createFromParcel(data);
198 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 IBinder resultTo = data.readStrongBinder();
200 String resultWho = data.readString();
201 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700202 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700204 Bundle options = data.readInt() != 0
205 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700206 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800207 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700208 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700209 reply.writeNoException();
210 reply.writeInt(result);
211 return true;
212 }
213
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700214 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700215 {
216 data.enforceInterface(IActivityManager.descriptor);
217 IBinder b = data.readStrongBinder();
218 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700219 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700220 Intent fillInIntent = null;
221 if (data.readInt() != 0) {
222 fillInIntent = Intent.CREATOR.createFromParcel(data);
223 }
224 String resolvedType = data.readString();
225 IBinder resultTo = data.readStrongBinder();
226 String resultWho = data.readString();
227 int requestCode = data.readInt();
228 int flagsMask = data.readInt();
229 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 Bundle options = data.readInt() != 0
231 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700232 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700233 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 reply.writeNoException();
236 reply.writeInt(result);
237 return true;
238 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239
240 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
241 {
242 data.enforceInterface(IActivityManager.descriptor);
243 IBinder callingActivity = data.readStrongBinder();
244 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700245 Bundle options = data.readInt() != 0
246 ? Bundle.CREATOR.createFromParcel(data) : null;
247 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 reply.writeNoException();
249 reply.writeInt(result ? 1 : 0);
250 return true;
251 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 case FINISH_ACTIVITY_TRANSACTION: {
254 data.enforceInterface(IActivityManager.descriptor);
255 IBinder token = data.readStrongBinder();
256 Intent resultData = null;
257 int resultCode = data.readInt();
258 if (data.readInt() != 0) {
259 resultData = Intent.CREATOR.createFromParcel(data);
260 }
261 boolean res = finishActivity(token, resultCode, resultData);
262 reply.writeNoException();
263 reply.writeInt(res ? 1 : 0);
264 return true;
265 }
266
267 case FINISH_SUB_ACTIVITY_TRANSACTION: {
268 data.enforceInterface(IActivityManager.descriptor);
269 IBinder token = data.readStrongBinder();
270 String resultWho = data.readString();
271 int requestCode = data.readInt();
272 finishSubActivity(token, resultWho, requestCode);
273 reply.writeNoException();
274 return true;
275 }
276
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700277 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
278 data.enforceInterface(IActivityManager.descriptor);
279 IBinder token = data.readStrongBinder();
280 boolean res = finishActivityAffinity(token);
281 reply.writeNoException();
282 reply.writeInt(res ? 1 : 0);
283 return true;
284 }
285
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800286 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
287 data.enforceInterface(IActivityManager.descriptor);
288 IBinder token = data.readStrongBinder();
289 boolean res = willActivityBeVisible(token);
290 reply.writeNoException();
291 reply.writeInt(res ? 1 : 0);
292 return true;
293 }
294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 case REGISTER_RECEIVER_TRANSACTION:
296 {
297 data.enforceInterface(IActivityManager.descriptor);
298 IBinder b = data.readStrongBinder();
299 IApplicationThread app =
300 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700301 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800302 b = data.readStrongBinder();
303 IIntentReceiver rec
304 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
305 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
306 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700307 int userId = data.readInt();
308 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800309 reply.writeNoException();
310 if (intent != null) {
311 reply.writeInt(1);
312 intent.writeToParcel(reply, 0);
313 } else {
314 reply.writeInt(0);
315 }
316 return true;
317 }
318
319 case UNREGISTER_RECEIVER_TRANSACTION:
320 {
321 data.enforceInterface(IActivityManager.descriptor);
322 IBinder b = data.readStrongBinder();
323 if (b == null) {
324 return true;
325 }
326 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
327 unregisterReceiver(rec);
328 reply.writeNoException();
329 return true;
330 }
331
332 case BROADCAST_INTENT_TRANSACTION:
333 {
334 data.enforceInterface(IActivityManager.descriptor);
335 IBinder b = data.readStrongBinder();
336 IApplicationThread app =
337 b != null ? ApplicationThreadNative.asInterface(b) : null;
338 Intent intent = Intent.CREATOR.createFromParcel(data);
339 String resolvedType = data.readString();
340 b = data.readStrongBinder();
341 IIntentReceiver resultTo =
342 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
343 int resultCode = data.readInt();
344 String resultData = data.readString();
345 Bundle resultExtras = data.readBundle();
346 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800347 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 boolean serialized = data.readInt() != 0;
349 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700350 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800352 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700353 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res);
356 return true;
357 }
358
359 case UNBROADCAST_INTENT_TRANSACTION:
360 {
361 data.enforceInterface(IActivityManager.descriptor);
362 IBinder b = data.readStrongBinder();
363 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
364 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700365 int userId = data.readInt();
366 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800367 reply.writeNoException();
368 return true;
369 }
370
371 case FINISH_RECEIVER_TRANSACTION: {
372 data.enforceInterface(IActivityManager.descriptor);
373 IBinder who = data.readStrongBinder();
374 int resultCode = data.readInt();
375 String resultData = data.readString();
376 Bundle resultExtras = data.readBundle();
377 boolean resultAbort = data.readInt() != 0;
378 if (who != null) {
379 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
380 }
381 reply.writeNoException();
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case ATTACH_APPLICATION_TRANSACTION: {
386 data.enforceInterface(IActivityManager.descriptor);
387 IApplicationThread app = ApplicationThreadNative.asInterface(
388 data.readStrongBinder());
389 if (app != null) {
390 attachApplication(app);
391 }
392 reply.writeNoException();
393 return true;
394 }
395
396 case ACTIVITY_IDLE_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700399 Configuration config = null;
400 if (data.readInt() != 0) {
401 config = Configuration.CREATOR.createFromParcel(data);
402 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700403 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800404 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700405 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 }
407 reply.writeNoException();
408 return true;
409 }
410
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700411 case ACTIVITY_RESUMED_TRANSACTION: {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder token = data.readStrongBinder();
414 activityResumed(token);
415 reply.writeNoException();
416 return true;
417 }
418
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 case ACTIVITY_PAUSED_TRANSACTION: {
420 data.enforceInterface(IActivityManager.descriptor);
421 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800422 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 reply.writeNoException();
424 return true;
425 }
426
427 case ACTIVITY_STOPPED_TRANSACTION: {
428 data.enforceInterface(IActivityManager.descriptor);
429 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800430 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 Bitmap thumbnail = data.readInt() != 0
432 ? Bitmap.CREATOR.createFromParcel(data) : null;
433 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800434 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800435 reply.writeNoException();
436 return true;
437 }
438
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800439 case ACTIVITY_SLEPT_TRANSACTION: {
440 data.enforceInterface(IActivityManager.descriptor);
441 IBinder token = data.readStrongBinder();
442 activitySlept(token);
443 reply.writeNoException();
444 return true;
445 }
446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 case ACTIVITY_DESTROYED_TRANSACTION: {
448 data.enforceInterface(IActivityManager.descriptor);
449 IBinder token = data.readStrongBinder();
450 activityDestroyed(token);
451 reply.writeNoException();
452 return true;
453 }
454
455 case GET_CALLING_PACKAGE_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
458 String res = token != null ? getCallingPackage(token) : null;
459 reply.writeNoException();
460 reply.writeString(res);
461 return true;
462 }
463
464 case GET_CALLING_ACTIVITY_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
467 ComponentName cn = getCallingActivity(token);
468 reply.writeNoException();
469 ComponentName.writeToParcel(cn, reply);
470 return true;
471 }
472
473 case GET_TASKS_TRANSACTION: {
474 data.enforceInterface(IActivityManager.descriptor);
475 int maxNum = data.readInt();
476 int fl = data.readInt();
477 IBinder receiverBinder = data.readStrongBinder();
478 IThumbnailReceiver receiver = receiverBinder != null
479 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
480 : null;
481 List list = getTasks(maxNum, fl, receiver);
482 reply.writeNoException();
483 int N = list != null ? list.size() : -1;
484 reply.writeInt(N);
485 int i;
486 for (i=0; i<N; i++) {
487 ActivityManager.RunningTaskInfo info =
488 (ActivityManager.RunningTaskInfo)list.get(i);
489 info.writeToParcel(reply, 0);
490 }
491 return true;
492 }
493
494 case GET_RECENT_TASKS_TRANSACTION: {
495 data.enforceInterface(IActivityManager.descriptor);
496 int maxNum = data.readInt();
497 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700498 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700500 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 reply.writeNoException();
502 reply.writeTypedList(list);
503 return true;
504 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700505
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700506 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800507 data.enforceInterface(IActivityManager.descriptor);
508 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700509 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800510 reply.writeNoException();
511 if (bm != null) {
512 reply.writeInt(1);
513 bm.writeToParcel(reply, 0);
514 } else {
515 reply.writeInt(0);
516 }
517 return true;
518 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700519
520 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
521 data.enforceInterface(IActivityManager.descriptor);
522 int id = data.readInt();
523 Bitmap bm = getTaskTopThumbnail(id);
524 reply.writeNoException();
525 if (bm != null) {
526 reply.writeInt(1);
527 bm.writeToParcel(reply, 0);
528 } else {
529 reply.writeInt(0);
530 }
531 return true;
532 }
533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 case GET_SERVICES_TRANSACTION: {
535 data.enforceInterface(IActivityManager.descriptor);
536 int maxNum = data.readInt();
537 int fl = data.readInt();
538 List list = getServices(maxNum, fl);
539 reply.writeNoException();
540 int N = list != null ? list.size() : -1;
541 reply.writeInt(N);
542 int i;
543 for (i=0; i<N; i++) {
544 ActivityManager.RunningServiceInfo info =
545 (ActivityManager.RunningServiceInfo)list.get(i);
546 info.writeToParcel(reply, 0);
547 }
548 return true;
549 }
550
551 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
552 data.enforceInterface(IActivityManager.descriptor);
553 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
554 reply.writeNoException();
555 reply.writeTypedList(list);
556 return true;
557 }
558
559 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
560 data.enforceInterface(IActivityManager.descriptor);
561 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
562 reply.writeNoException();
563 reply.writeTypedList(list);
564 return true;
565 }
566
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700567 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 List<ApplicationInfo> list = getRunningExternalApplications();
570 reply.writeNoException();
571 reply.writeTypedList(list);
572 return true;
573 }
574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 case MOVE_TASK_TO_FRONT_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800578 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700579 Bundle options = data.readInt() != 0
580 ? Bundle.CREATOR.createFromParcel(data) : null;
581 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 reply.writeNoException();
583 return true;
584 }
585
586 case MOVE_TASK_TO_BACK_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 int task = data.readInt();
589 moveTaskToBack(task);
590 reply.writeNoException();
591 return true;
592 }
593
594 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder token = data.readStrongBinder();
597 boolean nonRoot = data.readInt() != 0;
598 boolean res = moveActivityTaskToBack(token, nonRoot);
599 reply.writeNoException();
600 reply.writeInt(res ? 1 : 0);
601 return true;
602 }
603
604 case MOVE_TASK_BACKWARDS_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 int task = data.readInt();
607 moveTaskBackwards(task);
608 reply.writeNoException();
609 return true;
610 }
611
612 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
614 IBinder token = data.readStrongBinder();
615 boolean onlyRoot = data.readInt() != 0;
616 int res = token != null
617 ? getTaskForActivity(token, onlyRoot) : -1;
618 reply.writeNoException();
619 reply.writeInt(res);
620 return true;
621 }
622
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 case REPORT_THUMBNAIL_TRANSACTION: {
624 data.enforceInterface(IActivityManager.descriptor);
625 IBinder token = data.readStrongBinder();
626 Bitmap thumbnail = data.readInt() != 0
627 ? Bitmap.CREATOR.createFromParcel(data) : null;
628 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
629 reportThumbnail(token, thumbnail, description);
630 reply.writeNoException();
631 return true;
632 }
633
634 case GET_CONTENT_PROVIDER_TRANSACTION: {
635 data.enforceInterface(IActivityManager.descriptor);
636 IBinder b = data.readStrongBinder();
637 IApplicationThread app = ApplicationThreadNative.asInterface(b);
638 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700639 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700640 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700641 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 reply.writeNoException();
643 if (cph != null) {
644 reply.writeInt(1);
645 cph.writeToParcel(reply, 0);
646 } else {
647 reply.writeInt(0);
648 }
649 return true;
650 }
651
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800652 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
653 data.enforceInterface(IActivityManager.descriptor);
654 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700655 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800656 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700657 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800658 reply.writeNoException();
659 if (cph != null) {
660 reply.writeInt(1);
661 cph.writeToParcel(reply, 0);
662 } else {
663 reply.writeInt(0);
664 }
665 return true;
666 }
667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
669 data.enforceInterface(IActivityManager.descriptor);
670 IBinder b = data.readStrongBinder();
671 IApplicationThread app = ApplicationThreadNative.asInterface(b);
672 ArrayList<ContentProviderHolder> providers =
673 data.createTypedArrayList(ContentProviderHolder.CREATOR);
674 publishContentProviders(app, providers);
675 reply.writeNoException();
676 return true;
677 }
678
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700679 case REF_CONTENT_PROVIDER_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 IBinder b = data.readStrongBinder();
682 int stable = data.readInt();
683 int unstable = data.readInt();
684 boolean res = refContentProvider(b, stable, unstable);
685 reply.writeNoException();
686 reply.writeInt(res ? 1 : 0);
687 return true;
688 }
689
690 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
691 data.enforceInterface(IActivityManager.descriptor);
692 IBinder b = data.readStrongBinder();
693 unstableProviderDied(b);
694 reply.writeNoException();
695 return true;
696 }
697
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
699 data.enforceInterface(IActivityManager.descriptor);
700 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700701 boolean stable = data.readInt() != 0;
702 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 reply.writeNoException();
704 return true;
705 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800706
707 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 String name = data.readString();
710 IBinder token = data.readStrongBinder();
711 removeContentProviderExternal(name, token);
712 reply.writeNoException();
713 return true;
714 }
715
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700716 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
717 data.enforceInterface(IActivityManager.descriptor);
718 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
719 PendingIntent pi = getRunningServiceControlPanel(comp);
720 reply.writeNoException();
721 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
722 return true;
723 }
724
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800725 case START_SERVICE_TRANSACTION: {
726 data.enforceInterface(IActivityManager.descriptor);
727 IBinder b = data.readStrongBinder();
728 IApplicationThread app = ApplicationThreadNative.asInterface(b);
729 Intent service = Intent.CREATOR.createFromParcel(data);
730 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700731 int userId = data.readInt();
732 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800733 reply.writeNoException();
734 ComponentName.writeToParcel(cn, reply);
735 return true;
736 }
737
738 case STOP_SERVICE_TRANSACTION: {
739 data.enforceInterface(IActivityManager.descriptor);
740 IBinder b = data.readStrongBinder();
741 IApplicationThread app = ApplicationThreadNative.asInterface(b);
742 Intent service = Intent.CREATOR.createFromParcel(data);
743 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700744 int userId = data.readInt();
745 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 reply.writeNoException();
747 reply.writeInt(res);
748 return true;
749 }
750
751 case STOP_SERVICE_TOKEN_TRANSACTION: {
752 data.enforceInterface(IActivityManager.descriptor);
753 ComponentName className = ComponentName.readFromParcel(data);
754 IBinder token = data.readStrongBinder();
755 int startId = data.readInt();
756 boolean res = stopServiceToken(className, token, startId);
757 reply.writeNoException();
758 reply.writeInt(res ? 1 : 0);
759 return true;
760 }
761
762 case SET_SERVICE_FOREGROUND_TRANSACTION: {
763 data.enforceInterface(IActivityManager.descriptor);
764 ComponentName className = ComponentName.readFromParcel(data);
765 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700766 int id = data.readInt();
767 Notification notification = null;
768 if (data.readInt() != 0) {
769 notification = Notification.CREATOR.createFromParcel(data);
770 }
771 boolean removeNotification = data.readInt() != 0;
772 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 reply.writeNoException();
774 return true;
775 }
776
777 case BIND_SERVICE_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder b = data.readStrongBinder();
780 IApplicationThread app = ApplicationThreadNative.asInterface(b);
781 IBinder token = data.readStrongBinder();
782 Intent service = Intent.CREATOR.createFromParcel(data);
783 String resolvedType = data.readString();
784 b = data.readStrongBinder();
785 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800786 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800788 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 reply.writeNoException();
790 reply.writeInt(res);
791 return true;
792 }
793
794 case UNBIND_SERVICE_TRANSACTION: {
795 data.enforceInterface(IActivityManager.descriptor);
796 IBinder b = data.readStrongBinder();
797 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
798 boolean res = unbindService(conn);
799 reply.writeNoException();
800 reply.writeInt(res ? 1 : 0);
801 return true;
802 }
803
804 case PUBLISH_SERVICE_TRANSACTION: {
805 data.enforceInterface(IActivityManager.descriptor);
806 IBinder token = data.readStrongBinder();
807 Intent intent = Intent.CREATOR.createFromParcel(data);
808 IBinder service = data.readStrongBinder();
809 publishService(token, intent, service);
810 reply.writeNoException();
811 return true;
812 }
813
814 case UNBIND_FINISHED_TRANSACTION: {
815 data.enforceInterface(IActivityManager.descriptor);
816 IBinder token = data.readStrongBinder();
817 Intent intent = Intent.CREATOR.createFromParcel(data);
818 boolean doRebind = data.readInt() != 0;
819 unbindFinished(token, intent, doRebind);
820 reply.writeNoException();
821 return true;
822 }
823
824 case SERVICE_DONE_EXECUTING_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700827 int type = data.readInt();
828 int startId = data.readInt();
829 int res = data.readInt();
830 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800831 reply.writeNoException();
832 return true;
833 }
834
835 case START_INSTRUMENTATION_TRANSACTION: {
836 data.enforceInterface(IActivityManager.descriptor);
837 ComponentName className = ComponentName.readFromParcel(data);
838 String profileFile = data.readString();
839 int fl = data.readInt();
840 Bundle arguments = data.readBundle();
841 IBinder b = data.readStrongBinder();
842 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800843 b = data.readStrongBinder();
844 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700845 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800846 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800847 reply.writeNoException();
848 reply.writeInt(res ? 1 : 0);
849 return true;
850 }
851
852
853 case FINISH_INSTRUMENTATION_TRANSACTION: {
854 data.enforceInterface(IActivityManager.descriptor);
855 IBinder b = data.readStrongBinder();
856 IApplicationThread app = ApplicationThreadNative.asInterface(b);
857 int resultCode = data.readInt();
858 Bundle results = data.readBundle();
859 finishInstrumentation(app, resultCode, results);
860 reply.writeNoException();
861 return true;
862 }
863
864 case GET_CONFIGURATION_TRANSACTION: {
865 data.enforceInterface(IActivityManager.descriptor);
866 Configuration config = getConfiguration();
867 reply.writeNoException();
868 config.writeToParcel(reply, 0);
869 return true;
870 }
871
872 case UPDATE_CONFIGURATION_TRANSACTION: {
873 data.enforceInterface(IActivityManager.descriptor);
874 Configuration config = Configuration.CREATOR.createFromParcel(data);
875 updateConfiguration(config);
876 reply.writeNoException();
877 return true;
878 }
879
880 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
881 data.enforceInterface(IActivityManager.descriptor);
882 IBinder token = data.readStrongBinder();
883 int requestedOrientation = data.readInt();
884 setRequestedOrientation(token, requestedOrientation);
885 reply.writeNoException();
886 return true;
887 }
888
889 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
890 data.enforceInterface(IActivityManager.descriptor);
891 IBinder token = data.readStrongBinder();
892 int req = getRequestedOrientation(token);
893 reply.writeNoException();
894 reply.writeInt(req);
895 return true;
896 }
897
898 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
899 data.enforceInterface(IActivityManager.descriptor);
900 IBinder token = data.readStrongBinder();
901 ComponentName cn = getActivityClassForToken(token);
902 reply.writeNoException();
903 ComponentName.writeToParcel(cn, reply);
904 return true;
905 }
906
907 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 IBinder token = data.readStrongBinder();
910 reply.writeNoException();
911 reply.writeString(getPackageForToken(token));
912 return true;
913 }
914
915 case GET_INTENT_SENDER_TRANSACTION: {
916 data.enforceInterface(IActivityManager.descriptor);
917 int type = data.readInt();
918 String packageName = data.readString();
919 IBinder token = data.readStrongBinder();
920 String resultWho = data.readString();
921 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800922 Intent[] requestIntents;
923 String[] requestResolvedTypes;
924 if (data.readInt() != 0) {
925 requestIntents = data.createTypedArray(Intent.CREATOR);
926 requestResolvedTypes = data.createStringArray();
927 } else {
928 requestIntents = null;
929 requestResolvedTypes = null;
930 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700932 Bundle options = data.readInt() != 0
933 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700934 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800935 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800936 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700937 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 reply.writeNoException();
939 reply.writeStrongBinder(res != null ? res.asBinder() : null);
940 return true;
941 }
942
943 case CANCEL_INTENT_SENDER_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 IIntentSender r = IIntentSender.Stub.asInterface(
946 data.readStrongBinder());
947 cancelIntentSender(r);
948 reply.writeNoException();
949 return true;
950 }
951
952 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
953 data.enforceInterface(IActivityManager.descriptor);
954 IIntentSender r = IIntentSender.Stub.asInterface(
955 data.readStrongBinder());
956 String res = getPackageForIntentSender(r);
957 reply.writeNoException();
958 reply.writeString(res);
959 return true;
960 }
961
Christopher Tatec4a07d12012-04-06 14:19:13 -0700962 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
963 data.enforceInterface(IActivityManager.descriptor);
964 IIntentSender r = IIntentSender.Stub.asInterface(
965 data.readStrongBinder());
966 int res = getUidForIntentSender(r);
967 reply.writeNoException();
968 reply.writeInt(res);
969 return true;
970 }
971
Dianne Hackborn41203752012-08-31 14:05:51 -0700972 case HANDLE_INCOMING_USER_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 int callingPid = data.readInt();
975 int callingUid = data.readInt();
976 int userId = data.readInt();
977 boolean allowAll = data.readInt() != 0 ;
978 boolean requireFull = data.readInt() != 0;
979 String name = data.readString();
980 String callerPackage = data.readString();
981 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
982 requireFull, name, callerPackage);
983 reply.writeNoException();
984 reply.writeInt(res);
985 return true;
986 }
987
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800988 case SET_PROCESS_LIMIT_TRANSACTION: {
989 data.enforceInterface(IActivityManager.descriptor);
990 int max = data.readInt();
991 setProcessLimit(max);
992 reply.writeNoException();
993 return true;
994 }
995
996 case GET_PROCESS_LIMIT_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 int limit = getProcessLimit();
999 reply.writeNoException();
1000 reply.writeInt(limit);
1001 return true;
1002 }
1003
1004 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IBinder token = data.readStrongBinder();
1007 int pid = data.readInt();
1008 boolean isForeground = data.readInt() != 0;
1009 setProcessForeground(token, pid, isForeground);
1010 reply.writeNoException();
1011 return true;
1012 }
1013
1014 case CHECK_PERMISSION_TRANSACTION: {
1015 data.enforceInterface(IActivityManager.descriptor);
1016 String perm = data.readString();
1017 int pid = data.readInt();
1018 int uid = data.readInt();
1019 int res = checkPermission(perm, pid, uid);
1020 reply.writeNoException();
1021 reply.writeInt(res);
1022 return true;
1023 }
1024
1025 case CHECK_URI_PERMISSION_TRANSACTION: {
1026 data.enforceInterface(IActivityManager.descriptor);
1027 Uri uri = Uri.CREATOR.createFromParcel(data);
1028 int pid = data.readInt();
1029 int uid = data.readInt();
1030 int mode = data.readInt();
1031 int res = checkUriPermission(uri, pid, uid, mode);
1032 reply.writeNoException();
1033 reply.writeInt(res);
1034 return true;
1035 }
1036
1037 case CLEAR_APP_DATA_TRANSACTION: {
1038 data.enforceInterface(IActivityManager.descriptor);
1039 String packageName = data.readString();
1040 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1041 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001042 int userId = data.readInt();
1043 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001044 reply.writeNoException();
1045 reply.writeInt(res ? 1 : 0);
1046 return true;
1047 }
1048
1049 case GRANT_URI_PERMISSION_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 IBinder b = data.readStrongBinder();
1052 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1053 String targetPkg = data.readString();
1054 Uri uri = Uri.CREATOR.createFromParcel(data);
1055 int mode = data.readInt();
1056 grantUriPermission(app, targetPkg, uri, mode);
1057 reply.writeNoException();
1058 return true;
1059 }
1060
1061 case REVOKE_URI_PERMISSION_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder b = data.readStrongBinder();
1064 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1065 Uri uri = Uri.CREATOR.createFromParcel(data);
1066 int mode = data.readInt();
1067 revokeUriPermission(app, uri, mode);
1068 reply.writeNoException();
1069 return true;
1070 }
1071
1072 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1073 data.enforceInterface(IActivityManager.descriptor);
1074 IBinder b = data.readStrongBinder();
1075 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1076 boolean waiting = data.readInt() != 0;
1077 showWaitingForDebugger(app, waiting);
1078 reply.writeNoException();
1079 return true;
1080 }
1081
1082 case GET_MEMORY_INFO_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
1084 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1085 getMemoryInfo(mi);
1086 reply.writeNoException();
1087 mi.writeToParcel(reply, 0);
1088 return true;
1089 }
1090
1091 case UNHANDLED_BACK_TRANSACTION: {
1092 data.enforceInterface(IActivityManager.descriptor);
1093 unhandledBack();
1094 reply.writeNoException();
1095 return true;
1096 }
1097
1098 case OPEN_CONTENT_URI_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 Uri uri = Uri.parse(data.readString());
1101 ParcelFileDescriptor pfd = openContentUri(uri);
1102 reply.writeNoException();
1103 if (pfd != null) {
1104 reply.writeInt(1);
1105 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1106 } else {
1107 reply.writeInt(0);
1108 }
1109 return true;
1110 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001111
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001112 case GOING_TO_SLEEP_TRANSACTION: {
1113 data.enforceInterface(IActivityManager.descriptor);
1114 goingToSleep();
1115 reply.writeNoException();
1116 return true;
1117 }
1118
1119 case WAKING_UP_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
1121 wakingUp();
1122 reply.writeNoException();
1123 return true;
1124 }
1125
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001126 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 setLockScreenShown(data.readInt() != 0);
1129 reply.writeNoException();
1130 return true;
1131 }
1132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 case SET_DEBUG_APP_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 String pn = data.readString();
1136 boolean wfd = data.readInt() != 0;
1137 boolean per = data.readInt() != 0;
1138 setDebugApp(pn, wfd, per);
1139 reply.writeNoException();
1140 return true;
1141 }
1142
1143 case SET_ALWAYS_FINISH_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 boolean enabled = data.readInt() != 0;
1146 setAlwaysFinish(enabled);
1147 reply.writeNoException();
1148 return true;
1149 }
1150
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001151 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001153 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001154 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001155 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001156 return true;
1157 }
1158
1159 case ENTER_SAFE_MODE_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 enterSafeMode();
1162 reply.writeNoException();
1163 return true;
1164 }
1165
1166 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1167 data.enforceInterface(IActivityManager.descriptor);
1168 IIntentSender is = IIntentSender.Stub.asInterface(
1169 data.readStrongBinder());
1170 noteWakeupAlarm(is);
1171 reply.writeNoException();
1172 return true;
1173 }
1174
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001175 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 data.enforceInterface(IActivityManager.descriptor);
1177 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001178 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001179 boolean secure = data.readInt() != 0;
1180 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001181 reply.writeNoException();
1182 reply.writeInt(res ? 1 : 0);
1183 return true;
1184 }
1185
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001186 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 String reason = data.readString();
1189 boolean res = killProcessesBelowForeground(reason);
1190 reply.writeNoException();
1191 reply.writeInt(res ? 1 : 0);
1192 return true;
1193 }
1194
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001195 case START_RUNNING_TRANSACTION: {
1196 data.enforceInterface(IActivityManager.descriptor);
1197 String pkg = data.readString();
1198 String cls = data.readString();
1199 String action = data.readString();
1200 String indata = data.readString();
1201 startRunning(pkg, cls, action, indata);
1202 reply.writeNoException();
1203 return true;
1204 }
1205
Dan Egnor60d87622009-12-16 16:32:58 -08001206 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 IBinder app = data.readStrongBinder();
1209 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1210 handleApplicationCrash(app, ci);
1211 reply.writeNoException();
1212 return true;
1213 }
1214
1215 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 data.enforceInterface(IActivityManager.descriptor);
1217 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001219 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001220 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001221 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001222 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 return true;
1224 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001225
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001226 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1227 data.enforceInterface(IActivityManager.descriptor);
1228 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001229 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001230 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1231 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001232 reply.writeNoException();
1233 return true;
1234 }
1235
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001236 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1237 data.enforceInterface(IActivityManager.descriptor);
1238 int sig = data.readInt();
1239 signalPersistentProcesses(sig);
1240 reply.writeNoException();
1241 return true;
1242 }
1243
Dianne Hackborn03abb812010-01-04 18:43:19 -08001244 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1245 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001247 int userId = data.readInt();
1248 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001249 reply.writeNoException();
1250 return true;
1251 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001252
1253 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
1255 killAllBackgroundProcesses();
1256 reply.writeNoException();
1257 return true;
1258 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001259
1260 case FORCE_STOP_PACKAGE_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001263 int userId = data.readInt();
1264 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001265 reply.writeNoException();
1266 return true;
1267 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001268
1269 case GET_MY_MEMORY_STATE_TRANSACTION: {
1270 data.enforceInterface(IActivityManager.descriptor);
1271 ActivityManager.RunningAppProcessInfo info =
1272 new ActivityManager.RunningAppProcessInfo();
1273 getMyMemoryState(info);
1274 reply.writeNoException();
1275 info.writeToParcel(reply, 0);
1276 return true;
1277 }
1278
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001279 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 ConfigurationInfo config = getDeviceConfigurationInfo();
1282 reply.writeNoException();
1283 config.writeToParcel(reply, 0);
1284 return true;
1285 }
1286
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001287 case PROFILE_CONTROL_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
1289 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001290 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001291 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001292 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001293 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001294 ParcelFileDescriptor fd = data.readInt() != 0
1295 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001296 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001297 reply.writeNoException();
1298 reply.writeInt(res ? 1 : 0);
1299 return true;
1300 }
1301
Dianne Hackborn55280a92009-05-07 15:53:46 -07001302 case SHUTDOWN_TRANSACTION: {
1303 data.enforceInterface(IActivityManager.descriptor);
1304 boolean res = shutdown(data.readInt());
1305 reply.writeNoException();
1306 reply.writeInt(res ? 1 : 0);
1307 return true;
1308 }
1309
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001310 case STOP_APP_SWITCHES_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 stopAppSwitches();
1313 reply.writeNoException();
1314 return true;
1315 }
1316
1317 case RESUME_APP_SWITCHES_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 resumeAppSwitches();
1320 reply.writeNoException();
1321 return true;
1322 }
1323
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001324 case PEEK_SERVICE_TRANSACTION: {
1325 data.enforceInterface(IActivityManager.descriptor);
1326 Intent service = Intent.CREATOR.createFromParcel(data);
1327 String resolvedType = data.readString();
1328 IBinder binder = peekService(service, resolvedType);
1329 reply.writeNoException();
1330 reply.writeStrongBinder(binder);
1331 return true;
1332 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001333
1334 case START_BACKUP_AGENT_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
1336 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1337 int backupRestoreMode = data.readInt();
1338 boolean success = bindBackupAgent(info, backupRestoreMode);
1339 reply.writeNoException();
1340 reply.writeInt(success ? 1 : 0);
1341 return true;
1342 }
1343
1344 case BACKUP_AGENT_CREATED_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 String packageName = data.readString();
1347 IBinder agent = data.readStrongBinder();
1348 backupAgentCreated(packageName, agent);
1349 reply.writeNoException();
1350 return true;
1351 }
1352
1353 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
1355 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1356 unbindBackupAgent(info);
1357 reply.writeNoException();
1358 return true;
1359 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001360
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001361 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001362 data.enforceInterface(IActivityManager.descriptor);
1363 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001364 int appid = data.readInt();
1365 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001366 reply.writeNoException();
1367 return true;
1368 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001369
1370 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1371 data.enforceInterface(IActivityManager.descriptor);
1372 String reason = data.readString();
1373 closeSystemDialogs(reason);
1374 reply.writeNoException();
1375 return true;
1376 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001377
1378 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1379 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001380 int[] pids = data.createIntArray();
1381 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001382 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001383 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001384 return true;
1385 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001386
1387 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 String processName = data.readString();
1390 int uid = data.readInt();
1391 killApplicationProcess(processName, uid);
1392 reply.writeNoException();
1393 return true;
1394 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001395
1396 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1397 data.enforceInterface(IActivityManager.descriptor);
1398 IBinder token = data.readStrongBinder();
1399 String packageName = data.readString();
1400 int enterAnim = data.readInt();
1401 int exitAnim = data.readInt();
1402 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001403 reply.writeNoException();
1404 return true;
1405 }
1406
1407 case IS_USER_A_MONKEY_TRANSACTION: {
1408 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001409 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001410 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001411 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001412 return true;
1413 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001414
1415 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1416 data.enforceInterface(IActivityManager.descriptor);
1417 finishHeavyWeightApp();
1418 reply.writeNoException();
1419 return true;
1420 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001421
1422 case IS_IMMERSIVE_TRANSACTION: {
1423 data.enforceInterface(IActivityManager.descriptor);
1424 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001425 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001426 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001427 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001428 return true;
1429 }
1430
1431 case SET_IMMERSIVE_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 IBinder token = data.readStrongBinder();
1434 boolean imm = data.readInt() == 1;
1435 setImmersive(token, imm);
1436 reply.writeNoException();
1437 return true;
1438 }
1439
1440 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1441 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001442 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001443 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001444 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001445 return true;
1446 }
1447
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001448 case CRASH_APPLICATION_TRANSACTION: {
1449 data.enforceInterface(IActivityManager.descriptor);
1450 int uid = data.readInt();
1451 int initialPid = data.readInt();
1452 String packageName = data.readString();
1453 String message = data.readString();
1454 crashApplication(uid, initialPid, packageName, message);
1455 reply.writeNoException();
1456 return true;
1457 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001458
1459 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1460 data.enforceInterface(IActivityManager.descriptor);
1461 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001462 int userId = data.readInt();
1463 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001464 reply.writeNoException();
1465 reply.writeString(type);
1466 return true;
1467 }
1468
Dianne Hackborn7e269642010-08-25 19:50:20 -07001469 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 String name = data.readString();
1472 IBinder perm = newUriPermissionOwner(name);
1473 reply.writeNoException();
1474 reply.writeStrongBinder(perm);
1475 return true;
1476 }
1477
1478 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 IBinder owner = data.readStrongBinder();
1481 int fromUid = data.readInt();
1482 String targetPkg = data.readString();
1483 Uri uri = Uri.CREATOR.createFromParcel(data);
1484 int mode = data.readInt();
1485 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1486 reply.writeNoException();
1487 return true;
1488 }
1489
1490 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 IBinder owner = data.readStrongBinder();
1493 Uri uri = null;
1494 if (data.readInt() != 0) {
1495 Uri.CREATOR.createFromParcel(data);
1496 }
1497 int mode = data.readInt();
1498 revokeUriPermissionFromOwner(owner, uri, mode);
1499 reply.writeNoException();
1500 return true;
1501 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001502
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001503 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1504 data.enforceInterface(IActivityManager.descriptor);
1505 int callingUid = data.readInt();
1506 String targetPkg = data.readString();
1507 Uri uri = Uri.CREATOR.createFromParcel(data);
1508 int modeFlags = data.readInt();
1509 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1510 reply.writeNoException();
1511 reply.writeInt(res);
1512 return true;
1513 }
1514
Andy McFadden824c5102010-07-09 16:26:57 -07001515 case DUMP_HEAP_TRANSACTION: {
1516 data.enforceInterface(IActivityManager.descriptor);
1517 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001518 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001519 boolean managed = data.readInt() != 0;
1520 String path = data.readString();
1521 ParcelFileDescriptor fd = data.readInt() != 0
1522 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001523 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001524 reply.writeNoException();
1525 reply.writeInt(res ? 1 : 0);
1526 return true;
1527 }
1528
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001529 case START_ACTIVITIES_TRANSACTION:
1530 {
1531 data.enforceInterface(IActivityManager.descriptor);
1532 IBinder b = data.readStrongBinder();
1533 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001534 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001535 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1536 String[] resolvedTypes = data.createStringArray();
1537 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001538 Bundle options = data.readInt() != 0
1539 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001540 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001541 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001542 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001543 reply.writeNoException();
1544 reply.writeInt(result);
1545 return true;
1546 }
1547
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001548 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1549 {
1550 data.enforceInterface(IActivityManager.descriptor);
1551 int mode = getFrontActivityScreenCompatMode();
1552 reply.writeNoException();
1553 reply.writeInt(mode);
1554 return true;
1555 }
1556
1557 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1558 {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 int mode = data.readInt();
1561 setFrontActivityScreenCompatMode(mode);
1562 reply.writeNoException();
1563 reply.writeInt(mode);
1564 return true;
1565 }
1566
1567 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1568 {
1569 data.enforceInterface(IActivityManager.descriptor);
1570 String pkg = data.readString();
1571 int mode = getPackageScreenCompatMode(pkg);
1572 reply.writeNoException();
1573 reply.writeInt(mode);
1574 return true;
1575 }
1576
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001577 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1578 {
1579 data.enforceInterface(IActivityManager.descriptor);
1580 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001581 int mode = data.readInt();
1582 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001583 reply.writeNoException();
1584 return true;
1585 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001586
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001587 case SWITCH_USER_TRANSACTION: {
1588 data.enforceInterface(IActivityManager.descriptor);
1589 int userid = data.readInt();
1590 boolean result = switchUser(userid);
1591 reply.writeNoException();
1592 reply.writeInt(result ? 1 : 0);
1593 return true;
1594 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001595
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001596 case STOP_USER_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 int userid = data.readInt();
1599 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1600 data.readStrongBinder());
1601 int result = stopUser(userid, callback);
1602 reply.writeNoException();
1603 reply.writeInt(result);
1604 return true;
1605 }
1606
Amith Yamasani52f1d752012-03-28 18:19:29 -07001607 case GET_CURRENT_USER_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 UserInfo userInfo = getCurrentUser();
1610 reply.writeNoException();
1611 userInfo.writeToParcel(reply, 0);
1612 return true;
1613 }
1614
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001615 case IS_USER_RUNNING_TRANSACTION: {
1616 data.enforceInterface(IActivityManager.descriptor);
1617 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001618 boolean orStopping = data.readInt() != 0;
1619 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001620 reply.writeNoException();
1621 reply.writeInt(result ? 1 : 0);
1622 return true;
1623 }
1624
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001625 case GET_RUNNING_USER_IDS_TRANSACTION: {
1626 data.enforceInterface(IActivityManager.descriptor);
1627 int[] result = getRunningUserIds();
1628 reply.writeNoException();
1629 reply.writeIntArray(result);
1630 return true;
1631 }
1632
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001633 case REMOVE_SUB_TASK_TRANSACTION:
1634 {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 int taskId = data.readInt();
1637 int subTaskIndex = data.readInt();
1638 boolean result = removeSubTask(taskId, subTaskIndex);
1639 reply.writeNoException();
1640 reply.writeInt(result ? 1 : 0);
1641 return true;
1642 }
1643
1644 case REMOVE_TASK_TRANSACTION:
1645 {
1646 data.enforceInterface(IActivityManager.descriptor);
1647 int taskId = data.readInt();
1648 int fl = data.readInt();
1649 boolean result = removeTask(taskId, fl);
1650 reply.writeNoException();
1651 reply.writeInt(result ? 1 : 0);
1652 return true;
1653 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001654
Jeff Sharkeya4620792011-05-20 15:29:23 -07001655 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1656 data.enforceInterface(IActivityManager.descriptor);
1657 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1658 data.readStrongBinder());
1659 registerProcessObserver(observer);
1660 return true;
1661 }
1662
1663 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1666 data.readStrongBinder());
1667 unregisterProcessObserver(observer);
1668 return true;
1669 }
1670
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001671 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1672 {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 String pkg = data.readString();
1675 boolean ask = getPackageAskScreenCompat(pkg);
1676 reply.writeNoException();
1677 reply.writeInt(ask ? 1 : 0);
1678 return true;
1679 }
1680
1681 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1682 {
1683 data.enforceInterface(IActivityManager.descriptor);
1684 String pkg = data.readString();
1685 boolean ask = data.readInt() != 0;
1686 setPackageAskScreenCompat(pkg, ask);
1687 reply.writeNoException();
1688 return true;
1689 }
1690
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001691 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1692 data.enforceInterface(IActivityManager.descriptor);
1693 IIntentSender r = IIntentSender.Stub.asInterface(
1694 data.readStrongBinder());
1695 boolean res = isIntentSenderTargetedToPackage(r);
1696 reply.writeNoException();
1697 reply.writeInt(res ? 1 : 0);
1698 return true;
1699 }
1700
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001701 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1702 data.enforceInterface(IActivityManager.descriptor);
1703 IIntentSender r = IIntentSender.Stub.asInterface(
1704 data.readStrongBinder());
1705 boolean res = isIntentSenderAnActivity(r);
1706 reply.writeNoException();
1707 reply.writeInt(res ? 1 : 0);
1708 return true;
1709 }
1710
Dianne Hackborn81038902012-11-26 17:04:09 -08001711 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
1713 IIntentSender r = IIntentSender.Stub.asInterface(
1714 data.readStrongBinder());
1715 Intent intent = getIntentForIntentSender(r);
1716 reply.writeNoException();
1717 if (intent != null) {
1718 reply.writeInt(1);
1719 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1720 } else {
1721 reply.writeInt(0);
1722 }
1723 return true;
1724 }
1725
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001726 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1727 data.enforceInterface(IActivityManager.descriptor);
1728 Configuration config = Configuration.CREATOR.createFromParcel(data);
1729 updatePersistentConfiguration(config);
1730 reply.writeNoException();
1731 return true;
1732 }
1733
Dianne Hackbornb437e092011-08-05 17:50:29 -07001734 case GET_PROCESS_PSS_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 int[] pids = data.createIntArray();
1737 long[] pss = getProcessPss(pids);
1738 reply.writeNoException();
1739 reply.writeLongArray(pss);
1740 return true;
1741 }
1742
Dianne Hackborn661cd522011-08-22 00:26:20 -07001743 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1746 boolean always = data.readInt() != 0;
1747 showBootMessage(msg, always);
1748 reply.writeNoException();
1749 return true;
1750 }
1751
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001752 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1753 data.enforceInterface(IActivityManager.descriptor);
1754 dismissKeyguardOnNextActivity();
1755 reply.writeNoException();
1756 return true;
1757 }
1758
Adam Powelldd8fab22012-03-22 17:47:27 -07001759 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1760 data.enforceInterface(IActivityManager.descriptor);
1761 IBinder token = data.readStrongBinder();
1762 String destAffinity = data.readString();
1763 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1764 reply.writeNoException();
1765 reply.writeInt(res ? 1 : 0);
1766 return true;
1767 }
1768
1769 case NAVIGATE_UP_TO_TRANSACTION: {
1770 data.enforceInterface(IActivityManager.descriptor);
1771 IBinder token = data.readStrongBinder();
1772 Intent target = Intent.CREATOR.createFromParcel(data);
1773 int resultCode = data.readInt();
1774 Intent resultData = null;
1775 if (data.readInt() != 0) {
1776 resultData = Intent.CREATOR.createFromParcel(data);
1777 }
1778 boolean res = navigateUpTo(token, target, resultCode, resultData);
1779 reply.writeNoException();
1780 reply.writeInt(res ? 1 : 0);
1781 return true;
1782 }
1783
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001784 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1785 data.enforceInterface(IActivityManager.descriptor);
1786 IBinder token = data.readStrongBinder();
1787 int res = getLaunchedFromUid(token);
1788 reply.writeNoException();
1789 reply.writeInt(res);
1790 return true;
1791 }
1792
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001793 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1794 data.enforceInterface(IActivityManager.descriptor);
1795 IBinder token = data.readStrongBinder();
1796 String res = getLaunchedFromPackage(token);
1797 reply.writeNoException();
1798 reply.writeString(res);
1799 return true;
1800 }
1801
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001802 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1803 data.enforceInterface(IActivityManager.descriptor);
1804 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1805 data.readStrongBinder());
1806 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001807 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001808 return true;
1809 }
1810
1811 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1812 data.enforceInterface(IActivityManager.descriptor);
1813 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1814 data.readStrongBinder());
1815 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001816 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001817 return true;
1818 }
1819
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001820 case REQUEST_BUG_REPORT_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001823 reply.writeNoException();
1824 return true;
1825 }
1826
1827 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1828 data.enforceInterface(IActivityManager.descriptor);
1829 int pid = data.readInt();
1830 boolean aboveSystem = data.readInt() != 0;
1831 long res = inputDispatchingTimedOut(pid, aboveSystem);
1832 reply.writeNoException();
1833 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001834 return true;
1835 }
1836
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001837 case GET_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1838 data.enforceInterface(IActivityManager.descriptor);
1839 int requestType = data.readInt();
1840 Bundle res = getTopActivityExtras(requestType);
1841 reply.writeNoException();
1842 reply.writeBundle(res);
1843 return true;
1844 }
1845
1846 case REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 IBinder token = data.readStrongBinder();
1849 Bundle extras = data.readBundle();
1850 reportTopActivityExtras(token, extras);
1851 reply.writeNoException();
1852 return true;
1853 }
1854
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001855 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001856
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001857 return super.onTransact(code, data, reply, flags);
1858 }
1859
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001860 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001861 return this;
1862 }
1863
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001864 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1865 protected IActivityManager create() {
1866 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001867 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001868 Log.v("ActivityManager", "default service binder = " + b);
1869 }
1870 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001871 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001872 Log.v("ActivityManager", "default service = " + am);
1873 }
1874 return am;
1875 }
1876 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001877}
1878
1879class ActivityManagerProxy implements IActivityManager
1880{
1881 public ActivityManagerProxy(IBinder remote)
1882 {
1883 mRemote = remote;
1884 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001886 public IBinder asBinder()
1887 {
1888 return mRemote;
1889 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001890
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001891 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001892 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1893 int startFlags, String profileFile,
1894 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001895 Parcel data = Parcel.obtain();
1896 Parcel reply = Parcel.obtain();
1897 data.writeInterfaceToken(IActivityManager.descriptor);
1898 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001899 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001900 intent.writeToParcel(data, 0);
1901 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001902 data.writeStrongBinder(resultTo);
1903 data.writeString(resultWho);
1904 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001905 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001906 data.writeString(profileFile);
1907 if (profileFd != null) {
1908 data.writeInt(1);
1909 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1910 } else {
1911 data.writeInt(0);
1912 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001913 if (options != null) {
1914 data.writeInt(1);
1915 options.writeToParcel(data, 0);
1916 } else {
1917 data.writeInt(0);
1918 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001919 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1920 reply.readException();
1921 int result = reply.readInt();
1922 reply.recycle();
1923 data.recycle();
1924 return result;
1925 }
Amith Yamasani82644082012-08-03 13:09:11 -07001926
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001927 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07001928 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1929 int startFlags, String profileFile,
1930 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1931 Parcel data = Parcel.obtain();
1932 Parcel reply = Parcel.obtain();
1933 data.writeInterfaceToken(IActivityManager.descriptor);
1934 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001935 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07001936 intent.writeToParcel(data, 0);
1937 data.writeString(resolvedType);
1938 data.writeStrongBinder(resultTo);
1939 data.writeString(resultWho);
1940 data.writeInt(requestCode);
1941 data.writeInt(startFlags);
1942 data.writeString(profileFile);
1943 if (profileFd != null) {
1944 data.writeInt(1);
1945 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1946 } else {
1947 data.writeInt(0);
1948 }
1949 if (options != null) {
1950 data.writeInt(1);
1951 options.writeToParcel(data, 0);
1952 } else {
1953 data.writeInt(0);
1954 }
1955 data.writeInt(userId);
1956 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1957 reply.readException();
1958 int result = reply.readInt();
1959 reply.recycle();
1960 data.recycle();
1961 return result;
1962 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001963 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
1964 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001965 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001966 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001967 Parcel data = Parcel.obtain();
1968 Parcel reply = Parcel.obtain();
1969 data.writeInterfaceToken(IActivityManager.descriptor);
1970 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001971 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001972 intent.writeToParcel(data, 0);
1973 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001974 data.writeStrongBinder(resultTo);
1975 data.writeString(resultWho);
1976 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001977 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001978 data.writeString(profileFile);
1979 if (profileFd != null) {
1980 data.writeInt(1);
1981 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1982 } else {
1983 data.writeInt(0);
1984 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001985 if (options != null) {
1986 data.writeInt(1);
1987 options.writeToParcel(data, 0);
1988 } else {
1989 data.writeInt(0);
1990 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001991 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001992 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1993 reply.readException();
1994 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1995 reply.recycle();
1996 data.recycle();
1997 return result;
1998 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001999 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2000 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002001 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002002 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002003 Parcel data = Parcel.obtain();
2004 Parcel reply = Parcel.obtain();
2005 data.writeInterfaceToken(IActivityManager.descriptor);
2006 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002007 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002008 intent.writeToParcel(data, 0);
2009 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002010 data.writeStrongBinder(resultTo);
2011 data.writeString(resultWho);
2012 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002013 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002014 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002015 if (options != null) {
2016 data.writeInt(1);
2017 options.writeToParcel(data, 0);
2018 } else {
2019 data.writeInt(0);
2020 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002021 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002022 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2023 reply.readException();
2024 int result = reply.readInt();
2025 reply.recycle();
2026 data.recycle();
2027 return result;
2028 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002029 public int startActivityIntentSender(IApplicationThread caller,
2030 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002031 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002032 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002033 Parcel data = Parcel.obtain();
2034 Parcel reply = Parcel.obtain();
2035 data.writeInterfaceToken(IActivityManager.descriptor);
2036 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2037 intent.writeToParcel(data, 0);
2038 if (fillInIntent != null) {
2039 data.writeInt(1);
2040 fillInIntent.writeToParcel(data, 0);
2041 } else {
2042 data.writeInt(0);
2043 }
2044 data.writeString(resolvedType);
2045 data.writeStrongBinder(resultTo);
2046 data.writeString(resultWho);
2047 data.writeInt(requestCode);
2048 data.writeInt(flagsMask);
2049 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002050 if (options != null) {
2051 data.writeInt(1);
2052 options.writeToParcel(data, 0);
2053 } else {
2054 data.writeInt(0);
2055 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002056 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002057 reply.readException();
2058 int result = reply.readInt();
2059 reply.recycle();
2060 data.recycle();
2061 return result;
2062 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002063 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002064 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002065 Parcel data = Parcel.obtain();
2066 Parcel reply = Parcel.obtain();
2067 data.writeInterfaceToken(IActivityManager.descriptor);
2068 data.writeStrongBinder(callingActivity);
2069 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002070 if (options != null) {
2071 data.writeInt(1);
2072 options.writeToParcel(data, 0);
2073 } else {
2074 data.writeInt(0);
2075 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002076 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2077 reply.readException();
2078 int result = reply.readInt();
2079 reply.recycle();
2080 data.recycle();
2081 return result != 0;
2082 }
2083 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2084 throws RemoteException {
2085 Parcel data = Parcel.obtain();
2086 Parcel reply = Parcel.obtain();
2087 data.writeInterfaceToken(IActivityManager.descriptor);
2088 data.writeStrongBinder(token);
2089 data.writeInt(resultCode);
2090 if (resultData != null) {
2091 data.writeInt(1);
2092 resultData.writeToParcel(data, 0);
2093 } else {
2094 data.writeInt(0);
2095 }
2096 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2097 reply.readException();
2098 boolean res = reply.readInt() != 0;
2099 data.recycle();
2100 reply.recycle();
2101 return res;
2102 }
2103 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2104 {
2105 Parcel data = Parcel.obtain();
2106 Parcel reply = Parcel.obtain();
2107 data.writeInterfaceToken(IActivityManager.descriptor);
2108 data.writeStrongBinder(token);
2109 data.writeString(resultWho);
2110 data.writeInt(requestCode);
2111 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2112 reply.readException();
2113 data.recycle();
2114 reply.recycle();
2115 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002116 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2117 Parcel data = Parcel.obtain();
2118 Parcel reply = Parcel.obtain();
2119 data.writeInterfaceToken(IActivityManager.descriptor);
2120 data.writeStrongBinder(token);
2121 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2122 reply.readException();
2123 boolean res = reply.readInt() != 0;
2124 data.recycle();
2125 reply.recycle();
2126 return res;
2127 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002128 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2129 Parcel data = Parcel.obtain();
2130 Parcel reply = Parcel.obtain();
2131 data.writeInterfaceToken(IActivityManager.descriptor);
2132 data.writeStrongBinder(token);
2133 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2134 reply.readException();
2135 boolean res = reply.readInt() != 0;
2136 data.recycle();
2137 reply.recycle();
2138 return res;
2139 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002140 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002141 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002142 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002143 {
2144 Parcel data = Parcel.obtain();
2145 Parcel reply = Parcel.obtain();
2146 data.writeInterfaceToken(IActivityManager.descriptor);
2147 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002148 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002149 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2150 filter.writeToParcel(data, 0);
2151 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002152 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002153 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2154 reply.readException();
2155 Intent intent = null;
2156 int haveIntent = reply.readInt();
2157 if (haveIntent != 0) {
2158 intent = Intent.CREATOR.createFromParcel(reply);
2159 }
2160 reply.recycle();
2161 data.recycle();
2162 return intent;
2163 }
2164 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2165 {
2166 Parcel data = Parcel.obtain();
2167 Parcel reply = Parcel.obtain();
2168 data.writeInterfaceToken(IActivityManager.descriptor);
2169 data.writeStrongBinder(receiver.asBinder());
2170 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2171 reply.readException();
2172 data.recycle();
2173 reply.recycle();
2174 }
2175 public int broadcastIntent(IApplicationThread caller,
2176 Intent intent, String resolvedType, IIntentReceiver resultTo,
2177 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002178 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002179 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002180 {
2181 Parcel data = Parcel.obtain();
2182 Parcel reply = Parcel.obtain();
2183 data.writeInterfaceToken(IActivityManager.descriptor);
2184 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2185 intent.writeToParcel(data, 0);
2186 data.writeString(resolvedType);
2187 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2188 data.writeInt(resultCode);
2189 data.writeString(resultData);
2190 data.writeBundle(map);
2191 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002192 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002193 data.writeInt(serialized ? 1 : 0);
2194 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002195 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002196 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2197 reply.readException();
2198 int res = reply.readInt();
2199 reply.recycle();
2200 data.recycle();
2201 return res;
2202 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002203 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2204 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002205 {
2206 Parcel data = Parcel.obtain();
2207 Parcel reply = Parcel.obtain();
2208 data.writeInterfaceToken(IActivityManager.descriptor);
2209 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2210 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002211 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002212 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2213 reply.readException();
2214 data.recycle();
2215 reply.recycle();
2216 }
2217 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2218 {
2219 Parcel data = Parcel.obtain();
2220 Parcel reply = Parcel.obtain();
2221 data.writeInterfaceToken(IActivityManager.descriptor);
2222 data.writeStrongBinder(who);
2223 data.writeInt(resultCode);
2224 data.writeString(resultData);
2225 data.writeBundle(map);
2226 data.writeInt(abortBroadcast ? 1 : 0);
2227 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2228 reply.readException();
2229 data.recycle();
2230 reply.recycle();
2231 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002232 public void attachApplication(IApplicationThread app) throws RemoteException
2233 {
2234 Parcel data = Parcel.obtain();
2235 Parcel reply = Parcel.obtain();
2236 data.writeInterfaceToken(IActivityManager.descriptor);
2237 data.writeStrongBinder(app.asBinder());
2238 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2239 reply.readException();
2240 data.recycle();
2241 reply.recycle();
2242 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002243 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2244 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002245 {
2246 Parcel data = Parcel.obtain();
2247 Parcel reply = Parcel.obtain();
2248 data.writeInterfaceToken(IActivityManager.descriptor);
2249 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002250 if (config != null) {
2251 data.writeInt(1);
2252 config.writeToParcel(data, 0);
2253 } else {
2254 data.writeInt(0);
2255 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002256 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002257 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2258 reply.readException();
2259 data.recycle();
2260 reply.recycle();
2261 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002262 public void activityResumed(IBinder token) throws RemoteException
2263 {
2264 Parcel data = Parcel.obtain();
2265 Parcel reply = Parcel.obtain();
2266 data.writeInterfaceToken(IActivityManager.descriptor);
2267 data.writeStrongBinder(token);
2268 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2269 reply.readException();
2270 data.recycle();
2271 reply.recycle();
2272 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002273 public void activityPaused(IBinder token) throws RemoteException
2274 {
2275 Parcel data = Parcel.obtain();
2276 Parcel reply = Parcel.obtain();
2277 data.writeInterfaceToken(IActivityManager.descriptor);
2278 data.writeStrongBinder(token);
2279 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2280 reply.readException();
2281 data.recycle();
2282 reply.recycle();
2283 }
2284 public void activityStopped(IBinder token, Bundle state,
2285 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002286 {
2287 Parcel data = Parcel.obtain();
2288 Parcel reply = Parcel.obtain();
2289 data.writeInterfaceToken(IActivityManager.descriptor);
2290 data.writeStrongBinder(token);
2291 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002292 if (thumbnail != null) {
2293 data.writeInt(1);
2294 thumbnail.writeToParcel(data, 0);
2295 } else {
2296 data.writeInt(0);
2297 }
2298 TextUtils.writeToParcel(description, data, 0);
2299 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2300 reply.readException();
2301 data.recycle();
2302 reply.recycle();
2303 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002304 public void activitySlept(IBinder token) throws RemoteException
2305 {
2306 Parcel data = Parcel.obtain();
2307 Parcel reply = Parcel.obtain();
2308 data.writeInterfaceToken(IActivityManager.descriptor);
2309 data.writeStrongBinder(token);
2310 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2311 reply.readException();
2312 data.recycle();
2313 reply.recycle();
2314 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002315 public void activityDestroyed(IBinder token) throws RemoteException
2316 {
2317 Parcel data = Parcel.obtain();
2318 Parcel reply = Parcel.obtain();
2319 data.writeInterfaceToken(IActivityManager.descriptor);
2320 data.writeStrongBinder(token);
2321 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2322 reply.readException();
2323 data.recycle();
2324 reply.recycle();
2325 }
2326 public String getCallingPackage(IBinder token) throws RemoteException
2327 {
2328 Parcel data = Parcel.obtain();
2329 Parcel reply = Parcel.obtain();
2330 data.writeInterfaceToken(IActivityManager.descriptor);
2331 data.writeStrongBinder(token);
2332 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2333 reply.readException();
2334 String res = reply.readString();
2335 data.recycle();
2336 reply.recycle();
2337 return res;
2338 }
2339 public ComponentName getCallingActivity(IBinder token)
2340 throws RemoteException {
2341 Parcel data = Parcel.obtain();
2342 Parcel reply = Parcel.obtain();
2343 data.writeInterfaceToken(IActivityManager.descriptor);
2344 data.writeStrongBinder(token);
2345 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2346 reply.readException();
2347 ComponentName res = ComponentName.readFromParcel(reply);
2348 data.recycle();
2349 reply.recycle();
2350 return res;
2351 }
2352 public List getTasks(int maxNum, int flags,
2353 IThumbnailReceiver receiver) throws RemoteException {
2354 Parcel data = Parcel.obtain();
2355 Parcel reply = Parcel.obtain();
2356 data.writeInterfaceToken(IActivityManager.descriptor);
2357 data.writeInt(maxNum);
2358 data.writeInt(flags);
2359 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2360 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2361 reply.readException();
2362 ArrayList list = null;
2363 int N = reply.readInt();
2364 if (N >= 0) {
2365 list = new ArrayList();
2366 while (N > 0) {
2367 ActivityManager.RunningTaskInfo info =
2368 ActivityManager.RunningTaskInfo.CREATOR
2369 .createFromParcel(reply);
2370 list.add(info);
2371 N--;
2372 }
2373 }
2374 data.recycle();
2375 reply.recycle();
2376 return list;
2377 }
2378 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002379 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002380 Parcel data = Parcel.obtain();
2381 Parcel reply = Parcel.obtain();
2382 data.writeInterfaceToken(IActivityManager.descriptor);
2383 data.writeInt(maxNum);
2384 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002385 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002386 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2387 reply.readException();
2388 ArrayList<ActivityManager.RecentTaskInfo> list
2389 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2390 data.recycle();
2391 reply.recycle();
2392 return list;
2393 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002394 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002395 Parcel data = Parcel.obtain();
2396 Parcel reply = Parcel.obtain();
2397 data.writeInterfaceToken(IActivityManager.descriptor);
2398 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002399 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002400 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002401 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002402 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002403 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002404 }
2405 data.recycle();
2406 reply.recycle();
2407 return bm;
2408 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002409 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2410 Parcel data = Parcel.obtain();
2411 Parcel reply = Parcel.obtain();
2412 data.writeInterfaceToken(IActivityManager.descriptor);
2413 data.writeInt(id);
2414 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2415 reply.readException();
2416 Bitmap bm = null;
2417 if (reply.readInt() != 0) {
2418 bm = Bitmap.CREATOR.createFromParcel(reply);
2419 }
2420 data.recycle();
2421 reply.recycle();
2422 return bm;
2423 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002424 public List getServices(int maxNum, int flags) throws RemoteException {
2425 Parcel data = Parcel.obtain();
2426 Parcel reply = Parcel.obtain();
2427 data.writeInterfaceToken(IActivityManager.descriptor);
2428 data.writeInt(maxNum);
2429 data.writeInt(flags);
2430 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2431 reply.readException();
2432 ArrayList list = null;
2433 int N = reply.readInt();
2434 if (N >= 0) {
2435 list = new ArrayList();
2436 while (N > 0) {
2437 ActivityManager.RunningServiceInfo info =
2438 ActivityManager.RunningServiceInfo.CREATOR
2439 .createFromParcel(reply);
2440 list.add(info);
2441 N--;
2442 }
2443 }
2444 data.recycle();
2445 reply.recycle();
2446 return list;
2447 }
2448 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2449 throws RemoteException {
2450 Parcel data = Parcel.obtain();
2451 Parcel reply = Parcel.obtain();
2452 data.writeInterfaceToken(IActivityManager.descriptor);
2453 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2454 reply.readException();
2455 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2456 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2457 data.recycle();
2458 reply.recycle();
2459 return list;
2460 }
2461 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2462 throws RemoteException {
2463 Parcel data = Parcel.obtain();
2464 Parcel reply = Parcel.obtain();
2465 data.writeInterfaceToken(IActivityManager.descriptor);
2466 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2467 reply.readException();
2468 ArrayList<ActivityManager.RunningAppProcessInfo> list
2469 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2470 data.recycle();
2471 reply.recycle();
2472 return list;
2473 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002474 public List<ApplicationInfo> getRunningExternalApplications()
2475 throws RemoteException {
2476 Parcel data = Parcel.obtain();
2477 Parcel reply = Parcel.obtain();
2478 data.writeInterfaceToken(IActivityManager.descriptor);
2479 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2480 reply.readException();
2481 ArrayList<ApplicationInfo> list
2482 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2483 data.recycle();
2484 reply.recycle();
2485 return list;
2486 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002487 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002488 {
2489 Parcel data = Parcel.obtain();
2490 Parcel reply = Parcel.obtain();
2491 data.writeInterfaceToken(IActivityManager.descriptor);
2492 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002493 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002494 if (options != null) {
2495 data.writeInt(1);
2496 options.writeToParcel(data, 0);
2497 } else {
2498 data.writeInt(0);
2499 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002500 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2501 reply.readException();
2502 data.recycle();
2503 reply.recycle();
2504 }
2505 public void moveTaskToBack(int task) throws RemoteException
2506 {
2507 Parcel data = Parcel.obtain();
2508 Parcel reply = Parcel.obtain();
2509 data.writeInterfaceToken(IActivityManager.descriptor);
2510 data.writeInt(task);
2511 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2512 reply.readException();
2513 data.recycle();
2514 reply.recycle();
2515 }
2516 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2517 throws RemoteException {
2518 Parcel data = Parcel.obtain();
2519 Parcel reply = Parcel.obtain();
2520 data.writeInterfaceToken(IActivityManager.descriptor);
2521 data.writeStrongBinder(token);
2522 data.writeInt(nonRoot ? 1 : 0);
2523 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2524 reply.readException();
2525 boolean res = reply.readInt() != 0;
2526 data.recycle();
2527 reply.recycle();
2528 return res;
2529 }
2530 public void moveTaskBackwards(int task) throws RemoteException
2531 {
2532 Parcel data = Parcel.obtain();
2533 Parcel reply = Parcel.obtain();
2534 data.writeInterfaceToken(IActivityManager.descriptor);
2535 data.writeInt(task);
2536 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2537 reply.readException();
2538 data.recycle();
2539 reply.recycle();
2540 }
2541 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2542 {
2543 Parcel data = Parcel.obtain();
2544 Parcel reply = Parcel.obtain();
2545 data.writeInterfaceToken(IActivityManager.descriptor);
2546 data.writeStrongBinder(token);
2547 data.writeInt(onlyRoot ? 1 : 0);
2548 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2549 reply.readException();
2550 int res = reply.readInt();
2551 data.recycle();
2552 reply.recycle();
2553 return res;
2554 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002555 public void reportThumbnail(IBinder token,
2556 Bitmap thumbnail, CharSequence description) throws RemoteException
2557 {
2558 Parcel data = Parcel.obtain();
2559 Parcel reply = Parcel.obtain();
2560 data.writeInterfaceToken(IActivityManager.descriptor);
2561 data.writeStrongBinder(token);
2562 if (thumbnail != null) {
2563 data.writeInt(1);
2564 thumbnail.writeToParcel(data, 0);
2565 } else {
2566 data.writeInt(0);
2567 }
2568 TextUtils.writeToParcel(description, data, 0);
2569 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2570 reply.readException();
2571 data.recycle();
2572 reply.recycle();
2573 }
2574 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002575 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002576 Parcel data = Parcel.obtain();
2577 Parcel reply = Parcel.obtain();
2578 data.writeInterfaceToken(IActivityManager.descriptor);
2579 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2580 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002581 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002582 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002583 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 int res = reply.readInt();
2586 ContentProviderHolder cph = null;
2587 if (res != 0) {
2588 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2589 }
2590 data.recycle();
2591 reply.recycle();
2592 return cph;
2593 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002594 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2595 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002600 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002601 data.writeStrongBinder(token);
2602 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2603 reply.readException();
2604 int res = reply.readInt();
2605 ContentProviderHolder cph = null;
2606 if (res != 0) {
2607 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2608 }
2609 data.recycle();
2610 reply.recycle();
2611 return cph;
2612 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002613 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002614 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002615 {
2616 Parcel data = Parcel.obtain();
2617 Parcel reply = Parcel.obtain();
2618 data.writeInterfaceToken(IActivityManager.descriptor);
2619 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2620 data.writeTypedList(providers);
2621 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2622 reply.readException();
2623 data.recycle();
2624 reply.recycle();
2625 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002626 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2627 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002628 Parcel data = Parcel.obtain();
2629 Parcel reply = Parcel.obtain();
2630 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002631 data.writeStrongBinder(connection);
2632 data.writeInt(stable);
2633 data.writeInt(unstable);
2634 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2635 reply.readException();
2636 boolean res = reply.readInt() != 0;
2637 data.recycle();
2638 reply.recycle();
2639 return res;
2640 }
2641 public void unstableProviderDied(IBinder connection) throws RemoteException {
2642 Parcel data = Parcel.obtain();
2643 Parcel reply = Parcel.obtain();
2644 data.writeInterfaceToken(IActivityManager.descriptor);
2645 data.writeStrongBinder(connection);
2646 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2647 reply.readException();
2648 data.recycle();
2649 reply.recycle();
2650 }
2651
2652 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2653 Parcel data = Parcel.obtain();
2654 Parcel reply = Parcel.obtain();
2655 data.writeInterfaceToken(IActivityManager.descriptor);
2656 data.writeStrongBinder(connection);
2657 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002658 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2659 reply.readException();
2660 data.recycle();
2661 reply.recycle();
2662 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002663
2664 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2665 Parcel data = Parcel.obtain();
2666 Parcel reply = Parcel.obtain();
2667 data.writeInterfaceToken(IActivityManager.descriptor);
2668 data.writeString(name);
2669 data.writeStrongBinder(token);
2670 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2671 reply.readException();
2672 data.recycle();
2673 reply.recycle();
2674 }
2675
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002676 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2677 throws RemoteException
2678 {
2679 Parcel data = Parcel.obtain();
2680 Parcel reply = Parcel.obtain();
2681 data.writeInterfaceToken(IActivityManager.descriptor);
2682 service.writeToParcel(data, 0);
2683 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2684 reply.readException();
2685 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2686 data.recycle();
2687 reply.recycle();
2688 return res;
2689 }
2690
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002691 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002692 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002693 {
2694 Parcel data = Parcel.obtain();
2695 Parcel reply = Parcel.obtain();
2696 data.writeInterfaceToken(IActivityManager.descriptor);
2697 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2698 service.writeToParcel(data, 0);
2699 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002700 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002701 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2702 reply.readException();
2703 ComponentName res = ComponentName.readFromParcel(reply);
2704 data.recycle();
2705 reply.recycle();
2706 return res;
2707 }
2708 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002709 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002710 {
2711 Parcel data = Parcel.obtain();
2712 Parcel reply = Parcel.obtain();
2713 data.writeInterfaceToken(IActivityManager.descriptor);
2714 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2715 service.writeToParcel(data, 0);
2716 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002717 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002718 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2719 reply.readException();
2720 int res = reply.readInt();
2721 reply.recycle();
2722 data.recycle();
2723 return res;
2724 }
2725 public boolean stopServiceToken(ComponentName className, IBinder token,
2726 int startId) throws RemoteException {
2727 Parcel data = Parcel.obtain();
2728 Parcel reply = Parcel.obtain();
2729 data.writeInterfaceToken(IActivityManager.descriptor);
2730 ComponentName.writeToParcel(className, data);
2731 data.writeStrongBinder(token);
2732 data.writeInt(startId);
2733 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 boolean res = reply.readInt() != 0;
2736 data.recycle();
2737 reply.recycle();
2738 return res;
2739 }
2740 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002741 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002742 Parcel data = Parcel.obtain();
2743 Parcel reply = Parcel.obtain();
2744 data.writeInterfaceToken(IActivityManager.descriptor);
2745 ComponentName.writeToParcel(className, data);
2746 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002747 data.writeInt(id);
2748 if (notification != null) {
2749 data.writeInt(1);
2750 notification.writeToParcel(data, 0);
2751 } else {
2752 data.writeInt(0);
2753 }
2754 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002755 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2756 reply.readException();
2757 data.recycle();
2758 reply.recycle();
2759 }
2760 public int bindService(IApplicationThread caller, IBinder token,
2761 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002762 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002763 Parcel data = Parcel.obtain();
2764 Parcel reply = Parcel.obtain();
2765 data.writeInterfaceToken(IActivityManager.descriptor);
2766 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2767 data.writeStrongBinder(token);
2768 service.writeToParcel(data, 0);
2769 data.writeString(resolvedType);
2770 data.writeStrongBinder(connection.asBinder());
2771 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002772 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002773 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2774 reply.readException();
2775 int res = reply.readInt();
2776 data.recycle();
2777 reply.recycle();
2778 return res;
2779 }
2780 public boolean unbindService(IServiceConnection connection) throws RemoteException
2781 {
2782 Parcel data = Parcel.obtain();
2783 Parcel reply = Parcel.obtain();
2784 data.writeInterfaceToken(IActivityManager.descriptor);
2785 data.writeStrongBinder(connection.asBinder());
2786 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2787 reply.readException();
2788 boolean res = reply.readInt() != 0;
2789 data.recycle();
2790 reply.recycle();
2791 return res;
2792 }
2793
2794 public void publishService(IBinder token,
2795 Intent intent, IBinder service) throws RemoteException {
2796 Parcel data = Parcel.obtain();
2797 Parcel reply = Parcel.obtain();
2798 data.writeInterfaceToken(IActivityManager.descriptor);
2799 data.writeStrongBinder(token);
2800 intent.writeToParcel(data, 0);
2801 data.writeStrongBinder(service);
2802 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2803 reply.readException();
2804 data.recycle();
2805 reply.recycle();
2806 }
2807
2808 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2809 throws RemoteException {
2810 Parcel data = Parcel.obtain();
2811 Parcel reply = Parcel.obtain();
2812 data.writeInterfaceToken(IActivityManager.descriptor);
2813 data.writeStrongBinder(token);
2814 intent.writeToParcel(data, 0);
2815 data.writeInt(doRebind ? 1 : 0);
2816 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2817 reply.readException();
2818 data.recycle();
2819 reply.recycle();
2820 }
2821
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002822 public void serviceDoneExecuting(IBinder token, int type, int startId,
2823 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002824 Parcel data = Parcel.obtain();
2825 Parcel reply = Parcel.obtain();
2826 data.writeInterfaceToken(IActivityManager.descriptor);
2827 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002828 data.writeInt(type);
2829 data.writeInt(startId);
2830 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002831 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2832 reply.readException();
2833 data.recycle();
2834 reply.recycle();
2835 }
2836
2837 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2838 Parcel data = Parcel.obtain();
2839 Parcel reply = Parcel.obtain();
2840 data.writeInterfaceToken(IActivityManager.descriptor);
2841 service.writeToParcel(data, 0);
2842 data.writeString(resolvedType);
2843 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2844 reply.readException();
2845 IBinder binder = reply.readStrongBinder();
2846 reply.recycle();
2847 data.recycle();
2848 return binder;
2849 }
2850
Christopher Tate181fafa2009-05-14 11:12:14 -07002851 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2852 throws RemoteException {
2853 Parcel data = Parcel.obtain();
2854 Parcel reply = Parcel.obtain();
2855 data.writeInterfaceToken(IActivityManager.descriptor);
2856 app.writeToParcel(data, 0);
2857 data.writeInt(backupRestoreMode);
2858 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2859 reply.readException();
2860 boolean success = reply.readInt() != 0;
2861 reply.recycle();
2862 data.recycle();
2863 return success;
2864 }
2865
Christopher Tate346acb12012-10-15 19:20:25 -07002866 public void clearPendingBackup() throws RemoteException {
2867 Parcel data = Parcel.obtain();
2868 Parcel reply = Parcel.obtain();
2869 data.writeInterfaceToken(IActivityManager.descriptor);
2870 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
2871 reply.recycle();
2872 data.recycle();
2873 }
2874
Christopher Tate181fafa2009-05-14 11:12:14 -07002875 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2876 Parcel data = Parcel.obtain();
2877 Parcel reply = Parcel.obtain();
2878 data.writeInterfaceToken(IActivityManager.descriptor);
2879 data.writeString(packageName);
2880 data.writeStrongBinder(agent);
2881 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2882 reply.recycle();
2883 data.recycle();
2884 }
2885
2886 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2887 Parcel data = Parcel.obtain();
2888 Parcel reply = Parcel.obtain();
2889 data.writeInterfaceToken(IActivityManager.descriptor);
2890 app.writeToParcel(data, 0);
2891 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2892 reply.readException();
2893 reply.recycle();
2894 data.recycle();
2895 }
2896
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002897 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002898 int flags, Bundle arguments, IInstrumentationWatcher watcher,
2899 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002900 Parcel data = Parcel.obtain();
2901 Parcel reply = Parcel.obtain();
2902 data.writeInterfaceToken(IActivityManager.descriptor);
2903 ComponentName.writeToParcel(className, data);
2904 data.writeString(profileFile);
2905 data.writeInt(flags);
2906 data.writeBundle(arguments);
2907 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002908 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002909 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002910 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2911 reply.readException();
2912 boolean res = reply.readInt() != 0;
2913 reply.recycle();
2914 data.recycle();
2915 return res;
2916 }
2917
2918 public void finishInstrumentation(IApplicationThread target,
2919 int resultCode, Bundle results) throws RemoteException {
2920 Parcel data = Parcel.obtain();
2921 Parcel reply = Parcel.obtain();
2922 data.writeInterfaceToken(IActivityManager.descriptor);
2923 data.writeStrongBinder(target != null ? target.asBinder() : null);
2924 data.writeInt(resultCode);
2925 data.writeBundle(results);
2926 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2927 reply.readException();
2928 data.recycle();
2929 reply.recycle();
2930 }
2931 public Configuration getConfiguration() throws RemoteException
2932 {
2933 Parcel data = Parcel.obtain();
2934 Parcel reply = Parcel.obtain();
2935 data.writeInterfaceToken(IActivityManager.descriptor);
2936 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2937 reply.readException();
2938 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2939 reply.recycle();
2940 data.recycle();
2941 return res;
2942 }
2943 public void updateConfiguration(Configuration values) throws RemoteException
2944 {
2945 Parcel data = Parcel.obtain();
2946 Parcel reply = Parcel.obtain();
2947 data.writeInterfaceToken(IActivityManager.descriptor);
2948 values.writeToParcel(data, 0);
2949 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2950 reply.readException();
2951 data.recycle();
2952 reply.recycle();
2953 }
2954 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2955 throws RemoteException {
2956 Parcel data = Parcel.obtain();
2957 Parcel reply = Parcel.obtain();
2958 data.writeInterfaceToken(IActivityManager.descriptor);
2959 data.writeStrongBinder(token);
2960 data.writeInt(requestedOrientation);
2961 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2962 reply.readException();
2963 data.recycle();
2964 reply.recycle();
2965 }
2966 public int getRequestedOrientation(IBinder token) throws RemoteException {
2967 Parcel data = Parcel.obtain();
2968 Parcel reply = Parcel.obtain();
2969 data.writeInterfaceToken(IActivityManager.descriptor);
2970 data.writeStrongBinder(token);
2971 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 int res = reply.readInt();
2974 data.recycle();
2975 reply.recycle();
2976 return res;
2977 }
2978 public ComponentName getActivityClassForToken(IBinder token)
2979 throws RemoteException {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 data.writeStrongBinder(token);
2984 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2985 reply.readException();
2986 ComponentName res = ComponentName.readFromParcel(reply);
2987 data.recycle();
2988 reply.recycle();
2989 return res;
2990 }
2991 public String getPackageForToken(IBinder token) throws RemoteException
2992 {
2993 Parcel data = Parcel.obtain();
2994 Parcel reply = Parcel.obtain();
2995 data.writeInterfaceToken(IActivityManager.descriptor);
2996 data.writeStrongBinder(token);
2997 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2998 reply.readException();
2999 String res = reply.readString();
3000 data.recycle();
3001 reply.recycle();
3002 return res;
3003 }
3004 public IIntentSender getIntentSender(int type,
3005 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003006 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003007 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003008 Parcel data = Parcel.obtain();
3009 Parcel reply = Parcel.obtain();
3010 data.writeInterfaceToken(IActivityManager.descriptor);
3011 data.writeInt(type);
3012 data.writeString(packageName);
3013 data.writeStrongBinder(token);
3014 data.writeString(resultWho);
3015 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003016 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003018 data.writeTypedArray(intents, 0);
3019 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003020 } else {
3021 data.writeInt(0);
3022 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003023 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003024 if (options != null) {
3025 data.writeInt(1);
3026 options.writeToParcel(data, 0);
3027 } else {
3028 data.writeInt(0);
3029 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003030 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003031 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3032 reply.readException();
3033 IIntentSender res = IIntentSender.Stub.asInterface(
3034 reply.readStrongBinder());
3035 data.recycle();
3036 reply.recycle();
3037 return res;
3038 }
3039 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3040 Parcel data = Parcel.obtain();
3041 Parcel reply = Parcel.obtain();
3042 data.writeInterfaceToken(IActivityManager.descriptor);
3043 data.writeStrongBinder(sender.asBinder());
3044 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3045 reply.readException();
3046 data.recycle();
3047 reply.recycle();
3048 }
3049 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3050 Parcel data = Parcel.obtain();
3051 Parcel reply = Parcel.obtain();
3052 data.writeInterfaceToken(IActivityManager.descriptor);
3053 data.writeStrongBinder(sender.asBinder());
3054 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3055 reply.readException();
3056 String res = reply.readString();
3057 data.recycle();
3058 reply.recycle();
3059 return res;
3060 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003061 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3062 Parcel data = Parcel.obtain();
3063 Parcel reply = Parcel.obtain();
3064 data.writeInterfaceToken(IActivityManager.descriptor);
3065 data.writeStrongBinder(sender.asBinder());
3066 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3067 reply.readException();
3068 int res = reply.readInt();
3069 data.recycle();
3070 reply.recycle();
3071 return res;
3072 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003073 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3074 boolean requireFull, String name, String callerPackage) throws RemoteException {
3075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 data.writeInt(callingPid);
3079 data.writeInt(callingUid);
3080 data.writeInt(userId);
3081 data.writeInt(allowAll ? 1 : 0);
3082 data.writeInt(requireFull ? 1 : 0);
3083 data.writeString(name);
3084 data.writeString(callerPackage);
3085 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3086 reply.readException();
3087 int res = reply.readInt();
3088 data.recycle();
3089 reply.recycle();
3090 return res;
3091 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003092 public void setProcessLimit(int max) throws RemoteException
3093 {
3094 Parcel data = Parcel.obtain();
3095 Parcel reply = Parcel.obtain();
3096 data.writeInterfaceToken(IActivityManager.descriptor);
3097 data.writeInt(max);
3098 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3099 reply.readException();
3100 data.recycle();
3101 reply.recycle();
3102 }
3103 public int getProcessLimit() throws RemoteException
3104 {
3105 Parcel data = Parcel.obtain();
3106 Parcel reply = Parcel.obtain();
3107 data.writeInterfaceToken(IActivityManager.descriptor);
3108 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3109 reply.readException();
3110 int res = reply.readInt();
3111 data.recycle();
3112 reply.recycle();
3113 return res;
3114 }
3115 public void setProcessForeground(IBinder token, int pid,
3116 boolean isForeground) throws RemoteException {
3117 Parcel data = Parcel.obtain();
3118 Parcel reply = Parcel.obtain();
3119 data.writeInterfaceToken(IActivityManager.descriptor);
3120 data.writeStrongBinder(token);
3121 data.writeInt(pid);
3122 data.writeInt(isForeground ? 1 : 0);
3123 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3124 reply.readException();
3125 data.recycle();
3126 reply.recycle();
3127 }
3128 public int checkPermission(String permission, int pid, int uid)
3129 throws RemoteException {
3130 Parcel data = Parcel.obtain();
3131 Parcel reply = Parcel.obtain();
3132 data.writeInterfaceToken(IActivityManager.descriptor);
3133 data.writeString(permission);
3134 data.writeInt(pid);
3135 data.writeInt(uid);
3136 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3137 reply.readException();
3138 int res = reply.readInt();
3139 data.recycle();
3140 reply.recycle();
3141 return res;
3142 }
3143 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003144 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003145 Parcel data = Parcel.obtain();
3146 Parcel reply = Parcel.obtain();
3147 data.writeInterfaceToken(IActivityManager.descriptor);
3148 data.writeString(packageName);
3149 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003150 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003151 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3152 reply.readException();
3153 boolean res = reply.readInt() != 0;
3154 data.recycle();
3155 reply.recycle();
3156 return res;
3157 }
3158 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3159 throws RemoteException {
3160 Parcel data = Parcel.obtain();
3161 Parcel reply = Parcel.obtain();
3162 data.writeInterfaceToken(IActivityManager.descriptor);
3163 uri.writeToParcel(data, 0);
3164 data.writeInt(pid);
3165 data.writeInt(uid);
3166 data.writeInt(mode);
3167 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3168 reply.readException();
3169 int res = reply.readInt();
3170 data.recycle();
3171 reply.recycle();
3172 return res;
3173 }
3174 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3175 Uri uri, int mode) throws RemoteException {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 data.writeStrongBinder(caller.asBinder());
3180 data.writeString(targetPkg);
3181 uri.writeToParcel(data, 0);
3182 data.writeInt(mode);
3183 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3184 reply.readException();
3185 data.recycle();
3186 reply.recycle();
3187 }
3188 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3189 int mode) throws RemoteException {
3190 Parcel data = Parcel.obtain();
3191 Parcel reply = Parcel.obtain();
3192 data.writeInterfaceToken(IActivityManager.descriptor);
3193 data.writeStrongBinder(caller.asBinder());
3194 uri.writeToParcel(data, 0);
3195 data.writeInt(mode);
3196 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3197 reply.readException();
3198 data.recycle();
3199 reply.recycle();
3200 }
3201 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3202 throws RemoteException {
3203 Parcel data = Parcel.obtain();
3204 Parcel reply = Parcel.obtain();
3205 data.writeInterfaceToken(IActivityManager.descriptor);
3206 data.writeStrongBinder(who.asBinder());
3207 data.writeInt(waiting ? 1 : 0);
3208 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3209 reply.readException();
3210 data.recycle();
3211 reply.recycle();
3212 }
3213 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3214 Parcel data = Parcel.obtain();
3215 Parcel reply = Parcel.obtain();
3216 data.writeInterfaceToken(IActivityManager.descriptor);
3217 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3218 reply.readException();
3219 outInfo.readFromParcel(reply);
3220 data.recycle();
3221 reply.recycle();
3222 }
3223 public void unhandledBack() throws RemoteException
3224 {
3225 Parcel data = Parcel.obtain();
3226 Parcel reply = Parcel.obtain();
3227 data.writeInterfaceToken(IActivityManager.descriptor);
3228 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3229 reply.readException();
3230 data.recycle();
3231 reply.recycle();
3232 }
3233 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3234 {
3235 Parcel data = Parcel.obtain();
3236 Parcel reply = Parcel.obtain();
3237 data.writeInterfaceToken(IActivityManager.descriptor);
3238 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3239 reply.readException();
3240 ParcelFileDescriptor pfd = null;
3241 if (reply.readInt() != 0) {
3242 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3243 }
3244 data.recycle();
3245 reply.recycle();
3246 return pfd;
3247 }
3248 public void goingToSleep() throws RemoteException
3249 {
3250 Parcel data = Parcel.obtain();
3251 Parcel reply = Parcel.obtain();
3252 data.writeInterfaceToken(IActivityManager.descriptor);
3253 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3254 reply.readException();
3255 data.recycle();
3256 reply.recycle();
3257 }
3258 public void wakingUp() throws RemoteException
3259 {
3260 Parcel data = Parcel.obtain();
3261 Parcel reply = Parcel.obtain();
3262 data.writeInterfaceToken(IActivityManager.descriptor);
3263 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3264 reply.readException();
3265 data.recycle();
3266 reply.recycle();
3267 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003268 public void setLockScreenShown(boolean shown) throws RemoteException
3269 {
3270 Parcel data = Parcel.obtain();
3271 Parcel reply = Parcel.obtain();
3272 data.writeInterfaceToken(IActivityManager.descriptor);
3273 data.writeInt(shown ? 1 : 0);
3274 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3275 reply.readException();
3276 data.recycle();
3277 reply.recycle();
3278 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003279 public void setDebugApp(
3280 String packageName, boolean waitForDebugger, boolean persistent)
3281 throws RemoteException
3282 {
3283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 data.writeString(packageName);
3287 data.writeInt(waitForDebugger ? 1 : 0);
3288 data.writeInt(persistent ? 1 : 0);
3289 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3290 reply.readException();
3291 data.recycle();
3292 reply.recycle();
3293 }
3294 public void setAlwaysFinish(boolean enabled) throws RemoteException
3295 {
3296 Parcel data = Parcel.obtain();
3297 Parcel reply = Parcel.obtain();
3298 data.writeInterfaceToken(IActivityManager.descriptor);
3299 data.writeInt(enabled ? 1 : 0);
3300 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3301 reply.readException();
3302 data.recycle();
3303 reply.recycle();
3304 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003305 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306 {
3307 Parcel data = Parcel.obtain();
3308 Parcel reply = Parcel.obtain();
3309 data.writeInterfaceToken(IActivityManager.descriptor);
3310 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003311 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003312 reply.readException();
3313 data.recycle();
3314 reply.recycle();
3315 }
3316 public void enterSafeMode() throws RemoteException {
3317 Parcel data = Parcel.obtain();
3318 data.writeInterfaceToken(IActivityManager.descriptor);
3319 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3320 data.recycle();
3321 }
3322 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3323 Parcel data = Parcel.obtain();
3324 data.writeStrongBinder(sender.asBinder());
3325 data.writeInterfaceToken(IActivityManager.descriptor);
3326 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3327 data.recycle();
3328 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003329 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003330 Parcel data = Parcel.obtain();
3331 Parcel reply = Parcel.obtain();
3332 data.writeInterfaceToken(IActivityManager.descriptor);
3333 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003334 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003335 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003336 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003337 boolean res = reply.readInt() != 0;
3338 data.recycle();
3339 reply.recycle();
3340 return res;
3341 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003342 @Override
3343 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3344 Parcel data = Parcel.obtain();
3345 Parcel reply = Parcel.obtain();
3346 data.writeInterfaceToken(IActivityManager.descriptor);
3347 data.writeString(reason);
3348 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3349 boolean res = reply.readInt() != 0;
3350 data.recycle();
3351 reply.recycle();
3352 return res;
3353 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003354 public void startRunning(String pkg, String cls, String action,
3355 String indata) throws RemoteException {
3356 Parcel data = Parcel.obtain();
3357 Parcel reply = Parcel.obtain();
3358 data.writeInterfaceToken(IActivityManager.descriptor);
3359 data.writeString(pkg);
3360 data.writeString(cls);
3361 data.writeString(action);
3362 data.writeString(indata);
3363 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 data.recycle();
3366 reply.recycle();
3367 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003368 public boolean testIsSystemReady()
3369 {
3370 /* this base class version is never called */
3371 return true;
3372 }
Dan Egnor60d87622009-12-16 16:32:58 -08003373 public void handleApplicationCrash(IBinder app,
3374 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3375 {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(app);
3380 crashInfo.writeToParcel(data, 0);
3381 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3382 reply.readException();
3383 reply.recycle();
3384 data.recycle();
3385 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003386
Dan Egnor60d87622009-12-16 16:32:58 -08003387 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003388 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003389 {
3390 Parcel data = Parcel.obtain();
3391 Parcel reply = Parcel.obtain();
3392 data.writeInterfaceToken(IActivityManager.descriptor);
3393 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003394 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003395 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003396 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003397 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003398 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003399 reply.recycle();
3400 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003401 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003402 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003403
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003404 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003405 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003406 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003407 {
3408 Parcel data = Parcel.obtain();
3409 Parcel reply = Parcel.obtain();
3410 data.writeInterfaceToken(IActivityManager.descriptor);
3411 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003412 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003413 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003414 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3415 reply.readException();
3416 reply.recycle();
3417 data.recycle();
3418 }
3419
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003420 public void signalPersistentProcesses(int sig) throws RemoteException {
3421 Parcel data = Parcel.obtain();
3422 Parcel reply = Parcel.obtain();
3423 data.writeInterfaceToken(IActivityManager.descriptor);
3424 data.writeInt(sig);
3425 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3426 reply.readException();
3427 data.recycle();
3428 reply.recycle();
3429 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003430
Dianne Hackborn1676c852012-09-10 14:52:30 -07003431 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003432 Parcel data = Parcel.obtain();
3433 Parcel reply = Parcel.obtain();
3434 data.writeInterfaceToken(IActivityManager.descriptor);
3435 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003436 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003437 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3438 reply.readException();
3439 data.recycle();
3440 reply.recycle();
3441 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003442
3443 public void killAllBackgroundProcesses() throws RemoteException {
3444 Parcel data = Parcel.obtain();
3445 Parcel reply = Parcel.obtain();
3446 data.writeInterfaceToken(IActivityManager.descriptor);
3447 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3448 reply.readException();
3449 data.recycle();
3450 reply.recycle();
3451 }
3452
Dianne Hackborn1676c852012-09-10 14:52:30 -07003453 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003454 Parcel data = Parcel.obtain();
3455 Parcel reply = Parcel.obtain();
3456 data.writeInterfaceToken(IActivityManager.descriptor);
3457 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003458 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003459 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 reply.readException();
3461 data.recycle();
3462 reply.recycle();
3463 }
3464
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003465 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3466 throws RemoteException
3467 {
3468 Parcel data = Parcel.obtain();
3469 Parcel reply = Parcel.obtain();
3470 data.writeInterfaceToken(IActivityManager.descriptor);
3471 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3472 reply.readException();
3473 outInfo.readFromParcel(reply);
3474 reply.recycle();
3475 data.recycle();
3476 }
3477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003478 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3479 {
3480 Parcel data = Parcel.obtain();
3481 Parcel reply = Parcel.obtain();
3482 data.writeInterfaceToken(IActivityManager.descriptor);
3483 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3484 reply.readException();
3485 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3486 reply.recycle();
3487 data.recycle();
3488 return res;
3489 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003490
Dianne Hackborn1676c852012-09-10 14:52:30 -07003491 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003492 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003493 {
3494 Parcel data = Parcel.obtain();
3495 Parcel reply = Parcel.obtain();
3496 data.writeInterfaceToken(IActivityManager.descriptor);
3497 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003498 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003499 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003500 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003501 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003502 if (fd != null) {
3503 data.writeInt(1);
3504 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3505 } else {
3506 data.writeInt(0);
3507 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003508 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3509 reply.readException();
3510 boolean res = reply.readInt() != 0;
3511 reply.recycle();
3512 data.recycle();
3513 return res;
3514 }
3515
Dianne Hackborn55280a92009-05-07 15:53:46 -07003516 public boolean shutdown(int timeout) throws RemoteException
3517 {
3518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeInt(timeout);
3522 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3523 reply.readException();
3524 boolean res = reply.readInt() != 0;
3525 reply.recycle();
3526 data.recycle();
3527 return res;
3528 }
3529
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003530 public void stopAppSwitches() throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3535 reply.readException();
3536 reply.recycle();
3537 data.recycle();
3538 }
3539
3540 public void resumeAppSwitches() throws RemoteException {
3541 Parcel data = Parcel.obtain();
3542 Parcel reply = Parcel.obtain();
3543 data.writeInterfaceToken(IActivityManager.descriptor);
3544 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3545 reply.readException();
3546 reply.recycle();
3547 data.recycle();
3548 }
3549
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003550 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003555 data.writeInt(appid);
3556 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003557 reply.readException();
3558 data.recycle();
3559 reply.recycle();
3560 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003561
3562 public void closeSystemDialogs(String reason) throws RemoteException {
3563 Parcel data = Parcel.obtain();
3564 Parcel reply = Parcel.obtain();
3565 data.writeInterfaceToken(IActivityManager.descriptor);
3566 data.writeString(reason);
3567 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 data.recycle();
3570 reply.recycle();
3571 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003572
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003573 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003574 throws RemoteException {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003578 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003579 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3580 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003581 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003582 data.recycle();
3583 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003584 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003585 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003586
3587 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3588 Parcel data = Parcel.obtain();
3589 Parcel reply = Parcel.obtain();
3590 data.writeInterfaceToken(IActivityManager.descriptor);
3591 data.writeString(processName);
3592 data.writeInt(uid);
3593 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3594 reply.readException();
3595 data.recycle();
3596 reply.recycle();
3597 }
3598
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003599 public void overridePendingTransition(IBinder token, String packageName,
3600 int enterAnim, int exitAnim) throws RemoteException {
3601 Parcel data = Parcel.obtain();
3602 Parcel reply = Parcel.obtain();
3603 data.writeInterfaceToken(IActivityManager.descriptor);
3604 data.writeStrongBinder(token);
3605 data.writeString(packageName);
3606 data.writeInt(enterAnim);
3607 data.writeInt(exitAnim);
3608 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3609 reply.readException();
3610 data.recycle();
3611 reply.recycle();
3612 }
3613
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003614 public boolean isUserAMonkey() throws RemoteException {
3615 Parcel data = Parcel.obtain();
3616 Parcel reply = Parcel.obtain();
3617 data.writeInterfaceToken(IActivityManager.descriptor);
3618 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3619 reply.readException();
3620 boolean res = reply.readInt() != 0;
3621 data.recycle();
3622 reply.recycle();
3623 return res;
3624 }
3625
Dianne Hackborn860755f2010-06-03 18:47:52 -07003626 public void finishHeavyWeightApp() throws RemoteException {
3627 Parcel data = Parcel.obtain();
3628 Parcel reply = Parcel.obtain();
3629 data.writeInterfaceToken(IActivityManager.descriptor);
3630 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3631 reply.readException();
3632 data.recycle();
3633 reply.recycle();
3634 }
3635
Daniel Sandler69a48172010-06-23 16:29:36 -04003636 public void setImmersive(IBinder token, boolean immersive)
3637 throws RemoteException {
3638 Parcel data = Parcel.obtain();
3639 Parcel reply = Parcel.obtain();
3640 data.writeInterfaceToken(IActivityManager.descriptor);
3641 data.writeStrongBinder(token);
3642 data.writeInt(immersive ? 1 : 0);
3643 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3644 reply.readException();
3645 data.recycle();
3646 reply.recycle();
3647 }
3648
3649 public boolean isImmersive(IBinder token)
3650 throws RemoteException {
3651 Parcel data = Parcel.obtain();
3652 Parcel reply = Parcel.obtain();
3653 data.writeInterfaceToken(IActivityManager.descriptor);
3654 data.writeStrongBinder(token);
3655 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003656 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003657 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003658 data.recycle();
3659 reply.recycle();
3660 return res;
3661 }
3662
3663 public boolean isTopActivityImmersive()
3664 throws RemoteException {
3665 Parcel data = Parcel.obtain();
3666 Parcel reply = Parcel.obtain();
3667 data.writeInterfaceToken(IActivityManager.descriptor);
3668 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003669 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003670 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003671 data.recycle();
3672 reply.recycle();
3673 return res;
3674 }
3675
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003676 public void crashApplication(int uid, int initialPid, String packageName,
3677 String message) throws RemoteException {
3678 Parcel data = Parcel.obtain();
3679 Parcel reply = Parcel.obtain();
3680 data.writeInterfaceToken(IActivityManager.descriptor);
3681 data.writeInt(uid);
3682 data.writeInt(initialPid);
3683 data.writeString(packageName);
3684 data.writeString(message);
3685 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3686 reply.readException();
3687 data.recycle();
3688 reply.recycle();
3689 }
Andy McFadden824c5102010-07-09 16:26:57 -07003690
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003691 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003692 Parcel data = Parcel.obtain();
3693 Parcel reply = Parcel.obtain();
3694 data.writeInterfaceToken(IActivityManager.descriptor);
3695 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003696 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003697 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3698 reply.readException();
3699 String res = reply.readString();
3700 data.recycle();
3701 reply.recycle();
3702 return res;
3703 }
3704
Dianne Hackborn7e269642010-08-25 19:50:20 -07003705 public IBinder newUriPermissionOwner(String name)
3706 throws RemoteException {
3707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 data.writeString(name);
3711 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3712 reply.readException();
3713 IBinder res = reply.readStrongBinder();
3714 data.recycle();
3715 reply.recycle();
3716 return res;
3717 }
3718
3719 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3720 Uri uri, int mode) throws RemoteException {
3721 Parcel data = Parcel.obtain();
3722 Parcel reply = Parcel.obtain();
3723 data.writeInterfaceToken(IActivityManager.descriptor);
3724 data.writeStrongBinder(owner);
3725 data.writeInt(fromUid);
3726 data.writeString(targetPkg);
3727 uri.writeToParcel(data, 0);
3728 data.writeInt(mode);
3729 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3730 reply.readException();
3731 data.recycle();
3732 reply.recycle();
3733 }
3734
3735 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3736 int mode) throws RemoteException {
3737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 data.writeStrongBinder(owner);
3741 if (uri != null) {
3742 data.writeInt(1);
3743 uri.writeToParcel(data, 0);
3744 } else {
3745 data.writeInt(0);
3746 }
3747 data.writeInt(mode);
3748 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 data.recycle();
3751 reply.recycle();
3752 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003753
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003754 public int checkGrantUriPermission(int callingUid, String targetPkg,
3755 Uri uri, int modeFlags) throws RemoteException {
3756 Parcel data = Parcel.obtain();
3757 Parcel reply = Parcel.obtain();
3758 data.writeInterfaceToken(IActivityManager.descriptor);
3759 data.writeInt(callingUid);
3760 data.writeString(targetPkg);
3761 uri.writeToParcel(data, 0);
3762 data.writeInt(modeFlags);
3763 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3764 reply.readException();
3765 int res = reply.readInt();
3766 data.recycle();
3767 reply.recycle();
3768 return res;
3769 }
3770
Dianne Hackborn1676c852012-09-10 14:52:30 -07003771 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003772 String path, ParcelFileDescriptor fd) throws RemoteException {
3773 Parcel data = Parcel.obtain();
3774 Parcel reply = Parcel.obtain();
3775 data.writeInterfaceToken(IActivityManager.descriptor);
3776 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003777 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003778 data.writeInt(managed ? 1 : 0);
3779 data.writeString(path);
3780 if (fd != null) {
3781 data.writeInt(1);
3782 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3783 } else {
3784 data.writeInt(0);
3785 }
3786 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3787 reply.readException();
3788 boolean res = reply.readInt() != 0;
3789 reply.recycle();
3790 data.recycle();
3791 return res;
3792 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003793
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003794 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003795 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003796 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003797 Parcel data = Parcel.obtain();
3798 Parcel reply = Parcel.obtain();
3799 data.writeInterfaceToken(IActivityManager.descriptor);
3800 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003801 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003802 data.writeTypedArray(intents, 0);
3803 data.writeStringArray(resolvedTypes);
3804 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003805 if (options != null) {
3806 data.writeInt(1);
3807 options.writeToParcel(data, 0);
3808 } else {
3809 data.writeInt(0);
3810 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003811 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003812 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3813 reply.readException();
3814 int result = reply.readInt();
3815 reply.recycle();
3816 data.recycle();
3817 return result;
3818 }
3819
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003820 public int getFrontActivityScreenCompatMode() throws RemoteException {
3821 Parcel data = Parcel.obtain();
3822 Parcel reply = Parcel.obtain();
3823 data.writeInterfaceToken(IActivityManager.descriptor);
3824 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3825 reply.readException();
3826 int mode = reply.readInt();
3827 reply.recycle();
3828 data.recycle();
3829 return mode;
3830 }
3831
3832 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3833 Parcel data = Parcel.obtain();
3834 Parcel reply = Parcel.obtain();
3835 data.writeInterfaceToken(IActivityManager.descriptor);
3836 data.writeInt(mode);
3837 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3838 reply.readException();
3839 reply.recycle();
3840 data.recycle();
3841 }
3842
3843 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003847 data.writeString(packageName);
3848 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003849 reply.readException();
3850 int mode = reply.readInt();
3851 reply.recycle();
3852 data.recycle();
3853 return mode;
3854 }
3855
3856 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003857 throws RemoteException {
3858 Parcel data = Parcel.obtain();
3859 Parcel reply = Parcel.obtain();
3860 data.writeInterfaceToken(IActivityManager.descriptor);
3861 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003862 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003863 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3864 reply.readException();
3865 reply.recycle();
3866 data.recycle();
3867 }
3868
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003869 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3870 Parcel data = Parcel.obtain();
3871 Parcel reply = Parcel.obtain();
3872 data.writeInterfaceToken(IActivityManager.descriptor);
3873 data.writeString(packageName);
3874 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3875 reply.readException();
3876 boolean ask = reply.readInt() != 0;
3877 reply.recycle();
3878 data.recycle();
3879 return ask;
3880 }
3881
3882 public void setPackageAskScreenCompat(String packageName, boolean ask)
3883 throws RemoteException {
3884 Parcel data = Parcel.obtain();
3885 Parcel reply = Parcel.obtain();
3886 data.writeInterfaceToken(IActivityManager.descriptor);
3887 data.writeString(packageName);
3888 data.writeInt(ask ? 1 : 0);
3889 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3890 reply.readException();
3891 reply.recycle();
3892 data.recycle();
3893 }
3894
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003895 public boolean switchUser(int userid) throws RemoteException {
3896 Parcel data = Parcel.obtain();
3897 Parcel reply = Parcel.obtain();
3898 data.writeInterfaceToken(IActivityManager.descriptor);
3899 data.writeInt(userid);
3900 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3901 reply.readException();
3902 boolean result = reply.readInt() != 0;
3903 reply.recycle();
3904 data.recycle();
3905 return result;
3906 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003907
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003908 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3909 Parcel data = Parcel.obtain();
3910 Parcel reply = Parcel.obtain();
3911 data.writeInterfaceToken(IActivityManager.descriptor);
3912 data.writeInt(userid);
3913 data.writeStrongInterface(callback);
3914 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3915 reply.readException();
3916 int result = reply.readInt();
3917 reply.recycle();
3918 data.recycle();
3919 return result;
3920 }
3921
Amith Yamasani52f1d752012-03-28 18:19:29 -07003922 public UserInfo getCurrentUser() throws RemoteException {
3923 Parcel data = Parcel.obtain();
3924 Parcel reply = Parcel.obtain();
3925 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003926 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003927 reply.readException();
3928 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3929 reply.recycle();
3930 data.recycle();
3931 return userInfo;
3932 }
3933
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003934 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003935 Parcel data = Parcel.obtain();
3936 Parcel reply = Parcel.obtain();
3937 data.writeInterfaceToken(IActivityManager.descriptor);
3938 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003939 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003940 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3941 reply.readException();
3942 boolean result = reply.readInt() != 0;
3943 reply.recycle();
3944 data.recycle();
3945 return result;
3946 }
3947
Dianne Hackbornc72fc672012-09-20 13:12:03 -07003948 public int[] getRunningUserIds() throws RemoteException {
3949 Parcel data = Parcel.obtain();
3950 Parcel reply = Parcel.obtain();
3951 data.writeInterfaceToken(IActivityManager.descriptor);
3952 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
3953 reply.readException();
3954 int[] result = reply.createIntArray();
3955 reply.recycle();
3956 data.recycle();
3957 return result;
3958 }
3959
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003960 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3961 Parcel data = Parcel.obtain();
3962 Parcel reply = Parcel.obtain();
3963 data.writeInterfaceToken(IActivityManager.descriptor);
3964 data.writeInt(taskId);
3965 data.writeInt(subTaskIndex);
3966 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3967 reply.readException();
3968 boolean result = reply.readInt() != 0;
3969 reply.recycle();
3970 data.recycle();
3971 return result;
3972 }
3973
3974 public boolean removeTask(int taskId, int flags) throws RemoteException {
3975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 data.writeInt(taskId);
3979 data.writeInt(flags);
3980 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3981 reply.readException();
3982 boolean result = reply.readInt() != 0;
3983 reply.recycle();
3984 data.recycle();
3985 return result;
3986 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003987
Jeff Sharkeya4620792011-05-20 15:29:23 -07003988 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3989 Parcel data = Parcel.obtain();
3990 Parcel reply = Parcel.obtain();
3991 data.writeInterfaceToken(IActivityManager.descriptor);
3992 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3993 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3994 reply.readException();
3995 data.recycle();
3996 reply.recycle();
3997 }
3998
3999 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4000 Parcel data = Parcel.obtain();
4001 Parcel reply = Parcel.obtain();
4002 data.writeInterfaceToken(IActivityManager.descriptor);
4003 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4004 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4005 reply.readException();
4006 data.recycle();
4007 reply.recycle();
4008 }
4009
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004010 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4011 Parcel data = Parcel.obtain();
4012 Parcel reply = Parcel.obtain();
4013 data.writeInterfaceToken(IActivityManager.descriptor);
4014 data.writeStrongBinder(sender.asBinder());
4015 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4016 reply.readException();
4017 boolean res = reply.readInt() != 0;
4018 data.recycle();
4019 reply.recycle();
4020 return res;
4021 }
4022
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004023 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4024 Parcel data = Parcel.obtain();
4025 Parcel reply = Parcel.obtain();
4026 data.writeInterfaceToken(IActivityManager.descriptor);
4027 data.writeStrongBinder(sender.asBinder());
4028 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4029 reply.readException();
4030 boolean res = reply.readInt() != 0;
4031 data.recycle();
4032 reply.recycle();
4033 return res;
4034 }
4035
Dianne Hackborn81038902012-11-26 17:04:09 -08004036 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4037 Parcel data = Parcel.obtain();
4038 Parcel reply = Parcel.obtain();
4039 data.writeInterfaceToken(IActivityManager.descriptor);
4040 data.writeStrongBinder(sender.asBinder());
4041 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4042 reply.readException();
4043 Intent res = reply.readInt() != 0
4044 ? Intent.CREATOR.createFromParcel(reply) : null;
4045 data.recycle();
4046 reply.recycle();
4047 return res;
4048 }
4049
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004050 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4051 {
4052 Parcel data = Parcel.obtain();
4053 Parcel reply = Parcel.obtain();
4054 data.writeInterfaceToken(IActivityManager.descriptor);
4055 values.writeToParcel(data, 0);
4056 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4057 reply.readException();
4058 data.recycle();
4059 reply.recycle();
4060 }
4061
Dianne Hackbornb437e092011-08-05 17:50:29 -07004062 public long[] getProcessPss(int[] pids) throws RemoteException {
4063 Parcel data = Parcel.obtain();
4064 Parcel reply = Parcel.obtain();
4065 data.writeInterfaceToken(IActivityManager.descriptor);
4066 data.writeIntArray(pids);
4067 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4068 reply.readException();
4069 long[] res = reply.createLongArray();
4070 data.recycle();
4071 reply.recycle();
4072 return res;
4073 }
4074
Dianne Hackborn661cd522011-08-22 00:26:20 -07004075 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4076 Parcel data = Parcel.obtain();
4077 Parcel reply = Parcel.obtain();
4078 data.writeInterfaceToken(IActivityManager.descriptor);
4079 TextUtils.writeToParcel(msg, data, 0);
4080 data.writeInt(always ? 1 : 0);
4081 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4082 reply.readException();
4083 data.recycle();
4084 reply.recycle();
4085 }
4086
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004087 public void dismissKeyguardOnNextActivity() throws RemoteException {
4088 Parcel data = Parcel.obtain();
4089 Parcel reply = Parcel.obtain();
4090 data.writeInterfaceToken(IActivityManager.descriptor);
4091 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4092 reply.readException();
4093 data.recycle();
4094 reply.recycle();
4095 }
4096
Adam Powelldd8fab22012-03-22 17:47:27 -07004097 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4098 throws RemoteException {
4099 Parcel data = Parcel.obtain();
4100 Parcel reply = Parcel.obtain();
4101 data.writeInterfaceToken(IActivityManager.descriptor);
4102 data.writeStrongBinder(token);
4103 data.writeString(destAffinity);
4104 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4105 reply.readException();
4106 boolean result = reply.readInt() != 0;
4107 data.recycle();
4108 reply.recycle();
4109 return result;
4110 }
4111
4112 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4113 throws RemoteException {
4114 Parcel data = Parcel.obtain();
4115 Parcel reply = Parcel.obtain();
4116 data.writeInterfaceToken(IActivityManager.descriptor);
4117 data.writeStrongBinder(token);
4118 target.writeToParcel(data, 0);
4119 data.writeInt(resultCode);
4120 if (resultData != null) {
4121 data.writeInt(1);
4122 resultData.writeToParcel(data, 0);
4123 } else {
4124 data.writeInt(0);
4125 }
4126 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4127 reply.readException();
4128 boolean result = reply.readInt() != 0;
4129 data.recycle();
4130 reply.recycle();
4131 return result;
4132 }
4133
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004134 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4135 Parcel data = Parcel.obtain();
4136 Parcel reply = Parcel.obtain();
4137 data.writeInterfaceToken(IActivityManager.descriptor);
4138 data.writeStrongBinder(activityToken);
4139 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4140 reply.readException();
4141 int result = reply.readInt();
4142 data.recycle();
4143 reply.recycle();
4144 return result;
4145 }
4146
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004147 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4148 Parcel data = Parcel.obtain();
4149 Parcel reply = Parcel.obtain();
4150 data.writeInterfaceToken(IActivityManager.descriptor);
4151 data.writeStrongBinder(activityToken);
4152 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4153 reply.readException();
4154 String result = reply.readString();
4155 data.recycle();
4156 reply.recycle();
4157 return result;
4158 }
4159
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004160 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4161 Parcel data = Parcel.obtain();
4162 Parcel reply = Parcel.obtain();
4163 data.writeInterfaceToken(IActivityManager.descriptor);
4164 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4165 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4166 reply.readException();
4167 data.recycle();
4168 reply.recycle();
4169 }
4170
4171 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4176 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4177 reply.readException();
4178 data.recycle();
4179 reply.recycle();
4180 }
4181
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004182 public void requestBugReport() throws RemoteException {
4183 Parcel data = Parcel.obtain();
4184 Parcel reply = Parcel.obtain();
4185 data.writeInterfaceToken(IActivityManager.descriptor);
4186 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4187 reply.readException();
4188 data.recycle();
4189 reply.recycle();
4190 }
4191
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004192 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4193 Parcel data = Parcel.obtain();
4194 Parcel reply = Parcel.obtain();
4195 data.writeInterfaceToken(IActivityManager.descriptor);
4196 data.writeInt(pid);
4197 data.writeInt(aboveSystem ? 1 : 0);
4198 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4199 reply.readException();
4200 long res = reply.readInt();
4201 data.recycle();
4202 reply.recycle();
4203 return res;
4204 }
4205
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004206 public Bundle getTopActivityExtras(int requestType) throws RemoteException {
4207 Parcel data = Parcel.obtain();
4208 Parcel reply = Parcel.obtain();
4209 data.writeInterfaceToken(IActivityManager.descriptor);
4210 data.writeInt(requestType);
4211 mRemote.transact(GET_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4212 reply.readException();
4213 Bundle res = reply.readBundle();
4214 data.recycle();
4215 reply.recycle();
4216 return res;
4217 }
4218
4219 public void reportTopActivityExtras(IBinder token, Bundle extras) throws RemoteException {
4220 Parcel data = Parcel.obtain();
4221 Parcel reply = Parcel.obtain();
4222 data.writeInterfaceToken(IActivityManager.descriptor);
4223 data.writeStrongBinder(token);
4224 data.writeBundle(extras);
4225 mRemote.transact(REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4226 reply.readException();
4227 data.recycle();
4228 reply.recycle();
4229 }
4230
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004231 private IBinder mRemote;
4232}