blob: a23611ec6e620445eba665072168876316abe232 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautner5ff12102013-05-24 12:50:15 -070019import android.app.ActivityManager.StackBoxInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070026import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.content.pm.ConfigurationInfo;
28import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070029import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.res.Configuration;
31import android.graphics.Bitmap;
32import android.net.Uri;
33import android.os.Binder;
34import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070035import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.os.IBinder;
37import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070038import android.os.ParcelFileDescriptor;
39import android.os.Parcelable;
40import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070042import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080045import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.ArrayList;
48import java.util.List;
49
50/** {@hide} */
51public abstract class ActivityManagerNative extends Binder implements IActivityManager
52{
53 /**
54 * Cast a Binder object into an activity manager interface, generating
55 * a proxy if needed.
56 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080057 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 if (obj == null) {
59 return null;
60 }
61 IActivityManager in =
62 (IActivityManager)obj.queryLocalInterface(descriptor);
63 if (in != null) {
64 return in;
65 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 return new ActivityManagerProxy(obj);
68 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 /**
71 * Retrieve the system's default/global activity manager.
72 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080073 static public IActivityManager getDefault() {
74 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 }
76
77 /**
78 * Convenience for checking whether the system is ready. For internal use only.
79 */
80 static public boolean isSystemReady() {
81 if (!sSystemReady) {
82 sSystemReady = getDefault().testIsSystemReady();
83 }
84 return sSystemReady;
85 }
86 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 /**
89 * Convenience for sending a sticky broadcast. For internal use only.
90 * If you don't care about permission, use null.
91 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070092 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 try {
94 getDefault().broadcastIntent(
95 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -080096 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 } catch (RemoteException ex) {
98 }
99 }
100
101 static public void noteWakeupAlarm(PendingIntent ps) {
102 try {
103 getDefault().noteWakeupAlarm(ps.getTarget());
104 } catch (RemoteException ex) {
105 }
106 }
107
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800108 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 attachInterface(this, descriptor);
110 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700111
112 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
114 throws RemoteException {
115 switch (code) {
116 case START_ACTIVITY_TRANSACTION:
117 {
118 data.enforceInterface(IActivityManager.descriptor);
119 IBinder b = data.readStrongBinder();
120 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800121 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 Intent intent = Intent.CREATOR.createFromParcel(data);
123 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800125 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700127 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700128 String profileFile = data.readString();
129 ParcelFileDescriptor profileFd = data.readInt() != 0
130 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700131 Bundle options = data.readInt() != 0
132 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800133 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700134 resultTo, resultWho, requestCode, startFlags,
135 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 reply.writeNoException();
137 reply.writeInt(result);
138 return true;
139 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700140
Amith Yamasani82644082012-08-03 13:09:11 -0700141 case START_ACTIVITY_AS_USER_TRANSACTION:
142 {
143 data.enforceInterface(IActivityManager.descriptor);
144 IBinder b = data.readStrongBinder();
145 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800146 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700147 Intent intent = Intent.CREATOR.createFromParcel(data);
148 String resolvedType = data.readString();
149 IBinder resultTo = data.readStrongBinder();
150 String resultWho = data.readString();
151 int requestCode = data.readInt();
152 int startFlags = data.readInt();
153 String profileFile = data.readString();
154 ParcelFileDescriptor profileFd = data.readInt() != 0
155 ? data.readFileDescriptor() : null;
156 Bundle options = data.readInt() != 0
157 ? Bundle.CREATOR.createFromParcel(data) : null;
158 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800159 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700160 resultTo, resultWho, requestCode, startFlags,
161 profileFile, profileFd, options, userId);
162 reply.writeNoException();
163 reply.writeInt(result);
164 return true;
165 }
166
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800167 case START_ACTIVITY_AND_WAIT_TRANSACTION:
168 {
169 data.enforceInterface(IActivityManager.descriptor);
170 IBinder b = data.readStrongBinder();
171 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800172 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 Intent intent = Intent.CREATOR.createFromParcel(data);
174 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800175 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800176 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800177 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700178 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700179 String profileFile = data.readString();
180 ParcelFileDescriptor profileFd = data.readInt() != 0
181 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700182 Bundle options = data.readInt() != 0
183 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700184 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800185 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700186 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700187 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800188 reply.writeNoException();
189 result.writeToParcel(reply, 0);
190 return true;
191 }
192
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700193 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
194 {
195 data.enforceInterface(IActivityManager.descriptor);
196 IBinder b = data.readStrongBinder();
197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800198 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 Intent intent = Intent.CREATOR.createFromParcel(data);
200 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700201 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700202 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700204 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700206 Bundle options = data.readInt() != 0
207 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700208 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800209 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700210 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700211 reply.writeNoException();
212 reply.writeInt(result);
213 return true;
214 }
215
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700216 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700217 {
218 data.enforceInterface(IActivityManager.descriptor);
219 IBinder b = data.readStrongBinder();
220 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700221 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700222 Intent fillInIntent = null;
223 if (data.readInt() != 0) {
224 fillInIntent = Intent.CREATOR.createFromParcel(data);
225 }
226 String resolvedType = data.readString();
227 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700228 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700229 int requestCode = data.readInt();
230 int flagsMask = data.readInt();
231 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700232 Bundle options = data.readInt() != 0
233 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700234 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700236 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700237 reply.writeNoException();
238 reply.writeInt(result);
239 return true;
240 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700241
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
243 {
244 data.enforceInterface(IActivityManager.descriptor);
245 IBinder callingActivity = data.readStrongBinder();
246 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700247 Bundle options = data.readInt() != 0
248 ? Bundle.CREATOR.createFromParcel(data) : null;
249 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 reply.writeNoException();
251 reply.writeInt(result ? 1 : 0);
252 return true;
253 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 case FINISH_ACTIVITY_TRANSACTION: {
256 data.enforceInterface(IActivityManager.descriptor);
257 IBinder token = data.readStrongBinder();
258 Intent resultData = null;
259 int resultCode = data.readInt();
260 if (data.readInt() != 0) {
261 resultData = Intent.CREATOR.createFromParcel(data);
262 }
263 boolean res = finishActivity(token, resultCode, resultData);
264 reply.writeNoException();
265 reply.writeInt(res ? 1 : 0);
266 return true;
267 }
268
269 case FINISH_SUB_ACTIVITY_TRANSACTION: {
270 data.enforceInterface(IActivityManager.descriptor);
271 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700272 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800273 int requestCode = data.readInt();
274 finishSubActivity(token, resultWho, requestCode);
275 reply.writeNoException();
276 return true;
277 }
278
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700279 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
280 data.enforceInterface(IActivityManager.descriptor);
281 IBinder token = data.readStrongBinder();
282 boolean res = finishActivityAffinity(token);
283 reply.writeNoException();
284 reply.writeInt(res ? 1 : 0);
285 return true;
286 }
287
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800288 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder token = data.readStrongBinder();
291 boolean res = willActivityBeVisible(token);
292 reply.writeNoException();
293 reply.writeInt(res ? 1 : 0);
294 return true;
295 }
296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 case REGISTER_RECEIVER_TRANSACTION:
298 {
299 data.enforceInterface(IActivityManager.descriptor);
300 IBinder b = data.readStrongBinder();
301 IApplicationThread app =
302 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700303 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800304 b = data.readStrongBinder();
305 IIntentReceiver rec
306 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
307 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
308 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700309 int userId = data.readInt();
310 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311 reply.writeNoException();
312 if (intent != null) {
313 reply.writeInt(1);
314 intent.writeToParcel(reply, 0);
315 } else {
316 reply.writeInt(0);
317 }
318 return true;
319 }
320
321 case UNREGISTER_RECEIVER_TRANSACTION:
322 {
323 data.enforceInterface(IActivityManager.descriptor);
324 IBinder b = data.readStrongBinder();
325 if (b == null) {
326 return true;
327 }
328 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
329 unregisterReceiver(rec);
330 reply.writeNoException();
331 return true;
332 }
333
334 case BROADCAST_INTENT_TRANSACTION:
335 {
336 data.enforceInterface(IActivityManager.descriptor);
337 IBinder b = data.readStrongBinder();
338 IApplicationThread app =
339 b != null ? ApplicationThreadNative.asInterface(b) : null;
340 Intent intent = Intent.CREATOR.createFromParcel(data);
341 String resolvedType = data.readString();
342 b = data.readStrongBinder();
343 IIntentReceiver resultTo =
344 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
345 int resultCode = data.readInt();
346 String resultData = data.readString();
347 Bundle resultExtras = data.readBundle();
348 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800349 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 boolean serialized = data.readInt() != 0;
351 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700352 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800354 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700355 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800356 reply.writeNoException();
357 reply.writeInt(res);
358 return true;
359 }
360
361 case UNBROADCAST_INTENT_TRANSACTION:
362 {
363 data.enforceInterface(IActivityManager.descriptor);
364 IBinder b = data.readStrongBinder();
365 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
366 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700367 int userId = data.readInt();
368 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800369 reply.writeNoException();
370 return true;
371 }
372
373 case FINISH_RECEIVER_TRANSACTION: {
374 data.enforceInterface(IActivityManager.descriptor);
375 IBinder who = data.readStrongBinder();
376 int resultCode = data.readInt();
377 String resultData = data.readString();
378 Bundle resultExtras = data.readBundle();
379 boolean resultAbort = data.readInt() != 0;
380 if (who != null) {
381 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
382 }
383 reply.writeNoException();
384 return true;
385 }
386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 case ATTACH_APPLICATION_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IApplicationThread app = ApplicationThreadNative.asInterface(
390 data.readStrongBinder());
391 if (app != null) {
392 attachApplication(app);
393 }
394 reply.writeNoException();
395 return true;
396 }
397
398 case ACTIVITY_IDLE_TRANSACTION: {
399 data.enforceInterface(IActivityManager.descriptor);
400 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700401 Configuration config = null;
402 if (data.readInt() != 0) {
403 config = Configuration.CREATOR.createFromParcel(data);
404 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700405 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700407 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800408 }
409 reply.writeNoException();
410 return true;
411 }
412
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700413 case ACTIVITY_RESUMED_TRANSACTION: {
414 data.enforceInterface(IActivityManager.descriptor);
415 IBinder token = data.readStrongBinder();
416 activityResumed(token);
417 reply.writeNoException();
418 return true;
419 }
420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 case ACTIVITY_PAUSED_TRANSACTION: {
422 data.enforceInterface(IActivityManager.descriptor);
423 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800424 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800425 reply.writeNoException();
426 return true;
427 }
428
429 case ACTIVITY_STOPPED_TRANSACTION: {
430 data.enforceInterface(IActivityManager.descriptor);
431 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800432 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 Bitmap thumbnail = data.readInt() != 0
434 ? Bitmap.CREATOR.createFromParcel(data) : null;
435 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800436 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800437 reply.writeNoException();
438 return true;
439 }
440
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800441 case ACTIVITY_SLEPT_TRANSACTION: {
442 data.enforceInterface(IActivityManager.descriptor);
443 IBinder token = data.readStrongBinder();
444 activitySlept(token);
445 reply.writeNoException();
446 return true;
447 }
448
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 case ACTIVITY_DESTROYED_TRANSACTION: {
450 data.enforceInterface(IActivityManager.descriptor);
451 IBinder token = data.readStrongBinder();
452 activityDestroyed(token);
453 reply.writeNoException();
454 return true;
455 }
456
457 case GET_CALLING_PACKAGE_TRANSACTION: {
458 data.enforceInterface(IActivityManager.descriptor);
459 IBinder token = data.readStrongBinder();
460 String res = token != null ? getCallingPackage(token) : null;
461 reply.writeNoException();
462 reply.writeString(res);
463 return true;
464 }
465
466 case GET_CALLING_ACTIVITY_TRANSACTION: {
467 data.enforceInterface(IActivityManager.descriptor);
468 IBinder token = data.readStrongBinder();
469 ComponentName cn = getCallingActivity(token);
470 reply.writeNoException();
471 ComponentName.writeToParcel(cn, reply);
472 return true;
473 }
474
475 case GET_TASKS_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 int maxNum = data.readInt();
478 int fl = data.readInt();
479 IBinder receiverBinder = data.readStrongBinder();
480 IThumbnailReceiver receiver = receiverBinder != null
481 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
482 : null;
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700483 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl, receiver);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800484 reply.writeNoException();
485 int N = list != null ? list.size() : -1;
486 reply.writeInt(N);
487 int i;
488 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700489 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800490 info.writeToParcel(reply, 0);
491 }
492 return true;
493 }
494
495 case GET_RECENT_TASKS_TRANSACTION: {
496 data.enforceInterface(IActivityManager.descriptor);
497 int maxNum = data.readInt();
498 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700499 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700501 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 reply.writeNoException();
503 reply.writeTypedList(list);
504 return true;
505 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700506
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700507 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800508 data.enforceInterface(IActivityManager.descriptor);
509 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700510 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800511 reply.writeNoException();
512 if (bm != null) {
513 reply.writeInt(1);
514 bm.writeToParcel(reply, 0);
515 } else {
516 reply.writeInt(0);
517 }
518 return true;
519 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700520
521 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
522 data.enforceInterface(IActivityManager.descriptor);
523 int id = data.readInt();
524 Bitmap bm = getTaskTopThumbnail(id);
525 reply.writeNoException();
526 if (bm != null) {
527 reply.writeInt(1);
528 bm.writeToParcel(reply, 0);
529 } else {
530 reply.writeInt(0);
531 }
532 return true;
533 }
534
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800535 case GET_SERVICES_TRANSACTION: {
536 data.enforceInterface(IActivityManager.descriptor);
537 int maxNum = data.readInt();
538 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700539 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 reply.writeNoException();
541 int N = list != null ? list.size() : -1;
542 reply.writeInt(N);
543 int i;
544 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700545 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 info.writeToParcel(reply, 0);
547 }
548 return true;
549 }
550
551 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
552 data.enforceInterface(IActivityManager.descriptor);
553 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
554 reply.writeNoException();
555 reply.writeTypedList(list);
556 return true;
557 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700558
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800559 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
560 data.enforceInterface(IActivityManager.descriptor);
561 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
562 reply.writeNoException();
563 reply.writeTypedList(list);
564 return true;
565 }
566
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700567 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 List<ApplicationInfo> list = getRunningExternalApplications();
570 reply.writeNoException();
571 reply.writeTypedList(list);
572 return true;
573 }
574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 case MOVE_TASK_TO_FRONT_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800578 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700579 Bundle options = data.readInt() != 0
580 ? Bundle.CREATOR.createFromParcel(data) : null;
581 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 reply.writeNoException();
583 return true;
584 }
585
586 case MOVE_TASK_TO_BACK_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 int task = data.readInt();
589 moveTaskToBack(task);
590 reply.writeNoException();
591 return true;
592 }
593
594 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder token = data.readStrongBinder();
597 boolean nonRoot = data.readInt() != 0;
598 boolean res = moveActivityTaskToBack(token, nonRoot);
599 reply.writeNoException();
600 reply.writeInt(res ? 1 : 0);
601 return true;
602 }
603
604 case MOVE_TASK_BACKWARDS_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 int task = data.readInt();
607 moveTaskBackwards(task);
608 reply.writeNoException();
609 return true;
610 }
611
Craig Mautnerc00204b2013-03-05 15:02:14 -0800612 case CREATE_STACK_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700614 int taskId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800615 int relativeStackId = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700616 int position = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800617 float weight = data.readFloat();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700618 int res = createStack(taskId, relativeStackId, position, weight);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800619 reply.writeNoException();
620 reply.writeInt(res);
621 return true;
622 }
623
624 case MOVE_TASK_TO_STACK_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 int taskId = data.readInt();
627 int stackId = data.readInt();
628 boolean toTop = data.readInt() != 0;
629 moveTaskToStack(taskId, stackId, toTop);
630 reply.writeNoException();
631 return true;
632 }
633
634 case RESIZE_STACK_TRANSACTION: {
635 data.enforceInterface(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -0700636 int stackBoxId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800637 float weight = data.readFloat();
Craig Mautner5a449152013-05-24 15:49:29 -0700638 resizeStackBox(stackBoxId, weight);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800639 reply.writeNoException();
640 return true;
641 }
642
Craig Mautner5ff12102013-05-24 12:50:15 -0700643 case GET_STACK_BOXES_TRANSACTION: {
644 data.enforceInterface(IActivityManager.descriptor);
645 List<StackBoxInfo> list = getStackBoxes();
646 reply.writeNoException();
647 reply.writeTypedList(list);
648 return true;
649 }
650
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700651 case GET_STACK_BOX_INFO_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 int stackBoxId = data.readInt();
654 StackBoxInfo info = getStackBoxInfo(stackBoxId);
655 reply.writeNoException();
656 if (info != null) {
657 reply.writeInt(1);
658 info.writeToParcel(reply, 0);
659 } else {
660 reply.writeInt(0);
661 }
662 return true;
663 }
664
Craig Mautnercf910b02013-04-23 11:23:27 -0700665 case SET_FOCUSED_STACK_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 int stackId = data.readInt();
668 setFocusedStack(stackId);
669 reply.writeNoException();
670 return true;
671 }
672
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 IBinder token = data.readStrongBinder();
676 boolean onlyRoot = data.readInt() != 0;
677 int res = token != null
678 ? getTaskForActivity(token, onlyRoot) : -1;
679 reply.writeNoException();
680 reply.writeInt(res);
681 return true;
682 }
683
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 case REPORT_THUMBNAIL_TRANSACTION: {
685 data.enforceInterface(IActivityManager.descriptor);
686 IBinder token = data.readStrongBinder();
687 Bitmap thumbnail = data.readInt() != 0
688 ? Bitmap.CREATOR.createFromParcel(data) : null;
689 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
690 reportThumbnail(token, thumbnail, description);
691 reply.writeNoException();
692 return true;
693 }
694
695 case GET_CONTENT_PROVIDER_TRANSACTION: {
696 data.enforceInterface(IActivityManager.descriptor);
697 IBinder b = data.readStrongBinder();
698 IApplicationThread app = ApplicationThreadNative.asInterface(b);
699 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700700 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700701 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700702 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 reply.writeNoException();
704 if (cph != null) {
705 reply.writeInt(1);
706 cph.writeToParcel(reply, 0);
707 } else {
708 reply.writeInt(0);
709 }
710 return true;
711 }
712
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800713 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
714 data.enforceInterface(IActivityManager.descriptor);
715 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700716 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800717 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700718 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800719 reply.writeNoException();
720 if (cph != null) {
721 reply.writeInt(1);
722 cph.writeToParcel(reply, 0);
723 } else {
724 reply.writeInt(0);
725 }
726 return true;
727 }
728
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
730 data.enforceInterface(IActivityManager.descriptor);
731 IBinder b = data.readStrongBinder();
732 IApplicationThread app = ApplicationThreadNative.asInterface(b);
733 ArrayList<ContentProviderHolder> providers =
734 data.createTypedArrayList(ContentProviderHolder.CREATOR);
735 publishContentProviders(app, providers);
736 reply.writeNoException();
737 return true;
738 }
739
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700740 case REF_CONTENT_PROVIDER_TRANSACTION: {
741 data.enforceInterface(IActivityManager.descriptor);
742 IBinder b = data.readStrongBinder();
743 int stable = data.readInt();
744 int unstable = data.readInt();
745 boolean res = refContentProvider(b, stable, unstable);
746 reply.writeNoException();
747 reply.writeInt(res ? 1 : 0);
748 return true;
749 }
750
751 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
752 data.enforceInterface(IActivityManager.descriptor);
753 IBinder b = data.readStrongBinder();
754 unstableProviderDied(b);
755 reply.writeNoException();
756 return true;
757 }
758
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800759 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
760 data.enforceInterface(IActivityManager.descriptor);
761 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700762 boolean stable = data.readInt() != 0;
763 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 reply.writeNoException();
765 return true;
766 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800767
768 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 String name = data.readString();
771 IBinder token = data.readStrongBinder();
772 removeContentProviderExternal(name, token);
773 reply.writeNoException();
774 return true;
775 }
776
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700777 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
780 PendingIntent pi = getRunningServiceControlPanel(comp);
781 reply.writeNoException();
782 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
783 return true;
784 }
785
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 case START_SERVICE_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 IBinder b = data.readStrongBinder();
789 IApplicationThread app = ApplicationThreadNative.asInterface(b);
790 Intent service = Intent.CREATOR.createFromParcel(data);
791 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700792 int userId = data.readInt();
793 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794 reply.writeNoException();
795 ComponentName.writeToParcel(cn, reply);
796 return true;
797 }
798
799 case STOP_SERVICE_TRANSACTION: {
800 data.enforceInterface(IActivityManager.descriptor);
801 IBinder b = data.readStrongBinder();
802 IApplicationThread app = ApplicationThreadNative.asInterface(b);
803 Intent service = Intent.CREATOR.createFromParcel(data);
804 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700805 int userId = data.readInt();
806 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800807 reply.writeNoException();
808 reply.writeInt(res);
809 return true;
810 }
811
812 case STOP_SERVICE_TOKEN_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 ComponentName className = ComponentName.readFromParcel(data);
815 IBinder token = data.readStrongBinder();
816 int startId = data.readInt();
817 boolean res = stopServiceToken(className, token, startId);
818 reply.writeNoException();
819 reply.writeInt(res ? 1 : 0);
820 return true;
821 }
822
823 case SET_SERVICE_FOREGROUND_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 ComponentName className = ComponentName.readFromParcel(data);
826 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700827 int id = data.readInt();
828 Notification notification = null;
829 if (data.readInt() != 0) {
830 notification = Notification.CREATOR.createFromParcel(data);
831 }
832 boolean removeNotification = data.readInt() != 0;
833 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800834 reply.writeNoException();
835 return true;
836 }
837
838 case BIND_SERVICE_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 IBinder b = data.readStrongBinder();
841 IApplicationThread app = ApplicationThreadNative.asInterface(b);
842 IBinder token = data.readStrongBinder();
843 Intent service = Intent.CREATOR.createFromParcel(data);
844 String resolvedType = data.readString();
845 b = data.readStrongBinder();
846 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800847 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800848 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800849 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800850 reply.writeNoException();
851 reply.writeInt(res);
852 return true;
853 }
854
855 case UNBIND_SERVICE_TRANSACTION: {
856 data.enforceInterface(IActivityManager.descriptor);
857 IBinder b = data.readStrongBinder();
858 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
859 boolean res = unbindService(conn);
860 reply.writeNoException();
861 reply.writeInt(res ? 1 : 0);
862 return true;
863 }
864
865 case PUBLISH_SERVICE_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 IBinder token = data.readStrongBinder();
868 Intent intent = Intent.CREATOR.createFromParcel(data);
869 IBinder service = data.readStrongBinder();
870 publishService(token, intent, service);
871 reply.writeNoException();
872 return true;
873 }
874
875 case UNBIND_FINISHED_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 IBinder token = data.readStrongBinder();
878 Intent intent = Intent.CREATOR.createFromParcel(data);
879 boolean doRebind = data.readInt() != 0;
880 unbindFinished(token, intent, doRebind);
881 reply.writeNoException();
882 return true;
883 }
884
885 case SERVICE_DONE_EXECUTING_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700888 int type = data.readInt();
889 int startId = data.readInt();
890 int res = data.readInt();
891 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 reply.writeNoException();
893 return true;
894 }
895
896 case START_INSTRUMENTATION_TRANSACTION: {
897 data.enforceInterface(IActivityManager.descriptor);
898 ComponentName className = ComponentName.readFromParcel(data);
899 String profileFile = data.readString();
900 int fl = data.readInt();
901 Bundle arguments = data.readBundle();
902 IBinder b = data.readStrongBinder();
903 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800904 b = data.readStrongBinder();
905 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700906 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800907 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeInt(res ? 1 : 0);
910 return true;
911 }
912
913
914 case FINISH_INSTRUMENTATION_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 IBinder b = data.readStrongBinder();
917 IApplicationThread app = ApplicationThreadNative.asInterface(b);
918 int resultCode = data.readInt();
919 Bundle results = data.readBundle();
920 finishInstrumentation(app, resultCode, results);
921 reply.writeNoException();
922 return true;
923 }
924
925 case GET_CONFIGURATION_TRANSACTION: {
926 data.enforceInterface(IActivityManager.descriptor);
927 Configuration config = getConfiguration();
928 reply.writeNoException();
929 config.writeToParcel(reply, 0);
930 return true;
931 }
932
933 case UPDATE_CONFIGURATION_TRANSACTION: {
934 data.enforceInterface(IActivityManager.descriptor);
935 Configuration config = Configuration.CREATOR.createFromParcel(data);
936 updateConfiguration(config);
937 reply.writeNoException();
938 return true;
939 }
940
941 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 IBinder token = data.readStrongBinder();
944 int requestedOrientation = data.readInt();
945 setRequestedOrientation(token, requestedOrientation);
946 reply.writeNoException();
947 return true;
948 }
949
950 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder token = data.readStrongBinder();
953 int req = getRequestedOrientation(token);
954 reply.writeNoException();
955 reply.writeInt(req);
956 return true;
957 }
958
959 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
960 data.enforceInterface(IActivityManager.descriptor);
961 IBinder token = data.readStrongBinder();
962 ComponentName cn = getActivityClassForToken(token);
963 reply.writeNoException();
964 ComponentName.writeToParcel(cn, reply);
965 return true;
966 }
967
968 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder token = data.readStrongBinder();
971 reply.writeNoException();
972 reply.writeString(getPackageForToken(token));
973 return true;
974 }
975
976 case GET_INTENT_SENDER_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 int type = data.readInt();
979 String packageName = data.readString();
980 IBinder token = data.readStrongBinder();
981 String resultWho = data.readString();
982 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800983 Intent[] requestIntents;
984 String[] requestResolvedTypes;
985 if (data.readInt() != 0) {
986 requestIntents = data.createTypedArray(Intent.CREATOR);
987 requestResolvedTypes = data.createStringArray();
988 } else {
989 requestIntents = null;
990 requestResolvedTypes = null;
991 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700993 Bundle options = data.readInt() != 0
994 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700995 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800996 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800997 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700998 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 reply.writeNoException();
1000 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1001 return true;
1002 }
1003
1004 case CANCEL_INTENT_SENDER_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IIntentSender r = IIntentSender.Stub.asInterface(
1007 data.readStrongBinder());
1008 cancelIntentSender(r);
1009 reply.writeNoException();
1010 return true;
1011 }
1012
1013 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 IIntentSender r = IIntentSender.Stub.asInterface(
1016 data.readStrongBinder());
1017 String res = getPackageForIntentSender(r);
1018 reply.writeNoException();
1019 reply.writeString(res);
1020 return true;
1021 }
1022
Christopher Tatec4a07d12012-04-06 14:19:13 -07001023 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1024 data.enforceInterface(IActivityManager.descriptor);
1025 IIntentSender r = IIntentSender.Stub.asInterface(
1026 data.readStrongBinder());
1027 int res = getUidForIntentSender(r);
1028 reply.writeNoException();
1029 reply.writeInt(res);
1030 return true;
1031 }
1032
Dianne Hackborn41203752012-08-31 14:05:51 -07001033 case HANDLE_INCOMING_USER_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 int callingPid = data.readInt();
1036 int callingUid = data.readInt();
1037 int userId = data.readInt();
1038 boolean allowAll = data.readInt() != 0 ;
1039 boolean requireFull = data.readInt() != 0;
1040 String name = data.readString();
1041 String callerPackage = data.readString();
1042 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1043 requireFull, name, callerPackage);
1044 reply.writeNoException();
1045 reply.writeInt(res);
1046 return true;
1047 }
1048
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001049 case SET_PROCESS_LIMIT_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 int max = data.readInt();
1052 setProcessLimit(max);
1053 reply.writeNoException();
1054 return true;
1055 }
1056
1057 case GET_PROCESS_LIMIT_TRANSACTION: {
1058 data.enforceInterface(IActivityManager.descriptor);
1059 int limit = getProcessLimit();
1060 reply.writeNoException();
1061 reply.writeInt(limit);
1062 return true;
1063 }
1064
1065 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 IBinder token = data.readStrongBinder();
1068 int pid = data.readInt();
1069 boolean isForeground = data.readInt() != 0;
1070 setProcessForeground(token, pid, isForeground);
1071 reply.writeNoException();
1072 return true;
1073 }
1074
1075 case CHECK_PERMISSION_TRANSACTION: {
1076 data.enforceInterface(IActivityManager.descriptor);
1077 String perm = data.readString();
1078 int pid = data.readInt();
1079 int uid = data.readInt();
1080 int res = checkPermission(perm, pid, uid);
1081 reply.writeNoException();
1082 reply.writeInt(res);
1083 return true;
1084 }
1085
1086 case CHECK_URI_PERMISSION_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 Uri uri = Uri.CREATOR.createFromParcel(data);
1089 int pid = data.readInt();
1090 int uid = data.readInt();
1091 int mode = data.readInt();
1092 int res = checkUriPermission(uri, pid, uid, mode);
1093 reply.writeNoException();
1094 reply.writeInt(res);
1095 return true;
1096 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001097
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001099 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 String packageName = data.readString();
1101 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1102 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001103 int userId = data.readInt();
1104 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001105 reply.writeNoException();
1106 reply.writeInt(res ? 1 : 0);
1107 return true;
1108 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110 case GRANT_URI_PERMISSION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 IBinder b = data.readStrongBinder();
1113 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1114 String targetPkg = data.readString();
1115 Uri uri = Uri.CREATOR.createFromParcel(data);
1116 int mode = data.readInt();
1117 grantUriPermission(app, targetPkg, uri, mode);
1118 reply.writeNoException();
1119 return true;
1120 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001121
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 case REVOKE_URI_PERMISSION_TRANSACTION: {
1123 data.enforceInterface(IActivityManager.descriptor);
1124 IBinder b = data.readStrongBinder();
1125 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1126 Uri uri = Uri.CREATOR.createFromParcel(data);
1127 int mode = data.readInt();
1128 revokeUriPermission(app, uri, mode);
1129 reply.writeNoException();
1130 return true;
1131 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 IBinder b = data.readStrongBinder();
1136 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1137 boolean waiting = data.readInt() != 0;
1138 showWaitingForDebugger(app, waiting);
1139 reply.writeNoException();
1140 return true;
1141 }
1142
1143 case GET_MEMORY_INFO_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1146 getMemoryInfo(mi);
1147 reply.writeNoException();
1148 mi.writeToParcel(reply, 0);
1149 return true;
1150 }
1151
1152 case UNHANDLED_BACK_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 unhandledBack();
1155 reply.writeNoException();
1156 return true;
1157 }
1158
1159 case OPEN_CONTENT_URI_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 Uri uri = Uri.parse(data.readString());
1162 ParcelFileDescriptor pfd = openContentUri(uri);
1163 reply.writeNoException();
1164 if (pfd != null) {
1165 reply.writeInt(1);
1166 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1167 } else {
1168 reply.writeInt(0);
1169 }
1170 return true;
1171 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001172
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 case GOING_TO_SLEEP_TRANSACTION: {
1174 data.enforceInterface(IActivityManager.descriptor);
1175 goingToSleep();
1176 reply.writeNoException();
1177 return true;
1178 }
1179
1180 case WAKING_UP_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 wakingUp();
1183 reply.writeNoException();
1184 return true;
1185 }
1186
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001187 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 setLockScreenShown(data.readInt() != 0);
1190 reply.writeNoException();
1191 return true;
1192 }
1193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 case SET_DEBUG_APP_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 String pn = data.readString();
1197 boolean wfd = data.readInt() != 0;
1198 boolean per = data.readInt() != 0;
1199 setDebugApp(pn, wfd, per);
1200 reply.writeNoException();
1201 return true;
1202 }
1203
1204 case SET_ALWAYS_FINISH_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 boolean enabled = data.readInt() != 0;
1207 setAlwaysFinish(enabled);
1208 reply.writeNoException();
1209 return true;
1210 }
1211
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001212 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001214 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001216 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001217 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 return true;
1219 }
1220
1221 case ENTER_SAFE_MODE_TRANSACTION: {
1222 data.enforceInterface(IActivityManager.descriptor);
1223 enterSafeMode();
1224 reply.writeNoException();
1225 return true;
1226 }
1227
1228 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 IIntentSender is = IIntentSender.Stub.asInterface(
1231 data.readStrongBinder());
1232 noteWakeupAlarm(is);
1233 reply.writeNoException();
1234 return true;
1235 }
1236
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001237 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 data.enforceInterface(IActivityManager.descriptor);
1239 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001240 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001241 boolean secure = data.readInt() != 0;
1242 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001243 reply.writeNoException();
1244 reply.writeInt(res ? 1 : 0);
1245 return true;
1246 }
1247
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001248 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 String reason = data.readString();
1251 boolean res = killProcessesBelowForeground(reason);
1252 reply.writeNoException();
1253 reply.writeInt(res ? 1 : 0);
1254 return true;
1255 }
1256
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 case START_RUNNING_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 String pkg = data.readString();
1260 String cls = data.readString();
1261 String action = data.readString();
1262 String indata = data.readString();
1263 startRunning(pkg, cls, action, indata);
1264 reply.writeNoException();
1265 return true;
1266 }
1267
Dan Egnor60d87622009-12-16 16:32:58 -08001268 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 IBinder app = data.readStrongBinder();
1271 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1272 handleApplicationCrash(app, ci);
1273 reply.writeNoException();
1274 return true;
1275 }
1276
1277 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 data.enforceInterface(IActivityManager.descriptor);
1279 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001281 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001282 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001284 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 return true;
1286 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001287
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001288 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001291 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001292 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1293 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001294 reply.writeNoException();
1295 return true;
1296 }
1297
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001298 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
1300 int sig = data.readInt();
1301 signalPersistentProcesses(sig);
1302 reply.writeNoException();
1303 return true;
1304 }
1305
Dianne Hackborn03abb812010-01-04 18:43:19 -08001306 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001308 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001309 int userId = data.readInt();
1310 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001311 reply.writeNoException();
1312 return true;
1313 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001314
1315 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 killAllBackgroundProcesses();
1318 reply.writeNoException();
1319 return true;
1320 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001321
Dianne Hackborn03abb812010-01-04 18:43:19 -08001322 case FORCE_STOP_PACKAGE_TRANSACTION: {
1323 data.enforceInterface(IActivityManager.descriptor);
1324 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001325 int userId = data.readInt();
1326 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 reply.writeNoException();
1328 return true;
1329 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001330
1331 case GET_MY_MEMORY_STATE_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
1333 ActivityManager.RunningAppProcessInfo info =
1334 new ActivityManager.RunningAppProcessInfo();
1335 getMyMemoryState(info);
1336 reply.writeNoException();
1337 info.writeToParcel(reply, 0);
1338 return true;
1339 }
1340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
1343 ConfigurationInfo config = getDeviceConfigurationInfo();
1344 reply.writeNoException();
1345 config.writeToParcel(reply, 0);
1346 return true;
1347 }
1348
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001349 case PROFILE_CONTROL_TRANSACTION: {
1350 data.enforceInterface(IActivityManager.descriptor);
1351 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001352 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001353 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001354 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001355 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001356 ParcelFileDescriptor fd = data.readInt() != 0
1357 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001358 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001359 reply.writeNoException();
1360 reply.writeInt(res ? 1 : 0);
1361 return true;
1362 }
1363
Dianne Hackborn55280a92009-05-07 15:53:46 -07001364 case SHUTDOWN_TRANSACTION: {
1365 data.enforceInterface(IActivityManager.descriptor);
1366 boolean res = shutdown(data.readInt());
1367 reply.writeNoException();
1368 reply.writeInt(res ? 1 : 0);
1369 return true;
1370 }
1371
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001372 case STOP_APP_SWITCHES_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 stopAppSwitches();
1375 reply.writeNoException();
1376 return true;
1377 }
1378
1379 case RESUME_APP_SWITCHES_TRANSACTION: {
1380 data.enforceInterface(IActivityManager.descriptor);
1381 resumeAppSwitches();
1382 reply.writeNoException();
1383 return true;
1384 }
1385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001386 case PEEK_SERVICE_TRANSACTION: {
1387 data.enforceInterface(IActivityManager.descriptor);
1388 Intent service = Intent.CREATOR.createFromParcel(data);
1389 String resolvedType = data.readString();
1390 IBinder binder = peekService(service, resolvedType);
1391 reply.writeNoException();
1392 reply.writeStrongBinder(binder);
1393 return true;
1394 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001395
1396 case START_BACKUP_AGENT_TRANSACTION: {
1397 data.enforceInterface(IActivityManager.descriptor);
1398 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1399 int backupRestoreMode = data.readInt();
1400 boolean success = bindBackupAgent(info, backupRestoreMode);
1401 reply.writeNoException();
1402 reply.writeInt(success ? 1 : 0);
1403 return true;
1404 }
1405
1406 case BACKUP_AGENT_CREATED_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
1408 String packageName = data.readString();
1409 IBinder agent = data.readStrongBinder();
1410 backupAgentCreated(packageName, agent);
1411 reply.writeNoException();
1412 return true;
1413 }
1414
1415 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1416 data.enforceInterface(IActivityManager.descriptor);
1417 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1418 unbindBackupAgent(info);
1419 reply.writeNoException();
1420 return true;
1421 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001422
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001423 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001424 data.enforceInterface(IActivityManager.descriptor);
1425 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001426 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001427 String reason = data.readString();
1428 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001429 reply.writeNoException();
1430 return true;
1431 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001432
1433 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1434 data.enforceInterface(IActivityManager.descriptor);
1435 String reason = data.readString();
1436 closeSystemDialogs(reason);
1437 reply.writeNoException();
1438 return true;
1439 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001440
1441 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001443 int[] pids = data.createIntArray();
1444 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001445 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001446 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001447 return true;
1448 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001449
1450 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1451 data.enforceInterface(IActivityManager.descriptor);
1452 String processName = data.readString();
1453 int uid = data.readInt();
1454 killApplicationProcess(processName, uid);
1455 reply.writeNoException();
1456 return true;
1457 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001458
1459 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1460 data.enforceInterface(IActivityManager.descriptor);
1461 IBinder token = data.readStrongBinder();
1462 String packageName = data.readString();
1463 int enterAnim = data.readInt();
1464 int exitAnim = data.readInt();
1465 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001466 reply.writeNoException();
1467 return true;
1468 }
1469
1470 case IS_USER_A_MONKEY_TRANSACTION: {
1471 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001472 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001473 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001474 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001475 return true;
1476 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001477
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001478 case SET_USER_IS_MONKEY_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 final boolean monkey = (data.readInt() == 1);
1481 setUserIsMonkey(monkey);
1482 reply.writeNoException();
1483 return true;
1484 }
1485
Dianne Hackborn860755f2010-06-03 18:47:52 -07001486 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1487 data.enforceInterface(IActivityManager.descriptor);
1488 finishHeavyWeightApp();
1489 reply.writeNoException();
1490 return true;
1491 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001492
1493 case IS_IMMERSIVE_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
1495 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001496 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001497 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001498 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001499 return true;
1500 }
1501
Craig Mautner4addfc52013-06-25 08:05:45 -07001502 case CONVERT_TO_OPAQUE_TRANSACTION: {
1503 data.enforceInterface(IActivityManager.descriptor);
1504 IBinder token = data.readStrongBinder();
1505 convertToOpaque(token);
1506 reply.writeNoException();
1507 return true;
1508 }
1509
Daniel Sandler69a48172010-06-23 16:29:36 -04001510 case SET_IMMERSIVE_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 IBinder token = data.readStrongBinder();
1513 boolean imm = data.readInt() == 1;
1514 setImmersive(token, imm);
1515 reply.writeNoException();
1516 return true;
1517 }
1518
1519 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1520 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001521 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001522 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001523 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001524 return true;
1525 }
1526
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001527 case CRASH_APPLICATION_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
1529 int uid = data.readInt();
1530 int initialPid = data.readInt();
1531 String packageName = data.readString();
1532 String message = data.readString();
1533 crashApplication(uid, initialPid, packageName, message);
1534 reply.writeNoException();
1535 return true;
1536 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001537
1538 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1539 data.enforceInterface(IActivityManager.descriptor);
1540 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001541 int userId = data.readInt();
1542 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001543 reply.writeNoException();
1544 reply.writeString(type);
1545 return true;
1546 }
1547
Dianne Hackborn7e269642010-08-25 19:50:20 -07001548 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 String name = data.readString();
1551 IBinder perm = newUriPermissionOwner(name);
1552 reply.writeNoException();
1553 reply.writeStrongBinder(perm);
1554 return true;
1555 }
1556
1557 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1558 data.enforceInterface(IActivityManager.descriptor);
1559 IBinder owner = data.readStrongBinder();
1560 int fromUid = data.readInt();
1561 String targetPkg = data.readString();
1562 Uri uri = Uri.CREATOR.createFromParcel(data);
1563 int mode = data.readInt();
1564 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1565 reply.writeNoException();
1566 return true;
1567 }
1568
1569 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1570 data.enforceInterface(IActivityManager.descriptor);
1571 IBinder owner = data.readStrongBinder();
1572 Uri uri = null;
1573 if (data.readInt() != 0) {
1574 Uri.CREATOR.createFromParcel(data);
1575 }
1576 int mode = data.readInt();
1577 revokeUriPermissionFromOwner(owner, uri, mode);
1578 reply.writeNoException();
1579 return true;
1580 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001581
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001582 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 int callingUid = data.readInt();
1585 String targetPkg = data.readString();
1586 Uri uri = Uri.CREATOR.createFromParcel(data);
1587 int modeFlags = data.readInt();
1588 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1589 reply.writeNoException();
1590 reply.writeInt(res);
1591 return true;
1592 }
1593
Andy McFadden824c5102010-07-09 16:26:57 -07001594 case DUMP_HEAP_TRANSACTION: {
1595 data.enforceInterface(IActivityManager.descriptor);
1596 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001597 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001598 boolean managed = data.readInt() != 0;
1599 String path = data.readString();
1600 ParcelFileDescriptor fd = data.readInt() != 0
1601 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001602 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001603 reply.writeNoException();
1604 reply.writeInt(res ? 1 : 0);
1605 return true;
1606 }
1607
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001608 case START_ACTIVITIES_TRANSACTION:
1609 {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 IBinder b = data.readStrongBinder();
1612 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001613 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001614 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1615 String[] resolvedTypes = data.createStringArray();
1616 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001617 Bundle options = data.readInt() != 0
1618 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001619 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001620 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001621 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001622 reply.writeNoException();
1623 reply.writeInt(result);
1624 return true;
1625 }
1626
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001627 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1628 {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 int mode = getFrontActivityScreenCompatMode();
1631 reply.writeNoException();
1632 reply.writeInt(mode);
1633 return true;
1634 }
1635
1636 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1637 {
1638 data.enforceInterface(IActivityManager.descriptor);
1639 int mode = data.readInt();
1640 setFrontActivityScreenCompatMode(mode);
1641 reply.writeNoException();
1642 reply.writeInt(mode);
1643 return true;
1644 }
1645
1646 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1647 {
1648 data.enforceInterface(IActivityManager.descriptor);
1649 String pkg = data.readString();
1650 int mode = getPackageScreenCompatMode(pkg);
1651 reply.writeNoException();
1652 reply.writeInt(mode);
1653 return true;
1654 }
1655
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001656 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1657 {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001660 int mode = data.readInt();
1661 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001662 reply.writeNoException();
1663 return true;
1664 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001665
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001666 case SWITCH_USER_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 int userid = data.readInt();
1669 boolean result = switchUser(userid);
1670 reply.writeNoException();
1671 reply.writeInt(result ? 1 : 0);
1672 return true;
1673 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001674
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001675 case STOP_USER_TRANSACTION: {
1676 data.enforceInterface(IActivityManager.descriptor);
1677 int userid = data.readInt();
1678 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1679 data.readStrongBinder());
1680 int result = stopUser(userid, callback);
1681 reply.writeNoException();
1682 reply.writeInt(result);
1683 return true;
1684 }
1685
Amith Yamasani52f1d752012-03-28 18:19:29 -07001686 case GET_CURRENT_USER_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 UserInfo userInfo = getCurrentUser();
1689 reply.writeNoException();
1690 userInfo.writeToParcel(reply, 0);
1691 return true;
1692 }
1693
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001694 case IS_USER_RUNNING_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001697 boolean orStopping = data.readInt() != 0;
1698 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001699 reply.writeNoException();
1700 reply.writeInt(result ? 1 : 0);
1701 return true;
1702 }
1703
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001704 case GET_RUNNING_USER_IDS_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 int[] result = getRunningUserIds();
1707 reply.writeNoException();
1708 reply.writeIntArray(result);
1709 return true;
1710 }
1711
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001712 case REMOVE_SUB_TASK_TRANSACTION:
1713 {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 int taskId = data.readInt();
1716 int subTaskIndex = data.readInt();
1717 boolean result = removeSubTask(taskId, subTaskIndex);
1718 reply.writeNoException();
1719 reply.writeInt(result ? 1 : 0);
1720 return true;
1721 }
1722
1723 case REMOVE_TASK_TRANSACTION:
1724 {
1725 data.enforceInterface(IActivityManager.descriptor);
1726 int taskId = data.readInt();
1727 int fl = data.readInt();
1728 boolean result = removeTask(taskId, fl);
1729 reply.writeNoException();
1730 reply.writeInt(result ? 1 : 0);
1731 return true;
1732 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001733
Jeff Sharkeya4620792011-05-20 15:29:23 -07001734 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1737 data.readStrongBinder());
1738 registerProcessObserver(observer);
1739 return true;
1740 }
1741
1742 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1745 data.readStrongBinder());
1746 unregisterProcessObserver(observer);
1747 return true;
1748 }
1749
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001750 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1751 {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 String pkg = data.readString();
1754 boolean ask = getPackageAskScreenCompat(pkg);
1755 reply.writeNoException();
1756 reply.writeInt(ask ? 1 : 0);
1757 return true;
1758 }
1759
1760 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1761 {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 String pkg = data.readString();
1764 boolean ask = data.readInt() != 0;
1765 setPackageAskScreenCompat(pkg, ask);
1766 reply.writeNoException();
1767 return true;
1768 }
1769
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001770 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 IIntentSender r = IIntentSender.Stub.asInterface(
1773 data.readStrongBinder());
1774 boolean res = isIntentSenderTargetedToPackage(r);
1775 reply.writeNoException();
1776 reply.writeInt(res ? 1 : 0);
1777 return true;
1778 }
1779
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001780 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 IIntentSender r = IIntentSender.Stub.asInterface(
1783 data.readStrongBinder());
1784 boolean res = isIntentSenderAnActivity(r);
1785 reply.writeNoException();
1786 reply.writeInt(res ? 1 : 0);
1787 return true;
1788 }
1789
Dianne Hackborn81038902012-11-26 17:04:09 -08001790 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 IIntentSender r = IIntentSender.Stub.asInterface(
1793 data.readStrongBinder());
1794 Intent intent = getIntentForIntentSender(r);
1795 reply.writeNoException();
1796 if (intent != null) {
1797 reply.writeInt(1);
1798 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1799 } else {
1800 reply.writeInt(0);
1801 }
1802 return true;
1803 }
1804
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001805 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1806 data.enforceInterface(IActivityManager.descriptor);
1807 Configuration config = Configuration.CREATOR.createFromParcel(data);
1808 updatePersistentConfiguration(config);
1809 reply.writeNoException();
1810 return true;
1811 }
1812
Dianne Hackbornb437e092011-08-05 17:50:29 -07001813 case GET_PROCESS_PSS_TRANSACTION: {
1814 data.enforceInterface(IActivityManager.descriptor);
1815 int[] pids = data.createIntArray();
1816 long[] pss = getProcessPss(pids);
1817 reply.writeNoException();
1818 reply.writeLongArray(pss);
1819 return true;
1820 }
1821
Dianne Hackborn661cd522011-08-22 00:26:20 -07001822 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1823 data.enforceInterface(IActivityManager.descriptor);
1824 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1825 boolean always = data.readInt() != 0;
1826 showBootMessage(msg, always);
1827 reply.writeNoException();
1828 return true;
1829 }
1830
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001831 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1832 data.enforceInterface(IActivityManager.descriptor);
1833 dismissKeyguardOnNextActivity();
1834 reply.writeNoException();
1835 return true;
1836 }
1837
Adam Powelldd8fab22012-03-22 17:47:27 -07001838 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1839 data.enforceInterface(IActivityManager.descriptor);
1840 IBinder token = data.readStrongBinder();
1841 String destAffinity = data.readString();
1842 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1843 reply.writeNoException();
1844 reply.writeInt(res ? 1 : 0);
1845 return true;
1846 }
1847
1848 case NAVIGATE_UP_TO_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 IBinder token = data.readStrongBinder();
1851 Intent target = Intent.CREATOR.createFromParcel(data);
1852 int resultCode = data.readInt();
1853 Intent resultData = null;
1854 if (data.readInt() != 0) {
1855 resultData = Intent.CREATOR.createFromParcel(data);
1856 }
1857 boolean res = navigateUpTo(token, target, resultCode, resultData);
1858 reply.writeNoException();
1859 reply.writeInt(res ? 1 : 0);
1860 return true;
1861 }
1862
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001863 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1864 data.enforceInterface(IActivityManager.descriptor);
1865 IBinder token = data.readStrongBinder();
1866 int res = getLaunchedFromUid(token);
1867 reply.writeNoException();
1868 reply.writeInt(res);
1869 return true;
1870 }
1871
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001872 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1873 data.enforceInterface(IActivityManager.descriptor);
1874 IBinder token = data.readStrongBinder();
1875 String res = getLaunchedFromPackage(token);
1876 reply.writeNoException();
1877 reply.writeString(res);
1878 return true;
1879 }
1880
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001881 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1882 data.enforceInterface(IActivityManager.descriptor);
1883 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1884 data.readStrongBinder());
1885 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001886 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001887 return true;
1888 }
1889
1890 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1893 data.readStrongBinder());
1894 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001895 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001896 return true;
1897 }
1898
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001899 case REQUEST_BUG_REPORT_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001902 reply.writeNoException();
1903 return true;
1904 }
1905
1906 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1907 data.enforceInterface(IActivityManager.descriptor);
1908 int pid = data.readInt();
1909 boolean aboveSystem = data.readInt() != 0;
1910 long res = inputDispatchingTimedOut(pid, aboveSystem);
1911 reply.writeNoException();
1912 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001913 return true;
1914 }
1915
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001916 case GET_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 int requestType = data.readInt();
1919 Bundle res = getTopActivityExtras(requestType);
1920 reply.writeNoException();
1921 reply.writeBundle(res);
1922 return true;
1923 }
1924
1925 case REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION: {
1926 data.enforceInterface(IActivityManager.descriptor);
1927 IBinder token = data.readStrongBinder();
1928 Bundle extras = data.readBundle();
1929 reportTopActivityExtras(token, extras);
1930 reply.writeNoException();
1931 return true;
1932 }
1933
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001934 case KILL_UID_TRANSACTION: {
1935 data.enforceInterface(IActivityManager.descriptor);
1936 int uid = data.readInt();
1937 String reason = data.readString();
1938 killUid(uid, reason);
1939 reply.writeNoException();
1940 return true;
1941 }
1942
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07001943 case HANG_TRANSACTION: {
1944 data.enforceInterface(IActivityManager.descriptor);
1945 IBinder who = data.readStrongBinder();
1946 boolean allowRestart = data.readInt() != 0;
1947 hang(who, allowRestart);
1948 reply.writeNoException();
1949 return true;
1950 }
1951
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07001952 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
1953 data.enforceInterface(IActivityManager.descriptor);
1954 IBinder token = data.readStrongBinder();
1955 reportActivityFullyDrawn(token);
1956 reply.writeNoException();
1957 return true;
1958 }
1959
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001960 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001961
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001962 return super.onTransact(code, data, reply, flags);
1963 }
1964
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001965 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001966 return this;
1967 }
1968
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001969 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1970 protected IActivityManager create() {
1971 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001972 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001973 Log.v("ActivityManager", "default service binder = " + b);
1974 }
1975 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001976 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001977 Log.v("ActivityManager", "default service = " + am);
1978 }
1979 return am;
1980 }
1981 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001982}
1983
1984class ActivityManagerProxy implements IActivityManager
1985{
1986 public ActivityManagerProxy(IBinder remote)
1987 {
1988 mRemote = remote;
1989 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001990
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001991 public IBinder asBinder()
1992 {
1993 return mRemote;
1994 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001995
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001996 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001997 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1998 int startFlags, String profileFile,
1999 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002000 Parcel data = Parcel.obtain();
2001 Parcel reply = Parcel.obtain();
2002 data.writeInterfaceToken(IActivityManager.descriptor);
2003 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002004 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002005 intent.writeToParcel(data, 0);
2006 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002007 data.writeStrongBinder(resultTo);
2008 data.writeString(resultWho);
2009 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002010 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002011 data.writeString(profileFile);
2012 if (profileFd != null) {
2013 data.writeInt(1);
2014 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2015 } else {
2016 data.writeInt(0);
2017 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002018 if (options != null) {
2019 data.writeInt(1);
2020 options.writeToParcel(data, 0);
2021 } else {
2022 data.writeInt(0);
2023 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002024 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2025 reply.readException();
2026 int result = reply.readInt();
2027 reply.recycle();
2028 data.recycle();
2029 return result;
2030 }
Amith Yamasani82644082012-08-03 13:09:11 -07002031
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002032 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002033 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2034 int startFlags, String profileFile,
2035 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2036 Parcel data = Parcel.obtain();
2037 Parcel reply = Parcel.obtain();
2038 data.writeInterfaceToken(IActivityManager.descriptor);
2039 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002040 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002041 intent.writeToParcel(data, 0);
2042 data.writeString(resolvedType);
2043 data.writeStrongBinder(resultTo);
2044 data.writeString(resultWho);
2045 data.writeInt(requestCode);
2046 data.writeInt(startFlags);
2047 data.writeString(profileFile);
2048 if (profileFd != null) {
2049 data.writeInt(1);
2050 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2051 } else {
2052 data.writeInt(0);
2053 }
2054 if (options != null) {
2055 data.writeInt(1);
2056 options.writeToParcel(data, 0);
2057 } else {
2058 data.writeInt(0);
2059 }
2060 data.writeInt(userId);
2061 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2062 reply.readException();
2063 int result = reply.readInt();
2064 reply.recycle();
2065 data.recycle();
2066 return result;
2067 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002068 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2069 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002070 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002071 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002072 Parcel data = Parcel.obtain();
2073 Parcel reply = Parcel.obtain();
2074 data.writeInterfaceToken(IActivityManager.descriptor);
2075 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002076 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002077 intent.writeToParcel(data, 0);
2078 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002079 data.writeStrongBinder(resultTo);
2080 data.writeString(resultWho);
2081 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002082 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002083 data.writeString(profileFile);
2084 if (profileFd != null) {
2085 data.writeInt(1);
2086 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2087 } else {
2088 data.writeInt(0);
2089 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002090 if (options != null) {
2091 data.writeInt(1);
2092 options.writeToParcel(data, 0);
2093 } else {
2094 data.writeInt(0);
2095 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002096 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002097 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2098 reply.readException();
2099 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2100 reply.recycle();
2101 data.recycle();
2102 return result;
2103 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002104 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2105 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002106 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002107 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002108 Parcel data = Parcel.obtain();
2109 Parcel reply = Parcel.obtain();
2110 data.writeInterfaceToken(IActivityManager.descriptor);
2111 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002112 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002113 intent.writeToParcel(data, 0);
2114 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002115 data.writeStrongBinder(resultTo);
2116 data.writeString(resultWho);
2117 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002118 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002119 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002120 if (options != null) {
2121 data.writeInt(1);
2122 options.writeToParcel(data, 0);
2123 } else {
2124 data.writeInt(0);
2125 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002126 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002127 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2128 reply.readException();
2129 int result = reply.readInt();
2130 reply.recycle();
2131 data.recycle();
2132 return result;
2133 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002134 public int startActivityIntentSender(IApplicationThread caller,
2135 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002136 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002137 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002138 Parcel data = Parcel.obtain();
2139 Parcel reply = Parcel.obtain();
2140 data.writeInterfaceToken(IActivityManager.descriptor);
2141 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2142 intent.writeToParcel(data, 0);
2143 if (fillInIntent != null) {
2144 data.writeInt(1);
2145 fillInIntent.writeToParcel(data, 0);
2146 } else {
2147 data.writeInt(0);
2148 }
2149 data.writeString(resolvedType);
2150 data.writeStrongBinder(resultTo);
2151 data.writeString(resultWho);
2152 data.writeInt(requestCode);
2153 data.writeInt(flagsMask);
2154 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002155 if (options != null) {
2156 data.writeInt(1);
2157 options.writeToParcel(data, 0);
2158 } else {
2159 data.writeInt(0);
2160 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002161 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002162 reply.readException();
2163 int result = reply.readInt();
2164 reply.recycle();
2165 data.recycle();
2166 return result;
2167 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002168 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002169 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002170 Parcel data = Parcel.obtain();
2171 Parcel reply = Parcel.obtain();
2172 data.writeInterfaceToken(IActivityManager.descriptor);
2173 data.writeStrongBinder(callingActivity);
2174 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002175 if (options != null) {
2176 data.writeInt(1);
2177 options.writeToParcel(data, 0);
2178 } else {
2179 data.writeInt(0);
2180 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002181 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2182 reply.readException();
2183 int result = reply.readInt();
2184 reply.recycle();
2185 data.recycle();
2186 return result != 0;
2187 }
2188 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2189 throws RemoteException {
2190 Parcel data = Parcel.obtain();
2191 Parcel reply = Parcel.obtain();
2192 data.writeInterfaceToken(IActivityManager.descriptor);
2193 data.writeStrongBinder(token);
2194 data.writeInt(resultCode);
2195 if (resultData != null) {
2196 data.writeInt(1);
2197 resultData.writeToParcel(data, 0);
2198 } else {
2199 data.writeInt(0);
2200 }
2201 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2202 reply.readException();
2203 boolean res = reply.readInt() != 0;
2204 data.recycle();
2205 reply.recycle();
2206 return res;
2207 }
2208 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2209 {
2210 Parcel data = Parcel.obtain();
2211 Parcel reply = Parcel.obtain();
2212 data.writeInterfaceToken(IActivityManager.descriptor);
2213 data.writeStrongBinder(token);
2214 data.writeString(resultWho);
2215 data.writeInt(requestCode);
2216 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2217 reply.readException();
2218 data.recycle();
2219 reply.recycle();
2220 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002221 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2222 Parcel data = Parcel.obtain();
2223 Parcel reply = Parcel.obtain();
2224 data.writeInterfaceToken(IActivityManager.descriptor);
2225 data.writeStrongBinder(token);
2226 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2227 reply.readException();
2228 boolean res = reply.readInt() != 0;
2229 data.recycle();
2230 reply.recycle();
2231 return res;
2232 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002233 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2234 Parcel data = Parcel.obtain();
2235 Parcel reply = Parcel.obtain();
2236 data.writeInterfaceToken(IActivityManager.descriptor);
2237 data.writeStrongBinder(token);
2238 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2239 reply.readException();
2240 boolean res = reply.readInt() != 0;
2241 data.recycle();
2242 reply.recycle();
2243 return res;
2244 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002245 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002246 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002247 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002248 {
2249 Parcel data = Parcel.obtain();
2250 Parcel reply = Parcel.obtain();
2251 data.writeInterfaceToken(IActivityManager.descriptor);
2252 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002253 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002254 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2255 filter.writeToParcel(data, 0);
2256 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002257 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002258 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2259 reply.readException();
2260 Intent intent = null;
2261 int haveIntent = reply.readInt();
2262 if (haveIntent != 0) {
2263 intent = Intent.CREATOR.createFromParcel(reply);
2264 }
2265 reply.recycle();
2266 data.recycle();
2267 return intent;
2268 }
2269 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2270 {
2271 Parcel data = Parcel.obtain();
2272 Parcel reply = Parcel.obtain();
2273 data.writeInterfaceToken(IActivityManager.descriptor);
2274 data.writeStrongBinder(receiver.asBinder());
2275 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2276 reply.readException();
2277 data.recycle();
2278 reply.recycle();
2279 }
2280 public int broadcastIntent(IApplicationThread caller,
2281 Intent intent, String resolvedType, IIntentReceiver resultTo,
2282 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002283 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002284 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002285 {
2286 Parcel data = Parcel.obtain();
2287 Parcel reply = Parcel.obtain();
2288 data.writeInterfaceToken(IActivityManager.descriptor);
2289 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2290 intent.writeToParcel(data, 0);
2291 data.writeString(resolvedType);
2292 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2293 data.writeInt(resultCode);
2294 data.writeString(resultData);
2295 data.writeBundle(map);
2296 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002297 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002298 data.writeInt(serialized ? 1 : 0);
2299 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002300 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002301 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2302 reply.readException();
2303 int res = reply.readInt();
2304 reply.recycle();
2305 data.recycle();
2306 return res;
2307 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002308 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2309 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002310 {
2311 Parcel data = Parcel.obtain();
2312 Parcel reply = Parcel.obtain();
2313 data.writeInterfaceToken(IActivityManager.descriptor);
2314 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2315 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002316 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002317 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2318 reply.readException();
2319 data.recycle();
2320 reply.recycle();
2321 }
2322 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2323 {
2324 Parcel data = Parcel.obtain();
2325 Parcel reply = Parcel.obtain();
2326 data.writeInterfaceToken(IActivityManager.descriptor);
2327 data.writeStrongBinder(who);
2328 data.writeInt(resultCode);
2329 data.writeString(resultData);
2330 data.writeBundle(map);
2331 data.writeInt(abortBroadcast ? 1 : 0);
2332 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2333 reply.readException();
2334 data.recycle();
2335 reply.recycle();
2336 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002337 public void attachApplication(IApplicationThread app) throws RemoteException
2338 {
2339 Parcel data = Parcel.obtain();
2340 Parcel reply = Parcel.obtain();
2341 data.writeInterfaceToken(IActivityManager.descriptor);
2342 data.writeStrongBinder(app.asBinder());
2343 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2344 reply.readException();
2345 data.recycle();
2346 reply.recycle();
2347 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002348 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2349 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002350 {
2351 Parcel data = Parcel.obtain();
2352 Parcel reply = Parcel.obtain();
2353 data.writeInterfaceToken(IActivityManager.descriptor);
2354 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002355 if (config != null) {
2356 data.writeInt(1);
2357 config.writeToParcel(data, 0);
2358 } else {
2359 data.writeInt(0);
2360 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002361 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002362 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2363 reply.readException();
2364 data.recycle();
2365 reply.recycle();
2366 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002367 public void activityResumed(IBinder token) throws RemoteException
2368 {
2369 Parcel data = Parcel.obtain();
2370 Parcel reply = Parcel.obtain();
2371 data.writeInterfaceToken(IActivityManager.descriptor);
2372 data.writeStrongBinder(token);
2373 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2374 reply.readException();
2375 data.recycle();
2376 reply.recycle();
2377 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002378 public void activityPaused(IBinder token) throws RemoteException
2379 {
2380 Parcel data = Parcel.obtain();
2381 Parcel reply = Parcel.obtain();
2382 data.writeInterfaceToken(IActivityManager.descriptor);
2383 data.writeStrongBinder(token);
2384 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2385 reply.readException();
2386 data.recycle();
2387 reply.recycle();
2388 }
2389 public void activityStopped(IBinder token, Bundle state,
2390 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002391 {
2392 Parcel data = Parcel.obtain();
2393 Parcel reply = Parcel.obtain();
2394 data.writeInterfaceToken(IActivityManager.descriptor);
2395 data.writeStrongBinder(token);
2396 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002397 if (thumbnail != null) {
2398 data.writeInt(1);
2399 thumbnail.writeToParcel(data, 0);
2400 } else {
2401 data.writeInt(0);
2402 }
2403 TextUtils.writeToParcel(description, data, 0);
2404 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2405 reply.readException();
2406 data.recycle();
2407 reply.recycle();
2408 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002409 public void activitySlept(IBinder token) throws RemoteException
2410 {
2411 Parcel data = Parcel.obtain();
2412 Parcel reply = Parcel.obtain();
2413 data.writeInterfaceToken(IActivityManager.descriptor);
2414 data.writeStrongBinder(token);
2415 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2416 reply.readException();
2417 data.recycle();
2418 reply.recycle();
2419 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002420 public void activityDestroyed(IBinder token) throws RemoteException
2421 {
2422 Parcel data = Parcel.obtain();
2423 Parcel reply = Parcel.obtain();
2424 data.writeInterfaceToken(IActivityManager.descriptor);
2425 data.writeStrongBinder(token);
2426 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2427 reply.readException();
2428 data.recycle();
2429 reply.recycle();
2430 }
2431 public String getCallingPackage(IBinder token) throws RemoteException
2432 {
2433 Parcel data = Parcel.obtain();
2434 Parcel reply = Parcel.obtain();
2435 data.writeInterfaceToken(IActivityManager.descriptor);
2436 data.writeStrongBinder(token);
2437 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2438 reply.readException();
2439 String res = reply.readString();
2440 data.recycle();
2441 reply.recycle();
2442 return res;
2443 }
2444 public ComponentName getCallingActivity(IBinder token)
2445 throws RemoteException {
2446 Parcel data = Parcel.obtain();
2447 Parcel reply = Parcel.obtain();
2448 data.writeInterfaceToken(IActivityManager.descriptor);
2449 data.writeStrongBinder(token);
2450 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2451 reply.readException();
2452 ComponentName res = ComponentName.readFromParcel(reply);
2453 data.recycle();
2454 reply.recycle();
2455 return res;
2456 }
2457 public List getTasks(int maxNum, int flags,
2458 IThumbnailReceiver receiver) throws RemoteException {
2459 Parcel data = Parcel.obtain();
2460 Parcel reply = Parcel.obtain();
2461 data.writeInterfaceToken(IActivityManager.descriptor);
2462 data.writeInt(maxNum);
2463 data.writeInt(flags);
2464 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2465 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2466 reply.readException();
2467 ArrayList list = null;
2468 int N = reply.readInt();
2469 if (N >= 0) {
2470 list = new ArrayList();
2471 while (N > 0) {
2472 ActivityManager.RunningTaskInfo info =
2473 ActivityManager.RunningTaskInfo.CREATOR
2474 .createFromParcel(reply);
2475 list.add(info);
2476 N--;
2477 }
2478 }
2479 data.recycle();
2480 reply.recycle();
2481 return list;
2482 }
2483 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002484 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002485 Parcel data = Parcel.obtain();
2486 Parcel reply = Parcel.obtain();
2487 data.writeInterfaceToken(IActivityManager.descriptor);
2488 data.writeInt(maxNum);
2489 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002490 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002491 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2492 reply.readException();
2493 ArrayList<ActivityManager.RecentTaskInfo> list
2494 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2495 data.recycle();
2496 reply.recycle();
2497 return list;
2498 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002499 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002500 Parcel data = Parcel.obtain();
2501 Parcel reply = Parcel.obtain();
2502 data.writeInterfaceToken(IActivityManager.descriptor);
2503 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002504 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002505 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002506 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002507 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002508 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002509 }
2510 data.recycle();
2511 reply.recycle();
2512 return bm;
2513 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002514 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2515 Parcel data = Parcel.obtain();
2516 Parcel reply = Parcel.obtain();
2517 data.writeInterfaceToken(IActivityManager.descriptor);
2518 data.writeInt(id);
2519 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2520 reply.readException();
2521 Bitmap bm = null;
2522 if (reply.readInt() != 0) {
2523 bm = Bitmap.CREATOR.createFromParcel(reply);
2524 }
2525 data.recycle();
2526 reply.recycle();
2527 return bm;
2528 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002529 public List getServices(int maxNum, int flags) throws RemoteException {
2530 Parcel data = Parcel.obtain();
2531 Parcel reply = Parcel.obtain();
2532 data.writeInterfaceToken(IActivityManager.descriptor);
2533 data.writeInt(maxNum);
2534 data.writeInt(flags);
2535 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2536 reply.readException();
2537 ArrayList list = null;
2538 int N = reply.readInt();
2539 if (N >= 0) {
2540 list = new ArrayList();
2541 while (N > 0) {
2542 ActivityManager.RunningServiceInfo info =
2543 ActivityManager.RunningServiceInfo.CREATOR
2544 .createFromParcel(reply);
2545 list.add(info);
2546 N--;
2547 }
2548 }
2549 data.recycle();
2550 reply.recycle();
2551 return list;
2552 }
2553 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2554 throws RemoteException {
2555 Parcel data = Parcel.obtain();
2556 Parcel reply = Parcel.obtain();
2557 data.writeInterfaceToken(IActivityManager.descriptor);
2558 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2559 reply.readException();
2560 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2561 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2562 data.recycle();
2563 reply.recycle();
2564 return list;
2565 }
2566 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2567 throws RemoteException {
2568 Parcel data = Parcel.obtain();
2569 Parcel reply = Parcel.obtain();
2570 data.writeInterfaceToken(IActivityManager.descriptor);
2571 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2572 reply.readException();
2573 ArrayList<ActivityManager.RunningAppProcessInfo> list
2574 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2575 data.recycle();
2576 reply.recycle();
2577 return list;
2578 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002579 public List<ApplicationInfo> getRunningExternalApplications()
2580 throws RemoteException {
2581 Parcel data = Parcel.obtain();
2582 Parcel reply = Parcel.obtain();
2583 data.writeInterfaceToken(IActivityManager.descriptor);
2584 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2585 reply.readException();
2586 ArrayList<ApplicationInfo> list
2587 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2588 data.recycle();
2589 reply.recycle();
2590 return list;
2591 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002592 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593 {
2594 Parcel data = Parcel.obtain();
2595 Parcel reply = Parcel.obtain();
2596 data.writeInterfaceToken(IActivityManager.descriptor);
2597 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002598 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002599 if (options != null) {
2600 data.writeInt(1);
2601 options.writeToParcel(data, 0);
2602 } else {
2603 data.writeInt(0);
2604 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002605 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2606 reply.readException();
2607 data.recycle();
2608 reply.recycle();
2609 }
2610 public void moveTaskToBack(int task) throws RemoteException
2611 {
2612 Parcel data = Parcel.obtain();
2613 Parcel reply = Parcel.obtain();
2614 data.writeInterfaceToken(IActivityManager.descriptor);
2615 data.writeInt(task);
2616 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2617 reply.readException();
2618 data.recycle();
2619 reply.recycle();
2620 }
2621 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2622 throws RemoteException {
2623 Parcel data = Parcel.obtain();
2624 Parcel reply = Parcel.obtain();
2625 data.writeInterfaceToken(IActivityManager.descriptor);
2626 data.writeStrongBinder(token);
2627 data.writeInt(nonRoot ? 1 : 0);
2628 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2629 reply.readException();
2630 boolean res = reply.readInt() != 0;
2631 data.recycle();
2632 reply.recycle();
2633 return res;
2634 }
2635 public void moveTaskBackwards(int task) throws RemoteException
2636 {
2637 Parcel data = Parcel.obtain();
2638 Parcel reply = Parcel.obtain();
2639 data.writeInterfaceToken(IActivityManager.descriptor);
2640 data.writeInt(task);
2641 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2642 reply.readException();
2643 data.recycle();
2644 reply.recycle();
2645 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002646 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002647 public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002648 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002649 {
2650 Parcel data = Parcel.obtain();
2651 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002652 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002653 data.writeInt(taskId);
Craig Mautner5a449152013-05-24 15:49:29 -07002654 data.writeInt(relativeStackBoxId);
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07002655 data.writeInt(position);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002656 data.writeFloat(weight);
2657 mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
2658 reply.readException();
2659 int res = reply.readInt();
2660 data.recycle();
2661 reply.recycle();
2662 return res;
2663 }
2664 @Override
2665 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2666 {
2667 Parcel data = Parcel.obtain();
2668 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002669 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002670 data.writeInt(taskId);
2671 data.writeInt(stackId);
2672 data.writeInt(toTop ? 1 : 0);
2673 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2674 reply.readException();
2675 data.recycle();
2676 reply.recycle();
2677 }
2678 @Override
Craig Mautner5a449152013-05-24 15:49:29 -07002679 public void resizeStackBox(int stackBoxId, float weight) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002680 {
2681 Parcel data = Parcel.obtain();
2682 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002683 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002684 data.writeInt(stackBoxId);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002685 data.writeFloat(weight);
Craig Mautnercf910b02013-04-23 11:23:27 -07002686 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002687 reply.readException();
2688 data.recycle();
2689 reply.recycle();
2690 }
Craig Mautner967212c2013-04-13 21:10:58 -07002691 @Override
Craig Mautner5ff12102013-05-24 12:50:15 -07002692 public List<StackBoxInfo> getStackBoxes() throws RemoteException
2693 {
2694 Parcel data = Parcel.obtain();
2695 Parcel reply = Parcel.obtain();
2696 data.writeInterfaceToken(IActivityManager.descriptor);
2697 mRemote.transact(GET_STACK_BOXES_TRANSACTION, data, reply, 0);
2698 reply.readException();
2699 ArrayList<StackBoxInfo> list = reply.createTypedArrayList(StackBoxInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002700 data.recycle();
2701 reply.recycle();
2702 return list;
2703 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002704 @Override
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002705 public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException
2706 {
2707 Parcel data = Parcel.obtain();
2708 Parcel reply = Parcel.obtain();
2709 data.writeInterfaceToken(IActivityManager.descriptor);
2710 data.writeInt(stackBoxId);
2711 mRemote.transact(GET_STACK_BOX_INFO_TRANSACTION, data, reply, 0);
2712 reply.readException();
2713 int res = reply.readInt();
2714 StackBoxInfo info = null;
2715 if (res != 0) {
2716 info = StackBoxInfo.CREATOR.createFromParcel(reply);
2717 }
2718 data.recycle();
2719 reply.recycle();
2720 return info;
2721 }
2722 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002723 public void setFocusedStack(int stackId) throws RemoteException
2724 {
2725 Parcel data = Parcel.obtain();
2726 Parcel reply = Parcel.obtain();
2727 data.writeInterfaceToken(IActivityManager.descriptor);
2728 data.writeInt(stackId);
2729 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2730 reply.readException();
2731 data.recycle();
2732 reply.recycle();
2733 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002734 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2735 {
2736 Parcel data = Parcel.obtain();
2737 Parcel reply = Parcel.obtain();
2738 data.writeInterfaceToken(IActivityManager.descriptor);
2739 data.writeStrongBinder(token);
2740 data.writeInt(onlyRoot ? 1 : 0);
2741 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2742 reply.readException();
2743 int res = reply.readInt();
2744 data.recycle();
2745 reply.recycle();
2746 return res;
2747 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002748 public void reportThumbnail(IBinder token,
2749 Bitmap thumbnail, CharSequence description) throws RemoteException
2750 {
2751 Parcel data = Parcel.obtain();
2752 Parcel reply = Parcel.obtain();
2753 data.writeInterfaceToken(IActivityManager.descriptor);
2754 data.writeStrongBinder(token);
2755 if (thumbnail != null) {
2756 data.writeInt(1);
2757 thumbnail.writeToParcel(data, 0);
2758 } else {
2759 data.writeInt(0);
2760 }
2761 TextUtils.writeToParcel(description, data, 0);
2762 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2763 reply.readException();
2764 data.recycle();
2765 reply.recycle();
2766 }
2767 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002768 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002769 Parcel data = Parcel.obtain();
2770 Parcel reply = Parcel.obtain();
2771 data.writeInterfaceToken(IActivityManager.descriptor);
2772 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2773 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002774 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002775 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002776 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2777 reply.readException();
2778 int res = reply.readInt();
2779 ContentProviderHolder cph = null;
2780 if (res != 0) {
2781 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2782 }
2783 data.recycle();
2784 reply.recycle();
2785 return cph;
2786 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002787 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2788 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
2791 data.writeInterfaceToken(IActivityManager.descriptor);
2792 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002793 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002794 data.writeStrongBinder(token);
2795 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2796 reply.readException();
2797 int res = reply.readInt();
2798 ContentProviderHolder cph = null;
2799 if (res != 0) {
2800 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2801 }
2802 data.recycle();
2803 reply.recycle();
2804 return cph;
2805 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002806 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002807 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002808 {
2809 Parcel data = Parcel.obtain();
2810 Parcel reply = Parcel.obtain();
2811 data.writeInterfaceToken(IActivityManager.descriptor);
2812 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2813 data.writeTypedList(providers);
2814 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2815 reply.readException();
2816 data.recycle();
2817 reply.recycle();
2818 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002819 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2820 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002821 Parcel data = Parcel.obtain();
2822 Parcel reply = Parcel.obtain();
2823 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002824 data.writeStrongBinder(connection);
2825 data.writeInt(stable);
2826 data.writeInt(unstable);
2827 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2828 reply.readException();
2829 boolean res = reply.readInt() != 0;
2830 data.recycle();
2831 reply.recycle();
2832 return res;
2833 }
2834 public void unstableProviderDied(IBinder connection) throws RemoteException {
2835 Parcel data = Parcel.obtain();
2836 Parcel reply = Parcel.obtain();
2837 data.writeInterfaceToken(IActivityManager.descriptor);
2838 data.writeStrongBinder(connection);
2839 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2840 reply.readException();
2841 data.recycle();
2842 reply.recycle();
2843 }
2844
2845 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 data.writeStrongBinder(connection);
2850 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002851 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2852 reply.readException();
2853 data.recycle();
2854 reply.recycle();
2855 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002856
2857 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2858 Parcel data = Parcel.obtain();
2859 Parcel reply = Parcel.obtain();
2860 data.writeInterfaceToken(IActivityManager.descriptor);
2861 data.writeString(name);
2862 data.writeStrongBinder(token);
2863 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2864 reply.readException();
2865 data.recycle();
2866 reply.recycle();
2867 }
2868
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002869 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2870 throws RemoteException
2871 {
2872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 service.writeToParcel(data, 0);
2876 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2877 reply.readException();
2878 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2879 data.recycle();
2880 reply.recycle();
2881 return res;
2882 }
2883
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002884 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002885 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002886 {
2887 Parcel data = Parcel.obtain();
2888 Parcel reply = Parcel.obtain();
2889 data.writeInterfaceToken(IActivityManager.descriptor);
2890 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2891 service.writeToParcel(data, 0);
2892 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002893 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002894 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2895 reply.readException();
2896 ComponentName res = ComponentName.readFromParcel(reply);
2897 data.recycle();
2898 reply.recycle();
2899 return res;
2900 }
2901 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002902 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002903 {
2904 Parcel data = Parcel.obtain();
2905 Parcel reply = Parcel.obtain();
2906 data.writeInterfaceToken(IActivityManager.descriptor);
2907 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2908 service.writeToParcel(data, 0);
2909 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002910 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002911 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2912 reply.readException();
2913 int res = reply.readInt();
2914 reply.recycle();
2915 data.recycle();
2916 return res;
2917 }
2918 public boolean stopServiceToken(ComponentName className, IBinder token,
2919 int startId) throws RemoteException {
2920 Parcel data = Parcel.obtain();
2921 Parcel reply = Parcel.obtain();
2922 data.writeInterfaceToken(IActivityManager.descriptor);
2923 ComponentName.writeToParcel(className, data);
2924 data.writeStrongBinder(token);
2925 data.writeInt(startId);
2926 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2927 reply.readException();
2928 boolean res = reply.readInt() != 0;
2929 data.recycle();
2930 reply.recycle();
2931 return res;
2932 }
2933 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002934 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 Parcel data = Parcel.obtain();
2936 Parcel reply = Parcel.obtain();
2937 data.writeInterfaceToken(IActivityManager.descriptor);
2938 ComponentName.writeToParcel(className, data);
2939 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002940 data.writeInt(id);
2941 if (notification != null) {
2942 data.writeInt(1);
2943 notification.writeToParcel(data, 0);
2944 } else {
2945 data.writeInt(0);
2946 }
2947 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2949 reply.readException();
2950 data.recycle();
2951 reply.recycle();
2952 }
2953 public int bindService(IApplicationThread caller, IBinder token,
2954 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002955 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002956 Parcel data = Parcel.obtain();
2957 Parcel reply = Parcel.obtain();
2958 data.writeInterfaceToken(IActivityManager.descriptor);
2959 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2960 data.writeStrongBinder(token);
2961 service.writeToParcel(data, 0);
2962 data.writeString(resolvedType);
2963 data.writeStrongBinder(connection.asBinder());
2964 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002965 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002966 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2967 reply.readException();
2968 int res = reply.readInt();
2969 data.recycle();
2970 reply.recycle();
2971 return res;
2972 }
2973 public boolean unbindService(IServiceConnection connection) throws RemoteException
2974 {
2975 Parcel data = Parcel.obtain();
2976 Parcel reply = Parcel.obtain();
2977 data.writeInterfaceToken(IActivityManager.descriptor);
2978 data.writeStrongBinder(connection.asBinder());
2979 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2980 reply.readException();
2981 boolean res = reply.readInt() != 0;
2982 data.recycle();
2983 reply.recycle();
2984 return res;
2985 }
2986
2987 public void publishService(IBinder token,
2988 Intent intent, IBinder service) throws RemoteException {
2989 Parcel data = Parcel.obtain();
2990 Parcel reply = Parcel.obtain();
2991 data.writeInterfaceToken(IActivityManager.descriptor);
2992 data.writeStrongBinder(token);
2993 intent.writeToParcel(data, 0);
2994 data.writeStrongBinder(service);
2995 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2996 reply.readException();
2997 data.recycle();
2998 reply.recycle();
2999 }
3000
3001 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3002 throws RemoteException {
3003 Parcel data = Parcel.obtain();
3004 Parcel reply = Parcel.obtain();
3005 data.writeInterfaceToken(IActivityManager.descriptor);
3006 data.writeStrongBinder(token);
3007 intent.writeToParcel(data, 0);
3008 data.writeInt(doRebind ? 1 : 0);
3009 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3010 reply.readException();
3011 data.recycle();
3012 reply.recycle();
3013 }
3014
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003015 public void serviceDoneExecuting(IBinder token, int type, int startId,
3016 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 Parcel data = Parcel.obtain();
3018 Parcel reply = Parcel.obtain();
3019 data.writeInterfaceToken(IActivityManager.descriptor);
3020 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003021 data.writeInt(type);
3022 data.writeInt(startId);
3023 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003024 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3025 reply.readException();
3026 data.recycle();
3027 reply.recycle();
3028 }
3029
3030 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3031 Parcel data = Parcel.obtain();
3032 Parcel reply = Parcel.obtain();
3033 data.writeInterfaceToken(IActivityManager.descriptor);
3034 service.writeToParcel(data, 0);
3035 data.writeString(resolvedType);
3036 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3037 reply.readException();
3038 IBinder binder = reply.readStrongBinder();
3039 reply.recycle();
3040 data.recycle();
3041 return binder;
3042 }
3043
Christopher Tate181fafa2009-05-14 11:12:14 -07003044 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3045 throws RemoteException {
3046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 app.writeToParcel(data, 0);
3050 data.writeInt(backupRestoreMode);
3051 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3052 reply.readException();
3053 boolean success = reply.readInt() != 0;
3054 reply.recycle();
3055 data.recycle();
3056 return success;
3057 }
3058
Christopher Tate346acb12012-10-15 19:20:25 -07003059 public void clearPendingBackup() throws RemoteException {
3060 Parcel data = Parcel.obtain();
3061 Parcel reply = Parcel.obtain();
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3064 reply.recycle();
3065 data.recycle();
3066 }
3067
Christopher Tate181fafa2009-05-14 11:12:14 -07003068 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 data.writeString(packageName);
3073 data.writeStrongBinder(agent);
3074 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3075 reply.recycle();
3076 data.recycle();
3077 }
3078
3079 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 app.writeToParcel(data, 0);
3084 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 reply.recycle();
3087 data.recycle();
3088 }
3089
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003090 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003091 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3092 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 ComponentName.writeToParcel(className, data);
3097 data.writeString(profileFile);
3098 data.writeInt(flags);
3099 data.writeBundle(arguments);
3100 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003101 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003102 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003103 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3104 reply.readException();
3105 boolean res = reply.readInt() != 0;
3106 reply.recycle();
3107 data.recycle();
3108 return res;
3109 }
3110
3111 public void finishInstrumentation(IApplicationThread target,
3112 int resultCode, Bundle results) throws RemoteException {
3113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeStrongBinder(target != null ? target.asBinder() : null);
3117 data.writeInt(resultCode);
3118 data.writeBundle(results);
3119 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3120 reply.readException();
3121 data.recycle();
3122 reply.recycle();
3123 }
3124 public Configuration getConfiguration() throws RemoteException
3125 {
3126 Parcel data = Parcel.obtain();
3127 Parcel reply = Parcel.obtain();
3128 data.writeInterfaceToken(IActivityManager.descriptor);
3129 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3130 reply.readException();
3131 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3132 reply.recycle();
3133 data.recycle();
3134 return res;
3135 }
3136 public void updateConfiguration(Configuration values) throws RemoteException
3137 {
3138 Parcel data = Parcel.obtain();
3139 Parcel reply = Parcel.obtain();
3140 data.writeInterfaceToken(IActivityManager.descriptor);
3141 values.writeToParcel(data, 0);
3142 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3143 reply.readException();
3144 data.recycle();
3145 reply.recycle();
3146 }
3147 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3148 throws RemoteException {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
3151 data.writeInterfaceToken(IActivityManager.descriptor);
3152 data.writeStrongBinder(token);
3153 data.writeInt(requestedOrientation);
3154 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3155 reply.readException();
3156 data.recycle();
3157 reply.recycle();
3158 }
3159 public int getRequestedOrientation(IBinder token) throws RemoteException {
3160 Parcel data = Parcel.obtain();
3161 Parcel reply = Parcel.obtain();
3162 data.writeInterfaceToken(IActivityManager.descriptor);
3163 data.writeStrongBinder(token);
3164 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3165 reply.readException();
3166 int res = reply.readInt();
3167 data.recycle();
3168 reply.recycle();
3169 return res;
3170 }
3171 public ComponentName getActivityClassForToken(IBinder token)
3172 throws RemoteException {
3173 Parcel data = Parcel.obtain();
3174 Parcel reply = Parcel.obtain();
3175 data.writeInterfaceToken(IActivityManager.descriptor);
3176 data.writeStrongBinder(token);
3177 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 ComponentName res = ComponentName.readFromParcel(reply);
3180 data.recycle();
3181 reply.recycle();
3182 return res;
3183 }
3184 public String getPackageForToken(IBinder token) throws RemoteException
3185 {
3186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
3189 data.writeStrongBinder(token);
3190 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 String res = reply.readString();
3193 data.recycle();
3194 reply.recycle();
3195 return res;
3196 }
3197 public IIntentSender getIntentSender(int type,
3198 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003199 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003200 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeInt(type);
3205 data.writeString(packageName);
3206 data.writeStrongBinder(token);
3207 data.writeString(resultWho);
3208 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003209 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003210 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003211 data.writeTypedArray(intents, 0);
3212 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003213 } else {
3214 data.writeInt(0);
3215 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003217 if (options != null) {
3218 data.writeInt(1);
3219 options.writeToParcel(data, 0);
3220 } else {
3221 data.writeInt(0);
3222 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003223 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003224 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3225 reply.readException();
3226 IIntentSender res = IIntentSender.Stub.asInterface(
3227 reply.readStrongBinder());
3228 data.recycle();
3229 reply.recycle();
3230 return res;
3231 }
3232 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3233 Parcel data = Parcel.obtain();
3234 Parcel reply = Parcel.obtain();
3235 data.writeInterfaceToken(IActivityManager.descriptor);
3236 data.writeStrongBinder(sender.asBinder());
3237 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3238 reply.readException();
3239 data.recycle();
3240 reply.recycle();
3241 }
3242 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 data.writeStrongBinder(sender.asBinder());
3247 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3248 reply.readException();
3249 String res = reply.readString();
3250 data.recycle();
3251 reply.recycle();
3252 return res;
3253 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003254 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3255 Parcel data = Parcel.obtain();
3256 Parcel reply = Parcel.obtain();
3257 data.writeInterfaceToken(IActivityManager.descriptor);
3258 data.writeStrongBinder(sender.asBinder());
3259 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 int res = reply.readInt();
3262 data.recycle();
3263 reply.recycle();
3264 return res;
3265 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003266 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3267 boolean requireFull, String name, String callerPackage) throws RemoteException {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 data.writeInt(callingPid);
3272 data.writeInt(callingUid);
3273 data.writeInt(userId);
3274 data.writeInt(allowAll ? 1 : 0);
3275 data.writeInt(requireFull ? 1 : 0);
3276 data.writeString(name);
3277 data.writeString(callerPackage);
3278 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3279 reply.readException();
3280 int res = reply.readInt();
3281 data.recycle();
3282 reply.recycle();
3283 return res;
3284 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003285 public void setProcessLimit(int max) throws RemoteException
3286 {
3287 Parcel data = Parcel.obtain();
3288 Parcel reply = Parcel.obtain();
3289 data.writeInterfaceToken(IActivityManager.descriptor);
3290 data.writeInt(max);
3291 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3292 reply.readException();
3293 data.recycle();
3294 reply.recycle();
3295 }
3296 public int getProcessLimit() throws RemoteException
3297 {
3298 Parcel data = Parcel.obtain();
3299 Parcel reply = Parcel.obtain();
3300 data.writeInterfaceToken(IActivityManager.descriptor);
3301 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3302 reply.readException();
3303 int res = reply.readInt();
3304 data.recycle();
3305 reply.recycle();
3306 return res;
3307 }
3308 public void setProcessForeground(IBinder token, int pid,
3309 boolean isForeground) throws RemoteException {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeStrongBinder(token);
3314 data.writeInt(pid);
3315 data.writeInt(isForeground ? 1 : 0);
3316 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 data.recycle();
3319 reply.recycle();
3320 }
3321 public int checkPermission(String permission, int pid, int uid)
3322 throws RemoteException {
3323 Parcel data = Parcel.obtain();
3324 Parcel reply = Parcel.obtain();
3325 data.writeInterfaceToken(IActivityManager.descriptor);
3326 data.writeString(permission);
3327 data.writeInt(pid);
3328 data.writeInt(uid);
3329 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 int res = reply.readInt();
3332 data.recycle();
3333 reply.recycle();
3334 return res;
3335 }
3336 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003337 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 data.writeString(packageName);
3342 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003343 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003344 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3345 reply.readException();
3346 boolean res = reply.readInt() != 0;
3347 data.recycle();
3348 reply.recycle();
3349 return res;
3350 }
3351 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3352 throws RemoteException {
3353 Parcel data = Parcel.obtain();
3354 Parcel reply = Parcel.obtain();
3355 data.writeInterfaceToken(IActivityManager.descriptor);
3356 uri.writeToParcel(data, 0);
3357 data.writeInt(pid);
3358 data.writeInt(uid);
3359 data.writeInt(mode);
3360 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3361 reply.readException();
3362 int res = reply.readInt();
3363 data.recycle();
3364 reply.recycle();
3365 return res;
3366 }
3367 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3368 Uri uri, int mode) throws RemoteException {
3369 Parcel data = Parcel.obtain();
3370 Parcel reply = Parcel.obtain();
3371 data.writeInterfaceToken(IActivityManager.descriptor);
3372 data.writeStrongBinder(caller.asBinder());
3373 data.writeString(targetPkg);
3374 uri.writeToParcel(data, 0);
3375 data.writeInt(mode);
3376 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3377 reply.readException();
3378 data.recycle();
3379 reply.recycle();
3380 }
3381 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3382 int mode) throws RemoteException {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
3386 data.writeStrongBinder(caller.asBinder());
3387 uri.writeToParcel(data, 0);
3388 data.writeInt(mode);
3389 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3390 reply.readException();
3391 data.recycle();
3392 reply.recycle();
3393 }
3394 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3395 throws RemoteException {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 data.writeStrongBinder(who.asBinder());
3400 data.writeInt(waiting ? 1 : 0);
3401 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3402 reply.readException();
3403 data.recycle();
3404 reply.recycle();
3405 }
3406 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3407 Parcel data = Parcel.obtain();
3408 Parcel reply = Parcel.obtain();
3409 data.writeInterfaceToken(IActivityManager.descriptor);
3410 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3411 reply.readException();
3412 outInfo.readFromParcel(reply);
3413 data.recycle();
3414 reply.recycle();
3415 }
3416 public void unhandledBack() throws RemoteException
3417 {
3418 Parcel data = Parcel.obtain();
3419 Parcel reply = Parcel.obtain();
3420 data.writeInterfaceToken(IActivityManager.descriptor);
3421 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3422 reply.readException();
3423 data.recycle();
3424 reply.recycle();
3425 }
3426 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3427 {
3428 Parcel data = Parcel.obtain();
3429 Parcel reply = Parcel.obtain();
3430 data.writeInterfaceToken(IActivityManager.descriptor);
3431 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3432 reply.readException();
3433 ParcelFileDescriptor pfd = null;
3434 if (reply.readInt() != 0) {
3435 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3436 }
3437 data.recycle();
3438 reply.recycle();
3439 return pfd;
3440 }
3441 public void goingToSleep() throws RemoteException
3442 {
3443 Parcel data = Parcel.obtain();
3444 Parcel reply = Parcel.obtain();
3445 data.writeInterfaceToken(IActivityManager.descriptor);
3446 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3447 reply.readException();
3448 data.recycle();
3449 reply.recycle();
3450 }
3451 public void wakingUp() throws RemoteException
3452 {
3453 Parcel data = Parcel.obtain();
3454 Parcel reply = Parcel.obtain();
3455 data.writeInterfaceToken(IActivityManager.descriptor);
3456 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3457 reply.readException();
3458 data.recycle();
3459 reply.recycle();
3460 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003461 public void setLockScreenShown(boolean shown) throws RemoteException
3462 {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 data.writeInt(shown ? 1 : 0);
3467 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 data.recycle();
3470 reply.recycle();
3471 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003472 public void setDebugApp(
3473 String packageName, boolean waitForDebugger, boolean persistent)
3474 throws RemoteException
3475 {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 data.writeString(packageName);
3480 data.writeInt(waitForDebugger ? 1 : 0);
3481 data.writeInt(persistent ? 1 : 0);
3482 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3483 reply.readException();
3484 data.recycle();
3485 reply.recycle();
3486 }
3487 public void setAlwaysFinish(boolean enabled) throws RemoteException
3488 {
3489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
3492 data.writeInt(enabled ? 1 : 0);
3493 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3494 reply.readException();
3495 data.recycle();
3496 reply.recycle();
3497 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003498 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 {
3500 Parcel data = Parcel.obtain();
3501 Parcel reply = Parcel.obtain();
3502 data.writeInterfaceToken(IActivityManager.descriptor);
3503 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003504 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003505 reply.readException();
3506 data.recycle();
3507 reply.recycle();
3508 }
3509 public void enterSafeMode() throws RemoteException {
3510 Parcel data = Parcel.obtain();
3511 data.writeInterfaceToken(IActivityManager.descriptor);
3512 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3513 data.recycle();
3514 }
3515 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3516 Parcel data = Parcel.obtain();
3517 data.writeStrongBinder(sender.asBinder());
3518 data.writeInterfaceToken(IActivityManager.descriptor);
3519 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3520 data.recycle();
3521 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003522 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003527 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003528 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003529 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003530 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003531 boolean res = reply.readInt() != 0;
3532 data.recycle();
3533 reply.recycle();
3534 return res;
3535 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003536 @Override
3537 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeString(reason);
3542 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3543 boolean res = reply.readInt() != 0;
3544 data.recycle();
3545 reply.recycle();
3546 return res;
3547 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003548 public void startRunning(String pkg, String cls, String action,
3549 String indata) throws RemoteException {
3550 Parcel data = Parcel.obtain();
3551 Parcel reply = Parcel.obtain();
3552 data.writeInterfaceToken(IActivityManager.descriptor);
3553 data.writeString(pkg);
3554 data.writeString(cls);
3555 data.writeString(action);
3556 data.writeString(indata);
3557 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 data.recycle();
3560 reply.recycle();
3561 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003562 public boolean testIsSystemReady()
3563 {
3564 /* this base class version is never called */
3565 return true;
3566 }
Dan Egnor60d87622009-12-16 16:32:58 -08003567 public void handleApplicationCrash(IBinder app,
3568 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3569 {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeStrongBinder(app);
3574 crashInfo.writeToParcel(data, 0);
3575 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3576 reply.readException();
3577 reply.recycle();
3578 data.recycle();
3579 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003580
Dan Egnor60d87622009-12-16 16:32:58 -08003581 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003582 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003583 {
3584 Parcel data = Parcel.obtain();
3585 Parcel reply = Parcel.obtain();
3586 data.writeInterfaceToken(IActivityManager.descriptor);
3587 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003588 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003589 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003590 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003591 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003592 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003593 reply.recycle();
3594 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003595 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003596 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003597
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003598 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003599 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003600 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003601 {
3602 Parcel data = Parcel.obtain();
3603 Parcel reply = Parcel.obtain();
3604 data.writeInterfaceToken(IActivityManager.descriptor);
3605 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003606 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003607 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003608 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3609 reply.readException();
3610 reply.recycle();
3611 data.recycle();
3612 }
3613
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003614 public void signalPersistentProcesses(int sig) throws RemoteException {
3615 Parcel data = Parcel.obtain();
3616 Parcel reply = Parcel.obtain();
3617 data.writeInterfaceToken(IActivityManager.descriptor);
3618 data.writeInt(sig);
3619 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3620 reply.readException();
3621 data.recycle();
3622 reply.recycle();
3623 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003624
Dianne Hackborn1676c852012-09-10 14:52:30 -07003625 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003626 Parcel data = Parcel.obtain();
3627 Parcel reply = Parcel.obtain();
3628 data.writeInterfaceToken(IActivityManager.descriptor);
3629 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003630 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003631 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3632 reply.readException();
3633 data.recycle();
3634 reply.recycle();
3635 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003636
3637 public void killAllBackgroundProcesses() throws RemoteException {
3638 Parcel data = Parcel.obtain();
3639 Parcel reply = Parcel.obtain();
3640 data.writeInterfaceToken(IActivityManager.descriptor);
3641 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3642 reply.readException();
3643 data.recycle();
3644 reply.recycle();
3645 }
3646
Dianne Hackborn1676c852012-09-10 14:52:30 -07003647 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003648 Parcel data = Parcel.obtain();
3649 Parcel reply = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003652 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003653 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003654 reply.readException();
3655 data.recycle();
3656 reply.recycle();
3657 }
3658
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003659 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3660 throws RemoteException
3661 {
3662 Parcel data = Parcel.obtain();
3663 Parcel reply = Parcel.obtain();
3664 data.writeInterfaceToken(IActivityManager.descriptor);
3665 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3666 reply.readException();
3667 outInfo.readFromParcel(reply);
3668 reply.recycle();
3669 data.recycle();
3670 }
3671
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003672 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3673 {
3674 Parcel data = Parcel.obtain();
3675 Parcel reply = Parcel.obtain();
3676 data.writeInterfaceToken(IActivityManager.descriptor);
3677 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3678 reply.readException();
3679 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3680 reply.recycle();
3681 data.recycle();
3682 return res;
3683 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003684
Dianne Hackborn1676c852012-09-10 14:52:30 -07003685 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003686 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003687 {
3688 Parcel data = Parcel.obtain();
3689 Parcel reply = Parcel.obtain();
3690 data.writeInterfaceToken(IActivityManager.descriptor);
3691 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003692 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003693 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003694 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003695 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003696 if (fd != null) {
3697 data.writeInt(1);
3698 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3699 } else {
3700 data.writeInt(0);
3701 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003702 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3703 reply.readException();
3704 boolean res = reply.readInt() != 0;
3705 reply.recycle();
3706 data.recycle();
3707 return res;
3708 }
3709
Dianne Hackborn55280a92009-05-07 15:53:46 -07003710 public boolean shutdown(int timeout) throws RemoteException
3711 {
3712 Parcel data = Parcel.obtain();
3713 Parcel reply = Parcel.obtain();
3714 data.writeInterfaceToken(IActivityManager.descriptor);
3715 data.writeInt(timeout);
3716 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3717 reply.readException();
3718 boolean res = reply.readInt() != 0;
3719 reply.recycle();
3720 data.recycle();
3721 return res;
3722 }
3723
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003724 public void stopAppSwitches() throws RemoteException {
3725 Parcel data = Parcel.obtain();
3726 Parcel reply = Parcel.obtain();
3727 data.writeInterfaceToken(IActivityManager.descriptor);
3728 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3729 reply.readException();
3730 reply.recycle();
3731 data.recycle();
3732 }
3733
3734 public void resumeAppSwitches() throws RemoteException {
3735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3739 reply.readException();
3740 reply.recycle();
3741 data.recycle();
3742 }
3743
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003744 public void killApplicationWithAppId(String pkg, int appid, String reason)
3745 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003746 Parcel data = Parcel.obtain();
3747 Parcel reply = Parcel.obtain();
3748 data.writeInterfaceToken(IActivityManager.descriptor);
3749 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003750 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003751 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003752 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003753 reply.readException();
3754 data.recycle();
3755 reply.recycle();
3756 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003757
3758 public void closeSystemDialogs(String reason) throws RemoteException {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeString(reason);
3763 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3764 reply.readException();
3765 data.recycle();
3766 reply.recycle();
3767 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003768
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003769 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003770 throws RemoteException {
3771 Parcel data = Parcel.obtain();
3772 Parcel reply = Parcel.obtain();
3773 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003774 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003775 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3776 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003777 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003778 data.recycle();
3779 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003780 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003781 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003782
3783 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3784 Parcel data = Parcel.obtain();
3785 Parcel reply = Parcel.obtain();
3786 data.writeInterfaceToken(IActivityManager.descriptor);
3787 data.writeString(processName);
3788 data.writeInt(uid);
3789 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3790 reply.readException();
3791 data.recycle();
3792 reply.recycle();
3793 }
3794
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003795 public void overridePendingTransition(IBinder token, String packageName,
3796 int enterAnim, int exitAnim) throws RemoteException {
3797 Parcel data = Parcel.obtain();
3798 Parcel reply = Parcel.obtain();
3799 data.writeInterfaceToken(IActivityManager.descriptor);
3800 data.writeStrongBinder(token);
3801 data.writeString(packageName);
3802 data.writeInt(enterAnim);
3803 data.writeInt(exitAnim);
3804 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3805 reply.readException();
3806 data.recycle();
3807 reply.recycle();
3808 }
3809
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003810 public boolean isUserAMonkey() throws RemoteException {
3811 Parcel data = Parcel.obtain();
3812 Parcel reply = Parcel.obtain();
3813 data.writeInterfaceToken(IActivityManager.descriptor);
3814 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3815 reply.readException();
3816 boolean res = reply.readInt() != 0;
3817 data.recycle();
3818 reply.recycle();
3819 return res;
3820 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003821
3822 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3823 Parcel data = Parcel.obtain();
3824 Parcel reply = Parcel.obtain();
3825 data.writeInterfaceToken(IActivityManager.descriptor);
3826 data.writeInt(monkey ? 1 : 0);
3827 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3828 reply.readException();
3829 data.recycle();
3830 reply.recycle();
3831 }
3832
Dianne Hackborn860755f2010-06-03 18:47:52 -07003833 public void finishHeavyWeightApp() throws RemoteException {
3834 Parcel data = Parcel.obtain();
3835 Parcel reply = Parcel.obtain();
3836 data.writeInterfaceToken(IActivityManager.descriptor);
3837 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3838 reply.readException();
3839 data.recycle();
3840 reply.recycle();
3841 }
Craig Mautner4addfc52013-06-25 08:05:45 -07003842
3843 public void convertToOpaque(IBinder token)
3844 throws RemoteException {
3845 Parcel data = Parcel.obtain();
3846 Parcel reply = Parcel.obtain();
3847 data.writeInterfaceToken(IActivityManager.descriptor);
3848 data.writeStrongBinder(token);
3849 mRemote.transact(CONVERT_TO_OPAQUE_TRANSACTION, data, reply, 0);
3850 reply.readException();
3851 data.recycle();
3852 reply.recycle();
3853 }
3854
Daniel Sandler69a48172010-06-23 16:29:36 -04003855 public void setImmersive(IBinder token, boolean immersive)
3856 throws RemoteException {
3857 Parcel data = Parcel.obtain();
3858 Parcel reply = Parcel.obtain();
3859 data.writeInterfaceToken(IActivityManager.descriptor);
3860 data.writeStrongBinder(token);
3861 data.writeInt(immersive ? 1 : 0);
3862 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3863 reply.readException();
3864 data.recycle();
3865 reply.recycle();
3866 }
3867
3868 public boolean isImmersive(IBinder token)
3869 throws RemoteException {
3870 Parcel data = Parcel.obtain();
3871 Parcel reply = Parcel.obtain();
3872 data.writeInterfaceToken(IActivityManager.descriptor);
3873 data.writeStrongBinder(token);
3874 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003875 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003876 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003877 data.recycle();
3878 reply.recycle();
3879 return res;
3880 }
3881
3882 public boolean isTopActivityImmersive()
3883 throws RemoteException {
3884 Parcel data = Parcel.obtain();
3885 Parcel reply = Parcel.obtain();
3886 data.writeInterfaceToken(IActivityManager.descriptor);
3887 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003888 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003889 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003890 data.recycle();
3891 reply.recycle();
3892 return res;
3893 }
3894
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003895 public void crashApplication(int uid, int initialPid, String packageName,
3896 String message) throws RemoteException {
3897 Parcel data = Parcel.obtain();
3898 Parcel reply = Parcel.obtain();
3899 data.writeInterfaceToken(IActivityManager.descriptor);
3900 data.writeInt(uid);
3901 data.writeInt(initialPid);
3902 data.writeString(packageName);
3903 data.writeString(message);
3904 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3905 reply.readException();
3906 data.recycle();
3907 reply.recycle();
3908 }
Andy McFadden824c5102010-07-09 16:26:57 -07003909
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003910 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003911 Parcel data = Parcel.obtain();
3912 Parcel reply = Parcel.obtain();
3913 data.writeInterfaceToken(IActivityManager.descriptor);
3914 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003915 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003916 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3917 reply.readException();
3918 String res = reply.readString();
3919 data.recycle();
3920 reply.recycle();
3921 return res;
3922 }
3923
Dianne Hackborn7e269642010-08-25 19:50:20 -07003924 public IBinder newUriPermissionOwner(String name)
3925 throws RemoteException {
3926 Parcel data = Parcel.obtain();
3927 Parcel reply = Parcel.obtain();
3928 data.writeInterfaceToken(IActivityManager.descriptor);
3929 data.writeString(name);
3930 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3931 reply.readException();
3932 IBinder res = reply.readStrongBinder();
3933 data.recycle();
3934 reply.recycle();
3935 return res;
3936 }
3937
3938 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3939 Uri uri, int mode) throws RemoteException {
3940 Parcel data = Parcel.obtain();
3941 Parcel reply = Parcel.obtain();
3942 data.writeInterfaceToken(IActivityManager.descriptor);
3943 data.writeStrongBinder(owner);
3944 data.writeInt(fromUid);
3945 data.writeString(targetPkg);
3946 uri.writeToParcel(data, 0);
3947 data.writeInt(mode);
3948 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3949 reply.readException();
3950 data.recycle();
3951 reply.recycle();
3952 }
3953
3954 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3955 int mode) throws RemoteException {
3956 Parcel data = Parcel.obtain();
3957 Parcel reply = Parcel.obtain();
3958 data.writeInterfaceToken(IActivityManager.descriptor);
3959 data.writeStrongBinder(owner);
3960 if (uri != null) {
3961 data.writeInt(1);
3962 uri.writeToParcel(data, 0);
3963 } else {
3964 data.writeInt(0);
3965 }
3966 data.writeInt(mode);
3967 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3968 reply.readException();
3969 data.recycle();
3970 reply.recycle();
3971 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003972
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003973 public int checkGrantUriPermission(int callingUid, String targetPkg,
3974 Uri uri, int modeFlags) throws RemoteException {
3975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 data.writeInt(callingUid);
3979 data.writeString(targetPkg);
3980 uri.writeToParcel(data, 0);
3981 data.writeInt(modeFlags);
3982 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3983 reply.readException();
3984 int res = reply.readInt();
3985 data.recycle();
3986 reply.recycle();
3987 return res;
3988 }
3989
Dianne Hackborn1676c852012-09-10 14:52:30 -07003990 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003991 String path, ParcelFileDescriptor fd) throws RemoteException {
3992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
3995 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003996 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003997 data.writeInt(managed ? 1 : 0);
3998 data.writeString(path);
3999 if (fd != null) {
4000 data.writeInt(1);
4001 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4002 } else {
4003 data.writeInt(0);
4004 }
4005 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4006 reply.readException();
4007 boolean res = reply.readInt() != 0;
4008 reply.recycle();
4009 data.recycle();
4010 return res;
4011 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004012
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004013 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004014 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004015 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004016 Parcel data = Parcel.obtain();
4017 Parcel reply = Parcel.obtain();
4018 data.writeInterfaceToken(IActivityManager.descriptor);
4019 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004020 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004021 data.writeTypedArray(intents, 0);
4022 data.writeStringArray(resolvedTypes);
4023 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004024 if (options != null) {
4025 data.writeInt(1);
4026 options.writeToParcel(data, 0);
4027 } else {
4028 data.writeInt(0);
4029 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004030 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004031 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4032 reply.readException();
4033 int result = reply.readInt();
4034 reply.recycle();
4035 data.recycle();
4036 return result;
4037 }
4038
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004039 public int getFrontActivityScreenCompatMode() throws RemoteException {
4040 Parcel data = Parcel.obtain();
4041 Parcel reply = Parcel.obtain();
4042 data.writeInterfaceToken(IActivityManager.descriptor);
4043 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4044 reply.readException();
4045 int mode = reply.readInt();
4046 reply.recycle();
4047 data.recycle();
4048 return mode;
4049 }
4050
4051 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4052 Parcel data = Parcel.obtain();
4053 Parcel reply = Parcel.obtain();
4054 data.writeInterfaceToken(IActivityManager.descriptor);
4055 data.writeInt(mode);
4056 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4057 reply.readException();
4058 reply.recycle();
4059 data.recycle();
4060 }
4061
4062 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4063 Parcel data = Parcel.obtain();
4064 Parcel reply = Parcel.obtain();
4065 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004066 data.writeString(packageName);
4067 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004068 reply.readException();
4069 int mode = reply.readInt();
4070 reply.recycle();
4071 data.recycle();
4072 return mode;
4073 }
4074
4075 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004076 throws RemoteException {
4077 Parcel data = Parcel.obtain();
4078 Parcel reply = Parcel.obtain();
4079 data.writeInterfaceToken(IActivityManager.descriptor);
4080 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004081 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004082 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4083 reply.readException();
4084 reply.recycle();
4085 data.recycle();
4086 }
4087
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004088 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4089 Parcel data = Parcel.obtain();
4090 Parcel reply = Parcel.obtain();
4091 data.writeInterfaceToken(IActivityManager.descriptor);
4092 data.writeString(packageName);
4093 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4094 reply.readException();
4095 boolean ask = reply.readInt() != 0;
4096 reply.recycle();
4097 data.recycle();
4098 return ask;
4099 }
4100
4101 public void setPackageAskScreenCompat(String packageName, boolean ask)
4102 throws RemoteException {
4103 Parcel data = Parcel.obtain();
4104 Parcel reply = Parcel.obtain();
4105 data.writeInterfaceToken(IActivityManager.descriptor);
4106 data.writeString(packageName);
4107 data.writeInt(ask ? 1 : 0);
4108 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4109 reply.readException();
4110 reply.recycle();
4111 data.recycle();
4112 }
4113
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004114 public boolean switchUser(int userid) throws RemoteException {
4115 Parcel data = Parcel.obtain();
4116 Parcel reply = Parcel.obtain();
4117 data.writeInterfaceToken(IActivityManager.descriptor);
4118 data.writeInt(userid);
4119 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4120 reply.readException();
4121 boolean result = reply.readInt() != 0;
4122 reply.recycle();
4123 data.recycle();
4124 return result;
4125 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004126
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004127 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4128 Parcel data = Parcel.obtain();
4129 Parcel reply = Parcel.obtain();
4130 data.writeInterfaceToken(IActivityManager.descriptor);
4131 data.writeInt(userid);
4132 data.writeStrongInterface(callback);
4133 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4134 reply.readException();
4135 int result = reply.readInt();
4136 reply.recycle();
4137 data.recycle();
4138 return result;
4139 }
4140
Amith Yamasani52f1d752012-03-28 18:19:29 -07004141 public UserInfo getCurrentUser() throws RemoteException {
4142 Parcel data = Parcel.obtain();
4143 Parcel reply = Parcel.obtain();
4144 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004145 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004146 reply.readException();
4147 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4148 reply.recycle();
4149 data.recycle();
4150 return userInfo;
4151 }
4152
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004153 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004154 Parcel data = Parcel.obtain();
4155 Parcel reply = Parcel.obtain();
4156 data.writeInterfaceToken(IActivityManager.descriptor);
4157 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004158 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004159 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4160 reply.readException();
4161 boolean result = reply.readInt() != 0;
4162 reply.recycle();
4163 data.recycle();
4164 return result;
4165 }
4166
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004167 public int[] getRunningUserIds() throws RemoteException {
4168 Parcel data = Parcel.obtain();
4169 Parcel reply = Parcel.obtain();
4170 data.writeInterfaceToken(IActivityManager.descriptor);
4171 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4172 reply.readException();
4173 int[] result = reply.createIntArray();
4174 reply.recycle();
4175 data.recycle();
4176 return result;
4177 }
4178
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004179 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4180 Parcel data = Parcel.obtain();
4181 Parcel reply = Parcel.obtain();
4182 data.writeInterfaceToken(IActivityManager.descriptor);
4183 data.writeInt(taskId);
4184 data.writeInt(subTaskIndex);
4185 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4186 reply.readException();
4187 boolean result = reply.readInt() != 0;
4188 reply.recycle();
4189 data.recycle();
4190 return result;
4191 }
4192
4193 public boolean removeTask(int taskId, int flags) throws RemoteException {
4194 Parcel data = Parcel.obtain();
4195 Parcel reply = Parcel.obtain();
4196 data.writeInterfaceToken(IActivityManager.descriptor);
4197 data.writeInt(taskId);
4198 data.writeInt(flags);
4199 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4200 reply.readException();
4201 boolean result = reply.readInt() != 0;
4202 reply.recycle();
4203 data.recycle();
4204 return result;
4205 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004206
Jeff Sharkeya4620792011-05-20 15:29:23 -07004207 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4208 Parcel data = Parcel.obtain();
4209 Parcel reply = Parcel.obtain();
4210 data.writeInterfaceToken(IActivityManager.descriptor);
4211 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4212 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4213 reply.readException();
4214 data.recycle();
4215 reply.recycle();
4216 }
4217
4218 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4219 Parcel data = Parcel.obtain();
4220 Parcel reply = Parcel.obtain();
4221 data.writeInterfaceToken(IActivityManager.descriptor);
4222 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4223 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4224 reply.readException();
4225 data.recycle();
4226 reply.recycle();
4227 }
4228
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004229 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4230 Parcel data = Parcel.obtain();
4231 Parcel reply = Parcel.obtain();
4232 data.writeInterfaceToken(IActivityManager.descriptor);
4233 data.writeStrongBinder(sender.asBinder());
4234 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4235 reply.readException();
4236 boolean res = reply.readInt() != 0;
4237 data.recycle();
4238 reply.recycle();
4239 return res;
4240 }
4241
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004242 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4243 Parcel data = Parcel.obtain();
4244 Parcel reply = Parcel.obtain();
4245 data.writeInterfaceToken(IActivityManager.descriptor);
4246 data.writeStrongBinder(sender.asBinder());
4247 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4248 reply.readException();
4249 boolean res = reply.readInt() != 0;
4250 data.recycle();
4251 reply.recycle();
4252 return res;
4253 }
4254
Dianne Hackborn81038902012-11-26 17:04:09 -08004255 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4256 Parcel data = Parcel.obtain();
4257 Parcel reply = Parcel.obtain();
4258 data.writeInterfaceToken(IActivityManager.descriptor);
4259 data.writeStrongBinder(sender.asBinder());
4260 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4261 reply.readException();
4262 Intent res = reply.readInt() != 0
4263 ? Intent.CREATOR.createFromParcel(reply) : null;
4264 data.recycle();
4265 reply.recycle();
4266 return res;
4267 }
4268
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004269 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4270 {
4271 Parcel data = Parcel.obtain();
4272 Parcel reply = Parcel.obtain();
4273 data.writeInterfaceToken(IActivityManager.descriptor);
4274 values.writeToParcel(data, 0);
4275 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4276 reply.readException();
4277 data.recycle();
4278 reply.recycle();
4279 }
4280
Dianne Hackbornb437e092011-08-05 17:50:29 -07004281 public long[] getProcessPss(int[] pids) throws RemoteException {
4282 Parcel data = Parcel.obtain();
4283 Parcel reply = Parcel.obtain();
4284 data.writeInterfaceToken(IActivityManager.descriptor);
4285 data.writeIntArray(pids);
4286 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4287 reply.readException();
4288 long[] res = reply.createLongArray();
4289 data.recycle();
4290 reply.recycle();
4291 return res;
4292 }
4293
Dianne Hackborn661cd522011-08-22 00:26:20 -07004294 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4295 Parcel data = Parcel.obtain();
4296 Parcel reply = Parcel.obtain();
4297 data.writeInterfaceToken(IActivityManager.descriptor);
4298 TextUtils.writeToParcel(msg, data, 0);
4299 data.writeInt(always ? 1 : 0);
4300 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4301 reply.readException();
4302 data.recycle();
4303 reply.recycle();
4304 }
4305
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004306 public void dismissKeyguardOnNextActivity() throws RemoteException {
4307 Parcel data = Parcel.obtain();
4308 Parcel reply = Parcel.obtain();
4309 data.writeInterfaceToken(IActivityManager.descriptor);
4310 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4311 reply.readException();
4312 data.recycle();
4313 reply.recycle();
4314 }
4315
Adam Powelldd8fab22012-03-22 17:47:27 -07004316 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4317 throws RemoteException {
4318 Parcel data = Parcel.obtain();
4319 Parcel reply = Parcel.obtain();
4320 data.writeInterfaceToken(IActivityManager.descriptor);
4321 data.writeStrongBinder(token);
4322 data.writeString(destAffinity);
4323 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4324 reply.readException();
4325 boolean result = reply.readInt() != 0;
4326 data.recycle();
4327 reply.recycle();
4328 return result;
4329 }
4330
4331 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4332 throws RemoteException {
4333 Parcel data = Parcel.obtain();
4334 Parcel reply = Parcel.obtain();
4335 data.writeInterfaceToken(IActivityManager.descriptor);
4336 data.writeStrongBinder(token);
4337 target.writeToParcel(data, 0);
4338 data.writeInt(resultCode);
4339 if (resultData != null) {
4340 data.writeInt(1);
4341 resultData.writeToParcel(data, 0);
4342 } else {
4343 data.writeInt(0);
4344 }
4345 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4346 reply.readException();
4347 boolean result = reply.readInt() != 0;
4348 data.recycle();
4349 reply.recycle();
4350 return result;
4351 }
4352
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004353 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4354 Parcel data = Parcel.obtain();
4355 Parcel reply = Parcel.obtain();
4356 data.writeInterfaceToken(IActivityManager.descriptor);
4357 data.writeStrongBinder(activityToken);
4358 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4359 reply.readException();
4360 int result = reply.readInt();
4361 data.recycle();
4362 reply.recycle();
4363 return result;
4364 }
4365
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004366 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4367 Parcel data = Parcel.obtain();
4368 Parcel reply = Parcel.obtain();
4369 data.writeInterfaceToken(IActivityManager.descriptor);
4370 data.writeStrongBinder(activityToken);
4371 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4372 reply.readException();
4373 String result = reply.readString();
4374 data.recycle();
4375 reply.recycle();
4376 return result;
4377 }
4378
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004379 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4380 Parcel data = Parcel.obtain();
4381 Parcel reply = Parcel.obtain();
4382 data.writeInterfaceToken(IActivityManager.descriptor);
4383 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4384 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4385 reply.readException();
4386 data.recycle();
4387 reply.recycle();
4388 }
4389
4390 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4391 Parcel data = Parcel.obtain();
4392 Parcel reply = Parcel.obtain();
4393 data.writeInterfaceToken(IActivityManager.descriptor);
4394 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4395 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4396 reply.readException();
4397 data.recycle();
4398 reply.recycle();
4399 }
4400
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004401 public void requestBugReport() throws RemoteException {
4402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4406 reply.readException();
4407 data.recycle();
4408 reply.recycle();
4409 }
4410
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004411 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4412 Parcel data = Parcel.obtain();
4413 Parcel reply = Parcel.obtain();
4414 data.writeInterfaceToken(IActivityManager.descriptor);
4415 data.writeInt(pid);
4416 data.writeInt(aboveSystem ? 1 : 0);
4417 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4418 reply.readException();
4419 long res = reply.readInt();
4420 data.recycle();
4421 reply.recycle();
4422 return res;
4423 }
4424
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004425 public Bundle getTopActivityExtras(int requestType) throws RemoteException {
4426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 data.writeInt(requestType);
4430 mRemote.transact(GET_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4431 reply.readException();
4432 Bundle res = reply.readBundle();
4433 data.recycle();
4434 reply.recycle();
4435 return res;
4436 }
4437
4438 public void reportTopActivityExtras(IBinder token, Bundle extras) throws RemoteException {
4439 Parcel data = Parcel.obtain();
4440 Parcel reply = Parcel.obtain();
4441 data.writeInterfaceToken(IActivityManager.descriptor);
4442 data.writeStrongBinder(token);
4443 data.writeBundle(extras);
4444 mRemote.transact(REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION, data, reply, 0);
4445 reply.readException();
4446 data.recycle();
4447 reply.recycle();
4448 }
4449
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004450 public void killUid(int uid, String reason) throws RemoteException {
4451 Parcel data = Parcel.obtain();
4452 Parcel reply = Parcel.obtain();
4453 data.writeInterfaceToken(IActivityManager.descriptor);
4454 data.writeInt(uid);
4455 data.writeString(reason);
4456 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4457 reply.readException();
4458 data.recycle();
4459 reply.recycle();
4460 }
4461
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004462 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4463 Parcel data = Parcel.obtain();
4464 Parcel reply = Parcel.obtain();
4465 data.writeInterfaceToken(IActivityManager.descriptor);
4466 data.writeStrongBinder(who);
4467 data.writeInt(allowRestart ? 1 : 0);
4468 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4469 reply.readException();
4470 data.recycle();
4471 reply.recycle();
4472 }
4473
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004474 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4475 Parcel data = Parcel.obtain();
4476 Parcel reply = Parcel.obtain();
4477 data.writeInterfaceToken(IActivityManager.descriptor);
4478 data.writeStrongBinder(token);
4479 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4480 reply.readException();
4481 data.recycle();
4482 reply.recycle();
4483 }
4484
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004485 private IBinder mRemote;
4486}