blob: 98baa0ebb63193a9d99ffbc765e10c4dfc48787a [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070020import android.content.IIntentReceiver;
21import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Intent;
23import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070028import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.res.Configuration;
30import android.graphics.Bitmap;
31import android.net.Uri;
32import android.os.Binder;
33import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070034import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.os.IBinder;
36import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070037import android.os.ParcelFileDescriptor;
38import android.os.Parcelable;
39import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070041import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080044import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import java.util.ArrayList;
47import java.util.List;
48
49/** {@hide} */
50public abstract class ActivityManagerNative extends Binder implements IActivityManager
51{
52 /**
53 * Cast a Binder object into an activity manager interface, generating
54 * a proxy if needed.
55 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080056 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 if (obj == null) {
58 return null;
59 }
60 IActivityManager in =
61 (IActivityManager)obj.queryLocalInterface(descriptor);
62 if (in != null) {
63 return in;
64 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 return new ActivityManagerProxy(obj);
67 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 /**
70 * Retrieve the system's default/global activity manager.
71 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072 static public IActivityManager getDefault() {
73 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 }
75
76 /**
77 * Convenience for checking whether the system is ready. For internal use only.
78 */
79 static public boolean isSystemReady() {
80 if (!sSystemReady) {
81 sSystemReady = getDefault().testIsSystemReady();
82 }
83 return sSystemReady;
84 }
85 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 /**
88 * Convenience for sending a sticky broadcast. For internal use only.
89 * If you don't care about permission, use null.
90 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070091 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 try {
93 getDefault().broadcastIntent(
94 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -080095 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 } catch (RemoteException ex) {
97 }
98 }
99
100 static public void noteWakeupAlarm(PendingIntent ps) {
101 try {
102 getDefault().noteWakeupAlarm(ps.getTarget());
103 } catch (RemoteException ex) {
104 }
105 }
106
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800107 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 attachInterface(this, descriptor);
109 }
110
111 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
112 throws RemoteException {
113 switch (code) {
114 case START_ACTIVITY_TRANSACTION:
115 {
116 data.enforceInterface(IActivityManager.descriptor);
117 IBinder b = data.readStrongBinder();
118 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800119 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 Intent intent = Intent.CREATOR.createFromParcel(data);
121 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800123 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700125 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700126 String profileFile = data.readString();
127 ParcelFileDescriptor profileFd = data.readInt() != 0
128 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700129 Bundle options = data.readInt() != 0
130 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800131 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 resultTo, resultWho, requestCode, startFlags,
133 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 reply.writeNoException();
135 reply.writeInt(result);
136 return true;
137 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700138
Amith Yamasani82644082012-08-03 13:09:11 -0700139 case START_ACTIVITY_AS_USER_TRANSACTION:
140 {
141 data.enforceInterface(IActivityManager.descriptor);
142 IBinder b = data.readStrongBinder();
143 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800144 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700145 Intent intent = Intent.CREATOR.createFromParcel(data);
146 String resolvedType = data.readString();
147 IBinder resultTo = data.readStrongBinder();
148 String resultWho = data.readString();
149 int requestCode = data.readInt();
150 int startFlags = data.readInt();
151 String profileFile = data.readString();
152 ParcelFileDescriptor profileFd = data.readInt() != 0
153 ? data.readFileDescriptor() : null;
154 Bundle options = data.readInt() != 0
155 ? Bundle.CREATOR.createFromParcel(data) : null;
156 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800157 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700158 resultTo, resultWho, requestCode, startFlags,
159 profileFile, profileFd, options, userId);
160 reply.writeNoException();
161 reply.writeInt(result);
162 return true;
163 }
164
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800165 case START_ACTIVITY_AND_WAIT_TRANSACTION:
166 {
167 data.enforceInterface(IActivityManager.descriptor);
168 IBinder b = data.readStrongBinder();
169 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800170 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800171 Intent intent = Intent.CREATOR.createFromParcel(data);
172 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800174 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800175 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700176 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700177 String profileFile = data.readString();
178 ParcelFileDescriptor profileFd = data.readInt() != 0
179 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700180 Bundle options = data.readInt() != 0
181 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700182 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800183 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700185 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800186 reply.writeNoException();
187 result.writeToParcel(reply, 0);
188 return true;
189 }
190
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700191 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
192 {
193 data.enforceInterface(IActivityManager.descriptor);
194 IBinder b = data.readStrongBinder();
195 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800196 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700197 Intent intent = Intent.CREATOR.createFromParcel(data);
198 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 IBinder resultTo = data.readStrongBinder();
200 String resultWho = data.readString();
201 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700202 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700204 Bundle options = data.readInt() != 0
205 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700206 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800207 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700208 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700209 reply.writeNoException();
210 reply.writeInt(result);
211 return true;
212 }
213
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700214 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700215 {
216 data.enforceInterface(IActivityManager.descriptor);
217 IBinder b = data.readStrongBinder();
218 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700219 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700220 Intent fillInIntent = null;
221 if (data.readInt() != 0) {
222 fillInIntent = Intent.CREATOR.createFromParcel(data);
223 }
224 String resolvedType = data.readString();
225 IBinder resultTo = data.readStrongBinder();
226 String resultWho = data.readString();
227 int requestCode = data.readInt();
228 int flagsMask = data.readInt();
229 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 Bundle options = data.readInt() != 0
231 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700232 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700233 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 reply.writeNoException();
236 reply.writeInt(result);
237 return true;
238 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239
240 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
241 {
242 data.enforceInterface(IActivityManager.descriptor);
243 IBinder callingActivity = data.readStrongBinder();
244 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700245 Bundle options = data.readInt() != 0
246 ? Bundle.CREATOR.createFromParcel(data) : null;
247 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 reply.writeNoException();
249 reply.writeInt(result ? 1 : 0);
250 return true;
251 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 case FINISH_ACTIVITY_TRANSACTION: {
254 data.enforceInterface(IActivityManager.descriptor);
255 IBinder token = data.readStrongBinder();
256 Intent resultData = null;
257 int resultCode = data.readInt();
258 if (data.readInt() != 0) {
259 resultData = Intent.CREATOR.createFromParcel(data);
260 }
261 boolean res = finishActivity(token, resultCode, resultData);
262 reply.writeNoException();
263 reply.writeInt(res ? 1 : 0);
264 return true;
265 }
266
267 case FINISH_SUB_ACTIVITY_TRANSACTION: {
268 data.enforceInterface(IActivityManager.descriptor);
269 IBinder token = data.readStrongBinder();
270 String resultWho = data.readString();
271 int requestCode = data.readInt();
272 finishSubActivity(token, resultWho, requestCode);
273 reply.writeNoException();
274 return true;
275 }
276
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700277 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
278 data.enforceInterface(IActivityManager.descriptor);
279 IBinder token = data.readStrongBinder();
280 boolean res = finishActivityAffinity(token);
281 reply.writeNoException();
282 reply.writeInt(res ? 1 : 0);
283 return true;
284 }
285
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800286 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
287 data.enforceInterface(IActivityManager.descriptor);
288 IBinder token = data.readStrongBinder();
289 boolean res = willActivityBeVisible(token);
290 reply.writeNoException();
291 reply.writeInt(res ? 1 : 0);
292 return true;
293 }
294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 case REGISTER_RECEIVER_TRANSACTION:
296 {
297 data.enforceInterface(IActivityManager.descriptor);
298 IBinder b = data.readStrongBinder();
299 IApplicationThread app =
300 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700301 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800302 b = data.readStrongBinder();
303 IIntentReceiver rec
304 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
305 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
306 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700307 int userId = data.readInt();
308 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800309 reply.writeNoException();
310 if (intent != null) {
311 reply.writeInt(1);
312 intent.writeToParcel(reply, 0);
313 } else {
314 reply.writeInt(0);
315 }
316 return true;
317 }
318
319 case UNREGISTER_RECEIVER_TRANSACTION:
320 {
321 data.enforceInterface(IActivityManager.descriptor);
322 IBinder b = data.readStrongBinder();
323 if (b == null) {
324 return true;
325 }
326 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
327 unregisterReceiver(rec);
328 reply.writeNoException();
329 return true;
330 }
331
332 case BROADCAST_INTENT_TRANSACTION:
333 {
334 data.enforceInterface(IActivityManager.descriptor);
335 IBinder b = data.readStrongBinder();
336 IApplicationThread app =
337 b != null ? ApplicationThreadNative.asInterface(b) : null;
338 Intent intent = Intent.CREATOR.createFromParcel(data);
339 String resolvedType = data.readString();
340 b = data.readStrongBinder();
341 IIntentReceiver resultTo =
342 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
343 int resultCode = data.readInt();
344 String resultData = data.readString();
345 Bundle resultExtras = data.readBundle();
346 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800347 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 boolean serialized = data.readInt() != 0;
349 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700350 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800352 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700353 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res);
356 return true;
357 }
358
359 case UNBROADCAST_INTENT_TRANSACTION:
360 {
361 data.enforceInterface(IActivityManager.descriptor);
362 IBinder b = data.readStrongBinder();
363 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
364 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700365 int userId = data.readInt();
366 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800367 reply.writeNoException();
368 return true;
369 }
370
371 case FINISH_RECEIVER_TRANSACTION: {
372 data.enforceInterface(IActivityManager.descriptor);
373 IBinder who = data.readStrongBinder();
374 int resultCode = data.readInt();
375 String resultData = data.readString();
376 Bundle resultExtras = data.readBundle();
377 boolean resultAbort = data.readInt() != 0;
378 if (who != null) {
379 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
380 }
381 reply.writeNoException();
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case ATTACH_APPLICATION_TRANSACTION: {
386 data.enforceInterface(IActivityManager.descriptor);
387 IApplicationThread app = ApplicationThreadNative.asInterface(
388 data.readStrongBinder());
389 if (app != null) {
390 attachApplication(app);
391 }
392 reply.writeNoException();
393 return true;
394 }
395
396 case ACTIVITY_IDLE_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700399 Configuration config = null;
400 if (data.readInt() != 0) {
401 config = Configuration.CREATOR.createFromParcel(data);
402 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700403 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800404 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700405 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 }
407 reply.writeNoException();
408 return true;
409 }
410
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700411 case ACTIVITY_RESUMED_TRANSACTION: {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder token = data.readStrongBinder();
414 activityResumed(token);
415 reply.writeNoException();
416 return true;
417 }
418
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 case ACTIVITY_PAUSED_TRANSACTION: {
420 data.enforceInterface(IActivityManager.descriptor);
421 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800422 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 reply.writeNoException();
424 return true;
425 }
426
427 case ACTIVITY_STOPPED_TRANSACTION: {
428 data.enforceInterface(IActivityManager.descriptor);
429 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800430 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 Bitmap thumbnail = data.readInt() != 0
432 ? Bitmap.CREATOR.createFromParcel(data) : null;
433 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800434 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800435 reply.writeNoException();
436 return true;
437 }
438
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800439 case ACTIVITY_SLEPT_TRANSACTION: {
440 data.enforceInterface(IActivityManager.descriptor);
441 IBinder token = data.readStrongBinder();
442 activitySlept(token);
443 reply.writeNoException();
444 return true;
445 }
446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 case ACTIVITY_DESTROYED_TRANSACTION: {
448 data.enforceInterface(IActivityManager.descriptor);
449 IBinder token = data.readStrongBinder();
450 activityDestroyed(token);
451 reply.writeNoException();
452 return true;
453 }
454
455 case GET_CALLING_PACKAGE_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
458 String res = token != null ? getCallingPackage(token) : null;
459 reply.writeNoException();
460 reply.writeString(res);
461 return true;
462 }
463
464 case GET_CALLING_ACTIVITY_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
467 ComponentName cn = getCallingActivity(token);
468 reply.writeNoException();
469 ComponentName.writeToParcel(cn, reply);
470 return true;
471 }
472
473 case GET_TASKS_TRANSACTION: {
474 data.enforceInterface(IActivityManager.descriptor);
475 int maxNum = data.readInt();
476 int fl = data.readInt();
477 IBinder receiverBinder = data.readStrongBinder();
478 IThumbnailReceiver receiver = receiverBinder != null
479 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
480 : null;
481 List list = getTasks(maxNum, fl, receiver);
482 reply.writeNoException();
483 int N = list != null ? list.size() : -1;
484 reply.writeInt(N);
485 int i;
486 for (i=0; i<N; i++) {
487 ActivityManager.RunningTaskInfo info =
488 (ActivityManager.RunningTaskInfo)list.get(i);
489 info.writeToParcel(reply, 0);
490 }
491 return true;
492 }
493
494 case GET_RECENT_TASKS_TRANSACTION: {
495 data.enforceInterface(IActivityManager.descriptor);
496 int maxNum = data.readInt();
497 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700498 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700500 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 reply.writeNoException();
502 reply.writeTypedList(list);
503 return true;
504 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700505
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700506 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800507 data.enforceInterface(IActivityManager.descriptor);
508 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700509 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800510 reply.writeNoException();
511 if (bm != null) {
512 reply.writeInt(1);
513 bm.writeToParcel(reply, 0);
514 } else {
515 reply.writeInt(0);
516 }
517 return true;
518 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700519
520 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
521 data.enforceInterface(IActivityManager.descriptor);
522 int id = data.readInt();
523 Bitmap bm = getTaskTopThumbnail(id);
524 reply.writeNoException();
525 if (bm != null) {
526 reply.writeInt(1);
527 bm.writeToParcel(reply, 0);
528 } else {
529 reply.writeInt(0);
530 }
531 return true;
532 }
533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 case GET_SERVICES_TRANSACTION: {
535 data.enforceInterface(IActivityManager.descriptor);
536 int maxNum = data.readInt();
537 int fl = data.readInt();
538 List list = getServices(maxNum, fl);
539 reply.writeNoException();
540 int N = list != null ? list.size() : -1;
541 reply.writeInt(N);
542 int i;
543 for (i=0; i<N; i++) {
544 ActivityManager.RunningServiceInfo info =
545 (ActivityManager.RunningServiceInfo)list.get(i);
546 info.writeToParcel(reply, 0);
547 }
548 return true;
549 }
550
551 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
552 data.enforceInterface(IActivityManager.descriptor);
553 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
554 reply.writeNoException();
555 reply.writeTypedList(list);
556 return true;
557 }
558
559 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
560 data.enforceInterface(IActivityManager.descriptor);
561 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
562 reply.writeNoException();
563 reply.writeTypedList(list);
564 return true;
565 }
566
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700567 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 List<ApplicationInfo> list = getRunningExternalApplications();
570 reply.writeNoException();
571 reply.writeTypedList(list);
572 return true;
573 }
574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 case MOVE_TASK_TO_FRONT_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800578 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700579 Bundle options = data.readInt() != 0
580 ? Bundle.CREATOR.createFromParcel(data) : null;
581 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 reply.writeNoException();
583 return true;
584 }
585
586 case MOVE_TASK_TO_BACK_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 int task = data.readInt();
589 moveTaskToBack(task);
590 reply.writeNoException();
591 return true;
592 }
593
594 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder token = data.readStrongBinder();
597 boolean nonRoot = data.readInt() != 0;
598 boolean res = moveActivityTaskToBack(token, nonRoot);
599 reply.writeNoException();
600 reply.writeInt(res ? 1 : 0);
601 return true;
602 }
603
604 case MOVE_TASK_BACKWARDS_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 int task = data.readInt();
607 moveTaskBackwards(task);
608 reply.writeNoException();
609 return true;
610 }
611
612 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
614 IBinder token = data.readStrongBinder();
615 boolean onlyRoot = data.readInt() != 0;
616 int res = token != null
617 ? getTaskForActivity(token, onlyRoot) : -1;
618 reply.writeNoException();
619 reply.writeInt(res);
620 return true;
621 }
622
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 case REPORT_THUMBNAIL_TRANSACTION: {
624 data.enforceInterface(IActivityManager.descriptor);
625 IBinder token = data.readStrongBinder();
626 Bitmap thumbnail = data.readInt() != 0
627 ? Bitmap.CREATOR.createFromParcel(data) : null;
628 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
629 reportThumbnail(token, thumbnail, description);
630 reply.writeNoException();
631 return true;
632 }
633
634 case GET_CONTENT_PROVIDER_TRANSACTION: {
635 data.enforceInterface(IActivityManager.descriptor);
636 IBinder b = data.readStrongBinder();
637 IApplicationThread app = ApplicationThreadNative.asInterface(b);
638 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700639 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700640 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700641 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 reply.writeNoException();
643 if (cph != null) {
644 reply.writeInt(1);
645 cph.writeToParcel(reply, 0);
646 } else {
647 reply.writeInt(0);
648 }
649 return true;
650 }
651
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800652 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
653 data.enforceInterface(IActivityManager.descriptor);
654 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700655 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800656 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700657 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800658 reply.writeNoException();
659 if (cph != null) {
660 reply.writeInt(1);
661 cph.writeToParcel(reply, 0);
662 } else {
663 reply.writeInt(0);
664 }
665 return true;
666 }
667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
669 data.enforceInterface(IActivityManager.descriptor);
670 IBinder b = data.readStrongBinder();
671 IApplicationThread app = ApplicationThreadNative.asInterface(b);
672 ArrayList<ContentProviderHolder> providers =
673 data.createTypedArrayList(ContentProviderHolder.CREATOR);
674 publishContentProviders(app, providers);
675 reply.writeNoException();
676 return true;
677 }
678
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700679 case REF_CONTENT_PROVIDER_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 IBinder b = data.readStrongBinder();
682 int stable = data.readInt();
683 int unstable = data.readInt();
684 boolean res = refContentProvider(b, stable, unstable);
685 reply.writeNoException();
686 reply.writeInt(res ? 1 : 0);
687 return true;
688 }
689
690 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
691 data.enforceInterface(IActivityManager.descriptor);
692 IBinder b = data.readStrongBinder();
693 unstableProviderDied(b);
694 reply.writeNoException();
695 return true;
696 }
697
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
699 data.enforceInterface(IActivityManager.descriptor);
700 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700701 boolean stable = data.readInt() != 0;
702 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 reply.writeNoException();
704 return true;
705 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800706
707 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 String name = data.readString();
710 IBinder token = data.readStrongBinder();
711 removeContentProviderExternal(name, token);
712 reply.writeNoException();
713 return true;
714 }
715
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700716 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
717 data.enforceInterface(IActivityManager.descriptor);
718 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
719 PendingIntent pi = getRunningServiceControlPanel(comp);
720 reply.writeNoException();
721 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
722 return true;
723 }
724
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800725 case START_SERVICE_TRANSACTION: {
726 data.enforceInterface(IActivityManager.descriptor);
727 IBinder b = data.readStrongBinder();
728 IApplicationThread app = ApplicationThreadNative.asInterface(b);
729 Intent service = Intent.CREATOR.createFromParcel(data);
730 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700731 int userId = data.readInt();
732 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800733 reply.writeNoException();
734 ComponentName.writeToParcel(cn, reply);
735 return true;
736 }
737
738 case STOP_SERVICE_TRANSACTION: {
739 data.enforceInterface(IActivityManager.descriptor);
740 IBinder b = data.readStrongBinder();
741 IApplicationThread app = ApplicationThreadNative.asInterface(b);
742 Intent service = Intent.CREATOR.createFromParcel(data);
743 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700744 int userId = data.readInt();
745 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 reply.writeNoException();
747 reply.writeInt(res);
748 return true;
749 }
750
751 case STOP_SERVICE_TOKEN_TRANSACTION: {
752 data.enforceInterface(IActivityManager.descriptor);
753 ComponentName className = ComponentName.readFromParcel(data);
754 IBinder token = data.readStrongBinder();
755 int startId = data.readInt();
756 boolean res = stopServiceToken(className, token, startId);
757 reply.writeNoException();
758 reply.writeInt(res ? 1 : 0);
759 return true;
760 }
761
762 case SET_SERVICE_FOREGROUND_TRANSACTION: {
763 data.enforceInterface(IActivityManager.descriptor);
764 ComponentName className = ComponentName.readFromParcel(data);
765 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700766 int id = data.readInt();
767 Notification notification = null;
768 if (data.readInt() != 0) {
769 notification = Notification.CREATOR.createFromParcel(data);
770 }
771 boolean removeNotification = data.readInt() != 0;
772 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 reply.writeNoException();
774 return true;
775 }
776
777 case BIND_SERVICE_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder b = data.readStrongBinder();
780 IApplicationThread app = ApplicationThreadNative.asInterface(b);
781 IBinder token = data.readStrongBinder();
782 Intent service = Intent.CREATOR.createFromParcel(data);
783 String resolvedType = data.readString();
784 b = data.readStrongBinder();
785 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800786 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800788 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 reply.writeNoException();
790 reply.writeInt(res);
791 return true;
792 }
793
794 case UNBIND_SERVICE_TRANSACTION: {
795 data.enforceInterface(IActivityManager.descriptor);
796 IBinder b = data.readStrongBinder();
797 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
798 boolean res = unbindService(conn);
799 reply.writeNoException();
800 reply.writeInt(res ? 1 : 0);
801 return true;
802 }
803
804 case PUBLISH_SERVICE_TRANSACTION: {
805 data.enforceInterface(IActivityManager.descriptor);
806 IBinder token = data.readStrongBinder();
807 Intent intent = Intent.CREATOR.createFromParcel(data);
808 IBinder service = data.readStrongBinder();
809 publishService(token, intent, service);
810 reply.writeNoException();
811 return true;
812 }
813
814 case UNBIND_FINISHED_TRANSACTION: {
815 data.enforceInterface(IActivityManager.descriptor);
816 IBinder token = data.readStrongBinder();
817 Intent intent = Intent.CREATOR.createFromParcel(data);
818 boolean doRebind = data.readInt() != 0;
819 unbindFinished(token, intent, doRebind);
820 reply.writeNoException();
821 return true;
822 }
823
824 case SERVICE_DONE_EXECUTING_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700827 int type = data.readInt();
828 int startId = data.readInt();
829 int res = data.readInt();
830 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800831 reply.writeNoException();
832 return true;
833 }
834
835 case START_INSTRUMENTATION_TRANSACTION: {
836 data.enforceInterface(IActivityManager.descriptor);
837 ComponentName className = ComponentName.readFromParcel(data);
838 String profileFile = data.readString();
839 int fl = data.readInt();
840 Bundle arguments = data.readBundle();
841 IBinder b = data.readStrongBinder();
842 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800843 b = data.readStrongBinder();
844 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700845 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800846 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800847 reply.writeNoException();
848 reply.writeInt(res ? 1 : 0);
849 return true;
850 }
851
852
853 case FINISH_INSTRUMENTATION_TRANSACTION: {
854 data.enforceInterface(IActivityManager.descriptor);
855 IBinder b = data.readStrongBinder();
856 IApplicationThread app = ApplicationThreadNative.asInterface(b);
857 int resultCode = data.readInt();
858 Bundle results = data.readBundle();
859 finishInstrumentation(app, resultCode, results);
860 reply.writeNoException();
861 return true;
862 }
863
864 case GET_CONFIGURATION_TRANSACTION: {
865 data.enforceInterface(IActivityManager.descriptor);
866 Configuration config = getConfiguration();
867 reply.writeNoException();
868 config.writeToParcel(reply, 0);
869 return true;
870 }
871
872 case UPDATE_CONFIGURATION_TRANSACTION: {
873 data.enforceInterface(IActivityManager.descriptor);
874 Configuration config = Configuration.CREATOR.createFromParcel(data);
875 updateConfiguration(config);
876 reply.writeNoException();
877 return true;
878 }
879
880 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
881 data.enforceInterface(IActivityManager.descriptor);
882 IBinder token = data.readStrongBinder();
883 int requestedOrientation = data.readInt();
884 setRequestedOrientation(token, requestedOrientation);
885 reply.writeNoException();
886 return true;
887 }
888
889 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
890 data.enforceInterface(IActivityManager.descriptor);
891 IBinder token = data.readStrongBinder();
892 int req = getRequestedOrientation(token);
893 reply.writeNoException();
894 reply.writeInt(req);
895 return true;
896 }
897
898 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
899 data.enforceInterface(IActivityManager.descriptor);
900 IBinder token = data.readStrongBinder();
901 ComponentName cn = getActivityClassForToken(token);
902 reply.writeNoException();
903 ComponentName.writeToParcel(cn, reply);
904 return true;
905 }
906
907 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 IBinder token = data.readStrongBinder();
910 reply.writeNoException();
911 reply.writeString(getPackageForToken(token));
912 return true;
913 }
914
915 case GET_INTENT_SENDER_TRANSACTION: {
916 data.enforceInterface(IActivityManager.descriptor);
917 int type = data.readInt();
918 String packageName = data.readString();
919 IBinder token = data.readStrongBinder();
920 String resultWho = data.readString();
921 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800922 Intent[] requestIntents;
923 String[] requestResolvedTypes;
924 if (data.readInt() != 0) {
925 requestIntents = data.createTypedArray(Intent.CREATOR);
926 requestResolvedTypes = data.createStringArray();
927 } else {
928 requestIntents = null;
929 requestResolvedTypes = null;
930 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700932 Bundle options = data.readInt() != 0
933 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700934 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800935 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800936 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700937 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 reply.writeNoException();
939 reply.writeStrongBinder(res != null ? res.asBinder() : null);
940 return true;
941 }
942
943 case CANCEL_INTENT_SENDER_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 IIntentSender r = IIntentSender.Stub.asInterface(
946 data.readStrongBinder());
947 cancelIntentSender(r);
948 reply.writeNoException();
949 return true;
950 }
951
952 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
953 data.enforceInterface(IActivityManager.descriptor);
954 IIntentSender r = IIntentSender.Stub.asInterface(
955 data.readStrongBinder());
956 String res = getPackageForIntentSender(r);
957 reply.writeNoException();
958 reply.writeString(res);
959 return true;
960 }
961
Christopher Tatec4a07d12012-04-06 14:19:13 -0700962 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
963 data.enforceInterface(IActivityManager.descriptor);
964 IIntentSender r = IIntentSender.Stub.asInterface(
965 data.readStrongBinder());
966 int res = getUidForIntentSender(r);
967 reply.writeNoException();
968 reply.writeInt(res);
969 return true;
970 }
971
Dianne Hackborn41203752012-08-31 14:05:51 -0700972 case HANDLE_INCOMING_USER_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 int callingPid = data.readInt();
975 int callingUid = data.readInt();
976 int userId = data.readInt();
977 boolean allowAll = data.readInt() != 0 ;
978 boolean requireFull = data.readInt() != 0;
979 String name = data.readString();
980 String callerPackage = data.readString();
981 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
982 requireFull, name, callerPackage);
983 reply.writeNoException();
984 reply.writeInt(res);
985 return true;
986 }
987
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800988 case SET_PROCESS_LIMIT_TRANSACTION: {
989 data.enforceInterface(IActivityManager.descriptor);
990 int max = data.readInt();
991 setProcessLimit(max);
992 reply.writeNoException();
993 return true;
994 }
995
996 case GET_PROCESS_LIMIT_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 int limit = getProcessLimit();
999 reply.writeNoException();
1000 reply.writeInt(limit);
1001 return true;
1002 }
1003
1004 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IBinder token = data.readStrongBinder();
1007 int pid = data.readInt();
1008 boolean isForeground = data.readInt() != 0;
1009 setProcessForeground(token, pid, isForeground);
1010 reply.writeNoException();
1011 return true;
1012 }
1013
1014 case CHECK_PERMISSION_TRANSACTION: {
1015 data.enforceInterface(IActivityManager.descriptor);
1016 String perm = data.readString();
1017 int pid = data.readInt();
1018 int uid = data.readInt();
1019 int res = checkPermission(perm, pid, uid);
1020 reply.writeNoException();
1021 reply.writeInt(res);
1022 return true;
1023 }
1024
1025 case CHECK_URI_PERMISSION_TRANSACTION: {
1026 data.enforceInterface(IActivityManager.descriptor);
1027 Uri uri = Uri.CREATOR.createFromParcel(data);
1028 int pid = data.readInt();
1029 int uid = data.readInt();
1030 int mode = data.readInt();
1031 int res = checkUriPermission(uri, pid, uid, mode);
1032 reply.writeNoException();
1033 reply.writeInt(res);
1034 return true;
1035 }
1036
1037 case CLEAR_APP_DATA_TRANSACTION: {
1038 data.enforceInterface(IActivityManager.descriptor);
1039 String packageName = data.readString();
1040 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1041 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001042 int userId = data.readInt();
1043 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001044 reply.writeNoException();
1045 reply.writeInt(res ? 1 : 0);
1046 return true;
1047 }
1048
1049 case GRANT_URI_PERMISSION_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 IBinder b = data.readStrongBinder();
1052 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1053 String targetPkg = data.readString();
1054 Uri uri = Uri.CREATOR.createFromParcel(data);
1055 int mode = data.readInt();
1056 grantUriPermission(app, targetPkg, uri, mode);
1057 reply.writeNoException();
1058 return true;
1059 }
1060
1061 case REVOKE_URI_PERMISSION_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder b = data.readStrongBinder();
1064 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1065 Uri uri = Uri.CREATOR.createFromParcel(data);
1066 int mode = data.readInt();
1067 revokeUriPermission(app, uri, mode);
1068 reply.writeNoException();
1069 return true;
1070 }
1071
1072 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1073 data.enforceInterface(IActivityManager.descriptor);
1074 IBinder b = data.readStrongBinder();
1075 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1076 boolean waiting = data.readInt() != 0;
1077 showWaitingForDebugger(app, waiting);
1078 reply.writeNoException();
1079 return true;
1080 }
1081
1082 case GET_MEMORY_INFO_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
1084 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1085 getMemoryInfo(mi);
1086 reply.writeNoException();
1087 mi.writeToParcel(reply, 0);
1088 return true;
1089 }
1090
1091 case UNHANDLED_BACK_TRANSACTION: {
1092 data.enforceInterface(IActivityManager.descriptor);
1093 unhandledBack();
1094 reply.writeNoException();
1095 return true;
1096 }
1097
1098 case OPEN_CONTENT_URI_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 Uri uri = Uri.parse(data.readString());
1101 ParcelFileDescriptor pfd = openContentUri(uri);
1102 reply.writeNoException();
1103 if (pfd != null) {
1104 reply.writeInt(1);
1105 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1106 } else {
1107 reply.writeInt(0);
1108 }
1109 return true;
1110 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001111
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001112 case GOING_TO_SLEEP_TRANSACTION: {
1113 data.enforceInterface(IActivityManager.descriptor);
1114 goingToSleep();
1115 reply.writeNoException();
1116 return true;
1117 }
1118
1119 case WAKING_UP_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
1121 wakingUp();
1122 reply.writeNoException();
1123 return true;
1124 }
1125
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001126 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 setLockScreenShown(data.readInt() != 0);
1129 reply.writeNoException();
1130 return true;
1131 }
1132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 case SET_DEBUG_APP_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 String pn = data.readString();
1136 boolean wfd = data.readInt() != 0;
1137 boolean per = data.readInt() != 0;
1138 setDebugApp(pn, wfd, per);
1139 reply.writeNoException();
1140 return true;
1141 }
1142
1143 case SET_ALWAYS_FINISH_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 boolean enabled = data.readInt() != 0;
1146 setAlwaysFinish(enabled);
1147 reply.writeNoException();
1148 return true;
1149 }
1150
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001151 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001153 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001154 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001155 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001156 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 return true;
1158 }
1159
1160 case ENTER_SAFE_MODE_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 enterSafeMode();
1163 reply.writeNoException();
1164 return true;
1165 }
1166
1167 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 IIntentSender is = IIntentSender.Stub.asInterface(
1170 data.readStrongBinder());
1171 noteWakeupAlarm(is);
1172 reply.writeNoException();
1173 return true;
1174 }
1175
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001176 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001177 data.enforceInterface(IActivityManager.descriptor);
1178 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001179 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001180 boolean secure = data.readInt() != 0;
1181 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 reply.writeNoException();
1183 reply.writeInt(res ? 1 : 0);
1184 return true;
1185 }
1186
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001187 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 String reason = data.readString();
1190 boolean res = killProcessesBelowForeground(reason);
1191 reply.writeNoException();
1192 reply.writeInt(res ? 1 : 0);
1193 return true;
1194 }
1195
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 case START_RUNNING_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 String pkg = data.readString();
1199 String cls = data.readString();
1200 String action = data.readString();
1201 String indata = data.readString();
1202 startRunning(pkg, cls, action, indata);
1203 reply.writeNoException();
1204 return true;
1205 }
1206
Dan Egnor60d87622009-12-16 16:32:58 -08001207 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1208 data.enforceInterface(IActivityManager.descriptor);
1209 IBinder app = data.readStrongBinder();
1210 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1211 handleApplicationCrash(app, ci);
1212 reply.writeNoException();
1213 return true;
1214 }
1215
1216 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001217 data.enforceInterface(IActivityManager.descriptor);
1218 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001219 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001220 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001221 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001223 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 return true;
1225 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001226
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001227 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001230 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001231 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1232 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001233 reply.writeNoException();
1234 return true;
1235 }
1236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001237 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 int sig = data.readInt();
1240 signalPersistentProcesses(sig);
1241 reply.writeNoException();
1242 return true;
1243 }
1244
Dianne Hackborn03abb812010-01-04 18:43:19 -08001245 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1246 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001248 int userId = data.readInt();
1249 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001250 reply.writeNoException();
1251 return true;
1252 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001253
1254 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
1256 killAllBackgroundProcesses();
1257 reply.writeNoException();
1258 return true;
1259 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001260
1261 case FORCE_STOP_PACKAGE_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001264 int userId = data.readInt();
1265 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001266 reply.writeNoException();
1267 return true;
1268 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001269
1270 case GET_MY_MEMORY_STATE_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 ActivityManager.RunningAppProcessInfo info =
1273 new ActivityManager.RunningAppProcessInfo();
1274 getMyMemoryState(info);
1275 reply.writeNoException();
1276 info.writeToParcel(reply, 0);
1277 return true;
1278 }
1279
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 ConfigurationInfo config = getDeviceConfigurationInfo();
1283 reply.writeNoException();
1284 config.writeToParcel(reply, 0);
1285 return true;
1286 }
1287
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001288 case PROFILE_CONTROL_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001291 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001292 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001293 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001294 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001295 ParcelFileDescriptor fd = data.readInt() != 0
1296 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001297 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001298 reply.writeNoException();
1299 reply.writeInt(res ? 1 : 0);
1300 return true;
1301 }
1302
Dianne Hackborn55280a92009-05-07 15:53:46 -07001303 case SHUTDOWN_TRANSACTION: {
1304 data.enforceInterface(IActivityManager.descriptor);
1305 boolean res = shutdown(data.readInt());
1306 reply.writeNoException();
1307 reply.writeInt(res ? 1 : 0);
1308 return true;
1309 }
1310
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001311 case STOP_APP_SWITCHES_TRANSACTION: {
1312 data.enforceInterface(IActivityManager.descriptor);
1313 stopAppSwitches();
1314 reply.writeNoException();
1315 return true;
1316 }
1317
1318 case RESUME_APP_SWITCHES_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 resumeAppSwitches();
1321 reply.writeNoException();
1322 return true;
1323 }
1324
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001325 case PEEK_SERVICE_TRANSACTION: {
1326 data.enforceInterface(IActivityManager.descriptor);
1327 Intent service = Intent.CREATOR.createFromParcel(data);
1328 String resolvedType = data.readString();
1329 IBinder binder = peekService(service, resolvedType);
1330 reply.writeNoException();
1331 reply.writeStrongBinder(binder);
1332 return true;
1333 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001334
1335 case START_BACKUP_AGENT_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1338 int backupRestoreMode = data.readInt();
1339 boolean success = bindBackupAgent(info, backupRestoreMode);
1340 reply.writeNoException();
1341 reply.writeInt(success ? 1 : 0);
1342 return true;
1343 }
1344
1345 case BACKUP_AGENT_CREATED_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 String packageName = data.readString();
1348 IBinder agent = data.readStrongBinder();
1349 backupAgentCreated(packageName, agent);
1350 reply.writeNoException();
1351 return true;
1352 }
1353
1354 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1355 data.enforceInterface(IActivityManager.descriptor);
1356 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1357 unbindBackupAgent(info);
1358 reply.writeNoException();
1359 return true;
1360 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001361
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001362 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001363 data.enforceInterface(IActivityManager.descriptor);
1364 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001365 int appid = data.readInt();
1366 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001367 reply.writeNoException();
1368 return true;
1369 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001370
1371 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
1373 String reason = data.readString();
1374 closeSystemDialogs(reason);
1375 reply.writeNoException();
1376 return true;
1377 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001378
1379 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1380 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001381 int[] pids = data.createIntArray();
1382 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001383 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001384 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001385 return true;
1386 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001387
1388 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1389 data.enforceInterface(IActivityManager.descriptor);
1390 String processName = data.readString();
1391 int uid = data.readInt();
1392 killApplicationProcess(processName, uid);
1393 reply.writeNoException();
1394 return true;
1395 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001396
1397 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1398 data.enforceInterface(IActivityManager.descriptor);
1399 IBinder token = data.readStrongBinder();
1400 String packageName = data.readString();
1401 int enterAnim = data.readInt();
1402 int exitAnim = data.readInt();
1403 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001404 reply.writeNoException();
1405 return true;
1406 }
1407
1408 case IS_USER_A_MONKEY_TRANSACTION: {
1409 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001410 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001411 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001412 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001413 return true;
1414 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001415
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001416 case SET_USER_IS_MONKEY_TRANSACTION: {
1417 data.enforceInterface(IActivityManager.descriptor);
1418 final boolean monkey = (data.readInt() == 1);
1419 setUserIsMonkey(monkey);
1420 reply.writeNoException();
1421 return true;
1422 }
1423
Dianne Hackborn860755f2010-06-03 18:47:52 -07001424 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1425 data.enforceInterface(IActivityManager.descriptor);
1426 finishHeavyWeightApp();
1427 reply.writeNoException();
1428 return true;
1429 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001430
1431 case IS_IMMERSIVE_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001434 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001435 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001436 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001437 return true;
1438 }
1439
1440 case SET_IMMERSIVE_TRANSACTION: {
1441 data.enforceInterface(IActivityManager.descriptor);
1442 IBinder token = data.readStrongBinder();
1443 boolean imm = data.readInt() == 1;
1444 setImmersive(token, imm);
1445 reply.writeNoException();
1446 return true;
1447 }
1448
1449 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1450 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001451 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001452 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001453 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001454 return true;
1455 }
1456
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001457 case CRASH_APPLICATION_TRANSACTION: {
1458 data.enforceInterface(IActivityManager.descriptor);
1459 int uid = data.readInt();
1460 int initialPid = data.readInt();
1461 String packageName = data.readString();
1462 String message = data.readString();
1463 crashApplication(uid, initialPid, packageName, message);
1464 reply.writeNoException();
1465 return true;
1466 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001467
1468 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1469 data.enforceInterface(IActivityManager.descriptor);
1470 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001471 int userId = data.readInt();
1472 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001473 reply.writeNoException();
1474 reply.writeString(type);
1475 return true;
1476 }
1477
Dianne Hackborn7e269642010-08-25 19:50:20 -07001478 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 String name = data.readString();
1481 IBinder perm = newUriPermissionOwner(name);
1482 reply.writeNoException();
1483 reply.writeStrongBinder(perm);
1484 return true;
1485 }
1486
1487 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
1489 IBinder owner = data.readStrongBinder();
1490 int fromUid = data.readInt();
1491 String targetPkg = data.readString();
1492 Uri uri = Uri.CREATOR.createFromParcel(data);
1493 int mode = data.readInt();
1494 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1495 reply.writeNoException();
1496 return true;
1497 }
1498
1499 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 IBinder owner = data.readStrongBinder();
1502 Uri uri = null;
1503 if (data.readInt() != 0) {
1504 Uri.CREATOR.createFromParcel(data);
1505 }
1506 int mode = data.readInt();
1507 revokeUriPermissionFromOwner(owner, uri, mode);
1508 reply.writeNoException();
1509 return true;
1510 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001511
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001512 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1513 data.enforceInterface(IActivityManager.descriptor);
1514 int callingUid = data.readInt();
1515 String targetPkg = data.readString();
1516 Uri uri = Uri.CREATOR.createFromParcel(data);
1517 int modeFlags = data.readInt();
1518 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1519 reply.writeNoException();
1520 reply.writeInt(res);
1521 return true;
1522 }
1523
Andy McFadden824c5102010-07-09 16:26:57 -07001524 case DUMP_HEAP_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001527 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001528 boolean managed = data.readInt() != 0;
1529 String path = data.readString();
1530 ParcelFileDescriptor fd = data.readInt() != 0
1531 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001532 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001533 reply.writeNoException();
1534 reply.writeInt(res ? 1 : 0);
1535 return true;
1536 }
1537
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001538 case START_ACTIVITIES_TRANSACTION:
1539 {
1540 data.enforceInterface(IActivityManager.descriptor);
1541 IBinder b = data.readStrongBinder();
1542 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001543 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001544 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1545 String[] resolvedTypes = data.createStringArray();
1546 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001547 Bundle options = data.readInt() != 0
1548 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001549 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001550 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001551 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001552 reply.writeNoException();
1553 reply.writeInt(result);
1554 return true;
1555 }
1556
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001557 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1558 {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 int mode = getFrontActivityScreenCompatMode();
1561 reply.writeNoException();
1562 reply.writeInt(mode);
1563 return true;
1564 }
1565
1566 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1567 {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 int mode = data.readInt();
1570 setFrontActivityScreenCompatMode(mode);
1571 reply.writeNoException();
1572 reply.writeInt(mode);
1573 return true;
1574 }
1575
1576 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1577 {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 String pkg = data.readString();
1580 int mode = getPackageScreenCompatMode(pkg);
1581 reply.writeNoException();
1582 reply.writeInt(mode);
1583 return true;
1584 }
1585
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001586 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1587 {
1588 data.enforceInterface(IActivityManager.descriptor);
1589 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001590 int mode = data.readInt();
1591 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001592 reply.writeNoException();
1593 return true;
1594 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001595
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001596 case SWITCH_USER_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 int userid = data.readInt();
1599 boolean result = switchUser(userid);
1600 reply.writeNoException();
1601 reply.writeInt(result ? 1 : 0);
1602 return true;
1603 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001604
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001605 case STOP_USER_TRANSACTION: {
1606 data.enforceInterface(IActivityManager.descriptor);
1607 int userid = data.readInt();
1608 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1609 data.readStrongBinder());
1610 int result = stopUser(userid, callback);
1611 reply.writeNoException();
1612 reply.writeInt(result);
1613 return true;
1614 }
1615
Amith Yamasani52f1d752012-03-28 18:19:29 -07001616 case GET_CURRENT_USER_TRANSACTION: {
1617 data.enforceInterface(IActivityManager.descriptor);
1618 UserInfo userInfo = getCurrentUser();
1619 reply.writeNoException();
1620 userInfo.writeToParcel(reply, 0);
1621 return true;
1622 }
1623
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001624 case IS_USER_RUNNING_TRANSACTION: {
1625 data.enforceInterface(IActivityManager.descriptor);
1626 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001627 boolean orStopping = data.readInt() != 0;
1628 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001629 reply.writeNoException();
1630 reply.writeInt(result ? 1 : 0);
1631 return true;
1632 }
1633
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001634 case GET_RUNNING_USER_IDS_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 int[] result = getRunningUserIds();
1637 reply.writeNoException();
1638 reply.writeIntArray(result);
1639 return true;
1640 }
1641
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001642 case REMOVE_SUB_TASK_TRANSACTION:
1643 {
1644 data.enforceInterface(IActivityManager.descriptor);
1645 int taskId = data.readInt();
1646 int subTaskIndex = data.readInt();
1647 boolean result = removeSubTask(taskId, subTaskIndex);
1648 reply.writeNoException();
1649 reply.writeInt(result ? 1 : 0);
1650 return true;
1651 }
1652
1653 case REMOVE_TASK_TRANSACTION:
1654 {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 int taskId = data.readInt();
1657 int fl = data.readInt();
1658 boolean result = removeTask(taskId, fl);
1659 reply.writeNoException();
1660 reply.writeInt(result ? 1 : 0);
1661 return true;
1662 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001663
Jeff Sharkeya4620792011-05-20 15:29:23 -07001664 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1665 data.enforceInterface(IActivityManager.descriptor);
1666 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1667 data.readStrongBinder());
1668 registerProcessObserver(observer);
1669 return true;
1670 }
1671
1672 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1675 data.readStrongBinder());
1676 unregisterProcessObserver(observer);
1677 return true;
1678 }
1679
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001680 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1681 {
1682 data.enforceInterface(IActivityManager.descriptor);
1683 String pkg = data.readString();
1684 boolean ask = getPackageAskScreenCompat(pkg);
1685 reply.writeNoException();
1686 reply.writeInt(ask ? 1 : 0);
1687 return true;
1688 }
1689
1690 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1691 {
1692 data.enforceInterface(IActivityManager.descriptor);
1693 String pkg = data.readString();
1694 boolean ask = data.readInt() != 0;
1695 setPackageAskScreenCompat(pkg, ask);
1696 reply.writeNoException();
1697 return true;
1698 }
1699
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001700 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1701 data.enforceInterface(IActivityManager.descriptor);
1702 IIntentSender r = IIntentSender.Stub.asInterface(
1703 data.readStrongBinder());
1704 boolean res = isIntentSenderTargetedToPackage(r);
1705 reply.writeNoException();
1706 reply.writeInt(res ? 1 : 0);
1707 return true;
1708 }
1709
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001710 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1711 data.enforceInterface(IActivityManager.descriptor);
1712 IIntentSender r = IIntentSender.Stub.asInterface(
1713 data.readStrongBinder());
1714 boolean res = isIntentSenderAnActivity(r);
1715 reply.writeNoException();
1716 reply.writeInt(res ? 1 : 0);
1717 return true;
1718 }
1719
Dianne Hackborn81038902012-11-26 17:04:09 -08001720 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1721 data.enforceInterface(IActivityManager.descriptor);
1722 IIntentSender r = IIntentSender.Stub.asInterface(
1723 data.readStrongBinder());
1724 Intent intent = getIntentForIntentSender(r);
1725 reply.writeNoException();
1726 if (intent != null) {
1727 reply.writeInt(1);
1728 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1729 } else {
1730 reply.writeInt(0);
1731 }
1732 return true;
1733 }
1734
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001735 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
1737 Configuration config = Configuration.CREATOR.createFromParcel(data);
1738 updatePersistentConfiguration(config);
1739 reply.writeNoException();
1740 return true;
1741 }
1742
Dianne Hackbornb437e092011-08-05 17:50:29 -07001743 case GET_PROCESS_PSS_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 int[] pids = data.createIntArray();
1746 long[] pss = getProcessPss(pids);
1747 reply.writeNoException();
1748 reply.writeLongArray(pss);
1749 return true;
1750 }
1751
Dianne Hackborn661cd522011-08-22 00:26:20 -07001752 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1753 data.enforceInterface(IActivityManager.descriptor);
1754 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1755 boolean always = data.readInt() != 0;
1756 showBootMessage(msg, always);
1757 reply.writeNoException();
1758 return true;
1759 }
1760
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001761 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 dismissKeyguardOnNextActivity();
1764 reply.writeNoException();
1765 return true;
1766 }
1767
Adam Powelldd8fab22012-03-22 17:47:27 -07001768 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1769 data.enforceInterface(IActivityManager.descriptor);
1770 IBinder token = data.readStrongBinder();
1771 String destAffinity = data.readString();
1772 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1773 reply.writeNoException();
1774 reply.writeInt(res ? 1 : 0);
1775 return true;
1776 }
1777
1778 case NAVIGATE_UP_TO_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 IBinder token = data.readStrongBinder();
1781 Intent target = Intent.CREATOR.createFromParcel(data);
1782 int resultCode = data.readInt();
1783 Intent resultData = null;
1784 if (data.readInt() != 0) {
1785 resultData = Intent.CREATOR.createFromParcel(data);
1786 }
1787 boolean res = navigateUpTo(token, target, resultCode, resultData);
1788 reply.writeNoException();
1789 reply.writeInt(res ? 1 : 0);
1790 return true;
1791 }
1792
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001793 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1794 data.enforceInterface(IActivityManager.descriptor);
1795 IBinder token = data.readStrongBinder();
1796 int res = getLaunchedFromUid(token);
1797 reply.writeNoException();
1798 reply.writeInt(res);
1799 return true;
1800 }
1801
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001802 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1803 data.enforceInterface(IActivityManager.descriptor);
1804 IBinder token = data.readStrongBinder();
1805 String res = getLaunchedFromPackage(token);
1806 reply.writeNoException();
1807 reply.writeString(res);
1808 return true;
1809 }
1810
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001811 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1812 data.enforceInterface(IActivityManager.descriptor);
1813 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1814 data.readStrongBinder());
1815 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001816 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001817 return true;
1818 }
1819
1820 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1823 data.readStrongBinder());
1824 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001825 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001826 return true;
1827 }
1828
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001829 case REQUEST_BUG_REPORT_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001832 reply.writeNoException();
1833 return true;
1834 }
1835
1836 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1837 data.enforceInterface(IActivityManager.descriptor);
1838 int pid = data.readInt();
1839 boolean aboveSystem = data.readInt() != 0;
1840 long res = inputDispatchingTimedOut(pid, aboveSystem);
1841 reply.writeNoException();
1842 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001843 return true;
1844 }
1845
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001846 case GET_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 int requestType = data.readInt();
1849 Bundle res = getTopActivityExtras(requestType);
1850 reply.writeNoException();
1851 reply.writeBundle(res);
1852 return true;
1853 }
1854
1855 case REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1856 data.enforceInterface(IActivityManager.descriptor);
1857 IBinder token = data.readStrongBinder();
1858 Bundle extras = data.readBundle();
1859 reportTopActivityExtras(token, extras);
1860 reply.writeNoException();
1861 return true;
1862 }
1863
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001864 case KILL_UID_TRANSACTION: {
1865 data.enforceInterface(IActivityManager.descriptor);
1866 int uid = data.readInt();
1867 String reason = data.readString();
1868 killUid(uid, reason);
1869 reply.writeNoException();
1870 return true;
1871 }
1872
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001873 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001874
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001875 return super.onTransact(code, data, reply, flags);
1876 }
1877
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001878 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001879 return this;
1880 }
1881
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001882 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1883 protected IActivityManager create() {
1884 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001885 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001886 Log.v("ActivityManager", "default service binder = " + b);
1887 }
1888 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001889 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001890 Log.v("ActivityManager", "default service = " + am);
1891 }
1892 return am;
1893 }
1894 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001895}
1896
1897class ActivityManagerProxy implements IActivityManager
1898{
1899 public ActivityManagerProxy(IBinder remote)
1900 {
1901 mRemote = remote;
1902 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001903
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001904 public IBinder asBinder()
1905 {
1906 return mRemote;
1907 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001908
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001909 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001910 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1911 int startFlags, String profileFile,
1912 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001913 Parcel data = Parcel.obtain();
1914 Parcel reply = Parcel.obtain();
1915 data.writeInterfaceToken(IActivityManager.descriptor);
1916 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001917 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001918 intent.writeToParcel(data, 0);
1919 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001920 data.writeStrongBinder(resultTo);
1921 data.writeString(resultWho);
1922 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001923 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001924 data.writeString(profileFile);
1925 if (profileFd != null) {
1926 data.writeInt(1);
1927 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1928 } else {
1929 data.writeInt(0);
1930 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001931 if (options != null) {
1932 data.writeInt(1);
1933 options.writeToParcel(data, 0);
1934 } else {
1935 data.writeInt(0);
1936 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001937 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1938 reply.readException();
1939 int result = reply.readInt();
1940 reply.recycle();
1941 data.recycle();
1942 return result;
1943 }
Amith Yamasani82644082012-08-03 13:09:11 -07001944
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001945 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07001946 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1947 int startFlags, String profileFile,
1948 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1949 Parcel data = Parcel.obtain();
1950 Parcel reply = Parcel.obtain();
1951 data.writeInterfaceToken(IActivityManager.descriptor);
1952 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001953 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07001954 intent.writeToParcel(data, 0);
1955 data.writeString(resolvedType);
1956 data.writeStrongBinder(resultTo);
1957 data.writeString(resultWho);
1958 data.writeInt(requestCode);
1959 data.writeInt(startFlags);
1960 data.writeString(profileFile);
1961 if (profileFd != null) {
1962 data.writeInt(1);
1963 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1964 } else {
1965 data.writeInt(0);
1966 }
1967 if (options != null) {
1968 data.writeInt(1);
1969 options.writeToParcel(data, 0);
1970 } else {
1971 data.writeInt(0);
1972 }
1973 data.writeInt(userId);
1974 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1975 reply.readException();
1976 int result = reply.readInt();
1977 reply.recycle();
1978 data.recycle();
1979 return result;
1980 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001981 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
1982 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001983 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001984 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001985 Parcel data = Parcel.obtain();
1986 Parcel reply = Parcel.obtain();
1987 data.writeInterfaceToken(IActivityManager.descriptor);
1988 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001989 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001990 intent.writeToParcel(data, 0);
1991 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001992 data.writeStrongBinder(resultTo);
1993 data.writeString(resultWho);
1994 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001995 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001996 data.writeString(profileFile);
1997 if (profileFd != null) {
1998 data.writeInt(1);
1999 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2000 } else {
2001 data.writeInt(0);
2002 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002003 if (options != null) {
2004 data.writeInt(1);
2005 options.writeToParcel(data, 0);
2006 } else {
2007 data.writeInt(0);
2008 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002009 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002010 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2011 reply.readException();
2012 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2013 reply.recycle();
2014 data.recycle();
2015 return result;
2016 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002017 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2018 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002019 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002020 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002021 Parcel data = Parcel.obtain();
2022 Parcel reply = Parcel.obtain();
2023 data.writeInterfaceToken(IActivityManager.descriptor);
2024 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002025 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002026 intent.writeToParcel(data, 0);
2027 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002028 data.writeStrongBinder(resultTo);
2029 data.writeString(resultWho);
2030 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002031 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002032 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002033 if (options != null) {
2034 data.writeInt(1);
2035 options.writeToParcel(data, 0);
2036 } else {
2037 data.writeInt(0);
2038 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002039 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002040 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2041 reply.readException();
2042 int result = reply.readInt();
2043 reply.recycle();
2044 data.recycle();
2045 return result;
2046 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002047 public int startActivityIntentSender(IApplicationThread caller,
2048 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002049 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002050 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002051 Parcel data = Parcel.obtain();
2052 Parcel reply = Parcel.obtain();
2053 data.writeInterfaceToken(IActivityManager.descriptor);
2054 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2055 intent.writeToParcel(data, 0);
2056 if (fillInIntent != null) {
2057 data.writeInt(1);
2058 fillInIntent.writeToParcel(data, 0);
2059 } else {
2060 data.writeInt(0);
2061 }
2062 data.writeString(resolvedType);
2063 data.writeStrongBinder(resultTo);
2064 data.writeString(resultWho);
2065 data.writeInt(requestCode);
2066 data.writeInt(flagsMask);
2067 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002068 if (options != null) {
2069 data.writeInt(1);
2070 options.writeToParcel(data, 0);
2071 } else {
2072 data.writeInt(0);
2073 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002074 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002075 reply.readException();
2076 int result = reply.readInt();
2077 reply.recycle();
2078 data.recycle();
2079 return result;
2080 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002081 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002082 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002083 Parcel data = Parcel.obtain();
2084 Parcel reply = Parcel.obtain();
2085 data.writeInterfaceToken(IActivityManager.descriptor);
2086 data.writeStrongBinder(callingActivity);
2087 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002088 if (options != null) {
2089 data.writeInt(1);
2090 options.writeToParcel(data, 0);
2091 } else {
2092 data.writeInt(0);
2093 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002094 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2095 reply.readException();
2096 int result = reply.readInt();
2097 reply.recycle();
2098 data.recycle();
2099 return result != 0;
2100 }
2101 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2102 throws RemoteException {
2103 Parcel data = Parcel.obtain();
2104 Parcel reply = Parcel.obtain();
2105 data.writeInterfaceToken(IActivityManager.descriptor);
2106 data.writeStrongBinder(token);
2107 data.writeInt(resultCode);
2108 if (resultData != null) {
2109 data.writeInt(1);
2110 resultData.writeToParcel(data, 0);
2111 } else {
2112 data.writeInt(0);
2113 }
2114 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2115 reply.readException();
2116 boolean res = reply.readInt() != 0;
2117 data.recycle();
2118 reply.recycle();
2119 return res;
2120 }
2121 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2122 {
2123 Parcel data = Parcel.obtain();
2124 Parcel reply = Parcel.obtain();
2125 data.writeInterfaceToken(IActivityManager.descriptor);
2126 data.writeStrongBinder(token);
2127 data.writeString(resultWho);
2128 data.writeInt(requestCode);
2129 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2130 reply.readException();
2131 data.recycle();
2132 reply.recycle();
2133 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002134 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2135 Parcel data = Parcel.obtain();
2136 Parcel reply = Parcel.obtain();
2137 data.writeInterfaceToken(IActivityManager.descriptor);
2138 data.writeStrongBinder(token);
2139 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2140 reply.readException();
2141 boolean res = reply.readInt() != 0;
2142 data.recycle();
2143 reply.recycle();
2144 return res;
2145 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002146 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2147 Parcel data = Parcel.obtain();
2148 Parcel reply = Parcel.obtain();
2149 data.writeInterfaceToken(IActivityManager.descriptor);
2150 data.writeStrongBinder(token);
2151 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2152 reply.readException();
2153 boolean res = reply.readInt() != 0;
2154 data.recycle();
2155 reply.recycle();
2156 return res;
2157 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002158 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002159 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002160 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002161 {
2162 Parcel data = Parcel.obtain();
2163 Parcel reply = Parcel.obtain();
2164 data.writeInterfaceToken(IActivityManager.descriptor);
2165 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002166 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002167 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2168 filter.writeToParcel(data, 0);
2169 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002170 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002171 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2172 reply.readException();
2173 Intent intent = null;
2174 int haveIntent = reply.readInt();
2175 if (haveIntent != 0) {
2176 intent = Intent.CREATOR.createFromParcel(reply);
2177 }
2178 reply.recycle();
2179 data.recycle();
2180 return intent;
2181 }
2182 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2183 {
2184 Parcel data = Parcel.obtain();
2185 Parcel reply = Parcel.obtain();
2186 data.writeInterfaceToken(IActivityManager.descriptor);
2187 data.writeStrongBinder(receiver.asBinder());
2188 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2189 reply.readException();
2190 data.recycle();
2191 reply.recycle();
2192 }
2193 public int broadcastIntent(IApplicationThread caller,
2194 Intent intent, String resolvedType, IIntentReceiver resultTo,
2195 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002196 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002197 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002198 {
2199 Parcel data = Parcel.obtain();
2200 Parcel reply = Parcel.obtain();
2201 data.writeInterfaceToken(IActivityManager.descriptor);
2202 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2203 intent.writeToParcel(data, 0);
2204 data.writeString(resolvedType);
2205 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2206 data.writeInt(resultCode);
2207 data.writeString(resultData);
2208 data.writeBundle(map);
2209 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002210 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002211 data.writeInt(serialized ? 1 : 0);
2212 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002213 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002214 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2215 reply.readException();
2216 int res = reply.readInt();
2217 reply.recycle();
2218 data.recycle();
2219 return res;
2220 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002221 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2222 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002223 {
2224 Parcel data = Parcel.obtain();
2225 Parcel reply = Parcel.obtain();
2226 data.writeInterfaceToken(IActivityManager.descriptor);
2227 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2228 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002229 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002230 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2231 reply.readException();
2232 data.recycle();
2233 reply.recycle();
2234 }
2235 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2236 {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 data.writeStrongBinder(who);
2241 data.writeInt(resultCode);
2242 data.writeString(resultData);
2243 data.writeBundle(map);
2244 data.writeInt(abortBroadcast ? 1 : 0);
2245 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2246 reply.readException();
2247 data.recycle();
2248 reply.recycle();
2249 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002250 public void attachApplication(IApplicationThread app) throws RemoteException
2251 {
2252 Parcel data = Parcel.obtain();
2253 Parcel reply = Parcel.obtain();
2254 data.writeInterfaceToken(IActivityManager.descriptor);
2255 data.writeStrongBinder(app.asBinder());
2256 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2257 reply.readException();
2258 data.recycle();
2259 reply.recycle();
2260 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002261 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2262 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002263 {
2264 Parcel data = Parcel.obtain();
2265 Parcel reply = Parcel.obtain();
2266 data.writeInterfaceToken(IActivityManager.descriptor);
2267 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002268 if (config != null) {
2269 data.writeInt(1);
2270 config.writeToParcel(data, 0);
2271 } else {
2272 data.writeInt(0);
2273 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002274 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002275 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2276 reply.readException();
2277 data.recycle();
2278 reply.recycle();
2279 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002280 public void activityResumed(IBinder token) throws RemoteException
2281 {
2282 Parcel data = Parcel.obtain();
2283 Parcel reply = Parcel.obtain();
2284 data.writeInterfaceToken(IActivityManager.descriptor);
2285 data.writeStrongBinder(token);
2286 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2287 reply.readException();
2288 data.recycle();
2289 reply.recycle();
2290 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002291 public void activityPaused(IBinder token) throws RemoteException
2292 {
2293 Parcel data = Parcel.obtain();
2294 Parcel reply = Parcel.obtain();
2295 data.writeInterfaceToken(IActivityManager.descriptor);
2296 data.writeStrongBinder(token);
2297 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2298 reply.readException();
2299 data.recycle();
2300 reply.recycle();
2301 }
2302 public void activityStopped(IBinder token, Bundle state,
2303 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002304 {
2305 Parcel data = Parcel.obtain();
2306 Parcel reply = Parcel.obtain();
2307 data.writeInterfaceToken(IActivityManager.descriptor);
2308 data.writeStrongBinder(token);
2309 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002310 if (thumbnail != null) {
2311 data.writeInt(1);
2312 thumbnail.writeToParcel(data, 0);
2313 } else {
2314 data.writeInt(0);
2315 }
2316 TextUtils.writeToParcel(description, data, 0);
2317 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2318 reply.readException();
2319 data.recycle();
2320 reply.recycle();
2321 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002322 public void activitySlept(IBinder token) throws RemoteException
2323 {
2324 Parcel data = Parcel.obtain();
2325 Parcel reply = Parcel.obtain();
2326 data.writeInterfaceToken(IActivityManager.descriptor);
2327 data.writeStrongBinder(token);
2328 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2329 reply.readException();
2330 data.recycle();
2331 reply.recycle();
2332 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002333 public void activityDestroyed(IBinder token) throws RemoteException
2334 {
2335 Parcel data = Parcel.obtain();
2336 Parcel reply = Parcel.obtain();
2337 data.writeInterfaceToken(IActivityManager.descriptor);
2338 data.writeStrongBinder(token);
2339 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2340 reply.readException();
2341 data.recycle();
2342 reply.recycle();
2343 }
2344 public String getCallingPackage(IBinder token) throws RemoteException
2345 {
2346 Parcel data = Parcel.obtain();
2347 Parcel reply = Parcel.obtain();
2348 data.writeInterfaceToken(IActivityManager.descriptor);
2349 data.writeStrongBinder(token);
2350 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2351 reply.readException();
2352 String res = reply.readString();
2353 data.recycle();
2354 reply.recycle();
2355 return res;
2356 }
2357 public ComponentName getCallingActivity(IBinder token)
2358 throws RemoteException {
2359 Parcel data = Parcel.obtain();
2360 Parcel reply = Parcel.obtain();
2361 data.writeInterfaceToken(IActivityManager.descriptor);
2362 data.writeStrongBinder(token);
2363 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2364 reply.readException();
2365 ComponentName res = ComponentName.readFromParcel(reply);
2366 data.recycle();
2367 reply.recycle();
2368 return res;
2369 }
2370 public List getTasks(int maxNum, int flags,
2371 IThumbnailReceiver receiver) throws RemoteException {
2372 Parcel data = Parcel.obtain();
2373 Parcel reply = Parcel.obtain();
2374 data.writeInterfaceToken(IActivityManager.descriptor);
2375 data.writeInt(maxNum);
2376 data.writeInt(flags);
2377 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2378 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2379 reply.readException();
2380 ArrayList list = null;
2381 int N = reply.readInt();
2382 if (N >= 0) {
2383 list = new ArrayList();
2384 while (N > 0) {
2385 ActivityManager.RunningTaskInfo info =
2386 ActivityManager.RunningTaskInfo.CREATOR
2387 .createFromParcel(reply);
2388 list.add(info);
2389 N--;
2390 }
2391 }
2392 data.recycle();
2393 reply.recycle();
2394 return list;
2395 }
2396 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002397 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002398 Parcel data = Parcel.obtain();
2399 Parcel reply = Parcel.obtain();
2400 data.writeInterfaceToken(IActivityManager.descriptor);
2401 data.writeInt(maxNum);
2402 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002403 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002404 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2405 reply.readException();
2406 ArrayList<ActivityManager.RecentTaskInfo> list
2407 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2408 data.recycle();
2409 reply.recycle();
2410 return list;
2411 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002412 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002413 Parcel data = Parcel.obtain();
2414 Parcel reply = Parcel.obtain();
2415 data.writeInterfaceToken(IActivityManager.descriptor);
2416 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002417 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002418 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002419 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002420 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002421 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002422 }
2423 data.recycle();
2424 reply.recycle();
2425 return bm;
2426 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002427 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2428 Parcel data = Parcel.obtain();
2429 Parcel reply = Parcel.obtain();
2430 data.writeInterfaceToken(IActivityManager.descriptor);
2431 data.writeInt(id);
2432 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2433 reply.readException();
2434 Bitmap bm = null;
2435 if (reply.readInt() != 0) {
2436 bm = Bitmap.CREATOR.createFromParcel(reply);
2437 }
2438 data.recycle();
2439 reply.recycle();
2440 return bm;
2441 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002442 public List getServices(int maxNum, int flags) throws RemoteException {
2443 Parcel data = Parcel.obtain();
2444 Parcel reply = Parcel.obtain();
2445 data.writeInterfaceToken(IActivityManager.descriptor);
2446 data.writeInt(maxNum);
2447 data.writeInt(flags);
2448 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2449 reply.readException();
2450 ArrayList list = null;
2451 int N = reply.readInt();
2452 if (N >= 0) {
2453 list = new ArrayList();
2454 while (N > 0) {
2455 ActivityManager.RunningServiceInfo info =
2456 ActivityManager.RunningServiceInfo.CREATOR
2457 .createFromParcel(reply);
2458 list.add(info);
2459 N--;
2460 }
2461 }
2462 data.recycle();
2463 reply.recycle();
2464 return list;
2465 }
2466 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2467 throws RemoteException {
2468 Parcel data = Parcel.obtain();
2469 Parcel reply = Parcel.obtain();
2470 data.writeInterfaceToken(IActivityManager.descriptor);
2471 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2472 reply.readException();
2473 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2474 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2475 data.recycle();
2476 reply.recycle();
2477 return list;
2478 }
2479 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2480 throws RemoteException {
2481 Parcel data = Parcel.obtain();
2482 Parcel reply = Parcel.obtain();
2483 data.writeInterfaceToken(IActivityManager.descriptor);
2484 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2485 reply.readException();
2486 ArrayList<ActivityManager.RunningAppProcessInfo> list
2487 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2488 data.recycle();
2489 reply.recycle();
2490 return list;
2491 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002492 public List<ApplicationInfo> getRunningExternalApplications()
2493 throws RemoteException {
2494 Parcel data = Parcel.obtain();
2495 Parcel reply = Parcel.obtain();
2496 data.writeInterfaceToken(IActivityManager.descriptor);
2497 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2498 reply.readException();
2499 ArrayList<ApplicationInfo> list
2500 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2501 data.recycle();
2502 reply.recycle();
2503 return list;
2504 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002505 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002506 {
2507 Parcel data = Parcel.obtain();
2508 Parcel reply = Parcel.obtain();
2509 data.writeInterfaceToken(IActivityManager.descriptor);
2510 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002511 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002512 if (options != null) {
2513 data.writeInt(1);
2514 options.writeToParcel(data, 0);
2515 } else {
2516 data.writeInt(0);
2517 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002518 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2519 reply.readException();
2520 data.recycle();
2521 reply.recycle();
2522 }
2523 public void moveTaskToBack(int task) throws RemoteException
2524 {
2525 Parcel data = Parcel.obtain();
2526 Parcel reply = Parcel.obtain();
2527 data.writeInterfaceToken(IActivityManager.descriptor);
2528 data.writeInt(task);
2529 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2530 reply.readException();
2531 data.recycle();
2532 reply.recycle();
2533 }
2534 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2535 throws RemoteException {
2536 Parcel data = Parcel.obtain();
2537 Parcel reply = Parcel.obtain();
2538 data.writeInterfaceToken(IActivityManager.descriptor);
2539 data.writeStrongBinder(token);
2540 data.writeInt(nonRoot ? 1 : 0);
2541 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2542 reply.readException();
2543 boolean res = reply.readInt() != 0;
2544 data.recycle();
2545 reply.recycle();
2546 return res;
2547 }
2548 public void moveTaskBackwards(int task) throws RemoteException
2549 {
2550 Parcel data = Parcel.obtain();
2551 Parcel reply = Parcel.obtain();
2552 data.writeInterfaceToken(IActivityManager.descriptor);
2553 data.writeInt(task);
2554 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2555 reply.readException();
2556 data.recycle();
2557 reply.recycle();
2558 }
2559 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2560 {
2561 Parcel data = Parcel.obtain();
2562 Parcel reply = Parcel.obtain();
2563 data.writeInterfaceToken(IActivityManager.descriptor);
2564 data.writeStrongBinder(token);
2565 data.writeInt(onlyRoot ? 1 : 0);
2566 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2567 reply.readException();
2568 int res = reply.readInt();
2569 data.recycle();
2570 reply.recycle();
2571 return res;
2572 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002573 public void reportThumbnail(IBinder token,
2574 Bitmap thumbnail, CharSequence description) throws RemoteException
2575 {
2576 Parcel data = Parcel.obtain();
2577 Parcel reply = Parcel.obtain();
2578 data.writeInterfaceToken(IActivityManager.descriptor);
2579 data.writeStrongBinder(token);
2580 if (thumbnail != null) {
2581 data.writeInt(1);
2582 thumbnail.writeToParcel(data, 0);
2583 } else {
2584 data.writeInt(0);
2585 }
2586 TextUtils.writeToParcel(description, data, 0);
2587 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2588 reply.readException();
2589 data.recycle();
2590 reply.recycle();
2591 }
2592 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002593 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002594 Parcel data = Parcel.obtain();
2595 Parcel reply = Parcel.obtain();
2596 data.writeInterfaceToken(IActivityManager.descriptor);
2597 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2598 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002599 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002600 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002601 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2602 reply.readException();
2603 int res = reply.readInt();
2604 ContentProviderHolder cph = null;
2605 if (res != 0) {
2606 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2607 }
2608 data.recycle();
2609 reply.recycle();
2610 return cph;
2611 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002612 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2613 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002614 Parcel data = Parcel.obtain();
2615 Parcel reply = Parcel.obtain();
2616 data.writeInterfaceToken(IActivityManager.descriptor);
2617 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002618 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002619 data.writeStrongBinder(token);
2620 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2621 reply.readException();
2622 int res = reply.readInt();
2623 ContentProviderHolder cph = null;
2624 if (res != 0) {
2625 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2626 }
2627 data.recycle();
2628 reply.recycle();
2629 return cph;
2630 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002631 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002632 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002633 {
2634 Parcel data = Parcel.obtain();
2635 Parcel reply = Parcel.obtain();
2636 data.writeInterfaceToken(IActivityManager.descriptor);
2637 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2638 data.writeTypedList(providers);
2639 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2640 reply.readException();
2641 data.recycle();
2642 reply.recycle();
2643 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002644 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2645 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002646 Parcel data = Parcel.obtain();
2647 Parcel reply = Parcel.obtain();
2648 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002649 data.writeStrongBinder(connection);
2650 data.writeInt(stable);
2651 data.writeInt(unstable);
2652 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2653 reply.readException();
2654 boolean res = reply.readInt() != 0;
2655 data.recycle();
2656 reply.recycle();
2657 return res;
2658 }
2659 public void unstableProviderDied(IBinder connection) throws RemoteException {
2660 Parcel data = Parcel.obtain();
2661 Parcel reply = Parcel.obtain();
2662 data.writeInterfaceToken(IActivityManager.descriptor);
2663 data.writeStrongBinder(connection);
2664 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2665 reply.readException();
2666 data.recycle();
2667 reply.recycle();
2668 }
2669
2670 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2671 Parcel data = Parcel.obtain();
2672 Parcel reply = Parcel.obtain();
2673 data.writeInterfaceToken(IActivityManager.descriptor);
2674 data.writeStrongBinder(connection);
2675 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002676 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2677 reply.readException();
2678 data.recycle();
2679 reply.recycle();
2680 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002681
2682 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2683 Parcel data = Parcel.obtain();
2684 Parcel reply = Parcel.obtain();
2685 data.writeInterfaceToken(IActivityManager.descriptor);
2686 data.writeString(name);
2687 data.writeStrongBinder(token);
2688 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2689 reply.readException();
2690 data.recycle();
2691 reply.recycle();
2692 }
2693
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002694 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2695 throws RemoteException
2696 {
2697 Parcel data = Parcel.obtain();
2698 Parcel reply = Parcel.obtain();
2699 data.writeInterfaceToken(IActivityManager.descriptor);
2700 service.writeToParcel(data, 0);
2701 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2702 reply.readException();
2703 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2704 data.recycle();
2705 reply.recycle();
2706 return res;
2707 }
2708
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002709 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002710 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002711 {
2712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2716 service.writeToParcel(data, 0);
2717 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002718 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002719 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2720 reply.readException();
2721 ComponentName res = ComponentName.readFromParcel(reply);
2722 data.recycle();
2723 reply.recycle();
2724 return res;
2725 }
2726 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002727 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002728 {
2729 Parcel data = Parcel.obtain();
2730 Parcel reply = Parcel.obtain();
2731 data.writeInterfaceToken(IActivityManager.descriptor);
2732 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2733 service.writeToParcel(data, 0);
2734 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002735 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002736 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2737 reply.readException();
2738 int res = reply.readInt();
2739 reply.recycle();
2740 data.recycle();
2741 return res;
2742 }
2743 public boolean stopServiceToken(ComponentName className, IBinder token,
2744 int startId) throws RemoteException {
2745 Parcel data = Parcel.obtain();
2746 Parcel reply = Parcel.obtain();
2747 data.writeInterfaceToken(IActivityManager.descriptor);
2748 ComponentName.writeToParcel(className, data);
2749 data.writeStrongBinder(token);
2750 data.writeInt(startId);
2751 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2752 reply.readException();
2753 boolean res = reply.readInt() != 0;
2754 data.recycle();
2755 reply.recycle();
2756 return res;
2757 }
2758 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002759 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002760 Parcel data = Parcel.obtain();
2761 Parcel reply = Parcel.obtain();
2762 data.writeInterfaceToken(IActivityManager.descriptor);
2763 ComponentName.writeToParcel(className, data);
2764 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002765 data.writeInt(id);
2766 if (notification != null) {
2767 data.writeInt(1);
2768 notification.writeToParcel(data, 0);
2769 } else {
2770 data.writeInt(0);
2771 }
2772 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002773 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2774 reply.readException();
2775 data.recycle();
2776 reply.recycle();
2777 }
2778 public int bindService(IApplicationThread caller, IBinder token,
2779 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002780 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002781 Parcel data = Parcel.obtain();
2782 Parcel reply = Parcel.obtain();
2783 data.writeInterfaceToken(IActivityManager.descriptor);
2784 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2785 data.writeStrongBinder(token);
2786 service.writeToParcel(data, 0);
2787 data.writeString(resolvedType);
2788 data.writeStrongBinder(connection.asBinder());
2789 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002790 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002791 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2792 reply.readException();
2793 int res = reply.readInt();
2794 data.recycle();
2795 reply.recycle();
2796 return res;
2797 }
2798 public boolean unbindService(IServiceConnection connection) throws RemoteException
2799 {
2800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 data.writeStrongBinder(connection.asBinder());
2804 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2805 reply.readException();
2806 boolean res = reply.readInt() != 0;
2807 data.recycle();
2808 reply.recycle();
2809 return res;
2810 }
2811
2812 public void publishService(IBinder token,
2813 Intent intent, IBinder service) throws RemoteException {
2814 Parcel data = Parcel.obtain();
2815 Parcel reply = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 data.writeStrongBinder(token);
2818 intent.writeToParcel(data, 0);
2819 data.writeStrongBinder(service);
2820 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2821 reply.readException();
2822 data.recycle();
2823 reply.recycle();
2824 }
2825
2826 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2827 throws RemoteException {
2828 Parcel data = Parcel.obtain();
2829 Parcel reply = Parcel.obtain();
2830 data.writeInterfaceToken(IActivityManager.descriptor);
2831 data.writeStrongBinder(token);
2832 intent.writeToParcel(data, 0);
2833 data.writeInt(doRebind ? 1 : 0);
2834 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2835 reply.readException();
2836 data.recycle();
2837 reply.recycle();
2838 }
2839
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002840 public void serviceDoneExecuting(IBinder token, int type, int startId,
2841 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002846 data.writeInt(type);
2847 data.writeInt(startId);
2848 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002849 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2850 reply.readException();
2851 data.recycle();
2852 reply.recycle();
2853 }
2854
2855 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2856 Parcel data = Parcel.obtain();
2857 Parcel reply = Parcel.obtain();
2858 data.writeInterfaceToken(IActivityManager.descriptor);
2859 service.writeToParcel(data, 0);
2860 data.writeString(resolvedType);
2861 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2862 reply.readException();
2863 IBinder binder = reply.readStrongBinder();
2864 reply.recycle();
2865 data.recycle();
2866 return binder;
2867 }
2868
Christopher Tate181fafa2009-05-14 11:12:14 -07002869 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2870 throws RemoteException {
2871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 app.writeToParcel(data, 0);
2875 data.writeInt(backupRestoreMode);
2876 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2877 reply.readException();
2878 boolean success = reply.readInt() != 0;
2879 reply.recycle();
2880 data.recycle();
2881 return success;
2882 }
2883
Christopher Tate346acb12012-10-15 19:20:25 -07002884 public void clearPendingBackup() throws RemoteException {
2885 Parcel data = Parcel.obtain();
2886 Parcel reply = Parcel.obtain();
2887 data.writeInterfaceToken(IActivityManager.descriptor);
2888 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
2889 reply.recycle();
2890 data.recycle();
2891 }
2892
Christopher Tate181fafa2009-05-14 11:12:14 -07002893 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2894 Parcel data = Parcel.obtain();
2895 Parcel reply = Parcel.obtain();
2896 data.writeInterfaceToken(IActivityManager.descriptor);
2897 data.writeString(packageName);
2898 data.writeStrongBinder(agent);
2899 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2900 reply.recycle();
2901 data.recycle();
2902 }
2903
2904 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2905 Parcel data = Parcel.obtain();
2906 Parcel reply = Parcel.obtain();
2907 data.writeInterfaceToken(IActivityManager.descriptor);
2908 app.writeToParcel(data, 0);
2909 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2910 reply.readException();
2911 reply.recycle();
2912 data.recycle();
2913 }
2914
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002915 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002916 int flags, Bundle arguments, IInstrumentationWatcher watcher,
2917 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 ComponentName.writeToParcel(className, data);
2922 data.writeString(profileFile);
2923 data.writeInt(flags);
2924 data.writeBundle(arguments);
2925 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08002926 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002927 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002928 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2929 reply.readException();
2930 boolean res = reply.readInt() != 0;
2931 reply.recycle();
2932 data.recycle();
2933 return res;
2934 }
2935
2936 public void finishInstrumentation(IApplicationThread target,
2937 int resultCode, Bundle results) throws RemoteException {
2938 Parcel data = Parcel.obtain();
2939 Parcel reply = Parcel.obtain();
2940 data.writeInterfaceToken(IActivityManager.descriptor);
2941 data.writeStrongBinder(target != null ? target.asBinder() : null);
2942 data.writeInt(resultCode);
2943 data.writeBundle(results);
2944 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2945 reply.readException();
2946 data.recycle();
2947 reply.recycle();
2948 }
2949 public Configuration getConfiguration() throws RemoteException
2950 {
2951 Parcel data = Parcel.obtain();
2952 Parcel reply = Parcel.obtain();
2953 data.writeInterfaceToken(IActivityManager.descriptor);
2954 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2957 reply.recycle();
2958 data.recycle();
2959 return res;
2960 }
2961 public void updateConfiguration(Configuration values) throws RemoteException
2962 {
2963 Parcel data = Parcel.obtain();
2964 Parcel reply = Parcel.obtain();
2965 data.writeInterfaceToken(IActivityManager.descriptor);
2966 values.writeToParcel(data, 0);
2967 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2968 reply.readException();
2969 data.recycle();
2970 reply.recycle();
2971 }
2972 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2973 throws RemoteException {
2974 Parcel data = Parcel.obtain();
2975 Parcel reply = Parcel.obtain();
2976 data.writeInterfaceToken(IActivityManager.descriptor);
2977 data.writeStrongBinder(token);
2978 data.writeInt(requestedOrientation);
2979 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2980 reply.readException();
2981 data.recycle();
2982 reply.recycle();
2983 }
2984 public int getRequestedOrientation(IBinder token) throws RemoteException {
2985 Parcel data = Parcel.obtain();
2986 Parcel reply = Parcel.obtain();
2987 data.writeInterfaceToken(IActivityManager.descriptor);
2988 data.writeStrongBinder(token);
2989 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 int res = reply.readInt();
2992 data.recycle();
2993 reply.recycle();
2994 return res;
2995 }
2996 public ComponentName getActivityClassForToken(IBinder token)
2997 throws RemoteException {
2998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 data.writeStrongBinder(token);
3002 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3003 reply.readException();
3004 ComponentName res = ComponentName.readFromParcel(reply);
3005 data.recycle();
3006 reply.recycle();
3007 return res;
3008 }
3009 public String getPackageForToken(IBinder token) throws RemoteException
3010 {
3011 Parcel data = Parcel.obtain();
3012 Parcel reply = Parcel.obtain();
3013 data.writeInterfaceToken(IActivityManager.descriptor);
3014 data.writeStrongBinder(token);
3015 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3016 reply.readException();
3017 String res = reply.readString();
3018 data.recycle();
3019 reply.recycle();
3020 return res;
3021 }
3022 public IIntentSender getIntentSender(int type,
3023 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003024 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003025 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003026 Parcel data = Parcel.obtain();
3027 Parcel reply = Parcel.obtain();
3028 data.writeInterfaceToken(IActivityManager.descriptor);
3029 data.writeInt(type);
3030 data.writeString(packageName);
3031 data.writeStrongBinder(token);
3032 data.writeString(resultWho);
3033 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003034 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003035 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003036 data.writeTypedArray(intents, 0);
3037 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003038 } else {
3039 data.writeInt(0);
3040 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003041 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003042 if (options != null) {
3043 data.writeInt(1);
3044 options.writeToParcel(data, 0);
3045 } else {
3046 data.writeInt(0);
3047 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003048 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003049 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3050 reply.readException();
3051 IIntentSender res = IIntentSender.Stub.asInterface(
3052 reply.readStrongBinder());
3053 data.recycle();
3054 reply.recycle();
3055 return res;
3056 }
3057 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3058 Parcel data = Parcel.obtain();
3059 Parcel reply = Parcel.obtain();
3060 data.writeInterfaceToken(IActivityManager.descriptor);
3061 data.writeStrongBinder(sender.asBinder());
3062 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3063 reply.readException();
3064 data.recycle();
3065 reply.recycle();
3066 }
3067 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3068 Parcel data = Parcel.obtain();
3069 Parcel reply = Parcel.obtain();
3070 data.writeInterfaceToken(IActivityManager.descriptor);
3071 data.writeStrongBinder(sender.asBinder());
3072 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 String res = reply.readString();
3075 data.recycle();
3076 reply.recycle();
3077 return res;
3078 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003079 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeStrongBinder(sender.asBinder());
3084 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 int res = reply.readInt();
3087 data.recycle();
3088 reply.recycle();
3089 return res;
3090 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003091 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3092 boolean requireFull, String name, String callerPackage) throws RemoteException {
3093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 data.writeInt(callingPid);
3097 data.writeInt(callingUid);
3098 data.writeInt(userId);
3099 data.writeInt(allowAll ? 1 : 0);
3100 data.writeInt(requireFull ? 1 : 0);
3101 data.writeString(name);
3102 data.writeString(callerPackage);
3103 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3104 reply.readException();
3105 int res = reply.readInt();
3106 data.recycle();
3107 reply.recycle();
3108 return res;
3109 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003110 public void setProcessLimit(int max) throws RemoteException
3111 {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeInt(max);
3116 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3117 reply.readException();
3118 data.recycle();
3119 reply.recycle();
3120 }
3121 public int getProcessLimit() throws RemoteException
3122 {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 int res = reply.readInt();
3129 data.recycle();
3130 reply.recycle();
3131 return res;
3132 }
3133 public void setProcessForeground(IBinder token, int pid,
3134 boolean isForeground) throws RemoteException {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeStrongBinder(token);
3139 data.writeInt(pid);
3140 data.writeInt(isForeground ? 1 : 0);
3141 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3142 reply.readException();
3143 data.recycle();
3144 reply.recycle();
3145 }
3146 public int checkPermission(String permission, int pid, int uid)
3147 throws RemoteException {
3148 Parcel data = Parcel.obtain();
3149 Parcel reply = Parcel.obtain();
3150 data.writeInterfaceToken(IActivityManager.descriptor);
3151 data.writeString(permission);
3152 data.writeInt(pid);
3153 data.writeInt(uid);
3154 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3155 reply.readException();
3156 int res = reply.readInt();
3157 data.recycle();
3158 reply.recycle();
3159 return res;
3160 }
3161 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003162 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003163 Parcel data = Parcel.obtain();
3164 Parcel reply = Parcel.obtain();
3165 data.writeInterfaceToken(IActivityManager.descriptor);
3166 data.writeString(packageName);
3167 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003168 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003169 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3170 reply.readException();
3171 boolean res = reply.readInt() != 0;
3172 data.recycle();
3173 reply.recycle();
3174 return res;
3175 }
3176 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3177 throws RemoteException {
3178 Parcel data = Parcel.obtain();
3179 Parcel reply = Parcel.obtain();
3180 data.writeInterfaceToken(IActivityManager.descriptor);
3181 uri.writeToParcel(data, 0);
3182 data.writeInt(pid);
3183 data.writeInt(uid);
3184 data.writeInt(mode);
3185 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3186 reply.readException();
3187 int res = reply.readInt();
3188 data.recycle();
3189 reply.recycle();
3190 return res;
3191 }
3192 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3193 Uri uri, int mode) throws RemoteException {
3194 Parcel data = Parcel.obtain();
3195 Parcel reply = Parcel.obtain();
3196 data.writeInterfaceToken(IActivityManager.descriptor);
3197 data.writeStrongBinder(caller.asBinder());
3198 data.writeString(targetPkg);
3199 uri.writeToParcel(data, 0);
3200 data.writeInt(mode);
3201 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3202 reply.readException();
3203 data.recycle();
3204 reply.recycle();
3205 }
3206 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3207 int mode) throws RemoteException {
3208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 data.writeStrongBinder(caller.asBinder());
3212 uri.writeToParcel(data, 0);
3213 data.writeInt(mode);
3214 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3215 reply.readException();
3216 data.recycle();
3217 reply.recycle();
3218 }
3219 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3220 throws RemoteException {
3221 Parcel data = Parcel.obtain();
3222 Parcel reply = Parcel.obtain();
3223 data.writeInterfaceToken(IActivityManager.descriptor);
3224 data.writeStrongBinder(who.asBinder());
3225 data.writeInt(waiting ? 1 : 0);
3226 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3227 reply.readException();
3228 data.recycle();
3229 reply.recycle();
3230 }
3231 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3232 Parcel data = Parcel.obtain();
3233 Parcel reply = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3236 reply.readException();
3237 outInfo.readFromParcel(reply);
3238 data.recycle();
3239 reply.recycle();
3240 }
3241 public void unhandledBack() throws RemoteException
3242 {
3243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 data.recycle();
3249 reply.recycle();
3250 }
3251 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3252 {
3253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
3256 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3257 reply.readException();
3258 ParcelFileDescriptor pfd = null;
3259 if (reply.readInt() != 0) {
3260 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3261 }
3262 data.recycle();
3263 reply.recycle();
3264 return pfd;
3265 }
3266 public void goingToSleep() throws RemoteException
3267 {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3272 reply.readException();
3273 data.recycle();
3274 reply.recycle();
3275 }
3276 public void wakingUp() throws RemoteException
3277 {
3278 Parcel data = Parcel.obtain();
3279 Parcel reply = Parcel.obtain();
3280 data.writeInterfaceToken(IActivityManager.descriptor);
3281 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3282 reply.readException();
3283 data.recycle();
3284 reply.recycle();
3285 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003286 public void setLockScreenShown(boolean shown) throws RemoteException
3287 {
3288 Parcel data = Parcel.obtain();
3289 Parcel reply = Parcel.obtain();
3290 data.writeInterfaceToken(IActivityManager.descriptor);
3291 data.writeInt(shown ? 1 : 0);
3292 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3293 reply.readException();
3294 data.recycle();
3295 reply.recycle();
3296 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003297 public void setDebugApp(
3298 String packageName, boolean waitForDebugger, boolean persistent)
3299 throws RemoteException
3300 {
3301 Parcel data = Parcel.obtain();
3302 Parcel reply = Parcel.obtain();
3303 data.writeInterfaceToken(IActivityManager.descriptor);
3304 data.writeString(packageName);
3305 data.writeInt(waitForDebugger ? 1 : 0);
3306 data.writeInt(persistent ? 1 : 0);
3307 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3308 reply.readException();
3309 data.recycle();
3310 reply.recycle();
3311 }
3312 public void setAlwaysFinish(boolean enabled) throws RemoteException
3313 {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 data.writeInt(enabled ? 1 : 0);
3318 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3319 reply.readException();
3320 data.recycle();
3321 reply.recycle();
3322 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003323 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003324 {
3325 Parcel data = Parcel.obtain();
3326 Parcel reply = Parcel.obtain();
3327 data.writeInterfaceToken(IActivityManager.descriptor);
3328 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003329 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003330 reply.readException();
3331 data.recycle();
3332 reply.recycle();
3333 }
3334 public void enterSafeMode() throws RemoteException {
3335 Parcel data = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3338 data.recycle();
3339 }
3340 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3341 Parcel data = Parcel.obtain();
3342 data.writeStrongBinder(sender.asBinder());
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3345 data.recycle();
3346 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003347 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003352 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003353 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003354 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003355 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003356 boolean res = reply.readInt() != 0;
3357 data.recycle();
3358 reply.recycle();
3359 return res;
3360 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003361 @Override
3362 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 data.writeString(reason);
3367 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3368 boolean res = reply.readInt() != 0;
3369 data.recycle();
3370 reply.recycle();
3371 return res;
3372 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003373 public void startRunning(String pkg, String cls, String action,
3374 String indata) throws RemoteException {
3375 Parcel data = Parcel.obtain();
3376 Parcel reply = Parcel.obtain();
3377 data.writeInterfaceToken(IActivityManager.descriptor);
3378 data.writeString(pkg);
3379 data.writeString(cls);
3380 data.writeString(action);
3381 data.writeString(indata);
3382 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 data.recycle();
3385 reply.recycle();
3386 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003387 public boolean testIsSystemReady()
3388 {
3389 /* this base class version is never called */
3390 return true;
3391 }
Dan Egnor60d87622009-12-16 16:32:58 -08003392 public void handleApplicationCrash(IBinder app,
3393 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3394 {
3395 Parcel data = Parcel.obtain();
3396 Parcel reply = Parcel.obtain();
3397 data.writeInterfaceToken(IActivityManager.descriptor);
3398 data.writeStrongBinder(app);
3399 crashInfo.writeToParcel(data, 0);
3400 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3401 reply.readException();
3402 reply.recycle();
3403 data.recycle();
3404 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003405
Dan Egnor60d87622009-12-16 16:32:58 -08003406 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003407 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003408 {
3409 Parcel data = Parcel.obtain();
3410 Parcel reply = Parcel.obtain();
3411 data.writeInterfaceToken(IActivityManager.descriptor);
3412 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003413 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003414 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003415 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003416 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003417 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003418 reply.recycle();
3419 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003420 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003421 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003422
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003423 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003424 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003425 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003426 {
3427 Parcel data = Parcel.obtain();
3428 Parcel reply = Parcel.obtain();
3429 data.writeInterfaceToken(IActivityManager.descriptor);
3430 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003431 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003432 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003433 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3434 reply.readException();
3435 reply.recycle();
3436 data.recycle();
3437 }
3438
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003439 public void signalPersistentProcesses(int sig) throws RemoteException {
3440 Parcel data = Parcel.obtain();
3441 Parcel reply = Parcel.obtain();
3442 data.writeInterfaceToken(IActivityManager.descriptor);
3443 data.writeInt(sig);
3444 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3445 reply.readException();
3446 data.recycle();
3447 reply.recycle();
3448 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003449
Dianne Hackborn1676c852012-09-10 14:52:30 -07003450 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003451 Parcel data = Parcel.obtain();
3452 Parcel reply = Parcel.obtain();
3453 data.writeInterfaceToken(IActivityManager.descriptor);
3454 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003455 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003456 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3457 reply.readException();
3458 data.recycle();
3459 reply.recycle();
3460 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003461
3462 public void killAllBackgroundProcesses() throws RemoteException {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3467 reply.readException();
3468 data.recycle();
3469 reply.recycle();
3470 }
3471
Dianne Hackborn1676c852012-09-10 14:52:30 -07003472 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003473 Parcel data = Parcel.obtain();
3474 Parcel reply = Parcel.obtain();
3475 data.writeInterfaceToken(IActivityManager.descriptor);
3476 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003477 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003478 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003479 reply.readException();
3480 data.recycle();
3481 reply.recycle();
3482 }
3483
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003484 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3485 throws RemoteException
3486 {
3487 Parcel data = Parcel.obtain();
3488 Parcel reply = Parcel.obtain();
3489 data.writeInterfaceToken(IActivityManager.descriptor);
3490 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3491 reply.readException();
3492 outInfo.readFromParcel(reply);
3493 reply.recycle();
3494 data.recycle();
3495 }
3496
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003497 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3498 {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3503 reply.readException();
3504 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3505 reply.recycle();
3506 data.recycle();
3507 return res;
3508 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003509
Dianne Hackborn1676c852012-09-10 14:52:30 -07003510 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003511 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003512 {
3513 Parcel data = Parcel.obtain();
3514 Parcel reply = Parcel.obtain();
3515 data.writeInterfaceToken(IActivityManager.descriptor);
3516 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003517 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003518 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003519 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003520 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003521 if (fd != null) {
3522 data.writeInt(1);
3523 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3524 } else {
3525 data.writeInt(0);
3526 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003527 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3528 reply.readException();
3529 boolean res = reply.readInt() != 0;
3530 reply.recycle();
3531 data.recycle();
3532 return res;
3533 }
3534
Dianne Hackborn55280a92009-05-07 15:53:46 -07003535 public boolean shutdown(int timeout) throws RemoteException
3536 {
3537 Parcel data = Parcel.obtain();
3538 Parcel reply = Parcel.obtain();
3539 data.writeInterfaceToken(IActivityManager.descriptor);
3540 data.writeInt(timeout);
3541 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3542 reply.readException();
3543 boolean res = reply.readInt() != 0;
3544 reply.recycle();
3545 data.recycle();
3546 return res;
3547 }
3548
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003549 public void stopAppSwitches() throws RemoteException {
3550 Parcel data = Parcel.obtain();
3551 Parcel reply = Parcel.obtain();
3552 data.writeInterfaceToken(IActivityManager.descriptor);
3553 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3554 reply.readException();
3555 reply.recycle();
3556 data.recycle();
3557 }
3558
3559 public void resumeAppSwitches() throws RemoteException {
3560 Parcel data = Parcel.obtain();
3561 Parcel reply = Parcel.obtain();
3562 data.writeInterfaceToken(IActivityManager.descriptor);
3563 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3564 reply.readException();
3565 reply.recycle();
3566 data.recycle();
3567 }
3568
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003569 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003574 data.writeInt(appid);
3575 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003576 reply.readException();
3577 data.recycle();
3578 reply.recycle();
3579 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003580
3581 public void closeSystemDialogs(String reason) throws RemoteException {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 data.writeString(reason);
3586 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3587 reply.readException();
3588 data.recycle();
3589 reply.recycle();
3590 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003591
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003592 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003593 throws RemoteException {
3594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003597 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003598 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3599 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003600 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003601 data.recycle();
3602 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003603 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003604 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003605
3606 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3607 Parcel data = Parcel.obtain();
3608 Parcel reply = Parcel.obtain();
3609 data.writeInterfaceToken(IActivityManager.descriptor);
3610 data.writeString(processName);
3611 data.writeInt(uid);
3612 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3613 reply.readException();
3614 data.recycle();
3615 reply.recycle();
3616 }
3617
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003618 public void overridePendingTransition(IBinder token, String packageName,
3619 int enterAnim, int exitAnim) throws RemoteException {
3620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 data.writeStrongBinder(token);
3624 data.writeString(packageName);
3625 data.writeInt(enterAnim);
3626 data.writeInt(exitAnim);
3627 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3628 reply.readException();
3629 data.recycle();
3630 reply.recycle();
3631 }
3632
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003633 public boolean isUserAMonkey() throws RemoteException {
3634 Parcel data = Parcel.obtain();
3635 Parcel reply = Parcel.obtain();
3636 data.writeInterfaceToken(IActivityManager.descriptor);
3637 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3638 reply.readException();
3639 boolean res = reply.readInt() != 0;
3640 data.recycle();
3641 reply.recycle();
3642 return res;
3643 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003644
3645 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3646 Parcel data = Parcel.obtain();
3647 Parcel reply = Parcel.obtain();
3648 data.writeInterfaceToken(IActivityManager.descriptor);
3649 data.writeInt(monkey ? 1 : 0);
3650 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3651 reply.readException();
3652 data.recycle();
3653 reply.recycle();
3654 }
3655
Dianne Hackborn860755f2010-06-03 18:47:52 -07003656 public void finishHeavyWeightApp() throws RemoteException {
3657 Parcel data = Parcel.obtain();
3658 Parcel reply = Parcel.obtain();
3659 data.writeInterfaceToken(IActivityManager.descriptor);
3660 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3661 reply.readException();
3662 data.recycle();
3663 reply.recycle();
3664 }
3665
Daniel Sandler69a48172010-06-23 16:29:36 -04003666 public void setImmersive(IBinder token, boolean immersive)
3667 throws RemoteException {
3668 Parcel data = Parcel.obtain();
3669 Parcel reply = Parcel.obtain();
3670 data.writeInterfaceToken(IActivityManager.descriptor);
3671 data.writeStrongBinder(token);
3672 data.writeInt(immersive ? 1 : 0);
3673 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3674 reply.readException();
3675 data.recycle();
3676 reply.recycle();
3677 }
3678
3679 public boolean isImmersive(IBinder token)
3680 throws RemoteException {
3681 Parcel data = Parcel.obtain();
3682 Parcel reply = Parcel.obtain();
3683 data.writeInterfaceToken(IActivityManager.descriptor);
3684 data.writeStrongBinder(token);
3685 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003686 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003687 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003688 data.recycle();
3689 reply.recycle();
3690 return res;
3691 }
3692
3693 public boolean isTopActivityImmersive()
3694 throws RemoteException {
3695 Parcel data = Parcel.obtain();
3696 Parcel reply = Parcel.obtain();
3697 data.writeInterfaceToken(IActivityManager.descriptor);
3698 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003699 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003700 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003701 data.recycle();
3702 reply.recycle();
3703 return res;
3704 }
3705
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003706 public void crashApplication(int uid, int initialPid, String packageName,
3707 String message) throws RemoteException {
3708 Parcel data = Parcel.obtain();
3709 Parcel reply = Parcel.obtain();
3710 data.writeInterfaceToken(IActivityManager.descriptor);
3711 data.writeInt(uid);
3712 data.writeInt(initialPid);
3713 data.writeString(packageName);
3714 data.writeString(message);
3715 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3716 reply.readException();
3717 data.recycle();
3718 reply.recycle();
3719 }
Andy McFadden824c5102010-07-09 16:26:57 -07003720
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003721 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003722 Parcel data = Parcel.obtain();
3723 Parcel reply = Parcel.obtain();
3724 data.writeInterfaceToken(IActivityManager.descriptor);
3725 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003726 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003727 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3728 reply.readException();
3729 String res = reply.readString();
3730 data.recycle();
3731 reply.recycle();
3732 return res;
3733 }
3734
Dianne Hackborn7e269642010-08-25 19:50:20 -07003735 public IBinder newUriPermissionOwner(String name)
3736 throws RemoteException {
3737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 data.writeString(name);
3741 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3742 reply.readException();
3743 IBinder res = reply.readStrongBinder();
3744 data.recycle();
3745 reply.recycle();
3746 return res;
3747 }
3748
3749 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3750 Uri uri, int mode) throws RemoteException {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeStrongBinder(owner);
3755 data.writeInt(fromUid);
3756 data.writeString(targetPkg);
3757 uri.writeToParcel(data, 0);
3758 data.writeInt(mode);
3759 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3760 reply.readException();
3761 data.recycle();
3762 reply.recycle();
3763 }
3764
3765 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3766 int mode) throws RemoteException {
3767 Parcel data = Parcel.obtain();
3768 Parcel reply = Parcel.obtain();
3769 data.writeInterfaceToken(IActivityManager.descriptor);
3770 data.writeStrongBinder(owner);
3771 if (uri != null) {
3772 data.writeInt(1);
3773 uri.writeToParcel(data, 0);
3774 } else {
3775 data.writeInt(0);
3776 }
3777 data.writeInt(mode);
3778 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3779 reply.readException();
3780 data.recycle();
3781 reply.recycle();
3782 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003783
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003784 public int checkGrantUriPermission(int callingUid, String targetPkg,
3785 Uri uri, int modeFlags) throws RemoteException {
3786 Parcel data = Parcel.obtain();
3787 Parcel reply = Parcel.obtain();
3788 data.writeInterfaceToken(IActivityManager.descriptor);
3789 data.writeInt(callingUid);
3790 data.writeString(targetPkg);
3791 uri.writeToParcel(data, 0);
3792 data.writeInt(modeFlags);
3793 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3794 reply.readException();
3795 int res = reply.readInt();
3796 data.recycle();
3797 reply.recycle();
3798 return res;
3799 }
3800
Dianne Hackborn1676c852012-09-10 14:52:30 -07003801 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003802 String path, ParcelFileDescriptor fd) throws RemoteException {
3803 Parcel data = Parcel.obtain();
3804 Parcel reply = Parcel.obtain();
3805 data.writeInterfaceToken(IActivityManager.descriptor);
3806 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003807 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003808 data.writeInt(managed ? 1 : 0);
3809 data.writeString(path);
3810 if (fd != null) {
3811 data.writeInt(1);
3812 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3813 } else {
3814 data.writeInt(0);
3815 }
3816 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3817 reply.readException();
3818 boolean res = reply.readInt() != 0;
3819 reply.recycle();
3820 data.recycle();
3821 return res;
3822 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003823
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003824 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003825 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003826 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003827 Parcel data = Parcel.obtain();
3828 Parcel reply = Parcel.obtain();
3829 data.writeInterfaceToken(IActivityManager.descriptor);
3830 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003831 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003832 data.writeTypedArray(intents, 0);
3833 data.writeStringArray(resolvedTypes);
3834 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003835 if (options != null) {
3836 data.writeInt(1);
3837 options.writeToParcel(data, 0);
3838 } else {
3839 data.writeInt(0);
3840 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003841 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003842 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3843 reply.readException();
3844 int result = reply.readInt();
3845 reply.recycle();
3846 data.recycle();
3847 return result;
3848 }
3849
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003850 public int getFrontActivityScreenCompatMode() throws RemoteException {
3851 Parcel data = Parcel.obtain();
3852 Parcel reply = Parcel.obtain();
3853 data.writeInterfaceToken(IActivityManager.descriptor);
3854 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3855 reply.readException();
3856 int mode = reply.readInt();
3857 reply.recycle();
3858 data.recycle();
3859 return mode;
3860 }
3861
3862 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3863 Parcel data = Parcel.obtain();
3864 Parcel reply = Parcel.obtain();
3865 data.writeInterfaceToken(IActivityManager.descriptor);
3866 data.writeInt(mode);
3867 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3868 reply.readException();
3869 reply.recycle();
3870 data.recycle();
3871 }
3872
3873 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3874 Parcel data = Parcel.obtain();
3875 Parcel reply = Parcel.obtain();
3876 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003877 data.writeString(packageName);
3878 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003879 reply.readException();
3880 int mode = reply.readInt();
3881 reply.recycle();
3882 data.recycle();
3883 return mode;
3884 }
3885
3886 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003887 throws RemoteException {
3888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003892 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003893 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3894 reply.readException();
3895 reply.recycle();
3896 data.recycle();
3897 }
3898
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003899 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3900 Parcel data = Parcel.obtain();
3901 Parcel reply = Parcel.obtain();
3902 data.writeInterfaceToken(IActivityManager.descriptor);
3903 data.writeString(packageName);
3904 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3905 reply.readException();
3906 boolean ask = reply.readInt() != 0;
3907 reply.recycle();
3908 data.recycle();
3909 return ask;
3910 }
3911
3912 public void setPackageAskScreenCompat(String packageName, boolean ask)
3913 throws RemoteException {
3914 Parcel data = Parcel.obtain();
3915 Parcel reply = Parcel.obtain();
3916 data.writeInterfaceToken(IActivityManager.descriptor);
3917 data.writeString(packageName);
3918 data.writeInt(ask ? 1 : 0);
3919 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3920 reply.readException();
3921 reply.recycle();
3922 data.recycle();
3923 }
3924
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003925 public boolean switchUser(int userid) throws RemoteException {
3926 Parcel data = Parcel.obtain();
3927 Parcel reply = Parcel.obtain();
3928 data.writeInterfaceToken(IActivityManager.descriptor);
3929 data.writeInt(userid);
3930 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3931 reply.readException();
3932 boolean result = reply.readInt() != 0;
3933 reply.recycle();
3934 data.recycle();
3935 return result;
3936 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003937
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003938 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3939 Parcel data = Parcel.obtain();
3940 Parcel reply = Parcel.obtain();
3941 data.writeInterfaceToken(IActivityManager.descriptor);
3942 data.writeInt(userid);
3943 data.writeStrongInterface(callback);
3944 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3945 reply.readException();
3946 int result = reply.readInt();
3947 reply.recycle();
3948 data.recycle();
3949 return result;
3950 }
3951
Amith Yamasani52f1d752012-03-28 18:19:29 -07003952 public UserInfo getCurrentUser() throws RemoteException {
3953 Parcel data = Parcel.obtain();
3954 Parcel reply = Parcel.obtain();
3955 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003956 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003957 reply.readException();
3958 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3959 reply.recycle();
3960 data.recycle();
3961 return userInfo;
3962 }
3963
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003964 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003965 Parcel data = Parcel.obtain();
3966 Parcel reply = Parcel.obtain();
3967 data.writeInterfaceToken(IActivityManager.descriptor);
3968 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003969 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003970 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3971 reply.readException();
3972 boolean result = reply.readInt() != 0;
3973 reply.recycle();
3974 data.recycle();
3975 return result;
3976 }
3977
Dianne Hackbornc72fc672012-09-20 13:12:03 -07003978 public int[] getRunningUserIds() throws RemoteException {
3979 Parcel data = Parcel.obtain();
3980 Parcel reply = Parcel.obtain();
3981 data.writeInterfaceToken(IActivityManager.descriptor);
3982 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
3983 reply.readException();
3984 int[] result = reply.createIntArray();
3985 reply.recycle();
3986 data.recycle();
3987 return result;
3988 }
3989
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003990 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3991 Parcel data = Parcel.obtain();
3992 Parcel reply = Parcel.obtain();
3993 data.writeInterfaceToken(IActivityManager.descriptor);
3994 data.writeInt(taskId);
3995 data.writeInt(subTaskIndex);
3996 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3997 reply.readException();
3998 boolean result = reply.readInt() != 0;
3999 reply.recycle();
4000 data.recycle();
4001 return result;
4002 }
4003
4004 public boolean removeTask(int taskId, int flags) throws RemoteException {
4005 Parcel data = Parcel.obtain();
4006 Parcel reply = Parcel.obtain();
4007 data.writeInterfaceToken(IActivityManager.descriptor);
4008 data.writeInt(taskId);
4009 data.writeInt(flags);
4010 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4011 reply.readException();
4012 boolean result = reply.readInt() != 0;
4013 reply.recycle();
4014 data.recycle();
4015 return result;
4016 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004017
Jeff Sharkeya4620792011-05-20 15:29:23 -07004018 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4019 Parcel data = Parcel.obtain();
4020 Parcel reply = Parcel.obtain();
4021 data.writeInterfaceToken(IActivityManager.descriptor);
4022 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4023 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4024 reply.readException();
4025 data.recycle();
4026 reply.recycle();
4027 }
4028
4029 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4030 Parcel data = Parcel.obtain();
4031 Parcel reply = Parcel.obtain();
4032 data.writeInterfaceToken(IActivityManager.descriptor);
4033 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4034 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4035 reply.readException();
4036 data.recycle();
4037 reply.recycle();
4038 }
4039
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004040 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4041 Parcel data = Parcel.obtain();
4042 Parcel reply = Parcel.obtain();
4043 data.writeInterfaceToken(IActivityManager.descriptor);
4044 data.writeStrongBinder(sender.asBinder());
4045 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4046 reply.readException();
4047 boolean res = reply.readInt() != 0;
4048 data.recycle();
4049 reply.recycle();
4050 return res;
4051 }
4052
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004053 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4054 Parcel data = Parcel.obtain();
4055 Parcel reply = Parcel.obtain();
4056 data.writeInterfaceToken(IActivityManager.descriptor);
4057 data.writeStrongBinder(sender.asBinder());
4058 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4059 reply.readException();
4060 boolean res = reply.readInt() != 0;
4061 data.recycle();
4062 reply.recycle();
4063 return res;
4064 }
4065
Dianne Hackborn81038902012-11-26 17:04:09 -08004066 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4067 Parcel data = Parcel.obtain();
4068 Parcel reply = Parcel.obtain();
4069 data.writeInterfaceToken(IActivityManager.descriptor);
4070 data.writeStrongBinder(sender.asBinder());
4071 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4072 reply.readException();
4073 Intent res = reply.readInt() != 0
4074 ? Intent.CREATOR.createFromParcel(reply) : null;
4075 data.recycle();
4076 reply.recycle();
4077 return res;
4078 }
4079
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004080 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4081 {
4082 Parcel data = Parcel.obtain();
4083 Parcel reply = Parcel.obtain();
4084 data.writeInterfaceToken(IActivityManager.descriptor);
4085 values.writeToParcel(data, 0);
4086 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4087 reply.readException();
4088 data.recycle();
4089 reply.recycle();
4090 }
4091
Dianne Hackbornb437e092011-08-05 17:50:29 -07004092 public long[] getProcessPss(int[] pids) throws RemoteException {
4093 Parcel data = Parcel.obtain();
4094 Parcel reply = Parcel.obtain();
4095 data.writeInterfaceToken(IActivityManager.descriptor);
4096 data.writeIntArray(pids);
4097 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4098 reply.readException();
4099 long[] res = reply.createLongArray();
4100 data.recycle();
4101 reply.recycle();
4102 return res;
4103 }
4104
Dianne Hackborn661cd522011-08-22 00:26:20 -07004105 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4106 Parcel data = Parcel.obtain();
4107 Parcel reply = Parcel.obtain();
4108 data.writeInterfaceToken(IActivityManager.descriptor);
4109 TextUtils.writeToParcel(msg, data, 0);
4110 data.writeInt(always ? 1 : 0);
4111 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4112 reply.readException();
4113 data.recycle();
4114 reply.recycle();
4115 }
4116
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004117 public void dismissKeyguardOnNextActivity() throws RemoteException {
4118 Parcel data = Parcel.obtain();
4119 Parcel reply = Parcel.obtain();
4120 data.writeInterfaceToken(IActivityManager.descriptor);
4121 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4122 reply.readException();
4123 data.recycle();
4124 reply.recycle();
4125 }
4126
Adam Powelldd8fab22012-03-22 17:47:27 -07004127 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4128 throws RemoteException {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 data.writeStrongBinder(token);
4133 data.writeString(destAffinity);
4134 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4135 reply.readException();
4136 boolean result = reply.readInt() != 0;
4137 data.recycle();
4138 reply.recycle();
4139 return result;
4140 }
4141
4142 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4143 throws RemoteException {
4144 Parcel data = Parcel.obtain();
4145 Parcel reply = Parcel.obtain();
4146 data.writeInterfaceToken(IActivityManager.descriptor);
4147 data.writeStrongBinder(token);
4148 target.writeToParcel(data, 0);
4149 data.writeInt(resultCode);
4150 if (resultData != null) {
4151 data.writeInt(1);
4152 resultData.writeToParcel(data, 0);
4153 } else {
4154 data.writeInt(0);
4155 }
4156 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4157 reply.readException();
4158 boolean result = reply.readInt() != 0;
4159 data.recycle();
4160 reply.recycle();
4161 return result;
4162 }
4163
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004164 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4165 Parcel data = Parcel.obtain();
4166 Parcel reply = Parcel.obtain();
4167 data.writeInterfaceToken(IActivityManager.descriptor);
4168 data.writeStrongBinder(activityToken);
4169 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4170 reply.readException();
4171 int result = reply.readInt();
4172 data.recycle();
4173 reply.recycle();
4174 return result;
4175 }
4176
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004177 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4178 Parcel data = Parcel.obtain();
4179 Parcel reply = Parcel.obtain();
4180 data.writeInterfaceToken(IActivityManager.descriptor);
4181 data.writeStrongBinder(activityToken);
4182 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4183 reply.readException();
4184 String result = reply.readString();
4185 data.recycle();
4186 reply.recycle();
4187 return result;
4188 }
4189
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004190 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4191 Parcel data = Parcel.obtain();
4192 Parcel reply = Parcel.obtain();
4193 data.writeInterfaceToken(IActivityManager.descriptor);
4194 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4195 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4196 reply.readException();
4197 data.recycle();
4198 reply.recycle();
4199 }
4200
4201 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4202 Parcel data = Parcel.obtain();
4203 Parcel reply = Parcel.obtain();
4204 data.writeInterfaceToken(IActivityManager.descriptor);
4205 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4206 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4207 reply.readException();
4208 data.recycle();
4209 reply.recycle();
4210 }
4211
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004212 public void requestBugReport() throws RemoteException {
4213 Parcel data = Parcel.obtain();
4214 Parcel reply = Parcel.obtain();
4215 data.writeInterfaceToken(IActivityManager.descriptor);
4216 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4217 reply.readException();
4218 data.recycle();
4219 reply.recycle();
4220 }
4221
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004222 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4223 Parcel data = Parcel.obtain();
4224 Parcel reply = Parcel.obtain();
4225 data.writeInterfaceToken(IActivityManager.descriptor);
4226 data.writeInt(pid);
4227 data.writeInt(aboveSystem ? 1 : 0);
4228 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4229 reply.readException();
4230 long res = reply.readInt();
4231 data.recycle();
4232 reply.recycle();
4233 return res;
4234 }
4235
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004236 public Bundle getTopActivityExtras(int requestType) throws RemoteException {
4237 Parcel data = Parcel.obtain();
4238 Parcel reply = Parcel.obtain();
4239 data.writeInterfaceToken(IActivityManager.descriptor);
4240 data.writeInt(requestType);
4241 mRemote.transact(GET_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4242 reply.readException();
4243 Bundle res = reply.readBundle();
4244 data.recycle();
4245 reply.recycle();
4246 return res;
4247 }
4248
4249 public void reportTopActivityExtras(IBinder token, Bundle extras) throws RemoteException {
4250 Parcel data = Parcel.obtain();
4251 Parcel reply = Parcel.obtain();
4252 data.writeInterfaceToken(IActivityManager.descriptor);
4253 data.writeStrongBinder(token);
4254 data.writeBundle(extras);
4255 mRemote.transact(REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4256 reply.readException();
4257 data.recycle();
4258 reply.recycle();
4259 }
4260
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004261 public void killUid(int uid, String reason) throws RemoteException {
4262 Parcel data = Parcel.obtain();
4263 Parcel reply = Parcel.obtain();
4264 data.writeInterfaceToken(IActivityManager.descriptor);
4265 data.writeInt(uid);
4266 data.writeString(reason);
4267 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4268 reply.readException();
4269 data.recycle();
4270 reply.recycle();
4271 }
4272
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004273 private IBinder mRemote;
4274}