blob: b966d6d3a3be40603fdc41e0086a2565b4cefe51 [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 Mautner4addfc52013-06-25 08:05:45 -07001502 case CONVERT_TO_OPAQUE_TRANSACTION: {
1503 data.enforceInterface(IActivityManager.descriptor);
1504 IBinder token = data.readStrongBinder();
1505 convertToOpaque(token);
1506 reply.writeNoException();
1507 return true;
1508 }
1509
Daniel Sandler69a48172010-06-23 16:29:36 -04001510 case SET_IMMERSIVE_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 IBinder token = data.readStrongBinder();
1513 boolean imm = data.readInt() == 1;
1514 setImmersive(token, imm);
1515 reply.writeNoException();
1516 return true;
1517 }
1518
1519 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1520 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001521 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001522 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001523 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001524 return true;
1525 }
1526
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001527 case CRASH_APPLICATION_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
1529 int uid = data.readInt();
1530 int initialPid = data.readInt();
1531 String packageName = data.readString();
1532 String message = data.readString();
1533 crashApplication(uid, initialPid, packageName, message);
1534 reply.writeNoException();
1535 return true;
1536 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001537
1538 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1539 data.enforceInterface(IActivityManager.descriptor);
1540 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001541 int userId = data.readInt();
1542 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001543 reply.writeNoException();
1544 reply.writeString(type);
1545 return true;
1546 }
1547
Dianne Hackborn7e269642010-08-25 19:50:20 -07001548 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 String name = data.readString();
1551 IBinder perm = newUriPermissionOwner(name);
1552 reply.writeNoException();
1553 reply.writeStrongBinder(perm);
1554 return true;
1555 }
1556
1557 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1558 data.enforceInterface(IActivityManager.descriptor);
1559 IBinder owner = data.readStrongBinder();
1560 int fromUid = data.readInt();
1561 String targetPkg = data.readString();
1562 Uri uri = Uri.CREATOR.createFromParcel(data);
1563 int mode = data.readInt();
1564 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1565 reply.writeNoException();
1566 return true;
1567 }
1568
1569 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1570 data.enforceInterface(IActivityManager.descriptor);
1571 IBinder owner = data.readStrongBinder();
1572 Uri uri = null;
1573 if (data.readInt() != 0) {
1574 Uri.CREATOR.createFromParcel(data);
1575 }
1576 int mode = data.readInt();
1577 revokeUriPermissionFromOwner(owner, uri, mode);
1578 reply.writeNoException();
1579 return true;
1580 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001581
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001582 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 int callingUid = data.readInt();
1585 String targetPkg = data.readString();
1586 Uri uri = Uri.CREATOR.createFromParcel(data);
1587 int modeFlags = data.readInt();
1588 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1589 reply.writeNoException();
1590 reply.writeInt(res);
1591 return true;
1592 }
1593
Andy McFadden824c5102010-07-09 16:26:57 -07001594 case DUMP_HEAP_TRANSACTION: {
1595 data.enforceInterface(IActivityManager.descriptor);
1596 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001597 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001598 boolean managed = data.readInt() != 0;
1599 String path = data.readString();
1600 ParcelFileDescriptor fd = data.readInt() != 0
1601 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001602 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001603 reply.writeNoException();
1604 reply.writeInt(res ? 1 : 0);
1605 return true;
1606 }
1607
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001608 case START_ACTIVITIES_TRANSACTION:
1609 {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 IBinder b = data.readStrongBinder();
1612 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001613 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001614 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1615 String[] resolvedTypes = data.createStringArray();
1616 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001617 Bundle options = data.readInt() != 0
1618 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001619 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001620 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001621 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001622 reply.writeNoException();
1623 reply.writeInt(result);
1624 return true;
1625 }
1626
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001627 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1628 {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 int mode = getFrontActivityScreenCompatMode();
1631 reply.writeNoException();
1632 reply.writeInt(mode);
1633 return true;
1634 }
1635
1636 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1637 {
1638 data.enforceInterface(IActivityManager.descriptor);
1639 int mode = data.readInt();
1640 setFrontActivityScreenCompatMode(mode);
1641 reply.writeNoException();
1642 reply.writeInt(mode);
1643 return true;
1644 }
1645
1646 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1647 {
1648 data.enforceInterface(IActivityManager.descriptor);
1649 String pkg = data.readString();
1650 int mode = getPackageScreenCompatMode(pkg);
1651 reply.writeNoException();
1652 reply.writeInt(mode);
1653 return true;
1654 }
1655
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001656 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1657 {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001660 int mode = data.readInt();
1661 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001662 reply.writeNoException();
1663 return true;
1664 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001665
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001666 case SWITCH_USER_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 int userid = data.readInt();
1669 boolean result = switchUser(userid);
1670 reply.writeNoException();
1671 reply.writeInt(result ? 1 : 0);
1672 return true;
1673 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001674
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001675 case STOP_USER_TRANSACTION: {
1676 data.enforceInterface(IActivityManager.descriptor);
1677 int userid = data.readInt();
1678 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1679 data.readStrongBinder());
1680 int result = stopUser(userid, callback);
1681 reply.writeNoException();
1682 reply.writeInt(result);
1683 return true;
1684 }
1685
Amith Yamasani52f1d752012-03-28 18:19:29 -07001686 case GET_CURRENT_USER_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 UserInfo userInfo = getCurrentUser();
1689 reply.writeNoException();
1690 userInfo.writeToParcel(reply, 0);
1691 return true;
1692 }
1693
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001694 case IS_USER_RUNNING_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001697 boolean orStopping = data.readInt() != 0;
1698 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001699 reply.writeNoException();
1700 reply.writeInt(result ? 1 : 0);
1701 return true;
1702 }
1703
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001704 case GET_RUNNING_USER_IDS_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 int[] result = getRunningUserIds();
1707 reply.writeNoException();
1708 reply.writeIntArray(result);
1709 return true;
1710 }
1711
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001712 case REMOVE_SUB_TASK_TRANSACTION:
1713 {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 int taskId = data.readInt();
1716 int subTaskIndex = data.readInt();
1717 boolean result = removeSubTask(taskId, subTaskIndex);
1718 reply.writeNoException();
1719 reply.writeInt(result ? 1 : 0);
1720 return true;
1721 }
1722
1723 case REMOVE_TASK_TRANSACTION:
1724 {
1725 data.enforceInterface(IActivityManager.descriptor);
1726 int taskId = data.readInt();
1727 int fl = data.readInt();
1728 boolean result = removeTask(taskId, fl);
1729 reply.writeNoException();
1730 reply.writeInt(result ? 1 : 0);
1731 return true;
1732 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001733
Jeff Sharkeya4620792011-05-20 15:29:23 -07001734 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1737 data.readStrongBinder());
1738 registerProcessObserver(observer);
1739 return true;
1740 }
1741
1742 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1745 data.readStrongBinder());
1746 unregisterProcessObserver(observer);
1747 return true;
1748 }
1749
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001750 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1751 {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 String pkg = data.readString();
1754 boolean ask = getPackageAskScreenCompat(pkg);
1755 reply.writeNoException();
1756 reply.writeInt(ask ? 1 : 0);
1757 return true;
1758 }
1759
1760 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1761 {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 String pkg = data.readString();
1764 boolean ask = data.readInt() != 0;
1765 setPackageAskScreenCompat(pkg, ask);
1766 reply.writeNoException();
1767 return true;
1768 }
1769
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001770 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 IIntentSender r = IIntentSender.Stub.asInterface(
1773 data.readStrongBinder());
1774 boolean res = isIntentSenderTargetedToPackage(r);
1775 reply.writeNoException();
1776 reply.writeInt(res ? 1 : 0);
1777 return true;
1778 }
1779
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001780 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 IIntentSender r = IIntentSender.Stub.asInterface(
1783 data.readStrongBinder());
1784 boolean res = isIntentSenderAnActivity(r);
1785 reply.writeNoException();
1786 reply.writeInt(res ? 1 : 0);
1787 return true;
1788 }
1789
Dianne Hackborn81038902012-11-26 17:04:09 -08001790 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 IIntentSender r = IIntentSender.Stub.asInterface(
1793 data.readStrongBinder());
1794 Intent intent = getIntentForIntentSender(r);
1795 reply.writeNoException();
1796 if (intent != null) {
1797 reply.writeInt(1);
1798 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1799 } else {
1800 reply.writeInt(0);
1801 }
1802 return true;
1803 }
1804
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001805 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1806 data.enforceInterface(IActivityManager.descriptor);
1807 Configuration config = Configuration.CREATOR.createFromParcel(data);
1808 updatePersistentConfiguration(config);
1809 reply.writeNoException();
1810 return true;
1811 }
1812
Dianne Hackbornb437e092011-08-05 17:50:29 -07001813 case GET_PROCESS_PSS_TRANSACTION: {
1814 data.enforceInterface(IActivityManager.descriptor);
1815 int[] pids = data.createIntArray();
1816 long[] pss = getProcessPss(pids);
1817 reply.writeNoException();
1818 reply.writeLongArray(pss);
1819 return true;
1820 }
1821
Dianne Hackborn661cd522011-08-22 00:26:20 -07001822 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1823 data.enforceInterface(IActivityManager.descriptor);
1824 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1825 boolean always = data.readInt() != 0;
1826 showBootMessage(msg, always);
1827 reply.writeNoException();
1828 return true;
1829 }
1830
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001831 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1832 data.enforceInterface(IActivityManager.descriptor);
1833 dismissKeyguardOnNextActivity();
1834 reply.writeNoException();
1835 return true;
1836 }
1837
Adam Powelldd8fab22012-03-22 17:47:27 -07001838 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1839 data.enforceInterface(IActivityManager.descriptor);
1840 IBinder token = data.readStrongBinder();
1841 String destAffinity = data.readString();
1842 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1843 reply.writeNoException();
1844 reply.writeInt(res ? 1 : 0);
1845 return true;
1846 }
1847
1848 case NAVIGATE_UP_TO_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 IBinder token = data.readStrongBinder();
1851 Intent target = Intent.CREATOR.createFromParcel(data);
1852 int resultCode = data.readInt();
1853 Intent resultData = null;
1854 if (data.readInt() != 0) {
1855 resultData = Intent.CREATOR.createFromParcel(data);
1856 }
1857 boolean res = navigateUpTo(token, target, resultCode, resultData);
1858 reply.writeNoException();
1859 reply.writeInt(res ? 1 : 0);
1860 return true;
1861 }
1862
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001863 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1864 data.enforceInterface(IActivityManager.descriptor);
1865 IBinder token = data.readStrongBinder();
1866 int res = getLaunchedFromUid(token);
1867 reply.writeNoException();
1868 reply.writeInt(res);
1869 return true;
1870 }
1871
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001872 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1873 data.enforceInterface(IActivityManager.descriptor);
1874 IBinder token = data.readStrongBinder();
1875 String res = getLaunchedFromPackage(token);
1876 reply.writeNoException();
1877 reply.writeString(res);
1878 return true;
1879 }
1880
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001881 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1882 data.enforceInterface(IActivityManager.descriptor);
1883 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1884 data.readStrongBinder());
1885 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001886 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001887 return true;
1888 }
1889
1890 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1893 data.readStrongBinder());
1894 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001895 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001896 return true;
1897 }
1898
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001899 case REQUEST_BUG_REPORT_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001902 reply.writeNoException();
1903 return true;
1904 }
1905
1906 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1907 data.enforceInterface(IActivityManager.descriptor);
1908 int pid = data.readInt();
1909 boolean aboveSystem = data.readInt() != 0;
1910 long res = inputDispatchingTimedOut(pid, aboveSystem);
1911 reply.writeNoException();
1912 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001913 return true;
1914 }
1915
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001916 case GET_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 int requestType = data.readInt();
1919 Bundle res = getTopActivityExtras(requestType);
1920 reply.writeNoException();
1921 reply.writeBundle(res);
1922 return true;
1923 }
1924
1925 case REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1926 data.enforceInterface(IActivityManager.descriptor);
1927 IBinder token = data.readStrongBinder();
1928 Bundle extras = data.readBundle();
1929 reportTopActivityExtras(token, extras);
1930 reply.writeNoException();
1931 return true;
1932 }
1933
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001934 case KILL_UID_TRANSACTION: {
1935 data.enforceInterface(IActivityManager.descriptor);
1936 int uid = data.readInt();
1937 String reason = data.readString();
1938 killUid(uid, reason);
1939 reply.writeNoException();
1940 return true;
1941 }
1942
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07001943 case HANG_TRANSACTION: {
1944 data.enforceInterface(IActivityManager.descriptor);
1945 IBinder who = data.readStrongBinder();
1946 boolean allowRestart = data.readInt() != 0;
1947 hang(who, allowRestart);
1948 reply.writeNoException();
1949 return true;
1950 }
1951
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001952 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001953
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001954 return super.onTransact(code, data, reply, flags);
1955 }
1956
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001957 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001958 return this;
1959 }
1960
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001961 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1962 protected IActivityManager create() {
1963 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001964 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001965 Log.v("ActivityManager", "default service binder = " + b);
1966 }
1967 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001968 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001969 Log.v("ActivityManager", "default service = " + am);
1970 }
1971 return am;
1972 }
1973 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001974}
1975
1976class ActivityManagerProxy implements IActivityManager
1977{
1978 public ActivityManagerProxy(IBinder remote)
1979 {
1980 mRemote = remote;
1981 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001982
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001983 public IBinder asBinder()
1984 {
1985 return mRemote;
1986 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001987
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001988 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001989 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1990 int startFlags, String profileFile,
1991 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001992 Parcel data = Parcel.obtain();
1993 Parcel reply = Parcel.obtain();
1994 data.writeInterfaceToken(IActivityManager.descriptor);
1995 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001996 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001997 intent.writeToParcel(data, 0);
1998 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001999 data.writeStrongBinder(resultTo);
2000 data.writeString(resultWho);
2001 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002002 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002003 data.writeString(profileFile);
2004 if (profileFd != null) {
2005 data.writeInt(1);
2006 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2007 } else {
2008 data.writeInt(0);
2009 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002010 if (options != null) {
2011 data.writeInt(1);
2012 options.writeToParcel(data, 0);
2013 } else {
2014 data.writeInt(0);
2015 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002016 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2017 reply.readException();
2018 int result = reply.readInt();
2019 reply.recycle();
2020 data.recycle();
2021 return result;
2022 }
Amith Yamasani82644082012-08-03 13:09:11 -07002023
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002024 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002025 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2026 int startFlags, String profileFile,
2027 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2028 Parcel data = Parcel.obtain();
2029 Parcel reply = Parcel.obtain();
2030 data.writeInterfaceToken(IActivityManager.descriptor);
2031 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002032 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002033 intent.writeToParcel(data, 0);
2034 data.writeString(resolvedType);
2035 data.writeStrongBinder(resultTo);
2036 data.writeString(resultWho);
2037 data.writeInt(requestCode);
2038 data.writeInt(startFlags);
2039 data.writeString(profileFile);
2040 if (profileFd != null) {
2041 data.writeInt(1);
2042 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2043 } else {
2044 data.writeInt(0);
2045 }
2046 if (options != null) {
2047 data.writeInt(1);
2048 options.writeToParcel(data, 0);
2049 } else {
2050 data.writeInt(0);
2051 }
2052 data.writeInt(userId);
2053 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2054 reply.readException();
2055 int result = reply.readInt();
2056 reply.recycle();
2057 data.recycle();
2058 return result;
2059 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002060 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2061 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002062 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002063 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002064 Parcel data = Parcel.obtain();
2065 Parcel reply = Parcel.obtain();
2066 data.writeInterfaceToken(IActivityManager.descriptor);
2067 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002068 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002069 intent.writeToParcel(data, 0);
2070 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002071 data.writeStrongBinder(resultTo);
2072 data.writeString(resultWho);
2073 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002074 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002075 data.writeString(profileFile);
2076 if (profileFd != null) {
2077 data.writeInt(1);
2078 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2079 } else {
2080 data.writeInt(0);
2081 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002082 if (options != null) {
2083 data.writeInt(1);
2084 options.writeToParcel(data, 0);
2085 } else {
2086 data.writeInt(0);
2087 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002088 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002089 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2090 reply.readException();
2091 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2092 reply.recycle();
2093 data.recycle();
2094 return result;
2095 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002096 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2097 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002098 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002099 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002100 Parcel data = Parcel.obtain();
2101 Parcel reply = Parcel.obtain();
2102 data.writeInterfaceToken(IActivityManager.descriptor);
2103 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002104 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002105 intent.writeToParcel(data, 0);
2106 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002107 data.writeStrongBinder(resultTo);
2108 data.writeString(resultWho);
2109 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002110 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002111 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002112 if (options != null) {
2113 data.writeInt(1);
2114 options.writeToParcel(data, 0);
2115 } else {
2116 data.writeInt(0);
2117 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002118 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002119 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2120 reply.readException();
2121 int result = reply.readInt();
2122 reply.recycle();
2123 data.recycle();
2124 return result;
2125 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002126 public int startActivityIntentSender(IApplicationThread caller,
2127 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002128 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002129 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002130 Parcel data = Parcel.obtain();
2131 Parcel reply = Parcel.obtain();
2132 data.writeInterfaceToken(IActivityManager.descriptor);
2133 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2134 intent.writeToParcel(data, 0);
2135 if (fillInIntent != null) {
2136 data.writeInt(1);
2137 fillInIntent.writeToParcel(data, 0);
2138 } else {
2139 data.writeInt(0);
2140 }
2141 data.writeString(resolvedType);
2142 data.writeStrongBinder(resultTo);
2143 data.writeString(resultWho);
2144 data.writeInt(requestCode);
2145 data.writeInt(flagsMask);
2146 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002147 if (options != null) {
2148 data.writeInt(1);
2149 options.writeToParcel(data, 0);
2150 } else {
2151 data.writeInt(0);
2152 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002153 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002154 reply.readException();
2155 int result = reply.readInt();
2156 reply.recycle();
2157 data.recycle();
2158 return result;
2159 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002160 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002161 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002162 Parcel data = Parcel.obtain();
2163 Parcel reply = Parcel.obtain();
2164 data.writeInterfaceToken(IActivityManager.descriptor);
2165 data.writeStrongBinder(callingActivity);
2166 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002167 if (options != null) {
2168 data.writeInt(1);
2169 options.writeToParcel(data, 0);
2170 } else {
2171 data.writeInt(0);
2172 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002173 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2174 reply.readException();
2175 int result = reply.readInt();
2176 reply.recycle();
2177 data.recycle();
2178 return result != 0;
2179 }
2180 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2181 throws RemoteException {
2182 Parcel data = Parcel.obtain();
2183 Parcel reply = Parcel.obtain();
2184 data.writeInterfaceToken(IActivityManager.descriptor);
2185 data.writeStrongBinder(token);
2186 data.writeInt(resultCode);
2187 if (resultData != null) {
2188 data.writeInt(1);
2189 resultData.writeToParcel(data, 0);
2190 } else {
2191 data.writeInt(0);
2192 }
2193 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2194 reply.readException();
2195 boolean res = reply.readInt() != 0;
2196 data.recycle();
2197 reply.recycle();
2198 return res;
2199 }
2200 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2201 {
2202 Parcel data = Parcel.obtain();
2203 Parcel reply = Parcel.obtain();
2204 data.writeInterfaceToken(IActivityManager.descriptor);
2205 data.writeStrongBinder(token);
2206 data.writeString(resultWho);
2207 data.writeInt(requestCode);
2208 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2209 reply.readException();
2210 data.recycle();
2211 reply.recycle();
2212 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002213 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2214 Parcel data = Parcel.obtain();
2215 Parcel reply = Parcel.obtain();
2216 data.writeInterfaceToken(IActivityManager.descriptor);
2217 data.writeStrongBinder(token);
2218 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2219 reply.readException();
2220 boolean res = reply.readInt() != 0;
2221 data.recycle();
2222 reply.recycle();
2223 return res;
2224 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002225 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2226 Parcel data = Parcel.obtain();
2227 Parcel reply = Parcel.obtain();
2228 data.writeInterfaceToken(IActivityManager.descriptor);
2229 data.writeStrongBinder(token);
2230 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2231 reply.readException();
2232 boolean res = reply.readInt() != 0;
2233 data.recycle();
2234 reply.recycle();
2235 return res;
2236 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002237 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002238 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002239 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002240 {
2241 Parcel data = Parcel.obtain();
2242 Parcel reply = Parcel.obtain();
2243 data.writeInterfaceToken(IActivityManager.descriptor);
2244 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002245 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002246 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2247 filter.writeToParcel(data, 0);
2248 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002249 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002250 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2251 reply.readException();
2252 Intent intent = null;
2253 int haveIntent = reply.readInt();
2254 if (haveIntent != 0) {
2255 intent = Intent.CREATOR.createFromParcel(reply);
2256 }
2257 reply.recycle();
2258 data.recycle();
2259 return intent;
2260 }
2261 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2262 {
2263 Parcel data = Parcel.obtain();
2264 Parcel reply = Parcel.obtain();
2265 data.writeInterfaceToken(IActivityManager.descriptor);
2266 data.writeStrongBinder(receiver.asBinder());
2267 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2268 reply.readException();
2269 data.recycle();
2270 reply.recycle();
2271 }
2272 public int broadcastIntent(IApplicationThread caller,
2273 Intent intent, String resolvedType, IIntentReceiver resultTo,
2274 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002275 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002276 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002277 {
2278 Parcel data = Parcel.obtain();
2279 Parcel reply = Parcel.obtain();
2280 data.writeInterfaceToken(IActivityManager.descriptor);
2281 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2282 intent.writeToParcel(data, 0);
2283 data.writeString(resolvedType);
2284 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2285 data.writeInt(resultCode);
2286 data.writeString(resultData);
2287 data.writeBundle(map);
2288 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002289 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002290 data.writeInt(serialized ? 1 : 0);
2291 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002292 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002293 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2294 reply.readException();
2295 int res = reply.readInt();
2296 reply.recycle();
2297 data.recycle();
2298 return res;
2299 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002300 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2301 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002302 {
2303 Parcel data = Parcel.obtain();
2304 Parcel reply = Parcel.obtain();
2305 data.writeInterfaceToken(IActivityManager.descriptor);
2306 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2307 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002308 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002309 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2310 reply.readException();
2311 data.recycle();
2312 reply.recycle();
2313 }
2314 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2315 {
2316 Parcel data = Parcel.obtain();
2317 Parcel reply = Parcel.obtain();
2318 data.writeInterfaceToken(IActivityManager.descriptor);
2319 data.writeStrongBinder(who);
2320 data.writeInt(resultCode);
2321 data.writeString(resultData);
2322 data.writeBundle(map);
2323 data.writeInt(abortBroadcast ? 1 : 0);
2324 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2325 reply.readException();
2326 data.recycle();
2327 reply.recycle();
2328 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002329 public void attachApplication(IApplicationThread app) throws RemoteException
2330 {
2331 Parcel data = Parcel.obtain();
2332 Parcel reply = Parcel.obtain();
2333 data.writeInterfaceToken(IActivityManager.descriptor);
2334 data.writeStrongBinder(app.asBinder());
2335 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2336 reply.readException();
2337 data.recycle();
2338 reply.recycle();
2339 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002340 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2341 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 {
2343 Parcel data = Parcel.obtain();
2344 Parcel reply = Parcel.obtain();
2345 data.writeInterfaceToken(IActivityManager.descriptor);
2346 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002347 if (config != null) {
2348 data.writeInt(1);
2349 config.writeToParcel(data, 0);
2350 } else {
2351 data.writeInt(0);
2352 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002353 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002354 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2355 reply.readException();
2356 data.recycle();
2357 reply.recycle();
2358 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002359 public void activityResumed(IBinder token) throws RemoteException
2360 {
2361 Parcel data = Parcel.obtain();
2362 Parcel reply = Parcel.obtain();
2363 data.writeInterfaceToken(IActivityManager.descriptor);
2364 data.writeStrongBinder(token);
2365 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2366 reply.readException();
2367 data.recycle();
2368 reply.recycle();
2369 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002370 public void activityPaused(IBinder token) throws RemoteException
2371 {
2372 Parcel data = Parcel.obtain();
2373 Parcel reply = Parcel.obtain();
2374 data.writeInterfaceToken(IActivityManager.descriptor);
2375 data.writeStrongBinder(token);
2376 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2377 reply.readException();
2378 data.recycle();
2379 reply.recycle();
2380 }
2381 public void activityStopped(IBinder token, Bundle state,
2382 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002383 {
2384 Parcel data = Parcel.obtain();
2385 Parcel reply = Parcel.obtain();
2386 data.writeInterfaceToken(IActivityManager.descriptor);
2387 data.writeStrongBinder(token);
2388 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002389 if (thumbnail != null) {
2390 data.writeInt(1);
2391 thumbnail.writeToParcel(data, 0);
2392 } else {
2393 data.writeInt(0);
2394 }
2395 TextUtils.writeToParcel(description, data, 0);
2396 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2397 reply.readException();
2398 data.recycle();
2399 reply.recycle();
2400 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002401 public void activitySlept(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_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2408 reply.readException();
2409 data.recycle();
2410 reply.recycle();
2411 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002412 public void activityDestroyed(IBinder token) throws RemoteException
2413 {
2414 Parcel data = Parcel.obtain();
2415 Parcel reply = Parcel.obtain();
2416 data.writeInterfaceToken(IActivityManager.descriptor);
2417 data.writeStrongBinder(token);
2418 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2419 reply.readException();
2420 data.recycle();
2421 reply.recycle();
2422 }
2423 public String getCallingPackage(IBinder token) throws RemoteException
2424 {
2425 Parcel data = Parcel.obtain();
2426 Parcel reply = Parcel.obtain();
2427 data.writeInterfaceToken(IActivityManager.descriptor);
2428 data.writeStrongBinder(token);
2429 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2430 reply.readException();
2431 String res = reply.readString();
2432 data.recycle();
2433 reply.recycle();
2434 return res;
2435 }
2436 public ComponentName getCallingActivity(IBinder token)
2437 throws RemoteException {
2438 Parcel data = Parcel.obtain();
2439 Parcel reply = Parcel.obtain();
2440 data.writeInterfaceToken(IActivityManager.descriptor);
2441 data.writeStrongBinder(token);
2442 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2443 reply.readException();
2444 ComponentName res = ComponentName.readFromParcel(reply);
2445 data.recycle();
2446 reply.recycle();
2447 return res;
2448 }
2449 public List getTasks(int maxNum, int flags,
2450 IThumbnailReceiver receiver) throws RemoteException {
2451 Parcel data = Parcel.obtain();
2452 Parcel reply = Parcel.obtain();
2453 data.writeInterfaceToken(IActivityManager.descriptor);
2454 data.writeInt(maxNum);
2455 data.writeInt(flags);
2456 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2457 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2458 reply.readException();
2459 ArrayList list = null;
2460 int N = reply.readInt();
2461 if (N >= 0) {
2462 list = new ArrayList();
2463 while (N > 0) {
2464 ActivityManager.RunningTaskInfo info =
2465 ActivityManager.RunningTaskInfo.CREATOR
2466 .createFromParcel(reply);
2467 list.add(info);
2468 N--;
2469 }
2470 }
2471 data.recycle();
2472 reply.recycle();
2473 return list;
2474 }
2475 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002476 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002477 Parcel data = Parcel.obtain();
2478 Parcel reply = Parcel.obtain();
2479 data.writeInterfaceToken(IActivityManager.descriptor);
2480 data.writeInt(maxNum);
2481 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002482 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002483 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2484 reply.readException();
2485 ArrayList<ActivityManager.RecentTaskInfo> list
2486 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2487 data.recycle();
2488 reply.recycle();
2489 return list;
2490 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002491 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002492 Parcel data = Parcel.obtain();
2493 Parcel reply = Parcel.obtain();
2494 data.writeInterfaceToken(IActivityManager.descriptor);
2495 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002496 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002497 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002498 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002499 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002500 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002501 }
2502 data.recycle();
2503 reply.recycle();
2504 return bm;
2505 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002506 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2507 Parcel data = Parcel.obtain();
2508 Parcel reply = Parcel.obtain();
2509 data.writeInterfaceToken(IActivityManager.descriptor);
2510 data.writeInt(id);
2511 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2512 reply.readException();
2513 Bitmap bm = null;
2514 if (reply.readInt() != 0) {
2515 bm = Bitmap.CREATOR.createFromParcel(reply);
2516 }
2517 data.recycle();
2518 reply.recycle();
2519 return bm;
2520 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002521 public List getServices(int maxNum, int flags) throws RemoteException {
2522 Parcel data = Parcel.obtain();
2523 Parcel reply = Parcel.obtain();
2524 data.writeInterfaceToken(IActivityManager.descriptor);
2525 data.writeInt(maxNum);
2526 data.writeInt(flags);
2527 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2528 reply.readException();
2529 ArrayList list = null;
2530 int N = reply.readInt();
2531 if (N >= 0) {
2532 list = new ArrayList();
2533 while (N > 0) {
2534 ActivityManager.RunningServiceInfo info =
2535 ActivityManager.RunningServiceInfo.CREATOR
2536 .createFromParcel(reply);
2537 list.add(info);
2538 N--;
2539 }
2540 }
2541 data.recycle();
2542 reply.recycle();
2543 return list;
2544 }
2545 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2546 throws RemoteException {
2547 Parcel data = Parcel.obtain();
2548 Parcel reply = Parcel.obtain();
2549 data.writeInterfaceToken(IActivityManager.descriptor);
2550 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2551 reply.readException();
2552 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2553 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2554 data.recycle();
2555 reply.recycle();
2556 return list;
2557 }
2558 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2559 throws RemoteException {
2560 Parcel data = Parcel.obtain();
2561 Parcel reply = Parcel.obtain();
2562 data.writeInterfaceToken(IActivityManager.descriptor);
2563 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2564 reply.readException();
2565 ArrayList<ActivityManager.RunningAppProcessInfo> list
2566 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2567 data.recycle();
2568 reply.recycle();
2569 return list;
2570 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002571 public List<ApplicationInfo> getRunningExternalApplications()
2572 throws RemoteException {
2573 Parcel data = Parcel.obtain();
2574 Parcel reply = Parcel.obtain();
2575 data.writeInterfaceToken(IActivityManager.descriptor);
2576 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2577 reply.readException();
2578 ArrayList<ApplicationInfo> list
2579 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2580 data.recycle();
2581 reply.recycle();
2582 return list;
2583 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002584 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002585 {
2586 Parcel data = Parcel.obtain();
2587 Parcel reply = Parcel.obtain();
2588 data.writeInterfaceToken(IActivityManager.descriptor);
2589 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002590 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002591 if (options != null) {
2592 data.writeInt(1);
2593 options.writeToParcel(data, 0);
2594 } else {
2595 data.writeInt(0);
2596 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002597 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2598 reply.readException();
2599 data.recycle();
2600 reply.recycle();
2601 }
2602 public void moveTaskToBack(int task) throws RemoteException
2603 {
2604 Parcel data = Parcel.obtain();
2605 Parcel reply = Parcel.obtain();
2606 data.writeInterfaceToken(IActivityManager.descriptor);
2607 data.writeInt(task);
2608 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2609 reply.readException();
2610 data.recycle();
2611 reply.recycle();
2612 }
2613 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2614 throws RemoteException {
2615 Parcel data = Parcel.obtain();
2616 Parcel reply = Parcel.obtain();
2617 data.writeInterfaceToken(IActivityManager.descriptor);
2618 data.writeStrongBinder(token);
2619 data.writeInt(nonRoot ? 1 : 0);
2620 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2621 reply.readException();
2622 boolean res = reply.readInt() != 0;
2623 data.recycle();
2624 reply.recycle();
2625 return res;
2626 }
2627 public void moveTaskBackwards(int task) throws RemoteException
2628 {
2629 Parcel data = Parcel.obtain();
2630 Parcel reply = Parcel.obtain();
2631 data.writeInterfaceToken(IActivityManager.descriptor);
2632 data.writeInt(task);
2633 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2634 reply.readException();
2635 data.recycle();
2636 reply.recycle();
2637 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002638 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002639 public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002640 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002641 {
2642 Parcel data = Parcel.obtain();
2643 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002644 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002645 data.writeInt(taskId);
Craig Mautner5a449152013-05-24 15:49:29 -07002646 data.writeInt(relativeStackBoxId);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002647 data.writeInt(position);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002648 data.writeFloat(weight);
2649 mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
2650 reply.readException();
2651 int res = reply.readInt();
2652 data.recycle();
2653 reply.recycle();
2654 return res;
2655 }
2656 @Override
2657 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2658 {
2659 Parcel data = Parcel.obtain();
2660 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002661 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002662 data.writeInt(taskId);
2663 data.writeInt(stackId);
2664 data.writeInt(toTop ? 1 : 0);
2665 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2666 reply.readException();
2667 data.recycle();
2668 reply.recycle();
2669 }
2670 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002671 public void resizeStackBox(int stackBoxId, float weight) 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 Mautner5a449152013-05-24 15:49:29 -07002676 data.writeInt(stackBoxId);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002677 data.writeFloat(weight);
Craig Mautnercf910b02013-04-23 11:23:27 -07002678 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002679 reply.readException();
2680 data.recycle();
2681 reply.recycle();
2682 }
Craig Mautner967212c2013-04-13 21:10:58 -07002683 @Override
Craig Mautner5ff12102013-05-24 12:50:15 -07002684 public List<StackBoxInfo> getStackBoxes() throws RemoteException
2685 {
2686 Parcel data = Parcel.obtain();
2687 Parcel reply = Parcel.obtain();
2688 data.writeInterfaceToken(IActivityManager.descriptor);
2689 mRemote.transact(GET_STACK_BOXES_TRANSACTION, data, reply, 0);
2690 reply.readException();
2691 ArrayList<StackBoxInfo> list = reply.createTypedArrayList(StackBoxInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002692 data.recycle();
2693 reply.recycle();
2694 return list;
2695 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002696 @Override
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002697 public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException
2698 {
2699 Parcel data = Parcel.obtain();
2700 Parcel reply = Parcel.obtain();
2701 data.writeInterfaceToken(IActivityManager.descriptor);
2702 data.writeInt(stackBoxId);
2703 mRemote.transact(GET_STACK_BOX_INFO_TRANSACTION, data, reply, 0);
2704 reply.readException();
2705 int res = reply.readInt();
2706 StackBoxInfo info = null;
2707 if (res != 0) {
2708 info = StackBoxInfo.CREATOR.createFromParcel(reply);
2709 }
2710 data.recycle();
2711 reply.recycle();
2712 return info;
2713 }
2714 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002715 public void setFocusedStack(int stackId) throws RemoteException
2716 {
2717 Parcel data = Parcel.obtain();
2718 Parcel reply = Parcel.obtain();
2719 data.writeInterfaceToken(IActivityManager.descriptor);
2720 data.writeInt(stackId);
2721 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2722 reply.readException();
2723 data.recycle();
2724 reply.recycle();
2725 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002726 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2727 {
2728 Parcel data = Parcel.obtain();
2729 Parcel reply = Parcel.obtain();
2730 data.writeInterfaceToken(IActivityManager.descriptor);
2731 data.writeStrongBinder(token);
2732 data.writeInt(onlyRoot ? 1 : 0);
2733 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 int res = reply.readInt();
2736 data.recycle();
2737 reply.recycle();
2738 return res;
2739 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 public void reportThumbnail(IBinder token,
2741 Bitmap thumbnail, CharSequence description) throws RemoteException
2742 {
2743 Parcel data = Parcel.obtain();
2744 Parcel reply = Parcel.obtain();
2745 data.writeInterfaceToken(IActivityManager.descriptor);
2746 data.writeStrongBinder(token);
2747 if (thumbnail != null) {
2748 data.writeInt(1);
2749 thumbnail.writeToParcel(data, 0);
2750 } else {
2751 data.writeInt(0);
2752 }
2753 TextUtils.writeToParcel(description, data, 0);
2754 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2755 reply.readException();
2756 data.recycle();
2757 reply.recycle();
2758 }
2759 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002760 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002761 Parcel data = Parcel.obtain();
2762 Parcel reply = Parcel.obtain();
2763 data.writeInterfaceToken(IActivityManager.descriptor);
2764 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2765 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002766 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002767 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002768 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2769 reply.readException();
2770 int res = reply.readInt();
2771 ContentProviderHolder cph = null;
2772 if (res != 0) {
2773 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2774 }
2775 data.recycle();
2776 reply.recycle();
2777 return cph;
2778 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002779 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2780 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002781 Parcel data = Parcel.obtain();
2782 Parcel reply = Parcel.obtain();
2783 data.writeInterfaceToken(IActivityManager.descriptor);
2784 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002785 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002786 data.writeStrongBinder(token);
2787 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2788 reply.readException();
2789 int res = reply.readInt();
2790 ContentProviderHolder cph = null;
2791 if (res != 0) {
2792 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2793 }
2794 data.recycle();
2795 reply.recycle();
2796 return cph;
2797 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002798 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002799 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002800 {
2801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2805 data.writeTypedList(providers);
2806 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2807 reply.readException();
2808 data.recycle();
2809 reply.recycle();
2810 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002811 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2812 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002816 data.writeStrongBinder(connection);
2817 data.writeInt(stable);
2818 data.writeInt(unstable);
2819 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2820 reply.readException();
2821 boolean res = reply.readInt() != 0;
2822 data.recycle();
2823 reply.recycle();
2824 return res;
2825 }
2826 public void unstableProviderDied(IBinder connection) throws RemoteException {
2827 Parcel data = Parcel.obtain();
2828 Parcel reply = Parcel.obtain();
2829 data.writeInterfaceToken(IActivityManager.descriptor);
2830 data.writeStrongBinder(connection);
2831 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2832 reply.readException();
2833 data.recycle();
2834 reply.recycle();
2835 }
2836
2837 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2838 Parcel data = Parcel.obtain();
2839 Parcel reply = Parcel.obtain();
2840 data.writeInterfaceToken(IActivityManager.descriptor);
2841 data.writeStrongBinder(connection);
2842 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002843 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2844 reply.readException();
2845 data.recycle();
2846 reply.recycle();
2847 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002848
2849 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2850 Parcel data = Parcel.obtain();
2851 Parcel reply = Parcel.obtain();
2852 data.writeInterfaceToken(IActivityManager.descriptor);
2853 data.writeString(name);
2854 data.writeStrongBinder(token);
2855 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2856 reply.readException();
2857 data.recycle();
2858 reply.recycle();
2859 }
2860
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002861 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2862 throws RemoteException
2863 {
2864 Parcel data = Parcel.obtain();
2865 Parcel reply = Parcel.obtain();
2866 data.writeInterfaceToken(IActivityManager.descriptor);
2867 service.writeToParcel(data, 0);
2868 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2869 reply.readException();
2870 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2871 data.recycle();
2872 reply.recycle();
2873 return res;
2874 }
2875
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002876 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002877 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002878 {
2879 Parcel data = Parcel.obtain();
2880 Parcel reply = Parcel.obtain();
2881 data.writeInterfaceToken(IActivityManager.descriptor);
2882 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2883 service.writeToParcel(data, 0);
2884 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002885 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002886 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 ComponentName res = ComponentName.readFromParcel(reply);
2889 data.recycle();
2890 reply.recycle();
2891 return res;
2892 }
2893 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002894 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002895 {
2896 Parcel data = Parcel.obtain();
2897 Parcel reply = Parcel.obtain();
2898 data.writeInterfaceToken(IActivityManager.descriptor);
2899 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2900 service.writeToParcel(data, 0);
2901 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002902 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002903 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2904 reply.readException();
2905 int res = reply.readInt();
2906 reply.recycle();
2907 data.recycle();
2908 return res;
2909 }
2910 public boolean stopServiceToken(ComponentName className, IBinder token,
2911 int startId) throws RemoteException {
2912 Parcel data = Parcel.obtain();
2913 Parcel reply = Parcel.obtain();
2914 data.writeInterfaceToken(IActivityManager.descriptor);
2915 ComponentName.writeToParcel(className, data);
2916 data.writeStrongBinder(token);
2917 data.writeInt(startId);
2918 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2919 reply.readException();
2920 boolean res = reply.readInt() != 0;
2921 data.recycle();
2922 reply.recycle();
2923 return res;
2924 }
2925 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002926 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 ComponentName.writeToParcel(className, data);
2931 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002932 data.writeInt(id);
2933 if (notification != null) {
2934 data.writeInt(1);
2935 notification.writeToParcel(data, 0);
2936 } else {
2937 data.writeInt(0);
2938 }
2939 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002940 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2941 reply.readException();
2942 data.recycle();
2943 reply.recycle();
2944 }
2945 public int bindService(IApplicationThread caller, IBinder token,
2946 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002947 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 Parcel data = Parcel.obtain();
2949 Parcel reply = Parcel.obtain();
2950 data.writeInterfaceToken(IActivityManager.descriptor);
2951 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2952 data.writeStrongBinder(token);
2953 service.writeToParcel(data, 0);
2954 data.writeString(resolvedType);
2955 data.writeStrongBinder(connection.asBinder());
2956 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002957 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002958 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2959 reply.readException();
2960 int res = reply.readInt();
2961 data.recycle();
2962 reply.recycle();
2963 return res;
2964 }
2965 public boolean unbindService(IServiceConnection connection) throws RemoteException
2966 {
2967 Parcel data = Parcel.obtain();
2968 Parcel reply = Parcel.obtain();
2969 data.writeInterfaceToken(IActivityManager.descriptor);
2970 data.writeStrongBinder(connection.asBinder());
2971 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 boolean res = reply.readInt() != 0;
2974 data.recycle();
2975 reply.recycle();
2976 return res;
2977 }
2978
2979 public void publishService(IBinder token,
2980 Intent intent, IBinder service) throws RemoteException {
2981 Parcel data = Parcel.obtain();
2982 Parcel reply = Parcel.obtain();
2983 data.writeInterfaceToken(IActivityManager.descriptor);
2984 data.writeStrongBinder(token);
2985 intent.writeToParcel(data, 0);
2986 data.writeStrongBinder(service);
2987 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2988 reply.readException();
2989 data.recycle();
2990 reply.recycle();
2991 }
2992
2993 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2994 throws RemoteException {
2995 Parcel data = Parcel.obtain();
2996 Parcel reply = Parcel.obtain();
2997 data.writeInterfaceToken(IActivityManager.descriptor);
2998 data.writeStrongBinder(token);
2999 intent.writeToParcel(data, 0);
3000 data.writeInt(doRebind ? 1 : 0);
3001 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3002 reply.readException();
3003 data.recycle();
3004 reply.recycle();
3005 }
3006
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003007 public void serviceDoneExecuting(IBinder token, int type, int startId,
3008 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003009 Parcel data = Parcel.obtain();
3010 Parcel reply = Parcel.obtain();
3011 data.writeInterfaceToken(IActivityManager.descriptor);
3012 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003013 data.writeInt(type);
3014 data.writeInt(startId);
3015 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3017 reply.readException();
3018 data.recycle();
3019 reply.recycle();
3020 }
3021
3022 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3023 Parcel data = Parcel.obtain();
3024 Parcel reply = Parcel.obtain();
3025 data.writeInterfaceToken(IActivityManager.descriptor);
3026 service.writeToParcel(data, 0);
3027 data.writeString(resolvedType);
3028 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 IBinder binder = reply.readStrongBinder();
3031 reply.recycle();
3032 data.recycle();
3033 return binder;
3034 }
3035
Christopher Tate181fafa2009-05-14 11:12:14 -07003036 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3037 throws RemoteException {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 app.writeToParcel(data, 0);
3042 data.writeInt(backupRestoreMode);
3043 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3044 reply.readException();
3045 boolean success = reply.readInt() != 0;
3046 reply.recycle();
3047 data.recycle();
3048 return success;
3049 }
3050
Christopher Tate346acb12012-10-15 19:20:25 -07003051 public void clearPendingBackup() throws RemoteException {
3052 Parcel data = Parcel.obtain();
3053 Parcel reply = Parcel.obtain();
3054 data.writeInterfaceToken(IActivityManager.descriptor);
3055 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3056 reply.recycle();
3057 data.recycle();
3058 }
3059
Christopher Tate181fafa2009-05-14 11:12:14 -07003060 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3061 Parcel data = Parcel.obtain();
3062 Parcel reply = Parcel.obtain();
3063 data.writeInterfaceToken(IActivityManager.descriptor);
3064 data.writeString(packageName);
3065 data.writeStrongBinder(agent);
3066 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3067 reply.recycle();
3068 data.recycle();
3069 }
3070
3071 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3072 Parcel data = Parcel.obtain();
3073 Parcel reply = Parcel.obtain();
3074 data.writeInterfaceToken(IActivityManager.descriptor);
3075 app.writeToParcel(data, 0);
3076 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3077 reply.readException();
3078 reply.recycle();
3079 data.recycle();
3080 }
3081
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003082 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003083 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3084 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003085 Parcel data = Parcel.obtain();
3086 Parcel reply = Parcel.obtain();
3087 data.writeInterfaceToken(IActivityManager.descriptor);
3088 ComponentName.writeToParcel(className, data);
3089 data.writeString(profileFile);
3090 data.writeInt(flags);
3091 data.writeBundle(arguments);
3092 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003093 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003094 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003095 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3096 reply.readException();
3097 boolean res = reply.readInt() != 0;
3098 reply.recycle();
3099 data.recycle();
3100 return res;
3101 }
3102
3103 public void finishInstrumentation(IApplicationThread target,
3104 int resultCode, Bundle results) throws RemoteException {
3105 Parcel data = Parcel.obtain();
3106 Parcel reply = Parcel.obtain();
3107 data.writeInterfaceToken(IActivityManager.descriptor);
3108 data.writeStrongBinder(target != null ? target.asBinder() : null);
3109 data.writeInt(resultCode);
3110 data.writeBundle(results);
3111 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3112 reply.readException();
3113 data.recycle();
3114 reply.recycle();
3115 }
3116 public Configuration getConfiguration() throws RemoteException
3117 {
3118 Parcel data = Parcel.obtain();
3119 Parcel reply = Parcel.obtain();
3120 data.writeInterfaceToken(IActivityManager.descriptor);
3121 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3122 reply.readException();
3123 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3124 reply.recycle();
3125 data.recycle();
3126 return res;
3127 }
3128 public void updateConfiguration(Configuration values) throws RemoteException
3129 {
3130 Parcel data = Parcel.obtain();
3131 Parcel reply = Parcel.obtain();
3132 data.writeInterfaceToken(IActivityManager.descriptor);
3133 values.writeToParcel(data, 0);
3134 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3135 reply.readException();
3136 data.recycle();
3137 reply.recycle();
3138 }
3139 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3140 throws RemoteException {
3141 Parcel data = Parcel.obtain();
3142 Parcel reply = Parcel.obtain();
3143 data.writeInterfaceToken(IActivityManager.descriptor);
3144 data.writeStrongBinder(token);
3145 data.writeInt(requestedOrientation);
3146 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3147 reply.readException();
3148 data.recycle();
3149 reply.recycle();
3150 }
3151 public int getRequestedOrientation(IBinder token) throws RemoteException {
3152 Parcel data = Parcel.obtain();
3153 Parcel reply = Parcel.obtain();
3154 data.writeInterfaceToken(IActivityManager.descriptor);
3155 data.writeStrongBinder(token);
3156 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3157 reply.readException();
3158 int res = reply.readInt();
3159 data.recycle();
3160 reply.recycle();
3161 return res;
3162 }
3163 public ComponentName getActivityClassForToken(IBinder token)
3164 throws RemoteException {
3165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 data.writeStrongBinder(token);
3169 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3170 reply.readException();
3171 ComponentName res = ComponentName.readFromParcel(reply);
3172 data.recycle();
3173 reply.recycle();
3174 return res;
3175 }
3176 public String getPackageForToken(IBinder token) throws RemoteException
3177 {
3178 Parcel data = Parcel.obtain();
3179 Parcel reply = Parcel.obtain();
3180 data.writeInterfaceToken(IActivityManager.descriptor);
3181 data.writeStrongBinder(token);
3182 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3183 reply.readException();
3184 String res = reply.readString();
3185 data.recycle();
3186 reply.recycle();
3187 return res;
3188 }
3189 public IIntentSender getIntentSender(int type,
3190 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003191 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003192 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003193 Parcel data = Parcel.obtain();
3194 Parcel reply = Parcel.obtain();
3195 data.writeInterfaceToken(IActivityManager.descriptor);
3196 data.writeInt(type);
3197 data.writeString(packageName);
3198 data.writeStrongBinder(token);
3199 data.writeString(resultWho);
3200 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003201 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003202 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003203 data.writeTypedArray(intents, 0);
3204 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003205 } else {
3206 data.writeInt(0);
3207 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003208 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003209 if (options != null) {
3210 data.writeInt(1);
3211 options.writeToParcel(data, 0);
3212 } else {
3213 data.writeInt(0);
3214 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003215 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3217 reply.readException();
3218 IIntentSender res = IIntentSender.Stub.asInterface(
3219 reply.readStrongBinder());
3220 data.recycle();
3221 reply.recycle();
3222 return res;
3223 }
3224 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3225 Parcel data = Parcel.obtain();
3226 Parcel reply = Parcel.obtain();
3227 data.writeInterfaceToken(IActivityManager.descriptor);
3228 data.writeStrongBinder(sender.asBinder());
3229 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3230 reply.readException();
3231 data.recycle();
3232 reply.recycle();
3233 }
3234 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3235 Parcel data = Parcel.obtain();
3236 Parcel reply = Parcel.obtain();
3237 data.writeInterfaceToken(IActivityManager.descriptor);
3238 data.writeStrongBinder(sender.asBinder());
3239 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3240 reply.readException();
3241 String res = reply.readString();
3242 data.recycle();
3243 reply.recycle();
3244 return res;
3245 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003246 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3247 Parcel data = Parcel.obtain();
3248 Parcel reply = Parcel.obtain();
3249 data.writeInterfaceToken(IActivityManager.descriptor);
3250 data.writeStrongBinder(sender.asBinder());
3251 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3252 reply.readException();
3253 int res = reply.readInt();
3254 data.recycle();
3255 reply.recycle();
3256 return res;
3257 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003258 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3259 boolean requireFull, String name, String callerPackage) throws RemoteException {
3260 Parcel data = Parcel.obtain();
3261 Parcel reply = Parcel.obtain();
3262 data.writeInterfaceToken(IActivityManager.descriptor);
3263 data.writeInt(callingPid);
3264 data.writeInt(callingUid);
3265 data.writeInt(userId);
3266 data.writeInt(allowAll ? 1 : 0);
3267 data.writeInt(requireFull ? 1 : 0);
3268 data.writeString(name);
3269 data.writeString(callerPackage);
3270 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3271 reply.readException();
3272 int res = reply.readInt();
3273 data.recycle();
3274 reply.recycle();
3275 return res;
3276 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003277 public void setProcessLimit(int max) throws RemoteException
3278 {
3279 Parcel data = Parcel.obtain();
3280 Parcel reply = Parcel.obtain();
3281 data.writeInterfaceToken(IActivityManager.descriptor);
3282 data.writeInt(max);
3283 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3284 reply.readException();
3285 data.recycle();
3286 reply.recycle();
3287 }
3288 public int getProcessLimit() throws RemoteException
3289 {
3290 Parcel data = Parcel.obtain();
3291 Parcel reply = Parcel.obtain();
3292 data.writeInterfaceToken(IActivityManager.descriptor);
3293 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3294 reply.readException();
3295 int res = reply.readInt();
3296 data.recycle();
3297 reply.recycle();
3298 return res;
3299 }
3300 public void setProcessForeground(IBinder token, int pid,
3301 boolean isForeground) throws RemoteException {
3302 Parcel data = Parcel.obtain();
3303 Parcel reply = Parcel.obtain();
3304 data.writeInterfaceToken(IActivityManager.descriptor);
3305 data.writeStrongBinder(token);
3306 data.writeInt(pid);
3307 data.writeInt(isForeground ? 1 : 0);
3308 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3309 reply.readException();
3310 data.recycle();
3311 reply.recycle();
3312 }
3313 public int checkPermission(String permission, int pid, int uid)
3314 throws RemoteException {
3315 Parcel data = Parcel.obtain();
3316 Parcel reply = Parcel.obtain();
3317 data.writeInterfaceToken(IActivityManager.descriptor);
3318 data.writeString(permission);
3319 data.writeInt(pid);
3320 data.writeInt(uid);
3321 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3322 reply.readException();
3323 int res = reply.readInt();
3324 data.recycle();
3325 reply.recycle();
3326 return res;
3327 }
3328 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003329 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003330 Parcel data = Parcel.obtain();
3331 Parcel reply = Parcel.obtain();
3332 data.writeInterfaceToken(IActivityManager.descriptor);
3333 data.writeString(packageName);
3334 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003335 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003336 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3337 reply.readException();
3338 boolean res = reply.readInt() != 0;
3339 data.recycle();
3340 reply.recycle();
3341 return res;
3342 }
3343 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3344 throws RemoteException {
3345 Parcel data = Parcel.obtain();
3346 Parcel reply = Parcel.obtain();
3347 data.writeInterfaceToken(IActivityManager.descriptor);
3348 uri.writeToParcel(data, 0);
3349 data.writeInt(pid);
3350 data.writeInt(uid);
3351 data.writeInt(mode);
3352 mRemote.transact(CHECK_URI_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 void grantUriPermission(IApplicationThread caller, String targetPkg,
3360 Uri uri, int mode) throws RemoteException {
3361 Parcel data = Parcel.obtain();
3362 Parcel reply = Parcel.obtain();
3363 data.writeInterfaceToken(IActivityManager.descriptor);
3364 data.writeStrongBinder(caller.asBinder());
3365 data.writeString(targetPkg);
3366 uri.writeToParcel(data, 0);
3367 data.writeInt(mode);
3368 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3369 reply.readException();
3370 data.recycle();
3371 reply.recycle();
3372 }
3373 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3374 int mode) throws RemoteException {
3375 Parcel data = Parcel.obtain();
3376 Parcel reply = Parcel.obtain();
3377 data.writeInterfaceToken(IActivityManager.descriptor);
3378 data.writeStrongBinder(caller.asBinder());
3379 uri.writeToParcel(data, 0);
3380 data.writeInt(mode);
3381 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3382 reply.readException();
3383 data.recycle();
3384 reply.recycle();
3385 }
3386 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3387 throws RemoteException {
3388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 data.writeStrongBinder(who.asBinder());
3392 data.writeInt(waiting ? 1 : 0);
3393 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3394 reply.readException();
3395 data.recycle();
3396 reply.recycle();
3397 }
3398 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3399 Parcel data = Parcel.obtain();
3400 Parcel reply = Parcel.obtain();
3401 data.writeInterfaceToken(IActivityManager.descriptor);
3402 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3403 reply.readException();
3404 outInfo.readFromParcel(reply);
3405 data.recycle();
3406 reply.recycle();
3407 }
3408 public void unhandledBack() throws RemoteException
3409 {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3414 reply.readException();
3415 data.recycle();
3416 reply.recycle();
3417 }
3418 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3419 {
3420 Parcel data = Parcel.obtain();
3421 Parcel reply = Parcel.obtain();
3422 data.writeInterfaceToken(IActivityManager.descriptor);
3423 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3424 reply.readException();
3425 ParcelFileDescriptor pfd = null;
3426 if (reply.readInt() != 0) {
3427 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3428 }
3429 data.recycle();
3430 reply.recycle();
3431 return pfd;
3432 }
3433 public void goingToSleep() throws RemoteException
3434 {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3439 reply.readException();
3440 data.recycle();
3441 reply.recycle();
3442 }
3443 public void wakingUp() throws RemoteException
3444 {
3445 Parcel data = Parcel.obtain();
3446 Parcel reply = Parcel.obtain();
3447 data.writeInterfaceToken(IActivityManager.descriptor);
3448 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3449 reply.readException();
3450 data.recycle();
3451 reply.recycle();
3452 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003453 public void setLockScreenShown(boolean shown) throws RemoteException
3454 {
3455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 data.writeInt(shown ? 1 : 0);
3459 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3460 reply.readException();
3461 data.recycle();
3462 reply.recycle();
3463 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003464 public void setDebugApp(
3465 String packageName, boolean waitForDebugger, boolean persistent)
3466 throws RemoteException
3467 {
3468 Parcel data = Parcel.obtain();
3469 Parcel reply = Parcel.obtain();
3470 data.writeInterfaceToken(IActivityManager.descriptor);
3471 data.writeString(packageName);
3472 data.writeInt(waitForDebugger ? 1 : 0);
3473 data.writeInt(persistent ? 1 : 0);
3474 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3475 reply.readException();
3476 data.recycle();
3477 reply.recycle();
3478 }
3479 public void setAlwaysFinish(boolean enabled) throws RemoteException
3480 {
3481 Parcel data = Parcel.obtain();
3482 Parcel reply = Parcel.obtain();
3483 data.writeInterfaceToken(IActivityManager.descriptor);
3484 data.writeInt(enabled ? 1 : 0);
3485 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3486 reply.readException();
3487 data.recycle();
3488 reply.recycle();
3489 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003490 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003491 {
3492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003496 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003497 reply.readException();
3498 data.recycle();
3499 reply.recycle();
3500 }
3501 public void enterSafeMode() throws RemoteException {
3502 Parcel data = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3505 data.recycle();
3506 }
3507 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3508 Parcel data = Parcel.obtain();
3509 data.writeStrongBinder(sender.asBinder());
3510 data.writeInterfaceToken(IActivityManager.descriptor);
3511 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3512 data.recycle();
3513 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003514 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003519 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003520 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003521 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003522 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003523 boolean res = reply.readInt() != 0;
3524 data.recycle();
3525 reply.recycle();
3526 return res;
3527 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003528 @Override
3529 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3530 Parcel data = Parcel.obtain();
3531 Parcel reply = Parcel.obtain();
3532 data.writeInterfaceToken(IActivityManager.descriptor);
3533 data.writeString(reason);
3534 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3535 boolean res = reply.readInt() != 0;
3536 data.recycle();
3537 reply.recycle();
3538 return res;
3539 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003540 public void startRunning(String pkg, String cls, String action,
3541 String indata) throws RemoteException {
3542 Parcel data = Parcel.obtain();
3543 Parcel reply = Parcel.obtain();
3544 data.writeInterfaceToken(IActivityManager.descriptor);
3545 data.writeString(pkg);
3546 data.writeString(cls);
3547 data.writeString(action);
3548 data.writeString(indata);
3549 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 data.recycle();
3552 reply.recycle();
3553 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003554 public boolean testIsSystemReady()
3555 {
3556 /* this base class version is never called */
3557 return true;
3558 }
Dan Egnor60d87622009-12-16 16:32:58 -08003559 public void handleApplicationCrash(IBinder app,
3560 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3561 {
3562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 data.writeStrongBinder(app);
3566 crashInfo.writeToParcel(data, 0);
3567 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 reply.recycle();
3570 data.recycle();
3571 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003572
Dan Egnor60d87622009-12-16 16:32:58 -08003573 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003574 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003575 {
3576 Parcel data = Parcel.obtain();
3577 Parcel reply = Parcel.obtain();
3578 data.writeInterfaceToken(IActivityManager.descriptor);
3579 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003580 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003581 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003582 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003583 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003584 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003585 reply.recycle();
3586 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003587 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003588 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003589
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003590 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003591 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003592 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003593 {
3594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003598 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003599 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003600 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3601 reply.readException();
3602 reply.recycle();
3603 data.recycle();
3604 }
3605
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 public void signalPersistentProcesses(int sig) throws RemoteException {
3607 Parcel data = Parcel.obtain();
3608 Parcel reply = Parcel.obtain();
3609 data.writeInterfaceToken(IActivityManager.descriptor);
3610 data.writeInt(sig);
3611 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3612 reply.readException();
3613 data.recycle();
3614 reply.recycle();
3615 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003616
Dianne Hackborn1676c852012-09-10 14:52:30 -07003617 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003618 Parcel data = Parcel.obtain();
3619 Parcel reply = Parcel.obtain();
3620 data.writeInterfaceToken(IActivityManager.descriptor);
3621 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003622 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003623 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3624 reply.readException();
3625 data.recycle();
3626 reply.recycle();
3627 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003628
3629 public void killAllBackgroundProcesses() throws RemoteException {
3630 Parcel data = Parcel.obtain();
3631 Parcel reply = Parcel.obtain();
3632 data.writeInterfaceToken(IActivityManager.descriptor);
3633 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3634 reply.readException();
3635 data.recycle();
3636 reply.recycle();
3637 }
3638
Dianne Hackborn1676c852012-09-10 14:52:30 -07003639 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003640 Parcel data = Parcel.obtain();
3641 Parcel reply = Parcel.obtain();
3642 data.writeInterfaceToken(IActivityManager.descriptor);
3643 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003644 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003645 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003646 reply.readException();
3647 data.recycle();
3648 reply.recycle();
3649 }
3650
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003651 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3652 throws RemoteException
3653 {
3654 Parcel data = Parcel.obtain();
3655 Parcel reply = Parcel.obtain();
3656 data.writeInterfaceToken(IActivityManager.descriptor);
3657 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 outInfo.readFromParcel(reply);
3660 reply.recycle();
3661 data.recycle();
3662 }
3663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003664 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3665 {
3666 Parcel data = Parcel.obtain();
3667 Parcel reply = Parcel.obtain();
3668 data.writeInterfaceToken(IActivityManager.descriptor);
3669 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3670 reply.readException();
3671 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3672 reply.recycle();
3673 data.recycle();
3674 return res;
3675 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003676
Dianne Hackborn1676c852012-09-10 14:52:30 -07003677 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003678 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003679 {
3680 Parcel data = Parcel.obtain();
3681 Parcel reply = Parcel.obtain();
3682 data.writeInterfaceToken(IActivityManager.descriptor);
3683 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003684 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003685 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003686 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003687 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003688 if (fd != null) {
3689 data.writeInt(1);
3690 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3691 } else {
3692 data.writeInt(0);
3693 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003694 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 boolean res = reply.readInt() != 0;
3697 reply.recycle();
3698 data.recycle();
3699 return res;
3700 }
3701
Dianne Hackborn55280a92009-05-07 15:53:46 -07003702 public boolean shutdown(int timeout) throws RemoteException
3703 {
3704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 data.writeInt(timeout);
3708 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 boolean res = reply.readInt() != 0;
3711 reply.recycle();
3712 data.recycle();
3713 return res;
3714 }
3715
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003716 public void stopAppSwitches() throws RemoteException {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3721 reply.readException();
3722 reply.recycle();
3723 data.recycle();
3724 }
3725
3726 public void resumeAppSwitches() throws RemoteException {
3727 Parcel data = Parcel.obtain();
3728 Parcel reply = Parcel.obtain();
3729 data.writeInterfaceToken(IActivityManager.descriptor);
3730 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3731 reply.readException();
3732 reply.recycle();
3733 data.recycle();
3734 }
3735
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003736 public void killApplicationWithAppId(String pkg, int appid, String reason)
3737 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003738 Parcel data = Parcel.obtain();
3739 Parcel reply = Parcel.obtain();
3740 data.writeInterfaceToken(IActivityManager.descriptor);
3741 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003742 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003743 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003744 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003745 reply.readException();
3746 data.recycle();
3747 reply.recycle();
3748 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003749
3750 public void closeSystemDialogs(String reason) throws RemoteException {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeString(reason);
3755 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3756 reply.readException();
3757 data.recycle();
3758 reply.recycle();
3759 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003760
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003761 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003762 throws RemoteException {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003766 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003767 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3768 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003769 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003770 data.recycle();
3771 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003772 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003773 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003774
3775 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3776 Parcel data = Parcel.obtain();
3777 Parcel reply = Parcel.obtain();
3778 data.writeInterfaceToken(IActivityManager.descriptor);
3779 data.writeString(processName);
3780 data.writeInt(uid);
3781 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3782 reply.readException();
3783 data.recycle();
3784 reply.recycle();
3785 }
3786
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003787 public void overridePendingTransition(IBinder token, String packageName,
3788 int enterAnim, int exitAnim) throws RemoteException {
3789 Parcel data = Parcel.obtain();
3790 Parcel reply = Parcel.obtain();
3791 data.writeInterfaceToken(IActivityManager.descriptor);
3792 data.writeStrongBinder(token);
3793 data.writeString(packageName);
3794 data.writeInt(enterAnim);
3795 data.writeInt(exitAnim);
3796 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3797 reply.readException();
3798 data.recycle();
3799 reply.recycle();
3800 }
3801
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003802 public boolean isUserAMonkey() throws RemoteException {
3803 Parcel data = Parcel.obtain();
3804 Parcel reply = Parcel.obtain();
3805 data.writeInterfaceToken(IActivityManager.descriptor);
3806 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3807 reply.readException();
3808 boolean res = reply.readInt() != 0;
3809 data.recycle();
3810 reply.recycle();
3811 return res;
3812 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003813
3814 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3815 Parcel data = Parcel.obtain();
3816 Parcel reply = Parcel.obtain();
3817 data.writeInterfaceToken(IActivityManager.descriptor);
3818 data.writeInt(monkey ? 1 : 0);
3819 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 data.recycle();
3822 reply.recycle();
3823 }
3824
Dianne Hackborn860755f2010-06-03 18:47:52 -07003825 public void finishHeavyWeightApp() throws RemoteException {
3826 Parcel data = Parcel.obtain();
3827 Parcel reply = Parcel.obtain();
3828 data.writeInterfaceToken(IActivityManager.descriptor);
3829 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3830 reply.readException();
3831 data.recycle();
3832 reply.recycle();
3833 }
Craig Mautner4addfc52013-06-25 08:05:45 -07003834
3835 public void convertToOpaque(IBinder token)
3836 throws RemoteException {
3837 Parcel data = Parcel.obtain();
3838 Parcel reply = Parcel.obtain();
3839 data.writeInterfaceToken(IActivityManager.descriptor);
3840 data.writeStrongBinder(token);
3841 mRemote.transact(CONVERT_TO_OPAQUE_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 data.recycle();
3844 reply.recycle();
3845 }
3846
Daniel Sandler69a48172010-06-23 16:29:36 -04003847 public void setImmersive(IBinder token, boolean immersive)
3848 throws RemoteException {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 data.writeStrongBinder(token);
3853 data.writeInt(immersive ? 1 : 0);
3854 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3855 reply.readException();
3856 data.recycle();
3857 reply.recycle();
3858 }
3859
3860 public boolean isImmersive(IBinder token)
3861 throws RemoteException {
3862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 data.writeStrongBinder(token);
3866 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003867 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003868 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003869 data.recycle();
3870 reply.recycle();
3871 return res;
3872 }
3873
3874 public boolean isTopActivityImmersive()
3875 throws RemoteException {
3876 Parcel data = Parcel.obtain();
3877 Parcel reply = Parcel.obtain();
3878 data.writeInterfaceToken(IActivityManager.descriptor);
3879 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003880 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003881 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003882 data.recycle();
3883 reply.recycle();
3884 return res;
3885 }
3886
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003887 public void crashApplication(int uid, int initialPid, String packageName,
3888 String message) throws RemoteException {
3889 Parcel data = Parcel.obtain();
3890 Parcel reply = Parcel.obtain();
3891 data.writeInterfaceToken(IActivityManager.descriptor);
3892 data.writeInt(uid);
3893 data.writeInt(initialPid);
3894 data.writeString(packageName);
3895 data.writeString(message);
3896 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3897 reply.readException();
3898 data.recycle();
3899 reply.recycle();
3900 }
Andy McFadden824c5102010-07-09 16:26:57 -07003901
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003902 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
3906 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003907 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003908 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3909 reply.readException();
3910 String res = reply.readString();
3911 data.recycle();
3912 reply.recycle();
3913 return res;
3914 }
3915
Dianne Hackborn7e269642010-08-25 19:50:20 -07003916 public IBinder newUriPermissionOwner(String name)
3917 throws RemoteException {
3918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 data.writeString(name);
3922 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3923 reply.readException();
3924 IBinder res = reply.readStrongBinder();
3925 data.recycle();
3926 reply.recycle();
3927 return res;
3928 }
3929
3930 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3931 Uri uri, int mode) throws RemoteException {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 data.writeStrongBinder(owner);
3936 data.writeInt(fromUid);
3937 data.writeString(targetPkg);
3938 uri.writeToParcel(data, 0);
3939 data.writeInt(mode);
3940 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3941 reply.readException();
3942 data.recycle();
3943 reply.recycle();
3944 }
3945
3946 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3947 int mode) throws RemoteException {
3948 Parcel data = Parcel.obtain();
3949 Parcel reply = Parcel.obtain();
3950 data.writeInterfaceToken(IActivityManager.descriptor);
3951 data.writeStrongBinder(owner);
3952 if (uri != null) {
3953 data.writeInt(1);
3954 uri.writeToParcel(data, 0);
3955 } else {
3956 data.writeInt(0);
3957 }
3958 data.writeInt(mode);
3959 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3960 reply.readException();
3961 data.recycle();
3962 reply.recycle();
3963 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003964
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003965 public int checkGrantUriPermission(int callingUid, String targetPkg,
3966 Uri uri, int modeFlags) throws RemoteException {
3967 Parcel data = Parcel.obtain();
3968 Parcel reply = Parcel.obtain();
3969 data.writeInterfaceToken(IActivityManager.descriptor);
3970 data.writeInt(callingUid);
3971 data.writeString(targetPkg);
3972 uri.writeToParcel(data, 0);
3973 data.writeInt(modeFlags);
3974 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3975 reply.readException();
3976 int res = reply.readInt();
3977 data.recycle();
3978 reply.recycle();
3979 return res;
3980 }
3981
Dianne Hackborn1676c852012-09-10 14:52:30 -07003982 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003983 String path, ParcelFileDescriptor fd) throws RemoteException {
3984 Parcel data = Parcel.obtain();
3985 Parcel reply = Parcel.obtain();
3986 data.writeInterfaceToken(IActivityManager.descriptor);
3987 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003988 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003989 data.writeInt(managed ? 1 : 0);
3990 data.writeString(path);
3991 if (fd != null) {
3992 data.writeInt(1);
3993 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3994 } else {
3995 data.writeInt(0);
3996 }
3997 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3998 reply.readException();
3999 boolean res = reply.readInt() != 0;
4000 reply.recycle();
4001 data.recycle();
4002 return res;
4003 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004004
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004005 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004006 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004007 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004008 Parcel data = Parcel.obtain();
4009 Parcel reply = Parcel.obtain();
4010 data.writeInterfaceToken(IActivityManager.descriptor);
4011 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004012 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004013 data.writeTypedArray(intents, 0);
4014 data.writeStringArray(resolvedTypes);
4015 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004016 if (options != null) {
4017 data.writeInt(1);
4018 options.writeToParcel(data, 0);
4019 } else {
4020 data.writeInt(0);
4021 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004022 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004023 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4024 reply.readException();
4025 int result = reply.readInt();
4026 reply.recycle();
4027 data.recycle();
4028 return result;
4029 }
4030
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004031 public int getFrontActivityScreenCompatMode() throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4036 reply.readException();
4037 int mode = reply.readInt();
4038 reply.recycle();
4039 data.recycle();
4040 return mode;
4041 }
4042
4043 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4044 Parcel data = Parcel.obtain();
4045 Parcel reply = Parcel.obtain();
4046 data.writeInterfaceToken(IActivityManager.descriptor);
4047 data.writeInt(mode);
4048 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4049 reply.readException();
4050 reply.recycle();
4051 data.recycle();
4052 }
4053
4054 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4055 Parcel data = Parcel.obtain();
4056 Parcel reply = Parcel.obtain();
4057 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004058 data.writeString(packageName);
4059 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004060 reply.readException();
4061 int mode = reply.readInt();
4062 reply.recycle();
4063 data.recycle();
4064 return mode;
4065 }
4066
4067 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004068 throws RemoteException {
4069 Parcel data = Parcel.obtain();
4070 Parcel reply = Parcel.obtain();
4071 data.writeInterfaceToken(IActivityManager.descriptor);
4072 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004073 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004074 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4075 reply.readException();
4076 reply.recycle();
4077 data.recycle();
4078 }
4079
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004080 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4081 Parcel data = Parcel.obtain();
4082 Parcel reply = Parcel.obtain();
4083 data.writeInterfaceToken(IActivityManager.descriptor);
4084 data.writeString(packageName);
4085 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4086 reply.readException();
4087 boolean ask = reply.readInt() != 0;
4088 reply.recycle();
4089 data.recycle();
4090 return ask;
4091 }
4092
4093 public void setPackageAskScreenCompat(String packageName, boolean ask)
4094 throws RemoteException {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeString(packageName);
4099 data.writeInt(ask ? 1 : 0);
4100 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4101 reply.readException();
4102 reply.recycle();
4103 data.recycle();
4104 }
4105
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004106 public boolean switchUser(int userid) throws RemoteException {
4107 Parcel data = Parcel.obtain();
4108 Parcel reply = Parcel.obtain();
4109 data.writeInterfaceToken(IActivityManager.descriptor);
4110 data.writeInt(userid);
4111 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4112 reply.readException();
4113 boolean result = reply.readInt() != 0;
4114 reply.recycle();
4115 data.recycle();
4116 return result;
4117 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004118
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004119 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4120 Parcel data = Parcel.obtain();
4121 Parcel reply = Parcel.obtain();
4122 data.writeInterfaceToken(IActivityManager.descriptor);
4123 data.writeInt(userid);
4124 data.writeStrongInterface(callback);
4125 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4126 reply.readException();
4127 int result = reply.readInt();
4128 reply.recycle();
4129 data.recycle();
4130 return result;
4131 }
4132
Amith Yamasani52f1d752012-03-28 18:19:29 -07004133 public UserInfo getCurrentUser() throws RemoteException {
4134 Parcel data = Parcel.obtain();
4135 Parcel reply = Parcel.obtain();
4136 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004137 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004138 reply.readException();
4139 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4140 reply.recycle();
4141 data.recycle();
4142 return userInfo;
4143 }
4144
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004145 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004146 Parcel data = Parcel.obtain();
4147 Parcel reply = Parcel.obtain();
4148 data.writeInterfaceToken(IActivityManager.descriptor);
4149 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004150 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004151 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4152 reply.readException();
4153 boolean result = reply.readInt() != 0;
4154 reply.recycle();
4155 data.recycle();
4156 return result;
4157 }
4158
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004159 public int[] getRunningUserIds() throws RemoteException {
4160 Parcel data = Parcel.obtain();
4161 Parcel reply = Parcel.obtain();
4162 data.writeInterfaceToken(IActivityManager.descriptor);
4163 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4164 reply.readException();
4165 int[] result = reply.createIntArray();
4166 reply.recycle();
4167 data.recycle();
4168 return result;
4169 }
4170
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004171 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 data.writeInt(taskId);
4176 data.writeInt(subTaskIndex);
4177 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4178 reply.readException();
4179 boolean result = reply.readInt() != 0;
4180 reply.recycle();
4181 data.recycle();
4182 return result;
4183 }
4184
4185 public boolean removeTask(int taskId, int flags) throws RemoteException {
4186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 data.writeInt(taskId);
4190 data.writeInt(flags);
4191 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4192 reply.readException();
4193 boolean result = reply.readInt() != 0;
4194 reply.recycle();
4195 data.recycle();
4196 return result;
4197 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004198
Jeff Sharkeya4620792011-05-20 15:29:23 -07004199 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4200 Parcel data = Parcel.obtain();
4201 Parcel reply = Parcel.obtain();
4202 data.writeInterfaceToken(IActivityManager.descriptor);
4203 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4204 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4205 reply.readException();
4206 data.recycle();
4207 reply.recycle();
4208 }
4209
4210 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4211 Parcel data = Parcel.obtain();
4212 Parcel reply = Parcel.obtain();
4213 data.writeInterfaceToken(IActivityManager.descriptor);
4214 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4215 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4216 reply.readException();
4217 data.recycle();
4218 reply.recycle();
4219 }
4220
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004221 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4222 Parcel data = Parcel.obtain();
4223 Parcel reply = Parcel.obtain();
4224 data.writeInterfaceToken(IActivityManager.descriptor);
4225 data.writeStrongBinder(sender.asBinder());
4226 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4227 reply.readException();
4228 boolean res = reply.readInt() != 0;
4229 data.recycle();
4230 reply.recycle();
4231 return res;
4232 }
4233
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004234 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4235 Parcel data = Parcel.obtain();
4236 Parcel reply = Parcel.obtain();
4237 data.writeInterfaceToken(IActivityManager.descriptor);
4238 data.writeStrongBinder(sender.asBinder());
4239 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 boolean res = reply.readInt() != 0;
4242 data.recycle();
4243 reply.recycle();
4244 return res;
4245 }
4246
Dianne Hackborn81038902012-11-26 17:04:09 -08004247 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4248 Parcel data = Parcel.obtain();
4249 Parcel reply = Parcel.obtain();
4250 data.writeInterfaceToken(IActivityManager.descriptor);
4251 data.writeStrongBinder(sender.asBinder());
4252 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4253 reply.readException();
4254 Intent res = reply.readInt() != 0
4255 ? Intent.CREATOR.createFromParcel(reply) : null;
4256 data.recycle();
4257 reply.recycle();
4258 return res;
4259 }
4260
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004261 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4262 {
4263 Parcel data = Parcel.obtain();
4264 Parcel reply = Parcel.obtain();
4265 data.writeInterfaceToken(IActivityManager.descriptor);
4266 values.writeToParcel(data, 0);
4267 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4268 reply.readException();
4269 data.recycle();
4270 reply.recycle();
4271 }
4272
Dianne Hackbornb437e092011-08-05 17:50:29 -07004273 public long[] getProcessPss(int[] pids) throws RemoteException {
4274 Parcel data = Parcel.obtain();
4275 Parcel reply = Parcel.obtain();
4276 data.writeInterfaceToken(IActivityManager.descriptor);
4277 data.writeIntArray(pids);
4278 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4279 reply.readException();
4280 long[] res = reply.createLongArray();
4281 data.recycle();
4282 reply.recycle();
4283 return res;
4284 }
4285
Dianne Hackborn661cd522011-08-22 00:26:20 -07004286 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4287 Parcel data = Parcel.obtain();
4288 Parcel reply = Parcel.obtain();
4289 data.writeInterfaceToken(IActivityManager.descriptor);
4290 TextUtils.writeToParcel(msg, data, 0);
4291 data.writeInt(always ? 1 : 0);
4292 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4293 reply.readException();
4294 data.recycle();
4295 reply.recycle();
4296 }
4297
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004298 public void dismissKeyguardOnNextActivity() throws RemoteException {
4299 Parcel data = Parcel.obtain();
4300 Parcel reply = Parcel.obtain();
4301 data.writeInterfaceToken(IActivityManager.descriptor);
4302 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4303 reply.readException();
4304 data.recycle();
4305 reply.recycle();
4306 }
4307
Adam Powelldd8fab22012-03-22 17:47:27 -07004308 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4309 throws RemoteException {
4310 Parcel data = Parcel.obtain();
4311 Parcel reply = Parcel.obtain();
4312 data.writeInterfaceToken(IActivityManager.descriptor);
4313 data.writeStrongBinder(token);
4314 data.writeString(destAffinity);
4315 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4316 reply.readException();
4317 boolean result = reply.readInt() != 0;
4318 data.recycle();
4319 reply.recycle();
4320 return result;
4321 }
4322
4323 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4324 throws RemoteException {
4325 Parcel data = Parcel.obtain();
4326 Parcel reply = Parcel.obtain();
4327 data.writeInterfaceToken(IActivityManager.descriptor);
4328 data.writeStrongBinder(token);
4329 target.writeToParcel(data, 0);
4330 data.writeInt(resultCode);
4331 if (resultData != null) {
4332 data.writeInt(1);
4333 resultData.writeToParcel(data, 0);
4334 } else {
4335 data.writeInt(0);
4336 }
4337 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4338 reply.readException();
4339 boolean result = reply.readInt() != 0;
4340 data.recycle();
4341 reply.recycle();
4342 return result;
4343 }
4344
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004345 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4346 Parcel data = Parcel.obtain();
4347 Parcel reply = Parcel.obtain();
4348 data.writeInterfaceToken(IActivityManager.descriptor);
4349 data.writeStrongBinder(activityToken);
4350 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4351 reply.readException();
4352 int result = reply.readInt();
4353 data.recycle();
4354 reply.recycle();
4355 return result;
4356 }
4357
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004358 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4359 Parcel data = Parcel.obtain();
4360 Parcel reply = Parcel.obtain();
4361 data.writeInterfaceToken(IActivityManager.descriptor);
4362 data.writeStrongBinder(activityToken);
4363 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4364 reply.readException();
4365 String result = reply.readString();
4366 data.recycle();
4367 reply.recycle();
4368 return result;
4369 }
4370
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004371 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4372 Parcel data = Parcel.obtain();
4373 Parcel reply = Parcel.obtain();
4374 data.writeInterfaceToken(IActivityManager.descriptor);
4375 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4376 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 data.recycle();
4379 reply.recycle();
4380 }
4381
4382 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4387 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4388 reply.readException();
4389 data.recycle();
4390 reply.recycle();
4391 }
4392
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004393 public void requestBugReport() throws RemoteException {
4394 Parcel data = Parcel.obtain();
4395 Parcel reply = Parcel.obtain();
4396 data.writeInterfaceToken(IActivityManager.descriptor);
4397 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4398 reply.readException();
4399 data.recycle();
4400 reply.recycle();
4401 }
4402
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004403 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4404 Parcel data = Parcel.obtain();
4405 Parcel reply = Parcel.obtain();
4406 data.writeInterfaceToken(IActivityManager.descriptor);
4407 data.writeInt(pid);
4408 data.writeInt(aboveSystem ? 1 : 0);
4409 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4410 reply.readException();
4411 long res = reply.readInt();
4412 data.recycle();
4413 reply.recycle();
4414 return res;
4415 }
4416
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004417 public Bundle getTopActivityExtras(int requestType) throws RemoteException {
4418 Parcel data = Parcel.obtain();
4419 Parcel reply = Parcel.obtain();
4420 data.writeInterfaceToken(IActivityManager.descriptor);
4421 data.writeInt(requestType);
4422 mRemote.transact(GET_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4423 reply.readException();
4424 Bundle res = reply.readBundle();
4425 data.recycle();
4426 reply.recycle();
4427 return res;
4428 }
4429
4430 public void reportTopActivityExtras(IBinder token, Bundle extras) throws RemoteException {
4431 Parcel data = Parcel.obtain();
4432 Parcel reply = Parcel.obtain();
4433 data.writeInterfaceToken(IActivityManager.descriptor);
4434 data.writeStrongBinder(token);
4435 data.writeBundle(extras);
4436 mRemote.transact(REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4437 reply.readException();
4438 data.recycle();
4439 reply.recycle();
4440 }
4441
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004442 public void killUid(int uid, String reason) throws RemoteException {
4443 Parcel data = Parcel.obtain();
4444 Parcel reply = Parcel.obtain();
4445 data.writeInterfaceToken(IActivityManager.descriptor);
4446 data.writeInt(uid);
4447 data.writeString(reason);
4448 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4449 reply.readException();
4450 data.recycle();
4451 reply.recycle();
4452 }
4453
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004454 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4455 Parcel data = Parcel.obtain();
4456 Parcel reply = Parcel.obtain();
4457 data.writeInterfaceToken(IActivityManager.descriptor);
4458 data.writeStrongBinder(who);
4459 data.writeInt(allowRestart ? 1 : 0);
4460 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4461 reply.readException();
4462 data.recycle();
4463 reply.recycle();
4464 }
4465
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004466 private IBinder mRemote;
4467}