blob: acfcb408556c922a8189ef39e1b18abe658827ab [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautner5ff12102013-05-24 12:50:15 -070019import android.app.ActivityManager.StackBoxInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070026import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.content.pm.ConfigurationInfo;
28import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070029import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.res.Configuration;
31import android.graphics.Bitmap;
32import android.net.Uri;
33import android.os.Binder;
34import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070035import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.os.IBinder;
37import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070038import android.os.ParcelFileDescriptor;
39import android.os.Parcelable;
40import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070042import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080045import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.ArrayList;
48import java.util.List;
49
50/** {@hide} */
51public abstract class ActivityManagerNative extends Binder implements IActivityManager
52{
53 /**
54 * Cast a Binder object into an activity manager interface, generating
55 * a proxy if needed.
56 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080057 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 if (obj == null) {
59 return null;
60 }
61 IActivityManager in =
62 (IActivityManager)obj.queryLocalInterface(descriptor);
63 if (in != null) {
64 return in;
65 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 return new ActivityManagerProxy(obj);
68 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 /**
71 * Retrieve the system's default/global activity manager.
72 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080073 static public IActivityManager getDefault() {
74 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 }
76
77 /**
78 * Convenience for checking whether the system is ready. For internal use only.
79 */
80 static public boolean isSystemReady() {
81 if (!sSystemReady) {
82 sSystemReady = getDefault().testIsSystemReady();
83 }
84 return sSystemReady;
85 }
86 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 /**
89 * Convenience for sending a sticky broadcast. For internal use only.
90 * If you don't care about permission, use null.
91 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070092 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 try {
94 getDefault().broadcastIntent(
95 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -080096 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 } catch (RemoteException ex) {
98 }
99 }
100
101 static public void noteWakeupAlarm(PendingIntent ps) {
102 try {
103 getDefault().noteWakeupAlarm(ps.getTarget());
104 } catch (RemoteException ex) {
105 }
106 }
107
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800108 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 attachInterface(this, descriptor);
110 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700111
112 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
114 throws RemoteException {
115 switch (code) {
116 case START_ACTIVITY_TRANSACTION:
117 {
118 data.enforceInterface(IActivityManager.descriptor);
119 IBinder b = data.readStrongBinder();
120 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800121 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 Intent intent = Intent.CREATOR.createFromParcel(data);
123 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800125 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700127 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700128 String profileFile = data.readString();
129 ParcelFileDescriptor profileFd = data.readInt() != 0
130 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700131 Bundle options = data.readInt() != 0
132 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800133 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700134 resultTo, resultWho, requestCode, startFlags,
135 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 reply.writeNoException();
137 reply.writeInt(result);
138 return true;
139 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700140
Amith Yamasani82644082012-08-03 13:09:11 -0700141 case START_ACTIVITY_AS_USER_TRANSACTION:
142 {
143 data.enforceInterface(IActivityManager.descriptor);
144 IBinder b = data.readStrongBinder();
145 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800146 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700147 Intent intent = Intent.CREATOR.createFromParcel(data);
148 String resolvedType = data.readString();
149 IBinder resultTo = data.readStrongBinder();
150 String resultWho = data.readString();
151 int requestCode = data.readInt();
152 int startFlags = data.readInt();
153 String profileFile = data.readString();
154 ParcelFileDescriptor profileFd = data.readInt() != 0
155 ? data.readFileDescriptor() : null;
156 Bundle options = data.readInt() != 0
157 ? Bundle.CREATOR.createFromParcel(data) : null;
158 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800159 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700160 resultTo, resultWho, requestCode, startFlags,
161 profileFile, profileFd, options, userId);
162 reply.writeNoException();
163 reply.writeInt(result);
164 return true;
165 }
166
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800167 case START_ACTIVITY_AND_WAIT_TRANSACTION:
168 {
169 data.enforceInterface(IActivityManager.descriptor);
170 IBinder b = data.readStrongBinder();
171 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800172 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 Intent intent = Intent.CREATOR.createFromParcel(data);
174 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800175 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800176 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800177 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700178 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700179 String profileFile = data.readString();
180 ParcelFileDescriptor profileFd = data.readInt() != 0
181 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700182 Bundle options = data.readInt() != 0
183 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700184 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800185 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700186 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700187 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800188 reply.writeNoException();
189 result.writeToParcel(reply, 0);
190 return true;
191 }
192
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700193 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
194 {
195 data.enforceInterface(IActivityManager.descriptor);
196 IBinder b = data.readStrongBinder();
197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800198 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 Intent intent = Intent.CREATOR.createFromParcel(data);
200 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700201 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700202 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700204 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700206 Bundle options = data.readInt() != 0
207 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700208 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800209 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700210 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700211 reply.writeNoException();
212 reply.writeInt(result);
213 return true;
214 }
215
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700216 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700217 {
218 data.enforceInterface(IActivityManager.descriptor);
219 IBinder b = data.readStrongBinder();
220 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700221 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700222 Intent fillInIntent = null;
223 if (data.readInt() != 0) {
224 fillInIntent = Intent.CREATOR.createFromParcel(data);
225 }
226 String resolvedType = data.readString();
227 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700228 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700229 int requestCode = data.readInt();
230 int flagsMask = data.readInt();
231 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700232 Bundle options = data.readInt() != 0
233 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700234 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700236 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700237 reply.writeNoException();
238 reply.writeInt(result);
239 return true;
240 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700241
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
243 {
244 data.enforceInterface(IActivityManager.descriptor);
245 IBinder callingActivity = data.readStrongBinder();
246 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700247 Bundle options = data.readInt() != 0
248 ? Bundle.CREATOR.createFromParcel(data) : null;
249 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 reply.writeNoException();
251 reply.writeInt(result ? 1 : 0);
252 return true;
253 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 case FINISH_ACTIVITY_TRANSACTION: {
256 data.enforceInterface(IActivityManager.descriptor);
257 IBinder token = data.readStrongBinder();
258 Intent resultData = null;
259 int resultCode = data.readInt();
260 if (data.readInt() != 0) {
261 resultData = Intent.CREATOR.createFromParcel(data);
262 }
263 boolean res = finishActivity(token, resultCode, resultData);
264 reply.writeNoException();
265 reply.writeInt(res ? 1 : 0);
266 return true;
267 }
268
269 case FINISH_SUB_ACTIVITY_TRANSACTION: {
270 data.enforceInterface(IActivityManager.descriptor);
271 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700272 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800273 int requestCode = data.readInt();
274 finishSubActivity(token, resultWho, requestCode);
275 reply.writeNoException();
276 return true;
277 }
278
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700279 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
280 data.enforceInterface(IActivityManager.descriptor);
281 IBinder token = data.readStrongBinder();
282 boolean res = finishActivityAffinity(token);
283 reply.writeNoException();
284 reply.writeInt(res ? 1 : 0);
285 return true;
286 }
287
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800288 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder token = data.readStrongBinder();
291 boolean res = willActivityBeVisible(token);
292 reply.writeNoException();
293 reply.writeInt(res ? 1 : 0);
294 return true;
295 }
296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 case REGISTER_RECEIVER_TRANSACTION:
298 {
299 data.enforceInterface(IActivityManager.descriptor);
300 IBinder b = data.readStrongBinder();
301 IApplicationThread app =
302 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700303 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800304 b = data.readStrongBinder();
305 IIntentReceiver rec
306 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
307 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
308 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700309 int userId = data.readInt();
310 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311 reply.writeNoException();
312 if (intent != null) {
313 reply.writeInt(1);
314 intent.writeToParcel(reply, 0);
315 } else {
316 reply.writeInt(0);
317 }
318 return true;
319 }
320
321 case UNREGISTER_RECEIVER_TRANSACTION:
322 {
323 data.enforceInterface(IActivityManager.descriptor);
324 IBinder b = data.readStrongBinder();
325 if (b == null) {
326 return true;
327 }
328 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
329 unregisterReceiver(rec);
330 reply.writeNoException();
331 return true;
332 }
333
334 case BROADCAST_INTENT_TRANSACTION:
335 {
336 data.enforceInterface(IActivityManager.descriptor);
337 IBinder b = data.readStrongBinder();
338 IApplicationThread app =
339 b != null ? ApplicationThreadNative.asInterface(b) : null;
340 Intent intent = Intent.CREATOR.createFromParcel(data);
341 String resolvedType = data.readString();
342 b = data.readStrongBinder();
343 IIntentReceiver resultTo =
344 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
345 int resultCode = data.readInt();
346 String resultData = data.readString();
347 Bundle resultExtras = data.readBundle();
348 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800349 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 boolean serialized = data.readInt() != 0;
351 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700352 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800354 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700355 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800356 reply.writeNoException();
357 reply.writeInt(res);
358 return true;
359 }
360
361 case UNBROADCAST_INTENT_TRANSACTION:
362 {
363 data.enforceInterface(IActivityManager.descriptor);
364 IBinder b = data.readStrongBinder();
365 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
366 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700367 int userId = data.readInt();
368 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800369 reply.writeNoException();
370 return true;
371 }
372
373 case FINISH_RECEIVER_TRANSACTION: {
374 data.enforceInterface(IActivityManager.descriptor);
375 IBinder who = data.readStrongBinder();
376 int resultCode = data.readInt();
377 String resultData = data.readString();
378 Bundle resultExtras = data.readBundle();
379 boolean resultAbort = data.readInt() != 0;
380 if (who != null) {
381 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
382 }
383 reply.writeNoException();
384 return true;
385 }
386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 case ATTACH_APPLICATION_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IApplicationThread app = ApplicationThreadNative.asInterface(
390 data.readStrongBinder());
391 if (app != null) {
392 attachApplication(app);
393 }
394 reply.writeNoException();
395 return true;
396 }
397
398 case ACTIVITY_IDLE_TRANSACTION: {
399 data.enforceInterface(IActivityManager.descriptor);
400 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700401 Configuration config = null;
402 if (data.readInt() != 0) {
403 config = Configuration.CREATOR.createFromParcel(data);
404 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700405 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700407 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800408 }
409 reply.writeNoException();
410 return true;
411 }
412
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700413 case ACTIVITY_RESUMED_TRANSACTION: {
414 data.enforceInterface(IActivityManager.descriptor);
415 IBinder token = data.readStrongBinder();
416 activityResumed(token);
417 reply.writeNoException();
418 return true;
419 }
420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 case ACTIVITY_PAUSED_TRANSACTION: {
422 data.enforceInterface(IActivityManager.descriptor);
423 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800424 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800425 reply.writeNoException();
426 return true;
427 }
428
429 case ACTIVITY_STOPPED_TRANSACTION: {
430 data.enforceInterface(IActivityManager.descriptor);
431 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800432 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 Bitmap thumbnail = data.readInt() != 0
434 ? Bitmap.CREATOR.createFromParcel(data) : null;
435 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800436 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800437 reply.writeNoException();
438 return true;
439 }
440
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800441 case ACTIVITY_SLEPT_TRANSACTION: {
442 data.enforceInterface(IActivityManager.descriptor);
443 IBinder token = data.readStrongBinder();
444 activitySlept(token);
445 reply.writeNoException();
446 return true;
447 }
448
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 case ACTIVITY_DESTROYED_TRANSACTION: {
450 data.enforceInterface(IActivityManager.descriptor);
451 IBinder token = data.readStrongBinder();
452 activityDestroyed(token);
453 reply.writeNoException();
454 return true;
455 }
456
457 case GET_CALLING_PACKAGE_TRANSACTION: {
458 data.enforceInterface(IActivityManager.descriptor);
459 IBinder token = data.readStrongBinder();
460 String res = token != null ? getCallingPackage(token) : null;
461 reply.writeNoException();
462 reply.writeString(res);
463 return true;
464 }
465
466 case GET_CALLING_ACTIVITY_TRANSACTION: {
467 data.enforceInterface(IActivityManager.descriptor);
468 IBinder token = data.readStrongBinder();
469 ComponentName cn = getCallingActivity(token);
470 reply.writeNoException();
471 ComponentName.writeToParcel(cn, reply);
472 return true;
473 }
474
475 case GET_TASKS_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 int maxNum = data.readInt();
478 int fl = data.readInt();
479 IBinder receiverBinder = data.readStrongBinder();
480 IThumbnailReceiver receiver = receiverBinder != null
481 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
482 : null;
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700483 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl, receiver);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800484 reply.writeNoException();
485 int N = list != null ? list.size() : -1;
486 reply.writeInt(N);
487 int i;
488 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700489 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800490 info.writeToParcel(reply, 0);
491 }
492 return true;
493 }
494
495 case GET_RECENT_TASKS_TRANSACTION: {
496 data.enforceInterface(IActivityManager.descriptor);
497 int maxNum = data.readInt();
498 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700499 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700501 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 reply.writeNoException();
503 reply.writeTypedList(list);
504 return true;
505 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700506
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700507 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800508 data.enforceInterface(IActivityManager.descriptor);
509 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700510 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800511 reply.writeNoException();
512 if (bm != null) {
513 reply.writeInt(1);
514 bm.writeToParcel(reply, 0);
515 } else {
516 reply.writeInt(0);
517 }
518 return true;
519 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700520
521 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
522 data.enforceInterface(IActivityManager.descriptor);
523 int id = data.readInt();
524 Bitmap bm = getTaskTopThumbnail(id);
525 reply.writeNoException();
526 if (bm != null) {
527 reply.writeInt(1);
528 bm.writeToParcel(reply, 0);
529 } else {
530 reply.writeInt(0);
531 }
532 return true;
533 }
534
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800535 case GET_SERVICES_TRANSACTION: {
536 data.enforceInterface(IActivityManager.descriptor);
537 int maxNum = data.readInt();
538 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700539 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 reply.writeNoException();
541 int N = list != null ? list.size() : -1;
542 reply.writeInt(N);
543 int i;
544 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700545 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 info.writeToParcel(reply, 0);
547 }
548 return true;
549 }
550
551 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
552 data.enforceInterface(IActivityManager.descriptor);
553 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
554 reply.writeNoException();
555 reply.writeTypedList(list);
556 return true;
557 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700558
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800559 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
560 data.enforceInterface(IActivityManager.descriptor);
561 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
562 reply.writeNoException();
563 reply.writeTypedList(list);
564 return true;
565 }
566
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700567 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 List<ApplicationInfo> list = getRunningExternalApplications();
570 reply.writeNoException();
571 reply.writeTypedList(list);
572 return true;
573 }
574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 case MOVE_TASK_TO_FRONT_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800578 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700579 Bundle options = data.readInt() != 0
580 ? Bundle.CREATOR.createFromParcel(data) : null;
581 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 reply.writeNoException();
583 return true;
584 }
585
586 case MOVE_TASK_TO_BACK_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 int task = data.readInt();
589 moveTaskToBack(task);
590 reply.writeNoException();
591 return true;
592 }
593
594 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder token = data.readStrongBinder();
597 boolean nonRoot = data.readInt() != 0;
598 boolean res = moveActivityTaskToBack(token, nonRoot);
599 reply.writeNoException();
600 reply.writeInt(res ? 1 : 0);
601 return true;
602 }
603
604 case MOVE_TASK_BACKWARDS_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 int task = data.readInt();
607 moveTaskBackwards(task);
608 reply.writeNoException();
609 return true;
610 }
611
Craig Mautnerc00204b2013-03-05 15:02:14 -0800612 case CREATE_STACK_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700614 int taskId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800615 int relativeStackId = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700616 int position = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800617 float weight = data.readFloat();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700618 int res = createStack(taskId, relativeStackId, position, weight);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800619 reply.writeNoException();
620 reply.writeInt(res);
621 return true;
622 }
623
624 case MOVE_TASK_TO_STACK_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 int taskId = data.readInt();
627 int stackId = data.readInt();
628 boolean toTop = data.readInt() != 0;
629 moveTaskToStack(taskId, stackId, toTop);
630 reply.writeNoException();
631 return true;
632 }
633
634 case RESIZE_STACK_TRANSACTION: {
635 data.enforceInterface(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -0700636 int stackBoxId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800637 float weight = data.readFloat();
Craig Mautner5a449152013-05-24 15:49:29 -0700638 resizeStackBox(stackBoxId, weight);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800639 reply.writeNoException();
640 return true;
641 }
642
Craig Mautner5ff12102013-05-24 12:50:15 -0700643 case GET_STACK_BOXES_TRANSACTION: {
644 data.enforceInterface(IActivityManager.descriptor);
645 List<StackBoxInfo> list = getStackBoxes();
646 reply.writeNoException();
647 reply.writeTypedList(list);
648 return true;
649 }
650
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700651 case GET_STACK_BOX_INFO_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 int stackBoxId = data.readInt();
654 StackBoxInfo info = getStackBoxInfo(stackBoxId);
655 reply.writeNoException();
656 if (info != null) {
657 reply.writeInt(1);
658 info.writeToParcel(reply, 0);
659 } else {
660 reply.writeInt(0);
661 }
662 return true;
663 }
664
Craig Mautnercf910b02013-04-23 11:23:27 -0700665 case SET_FOCUSED_STACK_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 int stackId = data.readInt();
668 setFocusedStack(stackId);
669 reply.writeNoException();
670 return true;
671 }
672
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 IBinder token = data.readStrongBinder();
676 boolean onlyRoot = data.readInt() != 0;
677 int res = token != null
678 ? getTaskForActivity(token, onlyRoot) : -1;
679 reply.writeNoException();
680 reply.writeInt(res);
681 return true;
682 }
683
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 case REPORT_THUMBNAIL_TRANSACTION: {
685 data.enforceInterface(IActivityManager.descriptor);
686 IBinder token = data.readStrongBinder();
687 Bitmap thumbnail = data.readInt() != 0
688 ? Bitmap.CREATOR.createFromParcel(data) : null;
689 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
690 reportThumbnail(token, thumbnail, description);
691 reply.writeNoException();
692 return true;
693 }
694
695 case GET_CONTENT_PROVIDER_TRANSACTION: {
696 data.enforceInterface(IActivityManager.descriptor);
697 IBinder b = data.readStrongBinder();
698 IApplicationThread app = ApplicationThreadNative.asInterface(b);
699 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700700 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700701 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700702 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 reply.writeNoException();
704 if (cph != null) {
705 reply.writeInt(1);
706 cph.writeToParcel(reply, 0);
707 } else {
708 reply.writeInt(0);
709 }
710 return true;
711 }
712
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800713 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
714 data.enforceInterface(IActivityManager.descriptor);
715 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700716 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800717 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700718 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800719 reply.writeNoException();
720 if (cph != null) {
721 reply.writeInt(1);
722 cph.writeToParcel(reply, 0);
723 } else {
724 reply.writeInt(0);
725 }
726 return true;
727 }
728
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
730 data.enforceInterface(IActivityManager.descriptor);
731 IBinder b = data.readStrongBinder();
732 IApplicationThread app = ApplicationThreadNative.asInterface(b);
733 ArrayList<ContentProviderHolder> providers =
734 data.createTypedArrayList(ContentProviderHolder.CREATOR);
735 publishContentProviders(app, providers);
736 reply.writeNoException();
737 return true;
738 }
739
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700740 case REF_CONTENT_PROVIDER_TRANSACTION: {
741 data.enforceInterface(IActivityManager.descriptor);
742 IBinder b = data.readStrongBinder();
743 int stable = data.readInt();
744 int unstable = data.readInt();
745 boolean res = refContentProvider(b, stable, unstable);
746 reply.writeNoException();
747 reply.writeInt(res ? 1 : 0);
748 return true;
749 }
750
751 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
752 data.enforceInterface(IActivityManager.descriptor);
753 IBinder b = data.readStrongBinder();
754 unstableProviderDied(b);
755 reply.writeNoException();
756 return true;
757 }
758
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800759 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
760 data.enforceInterface(IActivityManager.descriptor);
761 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700762 boolean stable = data.readInt() != 0;
763 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 reply.writeNoException();
765 return true;
766 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800767
768 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 String name = data.readString();
771 IBinder token = data.readStrongBinder();
772 removeContentProviderExternal(name, token);
773 reply.writeNoException();
774 return true;
775 }
776
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700777 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
780 PendingIntent pi = getRunningServiceControlPanel(comp);
781 reply.writeNoException();
782 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
783 return true;
784 }
785
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 case START_SERVICE_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 IBinder b = data.readStrongBinder();
789 IApplicationThread app = ApplicationThreadNative.asInterface(b);
790 Intent service = Intent.CREATOR.createFromParcel(data);
791 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700792 int userId = data.readInt();
793 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794 reply.writeNoException();
795 ComponentName.writeToParcel(cn, reply);
796 return true;
797 }
798
799 case STOP_SERVICE_TRANSACTION: {
800 data.enforceInterface(IActivityManager.descriptor);
801 IBinder b = data.readStrongBinder();
802 IApplicationThread app = ApplicationThreadNative.asInterface(b);
803 Intent service = Intent.CREATOR.createFromParcel(data);
804 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700805 int userId = data.readInt();
806 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800807 reply.writeNoException();
808 reply.writeInt(res);
809 return true;
810 }
811
812 case STOP_SERVICE_TOKEN_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 ComponentName className = ComponentName.readFromParcel(data);
815 IBinder token = data.readStrongBinder();
816 int startId = data.readInt();
817 boolean res = stopServiceToken(className, token, startId);
818 reply.writeNoException();
819 reply.writeInt(res ? 1 : 0);
820 return true;
821 }
822
823 case SET_SERVICE_FOREGROUND_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 ComponentName className = ComponentName.readFromParcel(data);
826 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700827 int id = data.readInt();
828 Notification notification = null;
829 if (data.readInt() != 0) {
830 notification = Notification.CREATOR.createFromParcel(data);
831 }
832 boolean removeNotification = data.readInt() != 0;
833 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800834 reply.writeNoException();
835 return true;
836 }
837
838 case BIND_SERVICE_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 IBinder b = data.readStrongBinder();
841 IApplicationThread app = ApplicationThreadNative.asInterface(b);
842 IBinder token = data.readStrongBinder();
843 Intent service = Intent.CREATOR.createFromParcel(data);
844 String resolvedType = data.readString();
845 b = data.readStrongBinder();
846 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800847 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800848 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800849 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800850 reply.writeNoException();
851 reply.writeInt(res);
852 return true;
853 }
854
855 case UNBIND_SERVICE_TRANSACTION: {
856 data.enforceInterface(IActivityManager.descriptor);
857 IBinder b = data.readStrongBinder();
858 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
859 boolean res = unbindService(conn);
860 reply.writeNoException();
861 reply.writeInt(res ? 1 : 0);
862 return true;
863 }
864
865 case PUBLISH_SERVICE_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 IBinder token = data.readStrongBinder();
868 Intent intent = Intent.CREATOR.createFromParcel(data);
869 IBinder service = data.readStrongBinder();
870 publishService(token, intent, service);
871 reply.writeNoException();
872 return true;
873 }
874
875 case UNBIND_FINISHED_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 IBinder token = data.readStrongBinder();
878 Intent intent = Intent.CREATOR.createFromParcel(data);
879 boolean doRebind = data.readInt() != 0;
880 unbindFinished(token, intent, doRebind);
881 reply.writeNoException();
882 return true;
883 }
884
885 case SERVICE_DONE_EXECUTING_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700888 int type = data.readInt();
889 int startId = data.readInt();
890 int res = data.readInt();
891 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 reply.writeNoException();
893 return true;
894 }
895
896 case START_INSTRUMENTATION_TRANSACTION: {
897 data.enforceInterface(IActivityManager.descriptor);
898 ComponentName className = ComponentName.readFromParcel(data);
899 String profileFile = data.readString();
900 int fl = data.readInt();
901 Bundle arguments = data.readBundle();
902 IBinder b = data.readStrongBinder();
903 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800904 b = data.readStrongBinder();
905 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700906 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800907 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeInt(res ? 1 : 0);
910 return true;
911 }
912
913
914 case FINISH_INSTRUMENTATION_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 IBinder b = data.readStrongBinder();
917 IApplicationThread app = ApplicationThreadNative.asInterface(b);
918 int resultCode = data.readInt();
919 Bundle results = data.readBundle();
920 finishInstrumentation(app, resultCode, results);
921 reply.writeNoException();
922 return true;
923 }
924
925 case GET_CONFIGURATION_TRANSACTION: {
926 data.enforceInterface(IActivityManager.descriptor);
927 Configuration config = getConfiguration();
928 reply.writeNoException();
929 config.writeToParcel(reply, 0);
930 return true;
931 }
932
933 case UPDATE_CONFIGURATION_TRANSACTION: {
934 data.enforceInterface(IActivityManager.descriptor);
935 Configuration config = Configuration.CREATOR.createFromParcel(data);
936 updateConfiguration(config);
937 reply.writeNoException();
938 return true;
939 }
940
941 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 IBinder token = data.readStrongBinder();
944 int requestedOrientation = data.readInt();
945 setRequestedOrientation(token, requestedOrientation);
946 reply.writeNoException();
947 return true;
948 }
949
950 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder token = data.readStrongBinder();
953 int req = getRequestedOrientation(token);
954 reply.writeNoException();
955 reply.writeInt(req);
956 return true;
957 }
958
959 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
960 data.enforceInterface(IActivityManager.descriptor);
961 IBinder token = data.readStrongBinder();
962 ComponentName cn = getActivityClassForToken(token);
963 reply.writeNoException();
964 ComponentName.writeToParcel(cn, reply);
965 return true;
966 }
967
968 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder token = data.readStrongBinder();
971 reply.writeNoException();
972 reply.writeString(getPackageForToken(token));
973 return true;
974 }
975
976 case GET_INTENT_SENDER_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 int type = data.readInt();
979 String packageName = data.readString();
980 IBinder token = data.readStrongBinder();
981 String resultWho = data.readString();
982 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800983 Intent[] requestIntents;
984 String[] requestResolvedTypes;
985 if (data.readInt() != 0) {
986 requestIntents = data.createTypedArray(Intent.CREATOR);
987 requestResolvedTypes = data.createStringArray();
988 } else {
989 requestIntents = null;
990 requestResolvedTypes = null;
991 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700993 Bundle options = data.readInt() != 0
994 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700995 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800996 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800997 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700998 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 reply.writeNoException();
1000 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1001 return true;
1002 }
1003
1004 case CANCEL_INTENT_SENDER_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IIntentSender r = IIntentSender.Stub.asInterface(
1007 data.readStrongBinder());
1008 cancelIntentSender(r);
1009 reply.writeNoException();
1010 return true;
1011 }
1012
1013 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 IIntentSender r = IIntentSender.Stub.asInterface(
1016 data.readStrongBinder());
1017 String res = getPackageForIntentSender(r);
1018 reply.writeNoException();
1019 reply.writeString(res);
1020 return true;
1021 }
1022
Christopher Tatec4a07d12012-04-06 14:19:13 -07001023 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1024 data.enforceInterface(IActivityManager.descriptor);
1025 IIntentSender r = IIntentSender.Stub.asInterface(
1026 data.readStrongBinder());
1027 int res = getUidForIntentSender(r);
1028 reply.writeNoException();
1029 reply.writeInt(res);
1030 return true;
1031 }
1032
Dianne Hackborn41203752012-08-31 14:05:51 -07001033 case HANDLE_INCOMING_USER_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 int callingPid = data.readInt();
1036 int callingUid = data.readInt();
1037 int userId = data.readInt();
1038 boolean allowAll = data.readInt() != 0 ;
1039 boolean requireFull = data.readInt() != 0;
1040 String name = data.readString();
1041 String callerPackage = data.readString();
1042 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1043 requireFull, name, callerPackage);
1044 reply.writeNoException();
1045 reply.writeInt(res);
1046 return true;
1047 }
1048
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001049 case SET_PROCESS_LIMIT_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 int max = data.readInt();
1052 setProcessLimit(max);
1053 reply.writeNoException();
1054 return true;
1055 }
1056
1057 case GET_PROCESS_LIMIT_TRANSACTION: {
1058 data.enforceInterface(IActivityManager.descriptor);
1059 int limit = getProcessLimit();
1060 reply.writeNoException();
1061 reply.writeInt(limit);
1062 return true;
1063 }
1064
1065 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 IBinder token = data.readStrongBinder();
1068 int pid = data.readInt();
1069 boolean isForeground = data.readInt() != 0;
1070 setProcessForeground(token, pid, isForeground);
1071 reply.writeNoException();
1072 return true;
1073 }
1074
1075 case CHECK_PERMISSION_TRANSACTION: {
1076 data.enforceInterface(IActivityManager.descriptor);
1077 String perm = data.readString();
1078 int pid = data.readInt();
1079 int uid = data.readInt();
1080 int res = checkPermission(perm, pid, uid);
1081 reply.writeNoException();
1082 reply.writeInt(res);
1083 return true;
1084 }
1085
1086 case CHECK_URI_PERMISSION_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 Uri uri = Uri.CREATOR.createFromParcel(data);
1089 int pid = data.readInt();
1090 int uid = data.readInt();
1091 int mode = data.readInt();
1092 int res = checkUriPermission(uri, pid, uid, mode);
1093 reply.writeNoException();
1094 reply.writeInt(res);
1095 return true;
1096 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001097
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001099 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 String packageName = data.readString();
1101 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1102 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001103 int userId = data.readInt();
1104 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001105 reply.writeNoException();
1106 reply.writeInt(res ? 1 : 0);
1107 return true;
1108 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110 case GRANT_URI_PERMISSION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 IBinder b = data.readStrongBinder();
1113 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1114 String targetPkg = data.readString();
1115 Uri uri = Uri.CREATOR.createFromParcel(data);
1116 int mode = data.readInt();
1117 grantUriPermission(app, targetPkg, uri, mode);
1118 reply.writeNoException();
1119 return true;
1120 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001121
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 case REVOKE_URI_PERMISSION_TRANSACTION: {
1123 data.enforceInterface(IActivityManager.descriptor);
1124 IBinder b = data.readStrongBinder();
1125 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1126 Uri uri = Uri.CREATOR.createFromParcel(data);
1127 int mode = data.readInt();
1128 revokeUriPermission(app, uri, mode);
1129 reply.writeNoException();
1130 return true;
1131 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 IBinder b = data.readStrongBinder();
1136 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1137 boolean waiting = data.readInt() != 0;
1138 showWaitingForDebugger(app, waiting);
1139 reply.writeNoException();
1140 return true;
1141 }
1142
1143 case GET_MEMORY_INFO_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1146 getMemoryInfo(mi);
1147 reply.writeNoException();
1148 mi.writeToParcel(reply, 0);
1149 return true;
1150 }
1151
1152 case UNHANDLED_BACK_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 unhandledBack();
1155 reply.writeNoException();
1156 return true;
1157 }
1158
1159 case OPEN_CONTENT_URI_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 Uri uri = Uri.parse(data.readString());
1162 ParcelFileDescriptor pfd = openContentUri(uri);
1163 reply.writeNoException();
1164 if (pfd != null) {
1165 reply.writeInt(1);
1166 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1167 } else {
1168 reply.writeInt(0);
1169 }
1170 return true;
1171 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001172
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 case GOING_TO_SLEEP_TRANSACTION: {
1174 data.enforceInterface(IActivityManager.descriptor);
1175 goingToSleep();
1176 reply.writeNoException();
1177 return true;
1178 }
1179
1180 case WAKING_UP_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 wakingUp();
1183 reply.writeNoException();
1184 return true;
1185 }
1186
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001187 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 setLockScreenShown(data.readInt() != 0);
1190 reply.writeNoException();
1191 return true;
1192 }
1193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 case SET_DEBUG_APP_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 String pn = data.readString();
1197 boolean wfd = data.readInt() != 0;
1198 boolean per = data.readInt() != 0;
1199 setDebugApp(pn, wfd, per);
1200 reply.writeNoException();
1201 return true;
1202 }
1203
1204 case SET_ALWAYS_FINISH_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 boolean enabled = data.readInt() != 0;
1207 setAlwaysFinish(enabled);
1208 reply.writeNoException();
1209 return true;
1210 }
1211
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001212 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001214 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001216 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001217 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 return true;
1219 }
1220
1221 case ENTER_SAFE_MODE_TRANSACTION: {
1222 data.enforceInterface(IActivityManager.descriptor);
1223 enterSafeMode();
1224 reply.writeNoException();
1225 return true;
1226 }
1227
1228 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 IIntentSender is = IIntentSender.Stub.asInterface(
1231 data.readStrongBinder());
1232 noteWakeupAlarm(is);
1233 reply.writeNoException();
1234 return true;
1235 }
1236
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001237 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 data.enforceInterface(IActivityManager.descriptor);
1239 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001240 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001241 boolean secure = data.readInt() != 0;
1242 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001243 reply.writeNoException();
1244 reply.writeInt(res ? 1 : 0);
1245 return true;
1246 }
1247
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001248 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 String reason = data.readString();
1251 boolean res = killProcessesBelowForeground(reason);
1252 reply.writeNoException();
1253 reply.writeInt(res ? 1 : 0);
1254 return true;
1255 }
1256
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 case START_RUNNING_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 String pkg = data.readString();
1260 String cls = data.readString();
1261 String action = data.readString();
1262 String indata = data.readString();
1263 startRunning(pkg, cls, action, indata);
1264 reply.writeNoException();
1265 return true;
1266 }
1267
Dan Egnor60d87622009-12-16 16:32:58 -08001268 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 IBinder app = data.readStrongBinder();
1271 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1272 handleApplicationCrash(app, ci);
1273 reply.writeNoException();
1274 return true;
1275 }
1276
1277 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 data.enforceInterface(IActivityManager.descriptor);
1279 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001281 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001282 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001284 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 return true;
1286 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001287
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001288 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001291 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001292 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1293 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001294 reply.writeNoException();
1295 return true;
1296 }
1297
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001298 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
1300 int sig = data.readInt();
1301 signalPersistentProcesses(sig);
1302 reply.writeNoException();
1303 return true;
1304 }
1305
Dianne Hackborn03abb812010-01-04 18:43:19 -08001306 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001308 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001309 int userId = data.readInt();
1310 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001311 reply.writeNoException();
1312 return true;
1313 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001314
1315 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 killAllBackgroundProcesses();
1318 reply.writeNoException();
1319 return true;
1320 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001321
Dianne Hackborn03abb812010-01-04 18:43:19 -08001322 case FORCE_STOP_PACKAGE_TRANSACTION: {
1323 data.enforceInterface(IActivityManager.descriptor);
1324 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001325 int userId = data.readInt();
1326 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 reply.writeNoException();
1328 return true;
1329 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001330
1331 case GET_MY_MEMORY_STATE_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
1333 ActivityManager.RunningAppProcessInfo info =
1334 new ActivityManager.RunningAppProcessInfo();
1335 getMyMemoryState(info);
1336 reply.writeNoException();
1337 info.writeToParcel(reply, 0);
1338 return true;
1339 }
1340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
1343 ConfigurationInfo config = getDeviceConfigurationInfo();
1344 reply.writeNoException();
1345 config.writeToParcel(reply, 0);
1346 return true;
1347 }
1348
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001349 case PROFILE_CONTROL_TRANSACTION: {
1350 data.enforceInterface(IActivityManager.descriptor);
1351 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001352 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001353 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001354 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001355 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001356 ParcelFileDescriptor fd = data.readInt() != 0
1357 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001358 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001359 reply.writeNoException();
1360 reply.writeInt(res ? 1 : 0);
1361 return true;
1362 }
1363
Dianne Hackborn55280a92009-05-07 15:53:46 -07001364 case SHUTDOWN_TRANSACTION: {
1365 data.enforceInterface(IActivityManager.descriptor);
1366 boolean res = shutdown(data.readInt());
1367 reply.writeNoException();
1368 reply.writeInt(res ? 1 : 0);
1369 return true;
1370 }
1371
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001372 case STOP_APP_SWITCHES_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 stopAppSwitches();
1375 reply.writeNoException();
1376 return true;
1377 }
1378
1379 case RESUME_APP_SWITCHES_TRANSACTION: {
1380 data.enforceInterface(IActivityManager.descriptor);
1381 resumeAppSwitches();
1382 reply.writeNoException();
1383 return true;
1384 }
1385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001386 case PEEK_SERVICE_TRANSACTION: {
1387 data.enforceInterface(IActivityManager.descriptor);
1388 Intent service = Intent.CREATOR.createFromParcel(data);
1389 String resolvedType = data.readString();
1390 IBinder binder = peekService(service, resolvedType);
1391 reply.writeNoException();
1392 reply.writeStrongBinder(binder);
1393 return true;
1394 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001395
1396 case START_BACKUP_AGENT_TRANSACTION: {
1397 data.enforceInterface(IActivityManager.descriptor);
1398 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1399 int backupRestoreMode = data.readInt();
1400 boolean success = bindBackupAgent(info, backupRestoreMode);
1401 reply.writeNoException();
1402 reply.writeInt(success ? 1 : 0);
1403 return true;
1404 }
1405
1406 case BACKUP_AGENT_CREATED_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
1408 String packageName = data.readString();
1409 IBinder agent = data.readStrongBinder();
1410 backupAgentCreated(packageName, agent);
1411 reply.writeNoException();
1412 return true;
1413 }
1414
1415 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1416 data.enforceInterface(IActivityManager.descriptor);
1417 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1418 unbindBackupAgent(info);
1419 reply.writeNoException();
1420 return true;
1421 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001422
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001423 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001424 data.enforceInterface(IActivityManager.descriptor);
1425 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001426 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001427 String reason = data.readString();
1428 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001429 reply.writeNoException();
1430 return true;
1431 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001432
1433 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1434 data.enforceInterface(IActivityManager.descriptor);
1435 String reason = data.readString();
1436 closeSystemDialogs(reason);
1437 reply.writeNoException();
1438 return true;
1439 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001440
1441 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001443 int[] pids = data.createIntArray();
1444 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001445 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001446 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001447 return true;
1448 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001449
1450 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1451 data.enforceInterface(IActivityManager.descriptor);
1452 String processName = data.readString();
1453 int uid = data.readInt();
1454 killApplicationProcess(processName, uid);
1455 reply.writeNoException();
1456 return true;
1457 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001458
1459 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1460 data.enforceInterface(IActivityManager.descriptor);
1461 IBinder token = data.readStrongBinder();
1462 String packageName = data.readString();
1463 int enterAnim = data.readInt();
1464 int exitAnim = data.readInt();
1465 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001466 reply.writeNoException();
1467 return true;
1468 }
1469
1470 case IS_USER_A_MONKEY_TRANSACTION: {
1471 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001472 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001473 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001474 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001475 return true;
1476 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001477
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001478 case SET_USER_IS_MONKEY_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 final boolean monkey = (data.readInt() == 1);
1481 setUserIsMonkey(monkey);
1482 reply.writeNoException();
1483 return true;
1484 }
1485
Dianne Hackborn860755f2010-06-03 18:47:52 -07001486 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1487 data.enforceInterface(IActivityManager.descriptor);
1488 finishHeavyWeightApp();
1489 reply.writeNoException();
1490 return true;
1491 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001492
1493 case IS_IMMERSIVE_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
1495 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001496 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001497 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001498 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001499 return true;
1500 }
1501
Craig Mautner5eda9b32013-07-02 11:58:16 -07001502 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001503 data.enforceInterface(IActivityManager.descriptor);
1504 IBinder token = data.readStrongBinder();
Craig Mautner5eda9b32013-07-02 11:58:16 -07001505 convertFromTranslucent(token);
1506 reply.writeNoException();
1507 return true;
1508 }
1509
1510 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 IBinder token = data.readStrongBinder();
1513 convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001514 reply.writeNoException();
1515 return true;
1516 }
1517
Daniel Sandler69a48172010-06-23 16:29:36 -04001518 case SET_IMMERSIVE_TRANSACTION: {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 IBinder token = data.readStrongBinder();
1521 boolean imm = data.readInt() == 1;
1522 setImmersive(token, imm);
1523 reply.writeNoException();
1524 return true;
1525 }
1526
1527 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001529 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001530 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001531 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001532 return true;
1533 }
1534
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001535 case CRASH_APPLICATION_TRANSACTION: {
1536 data.enforceInterface(IActivityManager.descriptor);
1537 int uid = data.readInt();
1538 int initialPid = data.readInt();
1539 String packageName = data.readString();
1540 String message = data.readString();
1541 crashApplication(uid, initialPid, packageName, message);
1542 reply.writeNoException();
1543 return true;
1544 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001545
1546 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001549 int userId = data.readInt();
1550 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001551 reply.writeNoException();
1552 reply.writeString(type);
1553 return true;
1554 }
1555
Dianne Hackborn7e269642010-08-25 19:50:20 -07001556 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 String name = data.readString();
1559 IBinder perm = newUriPermissionOwner(name);
1560 reply.writeNoException();
1561 reply.writeStrongBinder(perm);
1562 return true;
1563 }
1564
1565 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 IBinder owner = data.readStrongBinder();
1568 int fromUid = data.readInt();
1569 String targetPkg = data.readString();
1570 Uri uri = Uri.CREATOR.createFromParcel(data);
1571 int mode = data.readInt();
1572 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1573 reply.writeNoException();
1574 return true;
1575 }
1576
1577 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 IBinder owner = data.readStrongBinder();
1580 Uri uri = null;
1581 if (data.readInt() != 0) {
1582 Uri.CREATOR.createFromParcel(data);
1583 }
1584 int mode = data.readInt();
1585 revokeUriPermissionFromOwner(owner, uri, mode);
1586 reply.writeNoException();
1587 return true;
1588 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001589
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001590 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1591 data.enforceInterface(IActivityManager.descriptor);
1592 int callingUid = data.readInt();
1593 String targetPkg = data.readString();
1594 Uri uri = Uri.CREATOR.createFromParcel(data);
1595 int modeFlags = data.readInt();
1596 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1597 reply.writeNoException();
1598 reply.writeInt(res);
1599 return true;
1600 }
1601
Andy McFadden824c5102010-07-09 16:26:57 -07001602 case DUMP_HEAP_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001605 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001606 boolean managed = data.readInt() != 0;
1607 String path = data.readString();
1608 ParcelFileDescriptor fd = data.readInt() != 0
1609 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001610 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001611 reply.writeNoException();
1612 reply.writeInt(res ? 1 : 0);
1613 return true;
1614 }
1615
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001616 case START_ACTIVITIES_TRANSACTION:
1617 {
1618 data.enforceInterface(IActivityManager.descriptor);
1619 IBinder b = data.readStrongBinder();
1620 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001621 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001622 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1623 String[] resolvedTypes = data.createStringArray();
1624 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001625 Bundle options = data.readInt() != 0
1626 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001627 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001628 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001629 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001630 reply.writeNoException();
1631 reply.writeInt(result);
1632 return true;
1633 }
1634
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001635 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1636 {
1637 data.enforceInterface(IActivityManager.descriptor);
1638 int mode = getFrontActivityScreenCompatMode();
1639 reply.writeNoException();
1640 reply.writeInt(mode);
1641 return true;
1642 }
1643
1644 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1645 {
1646 data.enforceInterface(IActivityManager.descriptor);
1647 int mode = data.readInt();
1648 setFrontActivityScreenCompatMode(mode);
1649 reply.writeNoException();
1650 reply.writeInt(mode);
1651 return true;
1652 }
1653
1654 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1655 {
1656 data.enforceInterface(IActivityManager.descriptor);
1657 String pkg = data.readString();
1658 int mode = getPackageScreenCompatMode(pkg);
1659 reply.writeNoException();
1660 reply.writeInt(mode);
1661 return true;
1662 }
1663
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001664 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1665 {
1666 data.enforceInterface(IActivityManager.descriptor);
1667 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001668 int mode = data.readInt();
1669 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001670 reply.writeNoException();
1671 return true;
1672 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001673
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001674 case SWITCH_USER_TRANSACTION: {
1675 data.enforceInterface(IActivityManager.descriptor);
1676 int userid = data.readInt();
1677 boolean result = switchUser(userid);
1678 reply.writeNoException();
1679 reply.writeInt(result ? 1 : 0);
1680 return true;
1681 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001682
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001683 case STOP_USER_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
1685 int userid = data.readInt();
1686 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1687 data.readStrongBinder());
1688 int result = stopUser(userid, callback);
1689 reply.writeNoException();
1690 reply.writeInt(result);
1691 return true;
1692 }
1693
Amith Yamasani52f1d752012-03-28 18:19:29 -07001694 case GET_CURRENT_USER_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 UserInfo userInfo = getCurrentUser();
1697 reply.writeNoException();
1698 userInfo.writeToParcel(reply, 0);
1699 return true;
1700 }
1701
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001702 case IS_USER_RUNNING_TRANSACTION: {
1703 data.enforceInterface(IActivityManager.descriptor);
1704 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001705 boolean orStopping = data.readInt() != 0;
1706 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001707 reply.writeNoException();
1708 reply.writeInt(result ? 1 : 0);
1709 return true;
1710 }
1711
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001712 case GET_RUNNING_USER_IDS_TRANSACTION: {
1713 data.enforceInterface(IActivityManager.descriptor);
1714 int[] result = getRunningUserIds();
1715 reply.writeNoException();
1716 reply.writeIntArray(result);
1717 return true;
1718 }
1719
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001720 case REMOVE_SUB_TASK_TRANSACTION:
1721 {
1722 data.enforceInterface(IActivityManager.descriptor);
1723 int taskId = data.readInt();
1724 int subTaskIndex = data.readInt();
1725 boolean result = removeSubTask(taskId, subTaskIndex);
1726 reply.writeNoException();
1727 reply.writeInt(result ? 1 : 0);
1728 return true;
1729 }
1730
1731 case REMOVE_TASK_TRANSACTION:
1732 {
1733 data.enforceInterface(IActivityManager.descriptor);
1734 int taskId = data.readInt();
1735 int fl = data.readInt();
1736 boolean result = removeTask(taskId, fl);
1737 reply.writeNoException();
1738 reply.writeInt(result ? 1 : 0);
1739 return true;
1740 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001741
Jeff Sharkeya4620792011-05-20 15:29:23 -07001742 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1745 data.readStrongBinder());
1746 registerProcessObserver(observer);
1747 return true;
1748 }
1749
1750 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1753 data.readStrongBinder());
1754 unregisterProcessObserver(observer);
1755 return true;
1756 }
1757
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001758 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1759 {
1760 data.enforceInterface(IActivityManager.descriptor);
1761 String pkg = data.readString();
1762 boolean ask = getPackageAskScreenCompat(pkg);
1763 reply.writeNoException();
1764 reply.writeInt(ask ? 1 : 0);
1765 return true;
1766 }
1767
1768 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1769 {
1770 data.enforceInterface(IActivityManager.descriptor);
1771 String pkg = data.readString();
1772 boolean ask = data.readInt() != 0;
1773 setPackageAskScreenCompat(pkg, ask);
1774 reply.writeNoException();
1775 return true;
1776 }
1777
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001778 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 IIntentSender r = IIntentSender.Stub.asInterface(
1781 data.readStrongBinder());
1782 boolean res = isIntentSenderTargetedToPackage(r);
1783 reply.writeNoException();
1784 reply.writeInt(res ? 1 : 0);
1785 return true;
1786 }
1787
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001788 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1789 data.enforceInterface(IActivityManager.descriptor);
1790 IIntentSender r = IIntentSender.Stub.asInterface(
1791 data.readStrongBinder());
1792 boolean res = isIntentSenderAnActivity(r);
1793 reply.writeNoException();
1794 reply.writeInt(res ? 1 : 0);
1795 return true;
1796 }
1797
Dianne Hackborn81038902012-11-26 17:04:09 -08001798 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 IIntentSender r = IIntentSender.Stub.asInterface(
1801 data.readStrongBinder());
1802 Intent intent = getIntentForIntentSender(r);
1803 reply.writeNoException();
1804 if (intent != null) {
1805 reply.writeInt(1);
1806 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1807 } else {
1808 reply.writeInt(0);
1809 }
1810 return true;
1811 }
1812
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001813 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1814 data.enforceInterface(IActivityManager.descriptor);
1815 Configuration config = Configuration.CREATOR.createFromParcel(data);
1816 updatePersistentConfiguration(config);
1817 reply.writeNoException();
1818 return true;
1819 }
1820
Dianne Hackbornb437e092011-08-05 17:50:29 -07001821 case GET_PROCESS_PSS_TRANSACTION: {
1822 data.enforceInterface(IActivityManager.descriptor);
1823 int[] pids = data.createIntArray();
1824 long[] pss = getProcessPss(pids);
1825 reply.writeNoException();
1826 reply.writeLongArray(pss);
1827 return true;
1828 }
1829
Dianne Hackborn661cd522011-08-22 00:26:20 -07001830 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1833 boolean always = data.readInt() != 0;
1834 showBootMessage(msg, always);
1835 reply.writeNoException();
1836 return true;
1837 }
1838
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001839 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1840 data.enforceInterface(IActivityManager.descriptor);
1841 dismissKeyguardOnNextActivity();
1842 reply.writeNoException();
1843 return true;
1844 }
1845
Adam Powelldd8fab22012-03-22 17:47:27 -07001846 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 IBinder token = data.readStrongBinder();
1849 String destAffinity = data.readString();
1850 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1851 reply.writeNoException();
1852 reply.writeInt(res ? 1 : 0);
1853 return true;
1854 }
1855
1856 case NAVIGATE_UP_TO_TRANSACTION: {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 IBinder token = data.readStrongBinder();
1859 Intent target = Intent.CREATOR.createFromParcel(data);
1860 int resultCode = data.readInt();
1861 Intent resultData = null;
1862 if (data.readInt() != 0) {
1863 resultData = Intent.CREATOR.createFromParcel(data);
1864 }
1865 boolean res = navigateUpTo(token, target, resultCode, resultData);
1866 reply.writeNoException();
1867 reply.writeInt(res ? 1 : 0);
1868 return true;
1869 }
1870
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001871 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1872 data.enforceInterface(IActivityManager.descriptor);
1873 IBinder token = data.readStrongBinder();
1874 int res = getLaunchedFromUid(token);
1875 reply.writeNoException();
1876 reply.writeInt(res);
1877 return true;
1878 }
1879
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001880 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1881 data.enforceInterface(IActivityManager.descriptor);
1882 IBinder token = data.readStrongBinder();
1883 String res = getLaunchedFromPackage(token);
1884 reply.writeNoException();
1885 reply.writeString(res);
1886 return true;
1887 }
1888
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001889 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1890 data.enforceInterface(IActivityManager.descriptor);
1891 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1892 data.readStrongBinder());
1893 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001894 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001895 return true;
1896 }
1897
1898 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1899 data.enforceInterface(IActivityManager.descriptor);
1900 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1901 data.readStrongBinder());
1902 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001903 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001904 return true;
1905 }
1906
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001907 case REQUEST_BUG_REPORT_TRANSACTION: {
1908 data.enforceInterface(IActivityManager.descriptor);
1909 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001910 reply.writeNoException();
1911 return true;
1912 }
1913
1914 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1915 data.enforceInterface(IActivityManager.descriptor);
1916 int pid = data.readInt();
1917 boolean aboveSystem = data.readInt() != 0;
1918 long res = inputDispatchingTimedOut(pid, aboveSystem);
1919 reply.writeNoException();
1920 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001921 return true;
1922 }
1923
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001924 case GET_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 int requestType = data.readInt();
1927 Bundle res = getTopActivityExtras(requestType);
1928 reply.writeNoException();
1929 reply.writeBundle(res);
1930 return true;
1931 }
1932
1933 case REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 IBinder token = data.readStrongBinder();
1936 Bundle extras = data.readBundle();
1937 reportTopActivityExtras(token, extras);
1938 reply.writeNoException();
1939 return true;
1940 }
1941
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001942 case KILL_UID_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 int uid = data.readInt();
1945 String reason = data.readString();
1946 killUid(uid, reason);
1947 reply.writeNoException();
1948 return true;
1949 }
1950
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07001951 case HANG_TRANSACTION: {
1952 data.enforceInterface(IActivityManager.descriptor);
1953 IBinder who = data.readStrongBinder();
1954 boolean allowRestart = data.readInt() != 0;
1955 hang(who, allowRestart);
1956 reply.writeNoException();
1957 return true;
1958 }
1959
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07001960 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 IBinder token = data.readStrongBinder();
1963 reportActivityFullyDrawn(token);
1964 reply.writeNoException();
1965 return true;
1966 }
1967
Craig Mautner5eda9b32013-07-02 11:58:16 -07001968 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
1969 data.enforceInterface(IActivityManager.descriptor);
1970 IBinder token = data.readStrongBinder();
1971 notifyActivityDrawn(token);
1972 reply.writeNoException();
1973 return true;
1974 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001975 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001976
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001977 return super.onTransact(code, data, reply, flags);
1978 }
1979
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001980 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001981 return this;
1982 }
1983
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001984 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1985 protected IActivityManager create() {
1986 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001987 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001988 Log.v("ActivityManager", "default service binder = " + b);
1989 }
1990 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001991 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001992 Log.v("ActivityManager", "default service = " + am);
1993 }
1994 return am;
1995 }
1996 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001997}
1998
1999class ActivityManagerProxy implements IActivityManager
2000{
2001 public ActivityManagerProxy(IBinder remote)
2002 {
2003 mRemote = remote;
2004 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002005
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002006 public IBinder asBinder()
2007 {
2008 return mRemote;
2009 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002010
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002011 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002012 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2013 int startFlags, String profileFile,
2014 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002015 Parcel data = Parcel.obtain();
2016 Parcel reply = Parcel.obtain();
2017 data.writeInterfaceToken(IActivityManager.descriptor);
2018 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002019 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002020 intent.writeToParcel(data, 0);
2021 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002022 data.writeStrongBinder(resultTo);
2023 data.writeString(resultWho);
2024 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002025 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002026 data.writeString(profileFile);
2027 if (profileFd != null) {
2028 data.writeInt(1);
2029 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2030 } else {
2031 data.writeInt(0);
2032 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002033 if (options != null) {
2034 data.writeInt(1);
2035 options.writeToParcel(data, 0);
2036 } else {
2037 data.writeInt(0);
2038 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002039 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2040 reply.readException();
2041 int result = reply.readInt();
2042 reply.recycle();
2043 data.recycle();
2044 return result;
2045 }
Amith Yamasani82644082012-08-03 13:09:11 -07002046
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002047 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002048 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2049 int startFlags, String profileFile,
2050 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2051 Parcel data = Parcel.obtain();
2052 Parcel reply = Parcel.obtain();
2053 data.writeInterfaceToken(IActivityManager.descriptor);
2054 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002055 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002056 intent.writeToParcel(data, 0);
2057 data.writeString(resolvedType);
2058 data.writeStrongBinder(resultTo);
2059 data.writeString(resultWho);
2060 data.writeInt(requestCode);
2061 data.writeInt(startFlags);
2062 data.writeString(profileFile);
2063 if (profileFd != null) {
2064 data.writeInt(1);
2065 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2066 } else {
2067 data.writeInt(0);
2068 }
2069 if (options != null) {
2070 data.writeInt(1);
2071 options.writeToParcel(data, 0);
2072 } else {
2073 data.writeInt(0);
2074 }
2075 data.writeInt(userId);
2076 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2077 reply.readException();
2078 int result = reply.readInt();
2079 reply.recycle();
2080 data.recycle();
2081 return result;
2082 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002083 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2084 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002085 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002086 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002087 Parcel data = Parcel.obtain();
2088 Parcel reply = Parcel.obtain();
2089 data.writeInterfaceToken(IActivityManager.descriptor);
2090 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002091 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002092 intent.writeToParcel(data, 0);
2093 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002094 data.writeStrongBinder(resultTo);
2095 data.writeString(resultWho);
2096 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002097 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002098 data.writeString(profileFile);
2099 if (profileFd != null) {
2100 data.writeInt(1);
2101 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2102 } else {
2103 data.writeInt(0);
2104 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002105 if (options != null) {
2106 data.writeInt(1);
2107 options.writeToParcel(data, 0);
2108 } else {
2109 data.writeInt(0);
2110 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002111 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002112 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2113 reply.readException();
2114 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2115 reply.recycle();
2116 data.recycle();
2117 return result;
2118 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002119 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2120 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002121 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002122 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002123 Parcel data = Parcel.obtain();
2124 Parcel reply = Parcel.obtain();
2125 data.writeInterfaceToken(IActivityManager.descriptor);
2126 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002127 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002128 intent.writeToParcel(data, 0);
2129 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002130 data.writeStrongBinder(resultTo);
2131 data.writeString(resultWho);
2132 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002133 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002134 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002135 if (options != null) {
2136 data.writeInt(1);
2137 options.writeToParcel(data, 0);
2138 } else {
2139 data.writeInt(0);
2140 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002141 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002142 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2143 reply.readException();
2144 int result = reply.readInt();
2145 reply.recycle();
2146 data.recycle();
2147 return result;
2148 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002149 public int startActivityIntentSender(IApplicationThread caller,
2150 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002151 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002152 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002153 Parcel data = Parcel.obtain();
2154 Parcel reply = Parcel.obtain();
2155 data.writeInterfaceToken(IActivityManager.descriptor);
2156 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2157 intent.writeToParcel(data, 0);
2158 if (fillInIntent != null) {
2159 data.writeInt(1);
2160 fillInIntent.writeToParcel(data, 0);
2161 } else {
2162 data.writeInt(0);
2163 }
2164 data.writeString(resolvedType);
2165 data.writeStrongBinder(resultTo);
2166 data.writeString(resultWho);
2167 data.writeInt(requestCode);
2168 data.writeInt(flagsMask);
2169 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002170 if (options != null) {
2171 data.writeInt(1);
2172 options.writeToParcel(data, 0);
2173 } else {
2174 data.writeInt(0);
2175 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002176 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002177 reply.readException();
2178 int result = reply.readInt();
2179 reply.recycle();
2180 data.recycle();
2181 return result;
2182 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002183 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002184 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002185 Parcel data = Parcel.obtain();
2186 Parcel reply = Parcel.obtain();
2187 data.writeInterfaceToken(IActivityManager.descriptor);
2188 data.writeStrongBinder(callingActivity);
2189 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002190 if (options != null) {
2191 data.writeInt(1);
2192 options.writeToParcel(data, 0);
2193 } else {
2194 data.writeInt(0);
2195 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002196 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2197 reply.readException();
2198 int result = reply.readInt();
2199 reply.recycle();
2200 data.recycle();
2201 return result != 0;
2202 }
2203 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2204 throws RemoteException {
2205 Parcel data = Parcel.obtain();
2206 Parcel reply = Parcel.obtain();
2207 data.writeInterfaceToken(IActivityManager.descriptor);
2208 data.writeStrongBinder(token);
2209 data.writeInt(resultCode);
2210 if (resultData != null) {
2211 data.writeInt(1);
2212 resultData.writeToParcel(data, 0);
2213 } else {
2214 data.writeInt(0);
2215 }
2216 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2217 reply.readException();
2218 boolean res = reply.readInt() != 0;
2219 data.recycle();
2220 reply.recycle();
2221 return res;
2222 }
2223 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2224 {
2225 Parcel data = Parcel.obtain();
2226 Parcel reply = Parcel.obtain();
2227 data.writeInterfaceToken(IActivityManager.descriptor);
2228 data.writeStrongBinder(token);
2229 data.writeString(resultWho);
2230 data.writeInt(requestCode);
2231 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2232 reply.readException();
2233 data.recycle();
2234 reply.recycle();
2235 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002236 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 data.writeStrongBinder(token);
2241 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2242 reply.readException();
2243 boolean res = reply.readInt() != 0;
2244 data.recycle();
2245 reply.recycle();
2246 return res;
2247 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002248 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2249 Parcel data = Parcel.obtain();
2250 Parcel reply = Parcel.obtain();
2251 data.writeInterfaceToken(IActivityManager.descriptor);
2252 data.writeStrongBinder(token);
2253 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2254 reply.readException();
2255 boolean res = reply.readInt() != 0;
2256 data.recycle();
2257 reply.recycle();
2258 return res;
2259 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002260 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002261 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002262 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002263 {
2264 Parcel data = Parcel.obtain();
2265 Parcel reply = Parcel.obtain();
2266 data.writeInterfaceToken(IActivityManager.descriptor);
2267 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002268 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002269 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2270 filter.writeToParcel(data, 0);
2271 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002272 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002273 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2274 reply.readException();
2275 Intent intent = null;
2276 int haveIntent = reply.readInt();
2277 if (haveIntent != 0) {
2278 intent = Intent.CREATOR.createFromParcel(reply);
2279 }
2280 reply.recycle();
2281 data.recycle();
2282 return intent;
2283 }
2284 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2285 {
2286 Parcel data = Parcel.obtain();
2287 Parcel reply = Parcel.obtain();
2288 data.writeInterfaceToken(IActivityManager.descriptor);
2289 data.writeStrongBinder(receiver.asBinder());
2290 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2291 reply.readException();
2292 data.recycle();
2293 reply.recycle();
2294 }
2295 public int broadcastIntent(IApplicationThread caller,
2296 Intent intent, String resolvedType, IIntentReceiver resultTo,
2297 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002298 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002299 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002300 {
2301 Parcel data = Parcel.obtain();
2302 Parcel reply = Parcel.obtain();
2303 data.writeInterfaceToken(IActivityManager.descriptor);
2304 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2305 intent.writeToParcel(data, 0);
2306 data.writeString(resolvedType);
2307 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2308 data.writeInt(resultCode);
2309 data.writeString(resultData);
2310 data.writeBundle(map);
2311 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002312 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002313 data.writeInt(serialized ? 1 : 0);
2314 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002315 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002316 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2317 reply.readException();
2318 int res = reply.readInt();
2319 reply.recycle();
2320 data.recycle();
2321 return res;
2322 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002323 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2324 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002325 {
2326 Parcel data = Parcel.obtain();
2327 Parcel reply = Parcel.obtain();
2328 data.writeInterfaceToken(IActivityManager.descriptor);
2329 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2330 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002331 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002332 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2333 reply.readException();
2334 data.recycle();
2335 reply.recycle();
2336 }
2337 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2338 {
2339 Parcel data = Parcel.obtain();
2340 Parcel reply = Parcel.obtain();
2341 data.writeInterfaceToken(IActivityManager.descriptor);
2342 data.writeStrongBinder(who);
2343 data.writeInt(resultCode);
2344 data.writeString(resultData);
2345 data.writeBundle(map);
2346 data.writeInt(abortBroadcast ? 1 : 0);
2347 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2348 reply.readException();
2349 data.recycle();
2350 reply.recycle();
2351 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002352 public void attachApplication(IApplicationThread app) throws RemoteException
2353 {
2354 Parcel data = Parcel.obtain();
2355 Parcel reply = Parcel.obtain();
2356 data.writeInterfaceToken(IActivityManager.descriptor);
2357 data.writeStrongBinder(app.asBinder());
2358 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2359 reply.readException();
2360 data.recycle();
2361 reply.recycle();
2362 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002363 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2364 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002365 {
2366 Parcel data = Parcel.obtain();
2367 Parcel reply = Parcel.obtain();
2368 data.writeInterfaceToken(IActivityManager.descriptor);
2369 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002370 if (config != null) {
2371 data.writeInt(1);
2372 config.writeToParcel(data, 0);
2373 } else {
2374 data.writeInt(0);
2375 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002376 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2378 reply.readException();
2379 data.recycle();
2380 reply.recycle();
2381 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002382 public void activityResumed(IBinder token) throws RemoteException
2383 {
2384 Parcel data = Parcel.obtain();
2385 Parcel reply = Parcel.obtain();
2386 data.writeInterfaceToken(IActivityManager.descriptor);
2387 data.writeStrongBinder(token);
2388 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2389 reply.readException();
2390 data.recycle();
2391 reply.recycle();
2392 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002393 public void activityPaused(IBinder token) throws RemoteException
2394 {
2395 Parcel data = Parcel.obtain();
2396 Parcel reply = Parcel.obtain();
2397 data.writeInterfaceToken(IActivityManager.descriptor);
2398 data.writeStrongBinder(token);
2399 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2400 reply.readException();
2401 data.recycle();
2402 reply.recycle();
2403 }
2404 public void activityStopped(IBinder token, Bundle state,
2405 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002406 {
2407 Parcel data = Parcel.obtain();
2408 Parcel reply = Parcel.obtain();
2409 data.writeInterfaceToken(IActivityManager.descriptor);
2410 data.writeStrongBinder(token);
2411 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002412 if (thumbnail != null) {
2413 data.writeInt(1);
2414 thumbnail.writeToParcel(data, 0);
2415 } else {
2416 data.writeInt(0);
2417 }
2418 TextUtils.writeToParcel(description, data, 0);
2419 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2420 reply.readException();
2421 data.recycle();
2422 reply.recycle();
2423 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002424 public void activitySlept(IBinder token) throws RemoteException
2425 {
2426 Parcel data = Parcel.obtain();
2427 Parcel reply = Parcel.obtain();
2428 data.writeInterfaceToken(IActivityManager.descriptor);
2429 data.writeStrongBinder(token);
2430 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2431 reply.readException();
2432 data.recycle();
2433 reply.recycle();
2434 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002435 public void activityDestroyed(IBinder token) throws RemoteException
2436 {
2437 Parcel data = Parcel.obtain();
2438 Parcel reply = Parcel.obtain();
2439 data.writeInterfaceToken(IActivityManager.descriptor);
2440 data.writeStrongBinder(token);
2441 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2442 reply.readException();
2443 data.recycle();
2444 reply.recycle();
2445 }
2446 public String getCallingPackage(IBinder token) throws RemoteException
2447 {
2448 Parcel data = Parcel.obtain();
2449 Parcel reply = Parcel.obtain();
2450 data.writeInterfaceToken(IActivityManager.descriptor);
2451 data.writeStrongBinder(token);
2452 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2453 reply.readException();
2454 String res = reply.readString();
2455 data.recycle();
2456 reply.recycle();
2457 return res;
2458 }
2459 public ComponentName getCallingActivity(IBinder token)
2460 throws RemoteException {
2461 Parcel data = Parcel.obtain();
2462 Parcel reply = Parcel.obtain();
2463 data.writeInterfaceToken(IActivityManager.descriptor);
2464 data.writeStrongBinder(token);
2465 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2466 reply.readException();
2467 ComponentName res = ComponentName.readFromParcel(reply);
2468 data.recycle();
2469 reply.recycle();
2470 return res;
2471 }
2472 public List getTasks(int maxNum, int flags,
2473 IThumbnailReceiver receiver) throws RemoteException {
2474 Parcel data = Parcel.obtain();
2475 Parcel reply = Parcel.obtain();
2476 data.writeInterfaceToken(IActivityManager.descriptor);
2477 data.writeInt(maxNum);
2478 data.writeInt(flags);
2479 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2480 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2481 reply.readException();
2482 ArrayList list = null;
2483 int N = reply.readInt();
2484 if (N >= 0) {
2485 list = new ArrayList();
2486 while (N > 0) {
2487 ActivityManager.RunningTaskInfo info =
2488 ActivityManager.RunningTaskInfo.CREATOR
2489 .createFromParcel(reply);
2490 list.add(info);
2491 N--;
2492 }
2493 }
2494 data.recycle();
2495 reply.recycle();
2496 return list;
2497 }
2498 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002499 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002500 Parcel data = Parcel.obtain();
2501 Parcel reply = Parcel.obtain();
2502 data.writeInterfaceToken(IActivityManager.descriptor);
2503 data.writeInt(maxNum);
2504 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002505 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002506 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2507 reply.readException();
2508 ArrayList<ActivityManager.RecentTaskInfo> list
2509 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2510 data.recycle();
2511 reply.recycle();
2512 return list;
2513 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002514 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002515 Parcel data = Parcel.obtain();
2516 Parcel reply = Parcel.obtain();
2517 data.writeInterfaceToken(IActivityManager.descriptor);
2518 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002519 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002520 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002521 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002522 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002523 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002524 }
2525 data.recycle();
2526 reply.recycle();
2527 return bm;
2528 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002529 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2530 Parcel data = Parcel.obtain();
2531 Parcel reply = Parcel.obtain();
2532 data.writeInterfaceToken(IActivityManager.descriptor);
2533 data.writeInt(id);
2534 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2535 reply.readException();
2536 Bitmap bm = null;
2537 if (reply.readInt() != 0) {
2538 bm = Bitmap.CREATOR.createFromParcel(reply);
2539 }
2540 data.recycle();
2541 reply.recycle();
2542 return bm;
2543 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002544 public List getServices(int maxNum, int flags) throws RemoteException {
2545 Parcel data = Parcel.obtain();
2546 Parcel reply = Parcel.obtain();
2547 data.writeInterfaceToken(IActivityManager.descriptor);
2548 data.writeInt(maxNum);
2549 data.writeInt(flags);
2550 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2551 reply.readException();
2552 ArrayList list = null;
2553 int N = reply.readInt();
2554 if (N >= 0) {
2555 list = new ArrayList();
2556 while (N > 0) {
2557 ActivityManager.RunningServiceInfo info =
2558 ActivityManager.RunningServiceInfo.CREATOR
2559 .createFromParcel(reply);
2560 list.add(info);
2561 N--;
2562 }
2563 }
2564 data.recycle();
2565 reply.recycle();
2566 return list;
2567 }
2568 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2569 throws RemoteException {
2570 Parcel data = Parcel.obtain();
2571 Parcel reply = Parcel.obtain();
2572 data.writeInterfaceToken(IActivityManager.descriptor);
2573 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2574 reply.readException();
2575 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2576 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2577 data.recycle();
2578 reply.recycle();
2579 return list;
2580 }
2581 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2582 throws RemoteException {
2583 Parcel data = Parcel.obtain();
2584 Parcel reply = Parcel.obtain();
2585 data.writeInterfaceToken(IActivityManager.descriptor);
2586 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2587 reply.readException();
2588 ArrayList<ActivityManager.RunningAppProcessInfo> list
2589 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2590 data.recycle();
2591 reply.recycle();
2592 return list;
2593 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002594 public List<ApplicationInfo> getRunningExternalApplications()
2595 throws RemoteException {
2596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2600 reply.readException();
2601 ArrayList<ApplicationInfo> list
2602 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2603 data.recycle();
2604 reply.recycle();
2605 return list;
2606 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002607 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002608 {
2609 Parcel data = Parcel.obtain();
2610 Parcel reply = Parcel.obtain();
2611 data.writeInterfaceToken(IActivityManager.descriptor);
2612 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002613 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002614 if (options != null) {
2615 data.writeInt(1);
2616 options.writeToParcel(data, 0);
2617 } else {
2618 data.writeInt(0);
2619 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002620 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2621 reply.readException();
2622 data.recycle();
2623 reply.recycle();
2624 }
2625 public void moveTaskToBack(int task) throws RemoteException
2626 {
2627 Parcel data = Parcel.obtain();
2628 Parcel reply = Parcel.obtain();
2629 data.writeInterfaceToken(IActivityManager.descriptor);
2630 data.writeInt(task);
2631 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2632 reply.readException();
2633 data.recycle();
2634 reply.recycle();
2635 }
2636 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2637 throws RemoteException {
2638 Parcel data = Parcel.obtain();
2639 Parcel reply = Parcel.obtain();
2640 data.writeInterfaceToken(IActivityManager.descriptor);
2641 data.writeStrongBinder(token);
2642 data.writeInt(nonRoot ? 1 : 0);
2643 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2644 reply.readException();
2645 boolean res = reply.readInt() != 0;
2646 data.recycle();
2647 reply.recycle();
2648 return res;
2649 }
2650 public void moveTaskBackwards(int task) throws RemoteException
2651 {
2652 Parcel data = Parcel.obtain();
2653 Parcel reply = Parcel.obtain();
2654 data.writeInterfaceToken(IActivityManager.descriptor);
2655 data.writeInt(task);
2656 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2657 reply.readException();
2658 data.recycle();
2659 reply.recycle();
2660 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002661 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002662 public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002663 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002664 {
2665 Parcel data = Parcel.obtain();
2666 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002667 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002668 data.writeInt(taskId);
Craig Mautner5a449152013-05-24 15:49:29 -07002669 data.writeInt(relativeStackBoxId);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002670 data.writeInt(position);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002671 data.writeFloat(weight);
2672 mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
2673 reply.readException();
2674 int res = reply.readInt();
2675 data.recycle();
2676 reply.recycle();
2677 return res;
2678 }
2679 @Override
2680 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2681 {
2682 Parcel data = Parcel.obtain();
2683 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002684 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002685 data.writeInt(taskId);
2686 data.writeInt(stackId);
2687 data.writeInt(toTop ? 1 : 0);
2688 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2689 reply.readException();
2690 data.recycle();
2691 reply.recycle();
2692 }
2693 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002694 public void resizeStackBox(int stackBoxId, float weight) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002695 {
2696 Parcel data = Parcel.obtain();
2697 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002698 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002699 data.writeInt(stackBoxId);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002700 data.writeFloat(weight);
Craig Mautnercf910b02013-04-23 11:23:27 -07002701 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002702 reply.readException();
2703 data.recycle();
2704 reply.recycle();
2705 }
Craig Mautner967212c2013-04-13 21:10:58 -07002706 @Override
Craig Mautner5ff12102013-05-24 12:50:15 -07002707 public List<StackBoxInfo> getStackBoxes() throws RemoteException
2708 {
2709 Parcel data = Parcel.obtain();
2710 Parcel reply = Parcel.obtain();
2711 data.writeInterfaceToken(IActivityManager.descriptor);
2712 mRemote.transact(GET_STACK_BOXES_TRANSACTION, data, reply, 0);
2713 reply.readException();
2714 ArrayList<StackBoxInfo> list = reply.createTypedArrayList(StackBoxInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002715 data.recycle();
2716 reply.recycle();
2717 return list;
2718 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002719 @Override
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002720 public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException
2721 {
2722 Parcel data = Parcel.obtain();
2723 Parcel reply = Parcel.obtain();
2724 data.writeInterfaceToken(IActivityManager.descriptor);
2725 data.writeInt(stackBoxId);
2726 mRemote.transact(GET_STACK_BOX_INFO_TRANSACTION, data, reply, 0);
2727 reply.readException();
2728 int res = reply.readInt();
2729 StackBoxInfo info = null;
2730 if (res != 0) {
2731 info = StackBoxInfo.CREATOR.createFromParcel(reply);
2732 }
2733 data.recycle();
2734 reply.recycle();
2735 return info;
2736 }
2737 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002738 public void setFocusedStack(int stackId) throws RemoteException
2739 {
2740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 data.writeInt(stackId);
2744 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2745 reply.readException();
2746 data.recycle();
2747 reply.recycle();
2748 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002749 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2750 {
2751 Parcel data = Parcel.obtain();
2752 Parcel reply = Parcel.obtain();
2753 data.writeInterfaceToken(IActivityManager.descriptor);
2754 data.writeStrongBinder(token);
2755 data.writeInt(onlyRoot ? 1 : 0);
2756 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2757 reply.readException();
2758 int res = reply.readInt();
2759 data.recycle();
2760 reply.recycle();
2761 return res;
2762 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002763 public void reportThumbnail(IBinder token,
2764 Bitmap thumbnail, CharSequence description) throws RemoteException
2765 {
2766 Parcel data = Parcel.obtain();
2767 Parcel reply = Parcel.obtain();
2768 data.writeInterfaceToken(IActivityManager.descriptor);
2769 data.writeStrongBinder(token);
2770 if (thumbnail != null) {
2771 data.writeInt(1);
2772 thumbnail.writeToParcel(data, 0);
2773 } else {
2774 data.writeInt(0);
2775 }
2776 TextUtils.writeToParcel(description, data, 0);
2777 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2778 reply.readException();
2779 data.recycle();
2780 reply.recycle();
2781 }
2782 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002783 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784 Parcel data = Parcel.obtain();
2785 Parcel reply = Parcel.obtain();
2786 data.writeInterfaceToken(IActivityManager.descriptor);
2787 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2788 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002789 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002790 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002791 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2792 reply.readException();
2793 int res = reply.readInt();
2794 ContentProviderHolder cph = null;
2795 if (res != 0) {
2796 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2797 }
2798 data.recycle();
2799 reply.recycle();
2800 return cph;
2801 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002802 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2803 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002804 Parcel data = Parcel.obtain();
2805 Parcel reply = Parcel.obtain();
2806 data.writeInterfaceToken(IActivityManager.descriptor);
2807 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002808 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002809 data.writeStrongBinder(token);
2810 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2811 reply.readException();
2812 int res = reply.readInt();
2813 ContentProviderHolder cph = null;
2814 if (res != 0) {
2815 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2816 }
2817 data.recycle();
2818 reply.recycle();
2819 return cph;
2820 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002821 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002822 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002823 {
2824 Parcel data = Parcel.obtain();
2825 Parcel reply = Parcel.obtain();
2826 data.writeInterfaceToken(IActivityManager.descriptor);
2827 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2828 data.writeTypedList(providers);
2829 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2830 reply.readException();
2831 data.recycle();
2832 reply.recycle();
2833 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002834 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2835 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 Parcel data = Parcel.obtain();
2837 Parcel reply = Parcel.obtain();
2838 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002839 data.writeStrongBinder(connection);
2840 data.writeInt(stable);
2841 data.writeInt(unstable);
2842 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2843 reply.readException();
2844 boolean res = reply.readInt() != 0;
2845 data.recycle();
2846 reply.recycle();
2847 return res;
2848 }
2849 public void unstableProviderDied(IBinder connection) throws RemoteException {
2850 Parcel data = Parcel.obtain();
2851 Parcel reply = Parcel.obtain();
2852 data.writeInterfaceToken(IActivityManager.descriptor);
2853 data.writeStrongBinder(connection);
2854 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2855 reply.readException();
2856 data.recycle();
2857 reply.recycle();
2858 }
2859
2860 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2861 Parcel data = Parcel.obtain();
2862 Parcel reply = Parcel.obtain();
2863 data.writeInterfaceToken(IActivityManager.descriptor);
2864 data.writeStrongBinder(connection);
2865 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002866 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2867 reply.readException();
2868 data.recycle();
2869 reply.recycle();
2870 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002871
2872 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2873 Parcel data = Parcel.obtain();
2874 Parcel reply = Parcel.obtain();
2875 data.writeInterfaceToken(IActivityManager.descriptor);
2876 data.writeString(name);
2877 data.writeStrongBinder(token);
2878 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2879 reply.readException();
2880 data.recycle();
2881 reply.recycle();
2882 }
2883
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002884 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2885 throws RemoteException
2886 {
2887 Parcel data = Parcel.obtain();
2888 Parcel reply = Parcel.obtain();
2889 data.writeInterfaceToken(IActivityManager.descriptor);
2890 service.writeToParcel(data, 0);
2891 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2892 reply.readException();
2893 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2894 data.recycle();
2895 reply.recycle();
2896 return res;
2897 }
2898
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002899 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002900 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002901 {
2902 Parcel data = Parcel.obtain();
2903 Parcel reply = Parcel.obtain();
2904 data.writeInterfaceToken(IActivityManager.descriptor);
2905 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2906 service.writeToParcel(data, 0);
2907 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002908 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002909 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2910 reply.readException();
2911 ComponentName res = ComponentName.readFromParcel(reply);
2912 data.recycle();
2913 reply.recycle();
2914 return res;
2915 }
2916 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002917 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002918 {
2919 Parcel data = Parcel.obtain();
2920 Parcel reply = Parcel.obtain();
2921 data.writeInterfaceToken(IActivityManager.descriptor);
2922 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2923 service.writeToParcel(data, 0);
2924 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002925 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002926 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2927 reply.readException();
2928 int res = reply.readInt();
2929 reply.recycle();
2930 data.recycle();
2931 return res;
2932 }
2933 public boolean stopServiceToken(ComponentName className, IBinder token,
2934 int startId) throws RemoteException {
2935 Parcel data = Parcel.obtain();
2936 Parcel reply = Parcel.obtain();
2937 data.writeInterfaceToken(IActivityManager.descriptor);
2938 ComponentName.writeToParcel(className, data);
2939 data.writeStrongBinder(token);
2940 data.writeInt(startId);
2941 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2942 reply.readException();
2943 boolean res = reply.readInt() != 0;
2944 data.recycle();
2945 reply.recycle();
2946 return res;
2947 }
2948 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002949 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 ComponentName.writeToParcel(className, data);
2954 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002955 data.writeInt(id);
2956 if (notification != null) {
2957 data.writeInt(1);
2958 notification.writeToParcel(data, 0);
2959 } else {
2960 data.writeInt(0);
2961 }
2962 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002963 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2964 reply.readException();
2965 data.recycle();
2966 reply.recycle();
2967 }
2968 public int bindService(IApplicationThread caller, IBinder token,
2969 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002970 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 Parcel data = Parcel.obtain();
2972 Parcel reply = Parcel.obtain();
2973 data.writeInterfaceToken(IActivityManager.descriptor);
2974 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2975 data.writeStrongBinder(token);
2976 service.writeToParcel(data, 0);
2977 data.writeString(resolvedType);
2978 data.writeStrongBinder(connection.asBinder());
2979 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002980 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002981 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2982 reply.readException();
2983 int res = reply.readInt();
2984 data.recycle();
2985 reply.recycle();
2986 return res;
2987 }
2988 public boolean unbindService(IServiceConnection connection) throws RemoteException
2989 {
2990 Parcel data = Parcel.obtain();
2991 Parcel reply = Parcel.obtain();
2992 data.writeInterfaceToken(IActivityManager.descriptor);
2993 data.writeStrongBinder(connection.asBinder());
2994 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2995 reply.readException();
2996 boolean res = reply.readInt() != 0;
2997 data.recycle();
2998 reply.recycle();
2999 return res;
3000 }
3001
3002 public void publishService(IBinder token,
3003 Intent intent, IBinder service) throws RemoteException {
3004 Parcel data = Parcel.obtain();
3005 Parcel reply = Parcel.obtain();
3006 data.writeInterfaceToken(IActivityManager.descriptor);
3007 data.writeStrongBinder(token);
3008 intent.writeToParcel(data, 0);
3009 data.writeStrongBinder(service);
3010 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3011 reply.readException();
3012 data.recycle();
3013 reply.recycle();
3014 }
3015
3016 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3017 throws RemoteException {
3018 Parcel data = Parcel.obtain();
3019 Parcel reply = Parcel.obtain();
3020 data.writeInterfaceToken(IActivityManager.descriptor);
3021 data.writeStrongBinder(token);
3022 intent.writeToParcel(data, 0);
3023 data.writeInt(doRebind ? 1 : 0);
3024 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3025 reply.readException();
3026 data.recycle();
3027 reply.recycle();
3028 }
3029
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003030 public void serviceDoneExecuting(IBinder token, int type, int startId,
3031 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003032 Parcel data = Parcel.obtain();
3033 Parcel reply = Parcel.obtain();
3034 data.writeInterfaceToken(IActivityManager.descriptor);
3035 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003036 data.writeInt(type);
3037 data.writeInt(startId);
3038 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003039 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3040 reply.readException();
3041 data.recycle();
3042 reply.recycle();
3043 }
3044
3045 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 service.writeToParcel(data, 0);
3050 data.writeString(resolvedType);
3051 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3052 reply.readException();
3053 IBinder binder = reply.readStrongBinder();
3054 reply.recycle();
3055 data.recycle();
3056 return binder;
3057 }
3058
Christopher Tate181fafa2009-05-14 11:12:14 -07003059 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3060 throws RemoteException {
3061 Parcel data = Parcel.obtain();
3062 Parcel reply = Parcel.obtain();
3063 data.writeInterfaceToken(IActivityManager.descriptor);
3064 app.writeToParcel(data, 0);
3065 data.writeInt(backupRestoreMode);
3066 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3067 reply.readException();
3068 boolean success = reply.readInt() != 0;
3069 reply.recycle();
3070 data.recycle();
3071 return success;
3072 }
3073
Christopher Tate346acb12012-10-15 19:20:25 -07003074 public void clearPendingBackup() throws RemoteException {
3075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3079 reply.recycle();
3080 data.recycle();
3081 }
3082
Christopher Tate181fafa2009-05-14 11:12:14 -07003083 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3084 Parcel data = Parcel.obtain();
3085 Parcel reply = Parcel.obtain();
3086 data.writeInterfaceToken(IActivityManager.descriptor);
3087 data.writeString(packageName);
3088 data.writeStrongBinder(agent);
3089 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3090 reply.recycle();
3091 data.recycle();
3092 }
3093
3094 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3095 Parcel data = Parcel.obtain();
3096 Parcel reply = Parcel.obtain();
3097 data.writeInterfaceToken(IActivityManager.descriptor);
3098 app.writeToParcel(data, 0);
3099 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3100 reply.readException();
3101 reply.recycle();
3102 data.recycle();
3103 }
3104
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003105 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003106 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3107 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003108 Parcel data = Parcel.obtain();
3109 Parcel reply = Parcel.obtain();
3110 data.writeInterfaceToken(IActivityManager.descriptor);
3111 ComponentName.writeToParcel(className, data);
3112 data.writeString(profileFile);
3113 data.writeInt(flags);
3114 data.writeBundle(arguments);
3115 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003116 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003117 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003118 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3119 reply.readException();
3120 boolean res = reply.readInt() != 0;
3121 reply.recycle();
3122 data.recycle();
3123 return res;
3124 }
3125
3126 public void finishInstrumentation(IApplicationThread target,
3127 int resultCode, Bundle results) throws RemoteException {
3128 Parcel data = Parcel.obtain();
3129 Parcel reply = Parcel.obtain();
3130 data.writeInterfaceToken(IActivityManager.descriptor);
3131 data.writeStrongBinder(target != null ? target.asBinder() : null);
3132 data.writeInt(resultCode);
3133 data.writeBundle(results);
3134 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3135 reply.readException();
3136 data.recycle();
3137 reply.recycle();
3138 }
3139 public Configuration getConfiguration() throws RemoteException
3140 {
3141 Parcel data = Parcel.obtain();
3142 Parcel reply = Parcel.obtain();
3143 data.writeInterfaceToken(IActivityManager.descriptor);
3144 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3147 reply.recycle();
3148 data.recycle();
3149 return res;
3150 }
3151 public void updateConfiguration(Configuration values) throws RemoteException
3152 {
3153 Parcel data = Parcel.obtain();
3154 Parcel reply = Parcel.obtain();
3155 data.writeInterfaceToken(IActivityManager.descriptor);
3156 values.writeToParcel(data, 0);
3157 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3158 reply.readException();
3159 data.recycle();
3160 reply.recycle();
3161 }
3162 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3163 throws RemoteException {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 data.writeStrongBinder(token);
3168 data.writeInt(requestedOrientation);
3169 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3170 reply.readException();
3171 data.recycle();
3172 reply.recycle();
3173 }
3174 public int getRequestedOrientation(IBinder token) throws RemoteException {
3175 Parcel data = Parcel.obtain();
3176 Parcel reply = Parcel.obtain();
3177 data.writeInterfaceToken(IActivityManager.descriptor);
3178 data.writeStrongBinder(token);
3179 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3180 reply.readException();
3181 int res = reply.readInt();
3182 data.recycle();
3183 reply.recycle();
3184 return res;
3185 }
3186 public ComponentName getActivityClassForToken(IBinder token)
3187 throws RemoteException {
3188 Parcel data = Parcel.obtain();
3189 Parcel reply = Parcel.obtain();
3190 data.writeInterfaceToken(IActivityManager.descriptor);
3191 data.writeStrongBinder(token);
3192 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3193 reply.readException();
3194 ComponentName res = ComponentName.readFromParcel(reply);
3195 data.recycle();
3196 reply.recycle();
3197 return res;
3198 }
3199 public String getPackageForToken(IBinder token) throws RemoteException
3200 {
3201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeStrongBinder(token);
3205 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3206 reply.readException();
3207 String res = reply.readString();
3208 data.recycle();
3209 reply.recycle();
3210 return res;
3211 }
3212 public IIntentSender getIntentSender(int type,
3213 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003214 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003215 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 Parcel data = Parcel.obtain();
3217 Parcel reply = Parcel.obtain();
3218 data.writeInterfaceToken(IActivityManager.descriptor);
3219 data.writeInt(type);
3220 data.writeString(packageName);
3221 data.writeStrongBinder(token);
3222 data.writeString(resultWho);
3223 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003224 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003226 data.writeTypedArray(intents, 0);
3227 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003228 } else {
3229 data.writeInt(0);
3230 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003231 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003232 if (options != null) {
3233 data.writeInt(1);
3234 options.writeToParcel(data, 0);
3235 } else {
3236 data.writeInt(0);
3237 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003238 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003239 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3240 reply.readException();
3241 IIntentSender res = IIntentSender.Stub.asInterface(
3242 reply.readStrongBinder());
3243 data.recycle();
3244 reply.recycle();
3245 return res;
3246 }
3247 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeStrongBinder(sender.asBinder());
3252 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3253 reply.readException();
3254 data.recycle();
3255 reply.recycle();
3256 }
3257 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 data.writeStrongBinder(sender.asBinder());
3262 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3263 reply.readException();
3264 String res = reply.readString();
3265 data.recycle();
3266 reply.recycle();
3267 return res;
3268 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003269 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3270 Parcel data = Parcel.obtain();
3271 Parcel reply = Parcel.obtain();
3272 data.writeInterfaceToken(IActivityManager.descriptor);
3273 data.writeStrongBinder(sender.asBinder());
3274 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3275 reply.readException();
3276 int res = reply.readInt();
3277 data.recycle();
3278 reply.recycle();
3279 return res;
3280 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003281 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3282 boolean requireFull, String name, String callerPackage) throws RemoteException {
3283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 data.writeInt(callingPid);
3287 data.writeInt(callingUid);
3288 data.writeInt(userId);
3289 data.writeInt(allowAll ? 1 : 0);
3290 data.writeInt(requireFull ? 1 : 0);
3291 data.writeString(name);
3292 data.writeString(callerPackage);
3293 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3294 reply.readException();
3295 int res = reply.readInt();
3296 data.recycle();
3297 reply.recycle();
3298 return res;
3299 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003300 public void setProcessLimit(int max) throws RemoteException
3301 {
3302 Parcel data = Parcel.obtain();
3303 Parcel reply = Parcel.obtain();
3304 data.writeInterfaceToken(IActivityManager.descriptor);
3305 data.writeInt(max);
3306 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3307 reply.readException();
3308 data.recycle();
3309 reply.recycle();
3310 }
3311 public int getProcessLimit() throws RemoteException
3312 {
3313 Parcel data = Parcel.obtain();
3314 Parcel reply = Parcel.obtain();
3315 data.writeInterfaceToken(IActivityManager.descriptor);
3316 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 int res = reply.readInt();
3319 data.recycle();
3320 reply.recycle();
3321 return res;
3322 }
3323 public void setProcessForeground(IBinder token, int pid,
3324 boolean isForeground) throws RemoteException {
3325 Parcel data = Parcel.obtain();
3326 Parcel reply = Parcel.obtain();
3327 data.writeInterfaceToken(IActivityManager.descriptor);
3328 data.writeStrongBinder(token);
3329 data.writeInt(pid);
3330 data.writeInt(isForeground ? 1 : 0);
3331 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3332 reply.readException();
3333 data.recycle();
3334 reply.recycle();
3335 }
3336 public int checkPermission(String permission, int pid, int uid)
3337 throws RemoteException {
3338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 data.writeString(permission);
3342 data.writeInt(pid);
3343 data.writeInt(uid);
3344 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3345 reply.readException();
3346 int res = reply.readInt();
3347 data.recycle();
3348 reply.recycle();
3349 return res;
3350 }
3351 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003352 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003353 Parcel data = Parcel.obtain();
3354 Parcel reply = Parcel.obtain();
3355 data.writeInterfaceToken(IActivityManager.descriptor);
3356 data.writeString(packageName);
3357 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003358 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003359 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3360 reply.readException();
3361 boolean res = reply.readInt() != 0;
3362 data.recycle();
3363 reply.recycle();
3364 return res;
3365 }
3366 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3367 throws RemoteException {
3368 Parcel data = Parcel.obtain();
3369 Parcel reply = Parcel.obtain();
3370 data.writeInterfaceToken(IActivityManager.descriptor);
3371 uri.writeToParcel(data, 0);
3372 data.writeInt(pid);
3373 data.writeInt(uid);
3374 data.writeInt(mode);
3375 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3376 reply.readException();
3377 int res = reply.readInt();
3378 data.recycle();
3379 reply.recycle();
3380 return res;
3381 }
3382 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3383 Uri uri, int mode) throws RemoteException {
3384 Parcel data = Parcel.obtain();
3385 Parcel reply = Parcel.obtain();
3386 data.writeInterfaceToken(IActivityManager.descriptor);
3387 data.writeStrongBinder(caller.asBinder());
3388 data.writeString(targetPkg);
3389 uri.writeToParcel(data, 0);
3390 data.writeInt(mode);
3391 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3392 reply.readException();
3393 data.recycle();
3394 reply.recycle();
3395 }
3396 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3397 int mode) throws RemoteException {
3398 Parcel data = Parcel.obtain();
3399 Parcel reply = Parcel.obtain();
3400 data.writeInterfaceToken(IActivityManager.descriptor);
3401 data.writeStrongBinder(caller.asBinder());
3402 uri.writeToParcel(data, 0);
3403 data.writeInt(mode);
3404 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3405 reply.readException();
3406 data.recycle();
3407 reply.recycle();
3408 }
3409 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3410 throws RemoteException {
3411 Parcel data = Parcel.obtain();
3412 Parcel reply = Parcel.obtain();
3413 data.writeInterfaceToken(IActivityManager.descriptor);
3414 data.writeStrongBinder(who.asBinder());
3415 data.writeInt(waiting ? 1 : 0);
3416 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3417 reply.readException();
3418 data.recycle();
3419 reply.recycle();
3420 }
3421 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
3424 data.writeInterfaceToken(IActivityManager.descriptor);
3425 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3426 reply.readException();
3427 outInfo.readFromParcel(reply);
3428 data.recycle();
3429 reply.recycle();
3430 }
3431 public void unhandledBack() throws RemoteException
3432 {
3433 Parcel data = Parcel.obtain();
3434 Parcel reply = Parcel.obtain();
3435 data.writeInterfaceToken(IActivityManager.descriptor);
3436 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3437 reply.readException();
3438 data.recycle();
3439 reply.recycle();
3440 }
3441 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3442 {
3443 Parcel data = Parcel.obtain();
3444 Parcel reply = Parcel.obtain();
3445 data.writeInterfaceToken(IActivityManager.descriptor);
3446 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3447 reply.readException();
3448 ParcelFileDescriptor pfd = null;
3449 if (reply.readInt() != 0) {
3450 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3451 }
3452 data.recycle();
3453 reply.recycle();
3454 return pfd;
3455 }
3456 public void goingToSleep() throws RemoteException
3457 {
3458 Parcel data = Parcel.obtain();
3459 Parcel reply = Parcel.obtain();
3460 data.writeInterfaceToken(IActivityManager.descriptor);
3461 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3462 reply.readException();
3463 data.recycle();
3464 reply.recycle();
3465 }
3466 public void wakingUp() throws RemoteException
3467 {
3468 Parcel data = Parcel.obtain();
3469 Parcel reply = Parcel.obtain();
3470 data.writeInterfaceToken(IActivityManager.descriptor);
3471 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3472 reply.readException();
3473 data.recycle();
3474 reply.recycle();
3475 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003476 public void setLockScreenShown(boolean shown) throws RemoteException
3477 {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeInt(shown ? 1 : 0);
3482 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3483 reply.readException();
3484 data.recycle();
3485 reply.recycle();
3486 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003487 public void setDebugApp(
3488 String packageName, boolean waitForDebugger, boolean persistent)
3489 throws RemoteException
3490 {
3491 Parcel data = Parcel.obtain();
3492 Parcel reply = Parcel.obtain();
3493 data.writeInterfaceToken(IActivityManager.descriptor);
3494 data.writeString(packageName);
3495 data.writeInt(waitForDebugger ? 1 : 0);
3496 data.writeInt(persistent ? 1 : 0);
3497 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3498 reply.readException();
3499 data.recycle();
3500 reply.recycle();
3501 }
3502 public void setAlwaysFinish(boolean enabled) throws RemoteException
3503 {
3504 Parcel data = Parcel.obtain();
3505 Parcel reply = Parcel.obtain();
3506 data.writeInterfaceToken(IActivityManager.descriptor);
3507 data.writeInt(enabled ? 1 : 0);
3508 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3509 reply.readException();
3510 data.recycle();
3511 reply.recycle();
3512 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003513 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003514 {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003519 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003520 reply.readException();
3521 data.recycle();
3522 reply.recycle();
3523 }
3524 public void enterSafeMode() throws RemoteException {
3525 Parcel data = Parcel.obtain();
3526 data.writeInterfaceToken(IActivityManager.descriptor);
3527 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3528 data.recycle();
3529 }
3530 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 data.writeStrongBinder(sender.asBinder());
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3535 data.recycle();
3536 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003537 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003542 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003543 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003544 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003545 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 boolean res = reply.readInt() != 0;
3547 data.recycle();
3548 reply.recycle();
3549 return res;
3550 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003551 @Override
3552 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3553 Parcel data = Parcel.obtain();
3554 Parcel reply = Parcel.obtain();
3555 data.writeInterfaceToken(IActivityManager.descriptor);
3556 data.writeString(reason);
3557 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3558 boolean res = reply.readInt() != 0;
3559 data.recycle();
3560 reply.recycle();
3561 return res;
3562 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003563 public void startRunning(String pkg, String cls, String action,
3564 String indata) throws RemoteException {
3565 Parcel data = Parcel.obtain();
3566 Parcel reply = Parcel.obtain();
3567 data.writeInterfaceToken(IActivityManager.descriptor);
3568 data.writeString(pkg);
3569 data.writeString(cls);
3570 data.writeString(action);
3571 data.writeString(indata);
3572 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3573 reply.readException();
3574 data.recycle();
3575 reply.recycle();
3576 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003577 public boolean testIsSystemReady()
3578 {
3579 /* this base class version is never called */
3580 return true;
3581 }
Dan Egnor60d87622009-12-16 16:32:58 -08003582 public void handleApplicationCrash(IBinder app,
3583 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3584 {
3585 Parcel data = Parcel.obtain();
3586 Parcel reply = Parcel.obtain();
3587 data.writeInterfaceToken(IActivityManager.descriptor);
3588 data.writeStrongBinder(app);
3589 crashInfo.writeToParcel(data, 0);
3590 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3591 reply.readException();
3592 reply.recycle();
3593 data.recycle();
3594 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003595
Dan Egnor60d87622009-12-16 16:32:58 -08003596 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003597 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003598 {
3599 Parcel data = Parcel.obtain();
3600 Parcel reply = Parcel.obtain();
3601 data.writeInterfaceToken(IActivityManager.descriptor);
3602 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003603 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003604 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003605 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003607 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003608 reply.recycle();
3609 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003610 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003611 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003612
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003613 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003614 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003615 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003616 {
3617 Parcel data = Parcel.obtain();
3618 Parcel reply = Parcel.obtain();
3619 data.writeInterfaceToken(IActivityManager.descriptor);
3620 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003621 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003622 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003623 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3624 reply.readException();
3625 reply.recycle();
3626 data.recycle();
3627 }
3628
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003629 public void signalPersistentProcesses(int sig) throws RemoteException {
3630 Parcel data = Parcel.obtain();
3631 Parcel reply = Parcel.obtain();
3632 data.writeInterfaceToken(IActivityManager.descriptor);
3633 data.writeInt(sig);
3634 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3635 reply.readException();
3636 data.recycle();
3637 reply.recycle();
3638 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003639
Dianne Hackborn1676c852012-09-10 14:52:30 -07003640 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003641 Parcel data = Parcel.obtain();
3642 Parcel reply = Parcel.obtain();
3643 data.writeInterfaceToken(IActivityManager.descriptor);
3644 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003645 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003646 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 data.recycle();
3649 reply.recycle();
3650 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003651
3652 public void killAllBackgroundProcesses() throws RemoteException {
3653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3657 reply.readException();
3658 data.recycle();
3659 reply.recycle();
3660 }
3661
Dianne Hackborn1676c852012-09-10 14:52:30 -07003662 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003663 Parcel data = Parcel.obtain();
3664 Parcel reply = Parcel.obtain();
3665 data.writeInterfaceToken(IActivityManager.descriptor);
3666 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003667 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003668 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003669 reply.readException();
3670 data.recycle();
3671 reply.recycle();
3672 }
3673
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003674 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3675 throws RemoteException
3676 {
3677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3681 reply.readException();
3682 outInfo.readFromParcel(reply);
3683 reply.recycle();
3684 data.recycle();
3685 }
3686
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003687 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3688 {
3689 Parcel data = Parcel.obtain();
3690 Parcel reply = Parcel.obtain();
3691 data.writeInterfaceToken(IActivityManager.descriptor);
3692 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3693 reply.readException();
3694 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3695 reply.recycle();
3696 data.recycle();
3697 return res;
3698 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003699
Dianne Hackborn1676c852012-09-10 14:52:30 -07003700 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003701 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003702 {
3703 Parcel data = Parcel.obtain();
3704 Parcel reply = Parcel.obtain();
3705 data.writeInterfaceToken(IActivityManager.descriptor);
3706 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003707 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003708 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003709 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003710 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003711 if (fd != null) {
3712 data.writeInt(1);
3713 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3714 } else {
3715 data.writeInt(0);
3716 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003717 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3718 reply.readException();
3719 boolean res = reply.readInt() != 0;
3720 reply.recycle();
3721 data.recycle();
3722 return res;
3723 }
3724
Dianne Hackborn55280a92009-05-07 15:53:46 -07003725 public boolean shutdown(int timeout) throws RemoteException
3726 {
3727 Parcel data = Parcel.obtain();
3728 Parcel reply = Parcel.obtain();
3729 data.writeInterfaceToken(IActivityManager.descriptor);
3730 data.writeInt(timeout);
3731 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3732 reply.readException();
3733 boolean res = reply.readInt() != 0;
3734 reply.recycle();
3735 data.recycle();
3736 return res;
3737 }
3738
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003739 public void stopAppSwitches() throws RemoteException {
3740 Parcel data = Parcel.obtain();
3741 Parcel reply = Parcel.obtain();
3742 data.writeInterfaceToken(IActivityManager.descriptor);
3743 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3744 reply.readException();
3745 reply.recycle();
3746 data.recycle();
3747 }
3748
3749 public void resumeAppSwitches() throws RemoteException {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3754 reply.readException();
3755 reply.recycle();
3756 data.recycle();
3757 }
3758
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003759 public void killApplicationWithAppId(String pkg, int appid, String reason)
3760 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003761 Parcel data = Parcel.obtain();
3762 Parcel reply = Parcel.obtain();
3763 data.writeInterfaceToken(IActivityManager.descriptor);
3764 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003765 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003766 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003767 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003768 reply.readException();
3769 data.recycle();
3770 reply.recycle();
3771 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003772
3773 public void closeSystemDialogs(String reason) throws RemoteException {
3774 Parcel data = Parcel.obtain();
3775 Parcel reply = Parcel.obtain();
3776 data.writeInterfaceToken(IActivityManager.descriptor);
3777 data.writeString(reason);
3778 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3779 reply.readException();
3780 data.recycle();
3781 reply.recycle();
3782 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003783
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003784 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003785 throws RemoteException {
3786 Parcel data = Parcel.obtain();
3787 Parcel reply = Parcel.obtain();
3788 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003789 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003790 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3791 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003792 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003793 data.recycle();
3794 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003795 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003796 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003797
3798 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3799 Parcel data = Parcel.obtain();
3800 Parcel reply = Parcel.obtain();
3801 data.writeInterfaceToken(IActivityManager.descriptor);
3802 data.writeString(processName);
3803 data.writeInt(uid);
3804 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3805 reply.readException();
3806 data.recycle();
3807 reply.recycle();
3808 }
3809
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003810 public void overridePendingTransition(IBinder token, String packageName,
3811 int enterAnim, int exitAnim) throws RemoteException {
3812 Parcel data = Parcel.obtain();
3813 Parcel reply = Parcel.obtain();
3814 data.writeInterfaceToken(IActivityManager.descriptor);
3815 data.writeStrongBinder(token);
3816 data.writeString(packageName);
3817 data.writeInt(enterAnim);
3818 data.writeInt(exitAnim);
3819 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 data.recycle();
3822 reply.recycle();
3823 }
3824
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003825 public boolean isUserAMonkey() throws RemoteException {
3826 Parcel data = Parcel.obtain();
3827 Parcel reply = Parcel.obtain();
3828 data.writeInterfaceToken(IActivityManager.descriptor);
3829 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3830 reply.readException();
3831 boolean res = reply.readInt() != 0;
3832 data.recycle();
3833 reply.recycle();
3834 return res;
3835 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003836
3837 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3838 Parcel data = Parcel.obtain();
3839 Parcel reply = Parcel.obtain();
3840 data.writeInterfaceToken(IActivityManager.descriptor);
3841 data.writeInt(monkey ? 1 : 0);
3842 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3843 reply.readException();
3844 data.recycle();
3845 reply.recycle();
3846 }
3847
Dianne Hackborn860755f2010-06-03 18:47:52 -07003848 public void finishHeavyWeightApp() throws RemoteException {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3853 reply.readException();
3854 data.recycle();
3855 reply.recycle();
3856 }
Craig Mautner4addfc52013-06-25 08:05:45 -07003857
Craig Mautner5eda9b32013-07-02 11:58:16 -07003858 public void convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07003859 throws RemoteException {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07003864 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 data.recycle();
3867 reply.recycle();
3868 }
3869
3870 public void convertToTranslucent(IBinder token)
3871 throws RemoteException {
3872 Parcel data = Parcel.obtain();
3873 Parcel reply = Parcel.obtain();
3874 data.writeInterfaceToken(IActivityManager.descriptor);
3875 data.writeStrongBinder(token);
3876 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07003877 reply.readException();
3878 data.recycle();
3879 reply.recycle();
3880 }
3881
Daniel Sandler69a48172010-06-23 16:29:36 -04003882 public void setImmersive(IBinder token, boolean immersive)
3883 throws RemoteException {
3884 Parcel data = Parcel.obtain();
3885 Parcel reply = Parcel.obtain();
3886 data.writeInterfaceToken(IActivityManager.descriptor);
3887 data.writeStrongBinder(token);
3888 data.writeInt(immersive ? 1 : 0);
3889 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3890 reply.readException();
3891 data.recycle();
3892 reply.recycle();
3893 }
3894
3895 public boolean isImmersive(IBinder token)
3896 throws RemoteException {
3897 Parcel data = Parcel.obtain();
3898 Parcel reply = Parcel.obtain();
3899 data.writeInterfaceToken(IActivityManager.descriptor);
3900 data.writeStrongBinder(token);
3901 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003902 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003903 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003904 data.recycle();
3905 reply.recycle();
3906 return res;
3907 }
3908
3909 public boolean isTopActivityImmersive()
3910 throws RemoteException {
3911 Parcel data = Parcel.obtain();
3912 Parcel reply = Parcel.obtain();
3913 data.writeInterfaceToken(IActivityManager.descriptor);
3914 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003915 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003916 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003917 data.recycle();
3918 reply.recycle();
3919 return res;
3920 }
3921
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003922 public void crashApplication(int uid, int initialPid, String packageName,
3923 String message) throws RemoteException {
3924 Parcel data = Parcel.obtain();
3925 Parcel reply = Parcel.obtain();
3926 data.writeInterfaceToken(IActivityManager.descriptor);
3927 data.writeInt(uid);
3928 data.writeInt(initialPid);
3929 data.writeString(packageName);
3930 data.writeString(message);
3931 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3932 reply.readException();
3933 data.recycle();
3934 reply.recycle();
3935 }
Andy McFadden824c5102010-07-09 16:26:57 -07003936
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003937 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003938 Parcel data = Parcel.obtain();
3939 Parcel reply = Parcel.obtain();
3940 data.writeInterfaceToken(IActivityManager.descriptor);
3941 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003942 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003943 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3944 reply.readException();
3945 String res = reply.readString();
3946 data.recycle();
3947 reply.recycle();
3948 return res;
3949 }
3950
Dianne Hackborn7e269642010-08-25 19:50:20 -07003951 public IBinder newUriPermissionOwner(String name)
3952 throws RemoteException {
3953 Parcel data = Parcel.obtain();
3954 Parcel reply = Parcel.obtain();
3955 data.writeInterfaceToken(IActivityManager.descriptor);
3956 data.writeString(name);
3957 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3958 reply.readException();
3959 IBinder res = reply.readStrongBinder();
3960 data.recycle();
3961 reply.recycle();
3962 return res;
3963 }
3964
3965 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3966 Uri uri, int mode) throws RemoteException {
3967 Parcel data = Parcel.obtain();
3968 Parcel reply = Parcel.obtain();
3969 data.writeInterfaceToken(IActivityManager.descriptor);
3970 data.writeStrongBinder(owner);
3971 data.writeInt(fromUid);
3972 data.writeString(targetPkg);
3973 uri.writeToParcel(data, 0);
3974 data.writeInt(mode);
3975 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3976 reply.readException();
3977 data.recycle();
3978 reply.recycle();
3979 }
3980
3981 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3982 int mode) throws RemoteException {
3983 Parcel data = Parcel.obtain();
3984 Parcel reply = Parcel.obtain();
3985 data.writeInterfaceToken(IActivityManager.descriptor);
3986 data.writeStrongBinder(owner);
3987 if (uri != null) {
3988 data.writeInt(1);
3989 uri.writeToParcel(data, 0);
3990 } else {
3991 data.writeInt(0);
3992 }
3993 data.writeInt(mode);
3994 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3995 reply.readException();
3996 data.recycle();
3997 reply.recycle();
3998 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003999
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004000 public int checkGrantUriPermission(int callingUid, String targetPkg,
4001 Uri uri, int modeFlags) throws RemoteException {
4002 Parcel data = Parcel.obtain();
4003 Parcel reply = Parcel.obtain();
4004 data.writeInterfaceToken(IActivityManager.descriptor);
4005 data.writeInt(callingUid);
4006 data.writeString(targetPkg);
4007 uri.writeToParcel(data, 0);
4008 data.writeInt(modeFlags);
4009 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4010 reply.readException();
4011 int res = reply.readInt();
4012 data.recycle();
4013 reply.recycle();
4014 return res;
4015 }
4016
Dianne Hackborn1676c852012-09-10 14:52:30 -07004017 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004018 String path, ParcelFileDescriptor fd) throws RemoteException {
4019 Parcel data = Parcel.obtain();
4020 Parcel reply = Parcel.obtain();
4021 data.writeInterfaceToken(IActivityManager.descriptor);
4022 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004023 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004024 data.writeInt(managed ? 1 : 0);
4025 data.writeString(path);
4026 if (fd != null) {
4027 data.writeInt(1);
4028 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4029 } else {
4030 data.writeInt(0);
4031 }
4032 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4033 reply.readException();
4034 boolean res = reply.readInt() != 0;
4035 reply.recycle();
4036 data.recycle();
4037 return res;
4038 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004039
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004040 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004041 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004042 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004043 Parcel data = Parcel.obtain();
4044 Parcel reply = Parcel.obtain();
4045 data.writeInterfaceToken(IActivityManager.descriptor);
4046 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004047 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004048 data.writeTypedArray(intents, 0);
4049 data.writeStringArray(resolvedTypes);
4050 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004051 if (options != null) {
4052 data.writeInt(1);
4053 options.writeToParcel(data, 0);
4054 } else {
4055 data.writeInt(0);
4056 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004057 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004058 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4059 reply.readException();
4060 int result = reply.readInt();
4061 reply.recycle();
4062 data.recycle();
4063 return result;
4064 }
4065
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004066 public int getFrontActivityScreenCompatMode() throws RemoteException {
4067 Parcel data = Parcel.obtain();
4068 Parcel reply = Parcel.obtain();
4069 data.writeInterfaceToken(IActivityManager.descriptor);
4070 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4071 reply.readException();
4072 int mode = reply.readInt();
4073 reply.recycle();
4074 data.recycle();
4075 return mode;
4076 }
4077
4078 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 data.writeInt(mode);
4083 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4084 reply.readException();
4085 reply.recycle();
4086 data.recycle();
4087 }
4088
4089 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004093 data.writeString(packageName);
4094 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004095 reply.readException();
4096 int mode = reply.readInt();
4097 reply.recycle();
4098 data.recycle();
4099 return mode;
4100 }
4101
4102 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004103 throws RemoteException {
4104 Parcel data = Parcel.obtain();
4105 Parcel reply = Parcel.obtain();
4106 data.writeInterfaceToken(IActivityManager.descriptor);
4107 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004108 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004109 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4110 reply.readException();
4111 reply.recycle();
4112 data.recycle();
4113 }
4114
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004115 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4116 Parcel data = Parcel.obtain();
4117 Parcel reply = Parcel.obtain();
4118 data.writeInterfaceToken(IActivityManager.descriptor);
4119 data.writeString(packageName);
4120 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4121 reply.readException();
4122 boolean ask = reply.readInt() != 0;
4123 reply.recycle();
4124 data.recycle();
4125 return ask;
4126 }
4127
4128 public void setPackageAskScreenCompat(String packageName, boolean ask)
4129 throws RemoteException {
4130 Parcel data = Parcel.obtain();
4131 Parcel reply = Parcel.obtain();
4132 data.writeInterfaceToken(IActivityManager.descriptor);
4133 data.writeString(packageName);
4134 data.writeInt(ask ? 1 : 0);
4135 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4136 reply.readException();
4137 reply.recycle();
4138 data.recycle();
4139 }
4140
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004141 public boolean switchUser(int userid) throws RemoteException {
4142 Parcel data = Parcel.obtain();
4143 Parcel reply = Parcel.obtain();
4144 data.writeInterfaceToken(IActivityManager.descriptor);
4145 data.writeInt(userid);
4146 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 boolean result = reply.readInt() != 0;
4149 reply.recycle();
4150 data.recycle();
4151 return result;
4152 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004153
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004154 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 data.writeInt(userid);
4159 data.writeStrongInterface(callback);
4160 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4161 reply.readException();
4162 int result = reply.readInt();
4163 reply.recycle();
4164 data.recycle();
4165 return result;
4166 }
4167
Amith Yamasani52f1d752012-03-28 18:19:29 -07004168 public UserInfo getCurrentUser() throws RemoteException {
4169 Parcel data = Parcel.obtain();
4170 Parcel reply = Parcel.obtain();
4171 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004172 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004173 reply.readException();
4174 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4175 reply.recycle();
4176 data.recycle();
4177 return userInfo;
4178 }
4179
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004180 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004185 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004186 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4187 reply.readException();
4188 boolean result = reply.readInt() != 0;
4189 reply.recycle();
4190 data.recycle();
4191 return result;
4192 }
4193
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004194 public int[] getRunningUserIds() throws RemoteException {
4195 Parcel data = Parcel.obtain();
4196 Parcel reply = Parcel.obtain();
4197 data.writeInterfaceToken(IActivityManager.descriptor);
4198 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4199 reply.readException();
4200 int[] result = reply.createIntArray();
4201 reply.recycle();
4202 data.recycle();
4203 return result;
4204 }
4205
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004206 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4207 Parcel data = Parcel.obtain();
4208 Parcel reply = Parcel.obtain();
4209 data.writeInterfaceToken(IActivityManager.descriptor);
4210 data.writeInt(taskId);
4211 data.writeInt(subTaskIndex);
4212 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4213 reply.readException();
4214 boolean result = reply.readInt() != 0;
4215 reply.recycle();
4216 data.recycle();
4217 return result;
4218 }
4219
4220 public boolean removeTask(int taskId, int flags) throws RemoteException {
4221 Parcel data = Parcel.obtain();
4222 Parcel reply = Parcel.obtain();
4223 data.writeInterfaceToken(IActivityManager.descriptor);
4224 data.writeInt(taskId);
4225 data.writeInt(flags);
4226 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4227 reply.readException();
4228 boolean result = reply.readInt() != 0;
4229 reply.recycle();
4230 data.recycle();
4231 return result;
4232 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004233
Jeff Sharkeya4620792011-05-20 15:29:23 -07004234 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4235 Parcel data = Parcel.obtain();
4236 Parcel reply = Parcel.obtain();
4237 data.writeInterfaceToken(IActivityManager.descriptor);
4238 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4239 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 data.recycle();
4242 reply.recycle();
4243 }
4244
4245 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4246 Parcel data = Parcel.obtain();
4247 Parcel reply = Parcel.obtain();
4248 data.writeInterfaceToken(IActivityManager.descriptor);
4249 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4250 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4251 reply.readException();
4252 data.recycle();
4253 reply.recycle();
4254 }
4255
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004256 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4257 Parcel data = Parcel.obtain();
4258 Parcel reply = Parcel.obtain();
4259 data.writeInterfaceToken(IActivityManager.descriptor);
4260 data.writeStrongBinder(sender.asBinder());
4261 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4262 reply.readException();
4263 boolean res = reply.readInt() != 0;
4264 data.recycle();
4265 reply.recycle();
4266 return res;
4267 }
4268
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004269 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4270 Parcel data = Parcel.obtain();
4271 Parcel reply = Parcel.obtain();
4272 data.writeInterfaceToken(IActivityManager.descriptor);
4273 data.writeStrongBinder(sender.asBinder());
4274 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4275 reply.readException();
4276 boolean res = reply.readInt() != 0;
4277 data.recycle();
4278 reply.recycle();
4279 return res;
4280 }
4281
Dianne Hackborn81038902012-11-26 17:04:09 -08004282 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4283 Parcel data = Parcel.obtain();
4284 Parcel reply = Parcel.obtain();
4285 data.writeInterfaceToken(IActivityManager.descriptor);
4286 data.writeStrongBinder(sender.asBinder());
4287 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4288 reply.readException();
4289 Intent res = reply.readInt() != 0
4290 ? Intent.CREATOR.createFromParcel(reply) : null;
4291 data.recycle();
4292 reply.recycle();
4293 return res;
4294 }
4295
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004296 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4297 {
4298 Parcel data = Parcel.obtain();
4299 Parcel reply = Parcel.obtain();
4300 data.writeInterfaceToken(IActivityManager.descriptor);
4301 values.writeToParcel(data, 0);
4302 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4303 reply.readException();
4304 data.recycle();
4305 reply.recycle();
4306 }
4307
Dianne Hackbornb437e092011-08-05 17:50:29 -07004308 public long[] getProcessPss(int[] pids) throws RemoteException {
4309 Parcel data = Parcel.obtain();
4310 Parcel reply = Parcel.obtain();
4311 data.writeInterfaceToken(IActivityManager.descriptor);
4312 data.writeIntArray(pids);
4313 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4314 reply.readException();
4315 long[] res = reply.createLongArray();
4316 data.recycle();
4317 reply.recycle();
4318 return res;
4319 }
4320
Dianne Hackborn661cd522011-08-22 00:26:20 -07004321 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4322 Parcel data = Parcel.obtain();
4323 Parcel reply = Parcel.obtain();
4324 data.writeInterfaceToken(IActivityManager.descriptor);
4325 TextUtils.writeToParcel(msg, data, 0);
4326 data.writeInt(always ? 1 : 0);
4327 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4328 reply.readException();
4329 data.recycle();
4330 reply.recycle();
4331 }
4332
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004333 public void dismissKeyguardOnNextActivity() throws RemoteException {
4334 Parcel data = Parcel.obtain();
4335 Parcel reply = Parcel.obtain();
4336 data.writeInterfaceToken(IActivityManager.descriptor);
4337 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4338 reply.readException();
4339 data.recycle();
4340 reply.recycle();
4341 }
4342
Adam Powelldd8fab22012-03-22 17:47:27 -07004343 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4344 throws RemoteException {
4345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 data.writeStrongBinder(token);
4349 data.writeString(destAffinity);
4350 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4351 reply.readException();
4352 boolean result = reply.readInt() != 0;
4353 data.recycle();
4354 reply.recycle();
4355 return result;
4356 }
4357
4358 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4359 throws RemoteException {
4360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 data.writeStrongBinder(token);
4364 target.writeToParcel(data, 0);
4365 data.writeInt(resultCode);
4366 if (resultData != null) {
4367 data.writeInt(1);
4368 resultData.writeToParcel(data, 0);
4369 } else {
4370 data.writeInt(0);
4371 }
4372 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4373 reply.readException();
4374 boolean result = reply.readInt() != 0;
4375 data.recycle();
4376 reply.recycle();
4377 return result;
4378 }
4379
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004380 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4381 Parcel data = Parcel.obtain();
4382 Parcel reply = Parcel.obtain();
4383 data.writeInterfaceToken(IActivityManager.descriptor);
4384 data.writeStrongBinder(activityToken);
4385 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4386 reply.readException();
4387 int result = reply.readInt();
4388 data.recycle();
4389 reply.recycle();
4390 return result;
4391 }
4392
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004393 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4394 Parcel data = Parcel.obtain();
4395 Parcel reply = Parcel.obtain();
4396 data.writeInterfaceToken(IActivityManager.descriptor);
4397 data.writeStrongBinder(activityToken);
4398 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4399 reply.readException();
4400 String result = reply.readString();
4401 data.recycle();
4402 reply.recycle();
4403 return result;
4404 }
4405
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004406 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4407 Parcel data = Parcel.obtain();
4408 Parcel reply = Parcel.obtain();
4409 data.writeInterfaceToken(IActivityManager.descriptor);
4410 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4411 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4412 reply.readException();
4413 data.recycle();
4414 reply.recycle();
4415 }
4416
4417 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4418 Parcel data = Parcel.obtain();
4419 Parcel reply = Parcel.obtain();
4420 data.writeInterfaceToken(IActivityManager.descriptor);
4421 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4422 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4423 reply.readException();
4424 data.recycle();
4425 reply.recycle();
4426 }
4427
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004428 public void requestBugReport() throws RemoteException {
4429 Parcel data = Parcel.obtain();
4430 Parcel reply = Parcel.obtain();
4431 data.writeInterfaceToken(IActivityManager.descriptor);
4432 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4433 reply.readException();
4434 data.recycle();
4435 reply.recycle();
4436 }
4437
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004438 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4439 Parcel data = Parcel.obtain();
4440 Parcel reply = Parcel.obtain();
4441 data.writeInterfaceToken(IActivityManager.descriptor);
4442 data.writeInt(pid);
4443 data.writeInt(aboveSystem ? 1 : 0);
4444 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4445 reply.readException();
4446 long res = reply.readInt();
4447 data.recycle();
4448 reply.recycle();
4449 return res;
4450 }
4451
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004452 public Bundle getTopActivityExtras(int requestType) throws RemoteException {
4453 Parcel data = Parcel.obtain();
4454 Parcel reply = Parcel.obtain();
4455 data.writeInterfaceToken(IActivityManager.descriptor);
4456 data.writeInt(requestType);
4457 mRemote.transact(GET_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4458 reply.readException();
4459 Bundle res = reply.readBundle();
4460 data.recycle();
4461 reply.recycle();
4462 return res;
4463 }
4464
4465 public void reportTopActivityExtras(IBinder token, Bundle extras) throws RemoteException {
4466 Parcel data = Parcel.obtain();
4467 Parcel reply = Parcel.obtain();
4468 data.writeInterfaceToken(IActivityManager.descriptor);
4469 data.writeStrongBinder(token);
4470 data.writeBundle(extras);
4471 mRemote.transact(REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4472 reply.readException();
4473 data.recycle();
4474 reply.recycle();
4475 }
4476
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004477 public void killUid(int uid, String reason) throws RemoteException {
4478 Parcel data = Parcel.obtain();
4479 Parcel reply = Parcel.obtain();
4480 data.writeInterfaceToken(IActivityManager.descriptor);
4481 data.writeInt(uid);
4482 data.writeString(reason);
4483 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4484 reply.readException();
4485 data.recycle();
4486 reply.recycle();
4487 }
4488
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004489 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeStrongBinder(who);
4494 data.writeInt(allowRestart ? 1 : 0);
4495 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4496 reply.readException();
4497 data.recycle();
4498 reply.recycle();
4499 }
4500
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004501 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4502 Parcel data = Parcel.obtain();
4503 Parcel reply = Parcel.obtain();
4504 data.writeInterfaceToken(IActivityManager.descriptor);
4505 data.writeStrongBinder(token);
4506 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4507 reply.readException();
4508 data.recycle();
4509 reply.recycle();
4510 }
4511
Craig Mautner5eda9b32013-07-02 11:58:16 -07004512 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4513 Parcel data = Parcel.obtain();
4514 Parcel reply = Parcel.obtain();
4515 data.writeInterfaceToken(IActivityManager.descriptor);
4516 data.writeStrongBinder(token);
4517 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4518 reply.readException();
4519 data.recycle();
4520 reply.recycle();
4521 }
4522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004523 private IBinder mRemote;
4524}