blob: add7af228cd65753455f486db772adfd60122b6a [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
Winson Chunga449dc02014-05-16 11:15:04 -07002348 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002349 data.enforceInterface(IActivityManager.descriptor);
2350 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002351 ActivityManager.TaskDescription values =
2352 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2353 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002354 reply.writeNoException();
2355 return true;
2356 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002357
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002358 case SET_TASK_RESIZEABLE_TRANSACTION: {
2359 data.enforceInterface(IActivityManager.descriptor);
2360 int taskId = data.readInt();
2361 boolean resizeable = (data.readInt() == 1) ? true : false;
2362 setTaskResizeable(taskId, resizeable);
2363 reply.writeNoException();
2364 return true;
2365 }
2366
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002367 case RESIZE_TASK_TRANSACTION: {
2368 data.enforceInterface(IActivityManager.descriptor);
2369 int taskId = data.readInt();
2370 Rect r = Rect.CREATOR.createFromParcel(data);
2371 resizeTask(taskId, r);
2372 reply.writeNoException();
2373 return true;
2374 }
2375
Craig Mautner648f69b2014-09-18 14:16:26 -07002376 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2377 data.enforceInterface(IActivityManager.descriptor);
2378 String filename = data.readString();
2379 Bitmap icon = getTaskDescriptionIcon(filename);
2380 reply.writeNoException();
2381 if (icon == null) {
2382 reply.writeInt(0);
2383 } else {
2384 reply.writeInt(1);
2385 icon.writeToParcel(reply, 0);
2386 }
2387 return true;
2388 }
2389
Winson Chung044d5292014-11-06 11:05:19 -08002390 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2391 data.enforceInterface(IActivityManager.descriptor);
2392 final Bundle bundle;
2393 if (data.readInt() == 0) {
2394 bundle = null;
2395 } else {
2396 bundle = data.readBundle();
2397 }
2398 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2399 startInPlaceAnimationOnFrontMostApplication(options);
2400 reply.writeNoException();
2401 return true;
2402 }
2403
Jose Lima4b6c6692014-08-12 17:41:12 -07002404 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002405 data.enforceInterface(IActivityManager.descriptor);
2406 IBinder token = data.readStrongBinder();
2407 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002408 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002409 reply.writeNoException();
2410 reply.writeInt(success ? 1 : 0);
2411 return true;
2412 }
2413
Jose Lima4b6c6692014-08-12 17:41:12 -07002414 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002415 data.enforceInterface(IActivityManager.descriptor);
2416 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002417 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002418 reply.writeNoException();
2419 reply.writeInt(enabled ? 1 : 0);
2420 return true;
2421 }
2422
Jose Lima4b6c6692014-08-12 17:41:12 -07002423 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002424 data.enforceInterface(IActivityManager.descriptor);
2425 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002426 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002427 reply.writeNoException();
2428 return true;
2429 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002430
2431 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2432 data.enforceInterface(IActivityManager.descriptor);
2433 IBinder token = data.readStrongBinder();
2434 notifyLaunchTaskBehindComplete(token);
2435 reply.writeNoException();
2436 return true;
2437 }
Craig Mautner8746a472014-07-24 15:12:54 -07002438
2439 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2440 data.enforceInterface(IActivityManager.descriptor);
2441 IBinder token = data.readStrongBinder();
2442 notifyEnterAnimationComplete(token);
2443 reply.writeNoException();
2444 return true;
2445 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002446
2447 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2448 data.enforceInterface(IActivityManager.descriptor);
2449 bootAnimationComplete();
2450 reply.writeNoException();
2451 return true;
2452 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002453
2454 case SYSTEM_BACKUP_RESTORED: {
2455 data.enforceInterface(IActivityManager.descriptor);
2456 systemBackupRestored();
2457 reply.writeNoException();
2458 return true;
2459 }
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08002460
Jeff Sharkey605eb792014-11-04 13:34:06 -08002461 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2462 data.enforceInterface(IActivityManager.descriptor);
2463 final int uid = data.readInt();
2464 final byte[] firstPacket = data.createByteArray();
2465 notifyCleartextNetwork(uid, firstPacket);
2466 reply.writeNoException();
2467 return true;
2468 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002469
2470 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2471 data.enforceInterface(IActivityManager.descriptor);
2472 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002473 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002474 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002475 String reportPackage = data.readString();
2476 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002477 reply.writeNoException();
2478 return true;
2479 }
2480
2481 case DUMP_HEAP_FINISHED_TRANSACTION: {
2482 data.enforceInterface(IActivityManager.descriptor);
2483 String path = data.readString();
2484 dumpHeapFinished(path);
2485 reply.writeNoException();
2486 return true;
2487 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002488
2489 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2490 data.enforceInterface(IActivityManager.descriptor);
2491 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2492 data.readStrongBinder());
2493 boolean keepAwake = data.readInt() != 0;
2494 setVoiceKeepAwake(session, keepAwake);
2495 reply.writeNoException();
2496 return true;
2497 }
Craig Mautnere5600772015-04-03 21:36:37 -07002498
2499 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2500 data.enforceInterface(IActivityManager.descriptor);
2501 int userId = data.readInt();
2502 String[] packages = data.readStringArray();
2503 updateLockTaskPackages(userId, packages);
2504 reply.writeNoException();
2505 return true;
2506 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002507
2508 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2509 data.enforceInterface(IActivityManager.descriptor);
2510 String pkg = data.readString();
2511 int res = getPackageProcessState(pkg);
2512 reply.writeNoException();
2513 reply.writeInt(res);
2514 return true;
2515 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002516 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002517
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002518 return super.onTransact(code, data, reply, flags);
2519 }
2520
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002521 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002522 return this;
2523 }
2524
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002525 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2526 protected IActivityManager create() {
2527 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002528 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002529 Log.v("ActivityManager", "default service binder = " + b);
2530 }
2531 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002532 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002533 Log.v("ActivityManager", "default service = " + am);
2534 }
2535 return am;
2536 }
2537 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002538}
2539
2540class ActivityManagerProxy implements IActivityManager
2541{
2542 public ActivityManagerProxy(IBinder remote)
2543 {
2544 mRemote = remote;
2545 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002546
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002547 public IBinder asBinder()
2548 {
2549 return mRemote;
2550 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002551
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002552 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002553 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002554 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002555 Parcel data = Parcel.obtain();
2556 Parcel reply = Parcel.obtain();
2557 data.writeInterfaceToken(IActivityManager.descriptor);
2558 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002559 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002560 intent.writeToParcel(data, 0);
2561 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002562 data.writeStrongBinder(resultTo);
2563 data.writeString(resultWho);
2564 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002565 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002566 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002567 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002568 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002569 } else {
2570 data.writeInt(0);
2571 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002572 if (options != null) {
2573 data.writeInt(1);
2574 options.writeToParcel(data, 0);
2575 } else {
2576 data.writeInt(0);
2577 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002578 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2579 reply.readException();
2580 int result = reply.readInt();
2581 reply.recycle();
2582 data.recycle();
2583 return result;
2584 }
Amith Yamasani82644082012-08-03 13:09:11 -07002585
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002586 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002587 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002588 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2589 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
2593 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002594 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002595 intent.writeToParcel(data, 0);
2596 data.writeString(resolvedType);
2597 data.writeStrongBinder(resultTo);
2598 data.writeString(resultWho);
2599 data.writeInt(requestCode);
2600 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002601 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002602 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002603 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002604 } else {
2605 data.writeInt(0);
2606 }
2607 if (options != null) {
2608 data.writeInt(1);
2609 options.writeToParcel(data, 0);
2610 } else {
2611 data.writeInt(0);
2612 }
2613 data.writeInt(userId);
2614 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2615 reply.readException();
2616 int result = reply.readInt();
2617 reply.recycle();
2618 data.recycle();
2619 return result;
2620 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002621 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2622 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002623 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002624 Parcel data = Parcel.obtain();
2625 Parcel reply = Parcel.obtain();
2626 data.writeInterfaceToken(IActivityManager.descriptor);
2627 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2628 data.writeString(callingPackage);
2629 intent.writeToParcel(data, 0);
2630 data.writeString(resolvedType);
2631 data.writeStrongBinder(resultTo);
2632 data.writeString(resultWho);
2633 data.writeInt(requestCode);
2634 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002635 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002636 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002637 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002638 } else {
2639 data.writeInt(0);
2640 }
2641 if (options != null) {
2642 data.writeInt(1);
2643 options.writeToParcel(data, 0);
2644 } else {
2645 data.writeInt(0);
2646 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002647 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002648 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2649 reply.readException();
2650 int result = reply.readInt();
2651 reply.recycle();
2652 data.recycle();
2653 return result;
2654 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002655 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2656 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002657 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2658 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002659 Parcel data = Parcel.obtain();
2660 Parcel reply = Parcel.obtain();
2661 data.writeInterfaceToken(IActivityManager.descriptor);
2662 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002663 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002664 intent.writeToParcel(data, 0);
2665 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002666 data.writeStrongBinder(resultTo);
2667 data.writeString(resultWho);
2668 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002669 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002670 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002671 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002672 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002673 } else {
2674 data.writeInt(0);
2675 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002676 if (options != null) {
2677 data.writeInt(1);
2678 options.writeToParcel(data, 0);
2679 } else {
2680 data.writeInt(0);
2681 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002682 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002683 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2684 reply.readException();
2685 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2686 reply.recycle();
2687 data.recycle();
2688 return result;
2689 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002690 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2691 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002692 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002693 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002694 Parcel data = Parcel.obtain();
2695 Parcel reply = Parcel.obtain();
2696 data.writeInterfaceToken(IActivityManager.descriptor);
2697 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002698 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002699 intent.writeToParcel(data, 0);
2700 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002701 data.writeStrongBinder(resultTo);
2702 data.writeString(resultWho);
2703 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002704 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002705 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002706 if (options != null) {
2707 data.writeInt(1);
2708 options.writeToParcel(data, 0);
2709 } else {
2710 data.writeInt(0);
2711 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002712 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002713 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2714 reply.readException();
2715 int result = reply.readInt();
2716 reply.recycle();
2717 data.recycle();
2718 return result;
2719 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002720 public int startActivityIntentSender(IApplicationThread caller,
2721 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002722 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002723 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002724 Parcel data = Parcel.obtain();
2725 Parcel reply = Parcel.obtain();
2726 data.writeInterfaceToken(IActivityManager.descriptor);
2727 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2728 intent.writeToParcel(data, 0);
2729 if (fillInIntent != null) {
2730 data.writeInt(1);
2731 fillInIntent.writeToParcel(data, 0);
2732 } else {
2733 data.writeInt(0);
2734 }
2735 data.writeString(resolvedType);
2736 data.writeStrongBinder(resultTo);
2737 data.writeString(resultWho);
2738 data.writeInt(requestCode);
2739 data.writeInt(flagsMask);
2740 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002741 if (options != null) {
2742 data.writeInt(1);
2743 options.writeToParcel(data, 0);
2744 } else {
2745 data.writeInt(0);
2746 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002747 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002748 reply.readException();
2749 int result = reply.readInt();
2750 reply.recycle();
2751 data.recycle();
2752 return result;
2753 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002754 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2755 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002756 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2757 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002758 Parcel data = Parcel.obtain();
2759 Parcel reply = Parcel.obtain();
2760 data.writeInterfaceToken(IActivityManager.descriptor);
2761 data.writeString(callingPackage);
2762 data.writeInt(callingPid);
2763 data.writeInt(callingUid);
2764 intent.writeToParcel(data, 0);
2765 data.writeString(resolvedType);
2766 data.writeStrongBinder(session.asBinder());
2767 data.writeStrongBinder(interactor.asBinder());
2768 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002769 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002770 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002771 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002772 } else {
2773 data.writeInt(0);
2774 }
2775 if (options != null) {
2776 data.writeInt(1);
2777 options.writeToParcel(data, 0);
2778 } else {
2779 data.writeInt(0);
2780 }
2781 data.writeInt(userId);
2782 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2783 reply.readException();
2784 int result = reply.readInt();
2785 reply.recycle();
2786 data.recycle();
2787 return result;
2788 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002789 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002790 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002791 Parcel data = Parcel.obtain();
2792 Parcel reply = Parcel.obtain();
2793 data.writeInterfaceToken(IActivityManager.descriptor);
2794 data.writeStrongBinder(callingActivity);
2795 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002796 if (options != null) {
2797 data.writeInt(1);
2798 options.writeToParcel(data, 0);
2799 } else {
2800 data.writeInt(0);
2801 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002802 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2803 reply.readException();
2804 int result = reply.readInt();
2805 reply.recycle();
2806 data.recycle();
2807 return result != 0;
2808 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002809 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2810 Parcel data = Parcel.obtain();
2811 Parcel reply = Parcel.obtain();
2812 data.writeInterfaceToken(IActivityManager.descriptor);
2813 data.writeInt(taskId);
2814 if (options == null) {
2815 data.writeInt(0);
2816 } else {
2817 data.writeInt(1);
2818 options.writeToParcel(data, 0);
2819 }
2820 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2821 reply.readException();
2822 int result = reply.readInt();
2823 reply.recycle();
2824 data.recycle();
2825 return result;
2826 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002827 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002828 throws RemoteException {
2829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
2832 data.writeStrongBinder(token);
2833 data.writeInt(resultCode);
2834 if (resultData != null) {
2835 data.writeInt(1);
2836 resultData.writeToParcel(data, 0);
2837 } else {
2838 data.writeInt(0);
2839 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002840 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002841 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2842 reply.readException();
2843 boolean res = reply.readInt() != 0;
2844 data.recycle();
2845 reply.recycle();
2846 return res;
2847 }
2848 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2849 {
2850 Parcel data = Parcel.obtain();
2851 Parcel reply = Parcel.obtain();
2852 data.writeInterfaceToken(IActivityManager.descriptor);
2853 data.writeStrongBinder(token);
2854 data.writeString(resultWho);
2855 data.writeInt(requestCode);
2856 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2857 reply.readException();
2858 data.recycle();
2859 reply.recycle();
2860 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002861 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2862 Parcel data = Parcel.obtain();
2863 Parcel reply = Parcel.obtain();
2864 data.writeInterfaceToken(IActivityManager.descriptor);
2865 data.writeStrongBinder(token);
2866 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2867 reply.readException();
2868 boolean res = reply.readInt() != 0;
2869 data.recycle();
2870 reply.recycle();
2871 return res;
2872 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002873 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2874 Parcel data = Parcel.obtain();
2875 Parcel reply = Parcel.obtain();
2876 data.writeInterfaceToken(IActivityManager.descriptor);
2877 data.writeStrongBinder(session.asBinder());
2878 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2879 reply.readException();
2880 data.recycle();
2881 reply.recycle();
2882 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002883 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2884 Parcel data = Parcel.obtain();
2885 Parcel reply = Parcel.obtain();
2886 data.writeInterfaceToken(IActivityManager.descriptor);
2887 data.writeStrongBinder(token);
2888 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2889 reply.readException();
2890 boolean res = reply.readInt() != 0;
2891 data.recycle();
2892 reply.recycle();
2893 return res;
2894 }
2895 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2896 Parcel data = Parcel.obtain();
2897 Parcel reply = Parcel.obtain();
2898 data.writeInterfaceToken(IActivityManager.descriptor);
2899 data.writeStrongBinder(app.asBinder());
2900 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 data.recycle();
2903 reply.recycle();
2904 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002905 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2906 Parcel data = Parcel.obtain();
2907 Parcel reply = Parcel.obtain();
2908 data.writeInterfaceToken(IActivityManager.descriptor);
2909 data.writeStrongBinder(token);
2910 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2911 reply.readException();
2912 boolean res = reply.readInt() != 0;
2913 data.recycle();
2914 reply.recycle();
2915 return res;
2916 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002917 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002918 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002919 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002920 {
2921 Parcel data = Parcel.obtain();
2922 Parcel reply = Parcel.obtain();
2923 data.writeInterfaceToken(IActivityManager.descriptor);
2924 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002925 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002926 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2927 filter.writeToParcel(data, 0);
2928 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002929 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002930 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2931 reply.readException();
2932 Intent intent = null;
2933 int haveIntent = reply.readInt();
2934 if (haveIntent != 0) {
2935 intent = Intent.CREATOR.createFromParcel(reply);
2936 }
2937 reply.recycle();
2938 data.recycle();
2939 return intent;
2940 }
2941 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2942 {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 data.writeStrongBinder(receiver.asBinder());
2947 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 data.recycle();
2950 reply.recycle();
2951 }
2952 public int broadcastIntent(IApplicationThread caller,
2953 Intent intent, String resolvedType, IIntentReceiver resultTo,
2954 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002955 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002956 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002957 {
2958 Parcel data = Parcel.obtain();
2959 Parcel reply = Parcel.obtain();
2960 data.writeInterfaceToken(IActivityManager.descriptor);
2961 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2962 intent.writeToParcel(data, 0);
2963 data.writeString(resolvedType);
2964 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2965 data.writeInt(resultCode);
2966 data.writeString(resultData);
2967 data.writeBundle(map);
2968 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002969 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002970 data.writeInt(serialized ? 1 : 0);
2971 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002972 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2974 reply.readException();
2975 int res = reply.readInt();
2976 reply.recycle();
2977 data.recycle();
2978 return res;
2979 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002980 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2981 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002982 {
2983 Parcel data = Parcel.obtain();
2984 Parcel reply = Parcel.obtain();
2985 data.writeInterfaceToken(IActivityManager.descriptor);
2986 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2987 intent.writeToParcel(data, 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(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 data.recycle();
2992 reply.recycle();
2993 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002994 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
2995 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002996 {
2997 Parcel data = Parcel.obtain();
2998 Parcel reply = Parcel.obtain();
2999 data.writeInterfaceToken(IActivityManager.descriptor);
3000 data.writeStrongBinder(who);
3001 data.writeInt(resultCode);
3002 data.writeString(resultData);
3003 data.writeBundle(map);
3004 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003005 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3007 reply.readException();
3008 data.recycle();
3009 reply.recycle();
3010 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003011 public void attachApplication(IApplicationThread app) throws RemoteException
3012 {
3013 Parcel data = Parcel.obtain();
3014 Parcel reply = Parcel.obtain();
3015 data.writeInterfaceToken(IActivityManager.descriptor);
3016 data.writeStrongBinder(app.asBinder());
3017 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3018 reply.readException();
3019 data.recycle();
3020 reply.recycle();
3021 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003022 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3023 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003024 {
3025 Parcel data = Parcel.obtain();
3026 Parcel reply = Parcel.obtain();
3027 data.writeInterfaceToken(IActivityManager.descriptor);
3028 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003029 if (config != null) {
3030 data.writeInt(1);
3031 config.writeToParcel(data, 0);
3032 } else {
3033 data.writeInt(0);
3034 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003035 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003036 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3037 reply.readException();
3038 data.recycle();
3039 reply.recycle();
3040 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003041 public void activityResumed(IBinder token) throws RemoteException
3042 {
3043 Parcel data = Parcel.obtain();
3044 Parcel reply = Parcel.obtain();
3045 data.writeInterfaceToken(IActivityManager.descriptor);
3046 data.writeStrongBinder(token);
3047 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3048 reply.readException();
3049 data.recycle();
3050 reply.recycle();
3051 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003052 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003053 {
3054 Parcel data = Parcel.obtain();
3055 Parcel reply = Parcel.obtain();
3056 data.writeInterfaceToken(IActivityManager.descriptor);
3057 data.writeStrongBinder(token);
3058 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3059 reply.readException();
3060 data.recycle();
3061 reply.recycle();
3062 }
3063 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003064 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003065 {
3066 Parcel data = Parcel.obtain();
3067 Parcel reply = Parcel.obtain();
3068 data.writeInterfaceToken(IActivityManager.descriptor);
3069 data.writeStrongBinder(token);
3070 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003071 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003072 TextUtils.writeToParcel(description, data, 0);
3073 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3074 reply.readException();
3075 data.recycle();
3076 reply.recycle();
3077 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003078 public void activitySlept(IBinder token) throws RemoteException
3079 {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeStrongBinder(token);
3084 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3085 reply.readException();
3086 data.recycle();
3087 reply.recycle();
3088 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003089 public void activityDestroyed(IBinder token) throws RemoteException
3090 {
3091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
3094 data.writeStrongBinder(token);
3095 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3096 reply.readException();
3097 data.recycle();
3098 reply.recycle();
3099 }
3100 public String getCallingPackage(IBinder token) throws RemoteException
3101 {
3102 Parcel data = Parcel.obtain();
3103 Parcel reply = Parcel.obtain();
3104 data.writeInterfaceToken(IActivityManager.descriptor);
3105 data.writeStrongBinder(token);
3106 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3107 reply.readException();
3108 String res = reply.readString();
3109 data.recycle();
3110 reply.recycle();
3111 return res;
3112 }
3113 public ComponentName getCallingActivity(IBinder token)
3114 throws RemoteException {
3115 Parcel data = Parcel.obtain();
3116 Parcel reply = Parcel.obtain();
3117 data.writeInterfaceToken(IActivityManager.descriptor);
3118 data.writeStrongBinder(token);
3119 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3120 reply.readException();
3121 ComponentName res = ComponentName.readFromParcel(reply);
3122 data.recycle();
3123 reply.recycle();
3124 return res;
3125 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003126 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003127 Parcel data = Parcel.obtain();
3128 Parcel reply = Parcel.obtain();
3129 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003130 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003131 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3132 reply.readException();
3133 ArrayList<IAppTask> list = null;
3134 int N = reply.readInt();
3135 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003136 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003137 while (N > 0) {
3138 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3139 list.add(task);
3140 N--;
3141 }
3142 }
3143 data.recycle();
3144 reply.recycle();
3145 return list;
3146 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003147 public int addAppTask(IBinder activityToken, Intent intent,
3148 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
3151 data.writeInterfaceToken(IActivityManager.descriptor);
3152 data.writeStrongBinder(activityToken);
3153 intent.writeToParcel(data, 0);
3154 description.writeToParcel(data, 0);
3155 thumbnail.writeToParcel(data, 0);
3156 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3157 reply.readException();
3158 int res = reply.readInt();
3159 data.recycle();
3160 reply.recycle();
3161 return res;
3162 }
3163 public Point getAppTaskThumbnailSize() throws RemoteException {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3168 reply.readException();
3169 Point size = Point.CREATOR.createFromParcel(reply);
3170 data.recycle();
3171 reply.recycle();
3172 return size;
3173 }
Todd Kennedye635f662015-01-20 10:36:49 -08003174 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3175 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 data.writeInt(maxNum);
3180 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003181 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3182 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003183 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003184 int N = reply.readInt();
3185 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003186 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003187 while (N > 0) {
3188 ActivityManager.RunningTaskInfo info =
3189 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003190 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003191 list.add(info);
3192 N--;
3193 }
3194 }
3195 data.recycle();
3196 reply.recycle();
3197 return list;
3198 }
3199 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003200 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeInt(maxNum);
3205 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003206 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3208 reply.readException();
3209 ArrayList<ActivityManager.RecentTaskInfo> list
3210 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3211 data.recycle();
3212 reply.recycle();
3213 return list;
3214 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003215 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003216 Parcel data = Parcel.obtain();
3217 Parcel reply = Parcel.obtain();
3218 data.writeInterfaceToken(IActivityManager.descriptor);
3219 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003220 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003221 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003222 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003223 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003224 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003225 }
3226 data.recycle();
3227 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003228 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003229 }
Todd Kennedye635f662015-01-20 10:36:49 -08003230 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3231 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003232 Parcel data = Parcel.obtain();
3233 Parcel reply = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 data.writeInt(maxNum);
3236 data.writeInt(flags);
3237 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3238 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003239 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 int N = reply.readInt();
3241 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003242 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 while (N > 0) {
3244 ActivityManager.RunningServiceInfo info =
3245 ActivityManager.RunningServiceInfo.CREATOR
3246 .createFromParcel(reply);
3247 list.add(info);
3248 N--;
3249 }
3250 }
3251 data.recycle();
3252 reply.recycle();
3253 return list;
3254 }
3255 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3256 throws RemoteException {
3257 Parcel data = Parcel.obtain();
3258 Parcel reply = Parcel.obtain();
3259 data.writeInterfaceToken(IActivityManager.descriptor);
3260 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3261 reply.readException();
3262 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3263 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3264 data.recycle();
3265 reply.recycle();
3266 return list;
3267 }
3268 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3269 throws RemoteException {
3270 Parcel data = Parcel.obtain();
3271 Parcel reply = Parcel.obtain();
3272 data.writeInterfaceToken(IActivityManager.descriptor);
3273 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3274 reply.readException();
3275 ArrayList<ActivityManager.RunningAppProcessInfo> list
3276 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3277 data.recycle();
3278 reply.recycle();
3279 return list;
3280 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003281 public List<ApplicationInfo> getRunningExternalApplications()
3282 throws RemoteException {
3283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3287 reply.readException();
3288 ArrayList<ApplicationInfo> list
3289 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3290 data.recycle();
3291 reply.recycle();
3292 return list;
3293 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003294 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003295 {
3296 Parcel data = Parcel.obtain();
3297 Parcel reply = Parcel.obtain();
3298 data.writeInterfaceToken(IActivityManager.descriptor);
3299 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003300 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003301 if (options != null) {
3302 data.writeInt(1);
3303 options.writeToParcel(data, 0);
3304 } else {
3305 data.writeInt(0);
3306 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003307 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3308 reply.readException();
3309 data.recycle();
3310 reply.recycle();
3311 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003312 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3313 throws RemoteException {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 data.writeStrongBinder(token);
3318 data.writeInt(nonRoot ? 1 : 0);
3319 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3320 reply.readException();
3321 boolean res = reply.readInt() != 0;
3322 data.recycle();
3323 reply.recycle();
3324 return res;
3325 }
3326 public void moveTaskBackwards(int task) throws RemoteException
3327 {
3328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeInt(task);
3332 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3333 reply.readException();
3334 data.recycle();
3335 reply.recycle();
3336 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003337 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003338 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3339 {
3340 Parcel data = Parcel.obtain();
3341 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003342 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003343 data.writeInt(taskId);
3344 data.writeInt(stackId);
3345 data.writeInt(toTop ? 1 : 0);
3346 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3347 reply.readException();
3348 data.recycle();
3349 reply.recycle();
3350 }
3351 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003352 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003353 {
3354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003356 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003357 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003358 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003359 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003360 reply.readException();
3361 data.recycle();
3362 reply.recycle();
3363 }
Craig Mautner967212c2013-04-13 21:10:58 -07003364 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003365 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003366 {
3367 Parcel data = Parcel.obtain();
3368 Parcel reply = Parcel.obtain();
3369 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003370 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003371 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003372 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003373 data.recycle();
3374 reply.recycle();
3375 return list;
3376 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003377 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003378 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003379 {
3380 Parcel data = Parcel.obtain();
3381 Parcel reply = Parcel.obtain();
3382 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003383 data.writeInt(stackId);
3384 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003385 reply.readException();
3386 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003387 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003388 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003389 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003390 }
3391 data.recycle();
3392 reply.recycle();
3393 return info;
3394 }
3395 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003396 public boolean isInHomeStack(int taskId) throws RemoteException {
3397 Parcel data = Parcel.obtain();
3398 Parcel reply = Parcel.obtain();
3399 data.writeInterfaceToken(IActivityManager.descriptor);
3400 data.writeInt(taskId);
3401 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3402 reply.readException();
3403 boolean isInHomeStack = reply.readInt() > 0;
3404 data.recycle();
3405 reply.recycle();
3406 return isInHomeStack;
3407 }
3408 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003409 public void setFocusedStack(int stackId) throws RemoteException
3410 {
3411 Parcel data = Parcel.obtain();
3412 Parcel reply = Parcel.obtain();
3413 data.writeInterfaceToken(IActivityManager.descriptor);
3414 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003415 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003416 reply.readException();
3417 data.recycle();
3418 reply.recycle();
3419 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003420 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003421 public int getFocusedStackId() throws RemoteException {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
3424 data.writeInterfaceToken(IActivityManager.descriptor);
3425 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3426 reply.readException();
3427 int focusedStackId = reply.readInt();
3428 data.recycle();
3429 reply.recycle();
3430 return focusedStackId;
3431 }
3432 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003433 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3434 {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003439 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003440 reply.readException();
3441 data.recycle();
3442 reply.recycle();
3443 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003444 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3445 {
3446 Parcel data = Parcel.obtain();
3447 Parcel reply = Parcel.obtain();
3448 data.writeInterfaceToken(IActivityManager.descriptor);
3449 data.writeStrongBinder(token);
3450 data.writeInt(onlyRoot ? 1 : 0);
3451 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3452 reply.readException();
3453 int res = reply.readInt();
3454 data.recycle();
3455 reply.recycle();
3456 return res;
3457 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003458 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003459 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 Parcel data = Parcel.obtain();
3461 Parcel reply = Parcel.obtain();
3462 data.writeInterfaceToken(IActivityManager.descriptor);
3463 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3464 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003465 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003466 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003467 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 int res = reply.readInt();
3470 ContentProviderHolder cph = null;
3471 if (res != 0) {
3472 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3473 }
3474 data.recycle();
3475 reply.recycle();
3476 return cph;
3477 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003478 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3479 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003480 Parcel data = Parcel.obtain();
3481 Parcel reply = Parcel.obtain();
3482 data.writeInterfaceToken(IActivityManager.descriptor);
3483 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003484 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003485 data.writeStrongBinder(token);
3486 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3487 reply.readException();
3488 int res = reply.readInt();
3489 ContentProviderHolder cph = null;
3490 if (res != 0) {
3491 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3492 }
3493 data.recycle();
3494 reply.recycle();
3495 return cph;
3496 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003497 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003498 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 {
3500 Parcel data = Parcel.obtain();
3501 Parcel reply = Parcel.obtain();
3502 data.writeInterfaceToken(IActivityManager.descriptor);
3503 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3504 data.writeTypedList(providers);
3505 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3506 reply.readException();
3507 data.recycle();
3508 reply.recycle();
3509 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003510 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3511 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003512 Parcel data = Parcel.obtain();
3513 Parcel reply = Parcel.obtain();
3514 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003515 data.writeStrongBinder(connection);
3516 data.writeInt(stable);
3517 data.writeInt(unstable);
3518 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3519 reply.readException();
3520 boolean res = reply.readInt() != 0;
3521 data.recycle();
3522 reply.recycle();
3523 return res;
3524 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003525
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003526 public void unstableProviderDied(IBinder connection) throws RemoteException {
3527 Parcel data = Parcel.obtain();
3528 Parcel reply = Parcel.obtain();
3529 data.writeInterfaceToken(IActivityManager.descriptor);
3530 data.writeStrongBinder(connection);
3531 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3532 reply.readException();
3533 data.recycle();
3534 reply.recycle();
3535 }
3536
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003537 @Override
3538 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3539 Parcel data = Parcel.obtain();
3540 Parcel reply = Parcel.obtain();
3541 data.writeInterfaceToken(IActivityManager.descriptor);
3542 data.writeStrongBinder(connection);
3543 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3544 reply.readException();
3545 data.recycle();
3546 reply.recycle();
3547 }
3548
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003549 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3550 Parcel data = Parcel.obtain();
3551 Parcel reply = Parcel.obtain();
3552 data.writeInterfaceToken(IActivityManager.descriptor);
3553 data.writeStrongBinder(connection);
3554 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003555 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3556 reply.readException();
3557 data.recycle();
3558 reply.recycle();
3559 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003560
3561 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 data.writeString(name);
3566 data.writeStrongBinder(token);
3567 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 data.recycle();
3570 reply.recycle();
3571 }
3572
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003573 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3574 throws RemoteException
3575 {
3576 Parcel data = Parcel.obtain();
3577 Parcel reply = Parcel.obtain();
3578 data.writeInterfaceToken(IActivityManager.descriptor);
3579 service.writeToParcel(data, 0);
3580 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3581 reply.readException();
3582 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3583 data.recycle();
3584 reply.recycle();
3585 return res;
3586 }
3587
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003588 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003589 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003590 {
3591 Parcel data = Parcel.obtain();
3592 Parcel reply = Parcel.obtain();
3593 data.writeInterfaceToken(IActivityManager.descriptor);
3594 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3595 service.writeToParcel(data, 0);
3596 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003597 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003598 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3599 reply.readException();
3600 ComponentName res = ComponentName.readFromParcel(reply);
3601 data.recycle();
3602 reply.recycle();
3603 return res;
3604 }
3605 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003606 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003607 {
3608 Parcel data = Parcel.obtain();
3609 Parcel reply = Parcel.obtain();
3610 data.writeInterfaceToken(IActivityManager.descriptor);
3611 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3612 service.writeToParcel(data, 0);
3613 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003614 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003615 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3616 reply.readException();
3617 int res = reply.readInt();
3618 reply.recycle();
3619 data.recycle();
3620 return res;
3621 }
3622 public boolean stopServiceToken(ComponentName className, IBinder token,
3623 int startId) throws RemoteException {
3624 Parcel data = Parcel.obtain();
3625 Parcel reply = Parcel.obtain();
3626 data.writeInterfaceToken(IActivityManager.descriptor);
3627 ComponentName.writeToParcel(className, data);
3628 data.writeStrongBinder(token);
3629 data.writeInt(startId);
3630 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3631 reply.readException();
3632 boolean res = reply.readInt() != 0;
3633 data.recycle();
3634 reply.recycle();
3635 return res;
3636 }
3637 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003638 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003639 Parcel data = Parcel.obtain();
3640 Parcel reply = Parcel.obtain();
3641 data.writeInterfaceToken(IActivityManager.descriptor);
3642 ComponentName.writeToParcel(className, data);
3643 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003644 data.writeInt(id);
3645 if (notification != null) {
3646 data.writeInt(1);
3647 notification.writeToParcel(data, 0);
3648 } else {
3649 data.writeInt(0);
3650 }
3651 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003652 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3653 reply.readException();
3654 data.recycle();
3655 reply.recycle();
3656 }
3657 public int bindService(IApplicationThread caller, IBinder token,
3658 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003659 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003660 Parcel data = Parcel.obtain();
3661 Parcel reply = Parcel.obtain();
3662 data.writeInterfaceToken(IActivityManager.descriptor);
3663 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3664 data.writeStrongBinder(token);
3665 service.writeToParcel(data, 0);
3666 data.writeString(resolvedType);
3667 data.writeStrongBinder(connection.asBinder());
3668 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003669 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003670 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3671 reply.readException();
3672 int res = reply.readInt();
3673 data.recycle();
3674 reply.recycle();
3675 return res;
3676 }
3677 public boolean unbindService(IServiceConnection connection) throws RemoteException
3678 {
3679 Parcel data = Parcel.obtain();
3680 Parcel reply = Parcel.obtain();
3681 data.writeInterfaceToken(IActivityManager.descriptor);
3682 data.writeStrongBinder(connection.asBinder());
3683 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 boolean res = reply.readInt() != 0;
3686 data.recycle();
3687 reply.recycle();
3688 return res;
3689 }
3690
3691 public void publishService(IBinder token,
3692 Intent intent, IBinder service) throws RemoteException {
3693 Parcel data = Parcel.obtain();
3694 Parcel reply = Parcel.obtain();
3695 data.writeInterfaceToken(IActivityManager.descriptor);
3696 data.writeStrongBinder(token);
3697 intent.writeToParcel(data, 0);
3698 data.writeStrongBinder(service);
3699 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3700 reply.readException();
3701 data.recycle();
3702 reply.recycle();
3703 }
3704
3705 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3706 throws RemoteException {
3707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 data.writeStrongBinder(token);
3711 intent.writeToParcel(data, 0);
3712 data.writeInt(doRebind ? 1 : 0);
3713 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3714 reply.readException();
3715 data.recycle();
3716 reply.recycle();
3717 }
3718
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003719 public void serviceDoneExecuting(IBinder token, int type, int startId,
3720 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003721 Parcel data = Parcel.obtain();
3722 Parcel reply = Parcel.obtain();
3723 data.writeInterfaceToken(IActivityManager.descriptor);
3724 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003725 data.writeInt(type);
3726 data.writeInt(startId);
3727 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003728 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3729 reply.readException();
3730 data.recycle();
3731 reply.recycle();
3732 }
3733
3734 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 service.writeToParcel(data, 0);
3739 data.writeString(resolvedType);
3740 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3741 reply.readException();
3742 IBinder binder = reply.readStrongBinder();
3743 reply.recycle();
3744 data.recycle();
3745 return binder;
3746 }
3747
Christopher Tate181fafa2009-05-14 11:12:14 -07003748 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3749 throws RemoteException {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 app.writeToParcel(data, 0);
3754 data.writeInt(backupRestoreMode);
3755 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3756 reply.readException();
3757 boolean success = reply.readInt() != 0;
3758 reply.recycle();
3759 data.recycle();
3760 return success;
3761 }
3762
Christopher Tate346acb12012-10-15 19:20:25 -07003763 public void clearPendingBackup() throws RemoteException {
3764 Parcel data = Parcel.obtain();
3765 Parcel reply = Parcel.obtain();
3766 data.writeInterfaceToken(IActivityManager.descriptor);
3767 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3768 reply.recycle();
3769 data.recycle();
3770 }
3771
Christopher Tate181fafa2009-05-14 11:12:14 -07003772 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3773 Parcel data = Parcel.obtain();
3774 Parcel reply = Parcel.obtain();
3775 data.writeInterfaceToken(IActivityManager.descriptor);
3776 data.writeString(packageName);
3777 data.writeStrongBinder(agent);
3778 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3779 reply.recycle();
3780 data.recycle();
3781 }
3782
3783 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3784 Parcel data = Parcel.obtain();
3785 Parcel reply = Parcel.obtain();
3786 data.writeInterfaceToken(IActivityManager.descriptor);
3787 app.writeToParcel(data, 0);
3788 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3789 reply.readException();
3790 reply.recycle();
3791 data.recycle();
3792 }
3793
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003794 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003795 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003796 IUiAutomationConnection connection, int userId, String instructionSet)
3797 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003798 Parcel data = Parcel.obtain();
3799 Parcel reply = Parcel.obtain();
3800 data.writeInterfaceToken(IActivityManager.descriptor);
3801 ComponentName.writeToParcel(className, data);
3802 data.writeString(profileFile);
3803 data.writeInt(flags);
3804 data.writeBundle(arguments);
3805 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003806 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003807 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003808 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003809 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3810 reply.readException();
3811 boolean res = reply.readInt() != 0;
3812 reply.recycle();
3813 data.recycle();
3814 return res;
3815 }
3816
3817 public void finishInstrumentation(IApplicationThread target,
3818 int resultCode, Bundle results) throws RemoteException {
3819 Parcel data = Parcel.obtain();
3820 Parcel reply = Parcel.obtain();
3821 data.writeInterfaceToken(IActivityManager.descriptor);
3822 data.writeStrongBinder(target != null ? target.asBinder() : null);
3823 data.writeInt(resultCode);
3824 data.writeBundle(results);
3825 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3826 reply.readException();
3827 data.recycle();
3828 reply.recycle();
3829 }
3830 public Configuration getConfiguration() throws RemoteException
3831 {
3832 Parcel data = Parcel.obtain();
3833 Parcel reply = Parcel.obtain();
3834 data.writeInterfaceToken(IActivityManager.descriptor);
3835 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3836 reply.readException();
3837 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3838 reply.recycle();
3839 data.recycle();
3840 return res;
3841 }
3842 public void updateConfiguration(Configuration values) throws RemoteException
3843 {
3844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
3847 values.writeToParcel(data, 0);
3848 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3849 reply.readException();
3850 data.recycle();
3851 reply.recycle();
3852 }
3853 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3854 throws RemoteException {
3855 Parcel data = Parcel.obtain();
3856 Parcel reply = Parcel.obtain();
3857 data.writeInterfaceToken(IActivityManager.descriptor);
3858 data.writeStrongBinder(token);
3859 data.writeInt(requestedOrientation);
3860 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3861 reply.readException();
3862 data.recycle();
3863 reply.recycle();
3864 }
3865 public int getRequestedOrientation(IBinder token) throws RemoteException {
3866 Parcel data = Parcel.obtain();
3867 Parcel reply = Parcel.obtain();
3868 data.writeInterfaceToken(IActivityManager.descriptor);
3869 data.writeStrongBinder(token);
3870 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3871 reply.readException();
3872 int res = reply.readInt();
3873 data.recycle();
3874 reply.recycle();
3875 return res;
3876 }
3877 public ComponentName getActivityClassForToken(IBinder token)
3878 throws RemoteException {
3879 Parcel data = Parcel.obtain();
3880 Parcel reply = Parcel.obtain();
3881 data.writeInterfaceToken(IActivityManager.descriptor);
3882 data.writeStrongBinder(token);
3883 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3884 reply.readException();
3885 ComponentName res = ComponentName.readFromParcel(reply);
3886 data.recycle();
3887 reply.recycle();
3888 return res;
3889 }
3890 public String getPackageForToken(IBinder token) throws RemoteException
3891 {
3892 Parcel data = Parcel.obtain();
3893 Parcel reply = Parcel.obtain();
3894 data.writeInterfaceToken(IActivityManager.descriptor);
3895 data.writeStrongBinder(token);
3896 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3897 reply.readException();
3898 String res = reply.readString();
3899 data.recycle();
3900 reply.recycle();
3901 return res;
3902 }
3903 public IIntentSender getIntentSender(int type,
3904 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003905 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003906 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003907 Parcel data = Parcel.obtain();
3908 Parcel reply = Parcel.obtain();
3909 data.writeInterfaceToken(IActivityManager.descriptor);
3910 data.writeInt(type);
3911 data.writeString(packageName);
3912 data.writeStrongBinder(token);
3913 data.writeString(resultWho);
3914 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003915 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003916 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003917 data.writeTypedArray(intents, 0);
3918 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003919 } else {
3920 data.writeInt(0);
3921 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003922 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003923 if (options != null) {
3924 data.writeInt(1);
3925 options.writeToParcel(data, 0);
3926 } else {
3927 data.writeInt(0);
3928 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003929 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003930 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3931 reply.readException();
3932 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003933 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003934 data.recycle();
3935 reply.recycle();
3936 return res;
3937 }
3938 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3939 Parcel data = Parcel.obtain();
3940 Parcel reply = Parcel.obtain();
3941 data.writeInterfaceToken(IActivityManager.descriptor);
3942 data.writeStrongBinder(sender.asBinder());
3943 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3944 reply.readException();
3945 data.recycle();
3946 reply.recycle();
3947 }
3948 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3949 Parcel data = Parcel.obtain();
3950 Parcel reply = Parcel.obtain();
3951 data.writeInterfaceToken(IActivityManager.descriptor);
3952 data.writeStrongBinder(sender.asBinder());
3953 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 String res = reply.readString();
3956 data.recycle();
3957 reply.recycle();
3958 return res;
3959 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003960 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3961 Parcel data = Parcel.obtain();
3962 Parcel reply = Parcel.obtain();
3963 data.writeInterfaceToken(IActivityManager.descriptor);
3964 data.writeStrongBinder(sender.asBinder());
3965 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 int res = reply.readInt();
3968 data.recycle();
3969 reply.recycle();
3970 return res;
3971 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003972 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3973 boolean requireFull, String name, String callerPackage) throws RemoteException {
3974 Parcel data = Parcel.obtain();
3975 Parcel reply = Parcel.obtain();
3976 data.writeInterfaceToken(IActivityManager.descriptor);
3977 data.writeInt(callingPid);
3978 data.writeInt(callingUid);
3979 data.writeInt(userId);
3980 data.writeInt(allowAll ? 1 : 0);
3981 data.writeInt(requireFull ? 1 : 0);
3982 data.writeString(name);
3983 data.writeString(callerPackage);
3984 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3985 reply.readException();
3986 int res = reply.readInt();
3987 data.recycle();
3988 reply.recycle();
3989 return res;
3990 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003991 public void setProcessLimit(int max) throws RemoteException
3992 {
3993 Parcel data = Parcel.obtain();
3994 Parcel reply = Parcel.obtain();
3995 data.writeInterfaceToken(IActivityManager.descriptor);
3996 data.writeInt(max);
3997 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3998 reply.readException();
3999 data.recycle();
4000 reply.recycle();
4001 }
4002 public int getProcessLimit() throws RemoteException
4003 {
4004 Parcel data = Parcel.obtain();
4005 Parcel reply = Parcel.obtain();
4006 data.writeInterfaceToken(IActivityManager.descriptor);
4007 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4008 reply.readException();
4009 int res = reply.readInt();
4010 data.recycle();
4011 reply.recycle();
4012 return res;
4013 }
4014 public void setProcessForeground(IBinder token, int pid,
4015 boolean isForeground) throws RemoteException {
4016 Parcel data = Parcel.obtain();
4017 Parcel reply = Parcel.obtain();
4018 data.writeInterfaceToken(IActivityManager.descriptor);
4019 data.writeStrongBinder(token);
4020 data.writeInt(pid);
4021 data.writeInt(isForeground ? 1 : 0);
4022 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4023 reply.readException();
4024 data.recycle();
4025 reply.recycle();
4026 }
4027 public int checkPermission(String permission, int pid, int uid)
4028 throws RemoteException {
4029 Parcel data = Parcel.obtain();
4030 Parcel reply = Parcel.obtain();
4031 data.writeInterfaceToken(IActivityManager.descriptor);
4032 data.writeString(permission);
4033 data.writeInt(pid);
4034 data.writeInt(uid);
4035 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4036 reply.readException();
4037 int res = reply.readInt();
4038 data.recycle();
4039 reply.recycle();
4040 return res;
4041 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004042 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4043 throws RemoteException {
4044 Parcel data = Parcel.obtain();
4045 Parcel reply = Parcel.obtain();
4046 data.writeInterfaceToken(IActivityManager.descriptor);
4047 data.writeString(permission);
4048 data.writeInt(pid);
4049 data.writeInt(uid);
4050 data.writeStrongBinder(callerToken);
4051 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4052 reply.readException();
4053 int res = reply.readInt();
4054 data.recycle();
4055 reply.recycle();
4056 return res;
4057 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004058 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004059 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004064 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004065 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004066 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4067 reply.readException();
4068 boolean res = reply.readInt() != 0;
4069 data.recycle();
4070 reply.recycle();
4071 return res;
4072 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004073 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4074 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 uri.writeToParcel(data, 0);
4079 data.writeInt(pid);
4080 data.writeInt(uid);
4081 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004082 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004083 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004084 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4085 reply.readException();
4086 int res = reply.readInt();
4087 data.recycle();
4088 reply.recycle();
4089 return res;
4090 }
4091 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004092 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004093 Parcel data = Parcel.obtain();
4094 Parcel reply = Parcel.obtain();
4095 data.writeInterfaceToken(IActivityManager.descriptor);
4096 data.writeStrongBinder(caller.asBinder());
4097 data.writeString(targetPkg);
4098 uri.writeToParcel(data, 0);
4099 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004100 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004101 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4102 reply.readException();
4103 data.recycle();
4104 reply.recycle();
4105 }
4106 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004107 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004108 Parcel data = Parcel.obtain();
4109 Parcel reply = Parcel.obtain();
4110 data.writeInterfaceToken(IActivityManager.descriptor);
4111 data.writeStrongBinder(caller.asBinder());
4112 uri.writeToParcel(data, 0);
4113 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004114 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004115 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4116 reply.readException();
4117 data.recycle();
4118 reply.recycle();
4119 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004120
4121 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004122 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4123 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004124 Parcel data = Parcel.obtain();
4125 Parcel reply = Parcel.obtain();
4126 data.writeInterfaceToken(IActivityManager.descriptor);
4127 uri.writeToParcel(data, 0);
4128 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004129 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004130 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4131 reply.readException();
4132 data.recycle();
4133 reply.recycle();
4134 }
4135
4136 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004137 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4138 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004139 Parcel data = Parcel.obtain();
4140 Parcel reply = Parcel.obtain();
4141 data.writeInterfaceToken(IActivityManager.descriptor);
4142 uri.writeToParcel(data, 0);
4143 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004144 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004145 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4146 reply.readException();
4147 data.recycle();
4148 reply.recycle();
4149 }
4150
4151 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004152 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4153 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004154 Parcel data = Parcel.obtain();
4155 Parcel reply = Parcel.obtain();
4156 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004157 data.writeString(packageName);
4158 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004159 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4160 reply.readException();
4161 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4162 reply);
4163 data.recycle();
4164 reply.recycle();
4165 return perms;
4166 }
4167
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004168 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4169 throws RemoteException {
4170 Parcel data = Parcel.obtain();
4171 Parcel reply = Parcel.obtain();
4172 data.writeInterfaceToken(IActivityManager.descriptor);
4173 data.writeStrongBinder(who.asBinder());
4174 data.writeInt(waiting ? 1 : 0);
4175 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4176 reply.readException();
4177 data.recycle();
4178 reply.recycle();
4179 }
4180 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4185 reply.readException();
4186 outInfo.readFromParcel(reply);
4187 data.recycle();
4188 reply.recycle();
4189 }
4190 public void unhandledBack() throws RemoteException
4191 {
4192 Parcel data = Parcel.obtain();
4193 Parcel reply = Parcel.obtain();
4194 data.writeInterfaceToken(IActivityManager.descriptor);
4195 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4196 reply.readException();
4197 data.recycle();
4198 reply.recycle();
4199 }
4200 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4201 {
4202 Parcel data = Parcel.obtain();
4203 Parcel reply = Parcel.obtain();
4204 data.writeInterfaceToken(IActivityManager.descriptor);
4205 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4206 reply.readException();
4207 ParcelFileDescriptor pfd = null;
4208 if (reply.readInt() != 0) {
4209 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4210 }
4211 data.recycle();
4212 reply.recycle();
4213 return pfd;
4214 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004215 public void setLockScreenShown(boolean shown) throws RemoteException
4216 {
4217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 data.writeInt(shown ? 1 : 0);
4221 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4222 reply.readException();
4223 data.recycle();
4224 reply.recycle();
4225 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004226 public void setDebugApp(
4227 String packageName, boolean waitForDebugger, boolean persistent)
4228 throws RemoteException
4229 {
4230 Parcel data = Parcel.obtain();
4231 Parcel reply = Parcel.obtain();
4232 data.writeInterfaceToken(IActivityManager.descriptor);
4233 data.writeString(packageName);
4234 data.writeInt(waitForDebugger ? 1 : 0);
4235 data.writeInt(persistent ? 1 : 0);
4236 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4237 reply.readException();
4238 data.recycle();
4239 reply.recycle();
4240 }
4241 public void setAlwaysFinish(boolean enabled) throws RemoteException
4242 {
4243 Parcel data = Parcel.obtain();
4244 Parcel reply = Parcel.obtain();
4245 data.writeInterfaceToken(IActivityManager.descriptor);
4246 data.writeInt(enabled ? 1 : 0);
4247 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4248 reply.readException();
4249 data.recycle();
4250 reply.recycle();
4251 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004252 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004253 {
4254 Parcel data = Parcel.obtain();
4255 Parcel reply = Parcel.obtain();
4256 data.writeInterfaceToken(IActivityManager.descriptor);
4257 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004258 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004259 reply.readException();
4260 data.recycle();
4261 reply.recycle();
4262 }
4263 public void enterSafeMode() throws RemoteException {
4264 Parcel data = Parcel.obtain();
4265 data.writeInterfaceToken(IActivityManager.descriptor);
4266 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4267 data.recycle();
4268 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004269 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004270 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004271 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004272 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004273 data.writeStrongBinder(sender.asBinder());
4274 data.writeInt(sourceUid);
4275 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004276 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004277 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4278 data.recycle();
4279 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004280 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4281 throws RemoteException {
4282 Parcel data = Parcel.obtain();
4283 data.writeInterfaceToken(IActivityManager.descriptor);
4284 data.writeStrongBinder(sender.asBinder());
4285 data.writeInt(sourceUid);
4286 data.writeString(tag);
4287 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4288 data.recycle();
4289 }
4290 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4291 throws RemoteException {
4292 Parcel data = Parcel.obtain();
4293 data.writeInterfaceToken(IActivityManager.descriptor);
4294 data.writeStrongBinder(sender.asBinder());
4295 data.writeInt(sourceUid);
4296 data.writeString(tag);
4297 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4298 data.recycle();
4299 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004300 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004301 Parcel data = Parcel.obtain();
4302 Parcel reply = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004305 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004306 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004307 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004308 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004309 boolean res = reply.readInt() != 0;
4310 data.recycle();
4311 reply.recycle();
4312 return res;
4313 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004314 @Override
4315 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4316 Parcel data = Parcel.obtain();
4317 Parcel reply = Parcel.obtain();
4318 data.writeInterfaceToken(IActivityManager.descriptor);
4319 data.writeString(reason);
4320 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4321 boolean res = reply.readInt() != 0;
4322 data.recycle();
4323 reply.recycle();
4324 return res;
4325 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004326 public boolean testIsSystemReady()
4327 {
4328 /* this base class version is never called */
4329 return true;
4330 }
Dan Egnor60d87622009-12-16 16:32:58 -08004331 public void handleApplicationCrash(IBinder app,
4332 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4333 {
4334 Parcel data = Parcel.obtain();
4335 Parcel reply = Parcel.obtain();
4336 data.writeInterfaceToken(IActivityManager.descriptor);
4337 data.writeStrongBinder(app);
4338 crashInfo.writeToParcel(data, 0);
4339 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4340 reply.readException();
4341 reply.recycle();
4342 data.recycle();
4343 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004344
Dianne Hackborn52322712014-08-26 22:47:26 -07004345 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004346 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004347 {
4348 Parcel data = Parcel.obtain();
4349 Parcel reply = Parcel.obtain();
4350 data.writeInterfaceToken(IActivityManager.descriptor);
4351 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004352 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004353 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004354 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004355 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004356 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004357 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004358 reply.recycle();
4359 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004360 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004361 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004362
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004363 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004364 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004365 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004366 {
4367 Parcel data = Parcel.obtain();
4368 Parcel reply = Parcel.obtain();
4369 data.writeInterfaceToken(IActivityManager.descriptor);
4370 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004371 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004372 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004373 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4374 reply.readException();
4375 reply.recycle();
4376 data.recycle();
4377 }
4378
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004379 public void signalPersistentProcesses(int sig) throws RemoteException {
4380 Parcel data = Parcel.obtain();
4381 Parcel reply = Parcel.obtain();
4382 data.writeInterfaceToken(IActivityManager.descriptor);
4383 data.writeInt(sig);
4384 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4385 reply.readException();
4386 data.recycle();
4387 reply.recycle();
4388 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004389
Dianne Hackborn1676c852012-09-10 14:52:30 -07004390 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004391 Parcel data = Parcel.obtain();
4392 Parcel reply = Parcel.obtain();
4393 data.writeInterfaceToken(IActivityManager.descriptor);
4394 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004395 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004396 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4397 reply.readException();
4398 data.recycle();
4399 reply.recycle();
4400 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004401
4402 public void killAllBackgroundProcesses() throws RemoteException {
4403 Parcel data = Parcel.obtain();
4404 Parcel reply = Parcel.obtain();
4405 data.writeInterfaceToken(IActivityManager.descriptor);
4406 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4407 reply.readException();
4408 data.recycle();
4409 reply.recycle();
4410 }
4411
Dianne Hackborn1676c852012-09-10 14:52:30 -07004412 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004413 Parcel data = Parcel.obtain();
4414 Parcel reply = Parcel.obtain();
4415 data.writeInterfaceToken(IActivityManager.descriptor);
4416 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004417 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004418 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004419 reply.readException();
4420 data.recycle();
4421 reply.recycle();
4422 }
4423
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004424 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4425 throws RemoteException
4426 {
4427 Parcel data = Parcel.obtain();
4428 Parcel reply = Parcel.obtain();
4429 data.writeInterfaceToken(IActivityManager.descriptor);
4430 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4431 reply.readException();
4432 outInfo.readFromParcel(reply);
4433 reply.recycle();
4434 data.recycle();
4435 }
4436
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004437 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4438 {
4439 Parcel data = Parcel.obtain();
4440 Parcel reply = Parcel.obtain();
4441 data.writeInterfaceToken(IActivityManager.descriptor);
4442 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4443 reply.readException();
4444 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4445 reply.recycle();
4446 data.recycle();
4447 return res;
4448 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004449
Dianne Hackborn1676c852012-09-10 14:52:30 -07004450 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004451 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004452 {
4453 Parcel data = Parcel.obtain();
4454 Parcel reply = Parcel.obtain();
4455 data.writeInterfaceToken(IActivityManager.descriptor);
4456 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004457 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004458 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004459 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004460 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004461 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004462 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004463 } else {
4464 data.writeInt(0);
4465 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004466 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4467 reply.readException();
4468 boolean res = reply.readInt() != 0;
4469 reply.recycle();
4470 data.recycle();
4471 return res;
4472 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004473
Dianne Hackborn55280a92009-05-07 15:53:46 -07004474 public boolean shutdown(int timeout) throws RemoteException
4475 {
4476 Parcel data = Parcel.obtain();
4477 Parcel reply = Parcel.obtain();
4478 data.writeInterfaceToken(IActivityManager.descriptor);
4479 data.writeInt(timeout);
4480 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4481 reply.readException();
4482 boolean res = reply.readInt() != 0;
4483 reply.recycle();
4484 data.recycle();
4485 return res;
4486 }
4487
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004488 public void stopAppSwitches() throws RemoteException {
4489 Parcel data = Parcel.obtain();
4490 Parcel reply = Parcel.obtain();
4491 data.writeInterfaceToken(IActivityManager.descriptor);
4492 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4493 reply.readException();
4494 reply.recycle();
4495 data.recycle();
4496 }
4497
4498 public void resumeAppSwitches() throws RemoteException {
4499 Parcel data = Parcel.obtain();
4500 Parcel reply = Parcel.obtain();
4501 data.writeInterfaceToken(IActivityManager.descriptor);
4502 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4503 reply.readException();
4504 reply.recycle();
4505 data.recycle();
4506 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004507
4508 public void addPackageDependency(String packageName) throws RemoteException {
4509 Parcel data = Parcel.obtain();
4510 Parcel reply = Parcel.obtain();
4511 data.writeInterfaceToken(IActivityManager.descriptor);
4512 data.writeString(packageName);
4513 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4514 reply.readException();
4515 data.recycle();
4516 reply.recycle();
4517 }
4518
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004519 public void killApplicationWithAppId(String pkg, int appid, String reason)
4520 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004521 Parcel data = Parcel.obtain();
4522 Parcel reply = Parcel.obtain();
4523 data.writeInterfaceToken(IActivityManager.descriptor);
4524 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004525 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004526 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004527 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004528 reply.readException();
4529 data.recycle();
4530 reply.recycle();
4531 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004532
4533 public void closeSystemDialogs(String reason) throws RemoteException {
4534 Parcel data = Parcel.obtain();
4535 Parcel reply = Parcel.obtain();
4536 data.writeInterfaceToken(IActivityManager.descriptor);
4537 data.writeString(reason);
4538 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4539 reply.readException();
4540 data.recycle();
4541 reply.recycle();
4542 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004543
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004544 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004545 throws RemoteException {
4546 Parcel data = Parcel.obtain();
4547 Parcel reply = Parcel.obtain();
4548 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004549 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004550 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4551 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004552 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004553 data.recycle();
4554 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004555 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004556 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004557
4558 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4559 Parcel data = Parcel.obtain();
4560 Parcel reply = Parcel.obtain();
4561 data.writeInterfaceToken(IActivityManager.descriptor);
4562 data.writeString(processName);
4563 data.writeInt(uid);
4564 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4565 reply.readException();
4566 data.recycle();
4567 reply.recycle();
4568 }
4569
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004570 public void overridePendingTransition(IBinder token, String packageName,
4571 int enterAnim, int exitAnim) throws RemoteException {
4572 Parcel data = Parcel.obtain();
4573 Parcel reply = Parcel.obtain();
4574 data.writeInterfaceToken(IActivityManager.descriptor);
4575 data.writeStrongBinder(token);
4576 data.writeString(packageName);
4577 data.writeInt(enterAnim);
4578 data.writeInt(exitAnim);
4579 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4580 reply.readException();
4581 data.recycle();
4582 reply.recycle();
4583 }
4584
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004585 public boolean isUserAMonkey() throws RemoteException {
4586 Parcel data = Parcel.obtain();
4587 Parcel reply = Parcel.obtain();
4588 data.writeInterfaceToken(IActivityManager.descriptor);
4589 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4590 reply.readException();
4591 boolean res = reply.readInt() != 0;
4592 data.recycle();
4593 reply.recycle();
4594 return res;
4595 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004596
4597 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4598 Parcel data = Parcel.obtain();
4599 Parcel reply = Parcel.obtain();
4600 data.writeInterfaceToken(IActivityManager.descriptor);
4601 data.writeInt(monkey ? 1 : 0);
4602 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4603 reply.readException();
4604 data.recycle();
4605 reply.recycle();
4606 }
4607
Dianne Hackborn860755f2010-06-03 18:47:52 -07004608 public void finishHeavyWeightApp() throws RemoteException {
4609 Parcel data = Parcel.obtain();
4610 Parcel reply = Parcel.obtain();
4611 data.writeInterfaceToken(IActivityManager.descriptor);
4612 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4613 reply.readException();
4614 data.recycle();
4615 reply.recycle();
4616 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004617
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004618 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004619 throws RemoteException {
4620 Parcel data = Parcel.obtain();
4621 Parcel reply = Parcel.obtain();
4622 data.writeInterfaceToken(IActivityManager.descriptor);
4623 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004624 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4625 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004626 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004627 data.recycle();
4628 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004629 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004630 }
4631
Craig Mautner233ceee2014-05-09 17:05:11 -07004632 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004633 throws RemoteException {
4634 Parcel data = Parcel.obtain();
4635 Parcel reply = Parcel.obtain();
4636 data.writeInterfaceToken(IActivityManager.descriptor);
4637 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004638 if (options == null) {
4639 data.writeInt(0);
4640 } else {
4641 data.writeInt(1);
4642 data.writeBundle(options.toBundle());
4643 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004644 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004645 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004646 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004647 data.recycle();
4648 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004649 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004650 }
4651
Craig Mautner233ceee2014-05-09 17:05:11 -07004652 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4653 Parcel data = Parcel.obtain();
4654 Parcel reply = Parcel.obtain();
4655 data.writeInterfaceToken(IActivityManager.descriptor);
4656 data.writeStrongBinder(token);
4657 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4658 reply.readException();
4659 Bundle bundle = reply.readBundle();
4660 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4661 data.recycle();
4662 reply.recycle();
4663 return options;
4664 }
4665
Daniel Sandler69a48172010-06-23 16:29:36 -04004666 public void setImmersive(IBinder token, boolean immersive)
4667 throws RemoteException {
4668 Parcel data = Parcel.obtain();
4669 Parcel reply = Parcel.obtain();
4670 data.writeInterfaceToken(IActivityManager.descriptor);
4671 data.writeStrongBinder(token);
4672 data.writeInt(immersive ? 1 : 0);
4673 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4674 reply.readException();
4675 data.recycle();
4676 reply.recycle();
4677 }
4678
4679 public boolean isImmersive(IBinder token)
4680 throws RemoteException {
4681 Parcel data = Parcel.obtain();
4682 Parcel reply = Parcel.obtain();
4683 data.writeInterfaceToken(IActivityManager.descriptor);
4684 data.writeStrongBinder(token);
4685 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004686 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004687 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004688 data.recycle();
4689 reply.recycle();
4690 return res;
4691 }
4692
Craig Mautnerd61dc202014-07-07 11:09:11 -07004693 public boolean isTopOfTask(IBinder token) throws RemoteException {
4694 Parcel data = Parcel.obtain();
4695 Parcel reply = Parcel.obtain();
4696 data.writeInterfaceToken(IActivityManager.descriptor);
4697 data.writeStrongBinder(token);
4698 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4699 reply.readException();
4700 boolean res = reply.readInt() == 1;
4701 data.recycle();
4702 reply.recycle();
4703 return res;
4704 }
4705
Daniel Sandler69a48172010-06-23 16:29:36 -04004706 public boolean isTopActivityImmersive()
4707 throws RemoteException {
4708 Parcel data = Parcel.obtain();
4709 Parcel reply = Parcel.obtain();
4710 data.writeInterfaceToken(IActivityManager.descriptor);
4711 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004712 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004713 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004714 data.recycle();
4715 reply.recycle();
4716 return res;
4717 }
4718
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004719 public void crashApplication(int uid, int initialPid, String packageName,
4720 String message) throws RemoteException {
4721 Parcel data = Parcel.obtain();
4722 Parcel reply = Parcel.obtain();
4723 data.writeInterfaceToken(IActivityManager.descriptor);
4724 data.writeInt(uid);
4725 data.writeInt(initialPid);
4726 data.writeString(packageName);
4727 data.writeString(message);
4728 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4729 reply.readException();
4730 data.recycle();
4731 reply.recycle();
4732 }
Andy McFadden824c5102010-07-09 16:26:57 -07004733
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004734 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004735 Parcel data = Parcel.obtain();
4736 Parcel reply = Parcel.obtain();
4737 data.writeInterfaceToken(IActivityManager.descriptor);
4738 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004739 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004740 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4741 reply.readException();
4742 String res = reply.readString();
4743 data.recycle();
4744 reply.recycle();
4745 return res;
4746 }
4747
Dianne Hackborn7e269642010-08-25 19:50:20 -07004748 public IBinder newUriPermissionOwner(String name)
4749 throws RemoteException {
4750 Parcel data = Parcel.obtain();
4751 Parcel reply = Parcel.obtain();
4752 data.writeInterfaceToken(IActivityManager.descriptor);
4753 data.writeString(name);
4754 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4755 reply.readException();
4756 IBinder res = reply.readStrongBinder();
4757 data.recycle();
4758 reply.recycle();
4759 return res;
4760 }
4761
4762 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004763 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004764 Parcel data = Parcel.obtain();
4765 Parcel reply = Parcel.obtain();
4766 data.writeInterfaceToken(IActivityManager.descriptor);
4767 data.writeStrongBinder(owner);
4768 data.writeInt(fromUid);
4769 data.writeString(targetPkg);
4770 uri.writeToParcel(data, 0);
4771 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004772 data.writeInt(sourceUserId);
4773 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004774 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4775 reply.readException();
4776 data.recycle();
4777 reply.recycle();
4778 }
4779
4780 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004781 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004782 Parcel data = Parcel.obtain();
4783 Parcel reply = Parcel.obtain();
4784 data.writeInterfaceToken(IActivityManager.descriptor);
4785 data.writeStrongBinder(owner);
4786 if (uri != null) {
4787 data.writeInt(1);
4788 uri.writeToParcel(data, 0);
4789 } else {
4790 data.writeInt(0);
4791 }
4792 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004793 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004794 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4795 reply.readException();
4796 data.recycle();
4797 reply.recycle();
4798 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004799
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004800 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004801 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004802 Parcel data = Parcel.obtain();
4803 Parcel reply = Parcel.obtain();
4804 data.writeInterfaceToken(IActivityManager.descriptor);
4805 data.writeInt(callingUid);
4806 data.writeString(targetPkg);
4807 uri.writeToParcel(data, 0);
4808 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004809 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004810 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4811 reply.readException();
4812 int res = reply.readInt();
4813 data.recycle();
4814 reply.recycle();
4815 return res;
4816 }
4817
Dianne Hackborn1676c852012-09-10 14:52:30 -07004818 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004819 String path, ParcelFileDescriptor fd) throws RemoteException {
4820 Parcel data = Parcel.obtain();
4821 Parcel reply = Parcel.obtain();
4822 data.writeInterfaceToken(IActivityManager.descriptor);
4823 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004824 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004825 data.writeInt(managed ? 1 : 0);
4826 data.writeString(path);
4827 if (fd != null) {
4828 data.writeInt(1);
4829 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4830 } else {
4831 data.writeInt(0);
4832 }
4833 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4834 reply.readException();
4835 boolean res = reply.readInt() != 0;
4836 reply.recycle();
4837 data.recycle();
4838 return res;
4839 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004840
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004841 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004842 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004843 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004844 Parcel data = Parcel.obtain();
4845 Parcel reply = Parcel.obtain();
4846 data.writeInterfaceToken(IActivityManager.descriptor);
4847 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004848 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004849 data.writeTypedArray(intents, 0);
4850 data.writeStringArray(resolvedTypes);
4851 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004852 if (options != null) {
4853 data.writeInt(1);
4854 options.writeToParcel(data, 0);
4855 } else {
4856 data.writeInt(0);
4857 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004858 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004859 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4860 reply.readException();
4861 int result = reply.readInt();
4862 reply.recycle();
4863 data.recycle();
4864 return result;
4865 }
4866
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004867 public int getFrontActivityScreenCompatMode() throws RemoteException {
4868 Parcel data = Parcel.obtain();
4869 Parcel reply = Parcel.obtain();
4870 data.writeInterfaceToken(IActivityManager.descriptor);
4871 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4872 reply.readException();
4873 int mode = reply.readInt();
4874 reply.recycle();
4875 data.recycle();
4876 return mode;
4877 }
4878
4879 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4880 Parcel data = Parcel.obtain();
4881 Parcel reply = Parcel.obtain();
4882 data.writeInterfaceToken(IActivityManager.descriptor);
4883 data.writeInt(mode);
4884 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4885 reply.readException();
4886 reply.recycle();
4887 data.recycle();
4888 }
4889
4890 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4891 Parcel data = Parcel.obtain();
4892 Parcel reply = Parcel.obtain();
4893 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004894 data.writeString(packageName);
4895 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004896 reply.readException();
4897 int mode = reply.readInt();
4898 reply.recycle();
4899 data.recycle();
4900 return mode;
4901 }
4902
4903 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004904 throws RemoteException {
4905 Parcel data = Parcel.obtain();
4906 Parcel reply = Parcel.obtain();
4907 data.writeInterfaceToken(IActivityManager.descriptor);
4908 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004909 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004910 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4911 reply.readException();
4912 reply.recycle();
4913 data.recycle();
4914 }
4915
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004916 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4917 Parcel data = Parcel.obtain();
4918 Parcel reply = Parcel.obtain();
4919 data.writeInterfaceToken(IActivityManager.descriptor);
4920 data.writeString(packageName);
4921 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4922 reply.readException();
4923 boolean ask = reply.readInt() != 0;
4924 reply.recycle();
4925 data.recycle();
4926 return ask;
4927 }
4928
4929 public void setPackageAskScreenCompat(String packageName, boolean ask)
4930 throws RemoteException {
4931 Parcel data = Parcel.obtain();
4932 Parcel reply = Parcel.obtain();
4933 data.writeInterfaceToken(IActivityManager.descriptor);
4934 data.writeString(packageName);
4935 data.writeInt(ask ? 1 : 0);
4936 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4937 reply.readException();
4938 reply.recycle();
4939 data.recycle();
4940 }
4941
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004942 public boolean switchUser(int userid) throws RemoteException {
4943 Parcel data = Parcel.obtain();
4944 Parcel reply = Parcel.obtain();
4945 data.writeInterfaceToken(IActivityManager.descriptor);
4946 data.writeInt(userid);
4947 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4948 reply.readException();
4949 boolean result = reply.readInt() != 0;
4950 reply.recycle();
4951 data.recycle();
4952 return result;
4953 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004954
Kenny Guy08488bf2014-02-21 17:40:37 +00004955 public boolean startUserInBackground(int userid) throws RemoteException {
4956 Parcel data = Parcel.obtain();
4957 Parcel reply = Parcel.obtain();
4958 data.writeInterfaceToken(IActivityManager.descriptor);
4959 data.writeInt(userid);
4960 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4961 reply.readException();
4962 boolean result = reply.readInt() != 0;
4963 reply.recycle();
4964 data.recycle();
4965 return result;
4966 }
4967
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004968 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4969 Parcel data = Parcel.obtain();
4970 Parcel reply = Parcel.obtain();
4971 data.writeInterfaceToken(IActivityManager.descriptor);
4972 data.writeInt(userid);
4973 data.writeStrongInterface(callback);
4974 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4975 reply.readException();
4976 int result = reply.readInt();
4977 reply.recycle();
4978 data.recycle();
4979 return result;
4980 }
4981
Amith Yamasani52f1d752012-03-28 18:19:29 -07004982 public UserInfo getCurrentUser() throws RemoteException {
4983 Parcel data = Parcel.obtain();
4984 Parcel reply = Parcel.obtain();
4985 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004986 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004987 reply.readException();
4988 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4989 reply.recycle();
4990 data.recycle();
4991 return userInfo;
4992 }
4993
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004994 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004995 Parcel data = Parcel.obtain();
4996 Parcel reply = Parcel.obtain();
4997 data.writeInterfaceToken(IActivityManager.descriptor);
4998 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004999 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005000 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5001 reply.readException();
5002 boolean result = reply.readInt() != 0;
5003 reply.recycle();
5004 data.recycle();
5005 return result;
5006 }
5007
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005008 public int[] getRunningUserIds() throws RemoteException {
5009 Parcel data = Parcel.obtain();
5010 Parcel reply = Parcel.obtain();
5011 data.writeInterfaceToken(IActivityManager.descriptor);
5012 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5013 reply.readException();
5014 int[] result = reply.createIntArray();
5015 reply.recycle();
5016 data.recycle();
5017 return result;
5018 }
5019
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005020 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005021 Parcel data = Parcel.obtain();
5022 Parcel reply = Parcel.obtain();
5023 data.writeInterfaceToken(IActivityManager.descriptor);
5024 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005025 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5026 reply.readException();
5027 boolean result = reply.readInt() != 0;
5028 reply.recycle();
5029 data.recycle();
5030 return result;
5031 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005032
Jeff Sharkeya4620792011-05-20 15:29:23 -07005033 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
5037 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5038 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5039 reply.readException();
5040 data.recycle();
5041 reply.recycle();
5042 }
5043
5044 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5045 Parcel data = Parcel.obtain();
5046 Parcel reply = Parcel.obtain();
5047 data.writeInterfaceToken(IActivityManager.descriptor);
5048 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5049 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5050 reply.readException();
5051 data.recycle();
5052 reply.recycle();
5053 }
5054
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005055 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5056 Parcel data = Parcel.obtain();
5057 Parcel reply = Parcel.obtain();
5058 data.writeInterfaceToken(IActivityManager.descriptor);
5059 data.writeStrongBinder(sender.asBinder());
5060 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5061 reply.readException();
5062 boolean res = reply.readInt() != 0;
5063 data.recycle();
5064 reply.recycle();
5065 return res;
5066 }
5067
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005068 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5069 Parcel data = Parcel.obtain();
5070 Parcel reply = Parcel.obtain();
5071 data.writeInterfaceToken(IActivityManager.descriptor);
5072 data.writeStrongBinder(sender.asBinder());
5073 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5074 reply.readException();
5075 boolean res = reply.readInt() != 0;
5076 data.recycle();
5077 reply.recycle();
5078 return res;
5079 }
5080
Dianne Hackborn81038902012-11-26 17:04:09 -08005081 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5082 Parcel data = Parcel.obtain();
5083 Parcel reply = Parcel.obtain();
5084 data.writeInterfaceToken(IActivityManager.descriptor);
5085 data.writeStrongBinder(sender.asBinder());
5086 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5087 reply.readException();
5088 Intent res = reply.readInt() != 0
5089 ? Intent.CREATOR.createFromParcel(reply) : null;
5090 data.recycle();
5091 reply.recycle();
5092 return res;
5093 }
5094
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005095 public String getTagForIntentSender(IIntentSender sender, String prefix)
5096 throws RemoteException {
5097 Parcel data = Parcel.obtain();
5098 Parcel reply = Parcel.obtain();
5099 data.writeInterfaceToken(IActivityManager.descriptor);
5100 data.writeStrongBinder(sender.asBinder());
5101 data.writeString(prefix);
5102 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5103 reply.readException();
5104 String res = reply.readString();
5105 data.recycle();
5106 reply.recycle();
5107 return res;
5108 }
5109
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005110 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5111 {
5112 Parcel data = Parcel.obtain();
5113 Parcel reply = Parcel.obtain();
5114 data.writeInterfaceToken(IActivityManager.descriptor);
5115 values.writeToParcel(data, 0);
5116 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5117 reply.readException();
5118 data.recycle();
5119 reply.recycle();
5120 }
5121
Dianne Hackbornb437e092011-08-05 17:50:29 -07005122 public long[] getProcessPss(int[] pids) throws RemoteException {
5123 Parcel data = Parcel.obtain();
5124 Parcel reply = Parcel.obtain();
5125 data.writeInterfaceToken(IActivityManager.descriptor);
5126 data.writeIntArray(pids);
5127 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5128 reply.readException();
5129 long[] res = reply.createLongArray();
5130 data.recycle();
5131 reply.recycle();
5132 return res;
5133 }
5134
Dianne Hackborn661cd522011-08-22 00:26:20 -07005135 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5136 Parcel data = Parcel.obtain();
5137 Parcel reply = Parcel.obtain();
5138 data.writeInterfaceToken(IActivityManager.descriptor);
5139 TextUtils.writeToParcel(msg, data, 0);
5140 data.writeInt(always ? 1 : 0);
5141 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5142 reply.readException();
5143 data.recycle();
5144 reply.recycle();
5145 }
5146
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005147 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005148 Parcel data = Parcel.obtain();
5149 Parcel reply = Parcel.obtain();
5150 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005151 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005152 reply.readException();
5153 data.recycle();
5154 reply.recycle();
5155 }
5156
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005157 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005158 throws RemoteException {
5159 Parcel data = Parcel.obtain();
5160 Parcel reply = Parcel.obtain();
5161 data.writeInterfaceToken(IActivityManager.descriptor);
5162 data.writeStrongBinder(token);
5163 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005164 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005165 reply.readException();
5166 boolean result = reply.readInt() != 0;
5167 data.recycle();
5168 reply.recycle();
5169 return result;
5170 }
5171
5172 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5173 throws RemoteException {
5174 Parcel data = Parcel.obtain();
5175 Parcel reply = Parcel.obtain();
5176 data.writeInterfaceToken(IActivityManager.descriptor);
5177 data.writeStrongBinder(token);
5178 target.writeToParcel(data, 0);
5179 data.writeInt(resultCode);
5180 if (resultData != null) {
5181 data.writeInt(1);
5182 resultData.writeToParcel(data, 0);
5183 } else {
5184 data.writeInt(0);
5185 }
5186 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5187 reply.readException();
5188 boolean result = reply.readInt() != 0;
5189 data.recycle();
5190 reply.recycle();
5191 return result;
5192 }
5193
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005194 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5195 Parcel data = Parcel.obtain();
5196 Parcel reply = Parcel.obtain();
5197 data.writeInterfaceToken(IActivityManager.descriptor);
5198 data.writeStrongBinder(activityToken);
5199 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5200 reply.readException();
5201 int result = reply.readInt();
5202 data.recycle();
5203 reply.recycle();
5204 return result;
5205 }
5206
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005207 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5208 Parcel data = Parcel.obtain();
5209 Parcel reply = Parcel.obtain();
5210 data.writeInterfaceToken(IActivityManager.descriptor);
5211 data.writeStrongBinder(activityToken);
5212 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5213 reply.readException();
5214 String result = reply.readString();
5215 data.recycle();
5216 reply.recycle();
5217 return result;
5218 }
5219
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005220 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5221 Parcel data = Parcel.obtain();
5222 Parcel reply = Parcel.obtain();
5223 data.writeInterfaceToken(IActivityManager.descriptor);
5224 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5225 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5226 reply.readException();
5227 data.recycle();
5228 reply.recycle();
5229 }
5230
5231 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5232 Parcel data = Parcel.obtain();
5233 Parcel reply = Parcel.obtain();
5234 data.writeInterfaceToken(IActivityManager.descriptor);
5235 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5236 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5237 reply.readException();
5238 data.recycle();
5239 reply.recycle();
5240 }
5241
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005242 public void requestBugReport() throws RemoteException {
5243 Parcel data = Parcel.obtain();
5244 Parcel reply = Parcel.obtain();
5245 data.writeInterfaceToken(IActivityManager.descriptor);
5246 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5247 reply.readException();
5248 data.recycle();
5249 reply.recycle();
5250 }
5251
Jeff Brownbd181bb2013-09-10 16:44:24 -07005252 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5253 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005254 Parcel data = Parcel.obtain();
5255 Parcel reply = Parcel.obtain();
5256 data.writeInterfaceToken(IActivityManager.descriptor);
5257 data.writeInt(pid);
5258 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005259 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005260 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5261 reply.readException();
5262 long res = reply.readInt();
5263 data.recycle();
5264 reply.recycle();
5265 return res;
5266 }
5267
Adam Skorydfc7fd72013-08-05 19:23:41 -07005268 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005269 Parcel data = Parcel.obtain();
5270 Parcel reply = Parcel.obtain();
5271 data.writeInterfaceToken(IActivityManager.descriptor);
5272 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005273 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005274 reply.readException();
5275 Bundle res = reply.readBundle();
5276 data.recycle();
5277 reply.recycle();
5278 return res;
5279 }
5280
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005281 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5282 throws RemoteException {
5283 Parcel data = Parcel.obtain();
5284 Parcel reply = Parcel.obtain();
5285 data.writeInterfaceToken(IActivityManager.descriptor);
5286 data.writeInt(requestType);
5287 data.writeStrongBinder(receiver.asBinder());
5288 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5289 reply.readException();
5290 data.recycle();
5291 reply.recycle();
5292 }
5293
Adam Skory7140a252013-09-11 12:04:58 +01005294 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005295 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005296 Parcel data = Parcel.obtain();
5297 Parcel reply = Parcel.obtain();
5298 data.writeInterfaceToken(IActivityManager.descriptor);
5299 data.writeStrongBinder(token);
5300 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005301 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005302 reply.readException();
5303 data.recycle();
5304 reply.recycle();
5305 }
5306
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005307 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5308 throws RemoteException {
5309 Parcel data = Parcel.obtain();
5310 Parcel reply = Parcel.obtain();
5311 data.writeInterfaceToken(IActivityManager.descriptor);
5312 intent.writeToParcel(data, 0);
5313 data.writeInt(requestType);
5314 data.writeString(hint);
5315 data.writeInt(userHandle);
5316 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5317 reply.readException();
5318 boolean res = reply.readInt() != 0;
5319 data.recycle();
5320 reply.recycle();
5321 return res;
5322 }
5323
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005324 public void killUid(int uid, String reason) throws RemoteException {
5325 Parcel data = Parcel.obtain();
5326 Parcel reply = Parcel.obtain();
5327 data.writeInterfaceToken(IActivityManager.descriptor);
5328 data.writeInt(uid);
5329 data.writeString(reason);
5330 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5331 reply.readException();
5332 data.recycle();
5333 reply.recycle();
5334 }
5335
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005336 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5337 Parcel data = Parcel.obtain();
5338 Parcel reply = Parcel.obtain();
5339 data.writeInterfaceToken(IActivityManager.descriptor);
5340 data.writeStrongBinder(who);
5341 data.writeInt(allowRestart ? 1 : 0);
5342 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5343 reply.readException();
5344 data.recycle();
5345 reply.recycle();
5346 }
5347
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005348 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5349 Parcel data = Parcel.obtain();
5350 Parcel reply = Parcel.obtain();
5351 data.writeInterfaceToken(IActivityManager.descriptor);
5352 data.writeStrongBinder(token);
5353 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5354 reply.readException();
5355 data.recycle();
5356 reply.recycle();
5357 }
5358
Craig Mautner5eda9b32013-07-02 11:58:16 -07005359 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5360 Parcel data = Parcel.obtain();
5361 Parcel reply = Parcel.obtain();
5362 data.writeInterfaceToken(IActivityManager.descriptor);
5363 data.writeStrongBinder(token);
5364 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5365 reply.readException();
5366 data.recycle();
5367 reply.recycle();
5368 }
5369
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005370 public void restart() throws RemoteException {
5371 Parcel data = Parcel.obtain();
5372 Parcel reply = Parcel.obtain();
5373 data.writeInterfaceToken(IActivityManager.descriptor);
5374 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5375 reply.readException();
5376 data.recycle();
5377 reply.recycle();
5378 }
5379
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005380 public void performIdleMaintenance() throws RemoteException {
5381 Parcel data = Parcel.obtain();
5382 Parcel reply = Parcel.obtain();
5383 data.writeInterfaceToken(IActivityManager.descriptor);
5384 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5385 reply.readException();
5386 data.recycle();
5387 reply.recycle();
5388 }
5389
Todd Kennedyca4d8422015-01-15 15:19:22 -08005390 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005391 IActivityContainerCallback callback) throws RemoteException {
5392 Parcel data = Parcel.obtain();
5393 Parcel reply = Parcel.obtain();
5394 data.writeInterfaceToken(IActivityManager.descriptor);
5395 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005396 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005397 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005398 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005399 final int result = reply.readInt();
5400 final IActivityContainer res;
5401 if (result == 1) {
5402 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5403 } else {
5404 res = null;
5405 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005406 data.recycle();
5407 reply.recycle();
5408 return res;
5409 }
5410
Craig Mautner95da1082014-02-24 17:54:35 -08005411 public void deleteActivityContainer(IActivityContainer activityContainer)
5412 throws RemoteException {
5413 Parcel data = Parcel.obtain();
5414 Parcel reply = Parcel.obtain();
5415 data.writeInterfaceToken(IActivityManager.descriptor);
5416 data.writeStrongBinder(activityContainer.asBinder());
5417 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5418 reply.readException();
5419 data.recycle();
5420 reply.recycle();
5421 }
5422
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005423 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005424 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5425 Parcel data = Parcel.obtain();
5426 Parcel reply = Parcel.obtain();
5427 data.writeInterfaceToken(IActivityManager.descriptor);
5428 data.writeInt(displayId);
5429 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5430 reply.readException();
5431 final int result = reply.readInt();
5432 final IActivityContainer res;
5433 if (result == 1) {
5434 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5435 } else {
5436 res = null;
5437 }
5438 data.recycle();
5439 reply.recycle();
5440 return res;
5441 }
5442
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005443 @Override
5444 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005445 throws RemoteException {
5446 Parcel data = Parcel.obtain();
5447 Parcel reply = Parcel.obtain();
5448 data.writeInterfaceToken(IActivityManager.descriptor);
5449 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005450 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005451 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005452 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005453 data.recycle();
5454 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005455 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005456 }
5457
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005458 @Override
Craig Mautner4a1cb222013-12-04 16:14:06 -08005459 public IBinder getHomeActivityToken() throws RemoteException {
5460 Parcel data = Parcel.obtain();
5461 Parcel reply = Parcel.obtain();
5462 data.writeInterfaceToken(IActivityManager.descriptor);
5463 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5464 reply.readException();
5465 IBinder res = reply.readStrongBinder();
5466 data.recycle();
5467 reply.recycle();
5468 return res;
5469 }
5470
Craig Mautneraea74a52014-03-08 14:23:10 -08005471 @Override
5472 public void startLockTaskMode(int taskId) throws RemoteException {
5473 Parcel data = Parcel.obtain();
5474 Parcel reply = Parcel.obtain();
5475 data.writeInterfaceToken(IActivityManager.descriptor);
5476 data.writeInt(taskId);
5477 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5478 reply.readException();
5479 data.recycle();
5480 reply.recycle();
5481 }
5482
5483 @Override
5484 public void startLockTaskMode(IBinder token) throws RemoteException {
5485 Parcel data = Parcel.obtain();
5486 Parcel reply = Parcel.obtain();
5487 data.writeInterfaceToken(IActivityManager.descriptor);
5488 data.writeStrongBinder(token);
5489 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5490 reply.readException();
5491 data.recycle();
5492 reply.recycle();
5493 }
5494
5495 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005496 public void startLockTaskModeOnCurrent() throws RemoteException {
5497 Parcel data = Parcel.obtain();
5498 Parcel reply = Parcel.obtain();
5499 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005500 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005501 reply.readException();
5502 data.recycle();
5503 reply.recycle();
5504 }
5505
5506 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005507 public void stopLockTaskMode() throws RemoteException {
5508 Parcel data = Parcel.obtain();
5509 Parcel reply = Parcel.obtain();
5510 data.writeInterfaceToken(IActivityManager.descriptor);
5511 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5512 reply.readException();
5513 data.recycle();
5514 reply.recycle();
5515 }
5516
5517 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005518 public void stopLockTaskModeOnCurrent() throws RemoteException {
5519 Parcel data = Parcel.obtain();
5520 Parcel reply = Parcel.obtain();
5521 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005522 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005523 reply.readException();
5524 data.recycle();
5525 reply.recycle();
5526 }
5527
5528 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005529 public boolean isInLockTaskMode() throws RemoteException {
5530 Parcel data = Parcel.obtain();
5531 Parcel reply = Parcel.obtain();
5532 data.writeInterfaceToken(IActivityManager.descriptor);
5533 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5534 reply.readException();
5535 boolean isInLockTaskMode = reply.readInt() == 1;
5536 data.recycle();
5537 reply.recycle();
5538 return isInLockTaskMode;
5539 }
5540
Craig Mautner688b5102014-03-27 16:55:03 -07005541 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005542 public int getLockTaskModeState() throws RemoteException {
5543 Parcel data = Parcel.obtain();
5544 Parcel reply = Parcel.obtain();
5545 data.writeInterfaceToken(IActivityManager.descriptor);
5546 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5547 reply.readException();
5548 int lockTaskModeState = reply.readInt();
5549 data.recycle();
5550 reply.recycle();
5551 return lockTaskModeState;
5552 }
5553
5554 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005555 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005556 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005557 Parcel data = Parcel.obtain();
5558 Parcel reply = Parcel.obtain();
5559 data.writeInterfaceToken(IActivityManager.descriptor);
5560 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005561 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005562 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005563 reply.readException();
5564 data.recycle();
5565 reply.recycle();
5566 }
5567
Craig Mautneree2e45a2014-06-27 12:10:03 -07005568 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005569 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5570 Parcel data = Parcel.obtain();
5571 Parcel reply = Parcel.obtain();
5572 data.writeInterfaceToken(IActivityManager.descriptor);
5573 data.writeInt(taskId);
5574 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005575 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005576 reply.readException();
5577 data.recycle();
5578 reply.recycle();
5579 }
5580
5581 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005582 public void resizeTask(int taskId, Rect r) throws RemoteException
5583 {
5584 Parcel data = Parcel.obtain();
5585 Parcel reply = Parcel.obtain();
5586 data.writeInterfaceToken(IActivityManager.descriptor);
5587 data.writeInt(taskId);
5588 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005589 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005590 reply.readException();
5591 data.recycle();
5592 reply.recycle();
5593 }
5594
5595 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005596 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5597 Parcel data = Parcel.obtain();
5598 Parcel reply = Parcel.obtain();
5599 data.writeInterfaceToken(IActivityManager.descriptor);
5600 data.writeString(filename);
5601 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5602 reply.readException();
5603 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5604 data.recycle();
5605 reply.recycle();
5606 return icon;
5607 }
5608
5609 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005610 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5611 throws RemoteException {
5612 Parcel data = Parcel.obtain();
5613 Parcel reply = Parcel.obtain();
5614 data.writeInterfaceToken(IActivityManager.descriptor);
5615 if (options == null) {
5616 data.writeInt(0);
5617 } else {
5618 data.writeInt(1);
5619 data.writeBundle(options.toBundle());
5620 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005621 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005622 reply.readException();
5623 data.recycle();
5624 reply.recycle();
5625 }
5626
5627 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005628 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005629 Parcel data = Parcel.obtain();
5630 Parcel reply = Parcel.obtain();
5631 data.writeInterfaceToken(IActivityManager.descriptor);
5632 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005633 data.writeInt(visible ? 1 : 0);
5634 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005635 reply.readException();
5636 boolean success = reply.readInt() > 0;
5637 data.recycle();
5638 reply.recycle();
5639 return success;
5640 }
5641
5642 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005643 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005644 Parcel data = Parcel.obtain();
5645 Parcel reply = Parcel.obtain();
5646 data.writeInterfaceToken(IActivityManager.descriptor);
5647 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005648 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005649 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005650 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005651 data.recycle();
5652 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005653 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005654 }
5655
5656 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005657 public void backgroundResourcesReleased(IBinder token) 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);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005662 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005663 reply.readException();
5664 data.recycle();
5665 reply.recycle();
5666 }
5667
5668 @Override
5669 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5670 Parcel data = Parcel.obtain();
5671 Parcel reply = Parcel.obtain();
5672 data.writeInterfaceToken(IActivityManager.descriptor);
5673 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005674 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005675 reply.readException();
5676 data.recycle();
5677 reply.recycle();
5678 }
5679
Craig Mautner8746a472014-07-24 15:12:54 -07005680 @Override
5681 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5682 Parcel data = Parcel.obtain();
5683 Parcel reply = Parcel.obtain();
5684 data.writeInterfaceToken(IActivityManager.descriptor);
5685 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005686 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005687 reply.readException();
5688 data.recycle();
5689 reply.recycle();
5690 }
5691
Craig Mautner6e2f3952014-09-09 14:26:41 -07005692 @Override
5693 public void bootAnimationComplete() throws RemoteException {
5694 Parcel data = Parcel.obtain();
5695 Parcel reply = Parcel.obtain();
5696 data.writeInterfaceToken(IActivityManager.descriptor);
5697 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5698 reply.readException();
5699 data.recycle();
5700 reply.recycle();
5701 }
5702
Wale Ogunwale18795a22014-12-03 11:38:33 -08005703 @Override
5704 public void systemBackupRestored() throws RemoteException {
5705 Parcel data = Parcel.obtain();
5706 Parcel reply = Parcel.obtain();
5707 data.writeInterfaceToken(IActivityManager.descriptor);
5708 mRemote.transact(SYSTEM_BACKUP_RESTORED, data, reply, 0);
5709 reply.readException();
5710 data.recycle();
5711 reply.recycle();
5712 }
5713
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08005714 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005715 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5716 Parcel data = Parcel.obtain();
5717 Parcel reply = Parcel.obtain();
5718 data.writeInterfaceToken(IActivityManager.descriptor);
5719 data.writeInt(uid);
5720 data.writeByteArray(firstPacket);
5721 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5722 reply.readException();
5723 data.recycle();
5724 reply.recycle();
5725 }
5726
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005727 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005728 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5729 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005730 Parcel data = Parcel.obtain();
5731 Parcel reply = Parcel.obtain();
5732 data.writeInterfaceToken(IActivityManager.descriptor);
5733 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005734 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005735 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005736 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005737 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5738 reply.readException();
5739 data.recycle();
5740 reply.recycle();
5741 }
5742
5743 @Override
5744 public void dumpHeapFinished(String path) throws RemoteException {
5745 Parcel data = Parcel.obtain();
5746 Parcel reply = Parcel.obtain();
5747 data.writeInterfaceToken(IActivityManager.descriptor);
5748 data.writeString(path);
5749 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5750 reply.readException();
5751 data.recycle();
5752 reply.recycle();
5753 }
5754
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005755 @Override
5756 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5757 throws RemoteException {
5758 Parcel data = Parcel.obtain();
5759 Parcel reply = Parcel.obtain();
5760 data.writeInterfaceToken(IActivityManager.descriptor);
5761 data.writeStrongBinder(session.asBinder());
5762 data.writeInt(keepAwake ? 1 : 0);
5763 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5764 reply.readException();
5765 data.recycle();
5766 reply.recycle();
5767 }
5768
Craig Mautnere5600772015-04-03 21:36:37 -07005769 @Override
5770 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5771 Parcel data = Parcel.obtain();
5772 Parcel reply = Parcel.obtain();
5773 data.writeInterfaceToken(IActivityManager.descriptor);
5774 data.writeInt(userId);
5775 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005776 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005777 reply.readException();
5778 data.recycle();
5779 reply.recycle();
5780 }
5781
Dianne Hackborn1e383822015-04-10 14:02:33 -07005782 @Override
5783 public int getPackageProcessState(String packageName) throws RemoteException {
5784 Parcel data = Parcel.obtain();
5785 Parcel reply = Parcel.obtain();
5786 data.writeInterfaceToken(IActivityManager.descriptor);
5787 data.writeString(packageName);
5788 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5789 reply.readException();
5790 int res = reply.readInt();
5791 data.recycle();
5792 reply.recycle();
5793 return res;
5794 }
5795
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005796 private IBinder mRemote;
5797}