blob: 653559d8fe4eb9521e71ba59f522af49ed8a9925 [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 Mautnerbc57cd12013-08-19 15:47:42 -07001505 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001506 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001507 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001508 return true;
1509 }
1510
1511 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1512 data.enforceInterface(IActivityManager.descriptor);
1513 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001514 boolean converted = convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001515 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001516 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001517 return true;
1518 }
1519
Daniel Sandler69a48172010-06-23 16:29:36 -04001520 case SET_IMMERSIVE_TRANSACTION: {
1521 data.enforceInterface(IActivityManager.descriptor);
1522 IBinder token = data.readStrongBinder();
1523 boolean imm = data.readInt() == 1;
1524 setImmersive(token, imm);
1525 reply.writeNoException();
1526 return true;
1527 }
1528
1529 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1530 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001531 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001532 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001533 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001534 return true;
1535 }
1536
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001537 case CRASH_APPLICATION_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 int uid = data.readInt();
1540 int initialPid = data.readInt();
1541 String packageName = data.readString();
1542 String message = data.readString();
1543 crashApplication(uid, initialPid, packageName, message);
1544 reply.writeNoException();
1545 return true;
1546 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001547
1548 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001551 int userId = data.readInt();
1552 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001553 reply.writeNoException();
1554 reply.writeString(type);
1555 return true;
1556 }
1557
Dianne Hackborn7e269642010-08-25 19:50:20 -07001558 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 String name = data.readString();
1561 IBinder perm = newUriPermissionOwner(name);
1562 reply.writeNoException();
1563 reply.writeStrongBinder(perm);
1564 return true;
1565 }
1566
1567 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 IBinder owner = data.readStrongBinder();
1570 int fromUid = data.readInt();
1571 String targetPkg = data.readString();
1572 Uri uri = Uri.CREATOR.createFromParcel(data);
1573 int mode = data.readInt();
1574 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1575 reply.writeNoException();
1576 return true;
1577 }
1578
1579 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1580 data.enforceInterface(IActivityManager.descriptor);
1581 IBinder owner = data.readStrongBinder();
1582 Uri uri = null;
1583 if (data.readInt() != 0) {
1584 Uri.CREATOR.createFromParcel(data);
1585 }
1586 int mode = data.readInt();
1587 revokeUriPermissionFromOwner(owner, uri, mode);
1588 reply.writeNoException();
1589 return true;
1590 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001591
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001592 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
1594 int callingUid = data.readInt();
1595 String targetPkg = data.readString();
1596 Uri uri = Uri.CREATOR.createFromParcel(data);
1597 int modeFlags = data.readInt();
1598 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1599 reply.writeNoException();
1600 reply.writeInt(res);
1601 return true;
1602 }
1603
Andy McFadden824c5102010-07-09 16:26:57 -07001604 case DUMP_HEAP_TRANSACTION: {
1605 data.enforceInterface(IActivityManager.descriptor);
1606 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001607 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001608 boolean managed = data.readInt() != 0;
1609 String path = data.readString();
1610 ParcelFileDescriptor fd = data.readInt() != 0
1611 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001612 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001613 reply.writeNoException();
1614 reply.writeInt(res ? 1 : 0);
1615 return true;
1616 }
1617
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001618 case START_ACTIVITIES_TRANSACTION:
1619 {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 IBinder b = data.readStrongBinder();
1622 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001623 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001624 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1625 String[] resolvedTypes = data.createStringArray();
1626 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001627 Bundle options = data.readInt() != 0
1628 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001629 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001630 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001631 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001632 reply.writeNoException();
1633 reply.writeInt(result);
1634 return true;
1635 }
1636
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001637 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1638 {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 int mode = getFrontActivityScreenCompatMode();
1641 reply.writeNoException();
1642 reply.writeInt(mode);
1643 return true;
1644 }
1645
1646 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1647 {
1648 data.enforceInterface(IActivityManager.descriptor);
1649 int mode = data.readInt();
1650 setFrontActivityScreenCompatMode(mode);
1651 reply.writeNoException();
1652 reply.writeInt(mode);
1653 return true;
1654 }
1655
1656 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1657 {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 String pkg = data.readString();
1660 int mode = getPackageScreenCompatMode(pkg);
1661 reply.writeNoException();
1662 reply.writeInt(mode);
1663 return true;
1664 }
1665
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001666 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1667 {
1668 data.enforceInterface(IActivityManager.descriptor);
1669 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001670 int mode = data.readInt();
1671 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001672 reply.writeNoException();
1673 return true;
1674 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001675
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001676 case SWITCH_USER_TRANSACTION: {
1677 data.enforceInterface(IActivityManager.descriptor);
1678 int userid = data.readInt();
1679 boolean result = switchUser(userid);
1680 reply.writeNoException();
1681 reply.writeInt(result ? 1 : 0);
1682 return true;
1683 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001684
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001685 case STOP_USER_TRANSACTION: {
1686 data.enforceInterface(IActivityManager.descriptor);
1687 int userid = data.readInt();
1688 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1689 data.readStrongBinder());
1690 int result = stopUser(userid, callback);
1691 reply.writeNoException();
1692 reply.writeInt(result);
1693 return true;
1694 }
1695
Amith Yamasani52f1d752012-03-28 18:19:29 -07001696 case GET_CURRENT_USER_TRANSACTION: {
1697 data.enforceInterface(IActivityManager.descriptor);
1698 UserInfo userInfo = getCurrentUser();
1699 reply.writeNoException();
1700 userInfo.writeToParcel(reply, 0);
1701 return true;
1702 }
1703
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001704 case IS_USER_RUNNING_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001707 boolean orStopping = data.readInt() != 0;
1708 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001709 reply.writeNoException();
1710 reply.writeInt(result ? 1 : 0);
1711 return true;
1712 }
1713
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001714 case GET_RUNNING_USER_IDS_TRANSACTION: {
1715 data.enforceInterface(IActivityManager.descriptor);
1716 int[] result = getRunningUserIds();
1717 reply.writeNoException();
1718 reply.writeIntArray(result);
1719 return true;
1720 }
1721
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001722 case REMOVE_SUB_TASK_TRANSACTION:
1723 {
1724 data.enforceInterface(IActivityManager.descriptor);
1725 int taskId = data.readInt();
1726 int subTaskIndex = data.readInt();
1727 boolean result = removeSubTask(taskId, subTaskIndex);
1728 reply.writeNoException();
1729 reply.writeInt(result ? 1 : 0);
1730 return true;
1731 }
1732
1733 case REMOVE_TASK_TRANSACTION:
1734 {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 int taskId = data.readInt();
1737 int fl = data.readInt();
1738 boolean result = removeTask(taskId, fl);
1739 reply.writeNoException();
1740 reply.writeInt(result ? 1 : 0);
1741 return true;
1742 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001743
Jeff Sharkeya4620792011-05-20 15:29:23 -07001744 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1745 data.enforceInterface(IActivityManager.descriptor);
1746 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1747 data.readStrongBinder());
1748 registerProcessObserver(observer);
1749 return true;
1750 }
1751
1752 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1753 data.enforceInterface(IActivityManager.descriptor);
1754 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1755 data.readStrongBinder());
1756 unregisterProcessObserver(observer);
1757 return true;
1758 }
1759
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001760 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1761 {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 String pkg = data.readString();
1764 boolean ask = getPackageAskScreenCompat(pkg);
1765 reply.writeNoException();
1766 reply.writeInt(ask ? 1 : 0);
1767 return true;
1768 }
1769
1770 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1771 {
1772 data.enforceInterface(IActivityManager.descriptor);
1773 String pkg = data.readString();
1774 boolean ask = data.readInt() != 0;
1775 setPackageAskScreenCompat(pkg, ask);
1776 reply.writeNoException();
1777 return true;
1778 }
1779
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001780 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 IIntentSender r = IIntentSender.Stub.asInterface(
1783 data.readStrongBinder());
1784 boolean res = isIntentSenderTargetedToPackage(r);
1785 reply.writeNoException();
1786 reply.writeInt(res ? 1 : 0);
1787 return true;
1788 }
1789
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001790 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 IIntentSender r = IIntentSender.Stub.asInterface(
1793 data.readStrongBinder());
1794 boolean res = isIntentSenderAnActivity(r);
1795 reply.writeNoException();
1796 reply.writeInt(res ? 1 : 0);
1797 return true;
1798 }
1799
Dianne Hackborn81038902012-11-26 17:04:09 -08001800 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1801 data.enforceInterface(IActivityManager.descriptor);
1802 IIntentSender r = IIntentSender.Stub.asInterface(
1803 data.readStrongBinder());
1804 Intent intent = getIntentForIntentSender(r);
1805 reply.writeNoException();
1806 if (intent != null) {
1807 reply.writeInt(1);
1808 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1809 } else {
1810 reply.writeInt(0);
1811 }
1812 return true;
1813 }
1814
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001815 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1816 data.enforceInterface(IActivityManager.descriptor);
1817 Configuration config = Configuration.CREATOR.createFromParcel(data);
1818 updatePersistentConfiguration(config);
1819 reply.writeNoException();
1820 return true;
1821 }
1822
Dianne Hackbornb437e092011-08-05 17:50:29 -07001823 case GET_PROCESS_PSS_TRANSACTION: {
1824 data.enforceInterface(IActivityManager.descriptor);
1825 int[] pids = data.createIntArray();
1826 long[] pss = getProcessPss(pids);
1827 reply.writeNoException();
1828 reply.writeLongArray(pss);
1829 return true;
1830 }
1831
Dianne Hackborn661cd522011-08-22 00:26:20 -07001832 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1833 data.enforceInterface(IActivityManager.descriptor);
1834 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1835 boolean always = data.readInt() != 0;
1836 showBootMessage(msg, always);
1837 reply.writeNoException();
1838 return true;
1839 }
1840
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001841 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1842 data.enforceInterface(IActivityManager.descriptor);
1843 dismissKeyguardOnNextActivity();
1844 reply.writeNoException();
1845 return true;
1846 }
1847
Adam Powelldd8fab22012-03-22 17:47:27 -07001848 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 IBinder token = data.readStrongBinder();
1851 String destAffinity = data.readString();
1852 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1853 reply.writeNoException();
1854 reply.writeInt(res ? 1 : 0);
1855 return true;
1856 }
1857
1858 case NAVIGATE_UP_TO_TRANSACTION: {
1859 data.enforceInterface(IActivityManager.descriptor);
1860 IBinder token = data.readStrongBinder();
1861 Intent target = Intent.CREATOR.createFromParcel(data);
1862 int resultCode = data.readInt();
1863 Intent resultData = null;
1864 if (data.readInt() != 0) {
1865 resultData = Intent.CREATOR.createFromParcel(data);
1866 }
1867 boolean res = navigateUpTo(token, target, resultCode, resultData);
1868 reply.writeNoException();
1869 reply.writeInt(res ? 1 : 0);
1870 return true;
1871 }
1872
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001873 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1874 data.enforceInterface(IActivityManager.descriptor);
1875 IBinder token = data.readStrongBinder();
1876 int res = getLaunchedFromUid(token);
1877 reply.writeNoException();
1878 reply.writeInt(res);
1879 return true;
1880 }
1881
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001882 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1883 data.enforceInterface(IActivityManager.descriptor);
1884 IBinder token = data.readStrongBinder();
1885 String res = getLaunchedFromPackage(token);
1886 reply.writeNoException();
1887 reply.writeString(res);
1888 return true;
1889 }
1890
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001891 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1892 data.enforceInterface(IActivityManager.descriptor);
1893 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1894 data.readStrongBinder());
1895 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001896 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001897 return true;
1898 }
1899
1900 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1901 data.enforceInterface(IActivityManager.descriptor);
1902 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1903 data.readStrongBinder());
1904 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001905 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001906 return true;
1907 }
1908
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001909 case REQUEST_BUG_REPORT_TRANSACTION: {
1910 data.enforceInterface(IActivityManager.descriptor);
1911 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001912 reply.writeNoException();
1913 return true;
1914 }
1915
1916 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 int pid = data.readInt();
1919 boolean aboveSystem = data.readInt() != 0;
1920 long res = inputDispatchingTimedOut(pid, aboveSystem);
1921 reply.writeNoException();
1922 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001923 return true;
1924 }
1925
Adam Skorydfc7fd72013-08-05 19:23:41 -07001926 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001927 data.enforceInterface(IActivityManager.descriptor);
1928 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001929 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001930 reply.writeNoException();
1931 reply.writeBundle(res);
1932 return true;
1933 }
1934
Adam Skorydfc7fd72013-08-05 19:23:41 -07001935 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001936 data.enforceInterface(IActivityManager.descriptor);
1937 IBinder token = data.readStrongBinder();
1938 Bundle extras = data.readBundle();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001939 int index = data.readInt();
1940 reportAssistContextExtras(token, extras, index);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001941 reply.writeNoException();
1942 return true;
1943 }
1944
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001945 case KILL_UID_TRANSACTION: {
1946 data.enforceInterface(IActivityManager.descriptor);
1947 int uid = data.readInt();
1948 String reason = data.readString();
1949 killUid(uid, reason);
1950 reply.writeNoException();
1951 return true;
1952 }
1953
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07001954 case HANG_TRANSACTION: {
1955 data.enforceInterface(IActivityManager.descriptor);
1956 IBinder who = data.readStrongBinder();
1957 boolean allowRestart = data.readInt() != 0;
1958 hang(who, allowRestart);
1959 reply.writeNoException();
1960 return true;
1961 }
1962
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07001963 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
1964 data.enforceInterface(IActivityManager.descriptor);
1965 IBinder token = data.readStrongBinder();
1966 reportActivityFullyDrawn(token);
1967 reply.writeNoException();
1968 return true;
1969 }
1970
Craig Mautner5eda9b32013-07-02 11:58:16 -07001971 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
1972 data.enforceInterface(IActivityManager.descriptor);
1973 IBinder token = data.readStrongBinder();
1974 notifyActivityDrawn(token);
1975 reply.writeNoException();
1976 return true;
1977 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07001978
1979 case RESTART_TRANSACTION: {
1980 data.enforceInterface(IActivityManager.descriptor);
1981 restart();
1982 reply.writeNoException();
1983 return true;
1984 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07001985
1986 case GET_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1987 data.enforceInterface(IActivityManager.descriptor);
1988 final String sourcePackage = data.readString();
1989 final String targetPackage = data.readString();
1990 final int modeFlags = data.readInt();
1991 final int modeMask = data.readInt();
1992 final Uri[] uris = getGrantedUriPermissions(
1993 sourcePackage, targetPackage, modeFlags, modeMask);
1994 reply.writeNoException();
1995 reply.writeParcelableArray(uris, 0);
1996 return true;
1997 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001998 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001999
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002000 return super.onTransact(code, data, reply, flags);
2001 }
2002
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002003 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002004 return this;
2005 }
2006
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002007 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2008 protected IActivityManager create() {
2009 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002010 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002011 Log.v("ActivityManager", "default service binder = " + b);
2012 }
2013 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002014 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002015 Log.v("ActivityManager", "default service = " + am);
2016 }
2017 return am;
2018 }
2019 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002020}
2021
2022class ActivityManagerProxy implements IActivityManager
2023{
2024 public ActivityManagerProxy(IBinder remote)
2025 {
2026 mRemote = remote;
2027 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002028
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002029 public IBinder asBinder()
2030 {
2031 return mRemote;
2032 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002033
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002034 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002035 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2036 int startFlags, String profileFile,
2037 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002038 Parcel data = Parcel.obtain();
2039 Parcel reply = Parcel.obtain();
2040 data.writeInterfaceToken(IActivityManager.descriptor);
2041 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002042 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002043 intent.writeToParcel(data, 0);
2044 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002045 data.writeStrongBinder(resultTo);
2046 data.writeString(resultWho);
2047 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002048 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002049 data.writeString(profileFile);
2050 if (profileFd != null) {
2051 data.writeInt(1);
2052 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2053 } else {
2054 data.writeInt(0);
2055 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002056 if (options != null) {
2057 data.writeInt(1);
2058 options.writeToParcel(data, 0);
2059 } else {
2060 data.writeInt(0);
2061 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002062 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2063 reply.readException();
2064 int result = reply.readInt();
2065 reply.recycle();
2066 data.recycle();
2067 return result;
2068 }
Amith Yamasani82644082012-08-03 13:09:11 -07002069
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002070 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002071 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2072 int startFlags, String profileFile,
2073 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2074 Parcel data = Parcel.obtain();
2075 Parcel reply = Parcel.obtain();
2076 data.writeInterfaceToken(IActivityManager.descriptor);
2077 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002078 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002079 intent.writeToParcel(data, 0);
2080 data.writeString(resolvedType);
2081 data.writeStrongBinder(resultTo);
2082 data.writeString(resultWho);
2083 data.writeInt(requestCode);
2084 data.writeInt(startFlags);
2085 data.writeString(profileFile);
2086 if (profileFd != null) {
2087 data.writeInt(1);
2088 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2089 } else {
2090 data.writeInt(0);
2091 }
2092 if (options != null) {
2093 data.writeInt(1);
2094 options.writeToParcel(data, 0);
2095 } else {
2096 data.writeInt(0);
2097 }
2098 data.writeInt(userId);
2099 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2100 reply.readException();
2101 int result = reply.readInt();
2102 reply.recycle();
2103 data.recycle();
2104 return result;
2105 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002106 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2107 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002108 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002109 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002110 Parcel data = Parcel.obtain();
2111 Parcel reply = Parcel.obtain();
2112 data.writeInterfaceToken(IActivityManager.descriptor);
2113 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002114 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002115 intent.writeToParcel(data, 0);
2116 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002117 data.writeStrongBinder(resultTo);
2118 data.writeString(resultWho);
2119 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002120 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002121 data.writeString(profileFile);
2122 if (profileFd != null) {
2123 data.writeInt(1);
2124 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2125 } else {
2126 data.writeInt(0);
2127 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002128 if (options != null) {
2129 data.writeInt(1);
2130 options.writeToParcel(data, 0);
2131 } else {
2132 data.writeInt(0);
2133 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002134 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002135 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2136 reply.readException();
2137 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2138 reply.recycle();
2139 data.recycle();
2140 return result;
2141 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002142 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2143 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002144 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002145 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002146 Parcel data = Parcel.obtain();
2147 Parcel reply = Parcel.obtain();
2148 data.writeInterfaceToken(IActivityManager.descriptor);
2149 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002150 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002151 intent.writeToParcel(data, 0);
2152 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002153 data.writeStrongBinder(resultTo);
2154 data.writeString(resultWho);
2155 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002156 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002157 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002158 if (options != null) {
2159 data.writeInt(1);
2160 options.writeToParcel(data, 0);
2161 } else {
2162 data.writeInt(0);
2163 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002164 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002165 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2166 reply.readException();
2167 int result = reply.readInt();
2168 reply.recycle();
2169 data.recycle();
2170 return result;
2171 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002172 public int startActivityIntentSender(IApplicationThread caller,
2173 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002174 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002175 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002176 Parcel data = Parcel.obtain();
2177 Parcel reply = Parcel.obtain();
2178 data.writeInterfaceToken(IActivityManager.descriptor);
2179 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2180 intent.writeToParcel(data, 0);
2181 if (fillInIntent != null) {
2182 data.writeInt(1);
2183 fillInIntent.writeToParcel(data, 0);
2184 } else {
2185 data.writeInt(0);
2186 }
2187 data.writeString(resolvedType);
2188 data.writeStrongBinder(resultTo);
2189 data.writeString(resultWho);
2190 data.writeInt(requestCode);
2191 data.writeInt(flagsMask);
2192 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002193 if (options != null) {
2194 data.writeInt(1);
2195 options.writeToParcel(data, 0);
2196 } else {
2197 data.writeInt(0);
2198 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002199 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002200 reply.readException();
2201 int result = reply.readInt();
2202 reply.recycle();
2203 data.recycle();
2204 return result;
2205 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002206 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002207 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002208 Parcel data = Parcel.obtain();
2209 Parcel reply = Parcel.obtain();
2210 data.writeInterfaceToken(IActivityManager.descriptor);
2211 data.writeStrongBinder(callingActivity);
2212 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002213 if (options != null) {
2214 data.writeInt(1);
2215 options.writeToParcel(data, 0);
2216 } else {
2217 data.writeInt(0);
2218 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002219 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2220 reply.readException();
2221 int result = reply.readInt();
2222 reply.recycle();
2223 data.recycle();
2224 return result != 0;
2225 }
2226 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2227 throws RemoteException {
2228 Parcel data = Parcel.obtain();
2229 Parcel reply = Parcel.obtain();
2230 data.writeInterfaceToken(IActivityManager.descriptor);
2231 data.writeStrongBinder(token);
2232 data.writeInt(resultCode);
2233 if (resultData != null) {
2234 data.writeInt(1);
2235 resultData.writeToParcel(data, 0);
2236 } else {
2237 data.writeInt(0);
2238 }
2239 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2240 reply.readException();
2241 boolean res = reply.readInt() != 0;
2242 data.recycle();
2243 reply.recycle();
2244 return res;
2245 }
2246 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2247 {
2248 Parcel data = Parcel.obtain();
2249 Parcel reply = Parcel.obtain();
2250 data.writeInterfaceToken(IActivityManager.descriptor);
2251 data.writeStrongBinder(token);
2252 data.writeString(resultWho);
2253 data.writeInt(requestCode);
2254 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2255 reply.readException();
2256 data.recycle();
2257 reply.recycle();
2258 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002259 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2260 Parcel data = Parcel.obtain();
2261 Parcel reply = Parcel.obtain();
2262 data.writeInterfaceToken(IActivityManager.descriptor);
2263 data.writeStrongBinder(token);
2264 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2265 reply.readException();
2266 boolean res = reply.readInt() != 0;
2267 data.recycle();
2268 reply.recycle();
2269 return res;
2270 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002271 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2272 Parcel data = Parcel.obtain();
2273 Parcel reply = Parcel.obtain();
2274 data.writeInterfaceToken(IActivityManager.descriptor);
2275 data.writeStrongBinder(token);
2276 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2277 reply.readException();
2278 boolean res = reply.readInt() != 0;
2279 data.recycle();
2280 reply.recycle();
2281 return res;
2282 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002283 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002284 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002285 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002286 {
2287 Parcel data = Parcel.obtain();
2288 Parcel reply = Parcel.obtain();
2289 data.writeInterfaceToken(IActivityManager.descriptor);
2290 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002291 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002292 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2293 filter.writeToParcel(data, 0);
2294 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002295 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002296 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2297 reply.readException();
2298 Intent intent = null;
2299 int haveIntent = reply.readInt();
2300 if (haveIntent != 0) {
2301 intent = Intent.CREATOR.createFromParcel(reply);
2302 }
2303 reply.recycle();
2304 data.recycle();
2305 return intent;
2306 }
2307 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2308 {
2309 Parcel data = Parcel.obtain();
2310 Parcel reply = Parcel.obtain();
2311 data.writeInterfaceToken(IActivityManager.descriptor);
2312 data.writeStrongBinder(receiver.asBinder());
2313 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2314 reply.readException();
2315 data.recycle();
2316 reply.recycle();
2317 }
2318 public int broadcastIntent(IApplicationThread caller,
2319 Intent intent, String resolvedType, IIntentReceiver resultTo,
2320 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002321 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002322 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002323 {
2324 Parcel data = Parcel.obtain();
2325 Parcel reply = Parcel.obtain();
2326 data.writeInterfaceToken(IActivityManager.descriptor);
2327 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2328 intent.writeToParcel(data, 0);
2329 data.writeString(resolvedType);
2330 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2331 data.writeInt(resultCode);
2332 data.writeString(resultData);
2333 data.writeBundle(map);
2334 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002335 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002336 data.writeInt(serialized ? 1 : 0);
2337 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002338 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002339 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2340 reply.readException();
2341 int res = reply.readInt();
2342 reply.recycle();
2343 data.recycle();
2344 return res;
2345 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002346 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2347 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002348 {
2349 Parcel data = Parcel.obtain();
2350 Parcel reply = Parcel.obtain();
2351 data.writeInterfaceToken(IActivityManager.descriptor);
2352 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2353 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002354 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002355 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2356 reply.readException();
2357 data.recycle();
2358 reply.recycle();
2359 }
2360 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2361 {
2362 Parcel data = Parcel.obtain();
2363 Parcel reply = Parcel.obtain();
2364 data.writeInterfaceToken(IActivityManager.descriptor);
2365 data.writeStrongBinder(who);
2366 data.writeInt(resultCode);
2367 data.writeString(resultData);
2368 data.writeBundle(map);
2369 data.writeInt(abortBroadcast ? 1 : 0);
2370 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2371 reply.readException();
2372 data.recycle();
2373 reply.recycle();
2374 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002375 public void attachApplication(IApplicationThread app) throws RemoteException
2376 {
2377 Parcel data = Parcel.obtain();
2378 Parcel reply = Parcel.obtain();
2379 data.writeInterfaceToken(IActivityManager.descriptor);
2380 data.writeStrongBinder(app.asBinder());
2381 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2382 reply.readException();
2383 data.recycle();
2384 reply.recycle();
2385 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002386 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2387 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002388 {
2389 Parcel data = Parcel.obtain();
2390 Parcel reply = Parcel.obtain();
2391 data.writeInterfaceToken(IActivityManager.descriptor);
2392 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002393 if (config != null) {
2394 data.writeInt(1);
2395 config.writeToParcel(data, 0);
2396 } else {
2397 data.writeInt(0);
2398 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002399 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002400 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2401 reply.readException();
2402 data.recycle();
2403 reply.recycle();
2404 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002405 public void activityResumed(IBinder token) throws RemoteException
2406 {
2407 Parcel data = Parcel.obtain();
2408 Parcel reply = Parcel.obtain();
2409 data.writeInterfaceToken(IActivityManager.descriptor);
2410 data.writeStrongBinder(token);
2411 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2412 reply.readException();
2413 data.recycle();
2414 reply.recycle();
2415 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002416 public void activityPaused(IBinder token) throws RemoteException
2417 {
2418 Parcel data = Parcel.obtain();
2419 Parcel reply = Parcel.obtain();
2420 data.writeInterfaceToken(IActivityManager.descriptor);
2421 data.writeStrongBinder(token);
2422 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2423 reply.readException();
2424 data.recycle();
2425 reply.recycle();
2426 }
2427 public void activityStopped(IBinder token, Bundle state,
2428 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002429 {
2430 Parcel data = Parcel.obtain();
2431 Parcel reply = Parcel.obtain();
2432 data.writeInterfaceToken(IActivityManager.descriptor);
2433 data.writeStrongBinder(token);
2434 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002435 if (thumbnail != null) {
2436 data.writeInt(1);
2437 thumbnail.writeToParcel(data, 0);
2438 } else {
2439 data.writeInt(0);
2440 }
2441 TextUtils.writeToParcel(description, data, 0);
2442 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2443 reply.readException();
2444 data.recycle();
2445 reply.recycle();
2446 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002447 public void activitySlept(IBinder token) throws RemoteException
2448 {
2449 Parcel data = Parcel.obtain();
2450 Parcel reply = Parcel.obtain();
2451 data.writeInterfaceToken(IActivityManager.descriptor);
2452 data.writeStrongBinder(token);
2453 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2454 reply.readException();
2455 data.recycle();
2456 reply.recycle();
2457 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002458 public void activityDestroyed(IBinder token) throws RemoteException
2459 {
2460 Parcel data = Parcel.obtain();
2461 Parcel reply = Parcel.obtain();
2462 data.writeInterfaceToken(IActivityManager.descriptor);
2463 data.writeStrongBinder(token);
2464 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2465 reply.readException();
2466 data.recycle();
2467 reply.recycle();
2468 }
2469 public String getCallingPackage(IBinder token) throws RemoteException
2470 {
2471 Parcel data = Parcel.obtain();
2472 Parcel reply = Parcel.obtain();
2473 data.writeInterfaceToken(IActivityManager.descriptor);
2474 data.writeStrongBinder(token);
2475 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2476 reply.readException();
2477 String res = reply.readString();
2478 data.recycle();
2479 reply.recycle();
2480 return res;
2481 }
2482 public ComponentName getCallingActivity(IBinder token)
2483 throws RemoteException {
2484 Parcel data = Parcel.obtain();
2485 Parcel reply = Parcel.obtain();
2486 data.writeInterfaceToken(IActivityManager.descriptor);
2487 data.writeStrongBinder(token);
2488 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2489 reply.readException();
2490 ComponentName res = ComponentName.readFromParcel(reply);
2491 data.recycle();
2492 reply.recycle();
2493 return res;
2494 }
2495 public List getTasks(int maxNum, int flags,
2496 IThumbnailReceiver receiver) throws RemoteException {
2497 Parcel data = Parcel.obtain();
2498 Parcel reply = Parcel.obtain();
2499 data.writeInterfaceToken(IActivityManager.descriptor);
2500 data.writeInt(maxNum);
2501 data.writeInt(flags);
2502 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2503 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2504 reply.readException();
2505 ArrayList list = null;
2506 int N = reply.readInt();
2507 if (N >= 0) {
2508 list = new ArrayList();
2509 while (N > 0) {
2510 ActivityManager.RunningTaskInfo info =
2511 ActivityManager.RunningTaskInfo.CREATOR
2512 .createFromParcel(reply);
2513 list.add(info);
2514 N--;
2515 }
2516 }
2517 data.recycle();
2518 reply.recycle();
2519 return list;
2520 }
2521 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002522 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002523 Parcel data = Parcel.obtain();
2524 Parcel reply = Parcel.obtain();
2525 data.writeInterfaceToken(IActivityManager.descriptor);
2526 data.writeInt(maxNum);
2527 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002528 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002529 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2530 reply.readException();
2531 ArrayList<ActivityManager.RecentTaskInfo> list
2532 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2533 data.recycle();
2534 reply.recycle();
2535 return list;
2536 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002537 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002538 Parcel data = Parcel.obtain();
2539 Parcel reply = Parcel.obtain();
2540 data.writeInterfaceToken(IActivityManager.descriptor);
2541 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002542 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002543 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002544 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002545 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002546 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002547 }
2548 data.recycle();
2549 reply.recycle();
2550 return bm;
2551 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002552 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2553 Parcel data = Parcel.obtain();
2554 Parcel reply = Parcel.obtain();
2555 data.writeInterfaceToken(IActivityManager.descriptor);
2556 data.writeInt(id);
2557 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2558 reply.readException();
2559 Bitmap bm = null;
2560 if (reply.readInt() != 0) {
2561 bm = Bitmap.CREATOR.createFromParcel(reply);
2562 }
2563 data.recycle();
2564 reply.recycle();
2565 return bm;
2566 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002567 public List getServices(int maxNum, int flags) throws RemoteException {
2568 Parcel data = Parcel.obtain();
2569 Parcel reply = Parcel.obtain();
2570 data.writeInterfaceToken(IActivityManager.descriptor);
2571 data.writeInt(maxNum);
2572 data.writeInt(flags);
2573 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2574 reply.readException();
2575 ArrayList list = null;
2576 int N = reply.readInt();
2577 if (N >= 0) {
2578 list = new ArrayList();
2579 while (N > 0) {
2580 ActivityManager.RunningServiceInfo info =
2581 ActivityManager.RunningServiceInfo.CREATOR
2582 .createFromParcel(reply);
2583 list.add(info);
2584 N--;
2585 }
2586 }
2587 data.recycle();
2588 reply.recycle();
2589 return list;
2590 }
2591 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2592 throws RemoteException {
2593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2597 reply.readException();
2598 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2599 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2600 data.recycle();
2601 reply.recycle();
2602 return list;
2603 }
2604 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2605 throws RemoteException {
2606 Parcel data = Parcel.obtain();
2607 Parcel reply = Parcel.obtain();
2608 data.writeInterfaceToken(IActivityManager.descriptor);
2609 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2610 reply.readException();
2611 ArrayList<ActivityManager.RunningAppProcessInfo> list
2612 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2613 data.recycle();
2614 reply.recycle();
2615 return list;
2616 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002617 public List<ApplicationInfo> getRunningExternalApplications()
2618 throws RemoteException {
2619 Parcel data = Parcel.obtain();
2620 Parcel reply = Parcel.obtain();
2621 data.writeInterfaceToken(IActivityManager.descriptor);
2622 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2623 reply.readException();
2624 ArrayList<ApplicationInfo> list
2625 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2626 data.recycle();
2627 reply.recycle();
2628 return list;
2629 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002630 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002631 {
2632 Parcel data = Parcel.obtain();
2633 Parcel reply = Parcel.obtain();
2634 data.writeInterfaceToken(IActivityManager.descriptor);
2635 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002636 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002637 if (options != null) {
2638 data.writeInt(1);
2639 options.writeToParcel(data, 0);
2640 } else {
2641 data.writeInt(0);
2642 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002643 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2644 reply.readException();
2645 data.recycle();
2646 reply.recycle();
2647 }
2648 public void moveTaskToBack(int task) throws RemoteException
2649 {
2650 Parcel data = Parcel.obtain();
2651 Parcel reply = Parcel.obtain();
2652 data.writeInterfaceToken(IActivityManager.descriptor);
2653 data.writeInt(task);
2654 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2655 reply.readException();
2656 data.recycle();
2657 reply.recycle();
2658 }
2659 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2660 throws RemoteException {
2661 Parcel data = Parcel.obtain();
2662 Parcel reply = Parcel.obtain();
2663 data.writeInterfaceToken(IActivityManager.descriptor);
2664 data.writeStrongBinder(token);
2665 data.writeInt(nonRoot ? 1 : 0);
2666 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2667 reply.readException();
2668 boolean res = reply.readInt() != 0;
2669 data.recycle();
2670 reply.recycle();
2671 return res;
2672 }
2673 public void moveTaskBackwards(int task) throws RemoteException
2674 {
2675 Parcel data = Parcel.obtain();
2676 Parcel reply = Parcel.obtain();
2677 data.writeInterfaceToken(IActivityManager.descriptor);
2678 data.writeInt(task);
2679 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2680 reply.readException();
2681 data.recycle();
2682 reply.recycle();
2683 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002684 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002685 public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002686 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002687 {
2688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002690 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002691 data.writeInt(taskId);
Craig Mautner5a449152013-05-24 15:49:29 -07002692 data.writeInt(relativeStackBoxId);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002693 data.writeInt(position);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002694 data.writeFloat(weight);
2695 mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
2696 reply.readException();
2697 int res = reply.readInt();
2698 data.recycle();
2699 reply.recycle();
2700 return res;
2701 }
2702 @Override
2703 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2704 {
2705 Parcel data = Parcel.obtain();
2706 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002707 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002708 data.writeInt(taskId);
2709 data.writeInt(stackId);
2710 data.writeInt(toTop ? 1 : 0);
2711 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2712 reply.readException();
2713 data.recycle();
2714 reply.recycle();
2715 }
2716 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002717 public void resizeStackBox(int stackBoxId, float weight) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002718 {
2719 Parcel data = Parcel.obtain();
2720 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002721 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002722 data.writeInt(stackBoxId);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002723 data.writeFloat(weight);
Craig Mautnercf910b02013-04-23 11:23:27 -07002724 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002725 reply.readException();
2726 data.recycle();
2727 reply.recycle();
2728 }
Craig Mautner967212c2013-04-13 21:10:58 -07002729 @Override
Craig Mautner5ff12102013-05-24 12:50:15 -07002730 public List<StackBoxInfo> getStackBoxes() throws RemoteException
2731 {
2732 Parcel data = Parcel.obtain();
2733 Parcel reply = Parcel.obtain();
2734 data.writeInterfaceToken(IActivityManager.descriptor);
2735 mRemote.transact(GET_STACK_BOXES_TRANSACTION, data, reply, 0);
2736 reply.readException();
2737 ArrayList<StackBoxInfo> list = reply.createTypedArrayList(StackBoxInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002738 data.recycle();
2739 reply.recycle();
2740 return list;
2741 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002742 @Override
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002743 public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException
2744 {
2745 Parcel data = Parcel.obtain();
2746 Parcel reply = Parcel.obtain();
2747 data.writeInterfaceToken(IActivityManager.descriptor);
2748 data.writeInt(stackBoxId);
2749 mRemote.transact(GET_STACK_BOX_INFO_TRANSACTION, data, reply, 0);
2750 reply.readException();
2751 int res = reply.readInt();
2752 StackBoxInfo info = null;
2753 if (res != 0) {
2754 info = StackBoxInfo.CREATOR.createFromParcel(reply);
2755 }
2756 data.recycle();
2757 reply.recycle();
2758 return info;
2759 }
2760 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002761 public void setFocusedStack(int stackId) throws RemoteException
2762 {
2763 Parcel data = Parcel.obtain();
2764 Parcel reply = Parcel.obtain();
2765 data.writeInterfaceToken(IActivityManager.descriptor);
2766 data.writeInt(stackId);
2767 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2768 reply.readException();
2769 data.recycle();
2770 reply.recycle();
2771 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002772 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2773 {
2774 Parcel data = Parcel.obtain();
2775 Parcel reply = Parcel.obtain();
2776 data.writeInterfaceToken(IActivityManager.descriptor);
2777 data.writeStrongBinder(token);
2778 data.writeInt(onlyRoot ? 1 : 0);
2779 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2780 reply.readException();
2781 int res = reply.readInt();
2782 data.recycle();
2783 reply.recycle();
2784 return res;
2785 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002786 public void reportThumbnail(IBinder token,
2787 Bitmap thumbnail, CharSequence description) throws RemoteException
2788 {
2789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
2791 data.writeInterfaceToken(IActivityManager.descriptor);
2792 data.writeStrongBinder(token);
2793 if (thumbnail != null) {
2794 data.writeInt(1);
2795 thumbnail.writeToParcel(data, 0);
2796 } else {
2797 data.writeInt(0);
2798 }
2799 TextUtils.writeToParcel(description, data, 0);
2800 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2801 reply.readException();
2802 data.recycle();
2803 reply.recycle();
2804 }
2805 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002806 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2811 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002812 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002813 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002814 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2815 reply.readException();
2816 int res = reply.readInt();
2817 ContentProviderHolder cph = null;
2818 if (res != 0) {
2819 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2820 }
2821 data.recycle();
2822 reply.recycle();
2823 return cph;
2824 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002825 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2826 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002827 Parcel data = Parcel.obtain();
2828 Parcel reply = Parcel.obtain();
2829 data.writeInterfaceToken(IActivityManager.descriptor);
2830 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002831 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002832 data.writeStrongBinder(token);
2833 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2834 reply.readException();
2835 int res = reply.readInt();
2836 ContentProviderHolder cph = null;
2837 if (res != 0) {
2838 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2839 }
2840 data.recycle();
2841 reply.recycle();
2842 return cph;
2843 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002844 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002845 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002846 {
2847 Parcel data = Parcel.obtain();
2848 Parcel reply = Parcel.obtain();
2849 data.writeInterfaceToken(IActivityManager.descriptor);
2850 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2851 data.writeTypedList(providers);
2852 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2853 reply.readException();
2854 data.recycle();
2855 reply.recycle();
2856 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002857 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2858 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002859 Parcel data = Parcel.obtain();
2860 Parcel reply = Parcel.obtain();
2861 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002862 data.writeStrongBinder(connection);
2863 data.writeInt(stable);
2864 data.writeInt(unstable);
2865 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2866 reply.readException();
2867 boolean res = reply.readInt() != 0;
2868 data.recycle();
2869 reply.recycle();
2870 return res;
2871 }
2872 public void unstableProviderDied(IBinder connection) throws RemoteException {
2873 Parcel data = Parcel.obtain();
2874 Parcel reply = Parcel.obtain();
2875 data.writeInterfaceToken(IActivityManager.descriptor);
2876 data.writeStrongBinder(connection);
2877 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2878 reply.readException();
2879 data.recycle();
2880 reply.recycle();
2881 }
2882
2883 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2884 Parcel data = Parcel.obtain();
2885 Parcel reply = Parcel.obtain();
2886 data.writeInterfaceToken(IActivityManager.descriptor);
2887 data.writeStrongBinder(connection);
2888 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002889 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2890 reply.readException();
2891 data.recycle();
2892 reply.recycle();
2893 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002894
2895 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2896 Parcel data = Parcel.obtain();
2897 Parcel reply = Parcel.obtain();
2898 data.writeInterfaceToken(IActivityManager.descriptor);
2899 data.writeString(name);
2900 data.writeStrongBinder(token);
2901 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2902 reply.readException();
2903 data.recycle();
2904 reply.recycle();
2905 }
2906
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002907 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2908 throws RemoteException
2909 {
2910 Parcel data = Parcel.obtain();
2911 Parcel reply = Parcel.obtain();
2912 data.writeInterfaceToken(IActivityManager.descriptor);
2913 service.writeToParcel(data, 0);
2914 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2915 reply.readException();
2916 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2917 data.recycle();
2918 reply.recycle();
2919 return res;
2920 }
2921
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002922 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002923 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002924 {
2925 Parcel data = Parcel.obtain();
2926 Parcel reply = Parcel.obtain();
2927 data.writeInterfaceToken(IActivityManager.descriptor);
2928 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2929 service.writeToParcel(data, 0);
2930 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002931 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002932 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2933 reply.readException();
2934 ComponentName res = ComponentName.readFromParcel(reply);
2935 data.recycle();
2936 reply.recycle();
2937 return res;
2938 }
2939 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002940 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002941 {
2942 Parcel data = Parcel.obtain();
2943 Parcel reply = Parcel.obtain();
2944 data.writeInterfaceToken(IActivityManager.descriptor);
2945 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2946 service.writeToParcel(data, 0);
2947 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002948 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002949 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2950 reply.readException();
2951 int res = reply.readInt();
2952 reply.recycle();
2953 data.recycle();
2954 return res;
2955 }
2956 public boolean stopServiceToken(ComponentName className, IBinder token,
2957 int startId) throws RemoteException {
2958 Parcel data = Parcel.obtain();
2959 Parcel reply = Parcel.obtain();
2960 data.writeInterfaceToken(IActivityManager.descriptor);
2961 ComponentName.writeToParcel(className, data);
2962 data.writeStrongBinder(token);
2963 data.writeInt(startId);
2964 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2965 reply.readException();
2966 boolean res = reply.readInt() != 0;
2967 data.recycle();
2968 reply.recycle();
2969 return res;
2970 }
2971 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002972 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 Parcel data = Parcel.obtain();
2974 Parcel reply = Parcel.obtain();
2975 data.writeInterfaceToken(IActivityManager.descriptor);
2976 ComponentName.writeToParcel(className, data);
2977 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002978 data.writeInt(id);
2979 if (notification != null) {
2980 data.writeInt(1);
2981 notification.writeToParcel(data, 0);
2982 } else {
2983 data.writeInt(0);
2984 }
2985 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002986 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2987 reply.readException();
2988 data.recycle();
2989 reply.recycle();
2990 }
2991 public int bindService(IApplicationThread caller, IBinder token,
2992 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002993 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002994 Parcel data = Parcel.obtain();
2995 Parcel reply = Parcel.obtain();
2996 data.writeInterfaceToken(IActivityManager.descriptor);
2997 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2998 data.writeStrongBinder(token);
2999 service.writeToParcel(data, 0);
3000 data.writeString(resolvedType);
3001 data.writeStrongBinder(connection.asBinder());
3002 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003003 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003004 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3005 reply.readException();
3006 int res = reply.readInt();
3007 data.recycle();
3008 reply.recycle();
3009 return res;
3010 }
3011 public boolean unbindService(IServiceConnection connection) throws RemoteException
3012 {
3013 Parcel data = Parcel.obtain();
3014 Parcel reply = Parcel.obtain();
3015 data.writeInterfaceToken(IActivityManager.descriptor);
3016 data.writeStrongBinder(connection.asBinder());
3017 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3018 reply.readException();
3019 boolean res = reply.readInt() != 0;
3020 data.recycle();
3021 reply.recycle();
3022 return res;
3023 }
3024
3025 public void publishService(IBinder token,
3026 Intent intent, IBinder service) throws RemoteException {
3027 Parcel data = Parcel.obtain();
3028 Parcel reply = Parcel.obtain();
3029 data.writeInterfaceToken(IActivityManager.descriptor);
3030 data.writeStrongBinder(token);
3031 intent.writeToParcel(data, 0);
3032 data.writeStrongBinder(service);
3033 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3034 reply.readException();
3035 data.recycle();
3036 reply.recycle();
3037 }
3038
3039 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3040 throws RemoteException {
3041 Parcel data = Parcel.obtain();
3042 Parcel reply = Parcel.obtain();
3043 data.writeInterfaceToken(IActivityManager.descriptor);
3044 data.writeStrongBinder(token);
3045 intent.writeToParcel(data, 0);
3046 data.writeInt(doRebind ? 1 : 0);
3047 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3048 reply.readException();
3049 data.recycle();
3050 reply.recycle();
3051 }
3052
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003053 public void serviceDoneExecuting(IBinder token, int type, int startId,
3054 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003055 Parcel data = Parcel.obtain();
3056 Parcel reply = Parcel.obtain();
3057 data.writeInterfaceToken(IActivityManager.descriptor);
3058 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003059 data.writeInt(type);
3060 data.writeInt(startId);
3061 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003062 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3063 reply.readException();
3064 data.recycle();
3065 reply.recycle();
3066 }
3067
3068 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 service.writeToParcel(data, 0);
3073 data.writeString(resolvedType);
3074 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 IBinder binder = reply.readStrongBinder();
3077 reply.recycle();
3078 data.recycle();
3079 return binder;
3080 }
3081
Christopher Tate181fafa2009-05-14 11:12:14 -07003082 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3083 throws RemoteException {
3084 Parcel data = Parcel.obtain();
3085 Parcel reply = Parcel.obtain();
3086 data.writeInterfaceToken(IActivityManager.descriptor);
3087 app.writeToParcel(data, 0);
3088 data.writeInt(backupRestoreMode);
3089 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3090 reply.readException();
3091 boolean success = reply.readInt() != 0;
3092 reply.recycle();
3093 data.recycle();
3094 return success;
3095 }
3096
Christopher Tate346acb12012-10-15 19:20:25 -07003097 public void clearPendingBackup() throws RemoteException {
3098 Parcel data = Parcel.obtain();
3099 Parcel reply = Parcel.obtain();
3100 data.writeInterfaceToken(IActivityManager.descriptor);
3101 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3102 reply.recycle();
3103 data.recycle();
3104 }
3105
Christopher Tate181fafa2009-05-14 11:12:14 -07003106 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeString(packageName);
3111 data.writeStrongBinder(agent);
3112 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3113 reply.recycle();
3114 data.recycle();
3115 }
3116
3117 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3118 Parcel data = Parcel.obtain();
3119 Parcel reply = Parcel.obtain();
3120 data.writeInterfaceToken(IActivityManager.descriptor);
3121 app.writeToParcel(data, 0);
3122 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3123 reply.readException();
3124 reply.recycle();
3125 data.recycle();
3126 }
3127
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003129 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3130 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003131 Parcel data = Parcel.obtain();
3132 Parcel reply = Parcel.obtain();
3133 data.writeInterfaceToken(IActivityManager.descriptor);
3134 ComponentName.writeToParcel(className, data);
3135 data.writeString(profileFile);
3136 data.writeInt(flags);
3137 data.writeBundle(arguments);
3138 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003139 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003140 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003141 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3142 reply.readException();
3143 boolean res = reply.readInt() != 0;
3144 reply.recycle();
3145 data.recycle();
3146 return res;
3147 }
3148
3149 public void finishInstrumentation(IApplicationThread target,
3150 int resultCode, Bundle results) throws RemoteException {
3151 Parcel data = Parcel.obtain();
3152 Parcel reply = Parcel.obtain();
3153 data.writeInterfaceToken(IActivityManager.descriptor);
3154 data.writeStrongBinder(target != null ? target.asBinder() : null);
3155 data.writeInt(resultCode);
3156 data.writeBundle(results);
3157 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3158 reply.readException();
3159 data.recycle();
3160 reply.recycle();
3161 }
3162 public Configuration getConfiguration() throws RemoteException
3163 {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3168 reply.readException();
3169 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3170 reply.recycle();
3171 data.recycle();
3172 return res;
3173 }
3174 public void updateConfiguration(Configuration values) throws RemoteException
3175 {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 values.writeToParcel(data, 0);
3180 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3181 reply.readException();
3182 data.recycle();
3183 reply.recycle();
3184 }
3185 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3186 throws RemoteException {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 data.writeStrongBinder(token);
3191 data.writeInt(requestedOrientation);
3192 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3193 reply.readException();
3194 data.recycle();
3195 reply.recycle();
3196 }
3197 public int getRequestedOrientation(IBinder token) throws RemoteException {
3198 Parcel data = Parcel.obtain();
3199 Parcel reply = Parcel.obtain();
3200 data.writeInterfaceToken(IActivityManager.descriptor);
3201 data.writeStrongBinder(token);
3202 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3203 reply.readException();
3204 int res = reply.readInt();
3205 data.recycle();
3206 reply.recycle();
3207 return res;
3208 }
3209 public ComponentName getActivityClassForToken(IBinder token)
3210 throws RemoteException {
3211 Parcel data = Parcel.obtain();
3212 Parcel reply = Parcel.obtain();
3213 data.writeInterfaceToken(IActivityManager.descriptor);
3214 data.writeStrongBinder(token);
3215 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3216 reply.readException();
3217 ComponentName res = ComponentName.readFromParcel(reply);
3218 data.recycle();
3219 reply.recycle();
3220 return res;
3221 }
3222 public String getPackageForToken(IBinder token) throws RemoteException
3223 {
3224 Parcel data = Parcel.obtain();
3225 Parcel reply = Parcel.obtain();
3226 data.writeInterfaceToken(IActivityManager.descriptor);
3227 data.writeStrongBinder(token);
3228 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3229 reply.readException();
3230 String res = reply.readString();
3231 data.recycle();
3232 reply.recycle();
3233 return res;
3234 }
3235 public IIntentSender getIntentSender(int type,
3236 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003237 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003238 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003239 Parcel data = Parcel.obtain();
3240 Parcel reply = Parcel.obtain();
3241 data.writeInterfaceToken(IActivityManager.descriptor);
3242 data.writeInt(type);
3243 data.writeString(packageName);
3244 data.writeStrongBinder(token);
3245 data.writeString(resultWho);
3246 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003247 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003248 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003249 data.writeTypedArray(intents, 0);
3250 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251 } else {
3252 data.writeInt(0);
3253 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003254 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003255 if (options != null) {
3256 data.writeInt(1);
3257 options.writeToParcel(data, 0);
3258 } else {
3259 data.writeInt(0);
3260 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003261 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3263 reply.readException();
3264 IIntentSender res = IIntentSender.Stub.asInterface(
3265 reply.readStrongBinder());
3266 data.recycle();
3267 reply.recycle();
3268 return res;
3269 }
3270 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3271 Parcel data = Parcel.obtain();
3272 Parcel reply = Parcel.obtain();
3273 data.writeInterfaceToken(IActivityManager.descriptor);
3274 data.writeStrongBinder(sender.asBinder());
3275 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3276 reply.readException();
3277 data.recycle();
3278 reply.recycle();
3279 }
3280 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 data.writeStrongBinder(sender.asBinder());
3285 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3286 reply.readException();
3287 String res = reply.readString();
3288 data.recycle();
3289 reply.recycle();
3290 return res;
3291 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003292 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3293 Parcel data = Parcel.obtain();
3294 Parcel reply = Parcel.obtain();
3295 data.writeInterfaceToken(IActivityManager.descriptor);
3296 data.writeStrongBinder(sender.asBinder());
3297 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3298 reply.readException();
3299 int res = reply.readInt();
3300 data.recycle();
3301 reply.recycle();
3302 return res;
3303 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003304 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3305 boolean requireFull, String name, String callerPackage) throws RemoteException {
3306 Parcel data = Parcel.obtain();
3307 Parcel reply = Parcel.obtain();
3308 data.writeInterfaceToken(IActivityManager.descriptor);
3309 data.writeInt(callingPid);
3310 data.writeInt(callingUid);
3311 data.writeInt(userId);
3312 data.writeInt(allowAll ? 1 : 0);
3313 data.writeInt(requireFull ? 1 : 0);
3314 data.writeString(name);
3315 data.writeString(callerPackage);
3316 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 int res = reply.readInt();
3319 data.recycle();
3320 reply.recycle();
3321 return res;
3322 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003323 public void setProcessLimit(int max) throws RemoteException
3324 {
3325 Parcel data = Parcel.obtain();
3326 Parcel reply = Parcel.obtain();
3327 data.writeInterfaceToken(IActivityManager.descriptor);
3328 data.writeInt(max);
3329 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 data.recycle();
3332 reply.recycle();
3333 }
3334 public int getProcessLimit() throws RemoteException
3335 {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 int res = reply.readInt();
3342 data.recycle();
3343 reply.recycle();
3344 return res;
3345 }
3346 public void setProcessForeground(IBinder token, int pid,
3347 boolean isForeground) throws RemoteException {
3348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 data.writeStrongBinder(token);
3352 data.writeInt(pid);
3353 data.writeInt(isForeground ? 1 : 0);
3354 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3355 reply.readException();
3356 data.recycle();
3357 reply.recycle();
3358 }
3359 public int checkPermission(String permission, int pid, int uid)
3360 throws RemoteException {
3361 Parcel data = Parcel.obtain();
3362 Parcel reply = Parcel.obtain();
3363 data.writeInterfaceToken(IActivityManager.descriptor);
3364 data.writeString(permission);
3365 data.writeInt(pid);
3366 data.writeInt(uid);
3367 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3368 reply.readException();
3369 int res = reply.readInt();
3370 data.recycle();
3371 reply.recycle();
3372 return res;
3373 }
3374 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003375 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003380 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003381 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003382 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 boolean res = reply.readInt() != 0;
3385 data.recycle();
3386 reply.recycle();
3387 return res;
3388 }
3389 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3390 throws RemoteException {
3391 Parcel data = Parcel.obtain();
3392 Parcel reply = Parcel.obtain();
3393 data.writeInterfaceToken(IActivityManager.descriptor);
3394 uri.writeToParcel(data, 0);
3395 data.writeInt(pid);
3396 data.writeInt(uid);
3397 data.writeInt(mode);
3398 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3399 reply.readException();
3400 int res = reply.readInt();
3401 data.recycle();
3402 reply.recycle();
3403 return res;
3404 }
3405 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3406 Uri uri, int mode) throws RemoteException {
3407 Parcel data = Parcel.obtain();
3408 Parcel reply = Parcel.obtain();
3409 data.writeInterfaceToken(IActivityManager.descriptor);
3410 data.writeStrongBinder(caller.asBinder());
3411 data.writeString(targetPkg);
3412 uri.writeToParcel(data, 0);
3413 data.writeInt(mode);
3414 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3415 reply.readException();
3416 data.recycle();
3417 reply.recycle();
3418 }
3419 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3420 int mode) throws RemoteException {
3421 Parcel data = Parcel.obtain();
3422 Parcel reply = Parcel.obtain();
3423 data.writeInterfaceToken(IActivityManager.descriptor);
3424 data.writeStrongBinder(caller.asBinder());
3425 uri.writeToParcel(data, 0);
3426 data.writeInt(mode);
3427 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 data.recycle();
3430 reply.recycle();
3431 }
3432 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3433 throws RemoteException {
3434 Parcel data = Parcel.obtain();
3435 Parcel reply = Parcel.obtain();
3436 data.writeInterfaceToken(IActivityManager.descriptor);
3437 data.writeStrongBinder(who.asBinder());
3438 data.writeInt(waiting ? 1 : 0);
3439 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3440 reply.readException();
3441 data.recycle();
3442 reply.recycle();
3443 }
3444 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3445 Parcel data = Parcel.obtain();
3446 Parcel reply = Parcel.obtain();
3447 data.writeInterfaceToken(IActivityManager.descriptor);
3448 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3449 reply.readException();
3450 outInfo.readFromParcel(reply);
3451 data.recycle();
3452 reply.recycle();
3453 }
3454 public void unhandledBack() throws RemoteException
3455 {
3456 Parcel data = Parcel.obtain();
3457 Parcel reply = Parcel.obtain();
3458 data.writeInterfaceToken(IActivityManager.descriptor);
3459 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3460 reply.readException();
3461 data.recycle();
3462 reply.recycle();
3463 }
3464 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3465 {
3466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
3468 data.writeInterfaceToken(IActivityManager.descriptor);
3469 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3470 reply.readException();
3471 ParcelFileDescriptor pfd = null;
3472 if (reply.readInt() != 0) {
3473 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3474 }
3475 data.recycle();
3476 reply.recycle();
3477 return pfd;
3478 }
3479 public void goingToSleep() throws RemoteException
3480 {
3481 Parcel data = Parcel.obtain();
3482 Parcel reply = Parcel.obtain();
3483 data.writeInterfaceToken(IActivityManager.descriptor);
3484 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3485 reply.readException();
3486 data.recycle();
3487 reply.recycle();
3488 }
3489 public void wakingUp() throws RemoteException
3490 {
3491 Parcel data = Parcel.obtain();
3492 Parcel reply = Parcel.obtain();
3493 data.writeInterfaceToken(IActivityManager.descriptor);
3494 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 data.recycle();
3497 reply.recycle();
3498 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003499 public void setLockScreenShown(boolean shown) throws RemoteException
3500 {
3501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 data.writeInt(shown ? 1 : 0);
3505 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3506 reply.readException();
3507 data.recycle();
3508 reply.recycle();
3509 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003510 public void setDebugApp(
3511 String packageName, boolean waitForDebugger, boolean persistent)
3512 throws RemoteException
3513 {
3514 Parcel data = Parcel.obtain();
3515 Parcel reply = Parcel.obtain();
3516 data.writeInterfaceToken(IActivityManager.descriptor);
3517 data.writeString(packageName);
3518 data.writeInt(waitForDebugger ? 1 : 0);
3519 data.writeInt(persistent ? 1 : 0);
3520 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3521 reply.readException();
3522 data.recycle();
3523 reply.recycle();
3524 }
3525 public void setAlwaysFinish(boolean enabled) throws RemoteException
3526 {
3527 Parcel data = Parcel.obtain();
3528 Parcel reply = Parcel.obtain();
3529 data.writeInterfaceToken(IActivityManager.descriptor);
3530 data.writeInt(enabled ? 1 : 0);
3531 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3532 reply.readException();
3533 data.recycle();
3534 reply.recycle();
3535 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003536 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003537 {
3538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003542 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003543 reply.readException();
3544 data.recycle();
3545 reply.recycle();
3546 }
3547 public void enterSafeMode() throws RemoteException {
3548 Parcel data = Parcel.obtain();
3549 data.writeInterfaceToken(IActivityManager.descriptor);
3550 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3551 data.recycle();
3552 }
3553 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3554 Parcel data = Parcel.obtain();
3555 data.writeStrongBinder(sender.asBinder());
3556 data.writeInterfaceToken(IActivityManager.descriptor);
3557 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3558 data.recycle();
3559 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003560 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003565 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003566 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003567 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003568 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003569 boolean res = reply.readInt() != 0;
3570 data.recycle();
3571 reply.recycle();
3572 return res;
3573 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003574 @Override
3575 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3576 Parcel data = Parcel.obtain();
3577 Parcel reply = Parcel.obtain();
3578 data.writeInterfaceToken(IActivityManager.descriptor);
3579 data.writeString(reason);
3580 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3581 boolean res = reply.readInt() != 0;
3582 data.recycle();
3583 reply.recycle();
3584 return res;
3585 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003586 public void startRunning(String pkg, String cls, String action,
3587 String indata) throws RemoteException {
3588 Parcel data = Parcel.obtain();
3589 Parcel reply = Parcel.obtain();
3590 data.writeInterfaceToken(IActivityManager.descriptor);
3591 data.writeString(pkg);
3592 data.writeString(cls);
3593 data.writeString(action);
3594 data.writeString(indata);
3595 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3596 reply.readException();
3597 data.recycle();
3598 reply.recycle();
3599 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003600 public boolean testIsSystemReady()
3601 {
3602 /* this base class version is never called */
3603 return true;
3604 }
Dan Egnor60d87622009-12-16 16:32:58 -08003605 public void handleApplicationCrash(IBinder app,
3606 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3607 {
3608 Parcel data = Parcel.obtain();
3609 Parcel reply = Parcel.obtain();
3610 data.writeInterfaceToken(IActivityManager.descriptor);
3611 data.writeStrongBinder(app);
3612 crashInfo.writeToParcel(data, 0);
3613 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3614 reply.readException();
3615 reply.recycle();
3616 data.recycle();
3617 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003618
Dan Egnor60d87622009-12-16 16:32:58 -08003619 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003620 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003621 {
3622 Parcel data = Parcel.obtain();
3623 Parcel reply = Parcel.obtain();
3624 data.writeInterfaceToken(IActivityManager.descriptor);
3625 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003626 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003627 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003628 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003629 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003630 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003631 reply.recycle();
3632 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003633 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003634 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003635
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003636 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003637 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003638 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003639 {
3640 Parcel data = Parcel.obtain();
3641 Parcel reply = Parcel.obtain();
3642 data.writeInterfaceToken(IActivityManager.descriptor);
3643 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003644 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003645 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003646 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 reply.recycle();
3649 data.recycle();
3650 }
3651
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003652 public void signalPersistentProcesses(int sig) throws RemoteException {
3653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 data.writeInt(sig);
3657 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 data.recycle();
3660 reply.recycle();
3661 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003662
Dianne Hackborn1676c852012-09-10 14:52:30 -07003663 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003664 Parcel data = Parcel.obtain();
3665 Parcel reply = Parcel.obtain();
3666 data.writeInterfaceToken(IActivityManager.descriptor);
3667 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003668 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003669 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3670 reply.readException();
3671 data.recycle();
3672 reply.recycle();
3673 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003674
3675 public void killAllBackgroundProcesses() throws RemoteException {
3676 Parcel data = Parcel.obtain();
3677 Parcel reply = Parcel.obtain();
3678 data.writeInterfaceToken(IActivityManager.descriptor);
3679 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3680 reply.readException();
3681 data.recycle();
3682 reply.recycle();
3683 }
3684
Dianne Hackborn1676c852012-09-10 14:52:30 -07003685 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003686 Parcel data = Parcel.obtain();
3687 Parcel reply = Parcel.obtain();
3688 data.writeInterfaceToken(IActivityManager.descriptor);
3689 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003690 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003691 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003692 reply.readException();
3693 data.recycle();
3694 reply.recycle();
3695 }
3696
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003697 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3698 throws RemoteException
3699 {
3700 Parcel data = Parcel.obtain();
3701 Parcel reply = Parcel.obtain();
3702 data.writeInterfaceToken(IActivityManager.descriptor);
3703 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3704 reply.readException();
3705 outInfo.readFromParcel(reply);
3706 reply.recycle();
3707 data.recycle();
3708 }
3709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003710 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3711 {
3712 Parcel data = Parcel.obtain();
3713 Parcel reply = Parcel.obtain();
3714 data.writeInterfaceToken(IActivityManager.descriptor);
3715 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3716 reply.readException();
3717 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3718 reply.recycle();
3719 data.recycle();
3720 return res;
3721 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003722
Dianne Hackborn1676c852012-09-10 14:52:30 -07003723 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003724 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003725 {
3726 Parcel data = Parcel.obtain();
3727 Parcel reply = Parcel.obtain();
3728 data.writeInterfaceToken(IActivityManager.descriptor);
3729 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003730 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003731 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003732 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003733 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003734 if (fd != null) {
3735 data.writeInt(1);
3736 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3737 } else {
3738 data.writeInt(0);
3739 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003740 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3741 reply.readException();
3742 boolean res = reply.readInt() != 0;
3743 reply.recycle();
3744 data.recycle();
3745 return res;
3746 }
3747
Dianne Hackborn55280a92009-05-07 15:53:46 -07003748 public boolean shutdown(int timeout) throws RemoteException
3749 {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 data.writeInt(timeout);
3754 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3755 reply.readException();
3756 boolean res = reply.readInt() != 0;
3757 reply.recycle();
3758 data.recycle();
3759 return res;
3760 }
3761
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003762 public void stopAppSwitches() throws RemoteException {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3767 reply.readException();
3768 reply.recycle();
3769 data.recycle();
3770 }
3771
3772 public void resumeAppSwitches() throws RemoteException {
3773 Parcel data = Parcel.obtain();
3774 Parcel reply = Parcel.obtain();
3775 data.writeInterfaceToken(IActivityManager.descriptor);
3776 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3777 reply.readException();
3778 reply.recycle();
3779 data.recycle();
3780 }
3781
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003782 public void killApplicationWithAppId(String pkg, int appid, String reason)
3783 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003784 Parcel data = Parcel.obtain();
3785 Parcel reply = Parcel.obtain();
3786 data.writeInterfaceToken(IActivityManager.descriptor);
3787 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003788 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003789 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003790 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003791 reply.readException();
3792 data.recycle();
3793 reply.recycle();
3794 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003795
3796 public void closeSystemDialogs(String reason) throws RemoteException {
3797 Parcel data = Parcel.obtain();
3798 Parcel reply = Parcel.obtain();
3799 data.writeInterfaceToken(IActivityManager.descriptor);
3800 data.writeString(reason);
3801 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3802 reply.readException();
3803 data.recycle();
3804 reply.recycle();
3805 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003806
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003807 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003808 throws RemoteException {
3809 Parcel data = Parcel.obtain();
3810 Parcel reply = Parcel.obtain();
3811 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003812 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003813 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3814 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003815 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003816 data.recycle();
3817 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003818 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003819 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003820
3821 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3822 Parcel data = Parcel.obtain();
3823 Parcel reply = Parcel.obtain();
3824 data.writeInterfaceToken(IActivityManager.descriptor);
3825 data.writeString(processName);
3826 data.writeInt(uid);
3827 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3828 reply.readException();
3829 data.recycle();
3830 reply.recycle();
3831 }
3832
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003833 public void overridePendingTransition(IBinder token, String packageName,
3834 int enterAnim, int exitAnim) throws RemoteException {
3835 Parcel data = Parcel.obtain();
3836 Parcel reply = Parcel.obtain();
3837 data.writeInterfaceToken(IActivityManager.descriptor);
3838 data.writeStrongBinder(token);
3839 data.writeString(packageName);
3840 data.writeInt(enterAnim);
3841 data.writeInt(exitAnim);
3842 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3843 reply.readException();
3844 data.recycle();
3845 reply.recycle();
3846 }
3847
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003848 public boolean isUserAMonkey() throws RemoteException {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3853 reply.readException();
3854 boolean res = reply.readInt() != 0;
3855 data.recycle();
3856 reply.recycle();
3857 return res;
3858 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003859
3860 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3861 Parcel data = Parcel.obtain();
3862 Parcel reply = Parcel.obtain();
3863 data.writeInterfaceToken(IActivityManager.descriptor);
3864 data.writeInt(monkey ? 1 : 0);
3865 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3866 reply.readException();
3867 data.recycle();
3868 reply.recycle();
3869 }
3870
Dianne Hackborn860755f2010-06-03 18:47:52 -07003871 public void finishHeavyWeightApp() throws RemoteException {
3872 Parcel data = Parcel.obtain();
3873 Parcel reply = Parcel.obtain();
3874 data.writeInterfaceToken(IActivityManager.descriptor);
3875 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3876 reply.readException();
3877 data.recycle();
3878 reply.recycle();
3879 }
Craig Mautner4addfc52013-06-25 08:05:45 -07003880
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003881 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07003882 throws RemoteException {
3883 Parcel data = Parcel.obtain();
3884 Parcel reply = Parcel.obtain();
3885 data.writeInterfaceToken(IActivityManager.descriptor);
3886 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07003887 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
3888 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003889 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07003890 data.recycle();
3891 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003892 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07003893 }
3894
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003895 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07003896 throws RemoteException {
3897 Parcel data = Parcel.obtain();
3898 Parcel reply = Parcel.obtain();
3899 data.writeInterfaceToken(IActivityManager.descriptor);
3900 data.writeStrongBinder(token);
3901 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07003902 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003903 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07003904 data.recycle();
3905 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003906 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07003907 }
3908
Daniel Sandler69a48172010-06-23 16:29:36 -04003909 public void setImmersive(IBinder token, boolean immersive)
3910 throws RemoteException {
3911 Parcel data = Parcel.obtain();
3912 Parcel reply = Parcel.obtain();
3913 data.writeInterfaceToken(IActivityManager.descriptor);
3914 data.writeStrongBinder(token);
3915 data.writeInt(immersive ? 1 : 0);
3916 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3917 reply.readException();
3918 data.recycle();
3919 reply.recycle();
3920 }
3921
3922 public boolean isImmersive(IBinder token)
3923 throws RemoteException {
3924 Parcel data = Parcel.obtain();
3925 Parcel reply = Parcel.obtain();
3926 data.writeInterfaceToken(IActivityManager.descriptor);
3927 data.writeStrongBinder(token);
3928 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003929 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003930 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003931 data.recycle();
3932 reply.recycle();
3933 return res;
3934 }
3935
3936 public boolean isTopActivityImmersive()
3937 throws RemoteException {
3938 Parcel data = Parcel.obtain();
3939 Parcel reply = Parcel.obtain();
3940 data.writeInterfaceToken(IActivityManager.descriptor);
3941 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003942 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003943 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003944 data.recycle();
3945 reply.recycle();
3946 return res;
3947 }
3948
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003949 public void crashApplication(int uid, int initialPid, String packageName,
3950 String message) throws RemoteException {
3951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 data.writeInt(uid);
3955 data.writeInt(initialPid);
3956 data.writeString(packageName);
3957 data.writeString(message);
3958 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3959 reply.readException();
3960 data.recycle();
3961 reply.recycle();
3962 }
Andy McFadden824c5102010-07-09 16:26:57 -07003963
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003964 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003965 Parcel data = Parcel.obtain();
3966 Parcel reply = Parcel.obtain();
3967 data.writeInterfaceToken(IActivityManager.descriptor);
3968 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003969 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003970 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3971 reply.readException();
3972 String res = reply.readString();
3973 data.recycle();
3974 reply.recycle();
3975 return res;
3976 }
3977
Dianne Hackborn7e269642010-08-25 19:50:20 -07003978 public IBinder newUriPermissionOwner(String name)
3979 throws RemoteException {
3980 Parcel data = Parcel.obtain();
3981 Parcel reply = Parcel.obtain();
3982 data.writeInterfaceToken(IActivityManager.descriptor);
3983 data.writeString(name);
3984 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3985 reply.readException();
3986 IBinder res = reply.readStrongBinder();
3987 data.recycle();
3988 reply.recycle();
3989 return res;
3990 }
3991
3992 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3993 Uri uri, int mode) throws RemoteException {
3994 Parcel data = Parcel.obtain();
3995 Parcel reply = Parcel.obtain();
3996 data.writeInterfaceToken(IActivityManager.descriptor);
3997 data.writeStrongBinder(owner);
3998 data.writeInt(fromUid);
3999 data.writeString(targetPkg);
4000 uri.writeToParcel(data, 0);
4001 data.writeInt(mode);
4002 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4003 reply.readException();
4004 data.recycle();
4005 reply.recycle();
4006 }
4007
4008 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4009 int mode) throws RemoteException {
4010 Parcel data = Parcel.obtain();
4011 Parcel reply = Parcel.obtain();
4012 data.writeInterfaceToken(IActivityManager.descriptor);
4013 data.writeStrongBinder(owner);
4014 if (uri != null) {
4015 data.writeInt(1);
4016 uri.writeToParcel(data, 0);
4017 } else {
4018 data.writeInt(0);
4019 }
4020 data.writeInt(mode);
4021 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4022 reply.readException();
4023 data.recycle();
4024 reply.recycle();
4025 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004026
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004027 public int checkGrantUriPermission(int callingUid, String targetPkg,
4028 Uri uri, int modeFlags) throws RemoteException {
4029 Parcel data = Parcel.obtain();
4030 Parcel reply = Parcel.obtain();
4031 data.writeInterfaceToken(IActivityManager.descriptor);
4032 data.writeInt(callingUid);
4033 data.writeString(targetPkg);
4034 uri.writeToParcel(data, 0);
4035 data.writeInt(modeFlags);
4036 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4037 reply.readException();
4038 int res = reply.readInt();
4039 data.recycle();
4040 reply.recycle();
4041 return res;
4042 }
4043
Dianne Hackborn1676c852012-09-10 14:52:30 -07004044 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004045 String path, ParcelFileDescriptor fd) throws RemoteException {
4046 Parcel data = Parcel.obtain();
4047 Parcel reply = Parcel.obtain();
4048 data.writeInterfaceToken(IActivityManager.descriptor);
4049 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004050 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004051 data.writeInt(managed ? 1 : 0);
4052 data.writeString(path);
4053 if (fd != null) {
4054 data.writeInt(1);
4055 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4056 } else {
4057 data.writeInt(0);
4058 }
4059 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4060 reply.readException();
4061 boolean res = reply.readInt() != 0;
4062 reply.recycle();
4063 data.recycle();
4064 return res;
4065 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004066
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004067 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004068 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004069 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004070 Parcel data = Parcel.obtain();
4071 Parcel reply = Parcel.obtain();
4072 data.writeInterfaceToken(IActivityManager.descriptor);
4073 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004074 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004075 data.writeTypedArray(intents, 0);
4076 data.writeStringArray(resolvedTypes);
4077 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004078 if (options != null) {
4079 data.writeInt(1);
4080 options.writeToParcel(data, 0);
4081 } else {
4082 data.writeInt(0);
4083 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004084 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004085 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4086 reply.readException();
4087 int result = reply.readInt();
4088 reply.recycle();
4089 data.recycle();
4090 return result;
4091 }
4092
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004093 public int getFrontActivityScreenCompatMode() throws RemoteException {
4094 Parcel data = Parcel.obtain();
4095 Parcel reply = Parcel.obtain();
4096 data.writeInterfaceToken(IActivityManager.descriptor);
4097 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4098 reply.readException();
4099 int mode = reply.readInt();
4100 reply.recycle();
4101 data.recycle();
4102 return mode;
4103 }
4104
4105 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4106 Parcel data = Parcel.obtain();
4107 Parcel reply = Parcel.obtain();
4108 data.writeInterfaceToken(IActivityManager.descriptor);
4109 data.writeInt(mode);
4110 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 reply.recycle();
4113 data.recycle();
4114 }
4115
4116 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004120 data.writeString(packageName);
4121 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004122 reply.readException();
4123 int mode = reply.readInt();
4124 reply.recycle();
4125 data.recycle();
4126 return mode;
4127 }
4128
4129 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004130 throws RemoteException {
4131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004135 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004136 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4137 reply.readException();
4138 reply.recycle();
4139 data.recycle();
4140 }
4141
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004142 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4143 Parcel data = Parcel.obtain();
4144 Parcel reply = Parcel.obtain();
4145 data.writeInterfaceToken(IActivityManager.descriptor);
4146 data.writeString(packageName);
4147 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4148 reply.readException();
4149 boolean ask = reply.readInt() != 0;
4150 reply.recycle();
4151 data.recycle();
4152 return ask;
4153 }
4154
4155 public void setPackageAskScreenCompat(String packageName, boolean ask)
4156 throws RemoteException {
4157 Parcel data = Parcel.obtain();
4158 Parcel reply = Parcel.obtain();
4159 data.writeInterfaceToken(IActivityManager.descriptor);
4160 data.writeString(packageName);
4161 data.writeInt(ask ? 1 : 0);
4162 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4163 reply.readException();
4164 reply.recycle();
4165 data.recycle();
4166 }
4167
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004168 public boolean switchUser(int userid) throws RemoteException {
4169 Parcel data = Parcel.obtain();
4170 Parcel reply = Parcel.obtain();
4171 data.writeInterfaceToken(IActivityManager.descriptor);
4172 data.writeInt(userid);
4173 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4174 reply.readException();
4175 boolean result = reply.readInt() != 0;
4176 reply.recycle();
4177 data.recycle();
4178 return result;
4179 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004180
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004181 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4182 Parcel data = Parcel.obtain();
4183 Parcel reply = Parcel.obtain();
4184 data.writeInterfaceToken(IActivityManager.descriptor);
4185 data.writeInt(userid);
4186 data.writeStrongInterface(callback);
4187 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4188 reply.readException();
4189 int result = reply.readInt();
4190 reply.recycle();
4191 data.recycle();
4192 return result;
4193 }
4194
Amith Yamasani52f1d752012-03-28 18:19:29 -07004195 public UserInfo getCurrentUser() throws RemoteException {
4196 Parcel data = Parcel.obtain();
4197 Parcel reply = Parcel.obtain();
4198 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004199 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004200 reply.readException();
4201 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4202 reply.recycle();
4203 data.recycle();
4204 return userInfo;
4205 }
4206
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004207 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004208 Parcel data = Parcel.obtain();
4209 Parcel reply = Parcel.obtain();
4210 data.writeInterfaceToken(IActivityManager.descriptor);
4211 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004212 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004213 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4214 reply.readException();
4215 boolean result = reply.readInt() != 0;
4216 reply.recycle();
4217 data.recycle();
4218 return result;
4219 }
4220
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004221 public int[] getRunningUserIds() throws RemoteException {
4222 Parcel data = Parcel.obtain();
4223 Parcel reply = Parcel.obtain();
4224 data.writeInterfaceToken(IActivityManager.descriptor);
4225 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4226 reply.readException();
4227 int[] result = reply.createIntArray();
4228 reply.recycle();
4229 data.recycle();
4230 return result;
4231 }
4232
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004233 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4234 Parcel data = Parcel.obtain();
4235 Parcel reply = Parcel.obtain();
4236 data.writeInterfaceToken(IActivityManager.descriptor);
4237 data.writeInt(taskId);
4238 data.writeInt(subTaskIndex);
4239 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 boolean result = reply.readInt() != 0;
4242 reply.recycle();
4243 data.recycle();
4244 return result;
4245 }
4246
4247 public boolean removeTask(int taskId, int flags) throws RemoteException {
4248 Parcel data = Parcel.obtain();
4249 Parcel reply = Parcel.obtain();
4250 data.writeInterfaceToken(IActivityManager.descriptor);
4251 data.writeInt(taskId);
4252 data.writeInt(flags);
4253 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4254 reply.readException();
4255 boolean result = reply.readInt() != 0;
4256 reply.recycle();
4257 data.recycle();
4258 return result;
4259 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004260
Jeff Sharkeya4620792011-05-20 15:29:23 -07004261 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4262 Parcel data = Parcel.obtain();
4263 Parcel reply = Parcel.obtain();
4264 data.writeInterfaceToken(IActivityManager.descriptor);
4265 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4266 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4267 reply.readException();
4268 data.recycle();
4269 reply.recycle();
4270 }
4271
4272 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4277 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4278 reply.readException();
4279 data.recycle();
4280 reply.recycle();
4281 }
4282
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004283 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4284 Parcel data = Parcel.obtain();
4285 Parcel reply = Parcel.obtain();
4286 data.writeInterfaceToken(IActivityManager.descriptor);
4287 data.writeStrongBinder(sender.asBinder());
4288 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4289 reply.readException();
4290 boolean res = reply.readInt() != 0;
4291 data.recycle();
4292 reply.recycle();
4293 return res;
4294 }
4295
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004296 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4297 Parcel data = Parcel.obtain();
4298 Parcel reply = Parcel.obtain();
4299 data.writeInterfaceToken(IActivityManager.descriptor);
4300 data.writeStrongBinder(sender.asBinder());
4301 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4302 reply.readException();
4303 boolean res = reply.readInt() != 0;
4304 data.recycle();
4305 reply.recycle();
4306 return res;
4307 }
4308
Dianne Hackborn81038902012-11-26 17:04:09 -08004309 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4310 Parcel data = Parcel.obtain();
4311 Parcel reply = Parcel.obtain();
4312 data.writeInterfaceToken(IActivityManager.descriptor);
4313 data.writeStrongBinder(sender.asBinder());
4314 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4315 reply.readException();
4316 Intent res = reply.readInt() != 0
4317 ? Intent.CREATOR.createFromParcel(reply) : null;
4318 data.recycle();
4319 reply.recycle();
4320 return res;
4321 }
4322
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004323 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4324 {
4325 Parcel data = Parcel.obtain();
4326 Parcel reply = Parcel.obtain();
4327 data.writeInterfaceToken(IActivityManager.descriptor);
4328 values.writeToParcel(data, 0);
4329 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4330 reply.readException();
4331 data.recycle();
4332 reply.recycle();
4333 }
4334
Dianne Hackbornb437e092011-08-05 17:50:29 -07004335 public long[] getProcessPss(int[] pids) throws RemoteException {
4336 Parcel data = Parcel.obtain();
4337 Parcel reply = Parcel.obtain();
4338 data.writeInterfaceToken(IActivityManager.descriptor);
4339 data.writeIntArray(pids);
4340 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4341 reply.readException();
4342 long[] res = reply.createLongArray();
4343 data.recycle();
4344 reply.recycle();
4345 return res;
4346 }
4347
Dianne Hackborn661cd522011-08-22 00:26:20 -07004348 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4349 Parcel data = Parcel.obtain();
4350 Parcel reply = Parcel.obtain();
4351 data.writeInterfaceToken(IActivityManager.descriptor);
4352 TextUtils.writeToParcel(msg, data, 0);
4353 data.writeInt(always ? 1 : 0);
4354 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4355 reply.readException();
4356 data.recycle();
4357 reply.recycle();
4358 }
4359
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004360 public void dismissKeyguardOnNextActivity() throws RemoteException {
4361 Parcel data = Parcel.obtain();
4362 Parcel reply = Parcel.obtain();
4363 data.writeInterfaceToken(IActivityManager.descriptor);
4364 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4365 reply.readException();
4366 data.recycle();
4367 reply.recycle();
4368 }
4369
Adam Powelldd8fab22012-03-22 17:47:27 -07004370 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4371 throws RemoteException {
4372 Parcel data = Parcel.obtain();
4373 Parcel reply = Parcel.obtain();
4374 data.writeInterfaceToken(IActivityManager.descriptor);
4375 data.writeStrongBinder(token);
4376 data.writeString(destAffinity);
4377 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4378 reply.readException();
4379 boolean result = reply.readInt() != 0;
4380 data.recycle();
4381 reply.recycle();
4382 return result;
4383 }
4384
4385 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4386 throws RemoteException {
4387 Parcel data = Parcel.obtain();
4388 Parcel reply = Parcel.obtain();
4389 data.writeInterfaceToken(IActivityManager.descriptor);
4390 data.writeStrongBinder(token);
4391 target.writeToParcel(data, 0);
4392 data.writeInt(resultCode);
4393 if (resultData != null) {
4394 data.writeInt(1);
4395 resultData.writeToParcel(data, 0);
4396 } else {
4397 data.writeInt(0);
4398 }
4399 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4400 reply.readException();
4401 boolean result = reply.readInt() != 0;
4402 data.recycle();
4403 reply.recycle();
4404 return result;
4405 }
4406
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004407 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4408 Parcel data = Parcel.obtain();
4409 Parcel reply = Parcel.obtain();
4410 data.writeInterfaceToken(IActivityManager.descriptor);
4411 data.writeStrongBinder(activityToken);
4412 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4413 reply.readException();
4414 int result = reply.readInt();
4415 data.recycle();
4416 reply.recycle();
4417 return result;
4418 }
4419
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004420 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4421 Parcel data = Parcel.obtain();
4422 Parcel reply = Parcel.obtain();
4423 data.writeInterfaceToken(IActivityManager.descriptor);
4424 data.writeStrongBinder(activityToken);
4425 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4426 reply.readException();
4427 String result = reply.readString();
4428 data.recycle();
4429 reply.recycle();
4430 return result;
4431 }
4432
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004433 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4438 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4439 reply.readException();
4440 data.recycle();
4441 reply.recycle();
4442 }
4443
4444 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4445 Parcel data = Parcel.obtain();
4446 Parcel reply = Parcel.obtain();
4447 data.writeInterfaceToken(IActivityManager.descriptor);
4448 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4449 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4450 reply.readException();
4451 data.recycle();
4452 reply.recycle();
4453 }
4454
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004455 public void requestBugReport() throws RemoteException {
4456 Parcel data = Parcel.obtain();
4457 Parcel reply = Parcel.obtain();
4458 data.writeInterfaceToken(IActivityManager.descriptor);
4459 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4460 reply.readException();
4461 data.recycle();
4462 reply.recycle();
4463 }
4464
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004465 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4466 Parcel data = Parcel.obtain();
4467 Parcel reply = Parcel.obtain();
4468 data.writeInterfaceToken(IActivityManager.descriptor);
4469 data.writeInt(pid);
4470 data.writeInt(aboveSystem ? 1 : 0);
4471 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4472 reply.readException();
4473 long res = reply.readInt();
4474 data.recycle();
4475 reply.recycle();
4476 return res;
4477 }
4478
Adam Skorydfc7fd72013-08-05 19:23:41 -07004479 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004480 Parcel data = Parcel.obtain();
4481 Parcel reply = Parcel.obtain();
4482 data.writeInterfaceToken(IActivityManager.descriptor);
4483 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004484 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004485 reply.readException();
4486 Bundle res = reply.readBundle();
4487 data.recycle();
4488 reply.recycle();
4489 return res;
4490 }
4491
Adam Skorydfc7fd72013-08-05 19:23:41 -07004492 public void reportAssistContextExtras(IBinder token, Bundle extras, int index)
4493 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004494 Parcel data = Parcel.obtain();
4495 Parcel reply = Parcel.obtain();
4496 data.writeInterfaceToken(IActivityManager.descriptor);
4497 data.writeStrongBinder(token);
4498 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004499 data.writeInt(index);
4500 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004501 reply.readException();
4502 data.recycle();
4503 reply.recycle();
4504 }
4505
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004506 public void killUid(int uid, String reason) throws RemoteException {
4507 Parcel data = Parcel.obtain();
4508 Parcel reply = Parcel.obtain();
4509 data.writeInterfaceToken(IActivityManager.descriptor);
4510 data.writeInt(uid);
4511 data.writeString(reason);
4512 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4513 reply.readException();
4514 data.recycle();
4515 reply.recycle();
4516 }
4517
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004518 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4519 Parcel data = Parcel.obtain();
4520 Parcel reply = Parcel.obtain();
4521 data.writeInterfaceToken(IActivityManager.descriptor);
4522 data.writeStrongBinder(who);
4523 data.writeInt(allowRestart ? 1 : 0);
4524 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4525 reply.readException();
4526 data.recycle();
4527 reply.recycle();
4528 }
4529
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004530 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4531 Parcel data = Parcel.obtain();
4532 Parcel reply = Parcel.obtain();
4533 data.writeInterfaceToken(IActivityManager.descriptor);
4534 data.writeStrongBinder(token);
4535 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4536 reply.readException();
4537 data.recycle();
4538 reply.recycle();
4539 }
4540
Craig Mautner5eda9b32013-07-02 11:58:16 -07004541 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4542 Parcel data = Parcel.obtain();
4543 Parcel reply = Parcel.obtain();
4544 data.writeInterfaceToken(IActivityManager.descriptor);
4545 data.writeStrongBinder(token);
4546 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4547 reply.readException();
4548 data.recycle();
4549 reply.recycle();
4550 }
4551
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004552 public void restart() throws RemoteException {
4553 Parcel data = Parcel.obtain();
4554 Parcel reply = Parcel.obtain();
4555 data.writeInterfaceToken(IActivityManager.descriptor);
4556 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4557 reply.readException();
4558 data.recycle();
4559 reply.recycle();
4560 }
4561
Jeff Sharkey08da7a12013-08-11 20:53:18 -07004562 public Uri[] getGrantedUriPermissions(
4563 String sourcePackage, String targetPackage, int modeFlags, int modeMask)
4564 throws RemoteException {
4565 Parcel data = Parcel.obtain();
4566 Parcel reply = Parcel.obtain();
4567 data.writeInterfaceToken(IActivityManager.descriptor);
4568 data.writeString(sourcePackage);
4569 data.writeString(targetPackage);
4570 data.writeInt(modeFlags);
4571 data.writeInt(modeMask);
4572 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4573 reply.readException();
4574 final Uri[] uris = (Uri[]) reply.readParcelableArray(null);
4575 data.recycle();
4576 reply.recycle();
4577 return uris;
4578 }
4579
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004580 private IBinder mRemote;
4581}