blob: b11c5091854a5fd6b89480fb9e3837f610555ac4 [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 Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
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;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070033import android.graphics.Bitmap;
34import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080035import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.net.Uri;
37import android.os.Binder;
38import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070039import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.IBinder;
41import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070042import android.os.ParcelFileDescriptor;
43import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070044import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070045import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070047import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070048import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080051import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070052import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080053import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055import java.util.ArrayList;
56import java.util.List;
57
58/** {@hide} */
59public abstract class ActivityManagerNative extends Binder implements IActivityManager
60{
61 /**
62 * Cast a Binder object into an activity manager interface, generating
63 * a proxy if needed.
64 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 if (obj == null) {
67 return null;
68 }
69 IActivityManager in =
70 (IActivityManager)obj.queryLocalInterface(descriptor);
71 if (in != null) {
72 return in;
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 return new ActivityManagerProxy(obj);
76 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 /**
79 * Retrieve the system's default/global activity manager.
80 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080081 static public IActivityManager getDefault() {
82 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 }
84
85 /**
86 * Convenience for checking whether the system is ready. For internal use only.
87 */
88 static public boolean isSystemReady() {
89 if (!sSystemReady) {
90 sSystemReady = getDefault().testIsSystemReady();
91 }
92 return sSystemReady;
93 }
94 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080095
Svet Ganov16a16892015-04-16 10:32:04 -070096 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
97 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
98 }
99
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 /**
101 * Convenience for sending a sticky broadcast. For internal use only.
102 * If you don't care about permission, use null.
103 */
Svet Ganov16a16892015-04-16 10:32:04 -0700104 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
105 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 try {
107 getDefault().broadcastIntent(
108 null, intent, null, null, Activity.RESULT_OK, null, null,
Svet Ganov16a16892015-04-16 10:32:04 -0700109 null /*permission*/, appOp, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 } catch (RemoteException ex) {
111 }
112 }
113
Dianne Hackborn1e383822015-04-10 14:02:33 -0700114 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
115 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 try {
Dianne Hackborn1e383822015-04-10 14:02:33 -0700117 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg, tag);
118 } catch (RemoteException ex) {
119 }
120 }
121
122 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
123 try {
124 getDefault().noteAlarmStart(ps.getTarget(), sourceUid, tag);
125 } catch (RemoteException ex) {
126 }
127 }
128
129 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
130 try {
131 getDefault().noteAlarmFinish(ps.getTarget(), sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 } catch (RemoteException ex) {
133 }
134 }
135
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800136 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137 attachInterface(this, descriptor);
138 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700139
140 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800141 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
142 throws RemoteException {
143 switch (code) {
144 case START_ACTIVITY_TRANSACTION:
145 {
146 data.enforceInterface(IActivityManager.descriptor);
147 IBinder b = data.readStrongBinder();
148 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800149 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800150 Intent intent = Intent.CREATOR.createFromParcel(data);
151 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800153 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700155 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700156 ProfilerInfo profilerInfo = data.readInt() != 0
157 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700158 Bundle options = data.readInt() != 0
159 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800160 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700161 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800162 reply.writeNoException();
163 reply.writeInt(result);
164 return true;
165 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700166
Amith Yamasani82644082012-08-03 13:09:11 -0700167 case START_ACTIVITY_AS_USER_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();
Amith Yamasani82644082012-08-03 13:09:11 -0700173 Intent intent = Intent.CREATOR.createFromParcel(data);
174 String resolvedType = data.readString();
175 IBinder resultTo = data.readStrongBinder();
176 String resultWho = data.readString();
177 int requestCode = data.readInt();
178 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700179 ProfilerInfo profilerInfo = data.readInt() != 0
180 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700181 Bundle options = data.readInt() != 0
182 ? Bundle.CREATOR.createFromParcel(data) : null;
183 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800184 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700185 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700186 reply.writeNoException();
187 reply.writeInt(result);
188 return true;
189 }
190
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700191 case START_ACTIVITY_AS_CALLER_TRANSACTION:
192 {
193 data.enforceInterface(IActivityManager.descriptor);
194 IBinder b = data.readStrongBinder();
195 IApplicationThread app = ApplicationThreadNative.asInterface(b);
196 String callingPackage = data.readString();
197 Intent intent = Intent.CREATOR.createFromParcel(data);
198 String resolvedType = data.readString();
199 IBinder resultTo = data.readStrongBinder();
200 String resultWho = data.readString();
201 int requestCode = data.readInt();
202 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700203 ProfilerInfo profilerInfo = data.readInt() != 0
204 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700205 Bundle options = data.readInt() != 0
206 ? Bundle.CREATOR.createFromParcel(data) : null;
Jeff Sharkey97978802014-10-14 10:48:18 -0700207 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700208 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Sharkey97978802014-10-14 10:48:18 -0700209 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700210 reply.writeNoException();
211 reply.writeInt(result);
212 return true;
213 }
214
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800215 case START_ACTIVITY_AND_WAIT_TRANSACTION:
216 {
217 data.enforceInterface(IActivityManager.descriptor);
218 IBinder b = data.readStrongBinder();
219 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800220 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800221 Intent intent = Intent.CREATOR.createFromParcel(data);
222 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800223 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800224 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800225 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700226 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700227 ProfilerInfo profilerInfo = data.readInt() != 0
228 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700229 Bundle options = data.readInt() != 0
230 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700231 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800232 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700233 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800234 reply.writeNoException();
235 result.writeToParcel(reply, 0);
236 return true;
237 }
238
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700239 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
240 {
241 data.enforceInterface(IActivityManager.descriptor);
242 IBinder b = data.readStrongBinder();
243 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800244 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700245 Intent intent = Intent.CREATOR.createFromParcel(data);
246 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700247 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700248 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700249 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700250 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700251 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700252 Bundle options = data.readInt() != 0
253 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700254 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800255 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700256 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700257 reply.writeNoException();
258 reply.writeInt(result);
259 return true;
260 }
261
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700262 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700263 {
264 data.enforceInterface(IActivityManager.descriptor);
265 IBinder b = data.readStrongBinder();
266 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700267 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700268 Intent fillInIntent = null;
269 if (data.readInt() != 0) {
270 fillInIntent = Intent.CREATOR.createFromParcel(data);
271 }
272 String resolvedType = data.readString();
273 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700274 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700275 int requestCode = data.readInt();
276 int flagsMask = data.readInt();
277 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700278 Bundle options = data.readInt() != 0
279 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700280 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700281 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700282 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700283 reply.writeNoException();
284 reply.writeInt(result);
285 return true;
286 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700287
Dianne Hackborn91097de2014-04-04 18:02:06 -0700288 case START_VOICE_ACTIVITY_TRANSACTION:
289 {
290 data.enforceInterface(IActivityManager.descriptor);
291 String callingPackage = data.readString();
292 int callingPid = data.readInt();
293 int callingUid = data.readInt();
294 Intent intent = Intent.CREATOR.createFromParcel(data);
295 String resolvedType = data.readString();
296 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
297 data.readStrongBinder());
298 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
299 data.readStrongBinder());
300 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700301 ProfilerInfo profilerInfo = data.readInt() != 0
302 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700303 Bundle options = data.readInt() != 0
304 ? Bundle.CREATOR.createFromParcel(data) : null;
305 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700306 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
307 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700308 reply.writeNoException();
309 reply.writeInt(result);
310 return true;
311 }
312
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800313 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
314 {
315 data.enforceInterface(IActivityManager.descriptor);
316 IBinder callingActivity = data.readStrongBinder();
317 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700318 Bundle options = data.readInt() != 0
319 ? Bundle.CREATOR.createFromParcel(data) : null;
320 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800321 reply.writeNoException();
322 reply.writeInt(result ? 1 : 0);
323 return true;
324 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700325
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700326 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
327 {
328 data.enforceInterface(IActivityManager.descriptor);
329 int taskId = data.readInt();
330 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
331 int result = startActivityFromRecents(taskId, options);
332 reply.writeNoException();
333 reply.writeInt(result);
334 return true;
335 }
336
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800337 case FINISH_ACTIVITY_TRANSACTION: {
338 data.enforceInterface(IActivityManager.descriptor);
339 IBinder token = data.readStrongBinder();
340 Intent resultData = null;
341 int resultCode = data.readInt();
342 if (data.readInt() != 0) {
343 resultData = Intent.CREATOR.createFromParcel(data);
344 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700345 boolean finishTask = (data.readInt() != 0);
346 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 reply.writeNoException();
348 reply.writeInt(res ? 1 : 0);
349 return true;
350 }
351
352 case FINISH_SUB_ACTIVITY_TRANSACTION: {
353 data.enforceInterface(IActivityManager.descriptor);
354 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700355 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800356 int requestCode = data.readInt();
357 finishSubActivity(token, resultWho, requestCode);
358 reply.writeNoException();
359 return true;
360 }
361
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700362 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
363 data.enforceInterface(IActivityManager.descriptor);
364 IBinder token = data.readStrongBinder();
365 boolean res = finishActivityAffinity(token);
366 reply.writeNoException();
367 reply.writeInt(res ? 1 : 0);
368 return true;
369 }
370
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700371 case FINISH_VOICE_TASK_TRANSACTION: {
372 data.enforceInterface(IActivityManager.descriptor);
373 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
374 data.readStrongBinder());
375 finishVoiceTask(session);
376 reply.writeNoException();
377 return true;
378 }
379
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700380 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
381 data.enforceInterface(IActivityManager.descriptor);
382 IBinder token = data.readStrongBinder();
383 boolean res = releaseActivityInstance(token);
384 reply.writeNoException();
385 reply.writeInt(res ? 1 : 0);
386 return true;
387 }
388
389 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
390 data.enforceInterface(IActivityManager.descriptor);
391 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
392 releaseSomeActivities(app);
393 reply.writeNoException();
394 return true;
395 }
396
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800397 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
398 data.enforceInterface(IActivityManager.descriptor);
399 IBinder token = data.readStrongBinder();
400 boolean res = willActivityBeVisible(token);
401 reply.writeNoException();
402 reply.writeInt(res ? 1 : 0);
403 return true;
404 }
405
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 case REGISTER_RECEIVER_TRANSACTION:
407 {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder b = data.readStrongBinder();
410 IApplicationThread app =
411 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700412 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800413 b = data.readStrongBinder();
414 IIntentReceiver rec
415 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
416 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
417 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700418 int userId = data.readInt();
419 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 reply.writeNoException();
421 if (intent != null) {
422 reply.writeInt(1);
423 intent.writeToParcel(reply, 0);
424 } else {
425 reply.writeInt(0);
426 }
427 return true;
428 }
429
430 case UNREGISTER_RECEIVER_TRANSACTION:
431 {
432 data.enforceInterface(IActivityManager.descriptor);
433 IBinder b = data.readStrongBinder();
434 if (b == null) {
435 return true;
436 }
437 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
438 unregisterReceiver(rec);
439 reply.writeNoException();
440 return true;
441 }
442
443 case BROADCAST_INTENT_TRANSACTION:
444 {
445 data.enforceInterface(IActivityManager.descriptor);
446 IBinder b = data.readStrongBinder();
447 IApplicationThread app =
448 b != null ? ApplicationThreadNative.asInterface(b) : null;
449 Intent intent = Intent.CREATOR.createFromParcel(data);
450 String resolvedType = data.readString();
451 b = data.readStrongBinder();
452 IIntentReceiver resultTo =
453 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
454 int resultCode = data.readInt();
455 String resultData = data.readString();
456 Bundle resultExtras = data.readBundle();
457 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800458 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 boolean serialized = data.readInt() != 0;
460 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700461 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800462 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800463 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700464 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800465 reply.writeNoException();
466 reply.writeInt(res);
467 return true;
468 }
469
470 case UNBROADCAST_INTENT_TRANSACTION:
471 {
472 data.enforceInterface(IActivityManager.descriptor);
473 IBinder b = data.readStrongBinder();
474 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
475 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700476 int userId = data.readInt();
477 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 reply.writeNoException();
479 return true;
480 }
481
482 case FINISH_RECEIVER_TRANSACTION: {
483 data.enforceInterface(IActivityManager.descriptor);
484 IBinder who = data.readStrongBinder();
485 int resultCode = data.readInt();
486 String resultData = data.readString();
487 Bundle resultExtras = data.readBundle();
488 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800489 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800490 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800491 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492 }
493 reply.writeNoException();
494 return true;
495 }
496
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 case ATTACH_APPLICATION_TRANSACTION: {
498 data.enforceInterface(IActivityManager.descriptor);
499 IApplicationThread app = ApplicationThreadNative.asInterface(
500 data.readStrongBinder());
501 if (app != null) {
502 attachApplication(app);
503 }
504 reply.writeNoException();
505 return true;
506 }
507
508 case ACTIVITY_IDLE_TRANSACTION: {
509 data.enforceInterface(IActivityManager.descriptor);
510 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700511 Configuration config = null;
512 if (data.readInt() != 0) {
513 config = Configuration.CREATOR.createFromParcel(data);
514 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700515 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800516 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700517 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800518 }
519 reply.writeNoException();
520 return true;
521 }
522
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700523 case ACTIVITY_RESUMED_TRANSACTION: {
524 data.enforceInterface(IActivityManager.descriptor);
525 IBinder token = data.readStrongBinder();
526 activityResumed(token);
527 reply.writeNoException();
528 return true;
529 }
530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800531 case ACTIVITY_PAUSED_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700534 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800535 reply.writeNoException();
536 return true;
537 }
538
539 case ACTIVITY_STOPPED_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800542 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700543 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800544 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700545 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 reply.writeNoException();
547 return true;
548 }
549
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800550 case ACTIVITY_SLEPT_TRANSACTION: {
551 data.enforceInterface(IActivityManager.descriptor);
552 IBinder token = data.readStrongBinder();
553 activitySlept(token);
554 reply.writeNoException();
555 return true;
556 }
557
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800558 case ACTIVITY_DESTROYED_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activityDestroyed(token);
562 reply.writeNoException();
563 return true;
564 }
565
566 case GET_CALLING_PACKAGE_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
569 String res = token != null ? getCallingPackage(token) : null;
570 reply.writeNoException();
571 reply.writeString(res);
572 return true;
573 }
574
575 case GET_CALLING_ACTIVITY_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 IBinder token = data.readStrongBinder();
578 ComponentName cn = getCallingActivity(token);
579 reply.writeNoException();
580 ComponentName.writeToParcel(cn, reply);
581 return true;
582 }
583
Winson Chung1147c402014-05-14 11:05:00 -0700584 case GET_APP_TASKS_TRANSACTION: {
585 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700586 String callingPackage = data.readString();
587 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700588 reply.writeNoException();
589 int N = list != null ? list.size() : -1;
590 reply.writeInt(N);
591 int i;
592 for (i=0; i<N; i++) {
593 IAppTask task = list.get(i);
594 reply.writeStrongBinder(task.asBinder());
595 }
596 return true;
597 }
598
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700599 case ADD_APP_TASK_TRANSACTION: {
600 data.enforceInterface(IActivityManager.descriptor);
601 IBinder activityToken = data.readStrongBinder();
602 Intent intent = Intent.CREATOR.createFromParcel(data);
603 ActivityManager.TaskDescription descr
604 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
605 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
606 int res = addAppTask(activityToken, intent, descr, thumbnail);
607 reply.writeNoException();
608 reply.writeInt(res);
609 return true;
610 }
611
612 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
614 Point size = getAppTaskThumbnailSize();
615 reply.writeNoException();
616 size.writeToParcel(reply, 0);
617 return true;
618 }
619
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 case GET_TASKS_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 int maxNum = data.readInt();
623 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700624 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 reply.writeNoException();
626 int N = list != null ? list.size() : -1;
627 reply.writeInt(N);
628 int i;
629 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700630 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800631 info.writeToParcel(reply, 0);
632 }
633 return true;
634 }
635
636 case GET_RECENT_TASKS_TRANSACTION: {
637 data.enforceInterface(IActivityManager.descriptor);
638 int maxNum = data.readInt();
639 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700640 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700642 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 reply.writeNoException();
644 reply.writeTypedList(list);
645 return true;
646 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700647
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700648 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800649 data.enforceInterface(IActivityManager.descriptor);
650 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700651 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800652 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700653 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800654 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700655 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700656 } else {
657 reply.writeInt(0);
658 }
659 return true;
660 }
661
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800662 case GET_SERVICES_TRANSACTION: {
663 data.enforceInterface(IActivityManager.descriptor);
664 int maxNum = data.readInt();
665 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700666 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667 reply.writeNoException();
668 int N = list != null ? list.size() : -1;
669 reply.writeInt(N);
670 int i;
671 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700672 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 info.writeToParcel(reply, 0);
674 }
675 return true;
676 }
677
678 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
679 data.enforceInterface(IActivityManager.descriptor);
680 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
681 reply.writeNoException();
682 reply.writeTypedList(list);
683 return true;
684 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700685
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800686 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
689 reply.writeNoException();
690 reply.writeTypedList(list);
691 return true;
692 }
693
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700694 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 List<ApplicationInfo> list = getRunningExternalApplications();
697 reply.writeNoException();
698 reply.writeTypedList(list);
699 return true;
700 }
701
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800702 case MOVE_TASK_TO_FRONT_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800705 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700706 Bundle options = data.readInt() != 0
707 ? Bundle.CREATOR.createFromParcel(data) : null;
708 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 reply.writeNoException();
710 return true;
711 }
712
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800713 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
714 data.enforceInterface(IActivityManager.descriptor);
715 IBinder token = data.readStrongBinder();
716 boolean nonRoot = data.readInt() != 0;
717 boolean res = moveActivityTaskToBack(token, nonRoot);
718 reply.writeNoException();
719 reply.writeInt(res ? 1 : 0);
720 return true;
721 }
722
723 case MOVE_TASK_BACKWARDS_TRANSACTION: {
724 data.enforceInterface(IActivityManager.descriptor);
725 int task = data.readInt();
726 moveTaskBackwards(task);
727 reply.writeNoException();
728 return true;
729 }
730
Craig Mautnerc00204b2013-03-05 15:02:14 -0800731 case MOVE_TASK_TO_STACK_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 int taskId = data.readInt();
734 int stackId = data.readInt();
735 boolean toTop = data.readInt() != 0;
736 moveTaskToStack(taskId, stackId, toTop);
737 reply.writeNoException();
738 return true;
739 }
740
741 case RESIZE_STACK_TRANSACTION: {
742 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800743 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800744 Rect r = Rect.CREATOR.createFromParcel(data);
745 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800746 reply.writeNoException();
747 return true;
748 }
749
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800750 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700751 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800752 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700753 reply.writeNoException();
754 reply.writeTypedList(list);
755 return true;
756 }
757
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800758 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700759 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800760 int stackId = data.readInt();
761 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700762 reply.writeNoException();
763 if (info != null) {
764 reply.writeInt(1);
765 info.writeToParcel(reply, 0);
766 } else {
767 reply.writeInt(0);
768 }
769 return true;
770 }
771
Winson Chung303e1ff2014-03-07 15:06:19 -0800772 case IS_IN_HOME_STACK_TRANSACTION: {
773 data.enforceInterface(IActivityManager.descriptor);
774 int taskId = data.readInt();
775 boolean isInHomeStack = isInHomeStack(taskId);
776 reply.writeNoException();
777 reply.writeInt(isInHomeStack ? 1 : 0);
778 return true;
779 }
780
Craig Mautnercf910b02013-04-23 11:23:27 -0700781 case SET_FOCUSED_STACK_TRANSACTION: {
782 data.enforceInterface(IActivityManager.descriptor);
783 int stackId = data.readInt();
784 setFocusedStack(stackId);
785 reply.writeNoException();
786 return true;
787 }
788
Winson Chungd16c5652015-01-26 16:11:07 -0800789 case GET_FOCUSED_STACK_ID_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 int focusedStackId = getFocusedStackId();
792 reply.writeNoException();
793 reply.writeInt(focusedStackId);
794 return true;
795 }
796
Winson Chung740c3ac2014-11-12 16:14:38 -0800797 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
798 data.enforceInterface(IActivityManager.descriptor);
799 IBinder token = data.readStrongBinder();
800 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
801 reply.writeNoException();
802 return true;
803 }
804
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800805 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
806 data.enforceInterface(IActivityManager.descriptor);
807 IBinder token = data.readStrongBinder();
808 boolean onlyRoot = data.readInt() != 0;
809 int res = token != null
810 ? getTaskForActivity(token, onlyRoot) : -1;
811 reply.writeNoException();
812 reply.writeInt(res);
813 return true;
814 }
815
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 case GET_CONTENT_PROVIDER_TRANSACTION: {
817 data.enforceInterface(IActivityManager.descriptor);
818 IBinder b = data.readStrongBinder();
819 IApplicationThread app = ApplicationThreadNative.asInterface(b);
820 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700821 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700822 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700823 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800824 reply.writeNoException();
825 if (cph != null) {
826 reply.writeInt(1);
827 cph.writeToParcel(reply, 0);
828 } else {
829 reply.writeInt(0);
830 }
831 return true;
832 }
833
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800834 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
835 data.enforceInterface(IActivityManager.descriptor);
836 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700837 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800838 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700839 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800840 reply.writeNoException();
841 if (cph != null) {
842 reply.writeInt(1);
843 cph.writeToParcel(reply, 0);
844 } else {
845 reply.writeInt(0);
846 }
847 return true;
848 }
849
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800850 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
851 data.enforceInterface(IActivityManager.descriptor);
852 IBinder b = data.readStrongBinder();
853 IApplicationThread app = ApplicationThreadNative.asInterface(b);
854 ArrayList<ContentProviderHolder> providers =
855 data.createTypedArrayList(ContentProviderHolder.CREATOR);
856 publishContentProviders(app, providers);
857 reply.writeNoException();
858 return true;
859 }
860
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700861 case REF_CONTENT_PROVIDER_TRANSACTION: {
862 data.enforceInterface(IActivityManager.descriptor);
863 IBinder b = data.readStrongBinder();
864 int stable = data.readInt();
865 int unstable = data.readInt();
866 boolean res = refContentProvider(b, stable, unstable);
867 reply.writeNoException();
868 reply.writeInt(res ? 1 : 0);
869 return true;
870 }
871
872 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
873 data.enforceInterface(IActivityManager.descriptor);
874 IBinder b = data.readStrongBinder();
875 unstableProviderDied(b);
876 reply.writeNoException();
877 return true;
878 }
879
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700880 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
881 data.enforceInterface(IActivityManager.descriptor);
882 IBinder b = data.readStrongBinder();
883 appNotRespondingViaProvider(b);
884 reply.writeNoException();
885 return true;
886 }
887
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800888 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
889 data.enforceInterface(IActivityManager.descriptor);
890 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700891 boolean stable = data.readInt() != 0;
892 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800893 reply.writeNoException();
894 return true;
895 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800896
897 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
898 data.enforceInterface(IActivityManager.descriptor);
899 String name = data.readString();
900 IBinder token = data.readStrongBinder();
901 removeContentProviderExternal(name, token);
902 reply.writeNoException();
903 return true;
904 }
905
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700906 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
907 data.enforceInterface(IActivityManager.descriptor);
908 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
909 PendingIntent pi = getRunningServiceControlPanel(comp);
910 reply.writeNoException();
911 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
912 return true;
913 }
914
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800915 case START_SERVICE_TRANSACTION: {
916 data.enforceInterface(IActivityManager.descriptor);
917 IBinder b = data.readStrongBinder();
918 IApplicationThread app = ApplicationThreadNative.asInterface(b);
919 Intent service = Intent.CREATOR.createFromParcel(data);
920 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700921 int userId = data.readInt();
922 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800923 reply.writeNoException();
924 ComponentName.writeToParcel(cn, reply);
925 return true;
926 }
927
928 case STOP_SERVICE_TRANSACTION: {
929 data.enforceInterface(IActivityManager.descriptor);
930 IBinder b = data.readStrongBinder();
931 IApplicationThread app = ApplicationThreadNative.asInterface(b);
932 Intent service = Intent.CREATOR.createFromParcel(data);
933 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700934 int userId = data.readInt();
935 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 reply.writeNoException();
937 reply.writeInt(res);
938 return true;
939 }
940
941 case STOP_SERVICE_TOKEN_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 ComponentName className = ComponentName.readFromParcel(data);
944 IBinder token = data.readStrongBinder();
945 int startId = data.readInt();
946 boolean res = stopServiceToken(className, token, startId);
947 reply.writeNoException();
948 reply.writeInt(res ? 1 : 0);
949 return true;
950 }
951
952 case SET_SERVICE_FOREGROUND_TRANSACTION: {
953 data.enforceInterface(IActivityManager.descriptor);
954 ComponentName className = ComponentName.readFromParcel(data);
955 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700956 int id = data.readInt();
957 Notification notification = null;
958 if (data.readInt() != 0) {
959 notification = Notification.CREATOR.createFromParcel(data);
960 }
961 boolean removeNotification = data.readInt() != 0;
962 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800963 reply.writeNoException();
964 return true;
965 }
966
967 case BIND_SERVICE_TRANSACTION: {
968 data.enforceInterface(IActivityManager.descriptor);
969 IBinder b = data.readStrongBinder();
970 IApplicationThread app = ApplicationThreadNative.asInterface(b);
971 IBinder token = data.readStrongBinder();
972 Intent service = Intent.CREATOR.createFromParcel(data);
973 String resolvedType = data.readString();
974 b = data.readStrongBinder();
975 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800976 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800978 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800979 reply.writeNoException();
980 reply.writeInt(res);
981 return true;
982 }
983
984 case UNBIND_SERVICE_TRANSACTION: {
985 data.enforceInterface(IActivityManager.descriptor);
986 IBinder b = data.readStrongBinder();
987 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
988 boolean res = unbindService(conn);
989 reply.writeNoException();
990 reply.writeInt(res ? 1 : 0);
991 return true;
992 }
993
994 case PUBLISH_SERVICE_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 IBinder token = data.readStrongBinder();
997 Intent intent = Intent.CREATOR.createFromParcel(data);
998 IBinder service = data.readStrongBinder();
999 publishService(token, intent, service);
1000 reply.writeNoException();
1001 return true;
1002 }
1003
1004 case UNBIND_FINISHED_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IBinder token = data.readStrongBinder();
1007 Intent intent = Intent.CREATOR.createFromParcel(data);
1008 boolean doRebind = data.readInt() != 0;
1009 unbindFinished(token, intent, doRebind);
1010 reply.writeNoException();
1011 return true;
1012 }
1013
1014 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1015 data.enforceInterface(IActivityManager.descriptor);
1016 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001017 int type = data.readInt();
1018 int startId = data.readInt();
1019 int res = data.readInt();
1020 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001021 reply.writeNoException();
1022 return true;
1023 }
1024
1025 case START_INSTRUMENTATION_TRANSACTION: {
1026 data.enforceInterface(IActivityManager.descriptor);
1027 ComponentName className = ComponentName.readFromParcel(data);
1028 String profileFile = data.readString();
1029 int fl = data.readInt();
1030 Bundle arguments = data.readBundle();
1031 IBinder b = data.readStrongBinder();
1032 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001033 b = data.readStrongBinder();
1034 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001035 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001036 String abiOverride = data.readString();
1037 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1038 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001039 reply.writeNoException();
1040 reply.writeInt(res ? 1 : 0);
1041 return true;
1042 }
1043
1044
1045 case FINISH_INSTRUMENTATION_TRANSACTION: {
1046 data.enforceInterface(IActivityManager.descriptor);
1047 IBinder b = data.readStrongBinder();
1048 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1049 int resultCode = data.readInt();
1050 Bundle results = data.readBundle();
1051 finishInstrumentation(app, resultCode, results);
1052 reply.writeNoException();
1053 return true;
1054 }
1055
1056 case GET_CONFIGURATION_TRANSACTION: {
1057 data.enforceInterface(IActivityManager.descriptor);
1058 Configuration config = getConfiguration();
1059 reply.writeNoException();
1060 config.writeToParcel(reply, 0);
1061 return true;
1062 }
1063
1064 case UPDATE_CONFIGURATION_TRANSACTION: {
1065 data.enforceInterface(IActivityManager.descriptor);
1066 Configuration config = Configuration.CREATOR.createFromParcel(data);
1067 updateConfiguration(config);
1068 reply.writeNoException();
1069 return true;
1070 }
1071
1072 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1073 data.enforceInterface(IActivityManager.descriptor);
1074 IBinder token = data.readStrongBinder();
1075 int requestedOrientation = data.readInt();
1076 setRequestedOrientation(token, requestedOrientation);
1077 reply.writeNoException();
1078 return true;
1079 }
1080
1081 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1082 data.enforceInterface(IActivityManager.descriptor);
1083 IBinder token = data.readStrongBinder();
1084 int req = getRequestedOrientation(token);
1085 reply.writeNoException();
1086 reply.writeInt(req);
1087 return true;
1088 }
1089
1090 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 IBinder token = data.readStrongBinder();
1093 ComponentName cn = getActivityClassForToken(token);
1094 reply.writeNoException();
1095 ComponentName.writeToParcel(cn, reply);
1096 return true;
1097 }
1098
1099 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1100 data.enforceInterface(IActivityManager.descriptor);
1101 IBinder token = data.readStrongBinder();
1102 reply.writeNoException();
1103 reply.writeString(getPackageForToken(token));
1104 return true;
1105 }
1106
1107 case GET_INTENT_SENDER_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 int type = data.readInt();
1110 String packageName = data.readString();
1111 IBinder token = data.readStrongBinder();
1112 String resultWho = data.readString();
1113 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001114 Intent[] requestIntents;
1115 String[] requestResolvedTypes;
1116 if (data.readInt() != 0) {
1117 requestIntents = data.createTypedArray(Intent.CREATOR);
1118 requestResolvedTypes = data.createStringArray();
1119 } else {
1120 requestIntents = null;
1121 requestResolvedTypes = null;
1122 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001123 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001124 Bundle options = data.readInt() != 0
1125 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001126 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001127 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001128 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001129 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 reply.writeNoException();
1131 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1132 return true;
1133 }
1134
1135 case CANCEL_INTENT_SENDER_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 IIntentSender r = IIntentSender.Stub.asInterface(
1138 data.readStrongBinder());
1139 cancelIntentSender(r);
1140 reply.writeNoException();
1141 return true;
1142 }
1143
1144 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 IIntentSender r = IIntentSender.Stub.asInterface(
1147 data.readStrongBinder());
1148 String res = getPackageForIntentSender(r);
1149 reply.writeNoException();
1150 reply.writeString(res);
1151 return true;
1152 }
1153
Christopher Tatec4a07d12012-04-06 14:19:13 -07001154 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1155 data.enforceInterface(IActivityManager.descriptor);
1156 IIntentSender r = IIntentSender.Stub.asInterface(
1157 data.readStrongBinder());
1158 int res = getUidForIntentSender(r);
1159 reply.writeNoException();
1160 reply.writeInt(res);
1161 return true;
1162 }
1163
Dianne Hackborn41203752012-08-31 14:05:51 -07001164 case HANDLE_INCOMING_USER_TRANSACTION: {
1165 data.enforceInterface(IActivityManager.descriptor);
1166 int callingPid = data.readInt();
1167 int callingUid = data.readInt();
1168 int userId = data.readInt();
1169 boolean allowAll = data.readInt() != 0 ;
1170 boolean requireFull = data.readInt() != 0;
1171 String name = data.readString();
1172 String callerPackage = data.readString();
1173 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1174 requireFull, name, callerPackage);
1175 reply.writeNoException();
1176 reply.writeInt(res);
1177 return true;
1178 }
1179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001180 case SET_PROCESS_LIMIT_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 int max = data.readInt();
1183 setProcessLimit(max);
1184 reply.writeNoException();
1185 return true;
1186 }
1187
1188 case GET_PROCESS_LIMIT_TRANSACTION: {
1189 data.enforceInterface(IActivityManager.descriptor);
1190 int limit = getProcessLimit();
1191 reply.writeNoException();
1192 reply.writeInt(limit);
1193 return true;
1194 }
1195
1196 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 IBinder token = data.readStrongBinder();
1199 int pid = data.readInt();
1200 boolean isForeground = data.readInt() != 0;
1201 setProcessForeground(token, pid, isForeground);
1202 reply.writeNoException();
1203 return true;
1204 }
1205
1206 case CHECK_PERMISSION_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 String perm = data.readString();
1209 int pid = data.readInt();
1210 int uid = data.readInt();
1211 int res = checkPermission(perm, pid, uid);
1212 reply.writeNoException();
1213 reply.writeInt(res);
1214 return true;
1215 }
1216
Dianne Hackbornff170242014-11-19 10:59:01 -08001217 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1218 data.enforceInterface(IActivityManager.descriptor);
1219 String perm = data.readString();
1220 int pid = data.readInt();
1221 int uid = data.readInt();
1222 IBinder token = data.readStrongBinder();
1223 int res = checkPermissionWithToken(perm, pid, uid, token);
1224 reply.writeNoException();
1225 reply.writeInt(res);
1226 return true;
1227 }
1228
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001229 case CHECK_URI_PERMISSION_TRANSACTION: {
1230 data.enforceInterface(IActivityManager.descriptor);
1231 Uri uri = Uri.CREATOR.createFromParcel(data);
1232 int pid = data.readInt();
1233 int uid = data.readInt();
1234 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001235 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001236 IBinder callerToken = data.readStrongBinder();
1237 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 reply.writeNoException();
1239 reply.writeInt(res);
1240 return true;
1241 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001242
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001243 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001244 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 String packageName = data.readString();
1246 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1247 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001248 int userId = data.readInt();
1249 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001250 reply.writeNoException();
1251 reply.writeInt(res ? 1 : 0);
1252 return true;
1253 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001255 case GRANT_URI_PERMISSION_TRANSACTION: {
1256 data.enforceInterface(IActivityManager.descriptor);
1257 IBinder b = data.readStrongBinder();
1258 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1259 String targetPkg = data.readString();
1260 Uri uri = Uri.CREATOR.createFromParcel(data);
1261 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001262 int userId = data.readInt();
1263 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001264 reply.writeNoException();
1265 return true;
1266 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001267
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001268 case REVOKE_URI_PERMISSION_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 IBinder b = data.readStrongBinder();
1271 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1272 Uri uri = Uri.CREATOR.createFromParcel(data);
1273 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001274 int userId = data.readInt();
1275 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001276 reply.writeNoException();
1277 return true;
1278 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001279
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001280 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 Uri uri = Uri.CREATOR.createFromParcel(data);
1283 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001284 int userId = data.readInt();
1285 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001286 reply.writeNoException();
1287 return true;
1288 }
1289
1290 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1291 data.enforceInterface(IActivityManager.descriptor);
1292 Uri uri = Uri.CREATOR.createFromParcel(data);
1293 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001294 int userId = data.readInt();
1295 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001296 reply.writeNoException();
1297 return true;
1298 }
1299
1300 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1301 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001302 final String packageName = data.readString();
1303 final boolean incoming = data.readInt() != 0;
1304 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1305 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001306 reply.writeNoException();
1307 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1308 return true;
1309 }
1310
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001311 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1312 data.enforceInterface(IActivityManager.descriptor);
1313 IBinder b = data.readStrongBinder();
1314 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1315 boolean waiting = data.readInt() != 0;
1316 showWaitingForDebugger(app, waiting);
1317 reply.writeNoException();
1318 return true;
1319 }
1320
1321 case GET_MEMORY_INFO_TRANSACTION: {
1322 data.enforceInterface(IActivityManager.descriptor);
1323 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1324 getMemoryInfo(mi);
1325 reply.writeNoException();
1326 mi.writeToParcel(reply, 0);
1327 return true;
1328 }
1329
1330 case UNHANDLED_BACK_TRANSACTION: {
1331 data.enforceInterface(IActivityManager.descriptor);
1332 unhandledBack();
1333 reply.writeNoException();
1334 return true;
1335 }
1336
1337 case OPEN_CONTENT_URI_TRANSACTION: {
1338 data.enforceInterface(IActivityManager.descriptor);
1339 Uri uri = Uri.parse(data.readString());
1340 ParcelFileDescriptor pfd = openContentUri(uri);
1341 reply.writeNoException();
1342 if (pfd != null) {
1343 reply.writeInt(1);
1344 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1345 } else {
1346 reply.writeInt(0);
1347 }
1348 return true;
1349 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001350
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001351 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1352 data.enforceInterface(IActivityManager.descriptor);
1353 setLockScreenShown(data.readInt() != 0);
1354 reply.writeNoException();
1355 return true;
1356 }
1357
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 case SET_DEBUG_APP_TRANSACTION: {
1359 data.enforceInterface(IActivityManager.descriptor);
1360 String pn = data.readString();
1361 boolean wfd = data.readInt() != 0;
1362 boolean per = data.readInt() != 0;
1363 setDebugApp(pn, wfd, per);
1364 reply.writeNoException();
1365 return true;
1366 }
1367
1368 case SET_ALWAYS_FINISH_TRANSACTION: {
1369 data.enforceInterface(IActivityManager.descriptor);
1370 boolean enabled = data.readInt() != 0;
1371 setAlwaysFinish(enabled);
1372 reply.writeNoException();
1373 return true;
1374 }
1375
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001376 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001377 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001378 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001379 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001380 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001381 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001382 return true;
1383 }
1384
1385 case ENTER_SAFE_MODE_TRANSACTION: {
1386 data.enforceInterface(IActivityManager.descriptor);
1387 enterSafeMode();
1388 reply.writeNoException();
1389 return true;
1390 }
1391
1392 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1393 data.enforceInterface(IActivityManager.descriptor);
1394 IIntentSender is = IIntentSender.Stub.asInterface(
1395 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001396 int sourceUid = data.readInt();
1397 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001398 String tag = data.readString();
1399 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1400 reply.writeNoException();
1401 return true;
1402 }
1403
1404 case NOTE_ALARM_START_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
1406 IIntentSender is = IIntentSender.Stub.asInterface(
1407 data.readStrongBinder());
1408 int sourceUid = data.readInt();
1409 String tag = data.readString();
1410 noteAlarmStart(is, sourceUid, tag);
1411 reply.writeNoException();
1412 return true;
1413 }
1414
1415 case NOTE_ALARM_FINISH_TRANSACTION: {
1416 data.enforceInterface(IActivityManager.descriptor);
1417 IIntentSender is = IIntentSender.Stub.asInterface(
1418 data.readStrongBinder());
1419 int sourceUid = data.readInt();
1420 String tag = data.readString();
1421 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 reply.writeNoException();
1423 return true;
1424 }
1425
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001426 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001427 data.enforceInterface(IActivityManager.descriptor);
1428 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001429 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001430 boolean secure = data.readInt() != 0;
1431 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001432 reply.writeNoException();
1433 reply.writeInt(res ? 1 : 0);
1434 return true;
1435 }
1436
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001437 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 String reason = data.readString();
1440 boolean res = killProcessesBelowForeground(reason);
1441 reply.writeNoException();
1442 reply.writeInt(res ? 1 : 0);
1443 return true;
1444 }
1445
Dan Egnor60d87622009-12-16 16:32:58 -08001446 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 IBinder app = data.readStrongBinder();
1449 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1450 handleApplicationCrash(app, ci);
1451 reply.writeNoException();
1452 return true;
1453 }
1454
1455 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001456 data.enforceInterface(IActivityManager.descriptor);
1457 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001459 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001460 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001461 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001462 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001463 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001464 return true;
1465 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001466
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001467 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1468 data.enforceInterface(IActivityManager.descriptor);
1469 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001470 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001471 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1472 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001473 reply.writeNoException();
1474 return true;
1475 }
1476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001477 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1478 data.enforceInterface(IActivityManager.descriptor);
1479 int sig = data.readInt();
1480 signalPersistentProcesses(sig);
1481 reply.writeNoException();
1482 return true;
1483 }
1484
Dianne Hackborn03abb812010-01-04 18:43:19 -08001485 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001487 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001488 int userId = data.readInt();
1489 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001490 reply.writeNoException();
1491 return true;
1492 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001493
1494 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1495 data.enforceInterface(IActivityManager.descriptor);
1496 killAllBackgroundProcesses();
1497 reply.writeNoException();
1498 return true;
1499 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001500
Dianne Hackborn03abb812010-01-04 18:43:19 -08001501 case FORCE_STOP_PACKAGE_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
1503 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001504 int userId = data.readInt();
1505 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001506 reply.writeNoException();
1507 return true;
1508 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001509
1510 case GET_MY_MEMORY_STATE_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 ActivityManager.RunningAppProcessInfo info =
1513 new ActivityManager.RunningAppProcessInfo();
1514 getMyMemoryState(info);
1515 reply.writeNoException();
1516 info.writeToParcel(reply, 0);
1517 return true;
1518 }
1519
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001520 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1521 data.enforceInterface(IActivityManager.descriptor);
1522 ConfigurationInfo config = getDeviceConfigurationInfo();
1523 reply.writeNoException();
1524 config.writeToParcel(reply, 0);
1525 return true;
1526 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001527
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001528 case PROFILE_CONTROL_TRANSACTION: {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001531 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001532 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001533 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001534 ProfilerInfo profilerInfo = data.readInt() != 0
1535 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1536 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001537 reply.writeNoException();
1538 reply.writeInt(res ? 1 : 0);
1539 return true;
1540 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001541
Dianne Hackborn55280a92009-05-07 15:53:46 -07001542 case SHUTDOWN_TRANSACTION: {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 boolean res = shutdown(data.readInt());
1545 reply.writeNoException();
1546 reply.writeInt(res ? 1 : 0);
1547 return true;
1548 }
1549
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001550 case STOP_APP_SWITCHES_TRANSACTION: {
1551 data.enforceInterface(IActivityManager.descriptor);
1552 stopAppSwitches();
1553 reply.writeNoException();
1554 return true;
1555 }
1556
1557 case RESUME_APP_SWITCHES_TRANSACTION: {
1558 data.enforceInterface(IActivityManager.descriptor);
1559 resumeAppSwitches();
1560 reply.writeNoException();
1561 return true;
1562 }
1563
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001564 case PEEK_SERVICE_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
1566 Intent service = Intent.CREATOR.createFromParcel(data);
1567 String resolvedType = data.readString();
1568 IBinder binder = peekService(service, resolvedType);
1569 reply.writeNoException();
1570 reply.writeStrongBinder(binder);
1571 return true;
1572 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001573
1574 case START_BACKUP_AGENT_TRANSACTION: {
1575 data.enforceInterface(IActivityManager.descriptor);
1576 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1577 int backupRestoreMode = data.readInt();
1578 boolean success = bindBackupAgent(info, backupRestoreMode);
1579 reply.writeNoException();
1580 reply.writeInt(success ? 1 : 0);
1581 return true;
1582 }
1583
1584 case BACKUP_AGENT_CREATED_TRANSACTION: {
1585 data.enforceInterface(IActivityManager.descriptor);
1586 String packageName = data.readString();
1587 IBinder agent = data.readStrongBinder();
1588 backupAgentCreated(packageName, agent);
1589 reply.writeNoException();
1590 return true;
1591 }
1592
1593 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1596 unbindBackupAgent(info);
1597 reply.writeNoException();
1598 return true;
1599 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001600
1601 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 String packageName = data.readString();
1604 addPackageDependency(packageName);
1605 reply.writeNoException();
1606 return true;
1607 }
1608
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001609 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001610 data.enforceInterface(IActivityManager.descriptor);
1611 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001612 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001613 String reason = data.readString();
1614 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001615 reply.writeNoException();
1616 return true;
1617 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001618
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001619 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 String reason = data.readString();
1622 closeSystemDialogs(reason);
1623 reply.writeNoException();
1624 return true;
1625 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001626
1627 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1628 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001629 int[] pids = data.createIntArray();
1630 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001631 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001632 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001633 return true;
1634 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001635
1636 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1637 data.enforceInterface(IActivityManager.descriptor);
1638 String processName = data.readString();
1639 int uid = data.readInt();
1640 killApplicationProcess(processName, uid);
1641 reply.writeNoException();
1642 return true;
1643 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001644
1645 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1646 data.enforceInterface(IActivityManager.descriptor);
1647 IBinder token = data.readStrongBinder();
1648 String packageName = data.readString();
1649 int enterAnim = data.readInt();
1650 int exitAnim = data.readInt();
1651 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001652 reply.writeNoException();
1653 return true;
1654 }
1655
1656 case IS_USER_A_MONKEY_TRANSACTION: {
1657 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001658 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001659 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001660 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001661 return true;
1662 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001663
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001664 case SET_USER_IS_MONKEY_TRANSACTION: {
1665 data.enforceInterface(IActivityManager.descriptor);
1666 final boolean monkey = (data.readInt() == 1);
1667 setUserIsMonkey(monkey);
1668 reply.writeNoException();
1669 return true;
1670 }
1671
Dianne Hackborn860755f2010-06-03 18:47:52 -07001672 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 finishHeavyWeightApp();
1675 reply.writeNoException();
1676 return true;
1677 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001678
1679 case IS_IMMERSIVE_TRANSACTION: {
1680 data.enforceInterface(IActivityManager.descriptor);
1681 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001682 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001683 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001684 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001685 return true;
1686 }
1687
Craig Mautnerd61dc202014-07-07 11:09:11 -07001688 case IS_TOP_OF_TASK_TRANSACTION: {
1689 data.enforceInterface(IActivityManager.descriptor);
1690 IBinder token = data.readStrongBinder();
1691 final boolean isTopOfTask = isTopOfTask(token);
1692 reply.writeNoException();
1693 reply.writeInt(isTopOfTask ? 1 : 0);
1694 return true;
1695 }
1696
Craig Mautner5eda9b32013-07-02 11:58:16 -07001697 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001698 data.enforceInterface(IActivityManager.descriptor);
1699 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001700 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001701 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001702 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001703 return true;
1704 }
1705
1706 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1707 data.enforceInterface(IActivityManager.descriptor);
1708 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001709 final Bundle bundle;
1710 if (data.readInt() == 0) {
1711 bundle = null;
1712 } else {
1713 bundle = data.readBundle();
1714 }
1715 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1716 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001717 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001718 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001719 return true;
1720 }
1721
Craig Mautner233ceee2014-05-09 17:05:11 -07001722 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1723 data.enforceInterface(IActivityManager.descriptor);
1724 IBinder token = data.readStrongBinder();
1725 final ActivityOptions options = getActivityOptions(token);
1726 reply.writeNoException();
1727 reply.writeBundle(options == null ? null : options.toBundle());
1728 return true;
1729 }
1730
Daniel Sandler69a48172010-06-23 16:29:36 -04001731 case SET_IMMERSIVE_TRANSACTION: {
1732 data.enforceInterface(IActivityManager.descriptor);
1733 IBinder token = data.readStrongBinder();
1734 boolean imm = data.readInt() == 1;
1735 setImmersive(token, imm);
1736 reply.writeNoException();
1737 return true;
1738 }
1739
1740 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1741 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001742 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001743 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001744 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001745 return true;
1746 }
1747
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001748 case CRASH_APPLICATION_TRANSACTION: {
1749 data.enforceInterface(IActivityManager.descriptor);
1750 int uid = data.readInt();
1751 int initialPid = data.readInt();
1752 String packageName = data.readString();
1753 String message = data.readString();
1754 crashApplication(uid, initialPid, packageName, message);
1755 reply.writeNoException();
1756 return true;
1757 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001758
1759 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1760 data.enforceInterface(IActivityManager.descriptor);
1761 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001762 int userId = data.readInt();
1763 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001764 reply.writeNoException();
1765 reply.writeString(type);
1766 return true;
1767 }
1768
Dianne Hackborn7e269642010-08-25 19:50:20 -07001769 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1770 data.enforceInterface(IActivityManager.descriptor);
1771 String name = data.readString();
1772 IBinder perm = newUriPermissionOwner(name);
1773 reply.writeNoException();
1774 reply.writeStrongBinder(perm);
1775 return true;
1776 }
1777
1778 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 IBinder owner = data.readStrongBinder();
1781 int fromUid = data.readInt();
1782 String targetPkg = data.readString();
1783 Uri uri = Uri.CREATOR.createFromParcel(data);
1784 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001785 int sourceUserId = data.readInt();
1786 int targetUserId = data.readInt();
1787 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1788 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001789 reply.writeNoException();
1790 return true;
1791 }
1792
1793 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1794 data.enforceInterface(IActivityManager.descriptor);
1795 IBinder owner = data.readStrongBinder();
1796 Uri uri = null;
1797 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001798 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001799 }
1800 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001801 int userId = data.readInt();
1802 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001803 reply.writeNoException();
1804 return true;
1805 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001806
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001807 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1808 data.enforceInterface(IActivityManager.descriptor);
1809 int callingUid = data.readInt();
1810 String targetPkg = data.readString();
1811 Uri uri = Uri.CREATOR.createFromParcel(data);
1812 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001813 int userId = data.readInt();
1814 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001815 reply.writeNoException();
1816 reply.writeInt(res);
1817 return true;
1818 }
1819
Andy McFadden824c5102010-07-09 16:26:57 -07001820 case DUMP_HEAP_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001823 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001824 boolean managed = data.readInt() != 0;
1825 String path = data.readString();
1826 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001827 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001828 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001829 reply.writeNoException();
1830 reply.writeInt(res ? 1 : 0);
1831 return true;
1832 }
1833
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001834 case START_ACTIVITIES_TRANSACTION:
1835 {
1836 data.enforceInterface(IActivityManager.descriptor);
1837 IBinder b = data.readStrongBinder();
1838 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001839 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001840 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1841 String[] resolvedTypes = data.createStringArray();
1842 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001843 Bundle options = data.readInt() != 0
1844 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001845 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001846 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001847 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001848 reply.writeNoException();
1849 reply.writeInt(result);
1850 return true;
1851 }
1852
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001853 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1854 {
1855 data.enforceInterface(IActivityManager.descriptor);
1856 int mode = getFrontActivityScreenCompatMode();
1857 reply.writeNoException();
1858 reply.writeInt(mode);
1859 return true;
1860 }
1861
1862 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1863 {
1864 data.enforceInterface(IActivityManager.descriptor);
1865 int mode = data.readInt();
1866 setFrontActivityScreenCompatMode(mode);
1867 reply.writeNoException();
1868 reply.writeInt(mode);
1869 return true;
1870 }
1871
1872 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1873 {
1874 data.enforceInterface(IActivityManager.descriptor);
1875 String pkg = data.readString();
1876 int mode = getPackageScreenCompatMode(pkg);
1877 reply.writeNoException();
1878 reply.writeInt(mode);
1879 return true;
1880 }
1881
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001882 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1883 {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001886 int mode = data.readInt();
1887 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001888 reply.writeNoException();
1889 return true;
1890 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001891
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001892 case SWITCH_USER_TRANSACTION: {
1893 data.enforceInterface(IActivityManager.descriptor);
1894 int userid = data.readInt();
1895 boolean result = switchUser(userid);
1896 reply.writeNoException();
1897 reply.writeInt(result ? 1 : 0);
1898 return true;
1899 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001900
Kenny Guy08488bf2014-02-21 17:40:37 +00001901 case START_USER_IN_BACKGROUND_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 int userid = data.readInt();
1904 boolean result = startUserInBackground(userid);
1905 reply.writeNoException();
1906 reply.writeInt(result ? 1 : 0);
1907 return true;
1908 }
1909
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001910 case STOP_USER_TRANSACTION: {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 int userid = data.readInt();
1913 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1914 data.readStrongBinder());
1915 int result = stopUser(userid, callback);
1916 reply.writeNoException();
1917 reply.writeInt(result);
1918 return true;
1919 }
1920
Amith Yamasani52f1d752012-03-28 18:19:29 -07001921 case GET_CURRENT_USER_TRANSACTION: {
1922 data.enforceInterface(IActivityManager.descriptor);
1923 UserInfo userInfo = getCurrentUser();
1924 reply.writeNoException();
1925 userInfo.writeToParcel(reply, 0);
1926 return true;
1927 }
1928
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001929 case IS_USER_RUNNING_TRANSACTION: {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001932 boolean orStopping = data.readInt() != 0;
1933 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001934 reply.writeNoException();
1935 reply.writeInt(result ? 1 : 0);
1936 return true;
1937 }
1938
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001939 case GET_RUNNING_USER_IDS_TRANSACTION: {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 int[] result = getRunningUserIds();
1942 reply.writeNoException();
1943 reply.writeIntArray(result);
1944 return true;
1945 }
1946
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001947 case REMOVE_TASK_TRANSACTION:
1948 {
1949 data.enforceInterface(IActivityManager.descriptor);
1950 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001951 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001952 reply.writeNoException();
1953 reply.writeInt(result ? 1 : 0);
1954 return true;
1955 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001956
Jeff Sharkeya4620792011-05-20 15:29:23 -07001957 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1960 data.readStrongBinder());
1961 registerProcessObserver(observer);
1962 return true;
1963 }
1964
1965 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1966 data.enforceInterface(IActivityManager.descriptor);
1967 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1968 data.readStrongBinder());
1969 unregisterProcessObserver(observer);
1970 return true;
1971 }
1972
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001973 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1974 {
1975 data.enforceInterface(IActivityManager.descriptor);
1976 String pkg = data.readString();
1977 boolean ask = getPackageAskScreenCompat(pkg);
1978 reply.writeNoException();
1979 reply.writeInt(ask ? 1 : 0);
1980 return true;
1981 }
1982
1983 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1984 {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 String pkg = data.readString();
1987 boolean ask = data.readInt() != 0;
1988 setPackageAskScreenCompat(pkg, ask);
1989 reply.writeNoException();
1990 return true;
1991 }
1992
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001993 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001996 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001997 boolean res = isIntentSenderTargetedToPackage(r);
1998 reply.writeNoException();
1999 reply.writeInt(res ? 1 : 0);
2000 return true;
2001 }
2002
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002003 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2004 data.enforceInterface(IActivityManager.descriptor);
2005 IIntentSender r = IIntentSender.Stub.asInterface(
2006 data.readStrongBinder());
2007 boolean res = isIntentSenderAnActivity(r);
2008 reply.writeNoException();
2009 reply.writeInt(res ? 1 : 0);
2010 return true;
2011 }
2012
Dianne Hackborn81038902012-11-26 17:04:09 -08002013 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2014 data.enforceInterface(IActivityManager.descriptor);
2015 IIntentSender r = IIntentSender.Stub.asInterface(
2016 data.readStrongBinder());
2017 Intent intent = getIntentForIntentSender(r);
2018 reply.writeNoException();
2019 if (intent != null) {
2020 reply.writeInt(1);
2021 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2022 } else {
2023 reply.writeInt(0);
2024 }
2025 return true;
2026 }
2027
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002028 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2029 data.enforceInterface(IActivityManager.descriptor);
2030 IIntentSender r = IIntentSender.Stub.asInterface(
2031 data.readStrongBinder());
2032 String prefix = data.readString();
2033 String tag = getTagForIntentSender(r, prefix);
2034 reply.writeNoException();
2035 reply.writeString(tag);
2036 return true;
2037 }
2038
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002039 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2040 data.enforceInterface(IActivityManager.descriptor);
2041 Configuration config = Configuration.CREATOR.createFromParcel(data);
2042 updatePersistentConfiguration(config);
2043 reply.writeNoException();
2044 return true;
2045 }
2046
Dianne Hackbornb437e092011-08-05 17:50:29 -07002047 case GET_PROCESS_PSS_TRANSACTION: {
2048 data.enforceInterface(IActivityManager.descriptor);
2049 int[] pids = data.createIntArray();
2050 long[] pss = getProcessPss(pids);
2051 reply.writeNoException();
2052 reply.writeLongArray(pss);
2053 return true;
2054 }
2055
Dianne Hackborn661cd522011-08-22 00:26:20 -07002056 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2057 data.enforceInterface(IActivityManager.descriptor);
2058 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2059 boolean always = data.readInt() != 0;
2060 showBootMessage(msg, always);
2061 reply.writeNoException();
2062 return true;
2063 }
2064
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002065 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002066 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002067 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002068 reply.writeNoException();
2069 return true;
2070 }
2071
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002072 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002073 data.enforceInterface(IActivityManager.descriptor);
2074 IBinder token = data.readStrongBinder();
2075 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002076 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002077 reply.writeNoException();
2078 reply.writeInt(res ? 1 : 0);
2079 return true;
2080 }
2081
2082 case NAVIGATE_UP_TO_TRANSACTION: {
2083 data.enforceInterface(IActivityManager.descriptor);
2084 IBinder token = data.readStrongBinder();
2085 Intent target = Intent.CREATOR.createFromParcel(data);
2086 int resultCode = data.readInt();
2087 Intent resultData = null;
2088 if (data.readInt() != 0) {
2089 resultData = Intent.CREATOR.createFromParcel(data);
2090 }
2091 boolean res = navigateUpTo(token, target, resultCode, resultData);
2092 reply.writeNoException();
2093 reply.writeInt(res ? 1 : 0);
2094 return true;
2095 }
2096
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002097 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2098 data.enforceInterface(IActivityManager.descriptor);
2099 IBinder token = data.readStrongBinder();
2100 int res = getLaunchedFromUid(token);
2101 reply.writeNoException();
2102 reply.writeInt(res);
2103 return true;
2104 }
2105
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002106 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2107 data.enforceInterface(IActivityManager.descriptor);
2108 IBinder token = data.readStrongBinder();
2109 String res = getLaunchedFromPackage(token);
2110 reply.writeNoException();
2111 reply.writeString(res);
2112 return true;
2113 }
2114
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002115 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2118 data.readStrongBinder());
2119 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002120 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002121 return true;
2122 }
2123
2124 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2127 data.readStrongBinder());
2128 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002129 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002130 return true;
2131 }
2132
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002133 case REQUEST_BUG_REPORT_TRANSACTION: {
2134 data.enforceInterface(IActivityManager.descriptor);
2135 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002136 reply.writeNoException();
2137 return true;
2138 }
2139
2140 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2141 data.enforceInterface(IActivityManager.descriptor);
2142 int pid = data.readInt();
2143 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002144 String reason = data.readString();
2145 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002146 reply.writeNoException();
2147 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002148 return true;
2149 }
2150
Adam Skorydfc7fd72013-08-05 19:23:41 -07002151 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002152 data.enforceInterface(IActivityManager.descriptor);
2153 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002154 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002155 reply.writeNoException();
2156 reply.writeBundle(res);
2157 return true;
2158 }
2159
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002160 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2161 data.enforceInterface(IActivityManager.descriptor);
2162 int requestType = data.readInt();
2163 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
2164 requestAssistContextExtras(requestType, receiver);
2165 reply.writeNoException();
2166 return true;
2167 }
2168
Adam Skorydfc7fd72013-08-05 19:23:41 -07002169 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002170 data.enforceInterface(IActivityManager.descriptor);
2171 IBinder token = data.readStrongBinder();
2172 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002173 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002174 reply.writeNoException();
2175 return true;
2176 }
2177
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002178 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2179 data.enforceInterface(IActivityManager.descriptor);
2180 Intent intent = Intent.CREATOR.createFromParcel(data);
2181 int requestType = data.readInt();
2182 String hint = data.readString();
2183 int userHandle = data.readInt();
2184 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2185 reply.writeNoException();
2186 reply.writeInt(res ? 1 : 0);
2187 return true;
2188 }
2189
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002190 case KILL_UID_TRANSACTION: {
2191 data.enforceInterface(IActivityManager.descriptor);
2192 int uid = data.readInt();
2193 String reason = data.readString();
2194 killUid(uid, reason);
2195 reply.writeNoException();
2196 return true;
2197 }
2198
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002199 case HANG_TRANSACTION: {
2200 data.enforceInterface(IActivityManager.descriptor);
2201 IBinder who = data.readStrongBinder();
2202 boolean allowRestart = data.readInt() != 0;
2203 hang(who, allowRestart);
2204 reply.writeNoException();
2205 return true;
2206 }
2207
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002208 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2209 data.enforceInterface(IActivityManager.descriptor);
2210 IBinder token = data.readStrongBinder();
2211 reportActivityFullyDrawn(token);
2212 reply.writeNoException();
2213 return true;
2214 }
2215
Craig Mautner5eda9b32013-07-02 11:58:16 -07002216 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2217 data.enforceInterface(IActivityManager.descriptor);
2218 IBinder token = data.readStrongBinder();
2219 notifyActivityDrawn(token);
2220 reply.writeNoException();
2221 return true;
2222 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002223
2224 case RESTART_TRANSACTION: {
2225 data.enforceInterface(IActivityManager.descriptor);
2226 restart();
2227 reply.writeNoException();
2228 return true;
2229 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002230
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002231 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2232 data.enforceInterface(IActivityManager.descriptor);
2233 performIdleMaintenance();
2234 reply.writeNoException();
2235 return true;
2236 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002237
Todd Kennedyca4d8422015-01-15 15:19:22 -08002238 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002239 data.enforceInterface(IActivityManager.descriptor);
2240 IBinder parentActivityToken = data.readStrongBinder();
2241 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002242 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002243 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002244 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002245 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002246 if (activityContainer != null) {
2247 reply.writeInt(1);
2248 reply.writeStrongBinder(activityContainer.asBinder());
2249 } else {
2250 reply.writeInt(0);
2251 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002252 return true;
2253 }
2254
Craig Mautner95da1082014-02-24 17:54:35 -08002255 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2256 data.enforceInterface(IActivityManager.descriptor);
2257 IActivityContainer activityContainer =
2258 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2259 deleteActivityContainer(activityContainer);
2260 reply.writeNoException();
2261 return true;
2262 }
2263
Todd Kennedy4900bf92015-01-16 16:05:14 -08002264 case CREATE_STACK_ON_DISPLAY: {
2265 data.enforceInterface(IActivityManager.descriptor);
2266 int displayId = data.readInt();
2267 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2268 reply.writeNoException();
2269 if (activityContainer != null) {
2270 reply.writeInt(1);
2271 reply.writeStrongBinder(activityContainer.asBinder());
2272 } else {
2273 reply.writeInt(0);
2274 }
2275 return true;
2276 }
2277
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002278 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002279 data.enforceInterface(IActivityManager.descriptor);
2280 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002281 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002282 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002283 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002284 return true;
2285 }
2286
Craig Mautner4a1cb222013-12-04 16:14:06 -08002287 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2288 data.enforceInterface(IActivityManager.descriptor);
2289 IBinder homeActivityToken = getHomeActivityToken();
2290 reply.writeNoException();
2291 reply.writeStrongBinder(homeActivityToken);
2292 return true;
2293 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002294
2295 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2296 data.enforceInterface(IActivityManager.descriptor);
2297 final int taskId = data.readInt();
2298 startLockTaskMode(taskId);
2299 reply.writeNoException();
2300 return true;
2301 }
2302
2303 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2304 data.enforceInterface(IActivityManager.descriptor);
2305 IBinder token = data.readStrongBinder();
2306 startLockTaskMode(token);
2307 reply.writeNoException();
2308 return true;
2309 }
2310
Craig Mautnerd61dc202014-07-07 11:09:11 -07002311 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002312 data.enforceInterface(IActivityManager.descriptor);
2313 startLockTaskModeOnCurrent();
2314 reply.writeNoException();
2315 return true;
2316 }
2317
Craig Mautneraea74a52014-03-08 14:23:10 -08002318 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2319 data.enforceInterface(IActivityManager.descriptor);
2320 stopLockTaskMode();
2321 reply.writeNoException();
2322 return true;
2323 }
2324
Craig Mautnerd61dc202014-07-07 11:09:11 -07002325 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002326 data.enforceInterface(IActivityManager.descriptor);
2327 stopLockTaskModeOnCurrent();
2328 reply.writeNoException();
2329 return true;
2330 }
2331
Craig Mautneraea74a52014-03-08 14:23:10 -08002332 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2333 data.enforceInterface(IActivityManager.descriptor);
2334 final boolean isInLockTaskMode = isInLockTaskMode();
2335 reply.writeNoException();
2336 reply.writeInt(isInLockTaskMode ? 1 : 0);
2337 return true;
2338 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002339
Benjamin Franz43261142015-02-11 15:59:44 +00002340 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2341 data.enforceInterface(IActivityManager.descriptor);
2342 final int lockTaskModeState = getLockTaskModeState();
2343 reply.writeNoException();
2344 reply.writeInt(lockTaskModeState);
2345 return true;
2346 }
2347
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002348 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2349 data.enforceInterface(IActivityManager.descriptor);
2350 final IBinder token = data.readStrongBinder();
2351 showLockTaskEscapeMessage(token);
2352 reply.writeNoException();
2353 return true;
2354 }
2355
Winson Chunga449dc02014-05-16 11:15:04 -07002356 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002357 data.enforceInterface(IActivityManager.descriptor);
2358 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002359 ActivityManager.TaskDescription values =
2360 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2361 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002362 reply.writeNoException();
2363 return true;
2364 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002365
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002366 case SET_TASK_RESIZEABLE_TRANSACTION: {
2367 data.enforceInterface(IActivityManager.descriptor);
2368 int taskId = data.readInt();
2369 boolean resizeable = (data.readInt() == 1) ? true : false;
2370 setTaskResizeable(taskId, resizeable);
2371 reply.writeNoException();
2372 return true;
2373 }
2374
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002375 case RESIZE_TASK_TRANSACTION: {
2376 data.enforceInterface(IActivityManager.descriptor);
2377 int taskId = data.readInt();
2378 Rect r = Rect.CREATOR.createFromParcel(data);
2379 resizeTask(taskId, r);
2380 reply.writeNoException();
2381 return true;
2382 }
2383
Craig Mautner648f69b2014-09-18 14:16:26 -07002384 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2385 data.enforceInterface(IActivityManager.descriptor);
2386 String filename = data.readString();
2387 Bitmap icon = getTaskDescriptionIcon(filename);
2388 reply.writeNoException();
2389 if (icon == null) {
2390 reply.writeInt(0);
2391 } else {
2392 reply.writeInt(1);
2393 icon.writeToParcel(reply, 0);
2394 }
2395 return true;
2396 }
2397
Winson Chung044d5292014-11-06 11:05:19 -08002398 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2399 data.enforceInterface(IActivityManager.descriptor);
2400 final Bundle bundle;
2401 if (data.readInt() == 0) {
2402 bundle = null;
2403 } else {
2404 bundle = data.readBundle();
2405 }
2406 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2407 startInPlaceAnimationOnFrontMostApplication(options);
2408 reply.writeNoException();
2409 return true;
2410 }
2411
Jose Lima4b6c6692014-08-12 17:41:12 -07002412 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002413 data.enforceInterface(IActivityManager.descriptor);
2414 IBinder token = data.readStrongBinder();
2415 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002416 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002417 reply.writeNoException();
2418 reply.writeInt(success ? 1 : 0);
2419 return true;
2420 }
2421
Jose Lima4b6c6692014-08-12 17:41:12 -07002422 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002423 data.enforceInterface(IActivityManager.descriptor);
2424 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002425 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002426 reply.writeNoException();
2427 reply.writeInt(enabled ? 1 : 0);
2428 return true;
2429 }
2430
Jose Lima4b6c6692014-08-12 17:41:12 -07002431 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002432 data.enforceInterface(IActivityManager.descriptor);
2433 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002434 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002435 reply.writeNoException();
2436 return true;
2437 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002438
2439 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2440 data.enforceInterface(IActivityManager.descriptor);
2441 IBinder token = data.readStrongBinder();
2442 notifyLaunchTaskBehindComplete(token);
2443 reply.writeNoException();
2444 return true;
2445 }
Craig Mautner8746a472014-07-24 15:12:54 -07002446
2447 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2448 data.enforceInterface(IActivityManager.descriptor);
2449 IBinder token = data.readStrongBinder();
2450 notifyEnterAnimationComplete(token);
2451 reply.writeNoException();
2452 return true;
2453 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002454
2455 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2456 data.enforceInterface(IActivityManager.descriptor);
2457 bootAnimationComplete();
2458 reply.writeNoException();
2459 return true;
2460 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002461
2462 case SYSTEM_BACKUP_RESTORED: {
2463 data.enforceInterface(IActivityManager.descriptor);
2464 systemBackupRestored();
2465 reply.writeNoException();
2466 return true;
2467 }
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08002468
Jeff Sharkey605eb792014-11-04 13:34:06 -08002469 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2470 data.enforceInterface(IActivityManager.descriptor);
2471 final int uid = data.readInt();
2472 final byte[] firstPacket = data.createByteArray();
2473 notifyCleartextNetwork(uid, firstPacket);
2474 reply.writeNoException();
2475 return true;
2476 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002477
2478 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2479 data.enforceInterface(IActivityManager.descriptor);
2480 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002481 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002482 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002483 String reportPackage = data.readString();
2484 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002485 reply.writeNoException();
2486 return true;
2487 }
2488
2489 case DUMP_HEAP_FINISHED_TRANSACTION: {
2490 data.enforceInterface(IActivityManager.descriptor);
2491 String path = data.readString();
2492 dumpHeapFinished(path);
2493 reply.writeNoException();
2494 return true;
2495 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002496
2497 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2498 data.enforceInterface(IActivityManager.descriptor);
2499 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2500 data.readStrongBinder());
2501 boolean keepAwake = data.readInt() != 0;
2502 setVoiceKeepAwake(session, keepAwake);
2503 reply.writeNoException();
2504 return true;
2505 }
Craig Mautnere5600772015-04-03 21:36:37 -07002506
2507 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2508 data.enforceInterface(IActivityManager.descriptor);
2509 int userId = data.readInt();
2510 String[] packages = data.readStringArray();
2511 updateLockTaskPackages(userId, packages);
2512 reply.writeNoException();
2513 return true;
2514 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002515
Craig Mautner015c5e52015-04-23 10:39:39 -07002516 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2517 data.enforceInterface(IActivityManager.descriptor);
2518 String packageName = data.readString();
2519 updateDeviceOwner(packageName);
2520 reply.writeNoException();
2521 return true;
2522 }
2523
Dianne Hackborn1e383822015-04-10 14:02:33 -07002524 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2525 data.enforceInterface(IActivityManager.descriptor);
2526 String pkg = data.readString();
2527 int res = getPackageProcessState(pkg);
2528 reply.writeNoException();
2529 reply.writeInt(res);
2530 return true;
2531 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002532 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002534 return super.onTransact(code, data, reply, flags);
2535 }
2536
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002537 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002538 return this;
2539 }
2540
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002541 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2542 protected IActivityManager create() {
2543 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002544 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002545 Log.v("ActivityManager", "default service binder = " + b);
2546 }
2547 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002548 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002549 Log.v("ActivityManager", "default service = " + am);
2550 }
2551 return am;
2552 }
2553 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002554}
2555
2556class ActivityManagerProxy implements IActivityManager
2557{
2558 public ActivityManagerProxy(IBinder remote)
2559 {
2560 mRemote = remote;
2561 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002562
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002563 public IBinder asBinder()
2564 {
2565 return mRemote;
2566 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002567
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002568 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002569 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002570 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002571 Parcel data = Parcel.obtain();
2572 Parcel reply = Parcel.obtain();
2573 data.writeInterfaceToken(IActivityManager.descriptor);
2574 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002575 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002576 intent.writeToParcel(data, 0);
2577 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002578 data.writeStrongBinder(resultTo);
2579 data.writeString(resultWho);
2580 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002581 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002582 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002583 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002584 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002585 } else {
2586 data.writeInt(0);
2587 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002588 if (options != null) {
2589 data.writeInt(1);
2590 options.writeToParcel(data, 0);
2591 } else {
2592 data.writeInt(0);
2593 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002594 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2595 reply.readException();
2596 int result = reply.readInt();
2597 reply.recycle();
2598 data.recycle();
2599 return result;
2600 }
Amith Yamasani82644082012-08-03 13:09:11 -07002601
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002602 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002603 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002604 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2605 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002606 Parcel data = Parcel.obtain();
2607 Parcel reply = Parcel.obtain();
2608 data.writeInterfaceToken(IActivityManager.descriptor);
2609 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002610 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002611 intent.writeToParcel(data, 0);
2612 data.writeString(resolvedType);
2613 data.writeStrongBinder(resultTo);
2614 data.writeString(resultWho);
2615 data.writeInt(requestCode);
2616 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002617 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002618 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002619 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002620 } else {
2621 data.writeInt(0);
2622 }
2623 if (options != null) {
2624 data.writeInt(1);
2625 options.writeToParcel(data, 0);
2626 } else {
2627 data.writeInt(0);
2628 }
2629 data.writeInt(userId);
2630 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2631 reply.readException();
2632 int result = reply.readInt();
2633 reply.recycle();
2634 data.recycle();
2635 return result;
2636 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002637 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2638 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002639 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002640 Parcel data = Parcel.obtain();
2641 Parcel reply = Parcel.obtain();
2642 data.writeInterfaceToken(IActivityManager.descriptor);
2643 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2644 data.writeString(callingPackage);
2645 intent.writeToParcel(data, 0);
2646 data.writeString(resolvedType);
2647 data.writeStrongBinder(resultTo);
2648 data.writeString(resultWho);
2649 data.writeInt(requestCode);
2650 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002651 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002652 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002653 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002654 } else {
2655 data.writeInt(0);
2656 }
2657 if (options != null) {
2658 data.writeInt(1);
2659 options.writeToParcel(data, 0);
2660 } else {
2661 data.writeInt(0);
2662 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002663 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002664 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2665 reply.readException();
2666 int result = reply.readInt();
2667 reply.recycle();
2668 data.recycle();
2669 return result;
2670 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002671 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2672 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002673 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2674 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002675 Parcel data = Parcel.obtain();
2676 Parcel reply = Parcel.obtain();
2677 data.writeInterfaceToken(IActivityManager.descriptor);
2678 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002679 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002680 intent.writeToParcel(data, 0);
2681 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002682 data.writeStrongBinder(resultTo);
2683 data.writeString(resultWho);
2684 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002685 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002686 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002687 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002688 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002689 } else {
2690 data.writeInt(0);
2691 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002692 if (options != null) {
2693 data.writeInt(1);
2694 options.writeToParcel(data, 0);
2695 } else {
2696 data.writeInt(0);
2697 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002698 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002699 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2700 reply.readException();
2701 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2702 reply.recycle();
2703 data.recycle();
2704 return result;
2705 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002706 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2707 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002708 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002709 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002710 Parcel data = Parcel.obtain();
2711 Parcel reply = Parcel.obtain();
2712 data.writeInterfaceToken(IActivityManager.descriptor);
2713 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002714 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002715 intent.writeToParcel(data, 0);
2716 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002717 data.writeStrongBinder(resultTo);
2718 data.writeString(resultWho);
2719 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002720 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002721 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002722 if (options != null) {
2723 data.writeInt(1);
2724 options.writeToParcel(data, 0);
2725 } else {
2726 data.writeInt(0);
2727 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002728 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002729 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2730 reply.readException();
2731 int result = reply.readInt();
2732 reply.recycle();
2733 data.recycle();
2734 return result;
2735 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002736 public int startActivityIntentSender(IApplicationThread caller,
2737 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002738 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002739 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2744 intent.writeToParcel(data, 0);
2745 if (fillInIntent != null) {
2746 data.writeInt(1);
2747 fillInIntent.writeToParcel(data, 0);
2748 } else {
2749 data.writeInt(0);
2750 }
2751 data.writeString(resolvedType);
2752 data.writeStrongBinder(resultTo);
2753 data.writeString(resultWho);
2754 data.writeInt(requestCode);
2755 data.writeInt(flagsMask);
2756 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002757 if (options != null) {
2758 data.writeInt(1);
2759 options.writeToParcel(data, 0);
2760 } else {
2761 data.writeInt(0);
2762 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002763 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002764 reply.readException();
2765 int result = reply.readInt();
2766 reply.recycle();
2767 data.recycle();
2768 return result;
2769 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002770 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2771 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002772 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2773 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002774 Parcel data = Parcel.obtain();
2775 Parcel reply = Parcel.obtain();
2776 data.writeInterfaceToken(IActivityManager.descriptor);
2777 data.writeString(callingPackage);
2778 data.writeInt(callingPid);
2779 data.writeInt(callingUid);
2780 intent.writeToParcel(data, 0);
2781 data.writeString(resolvedType);
2782 data.writeStrongBinder(session.asBinder());
2783 data.writeStrongBinder(interactor.asBinder());
2784 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002785 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002786 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002787 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002788 } else {
2789 data.writeInt(0);
2790 }
2791 if (options != null) {
2792 data.writeInt(1);
2793 options.writeToParcel(data, 0);
2794 } else {
2795 data.writeInt(0);
2796 }
2797 data.writeInt(userId);
2798 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2799 reply.readException();
2800 int result = reply.readInt();
2801 reply.recycle();
2802 data.recycle();
2803 return result;
2804 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002805 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002806 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 data.writeStrongBinder(callingActivity);
2811 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002812 if (options != null) {
2813 data.writeInt(1);
2814 options.writeToParcel(data, 0);
2815 } else {
2816 data.writeInt(0);
2817 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2819 reply.readException();
2820 int result = reply.readInt();
2821 reply.recycle();
2822 data.recycle();
2823 return result != 0;
2824 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002825 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2826 Parcel data = Parcel.obtain();
2827 Parcel reply = Parcel.obtain();
2828 data.writeInterfaceToken(IActivityManager.descriptor);
2829 data.writeInt(taskId);
2830 if (options == null) {
2831 data.writeInt(0);
2832 } else {
2833 data.writeInt(1);
2834 options.writeToParcel(data, 0);
2835 }
2836 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2837 reply.readException();
2838 int result = reply.readInt();
2839 reply.recycle();
2840 data.recycle();
2841 return result;
2842 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002843 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002844 throws RemoteException {
2845 Parcel data = Parcel.obtain();
2846 Parcel reply = Parcel.obtain();
2847 data.writeInterfaceToken(IActivityManager.descriptor);
2848 data.writeStrongBinder(token);
2849 data.writeInt(resultCode);
2850 if (resultData != null) {
2851 data.writeInt(1);
2852 resultData.writeToParcel(data, 0);
2853 } else {
2854 data.writeInt(0);
2855 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002856 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002857 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2858 reply.readException();
2859 boolean res = reply.readInt() != 0;
2860 data.recycle();
2861 reply.recycle();
2862 return res;
2863 }
2864 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2865 {
2866 Parcel data = Parcel.obtain();
2867 Parcel reply = Parcel.obtain();
2868 data.writeInterfaceToken(IActivityManager.descriptor);
2869 data.writeStrongBinder(token);
2870 data.writeString(resultWho);
2871 data.writeInt(requestCode);
2872 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2873 reply.readException();
2874 data.recycle();
2875 reply.recycle();
2876 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002877 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2878 Parcel data = Parcel.obtain();
2879 Parcel reply = Parcel.obtain();
2880 data.writeInterfaceToken(IActivityManager.descriptor);
2881 data.writeStrongBinder(token);
2882 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2883 reply.readException();
2884 boolean res = reply.readInt() != 0;
2885 data.recycle();
2886 reply.recycle();
2887 return res;
2888 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002889 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2890 Parcel data = Parcel.obtain();
2891 Parcel reply = Parcel.obtain();
2892 data.writeInterfaceToken(IActivityManager.descriptor);
2893 data.writeStrongBinder(session.asBinder());
2894 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2895 reply.readException();
2896 data.recycle();
2897 reply.recycle();
2898 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002899 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2900 Parcel data = Parcel.obtain();
2901 Parcel reply = Parcel.obtain();
2902 data.writeInterfaceToken(IActivityManager.descriptor);
2903 data.writeStrongBinder(token);
2904 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2905 reply.readException();
2906 boolean res = reply.readInt() != 0;
2907 data.recycle();
2908 reply.recycle();
2909 return res;
2910 }
2911 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2912 Parcel data = Parcel.obtain();
2913 Parcel reply = Parcel.obtain();
2914 data.writeInterfaceToken(IActivityManager.descriptor);
2915 data.writeStrongBinder(app.asBinder());
2916 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2917 reply.readException();
2918 data.recycle();
2919 reply.recycle();
2920 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002921 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2922 Parcel data = Parcel.obtain();
2923 Parcel reply = Parcel.obtain();
2924 data.writeInterfaceToken(IActivityManager.descriptor);
2925 data.writeStrongBinder(token);
2926 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2927 reply.readException();
2928 boolean res = reply.readInt() != 0;
2929 data.recycle();
2930 reply.recycle();
2931 return res;
2932 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002933 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002934 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002935 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002936 {
2937 Parcel data = Parcel.obtain();
2938 Parcel reply = Parcel.obtain();
2939 data.writeInterfaceToken(IActivityManager.descriptor);
2940 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002941 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002942 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2943 filter.writeToParcel(data, 0);
2944 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002945 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002946 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 Intent intent = null;
2949 int haveIntent = reply.readInt();
2950 if (haveIntent != 0) {
2951 intent = Intent.CREATOR.createFromParcel(reply);
2952 }
2953 reply.recycle();
2954 data.recycle();
2955 return intent;
2956 }
2957 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2958 {
2959 Parcel data = Parcel.obtain();
2960 Parcel reply = Parcel.obtain();
2961 data.writeInterfaceToken(IActivityManager.descriptor);
2962 data.writeStrongBinder(receiver.asBinder());
2963 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2964 reply.readException();
2965 data.recycle();
2966 reply.recycle();
2967 }
2968 public int broadcastIntent(IApplicationThread caller,
2969 Intent intent, String resolvedType, IIntentReceiver resultTo,
2970 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002971 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002972 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 {
2974 Parcel data = Parcel.obtain();
2975 Parcel reply = Parcel.obtain();
2976 data.writeInterfaceToken(IActivityManager.descriptor);
2977 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2978 intent.writeToParcel(data, 0);
2979 data.writeString(resolvedType);
2980 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2981 data.writeInt(resultCode);
2982 data.writeString(resultData);
2983 data.writeBundle(map);
2984 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002985 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002986 data.writeInt(serialized ? 1 : 0);
2987 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002988 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002989 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 int res = reply.readInt();
2992 reply.recycle();
2993 data.recycle();
2994 return res;
2995 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002996 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2997 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002998 {
2999 Parcel data = Parcel.obtain();
3000 Parcel reply = Parcel.obtain();
3001 data.writeInterfaceToken(IActivityManager.descriptor);
3002 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3003 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003004 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003005 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3006 reply.readException();
3007 data.recycle();
3008 reply.recycle();
3009 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003010 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3011 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003012 {
3013 Parcel data = Parcel.obtain();
3014 Parcel reply = Parcel.obtain();
3015 data.writeInterfaceToken(IActivityManager.descriptor);
3016 data.writeStrongBinder(who);
3017 data.writeInt(resultCode);
3018 data.writeString(resultData);
3019 data.writeBundle(map);
3020 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003021 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003022 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3023 reply.readException();
3024 data.recycle();
3025 reply.recycle();
3026 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003027 public void attachApplication(IApplicationThread app) throws RemoteException
3028 {
3029 Parcel data = Parcel.obtain();
3030 Parcel reply = Parcel.obtain();
3031 data.writeInterfaceToken(IActivityManager.descriptor);
3032 data.writeStrongBinder(app.asBinder());
3033 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3034 reply.readException();
3035 data.recycle();
3036 reply.recycle();
3037 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003038 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3039 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003040 {
3041 Parcel data = Parcel.obtain();
3042 Parcel reply = Parcel.obtain();
3043 data.writeInterfaceToken(IActivityManager.descriptor);
3044 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003045 if (config != null) {
3046 data.writeInt(1);
3047 config.writeToParcel(data, 0);
3048 } else {
3049 data.writeInt(0);
3050 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003051 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003052 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3053 reply.readException();
3054 data.recycle();
3055 reply.recycle();
3056 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003057 public void activityResumed(IBinder token) throws RemoteException
3058 {
3059 Parcel data = Parcel.obtain();
3060 Parcel reply = Parcel.obtain();
3061 data.writeInterfaceToken(IActivityManager.descriptor);
3062 data.writeStrongBinder(token);
3063 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3064 reply.readException();
3065 data.recycle();
3066 reply.recycle();
3067 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003068 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003069 {
3070 Parcel data = Parcel.obtain();
3071 Parcel reply = Parcel.obtain();
3072 data.writeInterfaceToken(IActivityManager.descriptor);
3073 data.writeStrongBinder(token);
3074 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 data.recycle();
3077 reply.recycle();
3078 }
3079 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003080 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003081 {
3082 Parcel data = Parcel.obtain();
3083 Parcel reply = Parcel.obtain();
3084 data.writeInterfaceToken(IActivityManager.descriptor);
3085 data.writeStrongBinder(token);
3086 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003087 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003088 TextUtils.writeToParcel(description, data, 0);
3089 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3090 reply.readException();
3091 data.recycle();
3092 reply.recycle();
3093 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003094 public void activitySlept(IBinder token) throws RemoteException
3095 {
3096 Parcel data = Parcel.obtain();
3097 Parcel reply = Parcel.obtain();
3098 data.writeInterfaceToken(IActivityManager.descriptor);
3099 data.writeStrongBinder(token);
3100 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3101 reply.readException();
3102 data.recycle();
3103 reply.recycle();
3104 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003105 public void activityDestroyed(IBinder token) throws RemoteException
3106 {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeStrongBinder(token);
3111 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3112 reply.readException();
3113 data.recycle();
3114 reply.recycle();
3115 }
3116 public String getCallingPackage(IBinder token) throws RemoteException
3117 {
3118 Parcel data = Parcel.obtain();
3119 Parcel reply = Parcel.obtain();
3120 data.writeInterfaceToken(IActivityManager.descriptor);
3121 data.writeStrongBinder(token);
3122 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3123 reply.readException();
3124 String res = reply.readString();
3125 data.recycle();
3126 reply.recycle();
3127 return res;
3128 }
3129 public ComponentName getCallingActivity(IBinder token)
3130 throws RemoteException {
3131 Parcel data = Parcel.obtain();
3132 Parcel reply = Parcel.obtain();
3133 data.writeInterfaceToken(IActivityManager.descriptor);
3134 data.writeStrongBinder(token);
3135 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3136 reply.readException();
3137 ComponentName res = ComponentName.readFromParcel(reply);
3138 data.recycle();
3139 reply.recycle();
3140 return res;
3141 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003142 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003143 Parcel data = Parcel.obtain();
3144 Parcel reply = Parcel.obtain();
3145 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003146 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003147 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3148 reply.readException();
3149 ArrayList<IAppTask> list = null;
3150 int N = reply.readInt();
3151 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003152 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003153 while (N > 0) {
3154 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3155 list.add(task);
3156 N--;
3157 }
3158 }
3159 data.recycle();
3160 reply.recycle();
3161 return list;
3162 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003163 public int addAppTask(IBinder activityToken, Intent intent,
3164 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 data.writeStrongBinder(activityToken);
3169 intent.writeToParcel(data, 0);
3170 description.writeToParcel(data, 0);
3171 thumbnail.writeToParcel(data, 0);
3172 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3173 reply.readException();
3174 int res = reply.readInt();
3175 data.recycle();
3176 reply.recycle();
3177 return res;
3178 }
3179 public Point getAppTaskThumbnailSize() throws RemoteException {
3180 Parcel data = Parcel.obtain();
3181 Parcel reply = Parcel.obtain();
3182 data.writeInterfaceToken(IActivityManager.descriptor);
3183 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3184 reply.readException();
3185 Point size = Point.CREATOR.createFromParcel(reply);
3186 data.recycle();
3187 reply.recycle();
3188 return size;
3189 }
Todd Kennedye635f662015-01-20 10:36:49 -08003190 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3191 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003192 Parcel data = Parcel.obtain();
3193 Parcel reply = Parcel.obtain();
3194 data.writeInterfaceToken(IActivityManager.descriptor);
3195 data.writeInt(maxNum);
3196 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003197 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3198 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003199 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003200 int N = reply.readInt();
3201 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003202 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003203 while (N > 0) {
3204 ActivityManager.RunningTaskInfo info =
3205 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003206 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 list.add(info);
3208 N--;
3209 }
3210 }
3211 data.recycle();
3212 reply.recycle();
3213 return list;
3214 }
3215 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003216 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003217 Parcel data = Parcel.obtain();
3218 Parcel reply = Parcel.obtain();
3219 data.writeInterfaceToken(IActivityManager.descriptor);
3220 data.writeInt(maxNum);
3221 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003222 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003223 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3224 reply.readException();
3225 ArrayList<ActivityManager.RecentTaskInfo> list
3226 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3227 data.recycle();
3228 reply.recycle();
3229 return list;
3230 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003231 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003232 Parcel data = Parcel.obtain();
3233 Parcel reply = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003236 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003237 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003238 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003239 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003240 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003241 }
3242 data.recycle();
3243 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003244 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003245 }
Todd Kennedye635f662015-01-20 10:36:49 -08003246 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3247 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeInt(maxNum);
3252 data.writeInt(flags);
3253 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3254 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003255 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003256 int N = reply.readInt();
3257 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003258 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003259 while (N > 0) {
3260 ActivityManager.RunningServiceInfo info =
3261 ActivityManager.RunningServiceInfo.CREATOR
3262 .createFromParcel(reply);
3263 list.add(info);
3264 N--;
3265 }
3266 }
3267 data.recycle();
3268 reply.recycle();
3269 return list;
3270 }
3271 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3272 throws RemoteException {
3273 Parcel data = Parcel.obtain();
3274 Parcel reply = Parcel.obtain();
3275 data.writeInterfaceToken(IActivityManager.descriptor);
3276 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3277 reply.readException();
3278 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3279 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3280 data.recycle();
3281 reply.recycle();
3282 return list;
3283 }
3284 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3285 throws RemoteException {
3286 Parcel data = Parcel.obtain();
3287 Parcel reply = Parcel.obtain();
3288 data.writeInterfaceToken(IActivityManager.descriptor);
3289 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3290 reply.readException();
3291 ArrayList<ActivityManager.RunningAppProcessInfo> list
3292 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3293 data.recycle();
3294 reply.recycle();
3295 return list;
3296 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003297 public List<ApplicationInfo> getRunningExternalApplications()
3298 throws RemoteException {
3299 Parcel data = Parcel.obtain();
3300 Parcel reply = Parcel.obtain();
3301 data.writeInterfaceToken(IActivityManager.descriptor);
3302 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3303 reply.readException();
3304 ArrayList<ApplicationInfo> list
3305 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3306 data.recycle();
3307 reply.recycle();
3308 return list;
3309 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003310 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003311 {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003316 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003317 if (options != null) {
3318 data.writeInt(1);
3319 options.writeToParcel(data, 0);
3320 } else {
3321 data.writeInt(0);
3322 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003323 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3324 reply.readException();
3325 data.recycle();
3326 reply.recycle();
3327 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003328 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3329 throws RemoteException {
3330 Parcel data = Parcel.obtain();
3331 Parcel reply = Parcel.obtain();
3332 data.writeInterfaceToken(IActivityManager.descriptor);
3333 data.writeStrongBinder(token);
3334 data.writeInt(nonRoot ? 1 : 0);
3335 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3336 reply.readException();
3337 boolean res = reply.readInt() != 0;
3338 data.recycle();
3339 reply.recycle();
3340 return res;
3341 }
3342 public void moveTaskBackwards(int task) throws RemoteException
3343 {
3344 Parcel data = Parcel.obtain();
3345 Parcel reply = Parcel.obtain();
3346 data.writeInterfaceToken(IActivityManager.descriptor);
3347 data.writeInt(task);
3348 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3349 reply.readException();
3350 data.recycle();
3351 reply.recycle();
3352 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003353 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003354 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3355 {
3356 Parcel data = Parcel.obtain();
3357 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003358 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003359 data.writeInt(taskId);
3360 data.writeInt(stackId);
3361 data.writeInt(toTop ? 1 : 0);
3362 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 data.recycle();
3365 reply.recycle();
3366 }
3367 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003368 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003369 {
3370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003372 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003373 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003374 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003375 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003376 reply.readException();
3377 data.recycle();
3378 reply.recycle();
3379 }
Craig Mautner967212c2013-04-13 21:10:58 -07003380 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003381 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003382 {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003386 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003387 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003388 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003389 data.recycle();
3390 reply.recycle();
3391 return list;
3392 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003393 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003394 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003395 {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003399 data.writeInt(stackId);
3400 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003401 reply.readException();
3402 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003403 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003404 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003405 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003406 }
3407 data.recycle();
3408 reply.recycle();
3409 return info;
3410 }
3411 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003412 public boolean isInHomeStack(int taskId) throws RemoteException {
3413 Parcel data = Parcel.obtain();
3414 Parcel reply = Parcel.obtain();
3415 data.writeInterfaceToken(IActivityManager.descriptor);
3416 data.writeInt(taskId);
3417 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3418 reply.readException();
3419 boolean isInHomeStack = reply.readInt() > 0;
3420 data.recycle();
3421 reply.recycle();
3422 return isInHomeStack;
3423 }
3424 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003425 public void setFocusedStack(int stackId) throws RemoteException
3426 {
3427 Parcel data = Parcel.obtain();
3428 Parcel reply = Parcel.obtain();
3429 data.writeInterfaceToken(IActivityManager.descriptor);
3430 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003431 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003432 reply.readException();
3433 data.recycle();
3434 reply.recycle();
3435 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003436 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003437 public int getFocusedStackId() throws RemoteException {
3438 Parcel data = Parcel.obtain();
3439 Parcel reply = Parcel.obtain();
3440 data.writeInterfaceToken(IActivityManager.descriptor);
3441 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3442 reply.readException();
3443 int focusedStackId = reply.readInt();
3444 data.recycle();
3445 reply.recycle();
3446 return focusedStackId;
3447 }
3448 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003449 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3450 {
3451 Parcel data = Parcel.obtain();
3452 Parcel reply = Parcel.obtain();
3453 data.writeInterfaceToken(IActivityManager.descriptor);
3454 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003455 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003456 reply.readException();
3457 data.recycle();
3458 reply.recycle();
3459 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3461 {
3462 Parcel data = Parcel.obtain();
3463 Parcel reply = Parcel.obtain();
3464 data.writeInterfaceToken(IActivityManager.descriptor);
3465 data.writeStrongBinder(token);
3466 data.writeInt(onlyRoot ? 1 : 0);
3467 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 int res = reply.readInt();
3470 data.recycle();
3471 reply.recycle();
3472 return res;
3473 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003474 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003475 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3480 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003481 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003482 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003483 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3484 reply.readException();
3485 int res = reply.readInt();
3486 ContentProviderHolder cph = null;
3487 if (res != 0) {
3488 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3489 }
3490 data.recycle();
3491 reply.recycle();
3492 return cph;
3493 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003494 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3495 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003496 Parcel data = Parcel.obtain();
3497 Parcel reply = Parcel.obtain();
3498 data.writeInterfaceToken(IActivityManager.descriptor);
3499 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003500 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003501 data.writeStrongBinder(token);
3502 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3503 reply.readException();
3504 int res = reply.readInt();
3505 ContentProviderHolder cph = null;
3506 if (res != 0) {
3507 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3508 }
3509 data.recycle();
3510 reply.recycle();
3511 return cph;
3512 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003513 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003514 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003515 {
3516 Parcel data = Parcel.obtain();
3517 Parcel reply = Parcel.obtain();
3518 data.writeInterfaceToken(IActivityManager.descriptor);
3519 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3520 data.writeTypedList(providers);
3521 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3522 reply.readException();
3523 data.recycle();
3524 reply.recycle();
3525 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003526 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3527 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003528 Parcel data = Parcel.obtain();
3529 Parcel reply = Parcel.obtain();
3530 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003531 data.writeStrongBinder(connection);
3532 data.writeInt(stable);
3533 data.writeInt(unstable);
3534 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3535 reply.readException();
3536 boolean res = reply.readInt() != 0;
3537 data.recycle();
3538 reply.recycle();
3539 return res;
3540 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003541
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003542 public void unstableProviderDied(IBinder connection) throws RemoteException {
3543 Parcel data = Parcel.obtain();
3544 Parcel reply = Parcel.obtain();
3545 data.writeInterfaceToken(IActivityManager.descriptor);
3546 data.writeStrongBinder(connection);
3547 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3548 reply.readException();
3549 data.recycle();
3550 reply.recycle();
3551 }
3552
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003553 @Override
3554 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3555 Parcel data = Parcel.obtain();
3556 Parcel reply = Parcel.obtain();
3557 data.writeInterfaceToken(IActivityManager.descriptor);
3558 data.writeStrongBinder(connection);
3559 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3560 reply.readException();
3561 data.recycle();
3562 reply.recycle();
3563 }
3564
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003565 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeStrongBinder(connection);
3570 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003571 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3572 reply.readException();
3573 data.recycle();
3574 reply.recycle();
3575 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003576
3577 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3578 Parcel data = Parcel.obtain();
3579 Parcel reply = Parcel.obtain();
3580 data.writeInterfaceToken(IActivityManager.descriptor);
3581 data.writeString(name);
3582 data.writeStrongBinder(token);
3583 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3584 reply.readException();
3585 data.recycle();
3586 reply.recycle();
3587 }
3588
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003589 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3590 throws RemoteException
3591 {
3592 Parcel data = Parcel.obtain();
3593 Parcel reply = Parcel.obtain();
3594 data.writeInterfaceToken(IActivityManager.descriptor);
3595 service.writeToParcel(data, 0);
3596 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3597 reply.readException();
3598 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3599 data.recycle();
3600 reply.recycle();
3601 return res;
3602 }
3603
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003604 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003605 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 {
3607 Parcel data = Parcel.obtain();
3608 Parcel reply = Parcel.obtain();
3609 data.writeInterfaceToken(IActivityManager.descriptor);
3610 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3611 service.writeToParcel(data, 0);
3612 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003613 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003614 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3615 reply.readException();
3616 ComponentName res = ComponentName.readFromParcel(reply);
3617 data.recycle();
3618 reply.recycle();
3619 return res;
3620 }
3621 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003622 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003623 {
3624 Parcel data = Parcel.obtain();
3625 Parcel reply = Parcel.obtain();
3626 data.writeInterfaceToken(IActivityManager.descriptor);
3627 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3628 service.writeToParcel(data, 0);
3629 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003630 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003631 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3632 reply.readException();
3633 int res = reply.readInt();
3634 reply.recycle();
3635 data.recycle();
3636 return res;
3637 }
3638 public boolean stopServiceToken(ComponentName className, IBinder token,
3639 int startId) throws RemoteException {
3640 Parcel data = Parcel.obtain();
3641 Parcel reply = Parcel.obtain();
3642 data.writeInterfaceToken(IActivityManager.descriptor);
3643 ComponentName.writeToParcel(className, data);
3644 data.writeStrongBinder(token);
3645 data.writeInt(startId);
3646 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 boolean res = reply.readInt() != 0;
3649 data.recycle();
3650 reply.recycle();
3651 return res;
3652 }
3653 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003654 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003655 Parcel data = Parcel.obtain();
3656 Parcel reply = Parcel.obtain();
3657 data.writeInterfaceToken(IActivityManager.descriptor);
3658 ComponentName.writeToParcel(className, data);
3659 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003660 data.writeInt(id);
3661 if (notification != null) {
3662 data.writeInt(1);
3663 notification.writeToParcel(data, 0);
3664 } else {
3665 data.writeInt(0);
3666 }
3667 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003668 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3669 reply.readException();
3670 data.recycle();
3671 reply.recycle();
3672 }
3673 public int bindService(IApplicationThread caller, IBinder token,
3674 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003675 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003676 Parcel data = Parcel.obtain();
3677 Parcel reply = Parcel.obtain();
3678 data.writeInterfaceToken(IActivityManager.descriptor);
3679 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3680 data.writeStrongBinder(token);
3681 service.writeToParcel(data, 0);
3682 data.writeString(resolvedType);
3683 data.writeStrongBinder(connection.asBinder());
3684 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003685 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003686 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3687 reply.readException();
3688 int res = reply.readInt();
3689 data.recycle();
3690 reply.recycle();
3691 return res;
3692 }
3693 public boolean unbindService(IServiceConnection connection) throws RemoteException
3694 {
3695 Parcel data = Parcel.obtain();
3696 Parcel reply = Parcel.obtain();
3697 data.writeInterfaceToken(IActivityManager.descriptor);
3698 data.writeStrongBinder(connection.asBinder());
3699 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3700 reply.readException();
3701 boolean res = reply.readInt() != 0;
3702 data.recycle();
3703 reply.recycle();
3704 return res;
3705 }
3706
3707 public void publishService(IBinder token,
3708 Intent intent, IBinder service) throws RemoteException {
3709 Parcel data = Parcel.obtain();
3710 Parcel reply = Parcel.obtain();
3711 data.writeInterfaceToken(IActivityManager.descriptor);
3712 data.writeStrongBinder(token);
3713 intent.writeToParcel(data, 0);
3714 data.writeStrongBinder(service);
3715 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3716 reply.readException();
3717 data.recycle();
3718 reply.recycle();
3719 }
3720
3721 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3722 throws RemoteException {
3723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 data.writeStrongBinder(token);
3727 intent.writeToParcel(data, 0);
3728 data.writeInt(doRebind ? 1 : 0);
3729 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3730 reply.readException();
3731 data.recycle();
3732 reply.recycle();
3733 }
3734
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003735 public void serviceDoneExecuting(IBinder token, int type, int startId,
3736 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003741 data.writeInt(type);
3742 data.writeInt(startId);
3743 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003744 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3745 reply.readException();
3746 data.recycle();
3747 reply.recycle();
3748 }
3749
3750 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 service.writeToParcel(data, 0);
3755 data.writeString(resolvedType);
3756 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3757 reply.readException();
3758 IBinder binder = reply.readStrongBinder();
3759 reply.recycle();
3760 data.recycle();
3761 return binder;
3762 }
3763
Christopher Tate181fafa2009-05-14 11:12:14 -07003764 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3765 throws RemoteException {
3766 Parcel data = Parcel.obtain();
3767 Parcel reply = Parcel.obtain();
3768 data.writeInterfaceToken(IActivityManager.descriptor);
3769 app.writeToParcel(data, 0);
3770 data.writeInt(backupRestoreMode);
3771 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3772 reply.readException();
3773 boolean success = reply.readInt() != 0;
3774 reply.recycle();
3775 data.recycle();
3776 return success;
3777 }
3778
Christopher Tate346acb12012-10-15 19:20:25 -07003779 public void clearPendingBackup() throws RemoteException {
3780 Parcel data = Parcel.obtain();
3781 Parcel reply = Parcel.obtain();
3782 data.writeInterfaceToken(IActivityManager.descriptor);
3783 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3784 reply.recycle();
3785 data.recycle();
3786 }
3787
Christopher Tate181fafa2009-05-14 11:12:14 -07003788 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3789 Parcel data = Parcel.obtain();
3790 Parcel reply = Parcel.obtain();
3791 data.writeInterfaceToken(IActivityManager.descriptor);
3792 data.writeString(packageName);
3793 data.writeStrongBinder(agent);
3794 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3795 reply.recycle();
3796 data.recycle();
3797 }
3798
3799 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3800 Parcel data = Parcel.obtain();
3801 Parcel reply = Parcel.obtain();
3802 data.writeInterfaceToken(IActivityManager.descriptor);
3803 app.writeToParcel(data, 0);
3804 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3805 reply.readException();
3806 reply.recycle();
3807 data.recycle();
3808 }
3809
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003810 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003811 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003812 IUiAutomationConnection connection, int userId, String instructionSet)
3813 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003814 Parcel data = Parcel.obtain();
3815 Parcel reply = Parcel.obtain();
3816 data.writeInterfaceToken(IActivityManager.descriptor);
3817 ComponentName.writeToParcel(className, data);
3818 data.writeString(profileFile);
3819 data.writeInt(flags);
3820 data.writeBundle(arguments);
3821 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003822 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003823 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003824 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003825 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3826 reply.readException();
3827 boolean res = reply.readInt() != 0;
3828 reply.recycle();
3829 data.recycle();
3830 return res;
3831 }
3832
3833 public void finishInstrumentation(IApplicationThread target,
3834 int resultCode, Bundle results) throws RemoteException {
3835 Parcel data = Parcel.obtain();
3836 Parcel reply = Parcel.obtain();
3837 data.writeInterfaceToken(IActivityManager.descriptor);
3838 data.writeStrongBinder(target != null ? target.asBinder() : null);
3839 data.writeInt(resultCode);
3840 data.writeBundle(results);
3841 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 data.recycle();
3844 reply.recycle();
3845 }
3846 public Configuration getConfiguration() throws RemoteException
3847 {
3848 Parcel data = Parcel.obtain();
3849 Parcel reply = Parcel.obtain();
3850 data.writeInterfaceToken(IActivityManager.descriptor);
3851 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3852 reply.readException();
3853 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3854 reply.recycle();
3855 data.recycle();
3856 return res;
3857 }
3858 public void updateConfiguration(Configuration values) throws RemoteException
3859 {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 values.writeToParcel(data, 0);
3864 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 data.recycle();
3867 reply.recycle();
3868 }
3869 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3870 throws RemoteException {
3871 Parcel data = Parcel.obtain();
3872 Parcel reply = Parcel.obtain();
3873 data.writeInterfaceToken(IActivityManager.descriptor);
3874 data.writeStrongBinder(token);
3875 data.writeInt(requestedOrientation);
3876 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3877 reply.readException();
3878 data.recycle();
3879 reply.recycle();
3880 }
3881 public int getRequestedOrientation(IBinder token) throws RemoteException {
3882 Parcel data = Parcel.obtain();
3883 Parcel reply = Parcel.obtain();
3884 data.writeInterfaceToken(IActivityManager.descriptor);
3885 data.writeStrongBinder(token);
3886 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3887 reply.readException();
3888 int res = reply.readInt();
3889 data.recycle();
3890 reply.recycle();
3891 return res;
3892 }
3893 public ComponentName getActivityClassForToken(IBinder token)
3894 throws RemoteException {
3895 Parcel data = Parcel.obtain();
3896 Parcel reply = Parcel.obtain();
3897 data.writeInterfaceToken(IActivityManager.descriptor);
3898 data.writeStrongBinder(token);
3899 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3900 reply.readException();
3901 ComponentName res = ComponentName.readFromParcel(reply);
3902 data.recycle();
3903 reply.recycle();
3904 return res;
3905 }
3906 public String getPackageForToken(IBinder token) throws RemoteException
3907 {
3908 Parcel data = Parcel.obtain();
3909 Parcel reply = Parcel.obtain();
3910 data.writeInterfaceToken(IActivityManager.descriptor);
3911 data.writeStrongBinder(token);
3912 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3913 reply.readException();
3914 String res = reply.readString();
3915 data.recycle();
3916 reply.recycle();
3917 return res;
3918 }
3919 public IIntentSender getIntentSender(int type,
3920 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003921 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003922 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003923 Parcel data = Parcel.obtain();
3924 Parcel reply = Parcel.obtain();
3925 data.writeInterfaceToken(IActivityManager.descriptor);
3926 data.writeInt(type);
3927 data.writeString(packageName);
3928 data.writeStrongBinder(token);
3929 data.writeString(resultWho);
3930 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003931 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003932 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003933 data.writeTypedArray(intents, 0);
3934 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003935 } else {
3936 data.writeInt(0);
3937 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003938 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003939 if (options != null) {
3940 data.writeInt(1);
3941 options.writeToParcel(data, 0);
3942 } else {
3943 data.writeInt(0);
3944 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003945 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003946 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3947 reply.readException();
3948 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003949 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003950 data.recycle();
3951 reply.recycle();
3952 return res;
3953 }
3954 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3955 Parcel data = Parcel.obtain();
3956 Parcel reply = Parcel.obtain();
3957 data.writeInterfaceToken(IActivityManager.descriptor);
3958 data.writeStrongBinder(sender.asBinder());
3959 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3960 reply.readException();
3961 data.recycle();
3962 reply.recycle();
3963 }
3964 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3965 Parcel data = Parcel.obtain();
3966 Parcel reply = Parcel.obtain();
3967 data.writeInterfaceToken(IActivityManager.descriptor);
3968 data.writeStrongBinder(sender.asBinder());
3969 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3970 reply.readException();
3971 String res = reply.readString();
3972 data.recycle();
3973 reply.recycle();
3974 return res;
3975 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003976 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 data.writeStrongBinder(sender.asBinder());
3981 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3982 reply.readException();
3983 int res = reply.readInt();
3984 data.recycle();
3985 reply.recycle();
3986 return res;
3987 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003988 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3989 boolean requireFull, String name, String callerPackage) throws RemoteException {
3990 Parcel data = Parcel.obtain();
3991 Parcel reply = Parcel.obtain();
3992 data.writeInterfaceToken(IActivityManager.descriptor);
3993 data.writeInt(callingPid);
3994 data.writeInt(callingUid);
3995 data.writeInt(userId);
3996 data.writeInt(allowAll ? 1 : 0);
3997 data.writeInt(requireFull ? 1 : 0);
3998 data.writeString(name);
3999 data.writeString(callerPackage);
4000 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4001 reply.readException();
4002 int res = reply.readInt();
4003 data.recycle();
4004 reply.recycle();
4005 return res;
4006 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004007 public void setProcessLimit(int max) throws RemoteException
4008 {
4009 Parcel data = Parcel.obtain();
4010 Parcel reply = Parcel.obtain();
4011 data.writeInterfaceToken(IActivityManager.descriptor);
4012 data.writeInt(max);
4013 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4014 reply.readException();
4015 data.recycle();
4016 reply.recycle();
4017 }
4018 public int getProcessLimit() throws RemoteException
4019 {
4020 Parcel data = Parcel.obtain();
4021 Parcel reply = Parcel.obtain();
4022 data.writeInterfaceToken(IActivityManager.descriptor);
4023 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4024 reply.readException();
4025 int res = reply.readInt();
4026 data.recycle();
4027 reply.recycle();
4028 return res;
4029 }
4030 public void setProcessForeground(IBinder token, int pid,
4031 boolean isForeground) throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 data.writeStrongBinder(token);
4036 data.writeInt(pid);
4037 data.writeInt(isForeground ? 1 : 0);
4038 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4039 reply.readException();
4040 data.recycle();
4041 reply.recycle();
4042 }
4043 public int checkPermission(String permission, int pid, int uid)
4044 throws RemoteException {
4045 Parcel data = Parcel.obtain();
4046 Parcel reply = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 data.writeString(permission);
4049 data.writeInt(pid);
4050 data.writeInt(uid);
4051 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4052 reply.readException();
4053 int res = reply.readInt();
4054 data.recycle();
4055 reply.recycle();
4056 return res;
4057 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004058 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4059 throws RemoteException {
4060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeString(permission);
4064 data.writeInt(pid);
4065 data.writeInt(uid);
4066 data.writeStrongBinder(callerToken);
4067 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4068 reply.readException();
4069 int res = reply.readInt();
4070 data.recycle();
4071 reply.recycle();
4072 return res;
4073 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004074 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004075 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004076 Parcel data = Parcel.obtain();
4077 Parcel reply = Parcel.obtain();
4078 data.writeInterfaceToken(IActivityManager.descriptor);
4079 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004080 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004081 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004082 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4083 reply.readException();
4084 boolean res = reply.readInt() != 0;
4085 data.recycle();
4086 reply.recycle();
4087 return res;
4088 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004089 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4090 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004091 Parcel data = Parcel.obtain();
4092 Parcel reply = Parcel.obtain();
4093 data.writeInterfaceToken(IActivityManager.descriptor);
4094 uri.writeToParcel(data, 0);
4095 data.writeInt(pid);
4096 data.writeInt(uid);
4097 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004098 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004099 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004100 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4101 reply.readException();
4102 int res = reply.readInt();
4103 data.recycle();
4104 reply.recycle();
4105 return res;
4106 }
4107 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004108 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004109 Parcel data = Parcel.obtain();
4110 Parcel reply = Parcel.obtain();
4111 data.writeInterfaceToken(IActivityManager.descriptor);
4112 data.writeStrongBinder(caller.asBinder());
4113 data.writeString(targetPkg);
4114 uri.writeToParcel(data, 0);
4115 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004116 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4118 reply.readException();
4119 data.recycle();
4120 reply.recycle();
4121 }
4122 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004123 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004124 Parcel data = Parcel.obtain();
4125 Parcel reply = Parcel.obtain();
4126 data.writeInterfaceToken(IActivityManager.descriptor);
4127 data.writeStrongBinder(caller.asBinder());
4128 uri.writeToParcel(data, 0);
4129 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004130 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004131 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4132 reply.readException();
4133 data.recycle();
4134 reply.recycle();
4135 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004136
4137 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004138 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4139 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004140 Parcel data = Parcel.obtain();
4141 Parcel reply = Parcel.obtain();
4142 data.writeInterfaceToken(IActivityManager.descriptor);
4143 uri.writeToParcel(data, 0);
4144 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004145 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004146 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 data.recycle();
4149 reply.recycle();
4150 }
4151
4152 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004153 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4154 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 uri.writeToParcel(data, 0);
4159 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004160 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004161 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4162 reply.readException();
4163 data.recycle();
4164 reply.recycle();
4165 }
4166
4167 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004168 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4169 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004170 Parcel data = Parcel.obtain();
4171 Parcel reply = Parcel.obtain();
4172 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004173 data.writeString(packageName);
4174 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004175 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4176 reply.readException();
4177 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4178 reply);
4179 data.recycle();
4180 reply.recycle();
4181 return perms;
4182 }
4183
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004184 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4185 throws RemoteException {
4186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 data.writeStrongBinder(who.asBinder());
4190 data.writeInt(waiting ? 1 : 0);
4191 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4192 reply.readException();
4193 data.recycle();
4194 reply.recycle();
4195 }
4196 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4197 Parcel data = Parcel.obtain();
4198 Parcel reply = Parcel.obtain();
4199 data.writeInterfaceToken(IActivityManager.descriptor);
4200 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4201 reply.readException();
4202 outInfo.readFromParcel(reply);
4203 data.recycle();
4204 reply.recycle();
4205 }
4206 public void unhandledBack() throws RemoteException
4207 {
4208 Parcel data = Parcel.obtain();
4209 Parcel reply = Parcel.obtain();
4210 data.writeInterfaceToken(IActivityManager.descriptor);
4211 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4212 reply.readException();
4213 data.recycle();
4214 reply.recycle();
4215 }
4216 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4217 {
4218 Parcel data = Parcel.obtain();
4219 Parcel reply = Parcel.obtain();
4220 data.writeInterfaceToken(IActivityManager.descriptor);
4221 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4222 reply.readException();
4223 ParcelFileDescriptor pfd = null;
4224 if (reply.readInt() != 0) {
4225 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4226 }
4227 data.recycle();
4228 reply.recycle();
4229 return pfd;
4230 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004231 public void setLockScreenShown(boolean shown) throws RemoteException
4232 {
4233 Parcel data = Parcel.obtain();
4234 Parcel reply = Parcel.obtain();
4235 data.writeInterfaceToken(IActivityManager.descriptor);
4236 data.writeInt(shown ? 1 : 0);
4237 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4238 reply.readException();
4239 data.recycle();
4240 reply.recycle();
4241 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004242 public void setDebugApp(
4243 String packageName, boolean waitForDebugger, boolean persistent)
4244 throws RemoteException
4245 {
4246 Parcel data = Parcel.obtain();
4247 Parcel reply = Parcel.obtain();
4248 data.writeInterfaceToken(IActivityManager.descriptor);
4249 data.writeString(packageName);
4250 data.writeInt(waitForDebugger ? 1 : 0);
4251 data.writeInt(persistent ? 1 : 0);
4252 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4253 reply.readException();
4254 data.recycle();
4255 reply.recycle();
4256 }
4257 public void setAlwaysFinish(boolean enabled) throws RemoteException
4258 {
4259 Parcel data = Parcel.obtain();
4260 Parcel reply = Parcel.obtain();
4261 data.writeInterfaceToken(IActivityManager.descriptor);
4262 data.writeInt(enabled ? 1 : 0);
4263 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4264 reply.readException();
4265 data.recycle();
4266 reply.recycle();
4267 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004268 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004269 {
4270 Parcel data = Parcel.obtain();
4271 Parcel reply = Parcel.obtain();
4272 data.writeInterfaceToken(IActivityManager.descriptor);
4273 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004274 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004275 reply.readException();
4276 data.recycle();
4277 reply.recycle();
4278 }
4279 public void enterSafeMode() throws RemoteException {
4280 Parcel data = Parcel.obtain();
4281 data.writeInterfaceToken(IActivityManager.descriptor);
4282 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4283 data.recycle();
4284 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004285 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004286 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004287 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004288 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004289 data.writeStrongBinder(sender.asBinder());
4290 data.writeInt(sourceUid);
4291 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004292 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004293 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4294 data.recycle();
4295 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004296 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4297 throws RemoteException {
4298 Parcel data = Parcel.obtain();
4299 data.writeInterfaceToken(IActivityManager.descriptor);
4300 data.writeStrongBinder(sender.asBinder());
4301 data.writeInt(sourceUid);
4302 data.writeString(tag);
4303 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4304 data.recycle();
4305 }
4306 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4307 throws RemoteException {
4308 Parcel data = Parcel.obtain();
4309 data.writeInterfaceToken(IActivityManager.descriptor);
4310 data.writeStrongBinder(sender.asBinder());
4311 data.writeInt(sourceUid);
4312 data.writeString(tag);
4313 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4314 data.recycle();
4315 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004316 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004317 Parcel data = Parcel.obtain();
4318 Parcel reply = Parcel.obtain();
4319 data.writeInterfaceToken(IActivityManager.descriptor);
4320 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004321 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004322 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004323 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004324 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004325 boolean res = reply.readInt() != 0;
4326 data.recycle();
4327 reply.recycle();
4328 return res;
4329 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004330 @Override
4331 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4332 Parcel data = Parcel.obtain();
4333 Parcel reply = Parcel.obtain();
4334 data.writeInterfaceToken(IActivityManager.descriptor);
4335 data.writeString(reason);
4336 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4337 boolean res = reply.readInt() != 0;
4338 data.recycle();
4339 reply.recycle();
4340 return res;
4341 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004342 public boolean testIsSystemReady()
4343 {
4344 /* this base class version is never called */
4345 return true;
4346 }
Dan Egnor60d87622009-12-16 16:32:58 -08004347 public void handleApplicationCrash(IBinder app,
4348 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4349 {
4350 Parcel data = Parcel.obtain();
4351 Parcel reply = Parcel.obtain();
4352 data.writeInterfaceToken(IActivityManager.descriptor);
4353 data.writeStrongBinder(app);
4354 crashInfo.writeToParcel(data, 0);
4355 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4356 reply.readException();
4357 reply.recycle();
4358 data.recycle();
4359 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004360
Dianne Hackborn52322712014-08-26 22:47:26 -07004361 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004362 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004363 {
4364 Parcel data = Parcel.obtain();
4365 Parcel reply = Parcel.obtain();
4366 data.writeInterfaceToken(IActivityManager.descriptor);
4367 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004368 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004369 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004370 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004371 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004372 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004373 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004374 reply.recycle();
4375 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004376 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004377 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004378
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004379 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004380 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004381 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004382 {
4383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004387 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004388 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004389 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4390 reply.readException();
4391 reply.recycle();
4392 data.recycle();
4393 }
4394
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004395 public void signalPersistentProcesses(int sig) throws RemoteException {
4396 Parcel data = Parcel.obtain();
4397 Parcel reply = Parcel.obtain();
4398 data.writeInterfaceToken(IActivityManager.descriptor);
4399 data.writeInt(sig);
4400 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4401 reply.readException();
4402 data.recycle();
4403 reply.recycle();
4404 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004405
Dianne Hackborn1676c852012-09-10 14:52:30 -07004406 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004407 Parcel data = Parcel.obtain();
4408 Parcel reply = Parcel.obtain();
4409 data.writeInterfaceToken(IActivityManager.descriptor);
4410 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004411 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004412 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4413 reply.readException();
4414 data.recycle();
4415 reply.recycle();
4416 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004417
4418 public void killAllBackgroundProcesses() throws RemoteException {
4419 Parcel data = Parcel.obtain();
4420 Parcel reply = Parcel.obtain();
4421 data.writeInterfaceToken(IActivityManager.descriptor);
4422 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4423 reply.readException();
4424 data.recycle();
4425 reply.recycle();
4426 }
4427
Dianne Hackborn1676c852012-09-10 14:52:30 -07004428 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004429 Parcel data = Parcel.obtain();
4430 Parcel reply = Parcel.obtain();
4431 data.writeInterfaceToken(IActivityManager.descriptor);
4432 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004433 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004434 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004435 reply.readException();
4436 data.recycle();
4437 reply.recycle();
4438 }
4439
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004440 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4441 throws RemoteException
4442 {
4443 Parcel data = Parcel.obtain();
4444 Parcel reply = Parcel.obtain();
4445 data.writeInterfaceToken(IActivityManager.descriptor);
4446 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4447 reply.readException();
4448 outInfo.readFromParcel(reply);
4449 reply.recycle();
4450 data.recycle();
4451 }
4452
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004453 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4454 {
4455 Parcel data = Parcel.obtain();
4456 Parcel reply = Parcel.obtain();
4457 data.writeInterfaceToken(IActivityManager.descriptor);
4458 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4459 reply.readException();
4460 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4461 reply.recycle();
4462 data.recycle();
4463 return res;
4464 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004465
Dianne Hackborn1676c852012-09-10 14:52:30 -07004466 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004467 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004468 {
4469 Parcel data = Parcel.obtain();
4470 Parcel reply = Parcel.obtain();
4471 data.writeInterfaceToken(IActivityManager.descriptor);
4472 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004473 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004474 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004475 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004476 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004477 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004478 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004479 } else {
4480 data.writeInt(0);
4481 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004482 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4483 reply.readException();
4484 boolean res = reply.readInt() != 0;
4485 reply.recycle();
4486 data.recycle();
4487 return res;
4488 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004489
Dianne Hackborn55280a92009-05-07 15:53:46 -07004490 public boolean shutdown(int timeout) throws RemoteException
4491 {
4492 Parcel data = Parcel.obtain();
4493 Parcel reply = Parcel.obtain();
4494 data.writeInterfaceToken(IActivityManager.descriptor);
4495 data.writeInt(timeout);
4496 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4497 reply.readException();
4498 boolean res = reply.readInt() != 0;
4499 reply.recycle();
4500 data.recycle();
4501 return res;
4502 }
4503
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004504 public void stopAppSwitches() throws RemoteException {
4505 Parcel data = Parcel.obtain();
4506 Parcel reply = Parcel.obtain();
4507 data.writeInterfaceToken(IActivityManager.descriptor);
4508 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4509 reply.readException();
4510 reply.recycle();
4511 data.recycle();
4512 }
4513
4514 public void resumeAppSwitches() throws RemoteException {
4515 Parcel data = Parcel.obtain();
4516 Parcel reply = Parcel.obtain();
4517 data.writeInterfaceToken(IActivityManager.descriptor);
4518 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4519 reply.readException();
4520 reply.recycle();
4521 data.recycle();
4522 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004523
4524 public void addPackageDependency(String packageName) throws RemoteException {
4525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 data.writeString(packageName);
4529 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4530 reply.readException();
4531 data.recycle();
4532 reply.recycle();
4533 }
4534
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004535 public void killApplicationWithAppId(String pkg, int appid, String reason)
4536 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004537 Parcel data = Parcel.obtain();
4538 Parcel reply = Parcel.obtain();
4539 data.writeInterfaceToken(IActivityManager.descriptor);
4540 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004541 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004542 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004543 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004544 reply.readException();
4545 data.recycle();
4546 reply.recycle();
4547 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004548
4549 public void closeSystemDialogs(String reason) throws RemoteException {
4550 Parcel data = Parcel.obtain();
4551 Parcel reply = Parcel.obtain();
4552 data.writeInterfaceToken(IActivityManager.descriptor);
4553 data.writeString(reason);
4554 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4555 reply.readException();
4556 data.recycle();
4557 reply.recycle();
4558 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004559
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004560 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004561 throws RemoteException {
4562 Parcel data = Parcel.obtain();
4563 Parcel reply = Parcel.obtain();
4564 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004565 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004566 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4567 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004568 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004569 data.recycle();
4570 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004571 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004572 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004573
4574 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4575 Parcel data = Parcel.obtain();
4576 Parcel reply = Parcel.obtain();
4577 data.writeInterfaceToken(IActivityManager.descriptor);
4578 data.writeString(processName);
4579 data.writeInt(uid);
4580 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4581 reply.readException();
4582 data.recycle();
4583 reply.recycle();
4584 }
4585
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004586 public void overridePendingTransition(IBinder token, String packageName,
4587 int enterAnim, int exitAnim) throws RemoteException {
4588 Parcel data = Parcel.obtain();
4589 Parcel reply = Parcel.obtain();
4590 data.writeInterfaceToken(IActivityManager.descriptor);
4591 data.writeStrongBinder(token);
4592 data.writeString(packageName);
4593 data.writeInt(enterAnim);
4594 data.writeInt(exitAnim);
4595 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4596 reply.readException();
4597 data.recycle();
4598 reply.recycle();
4599 }
4600
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004601 public boolean isUserAMonkey() throws RemoteException {
4602 Parcel data = Parcel.obtain();
4603 Parcel reply = Parcel.obtain();
4604 data.writeInterfaceToken(IActivityManager.descriptor);
4605 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4606 reply.readException();
4607 boolean res = reply.readInt() != 0;
4608 data.recycle();
4609 reply.recycle();
4610 return res;
4611 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004612
4613 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4614 Parcel data = Parcel.obtain();
4615 Parcel reply = Parcel.obtain();
4616 data.writeInterfaceToken(IActivityManager.descriptor);
4617 data.writeInt(monkey ? 1 : 0);
4618 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4619 reply.readException();
4620 data.recycle();
4621 reply.recycle();
4622 }
4623
Dianne Hackborn860755f2010-06-03 18:47:52 -07004624 public void finishHeavyWeightApp() throws RemoteException {
4625 Parcel data = Parcel.obtain();
4626 Parcel reply = Parcel.obtain();
4627 data.writeInterfaceToken(IActivityManager.descriptor);
4628 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4629 reply.readException();
4630 data.recycle();
4631 reply.recycle();
4632 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004633
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004634 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004635 throws RemoteException {
4636 Parcel data = Parcel.obtain();
4637 Parcel reply = Parcel.obtain();
4638 data.writeInterfaceToken(IActivityManager.descriptor);
4639 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004640 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4641 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004642 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004643 data.recycle();
4644 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004645 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004646 }
4647
Craig Mautner233ceee2014-05-09 17:05:11 -07004648 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004649 throws RemoteException {
4650 Parcel data = Parcel.obtain();
4651 Parcel reply = Parcel.obtain();
4652 data.writeInterfaceToken(IActivityManager.descriptor);
4653 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004654 if (options == null) {
4655 data.writeInt(0);
4656 } else {
4657 data.writeInt(1);
4658 data.writeBundle(options.toBundle());
4659 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004660 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004661 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004662 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004663 data.recycle();
4664 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004665 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004666 }
4667
Craig Mautner233ceee2014-05-09 17:05:11 -07004668 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4669 Parcel data = Parcel.obtain();
4670 Parcel reply = Parcel.obtain();
4671 data.writeInterfaceToken(IActivityManager.descriptor);
4672 data.writeStrongBinder(token);
4673 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4674 reply.readException();
4675 Bundle bundle = reply.readBundle();
4676 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4677 data.recycle();
4678 reply.recycle();
4679 return options;
4680 }
4681
Daniel Sandler69a48172010-06-23 16:29:36 -04004682 public void setImmersive(IBinder token, boolean immersive)
4683 throws RemoteException {
4684 Parcel data = Parcel.obtain();
4685 Parcel reply = Parcel.obtain();
4686 data.writeInterfaceToken(IActivityManager.descriptor);
4687 data.writeStrongBinder(token);
4688 data.writeInt(immersive ? 1 : 0);
4689 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4690 reply.readException();
4691 data.recycle();
4692 reply.recycle();
4693 }
4694
4695 public boolean isImmersive(IBinder token)
4696 throws RemoteException {
4697 Parcel data = Parcel.obtain();
4698 Parcel reply = Parcel.obtain();
4699 data.writeInterfaceToken(IActivityManager.descriptor);
4700 data.writeStrongBinder(token);
4701 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004702 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004703 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004704 data.recycle();
4705 reply.recycle();
4706 return res;
4707 }
4708
Craig Mautnerd61dc202014-07-07 11:09:11 -07004709 public boolean isTopOfTask(IBinder token) throws RemoteException {
4710 Parcel data = Parcel.obtain();
4711 Parcel reply = Parcel.obtain();
4712 data.writeInterfaceToken(IActivityManager.descriptor);
4713 data.writeStrongBinder(token);
4714 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4715 reply.readException();
4716 boolean res = reply.readInt() == 1;
4717 data.recycle();
4718 reply.recycle();
4719 return res;
4720 }
4721
Daniel Sandler69a48172010-06-23 16:29:36 -04004722 public boolean isTopActivityImmersive()
4723 throws RemoteException {
4724 Parcel data = Parcel.obtain();
4725 Parcel reply = Parcel.obtain();
4726 data.writeInterfaceToken(IActivityManager.descriptor);
4727 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004728 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004729 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004730 data.recycle();
4731 reply.recycle();
4732 return res;
4733 }
4734
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004735 public void crashApplication(int uid, int initialPid, String packageName,
4736 String message) throws RemoteException {
4737 Parcel data = Parcel.obtain();
4738 Parcel reply = Parcel.obtain();
4739 data.writeInterfaceToken(IActivityManager.descriptor);
4740 data.writeInt(uid);
4741 data.writeInt(initialPid);
4742 data.writeString(packageName);
4743 data.writeString(message);
4744 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4745 reply.readException();
4746 data.recycle();
4747 reply.recycle();
4748 }
Andy McFadden824c5102010-07-09 16:26:57 -07004749
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004750 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004751 Parcel data = Parcel.obtain();
4752 Parcel reply = Parcel.obtain();
4753 data.writeInterfaceToken(IActivityManager.descriptor);
4754 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004755 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004756 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4757 reply.readException();
4758 String res = reply.readString();
4759 data.recycle();
4760 reply.recycle();
4761 return res;
4762 }
4763
Dianne Hackborn7e269642010-08-25 19:50:20 -07004764 public IBinder newUriPermissionOwner(String name)
4765 throws RemoteException {
4766 Parcel data = Parcel.obtain();
4767 Parcel reply = Parcel.obtain();
4768 data.writeInterfaceToken(IActivityManager.descriptor);
4769 data.writeString(name);
4770 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4771 reply.readException();
4772 IBinder res = reply.readStrongBinder();
4773 data.recycle();
4774 reply.recycle();
4775 return res;
4776 }
4777
4778 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004779 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004780 Parcel data = Parcel.obtain();
4781 Parcel reply = Parcel.obtain();
4782 data.writeInterfaceToken(IActivityManager.descriptor);
4783 data.writeStrongBinder(owner);
4784 data.writeInt(fromUid);
4785 data.writeString(targetPkg);
4786 uri.writeToParcel(data, 0);
4787 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004788 data.writeInt(sourceUserId);
4789 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004790 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4791 reply.readException();
4792 data.recycle();
4793 reply.recycle();
4794 }
4795
4796 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004797 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004798 Parcel data = Parcel.obtain();
4799 Parcel reply = Parcel.obtain();
4800 data.writeInterfaceToken(IActivityManager.descriptor);
4801 data.writeStrongBinder(owner);
4802 if (uri != null) {
4803 data.writeInt(1);
4804 uri.writeToParcel(data, 0);
4805 } else {
4806 data.writeInt(0);
4807 }
4808 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004809 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004810 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4811 reply.readException();
4812 data.recycle();
4813 reply.recycle();
4814 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004815
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004816 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004817 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004818 Parcel data = Parcel.obtain();
4819 Parcel reply = Parcel.obtain();
4820 data.writeInterfaceToken(IActivityManager.descriptor);
4821 data.writeInt(callingUid);
4822 data.writeString(targetPkg);
4823 uri.writeToParcel(data, 0);
4824 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004825 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004826 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4827 reply.readException();
4828 int res = reply.readInt();
4829 data.recycle();
4830 reply.recycle();
4831 return res;
4832 }
4833
Dianne Hackborn1676c852012-09-10 14:52:30 -07004834 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004835 String path, ParcelFileDescriptor fd) throws RemoteException {
4836 Parcel data = Parcel.obtain();
4837 Parcel reply = Parcel.obtain();
4838 data.writeInterfaceToken(IActivityManager.descriptor);
4839 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004840 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004841 data.writeInt(managed ? 1 : 0);
4842 data.writeString(path);
4843 if (fd != null) {
4844 data.writeInt(1);
4845 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4846 } else {
4847 data.writeInt(0);
4848 }
4849 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4850 reply.readException();
4851 boolean res = reply.readInt() != 0;
4852 reply.recycle();
4853 data.recycle();
4854 return res;
4855 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004856
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004857 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004858 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004859 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004860 Parcel data = Parcel.obtain();
4861 Parcel reply = Parcel.obtain();
4862 data.writeInterfaceToken(IActivityManager.descriptor);
4863 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004864 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004865 data.writeTypedArray(intents, 0);
4866 data.writeStringArray(resolvedTypes);
4867 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004868 if (options != null) {
4869 data.writeInt(1);
4870 options.writeToParcel(data, 0);
4871 } else {
4872 data.writeInt(0);
4873 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004874 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004875 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4876 reply.readException();
4877 int result = reply.readInt();
4878 reply.recycle();
4879 data.recycle();
4880 return result;
4881 }
4882
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004883 public int getFrontActivityScreenCompatMode() throws RemoteException {
4884 Parcel data = Parcel.obtain();
4885 Parcel reply = Parcel.obtain();
4886 data.writeInterfaceToken(IActivityManager.descriptor);
4887 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4888 reply.readException();
4889 int mode = reply.readInt();
4890 reply.recycle();
4891 data.recycle();
4892 return mode;
4893 }
4894
4895 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4896 Parcel data = Parcel.obtain();
4897 Parcel reply = Parcel.obtain();
4898 data.writeInterfaceToken(IActivityManager.descriptor);
4899 data.writeInt(mode);
4900 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4901 reply.readException();
4902 reply.recycle();
4903 data.recycle();
4904 }
4905
4906 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4907 Parcel data = Parcel.obtain();
4908 Parcel reply = Parcel.obtain();
4909 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004910 data.writeString(packageName);
4911 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004912 reply.readException();
4913 int mode = reply.readInt();
4914 reply.recycle();
4915 data.recycle();
4916 return mode;
4917 }
4918
4919 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004920 throws RemoteException {
4921 Parcel data = Parcel.obtain();
4922 Parcel reply = Parcel.obtain();
4923 data.writeInterfaceToken(IActivityManager.descriptor);
4924 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004925 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004926 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4927 reply.readException();
4928 reply.recycle();
4929 data.recycle();
4930 }
4931
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004932 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4933 Parcel data = Parcel.obtain();
4934 Parcel reply = Parcel.obtain();
4935 data.writeInterfaceToken(IActivityManager.descriptor);
4936 data.writeString(packageName);
4937 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4938 reply.readException();
4939 boolean ask = reply.readInt() != 0;
4940 reply.recycle();
4941 data.recycle();
4942 return ask;
4943 }
4944
4945 public void setPackageAskScreenCompat(String packageName, boolean ask)
4946 throws RemoteException {
4947 Parcel data = Parcel.obtain();
4948 Parcel reply = Parcel.obtain();
4949 data.writeInterfaceToken(IActivityManager.descriptor);
4950 data.writeString(packageName);
4951 data.writeInt(ask ? 1 : 0);
4952 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4953 reply.readException();
4954 reply.recycle();
4955 data.recycle();
4956 }
4957
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004958 public boolean switchUser(int userid) throws RemoteException {
4959 Parcel data = Parcel.obtain();
4960 Parcel reply = Parcel.obtain();
4961 data.writeInterfaceToken(IActivityManager.descriptor);
4962 data.writeInt(userid);
4963 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4964 reply.readException();
4965 boolean result = reply.readInt() != 0;
4966 reply.recycle();
4967 data.recycle();
4968 return result;
4969 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004970
Kenny Guy08488bf2014-02-21 17:40:37 +00004971 public boolean startUserInBackground(int userid) throws RemoteException {
4972 Parcel data = Parcel.obtain();
4973 Parcel reply = Parcel.obtain();
4974 data.writeInterfaceToken(IActivityManager.descriptor);
4975 data.writeInt(userid);
4976 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4977 reply.readException();
4978 boolean result = reply.readInt() != 0;
4979 reply.recycle();
4980 data.recycle();
4981 return result;
4982 }
4983
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004984 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4985 Parcel data = Parcel.obtain();
4986 Parcel reply = Parcel.obtain();
4987 data.writeInterfaceToken(IActivityManager.descriptor);
4988 data.writeInt(userid);
4989 data.writeStrongInterface(callback);
4990 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4991 reply.readException();
4992 int result = reply.readInt();
4993 reply.recycle();
4994 data.recycle();
4995 return result;
4996 }
4997
Amith Yamasani52f1d752012-03-28 18:19:29 -07004998 public UserInfo getCurrentUser() throws RemoteException {
4999 Parcel data = Parcel.obtain();
5000 Parcel reply = Parcel.obtain();
5001 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005002 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005003 reply.readException();
5004 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5005 reply.recycle();
5006 data.recycle();
5007 return userInfo;
5008 }
5009
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005010 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005011 Parcel data = Parcel.obtain();
5012 Parcel reply = Parcel.obtain();
5013 data.writeInterfaceToken(IActivityManager.descriptor);
5014 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005015 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005016 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5017 reply.readException();
5018 boolean result = reply.readInt() != 0;
5019 reply.recycle();
5020 data.recycle();
5021 return result;
5022 }
5023
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005024 public int[] getRunningUserIds() throws RemoteException {
5025 Parcel data = Parcel.obtain();
5026 Parcel reply = Parcel.obtain();
5027 data.writeInterfaceToken(IActivityManager.descriptor);
5028 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5029 reply.readException();
5030 int[] result = reply.createIntArray();
5031 reply.recycle();
5032 data.recycle();
5033 return result;
5034 }
5035
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005036 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005037 Parcel data = Parcel.obtain();
5038 Parcel reply = Parcel.obtain();
5039 data.writeInterfaceToken(IActivityManager.descriptor);
5040 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005041 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5042 reply.readException();
5043 boolean result = reply.readInt() != 0;
5044 reply.recycle();
5045 data.recycle();
5046 return result;
5047 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005048
Jeff Sharkeya4620792011-05-20 15:29:23 -07005049 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5050 Parcel data = Parcel.obtain();
5051 Parcel reply = Parcel.obtain();
5052 data.writeInterfaceToken(IActivityManager.descriptor);
5053 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5054 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5055 reply.readException();
5056 data.recycle();
5057 reply.recycle();
5058 }
5059
5060 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5061 Parcel data = Parcel.obtain();
5062 Parcel reply = Parcel.obtain();
5063 data.writeInterfaceToken(IActivityManager.descriptor);
5064 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5065 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5066 reply.readException();
5067 data.recycle();
5068 reply.recycle();
5069 }
5070
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005071 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5072 Parcel data = Parcel.obtain();
5073 Parcel reply = Parcel.obtain();
5074 data.writeInterfaceToken(IActivityManager.descriptor);
5075 data.writeStrongBinder(sender.asBinder());
5076 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5077 reply.readException();
5078 boolean res = reply.readInt() != 0;
5079 data.recycle();
5080 reply.recycle();
5081 return res;
5082 }
5083
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005084 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5085 Parcel data = Parcel.obtain();
5086 Parcel reply = Parcel.obtain();
5087 data.writeInterfaceToken(IActivityManager.descriptor);
5088 data.writeStrongBinder(sender.asBinder());
5089 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5090 reply.readException();
5091 boolean res = reply.readInt() != 0;
5092 data.recycle();
5093 reply.recycle();
5094 return res;
5095 }
5096
Dianne Hackborn81038902012-11-26 17:04:09 -08005097 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5098 Parcel data = Parcel.obtain();
5099 Parcel reply = Parcel.obtain();
5100 data.writeInterfaceToken(IActivityManager.descriptor);
5101 data.writeStrongBinder(sender.asBinder());
5102 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5103 reply.readException();
5104 Intent res = reply.readInt() != 0
5105 ? Intent.CREATOR.createFromParcel(reply) : null;
5106 data.recycle();
5107 reply.recycle();
5108 return res;
5109 }
5110
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005111 public String getTagForIntentSender(IIntentSender sender, String prefix)
5112 throws RemoteException {
5113 Parcel data = Parcel.obtain();
5114 Parcel reply = Parcel.obtain();
5115 data.writeInterfaceToken(IActivityManager.descriptor);
5116 data.writeStrongBinder(sender.asBinder());
5117 data.writeString(prefix);
5118 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5119 reply.readException();
5120 String res = reply.readString();
5121 data.recycle();
5122 reply.recycle();
5123 return res;
5124 }
5125
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005126 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5127 {
5128 Parcel data = Parcel.obtain();
5129 Parcel reply = Parcel.obtain();
5130 data.writeInterfaceToken(IActivityManager.descriptor);
5131 values.writeToParcel(data, 0);
5132 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5133 reply.readException();
5134 data.recycle();
5135 reply.recycle();
5136 }
5137
Dianne Hackbornb437e092011-08-05 17:50:29 -07005138 public long[] getProcessPss(int[] pids) throws RemoteException {
5139 Parcel data = Parcel.obtain();
5140 Parcel reply = Parcel.obtain();
5141 data.writeInterfaceToken(IActivityManager.descriptor);
5142 data.writeIntArray(pids);
5143 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5144 reply.readException();
5145 long[] res = reply.createLongArray();
5146 data.recycle();
5147 reply.recycle();
5148 return res;
5149 }
5150
Dianne Hackborn661cd522011-08-22 00:26:20 -07005151 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5152 Parcel data = Parcel.obtain();
5153 Parcel reply = Parcel.obtain();
5154 data.writeInterfaceToken(IActivityManager.descriptor);
5155 TextUtils.writeToParcel(msg, data, 0);
5156 data.writeInt(always ? 1 : 0);
5157 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5158 reply.readException();
5159 data.recycle();
5160 reply.recycle();
5161 }
5162
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005163 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005164 Parcel data = Parcel.obtain();
5165 Parcel reply = Parcel.obtain();
5166 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005167 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005168 reply.readException();
5169 data.recycle();
5170 reply.recycle();
5171 }
5172
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005173 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005174 throws RemoteException {
5175 Parcel data = Parcel.obtain();
5176 Parcel reply = Parcel.obtain();
5177 data.writeInterfaceToken(IActivityManager.descriptor);
5178 data.writeStrongBinder(token);
5179 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005180 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005181 reply.readException();
5182 boolean result = reply.readInt() != 0;
5183 data.recycle();
5184 reply.recycle();
5185 return result;
5186 }
5187
5188 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5189 throws RemoteException {
5190 Parcel data = Parcel.obtain();
5191 Parcel reply = Parcel.obtain();
5192 data.writeInterfaceToken(IActivityManager.descriptor);
5193 data.writeStrongBinder(token);
5194 target.writeToParcel(data, 0);
5195 data.writeInt(resultCode);
5196 if (resultData != null) {
5197 data.writeInt(1);
5198 resultData.writeToParcel(data, 0);
5199 } else {
5200 data.writeInt(0);
5201 }
5202 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5203 reply.readException();
5204 boolean result = reply.readInt() != 0;
5205 data.recycle();
5206 reply.recycle();
5207 return result;
5208 }
5209
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005210 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5211 Parcel data = Parcel.obtain();
5212 Parcel reply = Parcel.obtain();
5213 data.writeInterfaceToken(IActivityManager.descriptor);
5214 data.writeStrongBinder(activityToken);
5215 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5216 reply.readException();
5217 int result = reply.readInt();
5218 data.recycle();
5219 reply.recycle();
5220 return result;
5221 }
5222
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005223 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5224 Parcel data = Parcel.obtain();
5225 Parcel reply = Parcel.obtain();
5226 data.writeInterfaceToken(IActivityManager.descriptor);
5227 data.writeStrongBinder(activityToken);
5228 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5229 reply.readException();
5230 String result = reply.readString();
5231 data.recycle();
5232 reply.recycle();
5233 return result;
5234 }
5235
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005236 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5237 Parcel data = Parcel.obtain();
5238 Parcel reply = Parcel.obtain();
5239 data.writeInterfaceToken(IActivityManager.descriptor);
5240 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5241 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5242 reply.readException();
5243 data.recycle();
5244 reply.recycle();
5245 }
5246
5247 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5248 Parcel data = Parcel.obtain();
5249 Parcel reply = Parcel.obtain();
5250 data.writeInterfaceToken(IActivityManager.descriptor);
5251 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5252 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5253 reply.readException();
5254 data.recycle();
5255 reply.recycle();
5256 }
5257
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005258 public void requestBugReport() throws RemoteException {
5259 Parcel data = Parcel.obtain();
5260 Parcel reply = Parcel.obtain();
5261 data.writeInterfaceToken(IActivityManager.descriptor);
5262 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5263 reply.readException();
5264 data.recycle();
5265 reply.recycle();
5266 }
5267
Jeff Brownbd181bb2013-09-10 16:44:24 -07005268 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5269 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005270 Parcel data = Parcel.obtain();
5271 Parcel reply = Parcel.obtain();
5272 data.writeInterfaceToken(IActivityManager.descriptor);
5273 data.writeInt(pid);
5274 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005275 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005276 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5277 reply.readException();
5278 long res = reply.readInt();
5279 data.recycle();
5280 reply.recycle();
5281 return res;
5282 }
5283
Adam Skorydfc7fd72013-08-05 19:23:41 -07005284 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005285 Parcel data = Parcel.obtain();
5286 Parcel reply = Parcel.obtain();
5287 data.writeInterfaceToken(IActivityManager.descriptor);
5288 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005289 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005290 reply.readException();
5291 Bundle res = reply.readBundle();
5292 data.recycle();
5293 reply.recycle();
5294 return res;
5295 }
5296
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005297 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5298 throws RemoteException {
5299 Parcel data = Parcel.obtain();
5300 Parcel reply = Parcel.obtain();
5301 data.writeInterfaceToken(IActivityManager.descriptor);
5302 data.writeInt(requestType);
5303 data.writeStrongBinder(receiver.asBinder());
5304 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5305 reply.readException();
5306 data.recycle();
5307 reply.recycle();
5308 }
5309
Adam Skory7140a252013-09-11 12:04:58 +01005310 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005311 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005312 Parcel data = Parcel.obtain();
5313 Parcel reply = Parcel.obtain();
5314 data.writeInterfaceToken(IActivityManager.descriptor);
5315 data.writeStrongBinder(token);
5316 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005317 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005318 reply.readException();
5319 data.recycle();
5320 reply.recycle();
5321 }
5322
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005323 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5324 throws RemoteException {
5325 Parcel data = Parcel.obtain();
5326 Parcel reply = Parcel.obtain();
5327 data.writeInterfaceToken(IActivityManager.descriptor);
5328 intent.writeToParcel(data, 0);
5329 data.writeInt(requestType);
5330 data.writeString(hint);
5331 data.writeInt(userHandle);
5332 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5333 reply.readException();
5334 boolean res = reply.readInt() != 0;
5335 data.recycle();
5336 reply.recycle();
5337 return res;
5338 }
5339
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005340 public void killUid(int uid, String reason) throws RemoteException {
5341 Parcel data = Parcel.obtain();
5342 Parcel reply = Parcel.obtain();
5343 data.writeInterfaceToken(IActivityManager.descriptor);
5344 data.writeInt(uid);
5345 data.writeString(reason);
5346 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5347 reply.readException();
5348 data.recycle();
5349 reply.recycle();
5350 }
5351
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005352 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5353 Parcel data = Parcel.obtain();
5354 Parcel reply = Parcel.obtain();
5355 data.writeInterfaceToken(IActivityManager.descriptor);
5356 data.writeStrongBinder(who);
5357 data.writeInt(allowRestart ? 1 : 0);
5358 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5359 reply.readException();
5360 data.recycle();
5361 reply.recycle();
5362 }
5363
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005364 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5365 Parcel data = Parcel.obtain();
5366 Parcel reply = Parcel.obtain();
5367 data.writeInterfaceToken(IActivityManager.descriptor);
5368 data.writeStrongBinder(token);
5369 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5370 reply.readException();
5371 data.recycle();
5372 reply.recycle();
5373 }
5374
Craig Mautner5eda9b32013-07-02 11:58:16 -07005375 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5376 Parcel data = Parcel.obtain();
5377 Parcel reply = Parcel.obtain();
5378 data.writeInterfaceToken(IActivityManager.descriptor);
5379 data.writeStrongBinder(token);
5380 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5381 reply.readException();
5382 data.recycle();
5383 reply.recycle();
5384 }
5385
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005386 public void restart() throws RemoteException {
5387 Parcel data = Parcel.obtain();
5388 Parcel reply = Parcel.obtain();
5389 data.writeInterfaceToken(IActivityManager.descriptor);
5390 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5391 reply.readException();
5392 data.recycle();
5393 reply.recycle();
5394 }
5395
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005396 public void performIdleMaintenance() throws RemoteException {
5397 Parcel data = Parcel.obtain();
5398 Parcel reply = Parcel.obtain();
5399 data.writeInterfaceToken(IActivityManager.descriptor);
5400 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5401 reply.readException();
5402 data.recycle();
5403 reply.recycle();
5404 }
5405
Todd Kennedyca4d8422015-01-15 15:19:22 -08005406 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005407 IActivityContainerCallback callback) throws RemoteException {
5408 Parcel data = Parcel.obtain();
5409 Parcel reply = Parcel.obtain();
5410 data.writeInterfaceToken(IActivityManager.descriptor);
5411 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005412 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005413 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005414 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005415 final int result = reply.readInt();
5416 final IActivityContainer res;
5417 if (result == 1) {
5418 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5419 } else {
5420 res = null;
5421 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005422 data.recycle();
5423 reply.recycle();
5424 return res;
5425 }
5426
Craig Mautner95da1082014-02-24 17:54:35 -08005427 public void deleteActivityContainer(IActivityContainer activityContainer)
5428 throws RemoteException {
5429 Parcel data = Parcel.obtain();
5430 Parcel reply = Parcel.obtain();
5431 data.writeInterfaceToken(IActivityManager.descriptor);
5432 data.writeStrongBinder(activityContainer.asBinder());
5433 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5434 reply.readException();
5435 data.recycle();
5436 reply.recycle();
5437 }
5438
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005439 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005440 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5441 Parcel data = Parcel.obtain();
5442 Parcel reply = Parcel.obtain();
5443 data.writeInterfaceToken(IActivityManager.descriptor);
5444 data.writeInt(displayId);
5445 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5446 reply.readException();
5447 final int result = reply.readInt();
5448 final IActivityContainer res;
5449 if (result == 1) {
5450 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5451 } else {
5452 res = null;
5453 }
5454 data.recycle();
5455 reply.recycle();
5456 return res;
5457 }
5458
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005459 @Override
5460 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005461 throws RemoteException {
5462 Parcel data = Parcel.obtain();
5463 Parcel reply = Parcel.obtain();
5464 data.writeInterfaceToken(IActivityManager.descriptor);
5465 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005466 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005467 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005468 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005469 data.recycle();
5470 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005471 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005472 }
5473
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005474 @Override
Craig Mautner4a1cb222013-12-04 16:14:06 -08005475 public IBinder getHomeActivityToken() throws RemoteException {
5476 Parcel data = Parcel.obtain();
5477 Parcel reply = Parcel.obtain();
5478 data.writeInterfaceToken(IActivityManager.descriptor);
5479 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5480 reply.readException();
5481 IBinder res = reply.readStrongBinder();
5482 data.recycle();
5483 reply.recycle();
5484 return res;
5485 }
5486
Craig Mautneraea74a52014-03-08 14:23:10 -08005487 @Override
5488 public void startLockTaskMode(int taskId) throws RemoteException {
5489 Parcel data = Parcel.obtain();
5490 Parcel reply = Parcel.obtain();
5491 data.writeInterfaceToken(IActivityManager.descriptor);
5492 data.writeInt(taskId);
5493 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5494 reply.readException();
5495 data.recycle();
5496 reply.recycle();
5497 }
5498
5499 @Override
5500 public void startLockTaskMode(IBinder token) throws RemoteException {
5501 Parcel data = Parcel.obtain();
5502 Parcel reply = Parcel.obtain();
5503 data.writeInterfaceToken(IActivityManager.descriptor);
5504 data.writeStrongBinder(token);
5505 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5506 reply.readException();
5507 data.recycle();
5508 reply.recycle();
5509 }
5510
5511 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005512 public void startLockTaskModeOnCurrent() throws RemoteException {
5513 Parcel data = Parcel.obtain();
5514 Parcel reply = Parcel.obtain();
5515 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005516 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005517 reply.readException();
5518 data.recycle();
5519 reply.recycle();
5520 }
5521
5522 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005523 public void stopLockTaskMode() throws RemoteException {
5524 Parcel data = Parcel.obtain();
5525 Parcel reply = Parcel.obtain();
5526 data.writeInterfaceToken(IActivityManager.descriptor);
5527 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5528 reply.readException();
5529 data.recycle();
5530 reply.recycle();
5531 }
5532
5533 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005534 public void stopLockTaskModeOnCurrent() throws RemoteException {
5535 Parcel data = Parcel.obtain();
5536 Parcel reply = Parcel.obtain();
5537 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005538 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005539 reply.readException();
5540 data.recycle();
5541 reply.recycle();
5542 }
5543
5544 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005545 public boolean isInLockTaskMode() throws RemoteException {
5546 Parcel data = Parcel.obtain();
5547 Parcel reply = Parcel.obtain();
5548 data.writeInterfaceToken(IActivityManager.descriptor);
5549 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5550 reply.readException();
5551 boolean isInLockTaskMode = reply.readInt() == 1;
5552 data.recycle();
5553 reply.recycle();
5554 return isInLockTaskMode;
5555 }
5556
Craig Mautner688b5102014-03-27 16:55:03 -07005557 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005558 public int getLockTaskModeState() throws RemoteException {
5559 Parcel data = Parcel.obtain();
5560 Parcel reply = Parcel.obtain();
5561 data.writeInterfaceToken(IActivityManager.descriptor);
5562 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5563 reply.readException();
5564 int lockTaskModeState = reply.readInt();
5565 data.recycle();
5566 reply.recycle();
5567 return lockTaskModeState;
5568 }
5569
5570 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005571 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5572 Parcel data = Parcel.obtain();
5573 Parcel reply = Parcel.obtain();
5574 data.writeInterfaceToken(IActivityManager.descriptor);
5575 data.writeStrongBinder(token);
5576 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5577 IBinder.FLAG_ONEWAY);
5578 reply.readException();
5579 data.recycle();
5580 reply.recycle();
5581 }
5582
5583 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005584 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005585 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005586 Parcel data = Parcel.obtain();
5587 Parcel reply = Parcel.obtain();
5588 data.writeInterfaceToken(IActivityManager.descriptor);
5589 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005590 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005591 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005592 reply.readException();
5593 data.recycle();
5594 reply.recycle();
5595 }
5596
Craig Mautneree2e45a2014-06-27 12:10:03 -07005597 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005598 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5599 Parcel data = Parcel.obtain();
5600 Parcel reply = Parcel.obtain();
5601 data.writeInterfaceToken(IActivityManager.descriptor);
5602 data.writeInt(taskId);
5603 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005604 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005605 reply.readException();
5606 data.recycle();
5607 reply.recycle();
5608 }
5609
5610 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005611 public void resizeTask(int taskId, Rect r) throws RemoteException
5612 {
5613 Parcel data = Parcel.obtain();
5614 Parcel reply = Parcel.obtain();
5615 data.writeInterfaceToken(IActivityManager.descriptor);
5616 data.writeInt(taskId);
5617 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005618 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005619 reply.readException();
5620 data.recycle();
5621 reply.recycle();
5622 }
5623
5624 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005625 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5626 Parcel data = Parcel.obtain();
5627 Parcel reply = Parcel.obtain();
5628 data.writeInterfaceToken(IActivityManager.descriptor);
5629 data.writeString(filename);
5630 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5631 reply.readException();
5632 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5633 data.recycle();
5634 reply.recycle();
5635 return icon;
5636 }
5637
5638 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005639 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5640 throws RemoteException {
5641 Parcel data = Parcel.obtain();
5642 Parcel reply = Parcel.obtain();
5643 data.writeInterfaceToken(IActivityManager.descriptor);
5644 if (options == null) {
5645 data.writeInt(0);
5646 } else {
5647 data.writeInt(1);
5648 data.writeBundle(options.toBundle());
5649 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005650 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005651 reply.readException();
5652 data.recycle();
5653 reply.recycle();
5654 }
5655
5656 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005657 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005658 Parcel data = Parcel.obtain();
5659 Parcel reply = Parcel.obtain();
5660 data.writeInterfaceToken(IActivityManager.descriptor);
5661 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005662 data.writeInt(visible ? 1 : 0);
5663 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005664 reply.readException();
5665 boolean success = reply.readInt() > 0;
5666 data.recycle();
5667 reply.recycle();
5668 return success;
5669 }
5670
5671 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005672 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005673 Parcel data = Parcel.obtain();
5674 Parcel reply = Parcel.obtain();
5675 data.writeInterfaceToken(IActivityManager.descriptor);
5676 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005677 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005678 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005679 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005680 data.recycle();
5681 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005682 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005683 }
5684
5685 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005686 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005687 Parcel data = Parcel.obtain();
5688 Parcel reply = Parcel.obtain();
5689 data.writeInterfaceToken(IActivityManager.descriptor);
5690 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005691 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005692 reply.readException();
5693 data.recycle();
5694 reply.recycle();
5695 }
5696
5697 @Override
5698 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5699 Parcel data = Parcel.obtain();
5700 Parcel reply = Parcel.obtain();
5701 data.writeInterfaceToken(IActivityManager.descriptor);
5702 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005703 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005704 reply.readException();
5705 data.recycle();
5706 reply.recycle();
5707 }
5708
Craig Mautner8746a472014-07-24 15:12:54 -07005709 @Override
5710 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5711 Parcel data = Parcel.obtain();
5712 Parcel reply = Parcel.obtain();
5713 data.writeInterfaceToken(IActivityManager.descriptor);
5714 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005715 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005716 reply.readException();
5717 data.recycle();
5718 reply.recycle();
5719 }
5720
Craig Mautner6e2f3952014-09-09 14:26:41 -07005721 @Override
5722 public void bootAnimationComplete() throws RemoteException {
5723 Parcel data = Parcel.obtain();
5724 Parcel reply = Parcel.obtain();
5725 data.writeInterfaceToken(IActivityManager.descriptor);
5726 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5727 reply.readException();
5728 data.recycle();
5729 reply.recycle();
5730 }
5731
Wale Ogunwale18795a22014-12-03 11:38:33 -08005732 @Override
5733 public void systemBackupRestored() throws RemoteException {
5734 Parcel data = Parcel.obtain();
5735 Parcel reply = Parcel.obtain();
5736 data.writeInterfaceToken(IActivityManager.descriptor);
5737 mRemote.transact(SYSTEM_BACKUP_RESTORED, data, reply, 0);
5738 reply.readException();
5739 data.recycle();
5740 reply.recycle();
5741 }
5742
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08005743 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005744 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5745 Parcel data = Parcel.obtain();
5746 Parcel reply = Parcel.obtain();
5747 data.writeInterfaceToken(IActivityManager.descriptor);
5748 data.writeInt(uid);
5749 data.writeByteArray(firstPacket);
5750 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5751 reply.readException();
5752 data.recycle();
5753 reply.recycle();
5754 }
5755
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005756 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005757 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5758 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005759 Parcel data = Parcel.obtain();
5760 Parcel reply = Parcel.obtain();
5761 data.writeInterfaceToken(IActivityManager.descriptor);
5762 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005763 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005764 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005765 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005766 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5767 reply.readException();
5768 data.recycle();
5769 reply.recycle();
5770 }
5771
5772 @Override
5773 public void dumpHeapFinished(String path) throws RemoteException {
5774 Parcel data = Parcel.obtain();
5775 Parcel reply = Parcel.obtain();
5776 data.writeInterfaceToken(IActivityManager.descriptor);
5777 data.writeString(path);
5778 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5779 reply.readException();
5780 data.recycle();
5781 reply.recycle();
5782 }
5783
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005784 @Override
5785 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5786 throws RemoteException {
5787 Parcel data = Parcel.obtain();
5788 Parcel reply = Parcel.obtain();
5789 data.writeInterfaceToken(IActivityManager.descriptor);
5790 data.writeStrongBinder(session.asBinder());
5791 data.writeInt(keepAwake ? 1 : 0);
5792 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5793 reply.readException();
5794 data.recycle();
5795 reply.recycle();
5796 }
5797
Craig Mautnere5600772015-04-03 21:36:37 -07005798 @Override
5799 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5800 Parcel data = Parcel.obtain();
5801 Parcel reply = Parcel.obtain();
5802 data.writeInterfaceToken(IActivityManager.descriptor);
5803 data.writeInt(userId);
5804 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005805 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005806 reply.readException();
5807 data.recycle();
5808 reply.recycle();
5809 }
5810
Dianne Hackborn1e383822015-04-10 14:02:33 -07005811 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07005812 public void updateDeviceOwner(String packageName) throws RemoteException {
5813 Parcel data = Parcel.obtain();
5814 Parcel reply = Parcel.obtain();
5815 data.writeInterfaceToken(IActivityManager.descriptor);
5816 data.writeString(packageName);
5817 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
5818 reply.readException();
5819 data.recycle();
5820 reply.recycle();
5821 }
5822
5823 @Override
Dianne Hackborn1e383822015-04-10 14:02:33 -07005824 public int getPackageProcessState(String packageName) throws RemoteException {
5825 Parcel data = Parcel.obtain();
5826 Parcel reply = Parcel.obtain();
5827 data.writeInterfaceToken(IActivityManager.descriptor);
5828 data.writeString(packageName);
5829 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5830 reply.readException();
5831 int res = reply.readInt();
5832 data.recycle();
5833 reply.recycle();
5834 return res;
5835 }
5836
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005837 private IBinder mRemote;
5838}