blob: cc964c29721f36a648e196951315b79b6b40693a [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
Craig Mautner5ff12102013-05-24 12:50:15 -070019import android.app.ActivityManager.StackBoxInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070026import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.content.pm.ConfigurationInfo;
28import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070029import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.res.Configuration;
31import android.graphics.Bitmap;
32import android.net.Uri;
33import android.os.Binder;
34import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070035import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.os.IBinder;
37import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070038import android.os.ParcelFileDescriptor;
39import android.os.Parcelable;
40import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070042import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080045import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.ArrayList;
48import java.util.List;
49
50/** {@hide} */
51public abstract class ActivityManagerNative extends Binder implements IActivityManager
52{
53 /**
54 * Cast a Binder object into an activity manager interface, generating
55 * a proxy if needed.
56 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080057 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 if (obj == null) {
59 return null;
60 }
61 IActivityManager in =
62 (IActivityManager)obj.queryLocalInterface(descriptor);
63 if (in != null) {
64 return in;
65 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 return new ActivityManagerProxy(obj);
68 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 /**
71 * Retrieve the system's default/global activity manager.
72 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080073 static public IActivityManager getDefault() {
74 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 }
76
77 /**
78 * Convenience for checking whether the system is ready. For internal use only.
79 */
80 static public boolean isSystemReady() {
81 if (!sSystemReady) {
82 sSystemReady = getDefault().testIsSystemReady();
83 }
84 return sSystemReady;
85 }
86 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 /**
89 * Convenience for sending a sticky broadcast. For internal use only.
90 * If you don't care about permission, use null.
91 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070092 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 try {
94 getDefault().broadcastIntent(
95 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -080096 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 } catch (RemoteException ex) {
98 }
99 }
100
101 static public void noteWakeupAlarm(PendingIntent ps) {
102 try {
103 getDefault().noteWakeupAlarm(ps.getTarget());
104 } catch (RemoteException ex) {
105 }
106 }
107
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800108 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 attachInterface(this, descriptor);
110 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700111
112 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
114 throws RemoteException {
115 switch (code) {
116 case START_ACTIVITY_TRANSACTION:
117 {
118 data.enforceInterface(IActivityManager.descriptor);
119 IBinder b = data.readStrongBinder();
120 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800121 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 Intent intent = Intent.CREATOR.createFromParcel(data);
123 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800125 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700127 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700128 String profileFile = data.readString();
129 ParcelFileDescriptor profileFd = data.readInt() != 0
130 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700131 Bundle options = data.readInt() != 0
132 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800133 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700134 resultTo, resultWho, requestCode, startFlags,
135 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 reply.writeNoException();
137 reply.writeInt(result);
138 return true;
139 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700140
Amith Yamasani82644082012-08-03 13:09:11 -0700141 case START_ACTIVITY_AS_USER_TRANSACTION:
142 {
143 data.enforceInterface(IActivityManager.descriptor);
144 IBinder b = data.readStrongBinder();
145 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800146 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700147 Intent intent = Intent.CREATOR.createFromParcel(data);
148 String resolvedType = data.readString();
149 IBinder resultTo = data.readStrongBinder();
150 String resultWho = data.readString();
151 int requestCode = data.readInt();
152 int startFlags = data.readInt();
153 String profileFile = data.readString();
154 ParcelFileDescriptor profileFd = data.readInt() != 0
155 ? data.readFileDescriptor() : null;
156 Bundle options = data.readInt() != 0
157 ? Bundle.CREATOR.createFromParcel(data) : null;
158 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800159 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700160 resultTo, resultWho, requestCode, startFlags,
161 profileFile, profileFd, options, userId);
162 reply.writeNoException();
163 reply.writeInt(result);
164 return true;
165 }
166
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800167 case START_ACTIVITY_AND_WAIT_TRANSACTION:
168 {
169 data.enforceInterface(IActivityManager.descriptor);
170 IBinder b = data.readStrongBinder();
171 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800172 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 Intent intent = Intent.CREATOR.createFromParcel(data);
174 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800175 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800176 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800177 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700178 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700179 String profileFile = data.readString();
180 ParcelFileDescriptor profileFd = data.readInt() != 0
181 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700182 Bundle options = data.readInt() != 0
183 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700184 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800185 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700186 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700187 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800188 reply.writeNoException();
189 result.writeToParcel(reply, 0);
190 return true;
191 }
192
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700193 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
194 {
195 data.enforceInterface(IActivityManager.descriptor);
196 IBinder b = data.readStrongBinder();
197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800198 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 Intent intent = Intent.CREATOR.createFromParcel(data);
200 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700201 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700202 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700204 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700206 Bundle options = data.readInt() != 0
207 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700208 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800209 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700210 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700211 reply.writeNoException();
212 reply.writeInt(result);
213 return true;
214 }
215
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700216 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700217 {
218 data.enforceInterface(IActivityManager.descriptor);
219 IBinder b = data.readStrongBinder();
220 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700221 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700222 Intent fillInIntent = null;
223 if (data.readInt() != 0) {
224 fillInIntent = Intent.CREATOR.createFromParcel(data);
225 }
226 String resolvedType = data.readString();
227 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700228 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700229 int requestCode = data.readInt();
230 int flagsMask = data.readInt();
231 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700232 Bundle options = data.readInt() != 0
233 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700234 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700236 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700237 reply.writeNoException();
238 reply.writeInt(result);
239 return true;
240 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700241
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
243 {
244 data.enforceInterface(IActivityManager.descriptor);
245 IBinder callingActivity = data.readStrongBinder();
246 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700247 Bundle options = data.readInt() != 0
248 ? Bundle.CREATOR.createFromParcel(data) : null;
249 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 reply.writeNoException();
251 reply.writeInt(result ? 1 : 0);
252 return true;
253 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 case FINISH_ACTIVITY_TRANSACTION: {
256 data.enforceInterface(IActivityManager.descriptor);
257 IBinder token = data.readStrongBinder();
258 Intent resultData = null;
259 int resultCode = data.readInt();
260 if (data.readInt() != 0) {
261 resultData = Intent.CREATOR.createFromParcel(data);
262 }
263 boolean res = finishActivity(token, resultCode, resultData);
264 reply.writeNoException();
265 reply.writeInt(res ? 1 : 0);
266 return true;
267 }
268
269 case FINISH_SUB_ACTIVITY_TRANSACTION: {
270 data.enforceInterface(IActivityManager.descriptor);
271 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700272 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800273 int requestCode = data.readInt();
274 finishSubActivity(token, resultWho, requestCode);
275 reply.writeNoException();
276 return true;
277 }
278
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700279 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
280 data.enforceInterface(IActivityManager.descriptor);
281 IBinder token = data.readStrongBinder();
282 boolean res = finishActivityAffinity(token);
283 reply.writeNoException();
284 reply.writeInt(res ? 1 : 0);
285 return true;
286 }
287
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800288 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder token = data.readStrongBinder();
291 boolean res = willActivityBeVisible(token);
292 reply.writeNoException();
293 reply.writeInt(res ? 1 : 0);
294 return true;
295 }
296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 case REGISTER_RECEIVER_TRANSACTION:
298 {
299 data.enforceInterface(IActivityManager.descriptor);
300 IBinder b = data.readStrongBinder();
301 IApplicationThread app =
302 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700303 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800304 b = data.readStrongBinder();
305 IIntentReceiver rec
306 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
307 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
308 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700309 int userId = data.readInt();
310 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311 reply.writeNoException();
312 if (intent != null) {
313 reply.writeInt(1);
314 intent.writeToParcel(reply, 0);
315 } else {
316 reply.writeInt(0);
317 }
318 return true;
319 }
320
321 case UNREGISTER_RECEIVER_TRANSACTION:
322 {
323 data.enforceInterface(IActivityManager.descriptor);
324 IBinder b = data.readStrongBinder();
325 if (b == null) {
326 return true;
327 }
328 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
329 unregisterReceiver(rec);
330 reply.writeNoException();
331 return true;
332 }
333
334 case BROADCAST_INTENT_TRANSACTION:
335 {
336 data.enforceInterface(IActivityManager.descriptor);
337 IBinder b = data.readStrongBinder();
338 IApplicationThread app =
339 b != null ? ApplicationThreadNative.asInterface(b) : null;
340 Intent intent = Intent.CREATOR.createFromParcel(data);
341 String resolvedType = data.readString();
342 b = data.readStrongBinder();
343 IIntentReceiver resultTo =
344 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
345 int resultCode = data.readInt();
346 String resultData = data.readString();
347 Bundle resultExtras = data.readBundle();
348 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800349 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 boolean serialized = data.readInt() != 0;
351 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700352 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800354 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700355 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800356 reply.writeNoException();
357 reply.writeInt(res);
358 return true;
359 }
360
361 case UNBROADCAST_INTENT_TRANSACTION:
362 {
363 data.enforceInterface(IActivityManager.descriptor);
364 IBinder b = data.readStrongBinder();
365 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
366 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700367 int userId = data.readInt();
368 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800369 reply.writeNoException();
370 return true;
371 }
372
373 case FINISH_RECEIVER_TRANSACTION: {
374 data.enforceInterface(IActivityManager.descriptor);
375 IBinder who = data.readStrongBinder();
376 int resultCode = data.readInt();
377 String resultData = data.readString();
378 Bundle resultExtras = data.readBundle();
379 boolean resultAbort = data.readInt() != 0;
380 if (who != null) {
381 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
382 }
383 reply.writeNoException();
384 return true;
385 }
386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 case ATTACH_APPLICATION_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IApplicationThread app = ApplicationThreadNative.asInterface(
390 data.readStrongBinder());
391 if (app != null) {
392 attachApplication(app);
393 }
394 reply.writeNoException();
395 return true;
396 }
397
398 case ACTIVITY_IDLE_TRANSACTION: {
399 data.enforceInterface(IActivityManager.descriptor);
400 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700401 Configuration config = null;
402 if (data.readInt() != 0) {
403 config = Configuration.CREATOR.createFromParcel(data);
404 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700405 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700407 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800408 }
409 reply.writeNoException();
410 return true;
411 }
412
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700413 case ACTIVITY_RESUMED_TRANSACTION: {
414 data.enforceInterface(IActivityManager.descriptor);
415 IBinder token = data.readStrongBinder();
416 activityResumed(token);
417 reply.writeNoException();
418 return true;
419 }
420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 case ACTIVITY_PAUSED_TRANSACTION: {
422 data.enforceInterface(IActivityManager.descriptor);
423 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800424 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800425 reply.writeNoException();
426 return true;
427 }
428
429 case ACTIVITY_STOPPED_TRANSACTION: {
430 data.enforceInterface(IActivityManager.descriptor);
431 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800432 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 Bitmap thumbnail = data.readInt() != 0
434 ? Bitmap.CREATOR.createFromParcel(data) : null;
435 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800436 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800437 reply.writeNoException();
438 return true;
439 }
440
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800441 case ACTIVITY_SLEPT_TRANSACTION: {
442 data.enforceInterface(IActivityManager.descriptor);
443 IBinder token = data.readStrongBinder();
444 activitySlept(token);
445 reply.writeNoException();
446 return true;
447 }
448
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 case ACTIVITY_DESTROYED_TRANSACTION: {
450 data.enforceInterface(IActivityManager.descriptor);
451 IBinder token = data.readStrongBinder();
452 activityDestroyed(token);
453 reply.writeNoException();
454 return true;
455 }
456
457 case GET_CALLING_PACKAGE_TRANSACTION: {
458 data.enforceInterface(IActivityManager.descriptor);
459 IBinder token = data.readStrongBinder();
460 String res = token != null ? getCallingPackage(token) : null;
461 reply.writeNoException();
462 reply.writeString(res);
463 return true;
464 }
465
466 case GET_CALLING_ACTIVITY_TRANSACTION: {
467 data.enforceInterface(IActivityManager.descriptor);
468 IBinder token = data.readStrongBinder();
469 ComponentName cn = getCallingActivity(token);
470 reply.writeNoException();
471 ComponentName.writeToParcel(cn, reply);
472 return true;
473 }
474
475 case GET_TASKS_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 int maxNum = data.readInt();
478 int fl = data.readInt();
479 IBinder receiverBinder = data.readStrongBinder();
480 IThumbnailReceiver receiver = receiverBinder != null
481 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
482 : null;
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700483 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl, receiver);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800484 reply.writeNoException();
485 int N = list != null ? list.size() : -1;
486 reply.writeInt(N);
487 int i;
488 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700489 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800490 info.writeToParcel(reply, 0);
491 }
492 return true;
493 }
494
495 case GET_RECENT_TASKS_TRANSACTION: {
496 data.enforceInterface(IActivityManager.descriptor);
497 int maxNum = data.readInt();
498 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700499 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700501 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 reply.writeNoException();
503 reply.writeTypedList(list);
504 return true;
505 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700506
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700507 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800508 data.enforceInterface(IActivityManager.descriptor);
509 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700510 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800511 reply.writeNoException();
512 if (bm != null) {
513 reply.writeInt(1);
514 bm.writeToParcel(reply, 0);
515 } else {
516 reply.writeInt(0);
517 }
518 return true;
519 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700520
521 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
522 data.enforceInterface(IActivityManager.descriptor);
523 int id = data.readInt();
524 Bitmap bm = getTaskTopThumbnail(id);
525 reply.writeNoException();
526 if (bm != null) {
527 reply.writeInt(1);
528 bm.writeToParcel(reply, 0);
529 } else {
530 reply.writeInt(0);
531 }
532 return true;
533 }
534
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800535 case GET_SERVICES_TRANSACTION: {
536 data.enforceInterface(IActivityManager.descriptor);
537 int maxNum = data.readInt();
538 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700539 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 reply.writeNoException();
541 int N = list != null ? list.size() : -1;
542 reply.writeInt(N);
543 int i;
544 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700545 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 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 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700558
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800559 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
560 data.enforceInterface(IActivityManager.descriptor);
561 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
562 reply.writeNoException();
563 reply.writeTypedList(list);
564 return true;
565 }
566
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700567 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 List<ApplicationInfo> list = getRunningExternalApplications();
570 reply.writeNoException();
571 reply.writeTypedList(list);
572 return true;
573 }
574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 case MOVE_TASK_TO_FRONT_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800578 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700579 Bundle options = data.readInt() != 0
580 ? Bundle.CREATOR.createFromParcel(data) : null;
581 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 reply.writeNoException();
583 return true;
584 }
585
586 case MOVE_TASK_TO_BACK_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 int task = data.readInt();
589 moveTaskToBack(task);
590 reply.writeNoException();
591 return true;
592 }
593
594 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder token = data.readStrongBinder();
597 boolean nonRoot = data.readInt() != 0;
598 boolean res = moveActivityTaskToBack(token, nonRoot);
599 reply.writeNoException();
600 reply.writeInt(res ? 1 : 0);
601 return true;
602 }
603
604 case MOVE_TASK_BACKWARDS_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 int task = data.readInt();
607 moveTaskBackwards(task);
608 reply.writeNoException();
609 return true;
610 }
611
Craig Mautnerc00204b2013-03-05 15:02:14 -0800612 case CREATE_STACK_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700614 int taskId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800615 int relativeStackId = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700616 int position = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800617 float weight = data.readFloat();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700618 int res = createStack(taskId, relativeStackId, position, weight);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800619 reply.writeNoException();
620 reply.writeInt(res);
621 return true;
622 }
623
624 case MOVE_TASK_TO_STACK_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 int taskId = data.readInt();
627 int stackId = data.readInt();
628 boolean toTop = data.readInt() != 0;
629 moveTaskToStack(taskId, stackId, toTop);
630 reply.writeNoException();
631 return true;
632 }
633
634 case RESIZE_STACK_TRANSACTION: {
635 data.enforceInterface(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -0700636 int stackBoxId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800637 float weight = data.readFloat();
Craig Mautner5a449152013-05-24 15:49:29 -0700638 resizeStackBox(stackBoxId, weight);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800639 reply.writeNoException();
640 return true;
641 }
642
Craig Mautner5ff12102013-05-24 12:50:15 -0700643 case GET_STACK_BOXES_TRANSACTION: {
644 data.enforceInterface(IActivityManager.descriptor);
645 List<StackBoxInfo> list = getStackBoxes();
646 reply.writeNoException();
647 reply.writeTypedList(list);
648 return true;
649 }
650
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700651 case GET_STACK_BOX_INFO_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 int stackBoxId = data.readInt();
654 StackBoxInfo info = getStackBoxInfo(stackBoxId);
655 reply.writeNoException();
656 if (info != null) {
657 reply.writeInt(1);
658 info.writeToParcel(reply, 0);
659 } else {
660 reply.writeInt(0);
661 }
662 return true;
663 }
664
Craig Mautnercf910b02013-04-23 11:23:27 -0700665 case SET_FOCUSED_STACK_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 int stackId = data.readInt();
668 setFocusedStack(stackId);
669 reply.writeNoException();
670 return true;
671 }
672
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 IBinder token = data.readStrongBinder();
676 boolean onlyRoot = data.readInt() != 0;
677 int res = token != null
678 ? getTaskForActivity(token, onlyRoot) : -1;
679 reply.writeNoException();
680 reply.writeInt(res);
681 return true;
682 }
683
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 case REPORT_THUMBNAIL_TRANSACTION: {
685 data.enforceInterface(IActivityManager.descriptor);
686 IBinder token = data.readStrongBinder();
687 Bitmap thumbnail = data.readInt() != 0
688 ? Bitmap.CREATOR.createFromParcel(data) : null;
689 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
690 reportThumbnail(token, thumbnail, description);
691 reply.writeNoException();
692 return true;
693 }
694
695 case GET_CONTENT_PROVIDER_TRANSACTION: {
696 data.enforceInterface(IActivityManager.descriptor);
697 IBinder b = data.readStrongBinder();
698 IApplicationThread app = ApplicationThreadNative.asInterface(b);
699 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700700 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700701 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700702 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 reply.writeNoException();
704 if (cph != null) {
705 reply.writeInt(1);
706 cph.writeToParcel(reply, 0);
707 } else {
708 reply.writeInt(0);
709 }
710 return true;
711 }
712
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800713 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
714 data.enforceInterface(IActivityManager.descriptor);
715 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700716 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800717 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700718 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800719 reply.writeNoException();
720 if (cph != null) {
721 reply.writeInt(1);
722 cph.writeToParcel(reply, 0);
723 } else {
724 reply.writeInt(0);
725 }
726 return true;
727 }
728
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
730 data.enforceInterface(IActivityManager.descriptor);
731 IBinder b = data.readStrongBinder();
732 IApplicationThread app = ApplicationThreadNative.asInterface(b);
733 ArrayList<ContentProviderHolder> providers =
734 data.createTypedArrayList(ContentProviderHolder.CREATOR);
735 publishContentProviders(app, providers);
736 reply.writeNoException();
737 return true;
738 }
739
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700740 case REF_CONTENT_PROVIDER_TRANSACTION: {
741 data.enforceInterface(IActivityManager.descriptor);
742 IBinder b = data.readStrongBinder();
743 int stable = data.readInt();
744 int unstable = data.readInt();
745 boolean res = refContentProvider(b, stable, unstable);
746 reply.writeNoException();
747 reply.writeInt(res ? 1 : 0);
748 return true;
749 }
750
751 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
752 data.enforceInterface(IActivityManager.descriptor);
753 IBinder b = data.readStrongBinder();
754 unstableProviderDied(b);
755 reply.writeNoException();
756 return true;
757 }
758
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800759 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
760 data.enforceInterface(IActivityManager.descriptor);
761 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700762 boolean stable = data.readInt() != 0;
763 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 reply.writeNoException();
765 return true;
766 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800767
768 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 String name = data.readString();
771 IBinder token = data.readStrongBinder();
772 removeContentProviderExternal(name, token);
773 reply.writeNoException();
774 return true;
775 }
776
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700777 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
780 PendingIntent pi = getRunningServiceControlPanel(comp);
781 reply.writeNoException();
782 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
783 return true;
784 }
785
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 case START_SERVICE_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 IBinder b = data.readStrongBinder();
789 IApplicationThread app = ApplicationThreadNative.asInterface(b);
790 Intent service = Intent.CREATOR.createFromParcel(data);
791 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700792 int userId = data.readInt();
793 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794 reply.writeNoException();
795 ComponentName.writeToParcel(cn, reply);
796 return true;
797 }
798
799 case STOP_SERVICE_TRANSACTION: {
800 data.enforceInterface(IActivityManager.descriptor);
801 IBinder b = data.readStrongBinder();
802 IApplicationThread app = ApplicationThreadNative.asInterface(b);
803 Intent service = Intent.CREATOR.createFromParcel(data);
804 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700805 int userId = data.readInt();
806 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800807 reply.writeNoException();
808 reply.writeInt(res);
809 return true;
810 }
811
812 case STOP_SERVICE_TOKEN_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 ComponentName className = ComponentName.readFromParcel(data);
815 IBinder token = data.readStrongBinder();
816 int startId = data.readInt();
817 boolean res = stopServiceToken(className, token, startId);
818 reply.writeNoException();
819 reply.writeInt(res ? 1 : 0);
820 return true;
821 }
822
823 case SET_SERVICE_FOREGROUND_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 ComponentName className = ComponentName.readFromParcel(data);
826 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700827 int id = data.readInt();
828 Notification notification = null;
829 if (data.readInt() != 0) {
830 notification = Notification.CREATOR.createFromParcel(data);
831 }
832 boolean removeNotification = data.readInt() != 0;
833 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800834 reply.writeNoException();
835 return true;
836 }
837
838 case BIND_SERVICE_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 IBinder b = data.readStrongBinder();
841 IApplicationThread app = ApplicationThreadNative.asInterface(b);
842 IBinder token = data.readStrongBinder();
843 Intent service = Intent.CREATOR.createFromParcel(data);
844 String resolvedType = data.readString();
845 b = data.readStrongBinder();
846 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800847 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800848 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800849 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800850 reply.writeNoException();
851 reply.writeInt(res);
852 return true;
853 }
854
855 case UNBIND_SERVICE_TRANSACTION: {
856 data.enforceInterface(IActivityManager.descriptor);
857 IBinder b = data.readStrongBinder();
858 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
859 boolean res = unbindService(conn);
860 reply.writeNoException();
861 reply.writeInt(res ? 1 : 0);
862 return true;
863 }
864
865 case PUBLISH_SERVICE_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 IBinder token = data.readStrongBinder();
868 Intent intent = Intent.CREATOR.createFromParcel(data);
869 IBinder service = data.readStrongBinder();
870 publishService(token, intent, service);
871 reply.writeNoException();
872 return true;
873 }
874
875 case UNBIND_FINISHED_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 IBinder token = data.readStrongBinder();
878 Intent intent = Intent.CREATOR.createFromParcel(data);
879 boolean doRebind = data.readInt() != 0;
880 unbindFinished(token, intent, doRebind);
881 reply.writeNoException();
882 return true;
883 }
884
885 case SERVICE_DONE_EXECUTING_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700888 int type = data.readInt();
889 int startId = data.readInt();
890 int res = data.readInt();
891 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 reply.writeNoException();
893 return true;
894 }
895
896 case START_INSTRUMENTATION_TRANSACTION: {
897 data.enforceInterface(IActivityManager.descriptor);
898 ComponentName className = ComponentName.readFromParcel(data);
899 String profileFile = data.readString();
900 int fl = data.readInt();
901 Bundle arguments = data.readBundle();
902 IBinder b = data.readStrongBinder();
903 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800904 b = data.readStrongBinder();
905 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700906 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800907 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeInt(res ? 1 : 0);
910 return true;
911 }
912
913
914 case FINISH_INSTRUMENTATION_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 IBinder b = data.readStrongBinder();
917 IApplicationThread app = ApplicationThreadNative.asInterface(b);
918 int resultCode = data.readInt();
919 Bundle results = data.readBundle();
920 finishInstrumentation(app, resultCode, results);
921 reply.writeNoException();
922 return true;
923 }
924
925 case GET_CONFIGURATION_TRANSACTION: {
926 data.enforceInterface(IActivityManager.descriptor);
927 Configuration config = getConfiguration();
928 reply.writeNoException();
929 config.writeToParcel(reply, 0);
930 return true;
931 }
932
933 case UPDATE_CONFIGURATION_TRANSACTION: {
934 data.enforceInterface(IActivityManager.descriptor);
935 Configuration config = Configuration.CREATOR.createFromParcel(data);
936 updateConfiguration(config);
937 reply.writeNoException();
938 return true;
939 }
940
941 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 IBinder token = data.readStrongBinder();
944 int requestedOrientation = data.readInt();
945 setRequestedOrientation(token, requestedOrientation);
946 reply.writeNoException();
947 return true;
948 }
949
950 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder token = data.readStrongBinder();
953 int req = getRequestedOrientation(token);
954 reply.writeNoException();
955 reply.writeInt(req);
956 return true;
957 }
958
959 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
960 data.enforceInterface(IActivityManager.descriptor);
961 IBinder token = data.readStrongBinder();
962 ComponentName cn = getActivityClassForToken(token);
963 reply.writeNoException();
964 ComponentName.writeToParcel(cn, reply);
965 return true;
966 }
967
968 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder token = data.readStrongBinder();
971 reply.writeNoException();
972 reply.writeString(getPackageForToken(token));
973 return true;
974 }
975
976 case GET_INTENT_SENDER_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 int type = data.readInt();
979 String packageName = data.readString();
980 IBinder token = data.readStrongBinder();
981 String resultWho = data.readString();
982 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800983 Intent[] requestIntents;
984 String[] requestResolvedTypes;
985 if (data.readInt() != 0) {
986 requestIntents = data.createTypedArray(Intent.CREATOR);
987 requestResolvedTypes = data.createStringArray();
988 } else {
989 requestIntents = null;
990 requestResolvedTypes = null;
991 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700993 Bundle options = data.readInt() != 0
994 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700995 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800996 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800997 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700998 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 reply.writeNoException();
1000 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1001 return true;
1002 }
1003
1004 case CANCEL_INTENT_SENDER_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IIntentSender r = IIntentSender.Stub.asInterface(
1007 data.readStrongBinder());
1008 cancelIntentSender(r);
1009 reply.writeNoException();
1010 return true;
1011 }
1012
1013 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 IIntentSender r = IIntentSender.Stub.asInterface(
1016 data.readStrongBinder());
1017 String res = getPackageForIntentSender(r);
1018 reply.writeNoException();
1019 reply.writeString(res);
1020 return true;
1021 }
1022
Christopher Tatec4a07d12012-04-06 14:19:13 -07001023 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1024 data.enforceInterface(IActivityManager.descriptor);
1025 IIntentSender r = IIntentSender.Stub.asInterface(
1026 data.readStrongBinder());
1027 int res = getUidForIntentSender(r);
1028 reply.writeNoException();
1029 reply.writeInt(res);
1030 return true;
1031 }
1032
Dianne Hackborn41203752012-08-31 14:05:51 -07001033 case HANDLE_INCOMING_USER_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 int callingPid = data.readInt();
1036 int callingUid = data.readInt();
1037 int userId = data.readInt();
1038 boolean allowAll = data.readInt() != 0 ;
1039 boolean requireFull = data.readInt() != 0;
1040 String name = data.readString();
1041 String callerPackage = data.readString();
1042 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1043 requireFull, name, callerPackage);
1044 reply.writeNoException();
1045 reply.writeInt(res);
1046 return true;
1047 }
1048
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001049 case SET_PROCESS_LIMIT_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 int max = data.readInt();
1052 setProcessLimit(max);
1053 reply.writeNoException();
1054 return true;
1055 }
1056
1057 case GET_PROCESS_LIMIT_TRANSACTION: {
1058 data.enforceInterface(IActivityManager.descriptor);
1059 int limit = getProcessLimit();
1060 reply.writeNoException();
1061 reply.writeInt(limit);
1062 return true;
1063 }
1064
1065 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 IBinder token = data.readStrongBinder();
1068 int pid = data.readInt();
1069 boolean isForeground = data.readInt() != 0;
1070 setProcessForeground(token, pid, isForeground);
1071 reply.writeNoException();
1072 return true;
1073 }
1074
1075 case CHECK_PERMISSION_TRANSACTION: {
1076 data.enforceInterface(IActivityManager.descriptor);
1077 String perm = data.readString();
1078 int pid = data.readInt();
1079 int uid = data.readInt();
1080 int res = checkPermission(perm, pid, uid);
1081 reply.writeNoException();
1082 reply.writeInt(res);
1083 return true;
1084 }
1085
1086 case CHECK_URI_PERMISSION_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 Uri uri = Uri.CREATOR.createFromParcel(data);
1089 int pid = data.readInt();
1090 int uid = data.readInt();
1091 int mode = data.readInt();
1092 int res = checkUriPermission(uri, pid, uid, mode);
1093 reply.writeNoException();
1094 reply.writeInt(res);
1095 return true;
1096 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001097
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001099 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 String packageName = data.readString();
1101 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1102 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001103 int userId = data.readInt();
1104 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001105 reply.writeNoException();
1106 reply.writeInt(res ? 1 : 0);
1107 return true;
1108 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110 case GRANT_URI_PERMISSION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 IBinder b = data.readStrongBinder();
1113 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1114 String targetPkg = data.readString();
1115 Uri uri = Uri.CREATOR.createFromParcel(data);
1116 int mode = data.readInt();
1117 grantUriPermission(app, targetPkg, uri, mode);
1118 reply.writeNoException();
1119 return true;
1120 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001121
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 case REVOKE_URI_PERMISSION_TRANSACTION: {
1123 data.enforceInterface(IActivityManager.descriptor);
1124 IBinder b = data.readStrongBinder();
1125 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1126 Uri uri = Uri.CREATOR.createFromParcel(data);
1127 int mode = data.readInt();
1128 revokeUriPermission(app, uri, mode);
1129 reply.writeNoException();
1130 return true;
1131 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 IBinder b = data.readStrongBinder();
1136 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1137 boolean waiting = data.readInt() != 0;
1138 showWaitingForDebugger(app, waiting);
1139 reply.writeNoException();
1140 return true;
1141 }
1142
1143 case GET_MEMORY_INFO_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1146 getMemoryInfo(mi);
1147 reply.writeNoException();
1148 mi.writeToParcel(reply, 0);
1149 return true;
1150 }
1151
1152 case UNHANDLED_BACK_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 unhandledBack();
1155 reply.writeNoException();
1156 return true;
1157 }
1158
1159 case OPEN_CONTENT_URI_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 Uri uri = Uri.parse(data.readString());
1162 ParcelFileDescriptor pfd = openContentUri(uri);
1163 reply.writeNoException();
1164 if (pfd != null) {
1165 reply.writeInt(1);
1166 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1167 } else {
1168 reply.writeInt(0);
1169 }
1170 return true;
1171 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001172
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 case GOING_TO_SLEEP_TRANSACTION: {
1174 data.enforceInterface(IActivityManager.descriptor);
1175 goingToSleep();
1176 reply.writeNoException();
1177 return true;
1178 }
1179
1180 case WAKING_UP_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 wakingUp();
1183 reply.writeNoException();
1184 return true;
1185 }
1186
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001187 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 setLockScreenShown(data.readInt() != 0);
1190 reply.writeNoException();
1191 return true;
1192 }
1193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 case SET_DEBUG_APP_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 String pn = data.readString();
1197 boolean wfd = data.readInt() != 0;
1198 boolean per = data.readInt() != 0;
1199 setDebugApp(pn, wfd, per);
1200 reply.writeNoException();
1201 return true;
1202 }
1203
1204 case SET_ALWAYS_FINISH_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 boolean enabled = data.readInt() != 0;
1207 setAlwaysFinish(enabled);
1208 reply.writeNoException();
1209 return true;
1210 }
1211
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001212 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001214 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001216 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001217 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 return true;
1219 }
1220
1221 case ENTER_SAFE_MODE_TRANSACTION: {
1222 data.enforceInterface(IActivityManager.descriptor);
1223 enterSafeMode();
1224 reply.writeNoException();
1225 return true;
1226 }
1227
1228 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 IIntentSender is = IIntentSender.Stub.asInterface(
1231 data.readStrongBinder());
1232 noteWakeupAlarm(is);
1233 reply.writeNoException();
1234 return true;
1235 }
1236
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001237 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 data.enforceInterface(IActivityManager.descriptor);
1239 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001240 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001241 boolean secure = data.readInt() != 0;
1242 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001243 reply.writeNoException();
1244 reply.writeInt(res ? 1 : 0);
1245 return true;
1246 }
1247
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001248 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 String reason = data.readString();
1251 boolean res = killProcessesBelowForeground(reason);
1252 reply.writeNoException();
1253 reply.writeInt(res ? 1 : 0);
1254 return true;
1255 }
1256
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 case START_RUNNING_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 String pkg = data.readString();
1260 String cls = data.readString();
1261 String action = data.readString();
1262 String indata = data.readString();
1263 startRunning(pkg, cls, action, indata);
1264 reply.writeNoException();
1265 return true;
1266 }
1267
Dan Egnor60d87622009-12-16 16:32:58 -08001268 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 IBinder app = data.readStrongBinder();
1271 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1272 handleApplicationCrash(app, ci);
1273 reply.writeNoException();
1274 return true;
1275 }
1276
1277 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 data.enforceInterface(IActivityManager.descriptor);
1279 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001281 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001282 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001284 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 return true;
1286 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001287
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001288 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001291 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001292 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1293 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001294 reply.writeNoException();
1295 return true;
1296 }
1297
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001298 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
1300 int sig = data.readInt();
1301 signalPersistentProcesses(sig);
1302 reply.writeNoException();
1303 return true;
1304 }
1305
Dianne Hackborn03abb812010-01-04 18:43:19 -08001306 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001308 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001309 int userId = data.readInt();
1310 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001311 reply.writeNoException();
1312 return true;
1313 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001314
1315 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 killAllBackgroundProcesses();
1318 reply.writeNoException();
1319 return true;
1320 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001321
Dianne Hackborn03abb812010-01-04 18:43:19 -08001322 case FORCE_STOP_PACKAGE_TRANSACTION: {
1323 data.enforceInterface(IActivityManager.descriptor);
1324 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001325 int userId = data.readInt();
1326 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 reply.writeNoException();
1328 return true;
1329 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001330
1331 case GET_MY_MEMORY_STATE_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
1333 ActivityManager.RunningAppProcessInfo info =
1334 new ActivityManager.RunningAppProcessInfo();
1335 getMyMemoryState(info);
1336 reply.writeNoException();
1337 info.writeToParcel(reply, 0);
1338 return true;
1339 }
1340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
1343 ConfigurationInfo config = getDeviceConfigurationInfo();
1344 reply.writeNoException();
1345 config.writeToParcel(reply, 0);
1346 return true;
1347 }
1348
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001349 case PROFILE_CONTROL_TRANSACTION: {
1350 data.enforceInterface(IActivityManager.descriptor);
1351 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001352 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001353 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001354 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001355 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001356 ParcelFileDescriptor fd = data.readInt() != 0
1357 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001358 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001359 reply.writeNoException();
1360 reply.writeInt(res ? 1 : 0);
1361 return true;
1362 }
1363
Dianne Hackborn55280a92009-05-07 15:53:46 -07001364 case SHUTDOWN_TRANSACTION: {
1365 data.enforceInterface(IActivityManager.descriptor);
1366 boolean res = shutdown(data.readInt());
1367 reply.writeNoException();
1368 reply.writeInt(res ? 1 : 0);
1369 return true;
1370 }
1371
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001372 case STOP_APP_SWITCHES_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 stopAppSwitches();
1375 reply.writeNoException();
1376 return true;
1377 }
1378
1379 case RESUME_APP_SWITCHES_TRANSACTION: {
1380 data.enforceInterface(IActivityManager.descriptor);
1381 resumeAppSwitches();
1382 reply.writeNoException();
1383 return true;
1384 }
1385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001386 case PEEK_SERVICE_TRANSACTION: {
1387 data.enforceInterface(IActivityManager.descriptor);
1388 Intent service = Intent.CREATOR.createFromParcel(data);
1389 String resolvedType = data.readString();
1390 IBinder binder = peekService(service, resolvedType);
1391 reply.writeNoException();
1392 reply.writeStrongBinder(binder);
1393 return true;
1394 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001395
1396 case START_BACKUP_AGENT_TRANSACTION: {
1397 data.enforceInterface(IActivityManager.descriptor);
1398 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1399 int backupRestoreMode = data.readInt();
1400 boolean success = bindBackupAgent(info, backupRestoreMode);
1401 reply.writeNoException();
1402 reply.writeInt(success ? 1 : 0);
1403 return true;
1404 }
1405
1406 case BACKUP_AGENT_CREATED_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
1408 String packageName = data.readString();
1409 IBinder agent = data.readStrongBinder();
1410 backupAgentCreated(packageName, agent);
1411 reply.writeNoException();
1412 return true;
1413 }
1414
1415 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1416 data.enforceInterface(IActivityManager.descriptor);
1417 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1418 unbindBackupAgent(info);
1419 reply.writeNoException();
1420 return true;
1421 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001422
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001423 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001424 data.enforceInterface(IActivityManager.descriptor);
1425 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001426 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001427 String reason = data.readString();
1428 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001429 reply.writeNoException();
1430 return true;
1431 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001432
1433 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1434 data.enforceInterface(IActivityManager.descriptor);
1435 String reason = data.readString();
1436 closeSystemDialogs(reason);
1437 reply.writeNoException();
1438 return true;
1439 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001440
1441 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001443 int[] pids = data.createIntArray();
1444 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001445 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001446 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001447 return true;
1448 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001449
1450 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1451 data.enforceInterface(IActivityManager.descriptor);
1452 String processName = data.readString();
1453 int uid = data.readInt();
1454 killApplicationProcess(processName, uid);
1455 reply.writeNoException();
1456 return true;
1457 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001458
1459 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1460 data.enforceInterface(IActivityManager.descriptor);
1461 IBinder token = data.readStrongBinder();
1462 String packageName = data.readString();
1463 int enterAnim = data.readInt();
1464 int exitAnim = data.readInt();
1465 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001466 reply.writeNoException();
1467 return true;
1468 }
1469
1470 case IS_USER_A_MONKEY_TRANSACTION: {
1471 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001472 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001473 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001474 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001475 return true;
1476 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001477
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001478 case SET_USER_IS_MONKEY_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 final boolean monkey = (data.readInt() == 1);
1481 setUserIsMonkey(monkey);
1482 reply.writeNoException();
1483 return true;
1484 }
1485
Dianne Hackborn860755f2010-06-03 18:47:52 -07001486 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1487 data.enforceInterface(IActivityManager.descriptor);
1488 finishHeavyWeightApp();
1489 reply.writeNoException();
1490 return true;
1491 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001492
1493 case IS_IMMERSIVE_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
1495 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001496 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001497 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001498 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001499 return true;
1500 }
1501
Craig Mautner5eda9b32013-07-02 11:58:16 -07001502 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001503 data.enforceInterface(IActivityManager.descriptor);
1504 IBinder token = data.readStrongBinder();
Craig Mautner5eda9b32013-07-02 11:58:16 -07001505 convertFromTranslucent(token);
1506 reply.writeNoException();
1507 return true;
1508 }
1509
1510 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 IBinder token = data.readStrongBinder();
1513 convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001514 reply.writeNoException();
1515 return true;
1516 }
1517
Daniel Sandler69a48172010-06-23 16:29:36 -04001518 case SET_IMMERSIVE_TRANSACTION: {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 IBinder token = data.readStrongBinder();
1521 boolean imm = data.readInt() == 1;
1522 setImmersive(token, imm);
1523 reply.writeNoException();
1524 return true;
1525 }
1526
1527 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001529 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001530 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001531 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001532 return true;
1533 }
1534
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001535 case CRASH_APPLICATION_TRANSACTION: {
1536 data.enforceInterface(IActivityManager.descriptor);
1537 int uid = data.readInt();
1538 int initialPid = data.readInt();
1539 String packageName = data.readString();
1540 String message = data.readString();
1541 crashApplication(uid, initialPid, packageName, message);
1542 reply.writeNoException();
1543 return true;
1544 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001545
1546 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001549 int userId = data.readInt();
1550 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001551 reply.writeNoException();
1552 reply.writeString(type);
1553 return true;
1554 }
1555
Dianne Hackborn7e269642010-08-25 19:50:20 -07001556 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 String name = data.readString();
1559 IBinder perm = newUriPermissionOwner(name);
1560 reply.writeNoException();
1561 reply.writeStrongBinder(perm);
1562 return true;
1563 }
1564
1565 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 IBinder owner = data.readStrongBinder();
1568 int fromUid = data.readInt();
1569 String targetPkg = data.readString();
1570 Uri uri = Uri.CREATOR.createFromParcel(data);
1571 int mode = data.readInt();
1572 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1573 reply.writeNoException();
1574 return true;
1575 }
1576
1577 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 IBinder owner = data.readStrongBinder();
1580 Uri uri = null;
1581 if (data.readInt() != 0) {
1582 Uri.CREATOR.createFromParcel(data);
1583 }
1584 int mode = data.readInt();
1585 revokeUriPermissionFromOwner(owner, uri, mode);
1586 reply.writeNoException();
1587 return true;
1588 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001589
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001590 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1591 data.enforceInterface(IActivityManager.descriptor);
1592 int callingUid = data.readInt();
1593 String targetPkg = data.readString();
1594 Uri uri = Uri.CREATOR.createFromParcel(data);
1595 int modeFlags = data.readInt();
1596 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1597 reply.writeNoException();
1598 reply.writeInt(res);
1599 return true;
1600 }
1601
Andy McFadden824c5102010-07-09 16:26:57 -07001602 case DUMP_HEAP_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001605 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001606 boolean managed = data.readInt() != 0;
1607 String path = data.readString();
1608 ParcelFileDescriptor fd = data.readInt() != 0
1609 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001610 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001611 reply.writeNoException();
1612 reply.writeInt(res ? 1 : 0);
1613 return true;
1614 }
1615
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001616 case START_ACTIVITIES_TRANSACTION:
1617 {
1618 data.enforceInterface(IActivityManager.descriptor);
1619 IBinder b = data.readStrongBinder();
1620 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001621 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001622 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1623 String[] resolvedTypes = data.createStringArray();
1624 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001625 Bundle options = data.readInt() != 0
1626 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001627 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001628 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001629 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001630 reply.writeNoException();
1631 reply.writeInt(result);
1632 return true;
1633 }
1634
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001635 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1636 {
1637 data.enforceInterface(IActivityManager.descriptor);
1638 int mode = getFrontActivityScreenCompatMode();
1639 reply.writeNoException();
1640 reply.writeInt(mode);
1641 return true;
1642 }
1643
1644 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1645 {
1646 data.enforceInterface(IActivityManager.descriptor);
1647 int mode = data.readInt();
1648 setFrontActivityScreenCompatMode(mode);
1649 reply.writeNoException();
1650 reply.writeInt(mode);
1651 return true;
1652 }
1653
1654 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1655 {
1656 data.enforceInterface(IActivityManager.descriptor);
1657 String pkg = data.readString();
1658 int mode = getPackageScreenCompatMode(pkg);
1659 reply.writeNoException();
1660 reply.writeInt(mode);
1661 return true;
1662 }
1663
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001664 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1665 {
1666 data.enforceInterface(IActivityManager.descriptor);
1667 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001668 int mode = data.readInt();
1669 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001670 reply.writeNoException();
1671 return true;
1672 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001673
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001674 case SWITCH_USER_TRANSACTION: {
1675 data.enforceInterface(IActivityManager.descriptor);
1676 int userid = data.readInt();
1677 boolean result = switchUser(userid);
1678 reply.writeNoException();
1679 reply.writeInt(result ? 1 : 0);
1680 return true;
1681 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001682
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001683 case STOP_USER_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
1685 int userid = data.readInt();
1686 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1687 data.readStrongBinder());
1688 int result = stopUser(userid, callback);
1689 reply.writeNoException();
1690 reply.writeInt(result);
1691 return true;
1692 }
1693
Amith Yamasani52f1d752012-03-28 18:19:29 -07001694 case GET_CURRENT_USER_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 UserInfo userInfo = getCurrentUser();
1697 reply.writeNoException();
1698 userInfo.writeToParcel(reply, 0);
1699 return true;
1700 }
1701
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001702 case IS_USER_RUNNING_TRANSACTION: {
1703 data.enforceInterface(IActivityManager.descriptor);
1704 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001705 boolean orStopping = data.readInt() != 0;
1706 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001707 reply.writeNoException();
1708 reply.writeInt(result ? 1 : 0);
1709 return true;
1710 }
1711
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001712 case GET_RUNNING_USER_IDS_TRANSACTION: {
1713 data.enforceInterface(IActivityManager.descriptor);
1714 int[] result = getRunningUserIds();
1715 reply.writeNoException();
1716 reply.writeIntArray(result);
1717 return true;
1718 }
1719
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001720 case REMOVE_SUB_TASK_TRANSACTION:
1721 {
1722 data.enforceInterface(IActivityManager.descriptor);
1723 int taskId = data.readInt();
1724 int subTaskIndex = data.readInt();
1725 boolean result = removeSubTask(taskId, subTaskIndex);
1726 reply.writeNoException();
1727 reply.writeInt(result ? 1 : 0);
1728 return true;
1729 }
1730
1731 case REMOVE_TASK_TRANSACTION:
1732 {
1733 data.enforceInterface(IActivityManager.descriptor);
1734 int taskId = data.readInt();
1735 int fl = data.readInt();
1736 boolean result = removeTask(taskId, fl);
1737 reply.writeNoException();
1738 reply.writeInt(result ? 1 : 0);
1739 return true;
1740 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001741
Jeff Sharkeya4620792011-05-20 15:29:23 -07001742 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1745 data.readStrongBinder());
1746 registerProcessObserver(observer);
1747 return true;
1748 }
1749
1750 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1753 data.readStrongBinder());
1754 unregisterProcessObserver(observer);
1755 return true;
1756 }
1757
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001758 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1759 {
1760 data.enforceInterface(IActivityManager.descriptor);
1761 String pkg = data.readString();
1762 boolean ask = getPackageAskScreenCompat(pkg);
1763 reply.writeNoException();
1764 reply.writeInt(ask ? 1 : 0);
1765 return true;
1766 }
1767
1768 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1769 {
1770 data.enforceInterface(IActivityManager.descriptor);
1771 String pkg = data.readString();
1772 boolean ask = data.readInt() != 0;
1773 setPackageAskScreenCompat(pkg, ask);
1774 reply.writeNoException();
1775 return true;
1776 }
1777
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001778 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 IIntentSender r = IIntentSender.Stub.asInterface(
1781 data.readStrongBinder());
1782 boolean res = isIntentSenderTargetedToPackage(r);
1783 reply.writeNoException();
1784 reply.writeInt(res ? 1 : 0);
1785 return true;
1786 }
1787
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001788 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1789 data.enforceInterface(IActivityManager.descriptor);
1790 IIntentSender r = IIntentSender.Stub.asInterface(
1791 data.readStrongBinder());
1792 boolean res = isIntentSenderAnActivity(r);
1793 reply.writeNoException();
1794 reply.writeInt(res ? 1 : 0);
1795 return true;
1796 }
1797
Dianne Hackborn81038902012-11-26 17:04:09 -08001798 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 IIntentSender r = IIntentSender.Stub.asInterface(
1801 data.readStrongBinder());
1802 Intent intent = getIntentForIntentSender(r);
1803 reply.writeNoException();
1804 if (intent != null) {
1805 reply.writeInt(1);
1806 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1807 } else {
1808 reply.writeInt(0);
1809 }
1810 return true;
1811 }
1812
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001813 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1814 data.enforceInterface(IActivityManager.descriptor);
1815 Configuration config = Configuration.CREATOR.createFromParcel(data);
1816 updatePersistentConfiguration(config);
1817 reply.writeNoException();
1818 return true;
1819 }
1820
Dianne Hackbornb437e092011-08-05 17:50:29 -07001821 case GET_PROCESS_PSS_TRANSACTION: {
1822 data.enforceInterface(IActivityManager.descriptor);
1823 int[] pids = data.createIntArray();
1824 long[] pss = getProcessPss(pids);
1825 reply.writeNoException();
1826 reply.writeLongArray(pss);
1827 return true;
1828 }
1829
Dianne Hackborn661cd522011-08-22 00:26:20 -07001830 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1833 boolean always = data.readInt() != 0;
1834 showBootMessage(msg, always);
1835 reply.writeNoException();
1836 return true;
1837 }
1838
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001839 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1840 data.enforceInterface(IActivityManager.descriptor);
1841 dismissKeyguardOnNextActivity();
1842 reply.writeNoException();
1843 return true;
1844 }
1845
Adam Powelldd8fab22012-03-22 17:47:27 -07001846 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 IBinder token = data.readStrongBinder();
1849 String destAffinity = data.readString();
1850 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1851 reply.writeNoException();
1852 reply.writeInt(res ? 1 : 0);
1853 return true;
1854 }
1855
1856 case NAVIGATE_UP_TO_TRANSACTION: {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 IBinder token = data.readStrongBinder();
1859 Intent target = Intent.CREATOR.createFromParcel(data);
1860 int resultCode = data.readInt();
1861 Intent resultData = null;
1862 if (data.readInt() != 0) {
1863 resultData = Intent.CREATOR.createFromParcel(data);
1864 }
1865 boolean res = navigateUpTo(token, target, resultCode, resultData);
1866 reply.writeNoException();
1867 reply.writeInt(res ? 1 : 0);
1868 return true;
1869 }
1870
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001871 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1872 data.enforceInterface(IActivityManager.descriptor);
1873 IBinder token = data.readStrongBinder();
1874 int res = getLaunchedFromUid(token);
1875 reply.writeNoException();
1876 reply.writeInt(res);
1877 return true;
1878 }
1879
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001880 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1881 data.enforceInterface(IActivityManager.descriptor);
1882 IBinder token = data.readStrongBinder();
1883 String res = getLaunchedFromPackage(token);
1884 reply.writeNoException();
1885 reply.writeString(res);
1886 return true;
1887 }
1888
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001889 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1890 data.enforceInterface(IActivityManager.descriptor);
1891 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1892 data.readStrongBinder());
1893 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001894 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001895 return true;
1896 }
1897
1898 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1899 data.enforceInterface(IActivityManager.descriptor);
1900 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1901 data.readStrongBinder());
1902 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001903 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001904 return true;
1905 }
1906
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001907 case REQUEST_BUG_REPORT_TRANSACTION: {
1908 data.enforceInterface(IActivityManager.descriptor);
1909 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001910 reply.writeNoException();
1911 return true;
1912 }
1913
1914 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1915 data.enforceInterface(IActivityManager.descriptor);
1916 int pid = data.readInt();
1917 boolean aboveSystem = data.readInt() != 0;
1918 long res = inputDispatchingTimedOut(pid, aboveSystem);
1919 reply.writeNoException();
1920 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001921 return true;
1922 }
1923
Adam Skorydfc7fd72013-08-05 19:23:41 -07001924 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001925 data.enforceInterface(IActivityManager.descriptor);
1926 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001927 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001928 reply.writeNoException();
1929 reply.writeBundle(res);
1930 return true;
1931 }
1932
Adam Skorydfc7fd72013-08-05 19:23:41 -07001933 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001934 data.enforceInterface(IActivityManager.descriptor);
1935 IBinder token = data.readStrongBinder();
1936 Bundle extras = data.readBundle();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001937 int index = data.readInt();
1938 reportAssistContextExtras(token, extras, index);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001939 reply.writeNoException();
1940 return true;
1941 }
1942
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001943 case KILL_UID_TRANSACTION: {
1944 data.enforceInterface(IActivityManager.descriptor);
1945 int uid = data.readInt();
1946 String reason = data.readString();
1947 killUid(uid, reason);
1948 reply.writeNoException();
1949 return true;
1950 }
1951
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07001952 case HANG_TRANSACTION: {
1953 data.enforceInterface(IActivityManager.descriptor);
1954 IBinder who = data.readStrongBinder();
1955 boolean allowRestart = data.readInt() != 0;
1956 hang(who, allowRestart);
1957 reply.writeNoException();
1958 return true;
1959 }
1960
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07001961 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
1962 data.enforceInterface(IActivityManager.descriptor);
1963 IBinder token = data.readStrongBinder();
1964 reportActivityFullyDrawn(token);
1965 reply.writeNoException();
1966 return true;
1967 }
1968
Craig Mautner5eda9b32013-07-02 11:58:16 -07001969 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
1970 data.enforceInterface(IActivityManager.descriptor);
1971 IBinder token = data.readStrongBinder();
1972 notifyActivityDrawn(token);
1973 reply.writeNoException();
1974 return true;
1975 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07001976
1977 case RESTART_TRANSACTION: {
1978 data.enforceInterface(IActivityManager.descriptor);
1979 restart();
1980 reply.writeNoException();
1981 return true;
1982 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001983 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001984
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001985 return super.onTransact(code, data, reply, flags);
1986 }
1987
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001988 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001989 return this;
1990 }
1991
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001992 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1993 protected IActivityManager create() {
1994 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001995 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001996 Log.v("ActivityManager", "default service binder = " + b);
1997 }
1998 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001999 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002000 Log.v("ActivityManager", "default service = " + am);
2001 }
2002 return am;
2003 }
2004 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002005}
2006
2007class ActivityManagerProxy implements IActivityManager
2008{
2009 public ActivityManagerProxy(IBinder remote)
2010 {
2011 mRemote = remote;
2012 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002013
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002014 public IBinder asBinder()
2015 {
2016 return mRemote;
2017 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002018
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002019 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002020 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2021 int startFlags, String profileFile,
2022 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002023 Parcel data = Parcel.obtain();
2024 Parcel reply = Parcel.obtain();
2025 data.writeInterfaceToken(IActivityManager.descriptor);
2026 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002027 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002028 intent.writeToParcel(data, 0);
2029 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002030 data.writeStrongBinder(resultTo);
2031 data.writeString(resultWho);
2032 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002033 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002034 data.writeString(profileFile);
2035 if (profileFd != null) {
2036 data.writeInt(1);
2037 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2038 } else {
2039 data.writeInt(0);
2040 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002041 if (options != null) {
2042 data.writeInt(1);
2043 options.writeToParcel(data, 0);
2044 } else {
2045 data.writeInt(0);
2046 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002047 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2048 reply.readException();
2049 int result = reply.readInt();
2050 reply.recycle();
2051 data.recycle();
2052 return result;
2053 }
Amith Yamasani82644082012-08-03 13:09:11 -07002054
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002055 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002056 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2057 int startFlags, String profileFile,
2058 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2059 Parcel data = Parcel.obtain();
2060 Parcel reply = Parcel.obtain();
2061 data.writeInterfaceToken(IActivityManager.descriptor);
2062 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002063 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002064 intent.writeToParcel(data, 0);
2065 data.writeString(resolvedType);
2066 data.writeStrongBinder(resultTo);
2067 data.writeString(resultWho);
2068 data.writeInt(requestCode);
2069 data.writeInt(startFlags);
2070 data.writeString(profileFile);
2071 if (profileFd != null) {
2072 data.writeInt(1);
2073 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2074 } else {
2075 data.writeInt(0);
2076 }
2077 if (options != null) {
2078 data.writeInt(1);
2079 options.writeToParcel(data, 0);
2080 } else {
2081 data.writeInt(0);
2082 }
2083 data.writeInt(userId);
2084 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2085 reply.readException();
2086 int result = reply.readInt();
2087 reply.recycle();
2088 data.recycle();
2089 return result;
2090 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002091 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2092 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002093 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002094 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002095 Parcel data = Parcel.obtain();
2096 Parcel reply = Parcel.obtain();
2097 data.writeInterfaceToken(IActivityManager.descriptor);
2098 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002099 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002100 intent.writeToParcel(data, 0);
2101 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002102 data.writeStrongBinder(resultTo);
2103 data.writeString(resultWho);
2104 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002105 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002106 data.writeString(profileFile);
2107 if (profileFd != null) {
2108 data.writeInt(1);
2109 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2110 } else {
2111 data.writeInt(0);
2112 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002113 if (options != null) {
2114 data.writeInt(1);
2115 options.writeToParcel(data, 0);
2116 } else {
2117 data.writeInt(0);
2118 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002119 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002120 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2121 reply.readException();
2122 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2123 reply.recycle();
2124 data.recycle();
2125 return result;
2126 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002127 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2128 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002129 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002130 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002131 Parcel data = Parcel.obtain();
2132 Parcel reply = Parcel.obtain();
2133 data.writeInterfaceToken(IActivityManager.descriptor);
2134 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002135 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002136 intent.writeToParcel(data, 0);
2137 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002138 data.writeStrongBinder(resultTo);
2139 data.writeString(resultWho);
2140 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002141 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002142 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002143 if (options != null) {
2144 data.writeInt(1);
2145 options.writeToParcel(data, 0);
2146 } else {
2147 data.writeInt(0);
2148 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002149 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002150 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2151 reply.readException();
2152 int result = reply.readInt();
2153 reply.recycle();
2154 data.recycle();
2155 return result;
2156 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002157 public int startActivityIntentSender(IApplicationThread caller,
2158 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002159 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002160 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002161 Parcel data = Parcel.obtain();
2162 Parcel reply = Parcel.obtain();
2163 data.writeInterfaceToken(IActivityManager.descriptor);
2164 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2165 intent.writeToParcel(data, 0);
2166 if (fillInIntent != null) {
2167 data.writeInt(1);
2168 fillInIntent.writeToParcel(data, 0);
2169 } else {
2170 data.writeInt(0);
2171 }
2172 data.writeString(resolvedType);
2173 data.writeStrongBinder(resultTo);
2174 data.writeString(resultWho);
2175 data.writeInt(requestCode);
2176 data.writeInt(flagsMask);
2177 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002178 if (options != null) {
2179 data.writeInt(1);
2180 options.writeToParcel(data, 0);
2181 } else {
2182 data.writeInt(0);
2183 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002184 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002185 reply.readException();
2186 int result = reply.readInt();
2187 reply.recycle();
2188 data.recycle();
2189 return result;
2190 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002191 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002192 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002193 Parcel data = Parcel.obtain();
2194 Parcel reply = Parcel.obtain();
2195 data.writeInterfaceToken(IActivityManager.descriptor);
2196 data.writeStrongBinder(callingActivity);
2197 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002198 if (options != null) {
2199 data.writeInt(1);
2200 options.writeToParcel(data, 0);
2201 } else {
2202 data.writeInt(0);
2203 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002204 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2205 reply.readException();
2206 int result = reply.readInt();
2207 reply.recycle();
2208 data.recycle();
2209 return result != 0;
2210 }
2211 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2212 throws RemoteException {
2213 Parcel data = Parcel.obtain();
2214 Parcel reply = Parcel.obtain();
2215 data.writeInterfaceToken(IActivityManager.descriptor);
2216 data.writeStrongBinder(token);
2217 data.writeInt(resultCode);
2218 if (resultData != null) {
2219 data.writeInt(1);
2220 resultData.writeToParcel(data, 0);
2221 } else {
2222 data.writeInt(0);
2223 }
2224 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2225 reply.readException();
2226 boolean res = reply.readInt() != 0;
2227 data.recycle();
2228 reply.recycle();
2229 return res;
2230 }
2231 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2232 {
2233 Parcel data = Parcel.obtain();
2234 Parcel reply = Parcel.obtain();
2235 data.writeInterfaceToken(IActivityManager.descriptor);
2236 data.writeStrongBinder(token);
2237 data.writeString(resultWho);
2238 data.writeInt(requestCode);
2239 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2240 reply.readException();
2241 data.recycle();
2242 reply.recycle();
2243 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002244 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2245 Parcel data = Parcel.obtain();
2246 Parcel reply = Parcel.obtain();
2247 data.writeInterfaceToken(IActivityManager.descriptor);
2248 data.writeStrongBinder(token);
2249 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2250 reply.readException();
2251 boolean res = reply.readInt() != 0;
2252 data.recycle();
2253 reply.recycle();
2254 return res;
2255 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002256 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2257 Parcel data = Parcel.obtain();
2258 Parcel reply = Parcel.obtain();
2259 data.writeInterfaceToken(IActivityManager.descriptor);
2260 data.writeStrongBinder(token);
2261 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2262 reply.readException();
2263 boolean res = reply.readInt() != 0;
2264 data.recycle();
2265 reply.recycle();
2266 return res;
2267 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002268 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002269 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002270 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002271 {
2272 Parcel data = Parcel.obtain();
2273 Parcel reply = Parcel.obtain();
2274 data.writeInterfaceToken(IActivityManager.descriptor);
2275 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002276 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002277 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2278 filter.writeToParcel(data, 0);
2279 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002280 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002281 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2282 reply.readException();
2283 Intent intent = null;
2284 int haveIntent = reply.readInt();
2285 if (haveIntent != 0) {
2286 intent = Intent.CREATOR.createFromParcel(reply);
2287 }
2288 reply.recycle();
2289 data.recycle();
2290 return intent;
2291 }
2292 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2293 {
2294 Parcel data = Parcel.obtain();
2295 Parcel reply = Parcel.obtain();
2296 data.writeInterfaceToken(IActivityManager.descriptor);
2297 data.writeStrongBinder(receiver.asBinder());
2298 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2299 reply.readException();
2300 data.recycle();
2301 reply.recycle();
2302 }
2303 public int broadcastIntent(IApplicationThread caller,
2304 Intent intent, String resolvedType, IIntentReceiver resultTo,
2305 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002306 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002307 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002308 {
2309 Parcel data = Parcel.obtain();
2310 Parcel reply = Parcel.obtain();
2311 data.writeInterfaceToken(IActivityManager.descriptor);
2312 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2313 intent.writeToParcel(data, 0);
2314 data.writeString(resolvedType);
2315 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2316 data.writeInt(resultCode);
2317 data.writeString(resultData);
2318 data.writeBundle(map);
2319 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002320 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002321 data.writeInt(serialized ? 1 : 0);
2322 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002323 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002324 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2325 reply.readException();
2326 int res = reply.readInt();
2327 reply.recycle();
2328 data.recycle();
2329 return res;
2330 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002331 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2332 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002333 {
2334 Parcel data = Parcel.obtain();
2335 Parcel reply = Parcel.obtain();
2336 data.writeInterfaceToken(IActivityManager.descriptor);
2337 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2338 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002339 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002340 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2341 reply.readException();
2342 data.recycle();
2343 reply.recycle();
2344 }
2345 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2346 {
2347 Parcel data = Parcel.obtain();
2348 Parcel reply = Parcel.obtain();
2349 data.writeInterfaceToken(IActivityManager.descriptor);
2350 data.writeStrongBinder(who);
2351 data.writeInt(resultCode);
2352 data.writeString(resultData);
2353 data.writeBundle(map);
2354 data.writeInt(abortBroadcast ? 1 : 0);
2355 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2356 reply.readException();
2357 data.recycle();
2358 reply.recycle();
2359 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002360 public void attachApplication(IApplicationThread app) throws RemoteException
2361 {
2362 Parcel data = Parcel.obtain();
2363 Parcel reply = Parcel.obtain();
2364 data.writeInterfaceToken(IActivityManager.descriptor);
2365 data.writeStrongBinder(app.asBinder());
2366 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2367 reply.readException();
2368 data.recycle();
2369 reply.recycle();
2370 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002371 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2372 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002373 {
2374 Parcel data = Parcel.obtain();
2375 Parcel reply = Parcel.obtain();
2376 data.writeInterfaceToken(IActivityManager.descriptor);
2377 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002378 if (config != null) {
2379 data.writeInt(1);
2380 config.writeToParcel(data, 0);
2381 } else {
2382 data.writeInt(0);
2383 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002384 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002385 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2386 reply.readException();
2387 data.recycle();
2388 reply.recycle();
2389 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002390 public void activityResumed(IBinder token) throws RemoteException
2391 {
2392 Parcel data = Parcel.obtain();
2393 Parcel reply = Parcel.obtain();
2394 data.writeInterfaceToken(IActivityManager.descriptor);
2395 data.writeStrongBinder(token);
2396 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2397 reply.readException();
2398 data.recycle();
2399 reply.recycle();
2400 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002401 public void activityPaused(IBinder token) throws RemoteException
2402 {
2403 Parcel data = Parcel.obtain();
2404 Parcel reply = Parcel.obtain();
2405 data.writeInterfaceToken(IActivityManager.descriptor);
2406 data.writeStrongBinder(token);
2407 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2408 reply.readException();
2409 data.recycle();
2410 reply.recycle();
2411 }
2412 public void activityStopped(IBinder token, Bundle state,
2413 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002414 {
2415 Parcel data = Parcel.obtain();
2416 Parcel reply = Parcel.obtain();
2417 data.writeInterfaceToken(IActivityManager.descriptor);
2418 data.writeStrongBinder(token);
2419 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002420 if (thumbnail != null) {
2421 data.writeInt(1);
2422 thumbnail.writeToParcel(data, 0);
2423 } else {
2424 data.writeInt(0);
2425 }
2426 TextUtils.writeToParcel(description, data, 0);
2427 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2428 reply.readException();
2429 data.recycle();
2430 reply.recycle();
2431 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002432 public void activitySlept(IBinder token) throws RemoteException
2433 {
2434 Parcel data = Parcel.obtain();
2435 Parcel reply = Parcel.obtain();
2436 data.writeInterfaceToken(IActivityManager.descriptor);
2437 data.writeStrongBinder(token);
2438 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2439 reply.readException();
2440 data.recycle();
2441 reply.recycle();
2442 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002443 public void activityDestroyed(IBinder token) throws RemoteException
2444 {
2445 Parcel data = Parcel.obtain();
2446 Parcel reply = Parcel.obtain();
2447 data.writeInterfaceToken(IActivityManager.descriptor);
2448 data.writeStrongBinder(token);
2449 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2450 reply.readException();
2451 data.recycle();
2452 reply.recycle();
2453 }
2454 public String getCallingPackage(IBinder token) throws RemoteException
2455 {
2456 Parcel data = Parcel.obtain();
2457 Parcel reply = Parcel.obtain();
2458 data.writeInterfaceToken(IActivityManager.descriptor);
2459 data.writeStrongBinder(token);
2460 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2461 reply.readException();
2462 String res = reply.readString();
2463 data.recycle();
2464 reply.recycle();
2465 return res;
2466 }
2467 public ComponentName getCallingActivity(IBinder token)
2468 throws RemoteException {
2469 Parcel data = Parcel.obtain();
2470 Parcel reply = Parcel.obtain();
2471 data.writeInterfaceToken(IActivityManager.descriptor);
2472 data.writeStrongBinder(token);
2473 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2474 reply.readException();
2475 ComponentName res = ComponentName.readFromParcel(reply);
2476 data.recycle();
2477 reply.recycle();
2478 return res;
2479 }
2480 public List getTasks(int maxNum, int flags,
2481 IThumbnailReceiver receiver) throws RemoteException {
2482 Parcel data = Parcel.obtain();
2483 Parcel reply = Parcel.obtain();
2484 data.writeInterfaceToken(IActivityManager.descriptor);
2485 data.writeInt(maxNum);
2486 data.writeInt(flags);
2487 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2488 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2489 reply.readException();
2490 ArrayList list = null;
2491 int N = reply.readInt();
2492 if (N >= 0) {
2493 list = new ArrayList();
2494 while (N > 0) {
2495 ActivityManager.RunningTaskInfo info =
2496 ActivityManager.RunningTaskInfo.CREATOR
2497 .createFromParcel(reply);
2498 list.add(info);
2499 N--;
2500 }
2501 }
2502 data.recycle();
2503 reply.recycle();
2504 return list;
2505 }
2506 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002507 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002508 Parcel data = Parcel.obtain();
2509 Parcel reply = Parcel.obtain();
2510 data.writeInterfaceToken(IActivityManager.descriptor);
2511 data.writeInt(maxNum);
2512 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002513 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002514 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2515 reply.readException();
2516 ArrayList<ActivityManager.RecentTaskInfo> list
2517 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2518 data.recycle();
2519 reply.recycle();
2520 return list;
2521 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002522 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002523 Parcel data = Parcel.obtain();
2524 Parcel reply = Parcel.obtain();
2525 data.writeInterfaceToken(IActivityManager.descriptor);
2526 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002527 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002528 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002529 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002530 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002531 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002532 }
2533 data.recycle();
2534 reply.recycle();
2535 return bm;
2536 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002537 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2538 Parcel data = Parcel.obtain();
2539 Parcel reply = Parcel.obtain();
2540 data.writeInterfaceToken(IActivityManager.descriptor);
2541 data.writeInt(id);
2542 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2543 reply.readException();
2544 Bitmap bm = null;
2545 if (reply.readInt() != 0) {
2546 bm = Bitmap.CREATOR.createFromParcel(reply);
2547 }
2548 data.recycle();
2549 reply.recycle();
2550 return bm;
2551 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002552 public List getServices(int maxNum, int flags) throws RemoteException {
2553 Parcel data = Parcel.obtain();
2554 Parcel reply = Parcel.obtain();
2555 data.writeInterfaceToken(IActivityManager.descriptor);
2556 data.writeInt(maxNum);
2557 data.writeInt(flags);
2558 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2559 reply.readException();
2560 ArrayList list = null;
2561 int N = reply.readInt();
2562 if (N >= 0) {
2563 list = new ArrayList();
2564 while (N > 0) {
2565 ActivityManager.RunningServiceInfo info =
2566 ActivityManager.RunningServiceInfo.CREATOR
2567 .createFromParcel(reply);
2568 list.add(info);
2569 N--;
2570 }
2571 }
2572 data.recycle();
2573 reply.recycle();
2574 return list;
2575 }
2576 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2577 throws RemoteException {
2578 Parcel data = Parcel.obtain();
2579 Parcel reply = Parcel.obtain();
2580 data.writeInterfaceToken(IActivityManager.descriptor);
2581 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2582 reply.readException();
2583 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2584 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2585 data.recycle();
2586 reply.recycle();
2587 return list;
2588 }
2589 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2590 throws RemoteException {
2591 Parcel data = Parcel.obtain();
2592 Parcel reply = Parcel.obtain();
2593 data.writeInterfaceToken(IActivityManager.descriptor);
2594 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2595 reply.readException();
2596 ArrayList<ActivityManager.RunningAppProcessInfo> list
2597 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2598 data.recycle();
2599 reply.recycle();
2600 return list;
2601 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002602 public List<ApplicationInfo> getRunningExternalApplications()
2603 throws RemoteException {
2604 Parcel data = Parcel.obtain();
2605 Parcel reply = Parcel.obtain();
2606 data.writeInterfaceToken(IActivityManager.descriptor);
2607 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2608 reply.readException();
2609 ArrayList<ApplicationInfo> list
2610 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2611 data.recycle();
2612 reply.recycle();
2613 return list;
2614 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002615 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 {
2617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002621 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002622 if (options != null) {
2623 data.writeInt(1);
2624 options.writeToParcel(data, 0);
2625 } else {
2626 data.writeInt(0);
2627 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002628 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2629 reply.readException();
2630 data.recycle();
2631 reply.recycle();
2632 }
2633 public void moveTaskToBack(int task) throws RemoteException
2634 {
2635 Parcel data = Parcel.obtain();
2636 Parcel reply = Parcel.obtain();
2637 data.writeInterfaceToken(IActivityManager.descriptor);
2638 data.writeInt(task);
2639 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2640 reply.readException();
2641 data.recycle();
2642 reply.recycle();
2643 }
2644 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2645 throws RemoteException {
2646 Parcel data = Parcel.obtain();
2647 Parcel reply = Parcel.obtain();
2648 data.writeInterfaceToken(IActivityManager.descriptor);
2649 data.writeStrongBinder(token);
2650 data.writeInt(nonRoot ? 1 : 0);
2651 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2652 reply.readException();
2653 boolean res = reply.readInt() != 0;
2654 data.recycle();
2655 reply.recycle();
2656 return res;
2657 }
2658 public void moveTaskBackwards(int task) throws RemoteException
2659 {
2660 Parcel data = Parcel.obtain();
2661 Parcel reply = Parcel.obtain();
2662 data.writeInterfaceToken(IActivityManager.descriptor);
2663 data.writeInt(task);
2664 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2665 reply.readException();
2666 data.recycle();
2667 reply.recycle();
2668 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002669 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002670 public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002671 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002672 {
2673 Parcel data = Parcel.obtain();
2674 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002675 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002676 data.writeInt(taskId);
Craig Mautner5a449152013-05-24 15:49:29 -07002677 data.writeInt(relativeStackBoxId);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002678 data.writeInt(position);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002679 data.writeFloat(weight);
2680 mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 int res = reply.readInt();
2683 data.recycle();
2684 reply.recycle();
2685 return res;
2686 }
2687 @Override
2688 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2689 {
2690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002692 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002693 data.writeInt(taskId);
2694 data.writeInt(stackId);
2695 data.writeInt(toTop ? 1 : 0);
2696 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2697 reply.readException();
2698 data.recycle();
2699 reply.recycle();
2700 }
2701 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002702 public void resizeStackBox(int stackBoxId, float weight) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002703 {
2704 Parcel data = Parcel.obtain();
2705 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002706 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002707 data.writeInt(stackBoxId);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002708 data.writeFloat(weight);
Craig Mautnercf910b02013-04-23 11:23:27 -07002709 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002710 reply.readException();
2711 data.recycle();
2712 reply.recycle();
2713 }
Craig Mautner967212c2013-04-13 21:10:58 -07002714 @Override
Craig Mautner5ff12102013-05-24 12:50:15 -07002715 public List<StackBoxInfo> getStackBoxes() throws RemoteException
2716 {
2717 Parcel data = Parcel.obtain();
2718 Parcel reply = Parcel.obtain();
2719 data.writeInterfaceToken(IActivityManager.descriptor);
2720 mRemote.transact(GET_STACK_BOXES_TRANSACTION, data, reply, 0);
2721 reply.readException();
2722 ArrayList<StackBoxInfo> list = reply.createTypedArrayList(StackBoxInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002723 data.recycle();
2724 reply.recycle();
2725 return list;
2726 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002727 @Override
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002728 public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException
2729 {
2730 Parcel data = Parcel.obtain();
2731 Parcel reply = Parcel.obtain();
2732 data.writeInterfaceToken(IActivityManager.descriptor);
2733 data.writeInt(stackBoxId);
2734 mRemote.transact(GET_STACK_BOX_INFO_TRANSACTION, data, reply, 0);
2735 reply.readException();
2736 int res = reply.readInt();
2737 StackBoxInfo info = null;
2738 if (res != 0) {
2739 info = StackBoxInfo.CREATOR.createFromParcel(reply);
2740 }
2741 data.recycle();
2742 reply.recycle();
2743 return info;
2744 }
2745 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002746 public void setFocusedStack(int stackId) throws RemoteException
2747 {
2748 Parcel data = Parcel.obtain();
2749 Parcel reply = Parcel.obtain();
2750 data.writeInterfaceToken(IActivityManager.descriptor);
2751 data.writeInt(stackId);
2752 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2753 reply.readException();
2754 data.recycle();
2755 reply.recycle();
2756 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002757 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2758 {
2759 Parcel data = Parcel.obtain();
2760 Parcel reply = Parcel.obtain();
2761 data.writeInterfaceToken(IActivityManager.descriptor);
2762 data.writeStrongBinder(token);
2763 data.writeInt(onlyRoot ? 1 : 0);
2764 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2765 reply.readException();
2766 int res = reply.readInt();
2767 data.recycle();
2768 reply.recycle();
2769 return res;
2770 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 public void reportThumbnail(IBinder token,
2772 Bitmap thumbnail, CharSequence description) throws RemoteException
2773 {
2774 Parcel data = Parcel.obtain();
2775 Parcel reply = Parcel.obtain();
2776 data.writeInterfaceToken(IActivityManager.descriptor);
2777 data.writeStrongBinder(token);
2778 if (thumbnail != null) {
2779 data.writeInt(1);
2780 thumbnail.writeToParcel(data, 0);
2781 } else {
2782 data.writeInt(0);
2783 }
2784 TextUtils.writeToParcel(description, data, 0);
2785 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2786 reply.readException();
2787 data.recycle();
2788 reply.recycle();
2789 }
2790 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002791 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2796 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002797 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002798 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002799 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2800 reply.readException();
2801 int res = reply.readInt();
2802 ContentProviderHolder cph = null;
2803 if (res != 0) {
2804 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2805 }
2806 data.recycle();
2807 reply.recycle();
2808 return cph;
2809 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002810 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2811 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002812 Parcel data = Parcel.obtain();
2813 Parcel reply = Parcel.obtain();
2814 data.writeInterfaceToken(IActivityManager.descriptor);
2815 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002816 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002817 data.writeStrongBinder(token);
2818 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2819 reply.readException();
2820 int res = reply.readInt();
2821 ContentProviderHolder cph = null;
2822 if (res != 0) {
2823 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2824 }
2825 data.recycle();
2826 reply.recycle();
2827 return cph;
2828 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002829 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002830 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002831 {
2832 Parcel data = Parcel.obtain();
2833 Parcel reply = Parcel.obtain();
2834 data.writeInterfaceToken(IActivityManager.descriptor);
2835 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2836 data.writeTypedList(providers);
2837 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2838 reply.readException();
2839 data.recycle();
2840 reply.recycle();
2841 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002842 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2843 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002844 Parcel data = Parcel.obtain();
2845 Parcel reply = Parcel.obtain();
2846 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002847 data.writeStrongBinder(connection);
2848 data.writeInt(stable);
2849 data.writeInt(unstable);
2850 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2851 reply.readException();
2852 boolean res = reply.readInt() != 0;
2853 data.recycle();
2854 reply.recycle();
2855 return res;
2856 }
2857 public void unstableProviderDied(IBinder connection) throws RemoteException {
2858 Parcel data = Parcel.obtain();
2859 Parcel reply = Parcel.obtain();
2860 data.writeInterfaceToken(IActivityManager.descriptor);
2861 data.writeStrongBinder(connection);
2862 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2863 reply.readException();
2864 data.recycle();
2865 reply.recycle();
2866 }
2867
2868 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2869 Parcel data = Parcel.obtain();
2870 Parcel reply = Parcel.obtain();
2871 data.writeInterfaceToken(IActivityManager.descriptor);
2872 data.writeStrongBinder(connection);
2873 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002874 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2875 reply.readException();
2876 data.recycle();
2877 reply.recycle();
2878 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002879
2880 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2881 Parcel data = Parcel.obtain();
2882 Parcel reply = Parcel.obtain();
2883 data.writeInterfaceToken(IActivityManager.descriptor);
2884 data.writeString(name);
2885 data.writeStrongBinder(token);
2886 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 data.recycle();
2889 reply.recycle();
2890 }
2891
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002892 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2893 throws RemoteException
2894 {
2895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 service.writeToParcel(data, 0);
2899 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2900 reply.readException();
2901 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2902 data.recycle();
2903 reply.recycle();
2904 return res;
2905 }
2906
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002907 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002908 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002909 {
2910 Parcel data = Parcel.obtain();
2911 Parcel reply = Parcel.obtain();
2912 data.writeInterfaceToken(IActivityManager.descriptor);
2913 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2914 service.writeToParcel(data, 0);
2915 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002916 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002917 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2918 reply.readException();
2919 ComponentName res = ComponentName.readFromParcel(reply);
2920 data.recycle();
2921 reply.recycle();
2922 return res;
2923 }
2924 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002925 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002926 {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2931 service.writeToParcel(data, 0);
2932 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002933 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002934 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2935 reply.readException();
2936 int res = reply.readInt();
2937 reply.recycle();
2938 data.recycle();
2939 return res;
2940 }
2941 public boolean stopServiceToken(ComponentName className, IBinder token,
2942 int startId) throws RemoteException {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 ComponentName.writeToParcel(className, data);
2947 data.writeStrongBinder(token);
2948 data.writeInt(startId);
2949 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2950 reply.readException();
2951 boolean res = reply.readInt() != 0;
2952 data.recycle();
2953 reply.recycle();
2954 return res;
2955 }
2956 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002957 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002958 Parcel data = Parcel.obtain();
2959 Parcel reply = Parcel.obtain();
2960 data.writeInterfaceToken(IActivityManager.descriptor);
2961 ComponentName.writeToParcel(className, data);
2962 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002963 data.writeInt(id);
2964 if (notification != null) {
2965 data.writeInt(1);
2966 notification.writeToParcel(data, 0);
2967 } else {
2968 data.writeInt(0);
2969 }
2970 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 data.recycle();
2974 reply.recycle();
2975 }
2976 public int bindService(IApplicationThread caller, IBinder token,
2977 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002978 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002979 Parcel data = Parcel.obtain();
2980 Parcel reply = Parcel.obtain();
2981 data.writeInterfaceToken(IActivityManager.descriptor);
2982 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2983 data.writeStrongBinder(token);
2984 service.writeToParcel(data, 0);
2985 data.writeString(resolvedType);
2986 data.writeStrongBinder(connection.asBinder());
2987 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002988 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002989 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 int res = reply.readInt();
2992 data.recycle();
2993 reply.recycle();
2994 return res;
2995 }
2996 public boolean unbindService(IServiceConnection connection) throws RemoteException
2997 {
2998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 data.writeStrongBinder(connection.asBinder());
3002 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3003 reply.readException();
3004 boolean res = reply.readInt() != 0;
3005 data.recycle();
3006 reply.recycle();
3007 return res;
3008 }
3009
3010 public void publishService(IBinder token,
3011 Intent intent, IBinder service) throws RemoteException {
3012 Parcel data = Parcel.obtain();
3013 Parcel reply = Parcel.obtain();
3014 data.writeInterfaceToken(IActivityManager.descriptor);
3015 data.writeStrongBinder(token);
3016 intent.writeToParcel(data, 0);
3017 data.writeStrongBinder(service);
3018 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3019 reply.readException();
3020 data.recycle();
3021 reply.recycle();
3022 }
3023
3024 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3025 throws RemoteException {
3026 Parcel data = Parcel.obtain();
3027 Parcel reply = Parcel.obtain();
3028 data.writeInterfaceToken(IActivityManager.descriptor);
3029 data.writeStrongBinder(token);
3030 intent.writeToParcel(data, 0);
3031 data.writeInt(doRebind ? 1 : 0);
3032 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3033 reply.readException();
3034 data.recycle();
3035 reply.recycle();
3036 }
3037
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003038 public void serviceDoneExecuting(IBinder token, int type, int startId,
3039 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003040 Parcel data = Parcel.obtain();
3041 Parcel reply = Parcel.obtain();
3042 data.writeInterfaceToken(IActivityManager.descriptor);
3043 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003044 data.writeInt(type);
3045 data.writeInt(startId);
3046 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003047 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3048 reply.readException();
3049 data.recycle();
3050 reply.recycle();
3051 }
3052
3053 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3054 Parcel data = Parcel.obtain();
3055 Parcel reply = Parcel.obtain();
3056 data.writeInterfaceToken(IActivityManager.descriptor);
3057 service.writeToParcel(data, 0);
3058 data.writeString(resolvedType);
3059 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3060 reply.readException();
3061 IBinder binder = reply.readStrongBinder();
3062 reply.recycle();
3063 data.recycle();
3064 return binder;
3065 }
3066
Christopher Tate181fafa2009-05-14 11:12:14 -07003067 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3068 throws RemoteException {
3069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 app.writeToParcel(data, 0);
3073 data.writeInt(backupRestoreMode);
3074 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 boolean success = reply.readInt() != 0;
3077 reply.recycle();
3078 data.recycle();
3079 return success;
3080 }
3081
Christopher Tate346acb12012-10-15 19:20:25 -07003082 public void clearPendingBackup() throws RemoteException {
3083 Parcel data = Parcel.obtain();
3084 Parcel reply = Parcel.obtain();
3085 data.writeInterfaceToken(IActivityManager.descriptor);
3086 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3087 reply.recycle();
3088 data.recycle();
3089 }
3090
Christopher Tate181fafa2009-05-14 11:12:14 -07003091 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeString(packageName);
3096 data.writeStrongBinder(agent);
3097 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3098 reply.recycle();
3099 data.recycle();
3100 }
3101
3102 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3103 Parcel data = Parcel.obtain();
3104 Parcel reply = Parcel.obtain();
3105 data.writeInterfaceToken(IActivityManager.descriptor);
3106 app.writeToParcel(data, 0);
3107 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3108 reply.readException();
3109 reply.recycle();
3110 data.recycle();
3111 }
3112
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003113 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003114 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3115 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003116 Parcel data = Parcel.obtain();
3117 Parcel reply = Parcel.obtain();
3118 data.writeInterfaceToken(IActivityManager.descriptor);
3119 ComponentName.writeToParcel(className, data);
3120 data.writeString(profileFile);
3121 data.writeInt(flags);
3122 data.writeBundle(arguments);
3123 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003124 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003125 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003126 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 boolean res = reply.readInt() != 0;
3129 reply.recycle();
3130 data.recycle();
3131 return res;
3132 }
3133
3134 public void finishInstrumentation(IApplicationThread target,
3135 int resultCode, Bundle results) throws RemoteException {
3136 Parcel data = Parcel.obtain();
3137 Parcel reply = Parcel.obtain();
3138 data.writeInterfaceToken(IActivityManager.descriptor);
3139 data.writeStrongBinder(target != null ? target.asBinder() : null);
3140 data.writeInt(resultCode);
3141 data.writeBundle(results);
3142 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3143 reply.readException();
3144 data.recycle();
3145 reply.recycle();
3146 }
3147 public Configuration getConfiguration() throws RemoteException
3148 {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
3151 data.writeInterfaceToken(IActivityManager.descriptor);
3152 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3153 reply.readException();
3154 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3155 reply.recycle();
3156 data.recycle();
3157 return res;
3158 }
3159 public void updateConfiguration(Configuration values) throws RemoteException
3160 {
3161 Parcel data = Parcel.obtain();
3162 Parcel reply = Parcel.obtain();
3163 data.writeInterfaceToken(IActivityManager.descriptor);
3164 values.writeToParcel(data, 0);
3165 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3166 reply.readException();
3167 data.recycle();
3168 reply.recycle();
3169 }
3170 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3171 throws RemoteException {
3172 Parcel data = Parcel.obtain();
3173 Parcel reply = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 data.writeStrongBinder(token);
3176 data.writeInt(requestedOrientation);
3177 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 data.recycle();
3180 reply.recycle();
3181 }
3182 public int getRequestedOrientation(IBinder token) throws RemoteException {
3183 Parcel data = Parcel.obtain();
3184 Parcel reply = Parcel.obtain();
3185 data.writeInterfaceToken(IActivityManager.descriptor);
3186 data.writeStrongBinder(token);
3187 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3188 reply.readException();
3189 int res = reply.readInt();
3190 data.recycle();
3191 reply.recycle();
3192 return res;
3193 }
3194 public ComponentName getActivityClassForToken(IBinder token)
3195 throws RemoteException {
3196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 data.writeStrongBinder(token);
3200 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3201 reply.readException();
3202 ComponentName res = ComponentName.readFromParcel(reply);
3203 data.recycle();
3204 reply.recycle();
3205 return res;
3206 }
3207 public String getPackageForToken(IBinder token) throws RemoteException
3208 {
3209 Parcel data = Parcel.obtain();
3210 Parcel reply = Parcel.obtain();
3211 data.writeInterfaceToken(IActivityManager.descriptor);
3212 data.writeStrongBinder(token);
3213 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3214 reply.readException();
3215 String res = reply.readString();
3216 data.recycle();
3217 reply.recycle();
3218 return res;
3219 }
3220 public IIntentSender getIntentSender(int type,
3221 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003222 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003223 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003224 Parcel data = Parcel.obtain();
3225 Parcel reply = Parcel.obtain();
3226 data.writeInterfaceToken(IActivityManager.descriptor);
3227 data.writeInt(type);
3228 data.writeString(packageName);
3229 data.writeStrongBinder(token);
3230 data.writeString(resultWho);
3231 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003232 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003233 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003234 data.writeTypedArray(intents, 0);
3235 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003236 } else {
3237 data.writeInt(0);
3238 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003239 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003240 if (options != null) {
3241 data.writeInt(1);
3242 options.writeToParcel(data, 0);
3243 } else {
3244 data.writeInt(0);
3245 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003246 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003247 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3248 reply.readException();
3249 IIntentSender res = IIntentSender.Stub.asInterface(
3250 reply.readStrongBinder());
3251 data.recycle();
3252 reply.recycle();
3253 return res;
3254 }
3255 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3256 Parcel data = Parcel.obtain();
3257 Parcel reply = Parcel.obtain();
3258 data.writeInterfaceToken(IActivityManager.descriptor);
3259 data.writeStrongBinder(sender.asBinder());
3260 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3261 reply.readException();
3262 data.recycle();
3263 reply.recycle();
3264 }
3265 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3266 Parcel data = Parcel.obtain();
3267 Parcel reply = Parcel.obtain();
3268 data.writeInterfaceToken(IActivityManager.descriptor);
3269 data.writeStrongBinder(sender.asBinder());
3270 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3271 reply.readException();
3272 String res = reply.readString();
3273 data.recycle();
3274 reply.recycle();
3275 return res;
3276 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003277 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3278 Parcel data = Parcel.obtain();
3279 Parcel reply = Parcel.obtain();
3280 data.writeInterfaceToken(IActivityManager.descriptor);
3281 data.writeStrongBinder(sender.asBinder());
3282 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3283 reply.readException();
3284 int res = reply.readInt();
3285 data.recycle();
3286 reply.recycle();
3287 return res;
3288 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003289 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3290 boolean requireFull, String name, String callerPackage) throws RemoteException {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeInt(callingPid);
3295 data.writeInt(callingUid);
3296 data.writeInt(userId);
3297 data.writeInt(allowAll ? 1 : 0);
3298 data.writeInt(requireFull ? 1 : 0);
3299 data.writeString(name);
3300 data.writeString(callerPackage);
3301 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3302 reply.readException();
3303 int res = reply.readInt();
3304 data.recycle();
3305 reply.recycle();
3306 return res;
3307 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003308 public void setProcessLimit(int max) throws RemoteException
3309 {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeInt(max);
3314 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3315 reply.readException();
3316 data.recycle();
3317 reply.recycle();
3318 }
3319 public int getProcessLimit() throws RemoteException
3320 {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3325 reply.readException();
3326 int res = reply.readInt();
3327 data.recycle();
3328 reply.recycle();
3329 return res;
3330 }
3331 public void setProcessForeground(IBinder token, int pid,
3332 boolean isForeground) throws RemoteException {
3333 Parcel data = Parcel.obtain();
3334 Parcel reply = Parcel.obtain();
3335 data.writeInterfaceToken(IActivityManager.descriptor);
3336 data.writeStrongBinder(token);
3337 data.writeInt(pid);
3338 data.writeInt(isForeground ? 1 : 0);
3339 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 data.recycle();
3342 reply.recycle();
3343 }
3344 public int checkPermission(String permission, int pid, int uid)
3345 throws RemoteException {
3346 Parcel data = Parcel.obtain();
3347 Parcel reply = Parcel.obtain();
3348 data.writeInterfaceToken(IActivityManager.descriptor);
3349 data.writeString(permission);
3350 data.writeInt(pid);
3351 data.writeInt(uid);
3352 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3353 reply.readException();
3354 int res = reply.readInt();
3355 data.recycle();
3356 reply.recycle();
3357 return res;
3358 }
3359 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003360 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003361 Parcel data = Parcel.obtain();
3362 Parcel reply = Parcel.obtain();
3363 data.writeInterfaceToken(IActivityManager.descriptor);
3364 data.writeString(packageName);
3365 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003366 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003367 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3368 reply.readException();
3369 boolean res = reply.readInt() != 0;
3370 data.recycle();
3371 reply.recycle();
3372 return res;
3373 }
3374 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3375 throws RemoteException {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 uri.writeToParcel(data, 0);
3380 data.writeInt(pid);
3381 data.writeInt(uid);
3382 data.writeInt(mode);
3383 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3384 reply.readException();
3385 int res = reply.readInt();
3386 data.recycle();
3387 reply.recycle();
3388 return res;
3389 }
3390 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3391 Uri uri, int mode) throws RemoteException {
3392 Parcel data = Parcel.obtain();
3393 Parcel reply = Parcel.obtain();
3394 data.writeInterfaceToken(IActivityManager.descriptor);
3395 data.writeStrongBinder(caller.asBinder());
3396 data.writeString(targetPkg);
3397 uri.writeToParcel(data, 0);
3398 data.writeInt(mode);
3399 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3400 reply.readException();
3401 data.recycle();
3402 reply.recycle();
3403 }
3404 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3405 int mode) throws RemoteException {
3406 Parcel data = Parcel.obtain();
3407 Parcel reply = Parcel.obtain();
3408 data.writeInterfaceToken(IActivityManager.descriptor);
3409 data.writeStrongBinder(caller.asBinder());
3410 uri.writeToParcel(data, 0);
3411 data.writeInt(mode);
3412 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3413 reply.readException();
3414 data.recycle();
3415 reply.recycle();
3416 }
3417 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3418 throws RemoteException {
3419 Parcel data = Parcel.obtain();
3420 Parcel reply = Parcel.obtain();
3421 data.writeInterfaceToken(IActivityManager.descriptor);
3422 data.writeStrongBinder(who.asBinder());
3423 data.writeInt(waiting ? 1 : 0);
3424 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3425 reply.readException();
3426 data.recycle();
3427 reply.recycle();
3428 }
3429 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3430 Parcel data = Parcel.obtain();
3431 Parcel reply = Parcel.obtain();
3432 data.writeInterfaceToken(IActivityManager.descriptor);
3433 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3434 reply.readException();
3435 outInfo.readFromParcel(reply);
3436 data.recycle();
3437 reply.recycle();
3438 }
3439 public void unhandledBack() throws RemoteException
3440 {
3441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
3444 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3445 reply.readException();
3446 data.recycle();
3447 reply.recycle();
3448 }
3449 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3450 {
3451 Parcel data = Parcel.obtain();
3452 Parcel reply = Parcel.obtain();
3453 data.writeInterfaceToken(IActivityManager.descriptor);
3454 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3455 reply.readException();
3456 ParcelFileDescriptor pfd = null;
3457 if (reply.readInt() != 0) {
3458 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3459 }
3460 data.recycle();
3461 reply.recycle();
3462 return pfd;
3463 }
3464 public void goingToSleep() throws RemoteException
3465 {
3466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
3468 data.writeInterfaceToken(IActivityManager.descriptor);
3469 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3470 reply.readException();
3471 data.recycle();
3472 reply.recycle();
3473 }
3474 public void wakingUp() throws RemoteException
3475 {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3480 reply.readException();
3481 data.recycle();
3482 reply.recycle();
3483 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003484 public void setLockScreenShown(boolean shown) throws RemoteException
3485 {
3486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 data.writeInt(shown ? 1 : 0);
3490 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3491 reply.readException();
3492 data.recycle();
3493 reply.recycle();
3494 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003495 public void setDebugApp(
3496 String packageName, boolean waitForDebugger, boolean persistent)
3497 throws RemoteException
3498 {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 data.writeString(packageName);
3503 data.writeInt(waitForDebugger ? 1 : 0);
3504 data.writeInt(persistent ? 1 : 0);
3505 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3506 reply.readException();
3507 data.recycle();
3508 reply.recycle();
3509 }
3510 public void setAlwaysFinish(boolean enabled) throws RemoteException
3511 {
3512 Parcel data = Parcel.obtain();
3513 Parcel reply = Parcel.obtain();
3514 data.writeInterfaceToken(IActivityManager.descriptor);
3515 data.writeInt(enabled ? 1 : 0);
3516 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3517 reply.readException();
3518 data.recycle();
3519 reply.recycle();
3520 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003521 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003522 {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003527 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003528 reply.readException();
3529 data.recycle();
3530 reply.recycle();
3531 }
3532 public void enterSafeMode() throws RemoteException {
3533 Parcel data = Parcel.obtain();
3534 data.writeInterfaceToken(IActivityManager.descriptor);
3535 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3536 data.recycle();
3537 }
3538 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3539 Parcel data = Parcel.obtain();
3540 data.writeStrongBinder(sender.asBinder());
3541 data.writeInterfaceToken(IActivityManager.descriptor);
3542 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3543 data.recycle();
3544 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003545 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003550 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003551 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003552 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003553 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003554 boolean res = reply.readInt() != 0;
3555 data.recycle();
3556 reply.recycle();
3557 return res;
3558 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003559 @Override
3560 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 data.writeString(reason);
3565 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3566 boolean res = reply.readInt() != 0;
3567 data.recycle();
3568 reply.recycle();
3569 return res;
3570 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003571 public void startRunning(String pkg, String cls, String action,
3572 String indata) throws RemoteException {
3573 Parcel data = Parcel.obtain();
3574 Parcel reply = Parcel.obtain();
3575 data.writeInterfaceToken(IActivityManager.descriptor);
3576 data.writeString(pkg);
3577 data.writeString(cls);
3578 data.writeString(action);
3579 data.writeString(indata);
3580 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3581 reply.readException();
3582 data.recycle();
3583 reply.recycle();
3584 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003585 public boolean testIsSystemReady()
3586 {
3587 /* this base class version is never called */
3588 return true;
3589 }
Dan Egnor60d87622009-12-16 16:32:58 -08003590 public void handleApplicationCrash(IBinder app,
3591 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3592 {
3593 Parcel data = Parcel.obtain();
3594 Parcel reply = Parcel.obtain();
3595 data.writeInterfaceToken(IActivityManager.descriptor);
3596 data.writeStrongBinder(app);
3597 crashInfo.writeToParcel(data, 0);
3598 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3599 reply.readException();
3600 reply.recycle();
3601 data.recycle();
3602 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003603
Dan Egnor60d87622009-12-16 16:32:58 -08003604 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003605 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 {
3607 Parcel data = Parcel.obtain();
3608 Parcel reply = Parcel.obtain();
3609 data.writeInterfaceToken(IActivityManager.descriptor);
3610 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003611 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003612 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003613 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003614 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003615 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003616 reply.recycle();
3617 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003618 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003619 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003620
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003621 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003622 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003623 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003624 {
3625 Parcel data = Parcel.obtain();
3626 Parcel reply = Parcel.obtain();
3627 data.writeInterfaceToken(IActivityManager.descriptor);
3628 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003629 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003630 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003631 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3632 reply.readException();
3633 reply.recycle();
3634 data.recycle();
3635 }
3636
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003637 public void signalPersistentProcesses(int sig) throws RemoteException {
3638 Parcel data = Parcel.obtain();
3639 Parcel reply = Parcel.obtain();
3640 data.writeInterfaceToken(IActivityManager.descriptor);
3641 data.writeInt(sig);
3642 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3643 reply.readException();
3644 data.recycle();
3645 reply.recycle();
3646 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003647
Dianne Hackborn1676c852012-09-10 14:52:30 -07003648 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003649 Parcel data = Parcel.obtain();
3650 Parcel reply = Parcel.obtain();
3651 data.writeInterfaceToken(IActivityManager.descriptor);
3652 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003653 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003654 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3655 reply.readException();
3656 data.recycle();
3657 reply.recycle();
3658 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003659
3660 public void killAllBackgroundProcesses() throws RemoteException {
3661 Parcel data = Parcel.obtain();
3662 Parcel reply = Parcel.obtain();
3663 data.writeInterfaceToken(IActivityManager.descriptor);
3664 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3665 reply.readException();
3666 data.recycle();
3667 reply.recycle();
3668 }
3669
Dianne Hackborn1676c852012-09-10 14:52:30 -07003670 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003671 Parcel data = Parcel.obtain();
3672 Parcel reply = Parcel.obtain();
3673 data.writeInterfaceToken(IActivityManager.descriptor);
3674 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003675 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003676 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003677 reply.readException();
3678 data.recycle();
3679 reply.recycle();
3680 }
3681
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003682 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3683 throws RemoteException
3684 {
3685 Parcel data = Parcel.obtain();
3686 Parcel reply = Parcel.obtain();
3687 data.writeInterfaceToken(IActivityManager.descriptor);
3688 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3689 reply.readException();
3690 outInfo.readFromParcel(reply);
3691 reply.recycle();
3692 data.recycle();
3693 }
3694
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003695 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3696 {
3697 Parcel data = Parcel.obtain();
3698 Parcel reply = Parcel.obtain();
3699 data.writeInterfaceToken(IActivityManager.descriptor);
3700 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3701 reply.readException();
3702 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3703 reply.recycle();
3704 data.recycle();
3705 return res;
3706 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003707
Dianne Hackborn1676c852012-09-10 14:52:30 -07003708 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003709 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003710 {
3711 Parcel data = Parcel.obtain();
3712 Parcel reply = Parcel.obtain();
3713 data.writeInterfaceToken(IActivityManager.descriptor);
3714 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003715 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003716 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003717 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003718 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003719 if (fd != null) {
3720 data.writeInt(1);
3721 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3722 } else {
3723 data.writeInt(0);
3724 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003725 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3726 reply.readException();
3727 boolean res = reply.readInt() != 0;
3728 reply.recycle();
3729 data.recycle();
3730 return res;
3731 }
3732
Dianne Hackborn55280a92009-05-07 15:53:46 -07003733 public boolean shutdown(int timeout) throws RemoteException
3734 {
3735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 data.writeInt(timeout);
3739 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3740 reply.readException();
3741 boolean res = reply.readInt() != 0;
3742 reply.recycle();
3743 data.recycle();
3744 return res;
3745 }
3746
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003747 public void stopAppSwitches() throws RemoteException {
3748 Parcel data = Parcel.obtain();
3749 Parcel reply = Parcel.obtain();
3750 data.writeInterfaceToken(IActivityManager.descriptor);
3751 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3752 reply.readException();
3753 reply.recycle();
3754 data.recycle();
3755 }
3756
3757 public void resumeAppSwitches() throws RemoteException {
3758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
3761 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3762 reply.readException();
3763 reply.recycle();
3764 data.recycle();
3765 }
3766
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003767 public void killApplicationWithAppId(String pkg, int appid, String reason)
3768 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003769 Parcel data = Parcel.obtain();
3770 Parcel reply = Parcel.obtain();
3771 data.writeInterfaceToken(IActivityManager.descriptor);
3772 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003773 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003774 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003775 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003776 reply.readException();
3777 data.recycle();
3778 reply.recycle();
3779 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003780
3781 public void closeSystemDialogs(String reason) throws RemoteException {
3782 Parcel data = Parcel.obtain();
3783 Parcel reply = Parcel.obtain();
3784 data.writeInterfaceToken(IActivityManager.descriptor);
3785 data.writeString(reason);
3786 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3787 reply.readException();
3788 data.recycle();
3789 reply.recycle();
3790 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003791
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003792 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003793 throws RemoteException {
3794 Parcel data = Parcel.obtain();
3795 Parcel reply = Parcel.obtain();
3796 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003797 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003798 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3799 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003800 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003801 data.recycle();
3802 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003803 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003804 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003805
3806 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3807 Parcel data = Parcel.obtain();
3808 Parcel reply = Parcel.obtain();
3809 data.writeInterfaceToken(IActivityManager.descriptor);
3810 data.writeString(processName);
3811 data.writeInt(uid);
3812 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3813 reply.readException();
3814 data.recycle();
3815 reply.recycle();
3816 }
3817
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003818 public void overridePendingTransition(IBinder token, String packageName,
3819 int enterAnim, int exitAnim) throws RemoteException {
3820 Parcel data = Parcel.obtain();
3821 Parcel reply = Parcel.obtain();
3822 data.writeInterfaceToken(IActivityManager.descriptor);
3823 data.writeStrongBinder(token);
3824 data.writeString(packageName);
3825 data.writeInt(enterAnim);
3826 data.writeInt(exitAnim);
3827 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3828 reply.readException();
3829 data.recycle();
3830 reply.recycle();
3831 }
3832
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003833 public boolean isUserAMonkey() throws RemoteException {
3834 Parcel data = Parcel.obtain();
3835 Parcel reply = Parcel.obtain();
3836 data.writeInterfaceToken(IActivityManager.descriptor);
3837 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3838 reply.readException();
3839 boolean res = reply.readInt() != 0;
3840 data.recycle();
3841 reply.recycle();
3842 return res;
3843 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003844
3845 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3846 Parcel data = Parcel.obtain();
3847 Parcel reply = Parcel.obtain();
3848 data.writeInterfaceToken(IActivityManager.descriptor);
3849 data.writeInt(monkey ? 1 : 0);
3850 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3851 reply.readException();
3852 data.recycle();
3853 reply.recycle();
3854 }
3855
Dianne Hackborn860755f2010-06-03 18:47:52 -07003856 public void finishHeavyWeightApp() throws RemoteException {
3857 Parcel data = Parcel.obtain();
3858 Parcel reply = Parcel.obtain();
3859 data.writeInterfaceToken(IActivityManager.descriptor);
3860 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3861 reply.readException();
3862 data.recycle();
3863 reply.recycle();
3864 }
Craig Mautner4addfc52013-06-25 08:05:45 -07003865
Craig Mautner5eda9b32013-07-02 11:58:16 -07003866 public void convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07003867 throws RemoteException {
3868 Parcel data = Parcel.obtain();
3869 Parcel reply = Parcel.obtain();
3870 data.writeInterfaceToken(IActivityManager.descriptor);
3871 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07003872 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
3873 reply.readException();
3874 data.recycle();
3875 reply.recycle();
3876 }
3877
3878 public void convertToTranslucent(IBinder token)
3879 throws RemoteException {
3880 Parcel data = Parcel.obtain();
3881 Parcel reply = Parcel.obtain();
3882 data.writeInterfaceToken(IActivityManager.descriptor);
3883 data.writeStrongBinder(token);
3884 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07003885 reply.readException();
3886 data.recycle();
3887 reply.recycle();
3888 }
3889
Daniel Sandler69a48172010-06-23 16:29:36 -04003890 public void setImmersive(IBinder token, boolean immersive)
3891 throws RemoteException {
3892 Parcel data = Parcel.obtain();
3893 Parcel reply = Parcel.obtain();
3894 data.writeInterfaceToken(IActivityManager.descriptor);
3895 data.writeStrongBinder(token);
3896 data.writeInt(immersive ? 1 : 0);
3897 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3898 reply.readException();
3899 data.recycle();
3900 reply.recycle();
3901 }
3902
3903 public boolean isImmersive(IBinder token)
3904 throws RemoteException {
3905 Parcel data = Parcel.obtain();
3906 Parcel reply = Parcel.obtain();
3907 data.writeInterfaceToken(IActivityManager.descriptor);
3908 data.writeStrongBinder(token);
3909 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003910 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003911 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003912 data.recycle();
3913 reply.recycle();
3914 return res;
3915 }
3916
3917 public boolean isTopActivityImmersive()
3918 throws RemoteException {
3919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003923 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003924 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003925 data.recycle();
3926 reply.recycle();
3927 return res;
3928 }
3929
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003930 public void crashApplication(int uid, int initialPid, String packageName,
3931 String message) throws RemoteException {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 data.writeInt(uid);
3936 data.writeInt(initialPid);
3937 data.writeString(packageName);
3938 data.writeString(message);
3939 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3940 reply.readException();
3941 data.recycle();
3942 reply.recycle();
3943 }
Andy McFadden824c5102010-07-09 16:26:57 -07003944
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003945 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003946 Parcel data = Parcel.obtain();
3947 Parcel reply = Parcel.obtain();
3948 data.writeInterfaceToken(IActivityManager.descriptor);
3949 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003950 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003951 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3952 reply.readException();
3953 String res = reply.readString();
3954 data.recycle();
3955 reply.recycle();
3956 return res;
3957 }
3958
Dianne Hackborn7e269642010-08-25 19:50:20 -07003959 public IBinder newUriPermissionOwner(String name)
3960 throws RemoteException {
3961 Parcel data = Parcel.obtain();
3962 Parcel reply = Parcel.obtain();
3963 data.writeInterfaceToken(IActivityManager.descriptor);
3964 data.writeString(name);
3965 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 IBinder res = reply.readStrongBinder();
3968 data.recycle();
3969 reply.recycle();
3970 return res;
3971 }
3972
3973 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3974 Uri uri, int mode) throws RemoteException {
3975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 data.writeStrongBinder(owner);
3979 data.writeInt(fromUid);
3980 data.writeString(targetPkg);
3981 uri.writeToParcel(data, 0);
3982 data.writeInt(mode);
3983 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3984 reply.readException();
3985 data.recycle();
3986 reply.recycle();
3987 }
3988
3989 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3990 int mode) throws RemoteException {
3991 Parcel data = Parcel.obtain();
3992 Parcel reply = Parcel.obtain();
3993 data.writeInterfaceToken(IActivityManager.descriptor);
3994 data.writeStrongBinder(owner);
3995 if (uri != null) {
3996 data.writeInt(1);
3997 uri.writeToParcel(data, 0);
3998 } else {
3999 data.writeInt(0);
4000 }
4001 data.writeInt(mode);
4002 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4003 reply.readException();
4004 data.recycle();
4005 reply.recycle();
4006 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004007
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004008 public int checkGrantUriPermission(int callingUid, String targetPkg,
4009 Uri uri, int modeFlags) throws RemoteException {
4010 Parcel data = Parcel.obtain();
4011 Parcel reply = Parcel.obtain();
4012 data.writeInterfaceToken(IActivityManager.descriptor);
4013 data.writeInt(callingUid);
4014 data.writeString(targetPkg);
4015 uri.writeToParcel(data, 0);
4016 data.writeInt(modeFlags);
4017 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4018 reply.readException();
4019 int res = reply.readInt();
4020 data.recycle();
4021 reply.recycle();
4022 return res;
4023 }
4024
Dianne Hackborn1676c852012-09-10 14:52:30 -07004025 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004026 String path, ParcelFileDescriptor fd) throws RemoteException {
4027 Parcel data = Parcel.obtain();
4028 Parcel reply = Parcel.obtain();
4029 data.writeInterfaceToken(IActivityManager.descriptor);
4030 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004031 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004032 data.writeInt(managed ? 1 : 0);
4033 data.writeString(path);
4034 if (fd != null) {
4035 data.writeInt(1);
4036 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4037 } else {
4038 data.writeInt(0);
4039 }
4040 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4041 reply.readException();
4042 boolean res = reply.readInt() != 0;
4043 reply.recycle();
4044 data.recycle();
4045 return res;
4046 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004047
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004048 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004049 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004050 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004051 Parcel data = Parcel.obtain();
4052 Parcel reply = Parcel.obtain();
4053 data.writeInterfaceToken(IActivityManager.descriptor);
4054 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004055 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004056 data.writeTypedArray(intents, 0);
4057 data.writeStringArray(resolvedTypes);
4058 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004059 if (options != null) {
4060 data.writeInt(1);
4061 options.writeToParcel(data, 0);
4062 } else {
4063 data.writeInt(0);
4064 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004065 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004066 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4067 reply.readException();
4068 int result = reply.readInt();
4069 reply.recycle();
4070 data.recycle();
4071 return result;
4072 }
4073
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004074 public int getFrontActivityScreenCompatMode() throws RemoteException {
4075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4079 reply.readException();
4080 int mode = reply.readInt();
4081 reply.recycle();
4082 data.recycle();
4083 return mode;
4084 }
4085
4086 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4087 Parcel data = Parcel.obtain();
4088 Parcel reply = Parcel.obtain();
4089 data.writeInterfaceToken(IActivityManager.descriptor);
4090 data.writeInt(mode);
4091 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4092 reply.readException();
4093 reply.recycle();
4094 data.recycle();
4095 }
4096
4097 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4098 Parcel data = Parcel.obtain();
4099 Parcel reply = Parcel.obtain();
4100 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004101 data.writeString(packageName);
4102 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004103 reply.readException();
4104 int mode = reply.readInt();
4105 reply.recycle();
4106 data.recycle();
4107 return mode;
4108 }
4109
4110 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004111 throws RemoteException {
4112 Parcel data = Parcel.obtain();
4113 Parcel reply = Parcel.obtain();
4114 data.writeInterfaceToken(IActivityManager.descriptor);
4115 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004116 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004117 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4118 reply.readException();
4119 reply.recycle();
4120 data.recycle();
4121 }
4122
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004123 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4124 Parcel data = Parcel.obtain();
4125 Parcel reply = Parcel.obtain();
4126 data.writeInterfaceToken(IActivityManager.descriptor);
4127 data.writeString(packageName);
4128 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4129 reply.readException();
4130 boolean ask = reply.readInt() != 0;
4131 reply.recycle();
4132 data.recycle();
4133 return ask;
4134 }
4135
4136 public void setPackageAskScreenCompat(String packageName, boolean ask)
4137 throws RemoteException {
4138 Parcel data = Parcel.obtain();
4139 Parcel reply = Parcel.obtain();
4140 data.writeInterfaceToken(IActivityManager.descriptor);
4141 data.writeString(packageName);
4142 data.writeInt(ask ? 1 : 0);
4143 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 reply.recycle();
4146 data.recycle();
4147 }
4148
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004149 public boolean switchUser(int userid) throws RemoteException {
4150 Parcel data = Parcel.obtain();
4151 Parcel reply = Parcel.obtain();
4152 data.writeInterfaceToken(IActivityManager.descriptor);
4153 data.writeInt(userid);
4154 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4155 reply.readException();
4156 boolean result = reply.readInt() != 0;
4157 reply.recycle();
4158 data.recycle();
4159 return result;
4160 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004161
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004162 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4163 Parcel data = Parcel.obtain();
4164 Parcel reply = Parcel.obtain();
4165 data.writeInterfaceToken(IActivityManager.descriptor);
4166 data.writeInt(userid);
4167 data.writeStrongInterface(callback);
4168 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4169 reply.readException();
4170 int result = reply.readInt();
4171 reply.recycle();
4172 data.recycle();
4173 return result;
4174 }
4175
Amith Yamasani52f1d752012-03-28 18:19:29 -07004176 public UserInfo getCurrentUser() throws RemoteException {
4177 Parcel data = Parcel.obtain();
4178 Parcel reply = Parcel.obtain();
4179 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004180 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004181 reply.readException();
4182 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4183 reply.recycle();
4184 data.recycle();
4185 return userInfo;
4186 }
4187
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004188 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004189 Parcel data = Parcel.obtain();
4190 Parcel reply = Parcel.obtain();
4191 data.writeInterfaceToken(IActivityManager.descriptor);
4192 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004193 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004194 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4195 reply.readException();
4196 boolean result = reply.readInt() != 0;
4197 reply.recycle();
4198 data.recycle();
4199 return result;
4200 }
4201
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004202 public int[] getRunningUserIds() throws RemoteException {
4203 Parcel data = Parcel.obtain();
4204 Parcel reply = Parcel.obtain();
4205 data.writeInterfaceToken(IActivityManager.descriptor);
4206 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4207 reply.readException();
4208 int[] result = reply.createIntArray();
4209 reply.recycle();
4210 data.recycle();
4211 return result;
4212 }
4213
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004214 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4215 Parcel data = Parcel.obtain();
4216 Parcel reply = Parcel.obtain();
4217 data.writeInterfaceToken(IActivityManager.descriptor);
4218 data.writeInt(taskId);
4219 data.writeInt(subTaskIndex);
4220 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4221 reply.readException();
4222 boolean result = reply.readInt() != 0;
4223 reply.recycle();
4224 data.recycle();
4225 return result;
4226 }
4227
4228 public boolean removeTask(int taskId, int flags) throws RemoteException {
4229 Parcel data = Parcel.obtain();
4230 Parcel reply = Parcel.obtain();
4231 data.writeInterfaceToken(IActivityManager.descriptor);
4232 data.writeInt(taskId);
4233 data.writeInt(flags);
4234 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4235 reply.readException();
4236 boolean result = reply.readInt() != 0;
4237 reply.recycle();
4238 data.recycle();
4239 return result;
4240 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004241
Jeff Sharkeya4620792011-05-20 15:29:23 -07004242 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4243 Parcel data = Parcel.obtain();
4244 Parcel reply = Parcel.obtain();
4245 data.writeInterfaceToken(IActivityManager.descriptor);
4246 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4247 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4248 reply.readException();
4249 data.recycle();
4250 reply.recycle();
4251 }
4252
4253 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4254 Parcel data = Parcel.obtain();
4255 Parcel reply = Parcel.obtain();
4256 data.writeInterfaceToken(IActivityManager.descriptor);
4257 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4258 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4259 reply.readException();
4260 data.recycle();
4261 reply.recycle();
4262 }
4263
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004264 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4265 Parcel data = Parcel.obtain();
4266 Parcel reply = Parcel.obtain();
4267 data.writeInterfaceToken(IActivityManager.descriptor);
4268 data.writeStrongBinder(sender.asBinder());
4269 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4270 reply.readException();
4271 boolean res = reply.readInt() != 0;
4272 data.recycle();
4273 reply.recycle();
4274 return res;
4275 }
4276
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004277 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4278 Parcel data = Parcel.obtain();
4279 Parcel reply = Parcel.obtain();
4280 data.writeInterfaceToken(IActivityManager.descriptor);
4281 data.writeStrongBinder(sender.asBinder());
4282 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 boolean res = reply.readInt() != 0;
4285 data.recycle();
4286 reply.recycle();
4287 return res;
4288 }
4289
Dianne Hackborn81038902012-11-26 17:04:09 -08004290 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4291 Parcel data = Parcel.obtain();
4292 Parcel reply = Parcel.obtain();
4293 data.writeInterfaceToken(IActivityManager.descriptor);
4294 data.writeStrongBinder(sender.asBinder());
4295 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4296 reply.readException();
4297 Intent res = reply.readInt() != 0
4298 ? Intent.CREATOR.createFromParcel(reply) : null;
4299 data.recycle();
4300 reply.recycle();
4301 return res;
4302 }
4303
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004304 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4305 {
4306 Parcel data = Parcel.obtain();
4307 Parcel reply = Parcel.obtain();
4308 data.writeInterfaceToken(IActivityManager.descriptor);
4309 values.writeToParcel(data, 0);
4310 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4311 reply.readException();
4312 data.recycle();
4313 reply.recycle();
4314 }
4315
Dianne Hackbornb437e092011-08-05 17:50:29 -07004316 public long[] getProcessPss(int[] pids) throws RemoteException {
4317 Parcel data = Parcel.obtain();
4318 Parcel reply = Parcel.obtain();
4319 data.writeInterfaceToken(IActivityManager.descriptor);
4320 data.writeIntArray(pids);
4321 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4322 reply.readException();
4323 long[] res = reply.createLongArray();
4324 data.recycle();
4325 reply.recycle();
4326 return res;
4327 }
4328
Dianne Hackborn661cd522011-08-22 00:26:20 -07004329 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4330 Parcel data = Parcel.obtain();
4331 Parcel reply = Parcel.obtain();
4332 data.writeInterfaceToken(IActivityManager.descriptor);
4333 TextUtils.writeToParcel(msg, data, 0);
4334 data.writeInt(always ? 1 : 0);
4335 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4336 reply.readException();
4337 data.recycle();
4338 reply.recycle();
4339 }
4340
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004341 public void dismissKeyguardOnNextActivity() throws RemoteException {
4342 Parcel data = Parcel.obtain();
4343 Parcel reply = Parcel.obtain();
4344 data.writeInterfaceToken(IActivityManager.descriptor);
4345 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4346 reply.readException();
4347 data.recycle();
4348 reply.recycle();
4349 }
4350
Adam Powelldd8fab22012-03-22 17:47:27 -07004351 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4352 throws RemoteException {
4353 Parcel data = Parcel.obtain();
4354 Parcel reply = Parcel.obtain();
4355 data.writeInterfaceToken(IActivityManager.descriptor);
4356 data.writeStrongBinder(token);
4357 data.writeString(destAffinity);
4358 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4359 reply.readException();
4360 boolean result = reply.readInt() != 0;
4361 data.recycle();
4362 reply.recycle();
4363 return result;
4364 }
4365
4366 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4367 throws RemoteException {
4368 Parcel data = Parcel.obtain();
4369 Parcel reply = Parcel.obtain();
4370 data.writeInterfaceToken(IActivityManager.descriptor);
4371 data.writeStrongBinder(token);
4372 target.writeToParcel(data, 0);
4373 data.writeInt(resultCode);
4374 if (resultData != null) {
4375 data.writeInt(1);
4376 resultData.writeToParcel(data, 0);
4377 } else {
4378 data.writeInt(0);
4379 }
4380 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4381 reply.readException();
4382 boolean result = reply.readInt() != 0;
4383 data.recycle();
4384 reply.recycle();
4385 return result;
4386 }
4387
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004388 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4389 Parcel data = Parcel.obtain();
4390 Parcel reply = Parcel.obtain();
4391 data.writeInterfaceToken(IActivityManager.descriptor);
4392 data.writeStrongBinder(activityToken);
4393 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4394 reply.readException();
4395 int result = reply.readInt();
4396 data.recycle();
4397 reply.recycle();
4398 return result;
4399 }
4400
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004401 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 data.writeStrongBinder(activityToken);
4406 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4407 reply.readException();
4408 String result = reply.readString();
4409 data.recycle();
4410 reply.recycle();
4411 return result;
4412 }
4413
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004414 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4415 Parcel data = Parcel.obtain();
4416 Parcel reply = Parcel.obtain();
4417 data.writeInterfaceToken(IActivityManager.descriptor);
4418 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4419 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4420 reply.readException();
4421 data.recycle();
4422 reply.recycle();
4423 }
4424
4425 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4430 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4431 reply.readException();
4432 data.recycle();
4433 reply.recycle();
4434 }
4435
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004436 public void requestBugReport() throws RemoteException {
4437 Parcel data = Parcel.obtain();
4438 Parcel reply = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4441 reply.readException();
4442 data.recycle();
4443 reply.recycle();
4444 }
4445
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004446 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4447 Parcel data = Parcel.obtain();
4448 Parcel reply = Parcel.obtain();
4449 data.writeInterfaceToken(IActivityManager.descriptor);
4450 data.writeInt(pid);
4451 data.writeInt(aboveSystem ? 1 : 0);
4452 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4453 reply.readException();
4454 long res = reply.readInt();
4455 data.recycle();
4456 reply.recycle();
4457 return res;
4458 }
4459
Adam Skorydfc7fd72013-08-05 19:23:41 -07004460 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004461 Parcel data = Parcel.obtain();
4462 Parcel reply = Parcel.obtain();
4463 data.writeInterfaceToken(IActivityManager.descriptor);
4464 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004465 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004466 reply.readException();
4467 Bundle res = reply.readBundle();
4468 data.recycle();
4469 reply.recycle();
4470 return res;
4471 }
4472
Adam Skorydfc7fd72013-08-05 19:23:41 -07004473 public void reportAssistContextExtras(IBinder token, Bundle extras, int index)
4474 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004475 Parcel data = Parcel.obtain();
4476 Parcel reply = Parcel.obtain();
4477 data.writeInterfaceToken(IActivityManager.descriptor);
4478 data.writeStrongBinder(token);
4479 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004480 data.writeInt(index);
4481 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004482 reply.readException();
4483 data.recycle();
4484 reply.recycle();
4485 }
4486
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004487 public void killUid(int uid, String reason) throws RemoteException {
4488 Parcel data = Parcel.obtain();
4489 Parcel reply = Parcel.obtain();
4490 data.writeInterfaceToken(IActivityManager.descriptor);
4491 data.writeInt(uid);
4492 data.writeString(reason);
4493 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4494 reply.readException();
4495 data.recycle();
4496 reply.recycle();
4497 }
4498
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004499 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4500 Parcel data = Parcel.obtain();
4501 Parcel reply = Parcel.obtain();
4502 data.writeInterfaceToken(IActivityManager.descriptor);
4503 data.writeStrongBinder(who);
4504 data.writeInt(allowRestart ? 1 : 0);
4505 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4506 reply.readException();
4507 data.recycle();
4508 reply.recycle();
4509 }
4510
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004511 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4512 Parcel data = Parcel.obtain();
4513 Parcel reply = Parcel.obtain();
4514 data.writeInterfaceToken(IActivityManager.descriptor);
4515 data.writeStrongBinder(token);
4516 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4517 reply.readException();
4518 data.recycle();
4519 reply.recycle();
4520 }
4521
Craig Mautner5eda9b32013-07-02 11:58:16 -07004522 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4523 Parcel data = Parcel.obtain();
4524 Parcel reply = Parcel.obtain();
4525 data.writeInterfaceToken(IActivityManager.descriptor);
4526 data.writeStrongBinder(token);
4527 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4528 reply.readException();
4529 data.recycle();
4530 reply.recycle();
4531 }
4532
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004533 public void restart() throws RemoteException {
4534 Parcel data = Parcel.obtain();
4535 Parcel reply = Parcel.obtain();
4536 data.writeInterfaceToken(IActivityManager.descriptor);
4537 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4538 reply.readException();
4539 data.recycle();
4540 reply.recycle();
4541 }
4542
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004543 private IBinder mRemote;
4544}