blob: 744c528c860293685e6ea0b9856f6cda6d88317e [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;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700110 null, intent, null, null, Activity.RESULT_OK, null, null,
111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700119 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
120 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700121 } catch (RemoteException ex) {
122 }
123 }
124
125 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
126 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700127 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700128 } catch (RemoteException ex) {
129 }
130 }
131
132 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
133 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700134 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 } catch (RemoteException ex) {
136 }
137 }
138
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800139 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 attachInterface(this, descriptor);
141 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700142
143 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
145 throws RemoteException {
146 switch (code) {
147 case START_ACTIVITY_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800156 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800163 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700169
Amith Yamasani82644082012-08-03 13:09:11 -0700170 case START_ACTIVITY_AS_USER_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 IBinder resultTo = data.readStrongBinder();
179 String resultWho = data.readString();
180 int requestCode = data.readInt();
181 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700182 ProfilerInfo profilerInfo = data.readInt() != 0
183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
186 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800187 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700194 case START_ACTIVITY_AS_CALLER_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
199 String callingPackage = data.readString();
200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
202 IBinder resultTo = data.readStrongBinder();
203 String resultWho = data.readString();
204 int requestCode = data.readInt();
205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700210 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
214 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700215 reply.writeNoException();
216 reply.writeInt(result);
217 return true;
218 }
219
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 case START_ACTIVITY_AND_WAIT_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800225 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800228 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800229 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800230 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700232 ProfilerInfo profilerInfo = data.readInt() != 0
233 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 Bundle options = data.readInt() != 0
235 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700236 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800237 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700238 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800239 reply.writeNoException();
240 result.writeToParcel(reply, 0);
241 return true;
242 }
243
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700244 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
245 {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder b = data.readStrongBinder();
248 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800249 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700250 Intent intent = Intent.CREATOR.createFromParcel(data);
251 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700254 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700255 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700256 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700259 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800260 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700261 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
266
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700267 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 IBinder b = data.readStrongBinder();
271 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700272 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700273 Intent fillInIntent = null;
274 if (data.readInt() != 0) {
275 fillInIntent = Intent.CREATOR.createFromParcel(data);
276 }
277 String resolvedType = data.readString();
278 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700279 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700280 int requestCode = data.readInt();
281 int flagsMask = data.readInt();
282 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700285 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700286 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700287 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700292
Dianne Hackborn91097de2014-04-04 18:02:06 -0700293 case START_VOICE_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 String callingPackage = data.readString();
297 int callingPid = data.readInt();
298 int callingUid = data.readInt();
299 Intent intent = Intent.CREATOR.createFromParcel(data);
300 String resolvedType = data.readString();
301 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
302 data.readStrongBinder());
303 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
304 data.readStrongBinder());
305 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700306 ProfilerInfo profilerInfo = data.readInt() != 0
307 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700308 Bundle options = data.readInt() != 0
309 ? Bundle.CREATOR.createFromParcel(data) : null;
310 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700311 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
312 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700313 reply.writeNoException();
314 reply.writeInt(result);
315 return true;
316 }
317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder callingActivity = data.readStrongBinder();
322 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700323 Bundle options = data.readInt() != 0
324 ? Bundle.CREATOR.createFromParcel(data) : null;
325 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(result ? 1 : 0);
328 return true;
329 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700330
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700331 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700334 final int taskId = data.readInt();
335 final int launchStackId = data.readInt();
336 final Bundle options =
337 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
338 final int result = startActivityFromRecents(taskId, launchStackId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700339 reply.writeNoException();
340 reply.writeInt(result);
341 return true;
342 }
343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 case FINISH_ACTIVITY_TRANSACTION: {
345 data.enforceInterface(IActivityManager.descriptor);
346 IBinder token = data.readStrongBinder();
347 Intent resultData = null;
348 int resultCode = data.readInt();
349 if (data.readInt() != 0) {
350 resultData = Intent.CREATOR.createFromParcel(data);
351 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700352 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700353 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res ? 1 : 0);
356 return true;
357 }
358
359 case FINISH_SUB_ACTIVITY_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700362 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 int requestCode = data.readInt();
364 finishSubActivity(token, resultWho, requestCode);
365 reply.writeNoException();
366 return true;
367 }
368
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700369 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder token = data.readStrongBinder();
372 boolean res = finishActivityAffinity(token);
373 reply.writeNoException();
374 reply.writeInt(res ? 1 : 0);
375 return true;
376 }
377
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700378 case FINISH_VOICE_TASK_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
381 data.readStrongBinder());
382 finishVoiceTask(session);
383 reply.writeNoException();
384 return true;
385 }
386
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700387 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder token = data.readStrongBinder();
390 boolean res = releaseActivityInstance(token);
391 reply.writeNoException();
392 reply.writeInt(res ? 1 : 0);
393 return true;
394 }
395
396 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
399 releaseSomeActivities(app);
400 reply.writeNoException();
401 return true;
402 }
403
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800404 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder token = data.readStrongBinder();
407 boolean res = willActivityBeVisible(token);
408 reply.writeNoException();
409 reply.writeInt(res ? 1 : 0);
410 return true;
411 }
412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800413 case REGISTER_RECEIVER_TRANSACTION:
414 {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder b = data.readStrongBinder();
417 IApplicationThread app =
418 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700419 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 b = data.readStrongBinder();
421 IIntentReceiver rec
422 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
423 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
424 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700425 int userId = data.readInt();
426 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 reply.writeNoException();
428 if (intent != null) {
429 reply.writeInt(1);
430 intent.writeToParcel(reply, 0);
431 } else {
432 reply.writeInt(0);
433 }
434 return true;
435 }
436
437 case UNREGISTER_RECEIVER_TRANSACTION:
438 {
439 data.enforceInterface(IActivityManager.descriptor);
440 IBinder b = data.readStrongBinder();
441 if (b == null) {
442 return true;
443 }
444 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
445 unregisterReceiver(rec);
446 reply.writeNoException();
447 return true;
448 }
449
450 case BROADCAST_INTENT_TRANSACTION:
451 {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder b = data.readStrongBinder();
454 IApplicationThread app =
455 b != null ? ApplicationThreadNative.asInterface(b) : null;
456 Intent intent = Intent.CREATOR.createFromParcel(data);
457 String resolvedType = data.readString();
458 b = data.readStrongBinder();
459 IIntentReceiver resultTo =
460 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
461 int resultCode = data.readInt();
462 String resultData = data.readString();
463 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700464 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800465 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700466 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 boolean serialized = data.readInt() != 0;
468 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700469 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700471 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700472 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 reply.writeNoException();
474 reply.writeInt(res);
475 return true;
476 }
477
478 case UNBROADCAST_INTENT_TRANSACTION:
479 {
480 data.enforceInterface(IActivityManager.descriptor);
481 IBinder b = data.readStrongBinder();
482 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
483 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700484 int userId = data.readInt();
485 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 reply.writeNoException();
487 return true;
488 }
489
490 case FINISH_RECEIVER_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 IBinder who = data.readStrongBinder();
493 int resultCode = data.readInt();
494 String resultData = data.readString();
495 Bundle resultExtras = data.readBundle();
496 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800497 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800499 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 }
501 reply.writeNoException();
502 return true;
503 }
504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 case ATTACH_APPLICATION_TRANSACTION: {
506 data.enforceInterface(IActivityManager.descriptor);
507 IApplicationThread app = ApplicationThreadNative.asInterface(
508 data.readStrongBinder());
509 if (app != null) {
510 attachApplication(app);
511 }
512 reply.writeNoException();
513 return true;
514 }
515
516 case ACTIVITY_IDLE_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700519 Configuration config = null;
520 if (data.readInt() != 0) {
521 config = Configuration.CREATOR.createFromParcel(data);
522 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700523 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700525 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 }
527 reply.writeNoException();
528 return true;
529 }
530
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700531 case ACTIVITY_RESUMED_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 IBinder token = data.readStrongBinder();
534 activityResumed(token);
535 reply.writeNoException();
536 return true;
537 }
538
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 case ACTIVITY_PAUSED_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700542 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 reply.writeNoException();
544 return true;
545 }
546
547 case ACTIVITY_STOPPED_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800550 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700551 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700553 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 reply.writeNoException();
555 return true;
556 }
557
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800558 case ACTIVITY_SLEPT_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activitySlept(token);
562 reply.writeNoException();
563 return true;
564 }
565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 case ACTIVITY_DESTROYED_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
569 activityDestroyed(token);
570 reply.writeNoException();
571 return true;
572 }
573
574 case GET_CALLING_PACKAGE_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 IBinder token = data.readStrongBinder();
577 String res = token != null ? getCallingPackage(token) : null;
578 reply.writeNoException();
579 reply.writeString(res);
580 return true;
581 }
582
583 case GET_CALLING_ACTIVITY_TRANSACTION: {
584 data.enforceInterface(IActivityManager.descriptor);
585 IBinder token = data.readStrongBinder();
586 ComponentName cn = getCallingActivity(token);
587 reply.writeNoException();
588 ComponentName.writeToParcel(cn, reply);
589 return true;
590 }
591
Winson Chung1147c402014-05-14 11:05:00 -0700592 case GET_APP_TASKS_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700594 String callingPackage = data.readString();
595 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700596 reply.writeNoException();
597 int N = list != null ? list.size() : -1;
598 reply.writeInt(N);
599 int i;
600 for (i=0; i<N; i++) {
601 IAppTask task = list.get(i);
602 reply.writeStrongBinder(task.asBinder());
603 }
604 return true;
605 }
606
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700607 case ADD_APP_TASK_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 IBinder activityToken = data.readStrongBinder();
610 Intent intent = Intent.CREATOR.createFromParcel(data);
611 ActivityManager.TaskDescription descr
612 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
613 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
614 int res = addAppTask(activityToken, intent, descr, thumbnail);
615 reply.writeNoException();
616 reply.writeInt(res);
617 return true;
618 }
619
620 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 Point size = getAppTaskThumbnailSize();
623 reply.writeNoException();
624 size.writeToParcel(reply, 0);
625 return true;
626 }
627
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628 case GET_TASKS_TRANSACTION: {
629 data.enforceInterface(IActivityManager.descriptor);
630 int maxNum = data.readInt();
631 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700632 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 reply.writeNoException();
634 int N = list != null ? list.size() : -1;
635 reply.writeInt(N);
636 int i;
637 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700638 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 info.writeToParcel(reply, 0);
640 }
641 return true;
642 }
643
644 case GET_RECENT_TASKS_TRANSACTION: {
645 data.enforceInterface(IActivityManager.descriptor);
646 int maxNum = data.readInt();
647 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700648 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800649 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700650 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 reply.writeNoException();
652 reply.writeTypedList(list);
653 return true;
654 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700655
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 data.enforceInterface(IActivityManager.descriptor);
658 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700659 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800660 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700661 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800662 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700663 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700664 } else {
665 reply.writeInt(0);
666 }
667 return true;
668 }
669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 case GET_SERVICES_TRANSACTION: {
671 data.enforceInterface(IActivityManager.descriptor);
672 int maxNum = data.readInt();
673 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700674 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 reply.writeNoException();
676 int N = list != null ? list.size() : -1;
677 reply.writeInt(N);
678 int i;
679 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700680 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 info.writeToParcel(reply, 0);
682 }
683 return true;
684 }
685
686 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
689 reply.writeNoException();
690 reply.writeTypedList(list);
691 return true;
692 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
697 reply.writeNoException();
698 reply.writeTypedList(list);
699 return true;
700 }
701
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700702 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 List<ApplicationInfo> list = getRunningExternalApplications();
705 reply.writeNoException();
706 reply.writeTypedList(list);
707 return true;
708 }
709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 case MOVE_TASK_TO_FRONT_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800713 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700714 Bundle options = data.readInt() != 0
715 ? Bundle.CREATOR.createFromParcel(data) : null;
716 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 reply.writeNoException();
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder token = data.readStrongBinder();
724 boolean nonRoot = data.readInt() != 0;
725 boolean res = moveActivityTaskToBack(token, nonRoot);
726 reply.writeNoException();
727 reply.writeInt(res ? 1 : 0);
728 return true;
729 }
730
731 case MOVE_TASK_BACKWARDS_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 int task = data.readInt();
734 moveTaskBackwards(task);
735 reply.writeNoException();
736 return true;
737 }
738
Craig Mautnerc00204b2013-03-05 15:02:14 -0800739 case MOVE_TASK_TO_STACK_TRANSACTION: {
740 data.enforceInterface(IActivityManager.descriptor);
741 int taskId = data.readInt();
742 int stackId = data.readInt();
743 boolean toTop = data.readInt() != 0;
744 moveTaskToStack(taskId, stackId, toTop);
745 reply.writeNoException();
746 return true;
747 }
748
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700749 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
750 data.enforceInterface(IActivityManager.descriptor);
751 int taskId = data.readInt();
752 int createMode = data.readInt();
753 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800754 boolean animate = data.readInt() != 0;
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -0800755 Rect bounds = null;
756 boolean hasBounds = data.readInt() != 0;
757 if (hasBounds) {
758 bounds = Rect.CREATOR.createFromParcel(data);
759 }
760 moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700761 reply.writeNoException();
762 return true;
763 }
764
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700765 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700766 data.enforceInterface(IActivityManager.descriptor);
767 final int stackId = data.readInt();
768 final Rect r = Rect.CREATOR.createFromParcel(data);
769 final boolean res = moveTopActivityToPinnedStack(stackId, r);
770 reply.writeNoException();
771 reply.writeInt(res ? 1 : 0);
772 return true;
773 }
774
Craig Mautnerc00204b2013-03-05 15:02:14 -0800775 case RESIZE_STACK_TRANSACTION: {
776 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700777 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100778 final boolean hasRect = data.readInt() != 0;
779 Rect r = null;
780 if (hasRect) {
781 r = Rect.CREATOR.createFromParcel(data);
782 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700783 final boolean allowResizeInDockedMode = data.readInt() == 1;
784 resizeStack(stackId, r, allowResizeInDockedMode);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800785 reply.writeNoException();
786 return true;
787 }
788
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700789 case POSITION_TASK_IN_STACK_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 int taskId = data.readInt();
792 int stackId = data.readInt();
793 int position = data.readInt();
794 positionTaskInStack(taskId, stackId, position);
795 reply.writeNoException();
796 return true;
797 }
798
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800799 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700800 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800801 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700802 reply.writeNoException();
803 reply.writeTypedList(list);
804 return true;
805 }
806
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800807 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700808 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800809 int stackId = data.readInt();
810 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700811 reply.writeNoException();
812 if (info != null) {
813 reply.writeInt(1);
814 info.writeToParcel(reply, 0);
815 } else {
816 reply.writeInt(0);
817 }
818 return true;
819 }
820
Winson Chung303e1ff2014-03-07 15:06:19 -0800821 case IS_IN_HOME_STACK_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 int taskId = data.readInt();
824 boolean isInHomeStack = isInHomeStack(taskId);
825 reply.writeNoException();
826 reply.writeInt(isInHomeStack ? 1 : 0);
827 return true;
828 }
829
Craig Mautnercf910b02013-04-23 11:23:27 -0700830 case SET_FOCUSED_STACK_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 int stackId = data.readInt();
833 setFocusedStack(stackId);
834 reply.writeNoException();
835 return true;
836 }
837
Winson Chungd16c5652015-01-26 16:11:07 -0800838 case GET_FOCUSED_STACK_ID_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 int focusedStackId = getFocusedStackId();
841 reply.writeNoException();
842 reply.writeInt(focusedStackId);
843 return true;
844 }
845
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700846 case SET_FOCUSED_TASK_TRANSACTION: {
847 data.enforceInterface(IActivityManager.descriptor);
848 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700849 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700850 reply.writeNoException();
851 return true;
852 }
853
Winson Chung740c3ac2014-11-12 16:14:38 -0800854 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
855 data.enforceInterface(IActivityManager.descriptor);
856 IBinder token = data.readStrongBinder();
857 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
858 reply.writeNoException();
859 return true;
860 }
861
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800862 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
863 data.enforceInterface(IActivityManager.descriptor);
864 IBinder token = data.readStrongBinder();
865 boolean onlyRoot = data.readInt() != 0;
866 int res = token != null
867 ? getTaskForActivity(token, onlyRoot) : -1;
868 reply.writeNoException();
869 reply.writeInt(res);
870 return true;
871 }
872
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 case GET_CONTENT_PROVIDER_TRANSACTION: {
874 data.enforceInterface(IActivityManager.descriptor);
875 IBinder b = data.readStrongBinder();
876 IApplicationThread app = ApplicationThreadNative.asInterface(b);
877 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700878 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700879 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700880 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800881 reply.writeNoException();
882 if (cph != null) {
883 reply.writeInt(1);
884 cph.writeToParcel(reply, 0);
885 } else {
886 reply.writeInt(0);
887 }
888 return true;
889 }
890
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800891 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
892 data.enforceInterface(IActivityManager.descriptor);
893 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700894 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800895 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700896 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800897 reply.writeNoException();
898 if (cph != null) {
899 reply.writeInt(1);
900 cph.writeToParcel(reply, 0);
901 } else {
902 reply.writeInt(0);
903 }
904 return true;
905 }
906
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800907 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 IBinder b = data.readStrongBinder();
910 IApplicationThread app = ApplicationThreadNative.asInterface(b);
911 ArrayList<ContentProviderHolder> providers =
912 data.createTypedArrayList(ContentProviderHolder.CREATOR);
913 publishContentProviders(app, providers);
914 reply.writeNoException();
915 return true;
916 }
917
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700918 case REF_CONTENT_PROVIDER_TRANSACTION: {
919 data.enforceInterface(IActivityManager.descriptor);
920 IBinder b = data.readStrongBinder();
921 int stable = data.readInt();
922 int unstable = data.readInt();
923 boolean res = refContentProvider(b, stable, unstable);
924 reply.writeNoException();
925 reply.writeInt(res ? 1 : 0);
926 return true;
927 }
928
929 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 IBinder b = data.readStrongBinder();
932 unstableProviderDied(b);
933 reply.writeNoException();
934 return true;
935 }
936
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700937 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
938 data.enforceInterface(IActivityManager.descriptor);
939 IBinder b = data.readStrongBinder();
940 appNotRespondingViaProvider(b);
941 reply.writeNoException();
942 return true;
943 }
944
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
946 data.enforceInterface(IActivityManager.descriptor);
947 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700948 boolean stable = data.readInt() != 0;
949 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 reply.writeNoException();
951 return true;
952 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800953
954 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
955 data.enforceInterface(IActivityManager.descriptor);
956 String name = data.readString();
957 IBinder token = data.readStrongBinder();
958 removeContentProviderExternal(name, token);
959 reply.writeNoException();
960 return true;
961 }
962
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700963 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
964 data.enforceInterface(IActivityManager.descriptor);
965 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
966 PendingIntent pi = getRunningServiceControlPanel(comp);
967 reply.writeNoException();
968 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
969 return true;
970 }
971
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800972 case START_SERVICE_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 IBinder b = data.readStrongBinder();
975 IApplicationThread app = ApplicationThreadNative.asInterface(b);
976 Intent service = Intent.CREATOR.createFromParcel(data);
977 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700978 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700979 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700980 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800981 reply.writeNoException();
982 ComponentName.writeToParcel(cn, reply);
983 return true;
984 }
985
986 case STOP_SERVICE_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder b = data.readStrongBinder();
989 IApplicationThread app = ApplicationThreadNative.asInterface(b);
990 Intent service = Intent.CREATOR.createFromParcel(data);
991 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700992 int userId = data.readInt();
993 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 reply.writeNoException();
995 reply.writeInt(res);
996 return true;
997 }
998
999 case STOP_SERVICE_TOKEN_TRANSACTION: {
1000 data.enforceInterface(IActivityManager.descriptor);
1001 ComponentName className = ComponentName.readFromParcel(data);
1002 IBinder token = data.readStrongBinder();
1003 int startId = data.readInt();
1004 boolean res = stopServiceToken(className, token, startId);
1005 reply.writeNoException();
1006 reply.writeInt(res ? 1 : 0);
1007 return true;
1008 }
1009
1010 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1011 data.enforceInterface(IActivityManager.descriptor);
1012 ComponentName className = ComponentName.readFromParcel(data);
1013 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001014 int id = data.readInt();
1015 Notification notification = null;
1016 if (data.readInt() != 0) {
1017 notification = Notification.CREATOR.createFromParcel(data);
1018 }
1019 boolean removeNotification = data.readInt() != 0;
1020 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001021 reply.writeNoException();
1022 return true;
1023 }
1024
1025 case BIND_SERVICE_TRANSACTION: {
1026 data.enforceInterface(IActivityManager.descriptor);
1027 IBinder b = data.readStrongBinder();
1028 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1029 IBinder token = data.readStrongBinder();
1030 Intent service = Intent.CREATOR.createFromParcel(data);
1031 String resolvedType = data.readString();
1032 b = data.readStrongBinder();
1033 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001034 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001035 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001036 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001037 int res = bindService(app, token, service, resolvedType, conn, fl,
1038 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001039 reply.writeNoException();
1040 reply.writeInt(res);
1041 return true;
1042 }
1043
1044 case UNBIND_SERVICE_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 IBinder b = data.readStrongBinder();
1047 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1048 boolean res = unbindService(conn);
1049 reply.writeNoException();
1050 reply.writeInt(res ? 1 : 0);
1051 return true;
1052 }
1053
1054 case PUBLISH_SERVICE_TRANSACTION: {
1055 data.enforceInterface(IActivityManager.descriptor);
1056 IBinder token = data.readStrongBinder();
1057 Intent intent = Intent.CREATOR.createFromParcel(data);
1058 IBinder service = data.readStrongBinder();
1059 publishService(token, intent, service);
1060 reply.writeNoException();
1061 return true;
1062 }
1063
1064 case UNBIND_FINISHED_TRANSACTION: {
1065 data.enforceInterface(IActivityManager.descriptor);
1066 IBinder token = data.readStrongBinder();
1067 Intent intent = Intent.CREATOR.createFromParcel(data);
1068 boolean doRebind = data.readInt() != 0;
1069 unbindFinished(token, intent, doRebind);
1070 reply.writeNoException();
1071 return true;
1072 }
1073
1074 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001077 int type = data.readInt();
1078 int startId = data.readInt();
1079 int res = data.readInt();
1080 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 reply.writeNoException();
1082 return true;
1083 }
1084
1085 case START_INSTRUMENTATION_TRANSACTION: {
1086 data.enforceInterface(IActivityManager.descriptor);
1087 ComponentName className = ComponentName.readFromParcel(data);
1088 String profileFile = data.readString();
1089 int fl = data.readInt();
1090 Bundle arguments = data.readBundle();
1091 IBinder b = data.readStrongBinder();
1092 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001093 b = data.readStrongBinder();
1094 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001095 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001096 String abiOverride = data.readString();
1097 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1098 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001099 reply.writeNoException();
1100 reply.writeInt(res ? 1 : 0);
1101 return true;
1102 }
1103
1104
1105 case FINISH_INSTRUMENTATION_TRANSACTION: {
1106 data.enforceInterface(IActivityManager.descriptor);
1107 IBinder b = data.readStrongBinder();
1108 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1109 int resultCode = data.readInt();
1110 Bundle results = data.readBundle();
1111 finishInstrumentation(app, resultCode, results);
1112 reply.writeNoException();
1113 return true;
1114 }
1115
1116 case GET_CONFIGURATION_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 Configuration config = getConfiguration();
1119 reply.writeNoException();
1120 config.writeToParcel(reply, 0);
1121 return true;
1122 }
1123
1124 case UPDATE_CONFIGURATION_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 Configuration config = Configuration.CREATOR.createFromParcel(data);
1127 updateConfiguration(config);
1128 reply.writeNoException();
1129 return true;
1130 }
1131
1132 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1133 data.enforceInterface(IActivityManager.descriptor);
1134 IBinder token = data.readStrongBinder();
1135 int requestedOrientation = data.readInt();
1136 setRequestedOrientation(token, requestedOrientation);
1137 reply.writeNoException();
1138 return true;
1139 }
1140
1141 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1142 data.enforceInterface(IActivityManager.descriptor);
1143 IBinder token = data.readStrongBinder();
1144 int req = getRequestedOrientation(token);
1145 reply.writeNoException();
1146 reply.writeInt(req);
1147 return true;
1148 }
1149
1150 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1151 data.enforceInterface(IActivityManager.descriptor);
1152 IBinder token = data.readStrongBinder();
1153 ComponentName cn = getActivityClassForToken(token);
1154 reply.writeNoException();
1155 ComponentName.writeToParcel(cn, reply);
1156 return true;
1157 }
1158
1159 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 IBinder token = data.readStrongBinder();
1162 reply.writeNoException();
1163 reply.writeString(getPackageForToken(token));
1164 return true;
1165 }
1166
1167 case GET_INTENT_SENDER_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 int type = data.readInt();
1170 String packageName = data.readString();
1171 IBinder token = data.readStrongBinder();
1172 String resultWho = data.readString();
1173 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001174 Intent[] requestIntents;
1175 String[] requestResolvedTypes;
1176 if (data.readInt() != 0) {
1177 requestIntents = data.createTypedArray(Intent.CREATOR);
1178 requestResolvedTypes = data.createStringArray();
1179 } else {
1180 requestIntents = null;
1181 requestResolvedTypes = null;
1182 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001183 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001184 Bundle options = data.readInt() != 0
1185 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001186 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001187 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001188 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001189 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 reply.writeNoException();
1191 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1192 return true;
1193 }
1194
1195 case CANCEL_INTENT_SENDER_TRANSACTION: {
1196 data.enforceInterface(IActivityManager.descriptor);
1197 IIntentSender r = IIntentSender.Stub.asInterface(
1198 data.readStrongBinder());
1199 cancelIntentSender(r);
1200 reply.writeNoException();
1201 return true;
1202 }
1203
1204 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 IIntentSender r = IIntentSender.Stub.asInterface(
1207 data.readStrongBinder());
1208 String res = getPackageForIntentSender(r);
1209 reply.writeNoException();
1210 reply.writeString(res);
1211 return true;
1212 }
1213
Christopher Tatec4a07d12012-04-06 14:19:13 -07001214 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 IIntentSender r = IIntentSender.Stub.asInterface(
1217 data.readStrongBinder());
1218 int res = getUidForIntentSender(r);
1219 reply.writeNoException();
1220 reply.writeInt(res);
1221 return true;
1222 }
1223
Dianne Hackborn41203752012-08-31 14:05:51 -07001224 case HANDLE_INCOMING_USER_TRANSACTION: {
1225 data.enforceInterface(IActivityManager.descriptor);
1226 int callingPid = data.readInt();
1227 int callingUid = data.readInt();
1228 int userId = data.readInt();
1229 boolean allowAll = data.readInt() != 0 ;
1230 boolean requireFull = data.readInt() != 0;
1231 String name = data.readString();
1232 String callerPackage = data.readString();
1233 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1234 requireFull, name, callerPackage);
1235 reply.writeNoException();
1236 reply.writeInt(res);
1237 return true;
1238 }
1239
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 case SET_PROCESS_LIMIT_TRANSACTION: {
1241 data.enforceInterface(IActivityManager.descriptor);
1242 int max = data.readInt();
1243 setProcessLimit(max);
1244 reply.writeNoException();
1245 return true;
1246 }
1247
1248 case GET_PROCESS_LIMIT_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 int limit = getProcessLimit();
1251 reply.writeNoException();
1252 reply.writeInt(limit);
1253 return true;
1254 }
1255
1256 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1257 data.enforceInterface(IActivityManager.descriptor);
1258 IBinder token = data.readStrongBinder();
1259 int pid = data.readInt();
1260 boolean isForeground = data.readInt() != 0;
1261 setProcessForeground(token, pid, isForeground);
1262 reply.writeNoException();
1263 return true;
1264 }
1265
1266 case CHECK_PERMISSION_TRANSACTION: {
1267 data.enforceInterface(IActivityManager.descriptor);
1268 String perm = data.readString();
1269 int pid = data.readInt();
1270 int uid = data.readInt();
1271 int res = checkPermission(perm, pid, uid);
1272 reply.writeNoException();
1273 reply.writeInt(res);
1274 return true;
1275 }
1276
Dianne Hackbornff170242014-11-19 10:59:01 -08001277 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1278 data.enforceInterface(IActivityManager.descriptor);
1279 String perm = data.readString();
1280 int pid = data.readInt();
1281 int uid = data.readInt();
1282 IBinder token = data.readStrongBinder();
1283 int res = checkPermissionWithToken(perm, pid, uid, token);
1284 reply.writeNoException();
1285 reply.writeInt(res);
1286 return true;
1287 }
1288
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001289 case CHECK_URI_PERMISSION_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 Uri uri = Uri.CREATOR.createFromParcel(data);
1292 int pid = data.readInt();
1293 int uid = data.readInt();
1294 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001295 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001296 IBinder callerToken = data.readStrongBinder();
1297 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001298 reply.writeNoException();
1299 reply.writeInt(res);
1300 return true;
1301 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001302
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001303 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001304 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001305 String packageName = data.readString();
1306 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1307 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001308 int userId = data.readInt();
1309 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 reply.writeNoException();
1311 reply.writeInt(res ? 1 : 0);
1312 return true;
1313 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001314
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001315 case GRANT_URI_PERMISSION_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 IBinder b = data.readStrongBinder();
1318 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1319 String targetPkg = data.readString();
1320 Uri uri = Uri.CREATOR.createFromParcel(data);
1321 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001322 int userId = data.readInt();
1323 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001324 reply.writeNoException();
1325 return true;
1326 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001327
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001328 case REVOKE_URI_PERMISSION_TRANSACTION: {
1329 data.enforceInterface(IActivityManager.descriptor);
1330 IBinder b = data.readStrongBinder();
1331 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1332 Uri uri = Uri.CREATOR.createFromParcel(data);
1333 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001334 int userId = data.readInt();
1335 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 reply.writeNoException();
1337 return true;
1338 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001339
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001340 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1341 data.enforceInterface(IActivityManager.descriptor);
1342 Uri uri = Uri.CREATOR.createFromParcel(data);
1343 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001344 int userId = data.readInt();
1345 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001346 reply.writeNoException();
1347 return true;
1348 }
1349
1350 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 Uri uri = Uri.CREATOR.createFromParcel(data);
1353 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001354 int userId = data.readInt();
1355 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001356 reply.writeNoException();
1357 return true;
1358 }
1359
1360 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001362 final String packageName = data.readString();
1363 final boolean incoming = data.readInt() != 0;
1364 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1365 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001366 reply.writeNoException();
1367 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1368 return true;
1369 }
1370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001371 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
1373 IBinder b = data.readStrongBinder();
1374 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1375 boolean waiting = data.readInt() != 0;
1376 showWaitingForDebugger(app, waiting);
1377 reply.writeNoException();
1378 return true;
1379 }
1380
1381 case GET_MEMORY_INFO_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1384 getMemoryInfo(mi);
1385 reply.writeNoException();
1386 mi.writeToParcel(reply, 0);
1387 return true;
1388 }
1389
1390 case UNHANDLED_BACK_TRANSACTION: {
1391 data.enforceInterface(IActivityManager.descriptor);
1392 unhandledBack();
1393 reply.writeNoException();
1394 return true;
1395 }
1396
1397 case OPEN_CONTENT_URI_TRANSACTION: {
1398 data.enforceInterface(IActivityManager.descriptor);
1399 Uri uri = Uri.parse(data.readString());
1400 ParcelFileDescriptor pfd = openContentUri(uri);
1401 reply.writeNoException();
1402 if (pfd != null) {
1403 reply.writeInt(1);
1404 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1405 } else {
1406 reply.writeInt(0);
1407 }
1408 return true;
1409 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001410
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001411 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1412 data.enforceInterface(IActivityManager.descriptor);
1413 setLockScreenShown(data.readInt() != 0);
1414 reply.writeNoException();
1415 return true;
1416 }
1417
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001418 case SET_DEBUG_APP_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 String pn = data.readString();
1421 boolean wfd = data.readInt() != 0;
1422 boolean per = data.readInt() != 0;
1423 setDebugApp(pn, wfd, per);
1424 reply.writeNoException();
1425 return true;
1426 }
1427
1428 case SET_ALWAYS_FINISH_TRANSACTION: {
1429 data.enforceInterface(IActivityManager.descriptor);
1430 boolean enabled = data.readInt() != 0;
1431 setAlwaysFinish(enabled);
1432 reply.writeNoException();
1433 return true;
1434 }
1435
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001436 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001437 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001438 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001439 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001440 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001441 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001442 return true;
1443 }
1444
1445 case ENTER_SAFE_MODE_TRANSACTION: {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 enterSafeMode();
1448 reply.writeNoException();
1449 return true;
1450 }
1451
1452 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 IIntentSender is = IIntentSender.Stub.asInterface(
1455 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001456 int sourceUid = data.readInt();
1457 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001458 String tag = data.readString();
1459 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1460 reply.writeNoException();
1461 return true;
1462 }
1463
1464 case NOTE_ALARM_START_TRANSACTION: {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 IIntentSender is = IIntentSender.Stub.asInterface(
1467 data.readStrongBinder());
1468 int sourceUid = data.readInt();
1469 String tag = data.readString();
1470 noteAlarmStart(is, sourceUid, tag);
1471 reply.writeNoException();
1472 return true;
1473 }
1474
1475 case NOTE_ALARM_FINISH_TRANSACTION: {
1476 data.enforceInterface(IActivityManager.descriptor);
1477 IIntentSender is = IIntentSender.Stub.asInterface(
1478 data.readStrongBinder());
1479 int sourceUid = data.readInt();
1480 String tag = data.readString();
1481 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001482 reply.writeNoException();
1483 return true;
1484 }
1485
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001486 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001487 data.enforceInterface(IActivityManager.descriptor);
1488 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001489 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001490 boolean secure = data.readInt() != 0;
1491 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001492 reply.writeNoException();
1493 reply.writeInt(res ? 1 : 0);
1494 return true;
1495 }
1496
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001497 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 String reason = data.readString();
1500 boolean res = killProcessesBelowForeground(reason);
1501 reply.writeNoException();
1502 reply.writeInt(res ? 1 : 0);
1503 return true;
1504 }
1505
Dan Egnor60d87622009-12-16 16:32:58 -08001506 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1507 data.enforceInterface(IActivityManager.descriptor);
1508 IBinder app = data.readStrongBinder();
1509 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1510 handleApplicationCrash(app, ci);
1511 reply.writeNoException();
1512 return true;
1513 }
1514
1515 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001516 data.enforceInterface(IActivityManager.descriptor);
1517 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001519 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001520 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001521 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001522 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001523 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001524 return true;
1525 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001526
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001527 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
1529 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001530 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001531 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1532 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001533 reply.writeNoException();
1534 return true;
1535 }
1536
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001537 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 int sig = data.readInt();
1540 signalPersistentProcesses(sig);
1541 reply.writeNoException();
1542 return true;
1543 }
1544
Dianne Hackborn03abb812010-01-04 18:43:19 -08001545 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1546 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001547 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001548 int userId = data.readInt();
1549 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001550 reply.writeNoException();
1551 return true;
1552 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001553
1554 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 killAllBackgroundProcesses();
1557 reply.writeNoException();
1558 return true;
1559 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001560
Gustav Sennton6258dcd2015-10-30 19:25:37 +00001561 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: {
1562 data.enforceInterface(IActivityManager.descriptor);
1563 String packageName = data.readString();
1564 int userId = data.readInt();
1565 killPackageDependents(packageName, userId);
1566 reply.writeNoException();
1567 return true;
1568 }
1569
Dianne Hackborn03abb812010-01-04 18:43:19 -08001570 case FORCE_STOP_PACKAGE_TRANSACTION: {
1571 data.enforceInterface(IActivityManager.descriptor);
1572 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001573 int userId = data.readInt();
1574 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001575 reply.writeNoException();
1576 return true;
1577 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001578
1579 case GET_MY_MEMORY_STATE_TRANSACTION: {
1580 data.enforceInterface(IActivityManager.descriptor);
1581 ActivityManager.RunningAppProcessInfo info =
1582 new ActivityManager.RunningAppProcessInfo();
1583 getMyMemoryState(info);
1584 reply.writeNoException();
1585 info.writeToParcel(reply, 0);
1586 return true;
1587 }
1588
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001589 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1590 data.enforceInterface(IActivityManager.descriptor);
1591 ConfigurationInfo config = getDeviceConfigurationInfo();
1592 reply.writeNoException();
1593 config.writeToParcel(reply, 0);
1594 return true;
1595 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001596
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001597 case PROFILE_CONTROL_TRANSACTION: {
1598 data.enforceInterface(IActivityManager.descriptor);
1599 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001600 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001601 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001602 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001603 ProfilerInfo profilerInfo = data.readInt() != 0
1604 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1605 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001606 reply.writeNoException();
1607 reply.writeInt(res ? 1 : 0);
1608 return true;
1609 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001610
Dianne Hackborn55280a92009-05-07 15:53:46 -07001611 case SHUTDOWN_TRANSACTION: {
1612 data.enforceInterface(IActivityManager.descriptor);
1613 boolean res = shutdown(data.readInt());
1614 reply.writeNoException();
1615 reply.writeInt(res ? 1 : 0);
1616 return true;
1617 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001618
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001619 case STOP_APP_SWITCHES_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 stopAppSwitches();
1622 reply.writeNoException();
1623 return true;
1624 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001625
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001626 case RESUME_APP_SWITCHES_TRANSACTION: {
1627 data.enforceInterface(IActivityManager.descriptor);
1628 resumeAppSwitches();
1629 reply.writeNoException();
1630 return true;
1631 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001632
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001633 case PEEK_SERVICE_TRANSACTION: {
1634 data.enforceInterface(IActivityManager.descriptor);
1635 Intent service = Intent.CREATOR.createFromParcel(data);
1636 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001637 String callingPackage = data.readString();
1638 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001639 reply.writeNoException();
1640 reply.writeStrongBinder(binder);
1641 return true;
1642 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001643
Christopher Tate181fafa2009-05-14 11:12:14 -07001644 case START_BACKUP_AGENT_TRANSACTION: {
1645 data.enforceInterface(IActivityManager.descriptor);
1646 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1647 int backupRestoreMode = data.readInt();
1648 boolean success = bindBackupAgent(info, backupRestoreMode);
1649 reply.writeNoException();
1650 reply.writeInt(success ? 1 : 0);
1651 return true;
1652 }
1653
1654 case BACKUP_AGENT_CREATED_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 String packageName = data.readString();
1657 IBinder agent = data.readStrongBinder();
1658 backupAgentCreated(packageName, agent);
1659 reply.writeNoException();
1660 return true;
1661 }
1662
1663 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1666 unbindBackupAgent(info);
1667 reply.writeNoException();
1668 return true;
1669 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001670
1671 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1672 data.enforceInterface(IActivityManager.descriptor);
1673 String packageName = data.readString();
1674 addPackageDependency(packageName);
1675 reply.writeNoException();
1676 return true;
1677 }
1678
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001679 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001680 data.enforceInterface(IActivityManager.descriptor);
1681 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001682 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001683 String reason = data.readString();
1684 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001685 reply.writeNoException();
1686 return true;
1687 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001688
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001689 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1690 data.enforceInterface(IActivityManager.descriptor);
1691 String reason = data.readString();
1692 closeSystemDialogs(reason);
1693 reply.writeNoException();
1694 return true;
1695 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001696
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001697 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001699 int[] pids = data.createIntArray();
1700 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001701 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001702 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001703 return true;
1704 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001705
1706 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1707 data.enforceInterface(IActivityManager.descriptor);
1708 String processName = data.readString();
1709 int uid = data.readInt();
1710 killApplicationProcess(processName, uid);
1711 reply.writeNoException();
1712 return true;
1713 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001714
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001715 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1716 data.enforceInterface(IActivityManager.descriptor);
1717 IBinder token = data.readStrongBinder();
1718 String packageName = data.readString();
1719 int enterAnim = data.readInt();
1720 int exitAnim = data.readInt();
1721 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001722 reply.writeNoException();
1723 return true;
1724 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001725
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001726 case IS_USER_A_MONKEY_TRANSACTION: {
1727 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001728 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001729 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001730 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001731 return true;
1732 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001733
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001734 case SET_USER_IS_MONKEY_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 final boolean monkey = (data.readInt() == 1);
1737 setUserIsMonkey(monkey);
1738 reply.writeNoException();
1739 return true;
1740 }
1741
Dianne Hackborn860755f2010-06-03 18:47:52 -07001742 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 finishHeavyWeightApp();
1745 reply.writeNoException();
1746 return true;
1747 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001748
1749 case IS_IMMERSIVE_TRANSACTION: {
1750 data.enforceInterface(IActivityManager.descriptor);
1751 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001752 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001753 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001754 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001755 return true;
1756 }
1757
Craig Mautnerd61dc202014-07-07 11:09:11 -07001758 case IS_TOP_OF_TASK_TRANSACTION: {
1759 data.enforceInterface(IActivityManager.descriptor);
1760 IBinder token = data.readStrongBinder();
1761 final boolean isTopOfTask = isTopOfTask(token);
1762 reply.writeNoException();
1763 reply.writeInt(isTopOfTask ? 1 : 0);
1764 return true;
1765 }
1766
Craig Mautner5eda9b32013-07-02 11:58:16 -07001767 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001768 data.enforceInterface(IActivityManager.descriptor);
1769 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001770 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001771 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001772 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001773 return true;
1774 }
1775
1776 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1777 data.enforceInterface(IActivityManager.descriptor);
1778 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001779 final Bundle bundle;
1780 if (data.readInt() == 0) {
1781 bundle = null;
1782 } else {
1783 bundle = data.readBundle();
1784 }
Chong Zhang280d3322015-11-03 17:27:26 -08001785 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001786 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001787 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001788 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001789 return true;
1790 }
1791
Craig Mautner233ceee2014-05-09 17:05:11 -07001792 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1793 data.enforceInterface(IActivityManager.descriptor);
1794 IBinder token = data.readStrongBinder();
1795 final ActivityOptions options = getActivityOptions(token);
1796 reply.writeNoException();
1797 reply.writeBundle(options == null ? null : options.toBundle());
1798 return true;
1799 }
1800
Daniel Sandler69a48172010-06-23 16:29:36 -04001801 case SET_IMMERSIVE_TRANSACTION: {
1802 data.enforceInterface(IActivityManager.descriptor);
1803 IBinder token = data.readStrongBinder();
1804 boolean imm = data.readInt() == 1;
1805 setImmersive(token, imm);
1806 reply.writeNoException();
1807 return true;
1808 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001809
Daniel Sandler69a48172010-06-23 16:29:36 -04001810 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1811 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001812 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001813 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001814 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001815 return true;
1816 }
1817
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001818 case CRASH_APPLICATION_TRANSACTION: {
1819 data.enforceInterface(IActivityManager.descriptor);
1820 int uid = data.readInt();
1821 int initialPid = data.readInt();
1822 String packageName = data.readString();
1823 String message = data.readString();
1824 crashApplication(uid, initialPid, packageName, message);
1825 reply.writeNoException();
1826 return true;
1827 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001828
1829 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001832 int userId = data.readInt();
1833 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001834 reply.writeNoException();
1835 reply.writeString(type);
1836 return true;
1837 }
1838
Dianne Hackborn7e269642010-08-25 19:50:20 -07001839 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1840 data.enforceInterface(IActivityManager.descriptor);
1841 String name = data.readString();
1842 IBinder perm = newUriPermissionOwner(name);
1843 reply.writeNoException();
1844 reply.writeStrongBinder(perm);
1845 return true;
1846 }
1847
1848 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 IBinder owner = data.readStrongBinder();
1851 int fromUid = data.readInt();
1852 String targetPkg = data.readString();
1853 Uri uri = Uri.CREATOR.createFromParcel(data);
1854 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001855 int sourceUserId = data.readInt();
1856 int targetUserId = data.readInt();
1857 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1858 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001859 reply.writeNoException();
1860 return true;
1861 }
1862
1863 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1864 data.enforceInterface(IActivityManager.descriptor);
1865 IBinder owner = data.readStrongBinder();
1866 Uri uri = null;
1867 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001868 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001869 }
1870 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001871 int userId = data.readInt();
1872 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001873 reply.writeNoException();
1874 return true;
1875 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001876
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001877 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1878 data.enforceInterface(IActivityManager.descriptor);
1879 int callingUid = data.readInt();
1880 String targetPkg = data.readString();
1881 Uri uri = Uri.CREATOR.createFromParcel(data);
1882 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001883 int userId = data.readInt();
1884 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001885 reply.writeNoException();
1886 reply.writeInt(res);
1887 return true;
1888 }
1889
Andy McFadden824c5102010-07-09 16:26:57 -07001890 case DUMP_HEAP_TRANSACTION: {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001893 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001894 boolean managed = data.readInt() != 0;
1895 String path = data.readString();
1896 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001897 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001898 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001899 reply.writeNoException();
1900 reply.writeInt(res ? 1 : 0);
1901 return true;
1902 }
1903
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001904 case START_ACTIVITIES_TRANSACTION:
1905 {
1906 data.enforceInterface(IActivityManager.descriptor);
1907 IBinder b = data.readStrongBinder();
1908 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001909 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001910 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1911 String[] resolvedTypes = data.createStringArray();
1912 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001913 Bundle options = data.readInt() != 0
1914 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001915 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001916 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001917 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001918 reply.writeNoException();
1919 reply.writeInt(result);
1920 return true;
1921 }
1922
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001923 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1924 {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 int mode = getFrontActivityScreenCompatMode();
1927 reply.writeNoException();
1928 reply.writeInt(mode);
1929 return true;
1930 }
1931
1932 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1933 {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 int mode = data.readInt();
1936 setFrontActivityScreenCompatMode(mode);
1937 reply.writeNoException();
1938 reply.writeInt(mode);
1939 return true;
1940 }
1941
1942 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1943 {
1944 data.enforceInterface(IActivityManager.descriptor);
1945 String pkg = data.readString();
1946 int mode = getPackageScreenCompatMode(pkg);
1947 reply.writeNoException();
1948 reply.writeInt(mode);
1949 return true;
1950 }
1951
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001952 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1953 {
1954 data.enforceInterface(IActivityManager.descriptor);
1955 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001956 int mode = data.readInt();
1957 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001958 reply.writeNoException();
1959 return true;
1960 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001961
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001962 case SWITCH_USER_TRANSACTION: {
1963 data.enforceInterface(IActivityManager.descriptor);
1964 int userid = data.readInt();
1965 boolean result = switchUser(userid);
1966 reply.writeNoException();
1967 reply.writeInt(result ? 1 : 0);
1968 return true;
1969 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001970
Kenny Guy08488bf2014-02-21 17:40:37 +00001971 case START_USER_IN_BACKGROUND_TRANSACTION: {
1972 data.enforceInterface(IActivityManager.descriptor);
1973 int userid = data.readInt();
1974 boolean result = startUserInBackground(userid);
1975 reply.writeNoException();
1976 reply.writeInt(result ? 1 : 0);
1977 return true;
1978 }
1979
Jeff Sharkeyba512352015-11-12 20:17:45 -08001980 case UNLOCK_USER_TRANSACTION: {
1981 data.enforceInterface(IActivityManager.descriptor);
1982 int userId = data.readInt();
1983 byte[] token = data.createByteArray();
1984 boolean result = unlockUser(userId, token);
1985 reply.writeNoException();
1986 reply.writeInt(result ? 1 : 0);
1987 return true;
1988 }
1989
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001990 case STOP_USER_TRANSACTION: {
1991 data.enforceInterface(IActivityManager.descriptor);
1992 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07001993 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001994 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1995 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07001996 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001997 reply.writeNoException();
1998 reply.writeInt(result);
1999 return true;
2000 }
2001
Amith Yamasani52f1d752012-03-28 18:19:29 -07002002 case GET_CURRENT_USER_TRANSACTION: {
2003 data.enforceInterface(IActivityManager.descriptor);
2004 UserInfo userInfo = getCurrentUser();
2005 reply.writeNoException();
2006 userInfo.writeToParcel(reply, 0);
2007 return true;
2008 }
2009
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002010 case IS_USER_RUNNING_TRANSACTION: {
2011 data.enforceInterface(IActivityManager.descriptor);
2012 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002013 int _flags = data.readInt();
2014 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002015 reply.writeNoException();
2016 reply.writeInt(result ? 1 : 0);
2017 return true;
2018 }
2019
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002020 case GET_RUNNING_USER_IDS_TRANSACTION: {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 int[] result = getRunningUserIds();
2023 reply.writeNoException();
2024 reply.writeIntArray(result);
2025 return true;
2026 }
2027
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002028 case REMOVE_TASK_TRANSACTION:
2029 {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002032 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002033 reply.writeNoException();
2034 reply.writeInt(result ? 1 : 0);
2035 return true;
2036 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002037
Jeff Sharkeya4620792011-05-20 15:29:23 -07002038 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2041 data.readStrongBinder());
2042 registerProcessObserver(observer);
2043 return true;
2044 }
2045
2046 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2049 data.readStrongBinder());
2050 unregisterProcessObserver(observer);
2051 return true;
2052 }
2053
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002054 case REGISTER_UID_OBSERVER_TRANSACTION: {
2055 data.enforceInterface(IActivityManager.descriptor);
2056 IUidObserver observer = IUidObserver.Stub.asInterface(
2057 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002058 int which = data.readInt();
2059 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002060 return true;
2061 }
2062
2063 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2064 data.enforceInterface(IActivityManager.descriptor);
2065 IUidObserver observer = IUidObserver.Stub.asInterface(
2066 data.readStrongBinder());
2067 unregisterUidObserver(observer);
2068 return true;
2069 }
2070
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002071 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2072 {
2073 data.enforceInterface(IActivityManager.descriptor);
2074 String pkg = data.readString();
2075 boolean ask = getPackageAskScreenCompat(pkg);
2076 reply.writeNoException();
2077 reply.writeInt(ask ? 1 : 0);
2078 return true;
2079 }
2080
2081 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2082 {
2083 data.enforceInterface(IActivityManager.descriptor);
2084 String pkg = data.readString();
2085 boolean ask = data.readInt() != 0;
2086 setPackageAskScreenCompat(pkg, ask);
2087 reply.writeNoException();
2088 return true;
2089 }
2090
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002091 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2092 data.enforceInterface(IActivityManager.descriptor);
2093 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002094 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002095 boolean res = isIntentSenderTargetedToPackage(r);
2096 reply.writeNoException();
2097 reply.writeInt(res ? 1 : 0);
2098 return true;
2099 }
2100
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002101 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2102 data.enforceInterface(IActivityManager.descriptor);
2103 IIntentSender r = IIntentSender.Stub.asInterface(
2104 data.readStrongBinder());
2105 boolean res = isIntentSenderAnActivity(r);
2106 reply.writeNoException();
2107 reply.writeInt(res ? 1 : 0);
2108 return true;
2109 }
2110
Dianne Hackborn81038902012-11-26 17:04:09 -08002111 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2112 data.enforceInterface(IActivityManager.descriptor);
2113 IIntentSender r = IIntentSender.Stub.asInterface(
2114 data.readStrongBinder());
2115 Intent intent = getIntentForIntentSender(r);
2116 reply.writeNoException();
2117 if (intent != null) {
2118 reply.writeInt(1);
2119 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2120 } else {
2121 reply.writeInt(0);
2122 }
2123 return true;
2124 }
2125
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002126 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2127 data.enforceInterface(IActivityManager.descriptor);
2128 IIntentSender r = IIntentSender.Stub.asInterface(
2129 data.readStrongBinder());
2130 String prefix = data.readString();
2131 String tag = getTagForIntentSender(r, prefix);
2132 reply.writeNoException();
2133 reply.writeString(tag);
2134 return true;
2135 }
2136
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002137 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2138 data.enforceInterface(IActivityManager.descriptor);
2139 Configuration config = Configuration.CREATOR.createFromParcel(data);
2140 updatePersistentConfiguration(config);
2141 reply.writeNoException();
2142 return true;
2143 }
2144
Dianne Hackbornb437e092011-08-05 17:50:29 -07002145 case GET_PROCESS_PSS_TRANSACTION: {
2146 data.enforceInterface(IActivityManager.descriptor);
2147 int[] pids = data.createIntArray();
2148 long[] pss = getProcessPss(pids);
2149 reply.writeNoException();
2150 reply.writeLongArray(pss);
2151 return true;
2152 }
2153
Dianne Hackborn661cd522011-08-22 00:26:20 -07002154 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2155 data.enforceInterface(IActivityManager.descriptor);
2156 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2157 boolean always = data.readInt() != 0;
2158 showBootMessage(msg, always);
2159 reply.writeNoException();
2160 return true;
2161 }
2162
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002163 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002164 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002165 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002166 reply.writeNoException();
2167 return true;
2168 }
2169
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002170 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2171 data.enforceInterface(IActivityManager.descriptor);
2172 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2173 reply.writeNoException();
2174 return true;
2175 }
2176
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002177 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002178 data.enforceInterface(IActivityManager.descriptor);
2179 IBinder token = data.readStrongBinder();
2180 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002181 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002182 reply.writeNoException();
2183 reply.writeInt(res ? 1 : 0);
2184 return true;
2185 }
2186
2187 case NAVIGATE_UP_TO_TRANSACTION: {
2188 data.enforceInterface(IActivityManager.descriptor);
2189 IBinder token = data.readStrongBinder();
2190 Intent target = Intent.CREATOR.createFromParcel(data);
2191 int resultCode = data.readInt();
2192 Intent resultData = null;
2193 if (data.readInt() != 0) {
2194 resultData = Intent.CREATOR.createFromParcel(data);
2195 }
2196 boolean res = navigateUpTo(token, target, resultCode, resultData);
2197 reply.writeNoException();
2198 reply.writeInt(res ? 1 : 0);
2199 return true;
2200 }
2201
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002202 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2203 data.enforceInterface(IActivityManager.descriptor);
2204 IBinder token = data.readStrongBinder();
2205 int res = getLaunchedFromUid(token);
2206 reply.writeNoException();
2207 reply.writeInt(res);
2208 return true;
2209 }
2210
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002211 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2212 data.enforceInterface(IActivityManager.descriptor);
2213 IBinder token = data.readStrongBinder();
2214 String res = getLaunchedFromPackage(token);
2215 reply.writeNoException();
2216 reply.writeString(res);
2217 return true;
2218 }
2219
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002220 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2221 data.enforceInterface(IActivityManager.descriptor);
2222 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2223 data.readStrongBinder());
2224 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002225 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002226 return true;
2227 }
2228
2229 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2230 data.enforceInterface(IActivityManager.descriptor);
2231 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2232 data.readStrongBinder());
2233 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002234 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002235 return true;
2236 }
2237
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002238 case REQUEST_BUG_REPORT_TRANSACTION: {
2239 data.enforceInterface(IActivityManager.descriptor);
Felipe Leme4cc86332015-12-04 16:37:28 -08002240 boolean progress = data.readInt() != 0;
2241 requestBugReport(progress);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002242 reply.writeNoException();
2243 return true;
2244 }
2245
2246 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2247 data.enforceInterface(IActivityManager.descriptor);
2248 int pid = data.readInt();
2249 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002250 String reason = data.readString();
2251 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002252 reply.writeNoException();
2253 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002254 return true;
2255 }
2256
Adam Skorydfc7fd72013-08-05 19:23:41 -07002257 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002258 data.enforceInterface(IActivityManager.descriptor);
2259 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002260 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002261 reply.writeNoException();
2262 reply.writeBundle(res);
2263 return true;
2264 }
2265
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002266 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2267 data.enforceInterface(IActivityManager.descriptor);
2268 int requestType = data.readInt();
2269 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002270 IBinder activityToken = data.readStrongBinder();
2271 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002272 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002273 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002274 return true;
2275 }
2276
Adam Skorydfc7fd72013-08-05 19:23:41 -07002277 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002278 data.enforceInterface(IActivityManager.descriptor);
2279 IBinder token = data.readStrongBinder();
2280 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002281 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2282 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002283 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2284 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002285 reply.writeNoException();
2286 return true;
2287 }
2288
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002289 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2290 data.enforceInterface(IActivityManager.descriptor);
2291 Intent intent = Intent.CREATOR.createFromParcel(data);
2292 int requestType = data.readInt();
2293 String hint = data.readString();
2294 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002295 Bundle args = data.readBundle();
2296 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002297 reply.writeNoException();
2298 reply.writeInt(res ? 1 : 0);
2299 return true;
2300 }
2301
Benjamin Franzc200f442015-06-25 18:20:04 +01002302 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2303 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002304 boolean res = isAssistDataAllowedOnCurrentActivity();
2305 reply.writeNoException();
2306 reply.writeInt(res ? 1 : 0);
2307 return true;
2308 }
2309
2310 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2311 data.enforceInterface(IActivityManager.descriptor);
2312 IBinder token = data.readStrongBinder();
2313 Bundle args = data.readBundle();
2314 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002315 reply.writeNoException();
2316 reply.writeInt(res ? 1 : 0);
2317 return true;
2318 }
2319
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002320 case KILL_UID_TRANSACTION: {
2321 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002322 int appId = data.readInt();
2323 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002324 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002325 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002326 reply.writeNoException();
2327 return true;
2328 }
2329
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002330 case HANG_TRANSACTION: {
2331 data.enforceInterface(IActivityManager.descriptor);
2332 IBinder who = data.readStrongBinder();
2333 boolean allowRestart = data.readInt() != 0;
2334 hang(who, allowRestart);
2335 reply.writeNoException();
2336 return true;
2337 }
2338
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002339 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2340 data.enforceInterface(IActivityManager.descriptor);
2341 IBinder token = data.readStrongBinder();
2342 reportActivityFullyDrawn(token);
2343 reply.writeNoException();
2344 return true;
2345 }
2346
Craig Mautner5eda9b32013-07-02 11:58:16 -07002347 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2348 data.enforceInterface(IActivityManager.descriptor);
2349 IBinder token = data.readStrongBinder();
2350 notifyActivityDrawn(token);
2351 reply.writeNoException();
2352 return true;
2353 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002354
2355 case RESTART_TRANSACTION: {
2356 data.enforceInterface(IActivityManager.descriptor);
2357 restart();
2358 reply.writeNoException();
2359 return true;
2360 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002361
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002362 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2363 data.enforceInterface(IActivityManager.descriptor);
2364 performIdleMaintenance();
2365 reply.writeNoException();
2366 return true;
2367 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002368
Todd Kennedyca4d8422015-01-15 15:19:22 -08002369 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002370 data.enforceInterface(IActivityManager.descriptor);
2371 IBinder parentActivityToken = data.readStrongBinder();
2372 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002373 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002374 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002375 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002376 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002377 if (activityContainer != null) {
2378 reply.writeInt(1);
2379 reply.writeStrongBinder(activityContainer.asBinder());
2380 } else {
2381 reply.writeInt(0);
2382 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002383 return true;
2384 }
2385
Craig Mautner95da1082014-02-24 17:54:35 -08002386 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2387 data.enforceInterface(IActivityManager.descriptor);
2388 IActivityContainer activityContainer =
2389 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2390 deleteActivityContainer(activityContainer);
2391 reply.writeNoException();
2392 return true;
2393 }
2394
Todd Kennedy4900bf92015-01-16 16:05:14 -08002395 case CREATE_STACK_ON_DISPLAY: {
2396 data.enforceInterface(IActivityManager.descriptor);
2397 int displayId = data.readInt();
2398 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2399 reply.writeNoException();
2400 if (activityContainer != null) {
2401 reply.writeInt(1);
2402 reply.writeStrongBinder(activityContainer.asBinder());
2403 } else {
2404 reply.writeInt(0);
2405 }
2406 return true;
2407 }
2408
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002409 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002410 data.enforceInterface(IActivityManager.descriptor);
2411 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002412 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002413 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002414 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002415 return true;
2416 }
2417
Craig Mautneraea74a52014-03-08 14:23:10 -08002418 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2419 data.enforceInterface(IActivityManager.descriptor);
2420 final int taskId = data.readInt();
2421 startLockTaskMode(taskId);
2422 reply.writeNoException();
2423 return true;
2424 }
2425
2426 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2427 data.enforceInterface(IActivityManager.descriptor);
2428 IBinder token = data.readStrongBinder();
2429 startLockTaskMode(token);
2430 reply.writeNoException();
2431 return true;
2432 }
2433
Craig Mautnerd61dc202014-07-07 11:09:11 -07002434 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002435 data.enforceInterface(IActivityManager.descriptor);
2436 startLockTaskModeOnCurrent();
2437 reply.writeNoException();
2438 return true;
2439 }
2440
Craig Mautneraea74a52014-03-08 14:23:10 -08002441 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2442 data.enforceInterface(IActivityManager.descriptor);
2443 stopLockTaskMode();
2444 reply.writeNoException();
2445 return true;
2446 }
2447
Craig Mautnerd61dc202014-07-07 11:09:11 -07002448 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002449 data.enforceInterface(IActivityManager.descriptor);
2450 stopLockTaskModeOnCurrent();
2451 reply.writeNoException();
2452 return true;
2453 }
2454
Craig Mautneraea74a52014-03-08 14:23:10 -08002455 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2456 data.enforceInterface(IActivityManager.descriptor);
2457 final boolean isInLockTaskMode = isInLockTaskMode();
2458 reply.writeNoException();
2459 reply.writeInt(isInLockTaskMode ? 1 : 0);
2460 return true;
2461 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002462
Benjamin Franz43261142015-02-11 15:59:44 +00002463 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2464 data.enforceInterface(IActivityManager.descriptor);
2465 final int lockTaskModeState = getLockTaskModeState();
2466 reply.writeNoException();
2467 reply.writeInt(lockTaskModeState);
2468 return true;
2469 }
2470
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002471 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2472 data.enforceInterface(IActivityManager.descriptor);
2473 final IBinder token = data.readStrongBinder();
2474 showLockTaskEscapeMessage(token);
2475 reply.writeNoException();
2476 return true;
2477 }
2478
Winson Chunga449dc02014-05-16 11:15:04 -07002479 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002480 data.enforceInterface(IActivityManager.descriptor);
2481 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002482 ActivityManager.TaskDescription values =
2483 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2484 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002485 reply.writeNoException();
2486 return true;
2487 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002488
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002489 case SET_TASK_RESIZEABLE_TRANSACTION: {
2490 data.enforceInterface(IActivityManager.descriptor);
2491 int taskId = data.readInt();
2492 boolean resizeable = (data.readInt() == 1) ? true : false;
2493 setTaskResizeable(taskId, resizeable);
2494 reply.writeNoException();
2495 return true;
2496 }
2497
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002498 case RESIZE_TASK_TRANSACTION: {
2499 data.enforceInterface(IActivityManager.descriptor);
2500 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002501 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002502 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002503 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002504 reply.writeNoException();
2505 return true;
2506 }
2507
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002508 case GET_TASK_BOUNDS_TRANSACTION: {
2509 data.enforceInterface(IActivityManager.descriptor);
2510 int taskId = data.readInt();
2511 Rect r = getTaskBounds(taskId);
2512 reply.writeNoException();
2513 r.writeToParcel(reply, 0);
2514 return true;
2515 }
2516
Craig Mautner648f69b2014-09-18 14:16:26 -07002517 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2518 data.enforceInterface(IActivityManager.descriptor);
2519 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002520 int userId = data.readInt();
2521 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002522 reply.writeNoException();
2523 if (icon == null) {
2524 reply.writeInt(0);
2525 } else {
2526 reply.writeInt(1);
2527 icon.writeToParcel(reply, 0);
2528 }
2529 return true;
2530 }
2531
Winson Chung044d5292014-11-06 11:05:19 -08002532 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2533 data.enforceInterface(IActivityManager.descriptor);
2534 final Bundle bundle;
2535 if (data.readInt() == 0) {
2536 bundle = null;
2537 } else {
2538 bundle = data.readBundle();
2539 }
Chong Zhang280d3322015-11-03 17:27:26 -08002540 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002541 startInPlaceAnimationOnFrontMostApplication(options);
2542 reply.writeNoException();
2543 return true;
2544 }
2545
Jose Lima4b6c6692014-08-12 17:41:12 -07002546 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002547 data.enforceInterface(IActivityManager.descriptor);
2548 IBinder token = data.readStrongBinder();
2549 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002550 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002551 reply.writeNoException();
2552 reply.writeInt(success ? 1 : 0);
2553 return true;
2554 }
2555
Jose Lima4b6c6692014-08-12 17:41:12 -07002556 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002557 data.enforceInterface(IActivityManager.descriptor);
2558 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002559 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002560 reply.writeNoException();
2561 reply.writeInt(enabled ? 1 : 0);
2562 return true;
2563 }
2564
Jose Lima4b6c6692014-08-12 17:41:12 -07002565 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002566 data.enforceInterface(IActivityManager.descriptor);
2567 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002568 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002569 reply.writeNoException();
2570 return true;
2571 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002572
2573 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2574 data.enforceInterface(IActivityManager.descriptor);
2575 IBinder token = data.readStrongBinder();
2576 notifyLaunchTaskBehindComplete(token);
2577 reply.writeNoException();
2578 return true;
2579 }
Craig Mautner8746a472014-07-24 15:12:54 -07002580
2581 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2582 data.enforceInterface(IActivityManager.descriptor);
2583 IBinder token = data.readStrongBinder();
2584 notifyEnterAnimationComplete(token);
2585 reply.writeNoException();
2586 return true;
2587 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002588
2589 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2590 data.enforceInterface(IActivityManager.descriptor);
2591 bootAnimationComplete();
2592 reply.writeNoException();
2593 return true;
2594 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002595
Jeff Sharkey605eb792014-11-04 13:34:06 -08002596 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2597 data.enforceInterface(IActivityManager.descriptor);
2598 final int uid = data.readInt();
2599 final byte[] firstPacket = data.createByteArray();
2600 notifyCleartextNetwork(uid, firstPacket);
2601 reply.writeNoException();
2602 return true;
2603 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002604
2605 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2606 data.enforceInterface(IActivityManager.descriptor);
2607 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002608 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002609 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002610 String reportPackage = data.readString();
2611 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002612 reply.writeNoException();
2613 return true;
2614 }
2615
2616 case DUMP_HEAP_FINISHED_TRANSACTION: {
2617 data.enforceInterface(IActivityManager.descriptor);
2618 String path = data.readString();
2619 dumpHeapFinished(path);
2620 reply.writeNoException();
2621 return true;
2622 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002623
2624 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2625 data.enforceInterface(IActivityManager.descriptor);
2626 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2627 data.readStrongBinder());
2628 boolean keepAwake = data.readInt() != 0;
2629 setVoiceKeepAwake(session, keepAwake);
2630 reply.writeNoException();
2631 return true;
2632 }
Craig Mautnere5600772015-04-03 21:36:37 -07002633
2634 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2635 data.enforceInterface(IActivityManager.descriptor);
2636 int userId = data.readInt();
2637 String[] packages = data.readStringArray();
2638 updateLockTaskPackages(userId, packages);
2639 reply.writeNoException();
2640 return true;
2641 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002642
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002643 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2644 data.enforceInterface(IActivityManager.descriptor);
2645 String packageName = data.readString();
2646 updateDeviceOwner(packageName);
2647 reply.writeNoException();
2648 return true;
2649 }
2650
Dianne Hackborn1e383822015-04-10 14:02:33 -07002651 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2652 data.enforceInterface(IActivityManager.descriptor);
2653 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002654 String callingPackage = data.readString();
2655 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002656 reply.writeNoException();
2657 reply.writeInt(res);
2658 return true;
2659 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002660
2661 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2662 data.enforceInterface(IActivityManager.descriptor);
2663 String process = data.readString();
2664 int userId = data.readInt();
2665 int level = data.readInt();
2666 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2667 reply.writeNoException();
2668 reply.writeInt(res ? 1 : 0);
2669 return true;
2670 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002671
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002672 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2673 data.enforceInterface(IActivityManager.descriptor);
2674 IBinder token = data.readStrongBinder();
2675 boolean res = isRootVoiceInteraction(token);
2676 reply.writeNoException();
2677 reply.writeInt(res ? 1 : 0);
2678 return true;
2679 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002680
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002681 case START_BINDER_TRACKING_TRANSACTION: {
2682 data.enforceInterface(IActivityManager.descriptor);
2683 boolean res = startBinderTracking();
2684 reply.writeNoException();
2685 reply.writeInt(res ? 1 : 0);
2686 return true;
2687 }
2688
2689 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2690 data.enforceInterface(IActivityManager.descriptor);
2691 ParcelFileDescriptor fd = data.readInt() != 0
2692 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2693 boolean res = stopBinderTrackingAndDump(fd);
2694 reply.writeNoException();
2695 reply.writeInt(res ? 1 : 0);
2696 return true;
2697 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002698 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2699 data.enforceInterface(IActivityManager.descriptor);
2700 IBinder token = data.readStrongBinder();
2701 int stackId = getActivityStackId(token);
2702 reply.writeNoException();
2703 reply.writeInt(stackId);
2704 return true;
2705 }
2706 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2707 data.enforceInterface(IActivityManager.descriptor);
2708 IBinder token = data.readStrongBinder();
2709 int stackId = data.readInt();
2710 moveActivityToStack(token, stackId);
2711 reply.writeNoException();
2712 return true;
2713 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002714 case REPORT_SIZE_CONFIGURATIONS: {
2715 data.enforceInterface(IActivityManager.descriptor);
2716 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002717 int[] horizontal = readIntArray(data);
2718 int[] vertical = readIntArray(data);
2719 int[] smallest = readIntArray(data);
2720 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002721 return true;
2722 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002723 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2724 data.enforceInterface(IActivityManager.descriptor);
2725 final boolean suppress = data.readInt() == 1;
2726 suppressResizeConfigChanges(suppress);
2727 reply.writeNoException();
2728 return true;
2729 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002730 case REMOVE_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002731 data.enforceInterface(IActivityManager.descriptor);
2732 final int stackId = data.readInt();
2733 removeStack(stackId);
2734 reply.writeNoException();
2735 return true;
2736 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002737 case GET_APP_START_MODE_TRANSACTION: {
2738 data.enforceInterface(IActivityManager.descriptor);
2739 final int uid = data.readInt();
2740 final String pkg = data.readString();
2741 int res = getAppStartMode(uid, pkg);
2742 reply.writeNoException();
2743 reply.writeInt(res);
2744 return true;
2745 }
Wale Ogunwale5f986092015-12-04 15:35:38 -08002746 case IN_MULTI_WINDOW_MODE_TRANSACTION: {
2747 data.enforceInterface(IActivityManager.descriptor);
2748 final IBinder token = data.readStrongBinder();
2749 final boolean multiWindowMode = inMultiWindowMode(token);
2750 reply.writeNoException();
2751 reply.writeInt(multiWindowMode ? 1 : 0);
2752 return true;
2753 }
2754 case IN_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2755 data.enforceInterface(IActivityManager.descriptor);
2756 final IBinder token = data.readStrongBinder();
2757 final boolean pipMode = inPictureInPictureMode(token);
2758 reply.writeNoException();
2759 reply.writeInt(pipMode ? 1 : 0);
2760 return true;
2761 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002762 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002763
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002764 return super.onTransact(code, data, reply, flags);
2765 }
2766
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002767 private int[] readIntArray(Parcel data) {
2768 int[] smallest = null;
2769 int smallestSize = data.readInt();
2770 if (smallestSize > 0) {
2771 smallest = new int[smallestSize];
2772 data.readIntArray(smallest);
2773 }
2774 return smallest;
2775 }
2776
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002777 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002778 return this;
2779 }
2780
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002781 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2782 protected IActivityManager create() {
2783 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002784 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002785 Log.v("ActivityManager", "default service binder = " + b);
2786 }
2787 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002788 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002789 Log.v("ActivityManager", "default service = " + am);
2790 }
2791 return am;
2792 }
2793 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002794}
2795
2796class ActivityManagerProxy implements IActivityManager
2797{
2798 public ActivityManagerProxy(IBinder remote)
2799 {
2800 mRemote = remote;
2801 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002802
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002803 public IBinder asBinder()
2804 {
2805 return mRemote;
2806 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002807
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002808 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002809 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002810 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002811 Parcel data = Parcel.obtain();
2812 Parcel reply = Parcel.obtain();
2813 data.writeInterfaceToken(IActivityManager.descriptor);
2814 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002815 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002816 intent.writeToParcel(data, 0);
2817 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818 data.writeStrongBinder(resultTo);
2819 data.writeString(resultWho);
2820 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002821 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002822 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002823 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002824 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002825 } else {
2826 data.writeInt(0);
2827 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002828 if (options != null) {
2829 data.writeInt(1);
2830 options.writeToParcel(data, 0);
2831 } else {
2832 data.writeInt(0);
2833 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002834 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2835 reply.readException();
2836 int result = reply.readInt();
2837 reply.recycle();
2838 data.recycle();
2839 return result;
2840 }
Amith Yamasani82644082012-08-03 13:09:11 -07002841
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002842 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002843 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002844 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2845 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002850 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002851 intent.writeToParcel(data, 0);
2852 data.writeString(resolvedType);
2853 data.writeStrongBinder(resultTo);
2854 data.writeString(resultWho);
2855 data.writeInt(requestCode);
2856 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002857 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002858 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002859 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002860 } else {
2861 data.writeInt(0);
2862 }
2863 if (options != null) {
2864 data.writeInt(1);
2865 options.writeToParcel(data, 0);
2866 } else {
2867 data.writeInt(0);
2868 }
2869 data.writeInt(userId);
2870 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2871 reply.readException();
2872 int result = reply.readInt();
2873 reply.recycle();
2874 data.recycle();
2875 return result;
2876 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002877 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2878 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002879 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2880 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002881 Parcel data = Parcel.obtain();
2882 Parcel reply = Parcel.obtain();
2883 data.writeInterfaceToken(IActivityManager.descriptor);
2884 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2885 data.writeString(callingPackage);
2886 intent.writeToParcel(data, 0);
2887 data.writeString(resolvedType);
2888 data.writeStrongBinder(resultTo);
2889 data.writeString(resultWho);
2890 data.writeInt(requestCode);
2891 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002892 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002893 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002894 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002895 } else {
2896 data.writeInt(0);
2897 }
2898 if (options != null) {
2899 data.writeInt(1);
2900 options.writeToParcel(data, 0);
2901 } else {
2902 data.writeInt(0);
2903 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002904 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002905 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002906 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2907 reply.readException();
2908 int result = reply.readInt();
2909 reply.recycle();
2910 data.recycle();
2911 return result;
2912 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002913 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2914 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002915 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2916 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002917 Parcel data = Parcel.obtain();
2918 Parcel reply = Parcel.obtain();
2919 data.writeInterfaceToken(IActivityManager.descriptor);
2920 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002921 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002922 intent.writeToParcel(data, 0);
2923 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002924 data.writeStrongBinder(resultTo);
2925 data.writeString(resultWho);
2926 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002927 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002928 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002929 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002930 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002931 } else {
2932 data.writeInt(0);
2933 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002934 if (options != null) {
2935 data.writeInt(1);
2936 options.writeToParcel(data, 0);
2937 } else {
2938 data.writeInt(0);
2939 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002940 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002941 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2942 reply.readException();
2943 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2944 reply.recycle();
2945 data.recycle();
2946 return result;
2947 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002948 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2949 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002950 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002951 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002952 Parcel data = Parcel.obtain();
2953 Parcel reply = Parcel.obtain();
2954 data.writeInterfaceToken(IActivityManager.descriptor);
2955 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002956 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002957 intent.writeToParcel(data, 0);
2958 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002959 data.writeStrongBinder(resultTo);
2960 data.writeString(resultWho);
2961 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002962 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002963 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002964 if (options != null) {
2965 data.writeInt(1);
2966 options.writeToParcel(data, 0);
2967 } else {
2968 data.writeInt(0);
2969 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002970 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002971 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 int result = reply.readInt();
2974 reply.recycle();
2975 data.recycle();
2976 return result;
2977 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002978 public int startActivityIntentSender(IApplicationThread caller,
2979 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002980 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002981 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002982 Parcel data = Parcel.obtain();
2983 Parcel reply = Parcel.obtain();
2984 data.writeInterfaceToken(IActivityManager.descriptor);
2985 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2986 intent.writeToParcel(data, 0);
2987 if (fillInIntent != null) {
2988 data.writeInt(1);
2989 fillInIntent.writeToParcel(data, 0);
2990 } else {
2991 data.writeInt(0);
2992 }
2993 data.writeString(resolvedType);
2994 data.writeStrongBinder(resultTo);
2995 data.writeString(resultWho);
2996 data.writeInt(requestCode);
2997 data.writeInt(flagsMask);
2998 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002999 if (options != null) {
3000 data.writeInt(1);
3001 options.writeToParcel(data, 0);
3002 } else {
3003 data.writeInt(0);
3004 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003005 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003006 reply.readException();
3007 int result = reply.readInt();
3008 reply.recycle();
3009 data.recycle();
3010 return result;
3011 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003012 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3013 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003014 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3015 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003016 Parcel data = Parcel.obtain();
3017 Parcel reply = Parcel.obtain();
3018 data.writeInterfaceToken(IActivityManager.descriptor);
3019 data.writeString(callingPackage);
3020 data.writeInt(callingPid);
3021 data.writeInt(callingUid);
3022 intent.writeToParcel(data, 0);
3023 data.writeString(resolvedType);
3024 data.writeStrongBinder(session.asBinder());
3025 data.writeStrongBinder(interactor.asBinder());
3026 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003027 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003028 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003029 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003030 } else {
3031 data.writeInt(0);
3032 }
3033 if (options != null) {
3034 data.writeInt(1);
3035 options.writeToParcel(data, 0);
3036 } else {
3037 data.writeInt(0);
3038 }
3039 data.writeInt(userId);
3040 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3041 reply.readException();
3042 int result = reply.readInt();
3043 reply.recycle();
3044 data.recycle();
3045 return result;
3046 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003047 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003048 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003049 Parcel data = Parcel.obtain();
3050 Parcel reply = Parcel.obtain();
3051 data.writeInterfaceToken(IActivityManager.descriptor);
3052 data.writeStrongBinder(callingActivity);
3053 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003054 if (options != null) {
3055 data.writeInt(1);
3056 options.writeToParcel(data, 0);
3057 } else {
3058 data.writeInt(0);
3059 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003060 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3061 reply.readException();
3062 int result = reply.readInt();
3063 reply.recycle();
3064 data.recycle();
3065 return result != 0;
3066 }
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003067 public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
3068 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 data.writeInt(taskId);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003073 data.writeInt(launchStackId);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003074 if (options == null) {
3075 data.writeInt(0);
3076 } else {
3077 data.writeInt(1);
3078 options.writeToParcel(data, 0);
3079 }
3080 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3081 reply.readException();
3082 int result = reply.readInt();
3083 reply.recycle();
3084 data.recycle();
3085 return result;
3086 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003087 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003088 throws RemoteException {
3089 Parcel data = Parcel.obtain();
3090 Parcel reply = Parcel.obtain();
3091 data.writeInterfaceToken(IActivityManager.descriptor);
3092 data.writeStrongBinder(token);
3093 data.writeInt(resultCode);
3094 if (resultData != null) {
3095 data.writeInt(1);
3096 resultData.writeToParcel(data, 0);
3097 } else {
3098 data.writeInt(0);
3099 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003100 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003101 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3102 reply.readException();
3103 boolean res = reply.readInt() != 0;
3104 data.recycle();
3105 reply.recycle();
3106 return res;
3107 }
3108 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3109 {
3110 Parcel data = Parcel.obtain();
3111 Parcel reply = Parcel.obtain();
3112 data.writeInterfaceToken(IActivityManager.descriptor);
3113 data.writeStrongBinder(token);
3114 data.writeString(resultWho);
3115 data.writeInt(requestCode);
3116 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3117 reply.readException();
3118 data.recycle();
3119 reply.recycle();
3120 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003121 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3122 Parcel data = Parcel.obtain();
3123 Parcel reply = Parcel.obtain();
3124 data.writeInterfaceToken(IActivityManager.descriptor);
3125 data.writeStrongBinder(token);
3126 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 boolean res = reply.readInt() != 0;
3129 data.recycle();
3130 reply.recycle();
3131 return res;
3132 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003133 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
3137 data.writeStrongBinder(session.asBinder());
3138 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3139 reply.readException();
3140 data.recycle();
3141 reply.recycle();
3142 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003143 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3144 Parcel data = Parcel.obtain();
3145 Parcel reply = Parcel.obtain();
3146 data.writeInterfaceToken(IActivityManager.descriptor);
3147 data.writeStrongBinder(token);
3148 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3149 reply.readException();
3150 boolean res = reply.readInt() != 0;
3151 data.recycle();
3152 reply.recycle();
3153 return res;
3154 }
3155 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3156 Parcel data = Parcel.obtain();
3157 Parcel reply = Parcel.obtain();
3158 data.writeInterfaceToken(IActivityManager.descriptor);
3159 data.writeStrongBinder(app.asBinder());
3160 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3161 reply.readException();
3162 data.recycle();
3163 reply.recycle();
3164 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003165 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3166 Parcel data = Parcel.obtain();
3167 Parcel reply = Parcel.obtain();
3168 data.writeInterfaceToken(IActivityManager.descriptor);
3169 data.writeStrongBinder(token);
3170 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3171 reply.readException();
3172 boolean res = reply.readInt() != 0;
3173 data.recycle();
3174 reply.recycle();
3175 return res;
3176 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003177 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003178 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003179 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003180 {
3181 Parcel data = Parcel.obtain();
3182 Parcel reply = Parcel.obtain();
3183 data.writeInterfaceToken(IActivityManager.descriptor);
3184 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003185 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003186 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3187 filter.writeToParcel(data, 0);
3188 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003189 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003190 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 Intent intent = null;
3193 int haveIntent = reply.readInt();
3194 if (haveIntent != 0) {
3195 intent = Intent.CREATOR.createFromParcel(reply);
3196 }
3197 reply.recycle();
3198 data.recycle();
3199 return intent;
3200 }
3201 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3202 {
3203 Parcel data = Parcel.obtain();
3204 Parcel reply = Parcel.obtain();
3205 data.writeInterfaceToken(IActivityManager.descriptor);
3206 data.writeStrongBinder(receiver.asBinder());
3207 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3208 reply.readException();
3209 data.recycle();
3210 reply.recycle();
3211 }
3212 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003213 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003214 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003215 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003216 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003217 {
3218 Parcel data = Parcel.obtain();
3219 Parcel reply = Parcel.obtain();
3220 data.writeInterfaceToken(IActivityManager.descriptor);
3221 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3222 intent.writeToParcel(data, 0);
3223 data.writeString(resolvedType);
3224 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3225 data.writeInt(resultCode);
3226 data.writeString(resultData);
3227 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003228 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003229 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003230 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003231 data.writeInt(serialized ? 1 : 0);
3232 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003233 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003234 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3235 reply.readException();
3236 int res = reply.readInt();
3237 reply.recycle();
3238 data.recycle();
3239 return res;
3240 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003241 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3242 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 {
3244 Parcel data = Parcel.obtain();
3245 Parcel reply = Parcel.obtain();
3246 data.writeInterfaceToken(IActivityManager.descriptor);
3247 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3248 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003249 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003250 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3251 reply.readException();
3252 data.recycle();
3253 reply.recycle();
3254 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003255 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3256 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003257 {
3258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 data.writeStrongBinder(who);
3262 data.writeInt(resultCode);
3263 data.writeString(resultData);
3264 data.writeBundle(map);
3265 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003266 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003267 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3268 reply.readException();
3269 data.recycle();
3270 reply.recycle();
3271 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003272 public void attachApplication(IApplicationThread app) throws RemoteException
3273 {
3274 Parcel data = Parcel.obtain();
3275 Parcel reply = Parcel.obtain();
3276 data.writeInterfaceToken(IActivityManager.descriptor);
3277 data.writeStrongBinder(app.asBinder());
3278 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3279 reply.readException();
3280 data.recycle();
3281 reply.recycle();
3282 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003283 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3284 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003285 {
3286 Parcel data = Parcel.obtain();
3287 Parcel reply = Parcel.obtain();
3288 data.writeInterfaceToken(IActivityManager.descriptor);
3289 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003290 if (config != null) {
3291 data.writeInt(1);
3292 config.writeToParcel(data, 0);
3293 } else {
3294 data.writeInt(0);
3295 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003296 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003297 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3298 reply.readException();
3299 data.recycle();
3300 reply.recycle();
3301 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003302 public void activityResumed(IBinder token) throws RemoteException
3303 {
3304 Parcel data = Parcel.obtain();
3305 Parcel reply = Parcel.obtain();
3306 data.writeInterfaceToken(IActivityManager.descriptor);
3307 data.writeStrongBinder(token);
3308 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3309 reply.readException();
3310 data.recycle();
3311 reply.recycle();
3312 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003313 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003314 {
3315 Parcel data = Parcel.obtain();
3316 Parcel reply = Parcel.obtain();
3317 data.writeInterfaceToken(IActivityManager.descriptor);
3318 data.writeStrongBinder(token);
3319 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3320 reply.readException();
3321 data.recycle();
3322 reply.recycle();
3323 }
3324 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003325 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003326 {
3327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
3330 data.writeStrongBinder(token);
3331 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003332 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 TextUtils.writeToParcel(description, data, 0);
3334 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3335 reply.readException();
3336 data.recycle();
3337 reply.recycle();
3338 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003339 public void activitySlept(IBinder token) throws RemoteException
3340 {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 data.writeStrongBinder(token);
3345 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3346 reply.readException();
3347 data.recycle();
3348 reply.recycle();
3349 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 public void activityDestroyed(IBinder token) throws RemoteException
3351 {
3352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 data.writeStrongBinder(token);
3356 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3357 reply.readException();
3358 data.recycle();
3359 reply.recycle();
3360 }
3361 public String getCallingPackage(IBinder token) throws RemoteException
3362 {
3363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 data.writeStrongBinder(token);
3367 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3368 reply.readException();
3369 String res = reply.readString();
3370 data.recycle();
3371 reply.recycle();
3372 return res;
3373 }
3374 public ComponentName getCallingActivity(IBinder token)
3375 throws RemoteException {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(token);
3380 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3381 reply.readException();
3382 ComponentName res = ComponentName.readFromParcel(reply);
3383 data.recycle();
3384 reply.recycle();
3385 return res;
3386 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003387 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003391 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003392 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3393 reply.readException();
3394 ArrayList<IAppTask> list = null;
3395 int N = reply.readInt();
3396 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003397 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003398 while (N > 0) {
3399 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3400 list.add(task);
3401 N--;
3402 }
3403 }
3404 data.recycle();
3405 reply.recycle();
3406 return list;
3407 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003408 public int addAppTask(IBinder activityToken, Intent intent,
3409 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 data.writeStrongBinder(activityToken);
3414 intent.writeToParcel(data, 0);
3415 description.writeToParcel(data, 0);
3416 thumbnail.writeToParcel(data, 0);
3417 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3418 reply.readException();
3419 int res = reply.readInt();
3420 data.recycle();
3421 reply.recycle();
3422 return res;
3423 }
3424 public Point getAppTaskThumbnailSize() throws RemoteException {
3425 Parcel data = Parcel.obtain();
3426 Parcel reply = Parcel.obtain();
3427 data.writeInterfaceToken(IActivityManager.descriptor);
3428 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3429 reply.readException();
3430 Point size = Point.CREATOR.createFromParcel(reply);
3431 data.recycle();
3432 reply.recycle();
3433 return size;
3434 }
Todd Kennedye635f662015-01-20 10:36:49 -08003435 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3436 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003437 Parcel data = Parcel.obtain();
3438 Parcel reply = Parcel.obtain();
3439 data.writeInterfaceToken(IActivityManager.descriptor);
3440 data.writeInt(maxNum);
3441 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003442 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3443 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003444 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003445 int N = reply.readInt();
3446 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003447 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003448 while (N > 0) {
3449 ActivityManager.RunningTaskInfo info =
3450 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003451 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003452 list.add(info);
3453 N--;
3454 }
3455 }
3456 data.recycle();
3457 reply.recycle();
3458 return list;
3459 }
3460 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003461 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003462 Parcel data = Parcel.obtain();
3463 Parcel reply = Parcel.obtain();
3464 data.writeInterfaceToken(IActivityManager.descriptor);
3465 data.writeInt(maxNum);
3466 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003467 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003468 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3469 reply.readException();
3470 ArrayList<ActivityManager.RecentTaskInfo> list
3471 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3472 data.recycle();
3473 reply.recycle();
3474 return list;
3475 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003476 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003477 Parcel data = Parcel.obtain();
3478 Parcel reply = Parcel.obtain();
3479 data.writeInterfaceToken(IActivityManager.descriptor);
3480 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003481 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003482 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003483 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003484 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003485 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003486 }
3487 data.recycle();
3488 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003489 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003490 }
Todd Kennedye635f662015-01-20 10:36:49 -08003491 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3492 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 data.writeInt(maxNum);
3497 data.writeInt(flags);
3498 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3499 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003500 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003501 int N = reply.readInt();
3502 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003503 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003504 while (N > 0) {
3505 ActivityManager.RunningServiceInfo info =
3506 ActivityManager.RunningServiceInfo.CREATOR
3507 .createFromParcel(reply);
3508 list.add(info);
3509 N--;
3510 }
3511 }
3512 data.recycle();
3513 reply.recycle();
3514 return list;
3515 }
3516 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3517 throws RemoteException {
3518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3522 reply.readException();
3523 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3524 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3525 data.recycle();
3526 reply.recycle();
3527 return list;
3528 }
3529 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3530 throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3535 reply.readException();
3536 ArrayList<ActivityManager.RunningAppProcessInfo> list
3537 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3538 data.recycle();
3539 reply.recycle();
3540 return list;
3541 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003542 public List<ApplicationInfo> getRunningExternalApplications()
3543 throws RemoteException {
3544 Parcel data = Parcel.obtain();
3545 Parcel reply = Parcel.obtain();
3546 data.writeInterfaceToken(IActivityManager.descriptor);
3547 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3548 reply.readException();
3549 ArrayList<ApplicationInfo> list
3550 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3551 data.recycle();
3552 reply.recycle();
3553 return list;
3554 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003555 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003556 {
3557 Parcel data = Parcel.obtain();
3558 Parcel reply = Parcel.obtain();
3559 data.writeInterfaceToken(IActivityManager.descriptor);
3560 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003561 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003562 if (options != null) {
3563 data.writeInt(1);
3564 options.writeToParcel(data, 0);
3565 } else {
3566 data.writeInt(0);
3567 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003568 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 data.recycle();
3571 reply.recycle();
3572 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003573 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3574 throws RemoteException {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
3578 data.writeStrongBinder(token);
3579 data.writeInt(nonRoot ? 1 : 0);
3580 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3581 reply.readException();
3582 boolean res = reply.readInt() != 0;
3583 data.recycle();
3584 reply.recycle();
3585 return res;
3586 }
3587 public void moveTaskBackwards(int task) throws RemoteException
3588 {
3589 Parcel data = Parcel.obtain();
3590 Parcel reply = Parcel.obtain();
3591 data.writeInterfaceToken(IActivityManager.descriptor);
3592 data.writeInt(task);
3593 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3594 reply.readException();
3595 data.recycle();
3596 reply.recycle();
3597 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003598 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003599 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3600 {
3601 Parcel data = Parcel.obtain();
3602 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003603 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003604 data.writeInt(taskId);
3605 data.writeInt(stackId);
3606 data.writeInt(toTop ? 1 : 0);
3607 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3608 reply.readException();
3609 data.recycle();
3610 reply.recycle();
3611 }
3612 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003613 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3614 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003615 {
3616 Parcel data = Parcel.obtain();
3617 Parcel reply = Parcel.obtain();
3618 data.writeInterfaceToken(IActivityManager.descriptor);
3619 data.writeInt(taskId);
3620 data.writeInt(createMode);
3621 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003622 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003623 if (initialBounds != null) {
3624 data.writeInt(1);
3625 initialBounds.writeToParcel(data, 0);
3626 } else {
3627 data.writeInt(0);
3628 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003629 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3630 reply.readException();
3631 data.recycle();
3632 reply.recycle();
3633 }
3634 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003635 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3636 throws RemoteException
3637 {
3638 Parcel data = Parcel.obtain();
3639 Parcel reply = Parcel.obtain();
3640 data.writeInterfaceToken(IActivityManager.descriptor);
3641 data.writeInt(stackId);
3642 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003643 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003644 reply.readException();
3645 final boolean res = reply.readInt() != 0;
3646 data.recycle();
3647 reply.recycle();
3648 return res;
3649 }
3650 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003651 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3652 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003653 {
3654 Parcel data = Parcel.obtain();
3655 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003656 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003657 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003658 if (r != null) {
3659 data.writeInt(1);
3660 r.writeToParcel(data, 0);
3661 } else {
3662 data.writeInt(0);
3663 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003664 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003665 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003666 reply.readException();
3667 data.recycle();
3668 reply.recycle();
3669 }
Craig Mautner967212c2013-04-13 21:10:58 -07003670 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003671 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3672 {
3673 Parcel data = Parcel.obtain();
3674 Parcel reply = Parcel.obtain();
3675 data.writeInterfaceToken(IActivityManager.descriptor);
3676 data.writeInt(taskId);
3677 data.writeInt(stackId);
3678 data.writeInt(position);
3679 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3680 reply.readException();
3681 data.recycle();
3682 reply.recycle();
3683 }
3684 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003685 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003686 {
3687 Parcel data = Parcel.obtain();
3688 Parcel reply = Parcel.obtain();
3689 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003690 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003691 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003692 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003693 data.recycle();
3694 reply.recycle();
3695 return list;
3696 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003697 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003698 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003699 {
3700 Parcel data = Parcel.obtain();
3701 Parcel reply = Parcel.obtain();
3702 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003703 data.writeInt(stackId);
3704 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003705 reply.readException();
3706 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003707 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003708 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003709 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003710 }
3711 data.recycle();
3712 reply.recycle();
3713 return info;
3714 }
3715 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003716 public boolean isInHomeStack(int taskId) throws RemoteException {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 data.writeInt(taskId);
3721 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3722 reply.readException();
3723 boolean isInHomeStack = reply.readInt() > 0;
3724 data.recycle();
3725 reply.recycle();
3726 return isInHomeStack;
3727 }
3728 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003729 public void setFocusedStack(int stackId) throws RemoteException
3730 {
3731 Parcel data = Parcel.obtain();
3732 Parcel reply = Parcel.obtain();
3733 data.writeInterfaceToken(IActivityManager.descriptor);
3734 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003735 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003736 reply.readException();
3737 data.recycle();
3738 reply.recycle();
3739 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003740 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003741 public int getFocusedStackId() throws RemoteException {
3742 Parcel data = Parcel.obtain();
3743 Parcel reply = Parcel.obtain();
3744 data.writeInterfaceToken(IActivityManager.descriptor);
3745 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3746 reply.readException();
3747 int focusedStackId = reply.readInt();
3748 data.recycle();
3749 reply.recycle();
3750 return focusedStackId;
3751 }
3752 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003753 public void setFocusedTask(int taskId) throws RemoteException
3754 {
3755 Parcel data = Parcel.obtain();
3756 Parcel reply = Parcel.obtain();
3757 data.writeInterfaceToken(IActivityManager.descriptor);
3758 data.writeInt(taskId);
3759 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3760 reply.readException();
3761 data.recycle();
3762 reply.recycle();
3763 }
3764 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003765 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3766 {
3767 Parcel data = Parcel.obtain();
3768 Parcel reply = Parcel.obtain();
3769 data.writeInterfaceToken(IActivityManager.descriptor);
3770 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003771 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003772 reply.readException();
3773 data.recycle();
3774 reply.recycle();
3775 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003776 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3777 {
3778 Parcel data = Parcel.obtain();
3779 Parcel reply = Parcel.obtain();
3780 data.writeInterfaceToken(IActivityManager.descriptor);
3781 data.writeStrongBinder(token);
3782 data.writeInt(onlyRoot ? 1 : 0);
3783 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 int res = reply.readInt();
3786 data.recycle();
3787 reply.recycle();
3788 return res;
3789 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003790 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003791 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003792 Parcel data = Parcel.obtain();
3793 Parcel reply = Parcel.obtain();
3794 data.writeInterfaceToken(IActivityManager.descriptor);
3795 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3796 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003797 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003798 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003799 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 int res = reply.readInt();
3802 ContentProviderHolder cph = null;
3803 if (res != 0) {
3804 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3805 }
3806 data.recycle();
3807 reply.recycle();
3808 return cph;
3809 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003810 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3811 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003812 Parcel data = Parcel.obtain();
3813 Parcel reply = Parcel.obtain();
3814 data.writeInterfaceToken(IActivityManager.descriptor);
3815 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003816 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003817 data.writeStrongBinder(token);
3818 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3819 reply.readException();
3820 int res = reply.readInt();
3821 ContentProviderHolder cph = null;
3822 if (res != 0) {
3823 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3824 }
3825 data.recycle();
3826 reply.recycle();
3827 return cph;
3828 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003829 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003830 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003831 {
3832 Parcel data = Parcel.obtain();
3833 Parcel reply = Parcel.obtain();
3834 data.writeInterfaceToken(IActivityManager.descriptor);
3835 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3836 data.writeTypedList(providers);
3837 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3838 reply.readException();
3839 data.recycle();
3840 reply.recycle();
3841 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003842 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3843 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003847 data.writeStrongBinder(connection);
3848 data.writeInt(stable);
3849 data.writeInt(unstable);
3850 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3851 reply.readException();
3852 boolean res = reply.readInt() != 0;
3853 data.recycle();
3854 reply.recycle();
3855 return res;
3856 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003857
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003858 public void unstableProviderDied(IBinder connection) throws RemoteException {
3859 Parcel data = Parcel.obtain();
3860 Parcel reply = Parcel.obtain();
3861 data.writeInterfaceToken(IActivityManager.descriptor);
3862 data.writeStrongBinder(connection);
3863 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3864 reply.readException();
3865 data.recycle();
3866 reply.recycle();
3867 }
3868
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003869 @Override
3870 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3871 Parcel data = Parcel.obtain();
3872 Parcel reply = Parcel.obtain();
3873 data.writeInterfaceToken(IActivityManager.descriptor);
3874 data.writeStrongBinder(connection);
3875 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3876 reply.readException();
3877 data.recycle();
3878 reply.recycle();
3879 }
3880
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003881 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3882 Parcel data = Parcel.obtain();
3883 Parcel reply = Parcel.obtain();
3884 data.writeInterfaceToken(IActivityManager.descriptor);
3885 data.writeStrongBinder(connection);
3886 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003887 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3888 reply.readException();
3889 data.recycle();
3890 reply.recycle();
3891 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003892
3893 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3894 Parcel data = Parcel.obtain();
3895 Parcel reply = Parcel.obtain();
3896 data.writeInterfaceToken(IActivityManager.descriptor);
3897 data.writeString(name);
3898 data.writeStrongBinder(token);
3899 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3900 reply.readException();
3901 data.recycle();
3902 reply.recycle();
3903 }
3904
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003905 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3906 throws RemoteException
3907 {
3908 Parcel data = Parcel.obtain();
3909 Parcel reply = Parcel.obtain();
3910 data.writeInterfaceToken(IActivityManager.descriptor);
3911 service.writeToParcel(data, 0);
3912 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3913 reply.readException();
3914 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3915 data.recycle();
3916 reply.recycle();
3917 return res;
3918 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003919
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003920 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003921 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003922 {
3923 Parcel data = Parcel.obtain();
3924 Parcel reply = Parcel.obtain();
3925 data.writeInterfaceToken(IActivityManager.descriptor);
3926 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3927 service.writeToParcel(data, 0);
3928 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003929 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003930 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003931 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3932 reply.readException();
3933 ComponentName res = ComponentName.readFromParcel(reply);
3934 data.recycle();
3935 reply.recycle();
3936 return res;
3937 }
3938 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003939 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003940 {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3945 service.writeToParcel(data, 0);
3946 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003947 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003948 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3949 reply.readException();
3950 int res = reply.readInt();
3951 reply.recycle();
3952 data.recycle();
3953 return res;
3954 }
3955 public boolean stopServiceToken(ComponentName className, IBinder token,
3956 int startId) throws RemoteException {
3957 Parcel data = Parcel.obtain();
3958 Parcel reply = Parcel.obtain();
3959 data.writeInterfaceToken(IActivityManager.descriptor);
3960 ComponentName.writeToParcel(className, data);
3961 data.writeStrongBinder(token);
3962 data.writeInt(startId);
3963 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3964 reply.readException();
3965 boolean res = reply.readInt() != 0;
3966 data.recycle();
3967 reply.recycle();
3968 return res;
3969 }
3970 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003971 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003972 Parcel data = Parcel.obtain();
3973 Parcel reply = Parcel.obtain();
3974 data.writeInterfaceToken(IActivityManager.descriptor);
3975 ComponentName.writeToParcel(className, data);
3976 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003977 data.writeInt(id);
3978 if (notification != null) {
3979 data.writeInt(1);
3980 notification.writeToParcel(data, 0);
3981 } else {
3982 data.writeInt(0);
3983 }
3984 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003985 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3986 reply.readException();
3987 data.recycle();
3988 reply.recycle();
3989 }
3990 public int bindService(IApplicationThread caller, IBinder token,
3991 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003992 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003993 Parcel data = Parcel.obtain();
3994 Parcel reply = Parcel.obtain();
3995 data.writeInterfaceToken(IActivityManager.descriptor);
3996 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3997 data.writeStrongBinder(token);
3998 service.writeToParcel(data, 0);
3999 data.writeString(resolvedType);
4000 data.writeStrongBinder(connection.asBinder());
4001 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004002 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004003 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004004 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4005 reply.readException();
4006 int res = reply.readInt();
4007 data.recycle();
4008 reply.recycle();
4009 return res;
4010 }
4011 public boolean unbindService(IServiceConnection connection) throws RemoteException
4012 {
4013 Parcel data = Parcel.obtain();
4014 Parcel reply = Parcel.obtain();
4015 data.writeInterfaceToken(IActivityManager.descriptor);
4016 data.writeStrongBinder(connection.asBinder());
4017 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4018 reply.readException();
4019 boolean res = reply.readInt() != 0;
4020 data.recycle();
4021 reply.recycle();
4022 return res;
4023 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004024
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004025 public void publishService(IBinder token,
4026 Intent intent, IBinder service) throws RemoteException {
4027 Parcel data = Parcel.obtain();
4028 Parcel reply = Parcel.obtain();
4029 data.writeInterfaceToken(IActivityManager.descriptor);
4030 data.writeStrongBinder(token);
4031 intent.writeToParcel(data, 0);
4032 data.writeStrongBinder(service);
4033 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4034 reply.readException();
4035 data.recycle();
4036 reply.recycle();
4037 }
4038
4039 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4040 throws RemoteException {
4041 Parcel data = Parcel.obtain();
4042 Parcel reply = Parcel.obtain();
4043 data.writeInterfaceToken(IActivityManager.descriptor);
4044 data.writeStrongBinder(token);
4045 intent.writeToParcel(data, 0);
4046 data.writeInt(doRebind ? 1 : 0);
4047 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4048 reply.readException();
4049 data.recycle();
4050 reply.recycle();
4051 }
4052
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004053 public void serviceDoneExecuting(IBinder token, int type, int startId,
4054 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004055 Parcel data = Parcel.obtain();
4056 Parcel reply = Parcel.obtain();
4057 data.writeInterfaceToken(IActivityManager.descriptor);
4058 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004059 data.writeInt(type);
4060 data.writeInt(startId);
4061 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004062 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4063 reply.readException();
4064 data.recycle();
4065 reply.recycle();
4066 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004067
Svet Ganov99b60432015-06-27 13:15:22 -07004068 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4069 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004070 Parcel data = Parcel.obtain();
4071 Parcel reply = Parcel.obtain();
4072 data.writeInterfaceToken(IActivityManager.descriptor);
4073 service.writeToParcel(data, 0);
4074 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004075 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004076 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4077 reply.readException();
4078 IBinder binder = reply.readStrongBinder();
4079 reply.recycle();
4080 data.recycle();
4081 return binder;
4082 }
4083
Christopher Tate181fafa2009-05-14 11:12:14 -07004084 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4085 throws RemoteException {
4086 Parcel data = Parcel.obtain();
4087 Parcel reply = Parcel.obtain();
4088 data.writeInterfaceToken(IActivityManager.descriptor);
4089 app.writeToParcel(data, 0);
4090 data.writeInt(backupRestoreMode);
4091 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4092 reply.readException();
4093 boolean success = reply.readInt() != 0;
4094 reply.recycle();
4095 data.recycle();
4096 return success;
4097 }
4098
Christopher Tate346acb12012-10-15 19:20:25 -07004099 public void clearPendingBackup() throws RemoteException {
4100 Parcel data = Parcel.obtain();
4101 Parcel reply = Parcel.obtain();
4102 data.writeInterfaceToken(IActivityManager.descriptor);
4103 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4104 reply.recycle();
4105 data.recycle();
4106 }
4107
Christopher Tate181fafa2009-05-14 11:12:14 -07004108 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4109 Parcel data = Parcel.obtain();
4110 Parcel reply = Parcel.obtain();
4111 data.writeInterfaceToken(IActivityManager.descriptor);
4112 data.writeString(packageName);
4113 data.writeStrongBinder(agent);
4114 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4115 reply.recycle();
4116 data.recycle();
4117 }
4118
4119 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4120 Parcel data = Parcel.obtain();
4121 Parcel reply = Parcel.obtain();
4122 data.writeInterfaceToken(IActivityManager.descriptor);
4123 app.writeToParcel(data, 0);
4124 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4125 reply.readException();
4126 reply.recycle();
4127 data.recycle();
4128 }
4129
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004130 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004131 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004132 IUiAutomationConnection connection, int userId, String instructionSet)
4133 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004134 Parcel data = Parcel.obtain();
4135 Parcel reply = Parcel.obtain();
4136 data.writeInterfaceToken(IActivityManager.descriptor);
4137 ComponentName.writeToParcel(className, data);
4138 data.writeString(profileFile);
4139 data.writeInt(flags);
4140 data.writeBundle(arguments);
4141 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004142 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004143 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004144 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004145 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4146 reply.readException();
4147 boolean res = reply.readInt() != 0;
4148 reply.recycle();
4149 data.recycle();
4150 return res;
4151 }
4152
4153 public void finishInstrumentation(IApplicationThread target,
4154 int resultCode, Bundle results) throws RemoteException {
4155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 data.writeStrongBinder(target != null ? target.asBinder() : null);
4159 data.writeInt(resultCode);
4160 data.writeBundle(results);
4161 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4162 reply.readException();
4163 data.recycle();
4164 reply.recycle();
4165 }
4166 public Configuration getConfiguration() throws RemoteException
4167 {
4168 Parcel data = Parcel.obtain();
4169 Parcel reply = Parcel.obtain();
4170 data.writeInterfaceToken(IActivityManager.descriptor);
4171 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4172 reply.readException();
4173 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4174 reply.recycle();
4175 data.recycle();
4176 return res;
4177 }
4178 public void updateConfiguration(Configuration values) throws RemoteException
4179 {
4180 Parcel data = Parcel.obtain();
4181 Parcel reply = Parcel.obtain();
4182 data.writeInterfaceToken(IActivityManager.descriptor);
4183 values.writeToParcel(data, 0);
4184 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4185 reply.readException();
4186 data.recycle();
4187 reply.recycle();
4188 }
4189 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4190 throws RemoteException {
4191 Parcel data = Parcel.obtain();
4192 Parcel reply = Parcel.obtain();
4193 data.writeInterfaceToken(IActivityManager.descriptor);
4194 data.writeStrongBinder(token);
4195 data.writeInt(requestedOrientation);
4196 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4197 reply.readException();
4198 data.recycle();
4199 reply.recycle();
4200 }
4201 public int getRequestedOrientation(IBinder token) throws RemoteException {
4202 Parcel data = Parcel.obtain();
4203 Parcel reply = Parcel.obtain();
4204 data.writeInterfaceToken(IActivityManager.descriptor);
4205 data.writeStrongBinder(token);
4206 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4207 reply.readException();
4208 int res = reply.readInt();
4209 data.recycle();
4210 reply.recycle();
4211 return res;
4212 }
4213 public ComponentName getActivityClassForToken(IBinder token)
4214 throws RemoteException {
4215 Parcel data = Parcel.obtain();
4216 Parcel reply = Parcel.obtain();
4217 data.writeInterfaceToken(IActivityManager.descriptor);
4218 data.writeStrongBinder(token);
4219 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4220 reply.readException();
4221 ComponentName res = ComponentName.readFromParcel(reply);
4222 data.recycle();
4223 reply.recycle();
4224 return res;
4225 }
4226 public String getPackageForToken(IBinder token) throws RemoteException
4227 {
4228 Parcel data = Parcel.obtain();
4229 Parcel reply = Parcel.obtain();
4230 data.writeInterfaceToken(IActivityManager.descriptor);
4231 data.writeStrongBinder(token);
4232 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4233 reply.readException();
4234 String res = reply.readString();
4235 data.recycle();
4236 reply.recycle();
4237 return res;
4238 }
4239 public IIntentSender getIntentSender(int type,
4240 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004241 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004242 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004243 Parcel data = Parcel.obtain();
4244 Parcel reply = Parcel.obtain();
4245 data.writeInterfaceToken(IActivityManager.descriptor);
4246 data.writeInt(type);
4247 data.writeString(packageName);
4248 data.writeStrongBinder(token);
4249 data.writeString(resultWho);
4250 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004251 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004252 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004253 data.writeTypedArray(intents, 0);
4254 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004255 } else {
4256 data.writeInt(0);
4257 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004258 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004259 if (options != null) {
4260 data.writeInt(1);
4261 options.writeToParcel(data, 0);
4262 } else {
4263 data.writeInt(0);
4264 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004265 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004266 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4267 reply.readException();
4268 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004269 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004270 data.recycle();
4271 reply.recycle();
4272 return res;
4273 }
4274 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4275 Parcel data = Parcel.obtain();
4276 Parcel reply = Parcel.obtain();
4277 data.writeInterfaceToken(IActivityManager.descriptor);
4278 data.writeStrongBinder(sender.asBinder());
4279 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4280 reply.readException();
4281 data.recycle();
4282 reply.recycle();
4283 }
4284 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 data.writeStrongBinder(sender.asBinder());
4289 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4290 reply.readException();
4291 String res = reply.readString();
4292 data.recycle();
4293 reply.recycle();
4294 return res;
4295 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004296 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4297 Parcel data = Parcel.obtain();
4298 Parcel reply = Parcel.obtain();
4299 data.writeInterfaceToken(IActivityManager.descriptor);
4300 data.writeStrongBinder(sender.asBinder());
4301 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4302 reply.readException();
4303 int res = reply.readInt();
4304 data.recycle();
4305 reply.recycle();
4306 return res;
4307 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004308 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4309 boolean requireFull, String name, String callerPackage) throws RemoteException {
4310 Parcel data = Parcel.obtain();
4311 Parcel reply = Parcel.obtain();
4312 data.writeInterfaceToken(IActivityManager.descriptor);
4313 data.writeInt(callingPid);
4314 data.writeInt(callingUid);
4315 data.writeInt(userId);
4316 data.writeInt(allowAll ? 1 : 0);
4317 data.writeInt(requireFull ? 1 : 0);
4318 data.writeString(name);
4319 data.writeString(callerPackage);
4320 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4321 reply.readException();
4322 int res = reply.readInt();
4323 data.recycle();
4324 reply.recycle();
4325 return res;
4326 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004327 public void setProcessLimit(int max) throws RemoteException
4328 {
4329 Parcel data = Parcel.obtain();
4330 Parcel reply = Parcel.obtain();
4331 data.writeInterfaceToken(IActivityManager.descriptor);
4332 data.writeInt(max);
4333 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4334 reply.readException();
4335 data.recycle();
4336 reply.recycle();
4337 }
4338 public int getProcessLimit() throws RemoteException
4339 {
4340 Parcel data = Parcel.obtain();
4341 Parcel reply = Parcel.obtain();
4342 data.writeInterfaceToken(IActivityManager.descriptor);
4343 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4344 reply.readException();
4345 int res = reply.readInt();
4346 data.recycle();
4347 reply.recycle();
4348 return res;
4349 }
4350 public void setProcessForeground(IBinder token, int pid,
4351 boolean isForeground) throws RemoteException {
4352 Parcel data = Parcel.obtain();
4353 Parcel reply = Parcel.obtain();
4354 data.writeInterfaceToken(IActivityManager.descriptor);
4355 data.writeStrongBinder(token);
4356 data.writeInt(pid);
4357 data.writeInt(isForeground ? 1 : 0);
4358 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4359 reply.readException();
4360 data.recycle();
4361 reply.recycle();
4362 }
4363 public int checkPermission(String permission, int pid, int uid)
4364 throws RemoteException {
4365 Parcel data = Parcel.obtain();
4366 Parcel reply = Parcel.obtain();
4367 data.writeInterfaceToken(IActivityManager.descriptor);
4368 data.writeString(permission);
4369 data.writeInt(pid);
4370 data.writeInt(uid);
4371 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4372 reply.readException();
4373 int res = reply.readInt();
4374 data.recycle();
4375 reply.recycle();
4376 return res;
4377 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004378 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4379 throws RemoteException {
4380 Parcel data = Parcel.obtain();
4381 Parcel reply = Parcel.obtain();
4382 data.writeInterfaceToken(IActivityManager.descriptor);
4383 data.writeString(permission);
4384 data.writeInt(pid);
4385 data.writeInt(uid);
4386 data.writeStrongBinder(callerToken);
4387 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4388 reply.readException();
4389 int res = reply.readInt();
4390 data.recycle();
4391 reply.recycle();
4392 return res;
4393 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004394 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004395 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004396 Parcel data = Parcel.obtain();
4397 Parcel reply = Parcel.obtain();
4398 data.writeInterfaceToken(IActivityManager.descriptor);
4399 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004400 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004401 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004402 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4403 reply.readException();
4404 boolean res = reply.readInt() != 0;
4405 data.recycle();
4406 reply.recycle();
4407 return res;
4408 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004409 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4410 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004411 Parcel data = Parcel.obtain();
4412 Parcel reply = Parcel.obtain();
4413 data.writeInterfaceToken(IActivityManager.descriptor);
4414 uri.writeToParcel(data, 0);
4415 data.writeInt(pid);
4416 data.writeInt(uid);
4417 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004418 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004419 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004420 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4421 reply.readException();
4422 int res = reply.readInt();
4423 data.recycle();
4424 reply.recycle();
4425 return res;
4426 }
4427 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004428 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004429 Parcel data = Parcel.obtain();
4430 Parcel reply = Parcel.obtain();
4431 data.writeInterfaceToken(IActivityManager.descriptor);
4432 data.writeStrongBinder(caller.asBinder());
4433 data.writeString(targetPkg);
4434 uri.writeToParcel(data, 0);
4435 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004436 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004437 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4438 reply.readException();
4439 data.recycle();
4440 reply.recycle();
4441 }
4442 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004443 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004444 Parcel data = Parcel.obtain();
4445 Parcel reply = Parcel.obtain();
4446 data.writeInterfaceToken(IActivityManager.descriptor);
4447 data.writeStrongBinder(caller.asBinder());
4448 uri.writeToParcel(data, 0);
4449 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004450 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004451 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4452 reply.readException();
4453 data.recycle();
4454 reply.recycle();
4455 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004456
4457 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004458 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4459 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004460 Parcel data = Parcel.obtain();
4461 Parcel reply = Parcel.obtain();
4462 data.writeInterfaceToken(IActivityManager.descriptor);
4463 uri.writeToParcel(data, 0);
4464 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004465 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004466 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4467 reply.readException();
4468 data.recycle();
4469 reply.recycle();
4470 }
4471
4472 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004473 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4474 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004475 Parcel data = Parcel.obtain();
4476 Parcel reply = Parcel.obtain();
4477 data.writeInterfaceToken(IActivityManager.descriptor);
4478 uri.writeToParcel(data, 0);
4479 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004480 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004481 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4482 reply.readException();
4483 data.recycle();
4484 reply.recycle();
4485 }
4486
4487 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004488 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4489 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004493 data.writeString(packageName);
4494 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004495 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4496 reply.readException();
4497 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4498 reply);
4499 data.recycle();
4500 reply.recycle();
4501 return perms;
4502 }
4503
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004504 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4505 throws RemoteException {
4506 Parcel data = Parcel.obtain();
4507 Parcel reply = Parcel.obtain();
4508 data.writeInterfaceToken(IActivityManager.descriptor);
4509 data.writeStrongBinder(who.asBinder());
4510 data.writeInt(waiting ? 1 : 0);
4511 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4512 reply.readException();
4513 data.recycle();
4514 reply.recycle();
4515 }
4516 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4517 Parcel data = Parcel.obtain();
4518 Parcel reply = Parcel.obtain();
4519 data.writeInterfaceToken(IActivityManager.descriptor);
4520 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4521 reply.readException();
4522 outInfo.readFromParcel(reply);
4523 data.recycle();
4524 reply.recycle();
4525 }
4526 public void unhandledBack() throws RemoteException
4527 {
4528 Parcel data = Parcel.obtain();
4529 Parcel reply = Parcel.obtain();
4530 data.writeInterfaceToken(IActivityManager.descriptor);
4531 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4532 reply.readException();
4533 data.recycle();
4534 reply.recycle();
4535 }
4536 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4537 {
4538 Parcel data = Parcel.obtain();
4539 Parcel reply = Parcel.obtain();
4540 data.writeInterfaceToken(IActivityManager.descriptor);
4541 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4542 reply.readException();
4543 ParcelFileDescriptor pfd = null;
4544 if (reply.readInt() != 0) {
4545 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4546 }
4547 data.recycle();
4548 reply.recycle();
4549 return pfd;
4550 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004551 public void setLockScreenShown(boolean shown) throws RemoteException
4552 {
4553 Parcel data = Parcel.obtain();
4554 Parcel reply = Parcel.obtain();
4555 data.writeInterfaceToken(IActivityManager.descriptor);
4556 data.writeInt(shown ? 1 : 0);
4557 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4558 reply.readException();
4559 data.recycle();
4560 reply.recycle();
4561 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004562 public void setDebugApp(
4563 String packageName, boolean waitForDebugger, boolean persistent)
4564 throws RemoteException
4565 {
4566 Parcel data = Parcel.obtain();
4567 Parcel reply = Parcel.obtain();
4568 data.writeInterfaceToken(IActivityManager.descriptor);
4569 data.writeString(packageName);
4570 data.writeInt(waitForDebugger ? 1 : 0);
4571 data.writeInt(persistent ? 1 : 0);
4572 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4573 reply.readException();
4574 data.recycle();
4575 reply.recycle();
4576 }
4577 public void setAlwaysFinish(boolean enabled) throws RemoteException
4578 {
4579 Parcel data = Parcel.obtain();
4580 Parcel reply = Parcel.obtain();
4581 data.writeInterfaceToken(IActivityManager.descriptor);
4582 data.writeInt(enabled ? 1 : 0);
4583 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4584 reply.readException();
4585 data.recycle();
4586 reply.recycle();
4587 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004588 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004589 {
4590 Parcel data = Parcel.obtain();
4591 Parcel reply = Parcel.obtain();
4592 data.writeInterfaceToken(IActivityManager.descriptor);
4593 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004594 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004595 reply.readException();
4596 data.recycle();
4597 reply.recycle();
4598 }
4599 public void enterSafeMode() throws RemoteException {
4600 Parcel data = Parcel.obtain();
4601 data.writeInterfaceToken(IActivityManager.descriptor);
4602 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4603 data.recycle();
4604 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004605 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004606 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004607 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004608 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004609 data.writeStrongBinder(sender.asBinder());
4610 data.writeInt(sourceUid);
4611 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004612 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004613 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4614 data.recycle();
4615 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004616 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4617 throws RemoteException {
4618 Parcel data = Parcel.obtain();
4619 data.writeInterfaceToken(IActivityManager.descriptor);
4620 data.writeStrongBinder(sender.asBinder());
4621 data.writeInt(sourceUid);
4622 data.writeString(tag);
4623 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4624 data.recycle();
4625 }
4626 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4627 throws RemoteException {
4628 Parcel data = Parcel.obtain();
4629 data.writeInterfaceToken(IActivityManager.descriptor);
4630 data.writeStrongBinder(sender.asBinder());
4631 data.writeInt(sourceUid);
4632 data.writeString(tag);
4633 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4634 data.recycle();
4635 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004636 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004637 Parcel data = Parcel.obtain();
4638 Parcel reply = Parcel.obtain();
4639 data.writeInterfaceToken(IActivityManager.descriptor);
4640 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004641 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004642 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004643 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004644 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004645 boolean res = reply.readInt() != 0;
4646 data.recycle();
4647 reply.recycle();
4648 return res;
4649 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004650 @Override
4651 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4652 Parcel data = Parcel.obtain();
4653 Parcel reply = Parcel.obtain();
4654 data.writeInterfaceToken(IActivityManager.descriptor);
4655 data.writeString(reason);
4656 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4657 boolean res = reply.readInt() != 0;
4658 data.recycle();
4659 reply.recycle();
4660 return res;
4661 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004662 public boolean testIsSystemReady()
4663 {
4664 /* this base class version is never called */
4665 return true;
4666 }
Dan Egnor60d87622009-12-16 16:32:58 -08004667 public void handleApplicationCrash(IBinder app,
4668 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4669 {
4670 Parcel data = Parcel.obtain();
4671 Parcel reply = Parcel.obtain();
4672 data.writeInterfaceToken(IActivityManager.descriptor);
4673 data.writeStrongBinder(app);
4674 crashInfo.writeToParcel(data, 0);
4675 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4676 reply.readException();
4677 reply.recycle();
4678 data.recycle();
4679 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004680
Dianne Hackborn52322712014-08-26 22:47:26 -07004681 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004682 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004683 {
4684 Parcel data = Parcel.obtain();
4685 Parcel reply = Parcel.obtain();
4686 data.writeInterfaceToken(IActivityManager.descriptor);
4687 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004688 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004689 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004690 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004691 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004692 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004693 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004694 reply.recycle();
4695 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004696 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004697 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004698
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004699 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004700 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004701 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004702 {
4703 Parcel data = Parcel.obtain();
4704 Parcel reply = Parcel.obtain();
4705 data.writeInterfaceToken(IActivityManager.descriptor);
4706 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004707 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004708 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004709 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4710 reply.readException();
4711 reply.recycle();
4712 data.recycle();
4713 }
4714
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004715 public void signalPersistentProcesses(int sig) throws RemoteException {
4716 Parcel data = Parcel.obtain();
4717 Parcel reply = Parcel.obtain();
4718 data.writeInterfaceToken(IActivityManager.descriptor);
4719 data.writeInt(sig);
4720 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4721 reply.readException();
4722 data.recycle();
4723 reply.recycle();
4724 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004725
Dianne Hackborn1676c852012-09-10 14:52:30 -07004726 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004727 Parcel data = Parcel.obtain();
4728 Parcel reply = Parcel.obtain();
4729 data.writeInterfaceToken(IActivityManager.descriptor);
4730 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004731 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004732 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4733 reply.readException();
4734 data.recycle();
4735 reply.recycle();
4736 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004737
4738 public void killAllBackgroundProcesses() throws RemoteException {
4739 Parcel data = Parcel.obtain();
4740 Parcel reply = Parcel.obtain();
4741 data.writeInterfaceToken(IActivityManager.descriptor);
4742 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4743 reply.readException();
4744 data.recycle();
4745 reply.recycle();
4746 }
4747
Gustav Sennton6258dcd2015-10-30 19:25:37 +00004748 public void killPackageDependents(String packageName, int userId) throws RemoteException {
4749 Parcel data = Parcel.obtain();
4750 Parcel reply = Parcel.obtain();
4751 data.writeInterfaceToken(IActivityManager.descriptor);
4752 data.writeString(packageName);
4753 data.writeInt(userId);
4754 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
4755 reply.readException();
4756 data.recycle();
4757 reply.recycle();
4758 }
4759
Dianne Hackborn1676c852012-09-10 14:52:30 -07004760 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004761 Parcel data = Parcel.obtain();
4762 Parcel reply = Parcel.obtain();
4763 data.writeInterfaceToken(IActivityManager.descriptor);
4764 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004765 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004766 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004767 reply.readException();
4768 data.recycle();
4769 reply.recycle();
4770 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004771
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004772 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4773 throws RemoteException
4774 {
4775 Parcel data = Parcel.obtain();
4776 Parcel reply = Parcel.obtain();
4777 data.writeInterfaceToken(IActivityManager.descriptor);
4778 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4779 reply.readException();
4780 outInfo.readFromParcel(reply);
4781 reply.recycle();
4782 data.recycle();
4783 }
4784
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004785 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4786 {
4787 Parcel data = Parcel.obtain();
4788 Parcel reply = Parcel.obtain();
4789 data.writeInterfaceToken(IActivityManager.descriptor);
4790 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4791 reply.readException();
4792 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4793 reply.recycle();
4794 data.recycle();
4795 return res;
4796 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004797
Dianne Hackborn1676c852012-09-10 14:52:30 -07004798 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004799 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004800 {
4801 Parcel data = Parcel.obtain();
4802 Parcel reply = Parcel.obtain();
4803 data.writeInterfaceToken(IActivityManager.descriptor);
4804 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004805 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004806 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004807 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004808 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004809 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004810 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004811 } else {
4812 data.writeInt(0);
4813 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004814 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4815 reply.readException();
4816 boolean res = reply.readInt() != 0;
4817 reply.recycle();
4818 data.recycle();
4819 return res;
4820 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004821
Dianne Hackborn55280a92009-05-07 15:53:46 -07004822 public boolean shutdown(int timeout) throws RemoteException
4823 {
4824 Parcel data = Parcel.obtain();
4825 Parcel reply = Parcel.obtain();
4826 data.writeInterfaceToken(IActivityManager.descriptor);
4827 data.writeInt(timeout);
4828 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4829 reply.readException();
4830 boolean res = reply.readInt() != 0;
4831 reply.recycle();
4832 data.recycle();
4833 return res;
4834 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004835
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004836 public void stopAppSwitches() throws RemoteException {
4837 Parcel data = Parcel.obtain();
4838 Parcel reply = Parcel.obtain();
4839 data.writeInterfaceToken(IActivityManager.descriptor);
4840 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4841 reply.readException();
4842 reply.recycle();
4843 data.recycle();
4844 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004845
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004846 public void resumeAppSwitches() throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4851 reply.readException();
4852 reply.recycle();
4853 data.recycle();
4854 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004855
4856 public void addPackageDependency(String packageName) throws RemoteException {
4857 Parcel data = Parcel.obtain();
4858 Parcel reply = Parcel.obtain();
4859 data.writeInterfaceToken(IActivityManager.descriptor);
4860 data.writeString(packageName);
4861 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4862 reply.readException();
4863 data.recycle();
4864 reply.recycle();
4865 }
4866
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004867 public void killApplicationWithAppId(String pkg, int appid, String reason)
4868 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004869 Parcel data = Parcel.obtain();
4870 Parcel reply = Parcel.obtain();
4871 data.writeInterfaceToken(IActivityManager.descriptor);
4872 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004873 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004874 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004875 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004876 reply.readException();
4877 data.recycle();
4878 reply.recycle();
4879 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004880
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004881 public void closeSystemDialogs(String reason) throws RemoteException {
4882 Parcel data = Parcel.obtain();
4883 Parcel reply = Parcel.obtain();
4884 data.writeInterfaceToken(IActivityManager.descriptor);
4885 data.writeString(reason);
4886 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4887 reply.readException();
4888 data.recycle();
4889 reply.recycle();
4890 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004891
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004892 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004893 throws RemoteException {
4894 Parcel data = Parcel.obtain();
4895 Parcel reply = Parcel.obtain();
4896 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004897 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004898 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4899 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004900 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004901 data.recycle();
4902 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004903 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004904 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004905
4906 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4907 Parcel data = Parcel.obtain();
4908 Parcel reply = Parcel.obtain();
4909 data.writeInterfaceToken(IActivityManager.descriptor);
4910 data.writeString(processName);
4911 data.writeInt(uid);
4912 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4913 reply.readException();
4914 data.recycle();
4915 reply.recycle();
4916 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004917
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004918 public void overridePendingTransition(IBinder token, String packageName,
4919 int enterAnim, int exitAnim) throws RemoteException {
4920 Parcel data = Parcel.obtain();
4921 Parcel reply = Parcel.obtain();
4922 data.writeInterfaceToken(IActivityManager.descriptor);
4923 data.writeStrongBinder(token);
4924 data.writeString(packageName);
4925 data.writeInt(enterAnim);
4926 data.writeInt(exitAnim);
4927 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4928 reply.readException();
4929 data.recycle();
4930 reply.recycle();
4931 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004932
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004933 public boolean isUserAMonkey() throws RemoteException {
4934 Parcel data = Parcel.obtain();
4935 Parcel reply = Parcel.obtain();
4936 data.writeInterfaceToken(IActivityManager.descriptor);
4937 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4938 reply.readException();
4939 boolean res = reply.readInt() != 0;
4940 data.recycle();
4941 reply.recycle();
4942 return res;
4943 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004944
4945 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4946 Parcel data = Parcel.obtain();
4947 Parcel reply = Parcel.obtain();
4948 data.writeInterfaceToken(IActivityManager.descriptor);
4949 data.writeInt(monkey ? 1 : 0);
4950 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4951 reply.readException();
4952 data.recycle();
4953 reply.recycle();
4954 }
4955
Dianne Hackborn860755f2010-06-03 18:47:52 -07004956 public void finishHeavyWeightApp() throws RemoteException {
4957 Parcel data = Parcel.obtain();
4958 Parcel reply = Parcel.obtain();
4959 data.writeInterfaceToken(IActivityManager.descriptor);
4960 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4961 reply.readException();
4962 data.recycle();
4963 reply.recycle();
4964 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004965
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004966 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004967 throws RemoteException {
4968 Parcel data = Parcel.obtain();
4969 Parcel reply = Parcel.obtain();
4970 data.writeInterfaceToken(IActivityManager.descriptor);
4971 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004972 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4973 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004974 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004975 data.recycle();
4976 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004977 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004978 }
4979
Craig Mautner233ceee2014-05-09 17:05:11 -07004980 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004981 throws RemoteException {
4982 Parcel data = Parcel.obtain();
4983 Parcel reply = Parcel.obtain();
4984 data.writeInterfaceToken(IActivityManager.descriptor);
4985 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004986 if (options == null) {
4987 data.writeInt(0);
4988 } else {
4989 data.writeInt(1);
4990 data.writeBundle(options.toBundle());
4991 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004992 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004993 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004994 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004995 data.recycle();
4996 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004997 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004998 }
4999
Craig Mautner233ceee2014-05-09 17:05:11 -07005000 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5001 Parcel data = Parcel.obtain();
5002 Parcel reply = Parcel.obtain();
5003 data.writeInterfaceToken(IActivityManager.descriptor);
5004 data.writeStrongBinder(token);
5005 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5006 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005007 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005008 data.recycle();
5009 reply.recycle();
5010 return options;
5011 }
5012
Daniel Sandler69a48172010-06-23 16:29:36 -04005013 public void setImmersive(IBinder token, boolean immersive)
5014 throws RemoteException {
5015 Parcel data = Parcel.obtain();
5016 Parcel reply = Parcel.obtain();
5017 data.writeInterfaceToken(IActivityManager.descriptor);
5018 data.writeStrongBinder(token);
5019 data.writeInt(immersive ? 1 : 0);
5020 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5021 reply.readException();
5022 data.recycle();
5023 reply.recycle();
5024 }
5025
5026 public boolean isImmersive(IBinder token)
5027 throws RemoteException {
5028 Parcel data = Parcel.obtain();
5029 Parcel reply = Parcel.obtain();
5030 data.writeInterfaceToken(IActivityManager.descriptor);
5031 data.writeStrongBinder(token);
5032 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005033 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005034 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005035 data.recycle();
5036 reply.recycle();
5037 return res;
5038 }
5039
Craig Mautnerd61dc202014-07-07 11:09:11 -07005040 public boolean isTopOfTask(IBinder token) throws RemoteException {
5041 Parcel data = Parcel.obtain();
5042 Parcel reply = Parcel.obtain();
5043 data.writeInterfaceToken(IActivityManager.descriptor);
5044 data.writeStrongBinder(token);
5045 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5046 reply.readException();
5047 boolean res = reply.readInt() == 1;
5048 data.recycle();
5049 reply.recycle();
5050 return res;
5051 }
5052
Daniel Sandler69a48172010-06-23 16:29:36 -04005053 public boolean isTopActivityImmersive()
5054 throws RemoteException {
5055 Parcel data = Parcel.obtain();
5056 Parcel reply = Parcel.obtain();
5057 data.writeInterfaceToken(IActivityManager.descriptor);
5058 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005059 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005060 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005061 data.recycle();
5062 reply.recycle();
5063 return res;
5064 }
5065
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005066 public void crashApplication(int uid, int initialPid, String packageName,
5067 String message) throws RemoteException {
5068 Parcel data = Parcel.obtain();
5069 Parcel reply = Parcel.obtain();
5070 data.writeInterfaceToken(IActivityManager.descriptor);
5071 data.writeInt(uid);
5072 data.writeInt(initialPid);
5073 data.writeString(packageName);
5074 data.writeString(message);
5075 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5076 reply.readException();
5077 data.recycle();
5078 reply.recycle();
5079 }
Andy McFadden824c5102010-07-09 16:26:57 -07005080
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005081 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005082 Parcel data = Parcel.obtain();
5083 Parcel reply = Parcel.obtain();
5084 data.writeInterfaceToken(IActivityManager.descriptor);
5085 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005086 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005087 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5088 reply.readException();
5089 String res = reply.readString();
5090 data.recycle();
5091 reply.recycle();
5092 return res;
5093 }
5094
Dianne Hackborn7e269642010-08-25 19:50:20 -07005095 public IBinder newUriPermissionOwner(String name)
5096 throws RemoteException {
5097 Parcel data = Parcel.obtain();
5098 Parcel reply = Parcel.obtain();
5099 data.writeInterfaceToken(IActivityManager.descriptor);
5100 data.writeString(name);
5101 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5102 reply.readException();
5103 IBinder res = reply.readStrongBinder();
5104 data.recycle();
5105 reply.recycle();
5106 return res;
5107 }
5108
5109 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005110 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005111 Parcel data = Parcel.obtain();
5112 Parcel reply = Parcel.obtain();
5113 data.writeInterfaceToken(IActivityManager.descriptor);
5114 data.writeStrongBinder(owner);
5115 data.writeInt(fromUid);
5116 data.writeString(targetPkg);
5117 uri.writeToParcel(data, 0);
5118 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005119 data.writeInt(sourceUserId);
5120 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005121 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5122 reply.readException();
5123 data.recycle();
5124 reply.recycle();
5125 }
5126
5127 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005128 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005129 Parcel data = Parcel.obtain();
5130 Parcel reply = Parcel.obtain();
5131 data.writeInterfaceToken(IActivityManager.descriptor);
5132 data.writeStrongBinder(owner);
5133 if (uri != null) {
5134 data.writeInt(1);
5135 uri.writeToParcel(data, 0);
5136 } else {
5137 data.writeInt(0);
5138 }
5139 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005140 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005141 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5142 reply.readException();
5143 data.recycle();
5144 reply.recycle();
5145 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005146
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005147 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005148 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005149 Parcel data = Parcel.obtain();
5150 Parcel reply = Parcel.obtain();
5151 data.writeInterfaceToken(IActivityManager.descriptor);
5152 data.writeInt(callingUid);
5153 data.writeString(targetPkg);
5154 uri.writeToParcel(data, 0);
5155 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005156 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005157 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5158 reply.readException();
5159 int res = reply.readInt();
5160 data.recycle();
5161 reply.recycle();
5162 return res;
5163 }
5164
Dianne Hackborn1676c852012-09-10 14:52:30 -07005165 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005166 String path, ParcelFileDescriptor fd) throws RemoteException {
5167 Parcel data = Parcel.obtain();
5168 Parcel reply = Parcel.obtain();
5169 data.writeInterfaceToken(IActivityManager.descriptor);
5170 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005171 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005172 data.writeInt(managed ? 1 : 0);
5173 data.writeString(path);
5174 if (fd != null) {
5175 data.writeInt(1);
5176 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5177 } else {
5178 data.writeInt(0);
5179 }
5180 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5181 reply.readException();
5182 boolean res = reply.readInt() != 0;
5183 reply.recycle();
5184 data.recycle();
5185 return res;
5186 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005187
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005188 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005189 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005190 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005191 Parcel data = Parcel.obtain();
5192 Parcel reply = Parcel.obtain();
5193 data.writeInterfaceToken(IActivityManager.descriptor);
5194 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005195 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005196 data.writeTypedArray(intents, 0);
5197 data.writeStringArray(resolvedTypes);
5198 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005199 if (options != null) {
5200 data.writeInt(1);
5201 options.writeToParcel(data, 0);
5202 } else {
5203 data.writeInt(0);
5204 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005205 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005206 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5207 reply.readException();
5208 int result = reply.readInt();
5209 reply.recycle();
5210 data.recycle();
5211 return result;
5212 }
5213
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005214 public int getFrontActivityScreenCompatMode() throws RemoteException {
5215 Parcel data = Parcel.obtain();
5216 Parcel reply = Parcel.obtain();
5217 data.writeInterfaceToken(IActivityManager.descriptor);
5218 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5219 reply.readException();
5220 int mode = reply.readInt();
5221 reply.recycle();
5222 data.recycle();
5223 return mode;
5224 }
5225
5226 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5227 Parcel data = Parcel.obtain();
5228 Parcel reply = Parcel.obtain();
5229 data.writeInterfaceToken(IActivityManager.descriptor);
5230 data.writeInt(mode);
5231 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5232 reply.readException();
5233 reply.recycle();
5234 data.recycle();
5235 }
5236
5237 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5238 Parcel data = Parcel.obtain();
5239 Parcel reply = Parcel.obtain();
5240 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005241 data.writeString(packageName);
5242 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005243 reply.readException();
5244 int mode = reply.readInt();
5245 reply.recycle();
5246 data.recycle();
5247 return mode;
5248 }
5249
5250 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005251 throws RemoteException {
5252 Parcel data = Parcel.obtain();
5253 Parcel reply = Parcel.obtain();
5254 data.writeInterfaceToken(IActivityManager.descriptor);
5255 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005256 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005257 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5258 reply.readException();
5259 reply.recycle();
5260 data.recycle();
5261 }
5262
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005263 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5264 Parcel data = Parcel.obtain();
5265 Parcel reply = Parcel.obtain();
5266 data.writeInterfaceToken(IActivityManager.descriptor);
5267 data.writeString(packageName);
5268 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5269 reply.readException();
5270 boolean ask = reply.readInt() != 0;
5271 reply.recycle();
5272 data.recycle();
5273 return ask;
5274 }
5275
5276 public void setPackageAskScreenCompat(String packageName, boolean ask)
5277 throws RemoteException {
5278 Parcel data = Parcel.obtain();
5279 Parcel reply = Parcel.obtain();
5280 data.writeInterfaceToken(IActivityManager.descriptor);
5281 data.writeString(packageName);
5282 data.writeInt(ask ? 1 : 0);
5283 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5284 reply.readException();
5285 reply.recycle();
5286 data.recycle();
5287 }
5288
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005289 public boolean switchUser(int userid) throws RemoteException {
5290 Parcel data = Parcel.obtain();
5291 Parcel reply = Parcel.obtain();
5292 data.writeInterfaceToken(IActivityManager.descriptor);
5293 data.writeInt(userid);
5294 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5295 reply.readException();
5296 boolean result = reply.readInt() != 0;
5297 reply.recycle();
5298 data.recycle();
5299 return result;
5300 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005301
Kenny Guy08488bf2014-02-21 17:40:37 +00005302 public boolean startUserInBackground(int userid) throws RemoteException {
5303 Parcel data = Parcel.obtain();
5304 Parcel reply = Parcel.obtain();
5305 data.writeInterfaceToken(IActivityManager.descriptor);
5306 data.writeInt(userid);
5307 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5308 reply.readException();
5309 boolean result = reply.readInt() != 0;
5310 reply.recycle();
5311 data.recycle();
5312 return result;
5313 }
5314
Jeff Sharkeyba512352015-11-12 20:17:45 -08005315 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5316 Parcel data = Parcel.obtain();
5317 Parcel reply = Parcel.obtain();
5318 data.writeInterfaceToken(IActivityManager.descriptor);
5319 data.writeInt(userId);
5320 data.writeByteArray(token);
5321 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5322 reply.readException();
5323 boolean result = reply.readInt() != 0;
5324 reply.recycle();
5325 data.recycle();
5326 return result;
5327 }
5328
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005329 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5330 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005331 Parcel data = Parcel.obtain();
5332 Parcel reply = Parcel.obtain();
5333 data.writeInterfaceToken(IActivityManager.descriptor);
5334 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005335 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005336 data.writeStrongInterface(callback);
5337 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5338 reply.readException();
5339 int result = reply.readInt();
5340 reply.recycle();
5341 data.recycle();
5342 return result;
5343 }
5344
Amith Yamasani52f1d752012-03-28 18:19:29 -07005345 public UserInfo getCurrentUser() throws RemoteException {
5346 Parcel data = Parcel.obtain();
5347 Parcel reply = Parcel.obtain();
5348 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005349 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005350 reply.readException();
5351 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5352 reply.recycle();
5353 data.recycle();
5354 return userInfo;
5355 }
5356
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005357 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005358 Parcel data = Parcel.obtain();
5359 Parcel reply = Parcel.obtain();
5360 data.writeInterfaceToken(IActivityManager.descriptor);
5361 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005362 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005363 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5364 reply.readException();
5365 boolean result = reply.readInt() != 0;
5366 reply.recycle();
5367 data.recycle();
5368 return result;
5369 }
5370
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005371 public int[] getRunningUserIds() throws RemoteException {
5372 Parcel data = Parcel.obtain();
5373 Parcel reply = Parcel.obtain();
5374 data.writeInterfaceToken(IActivityManager.descriptor);
5375 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5376 reply.readException();
5377 int[] result = reply.createIntArray();
5378 reply.recycle();
5379 data.recycle();
5380 return result;
5381 }
5382
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005383 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005384 Parcel data = Parcel.obtain();
5385 Parcel reply = Parcel.obtain();
5386 data.writeInterfaceToken(IActivityManager.descriptor);
5387 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005388 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5389 reply.readException();
5390 boolean result = reply.readInt() != 0;
5391 reply.recycle();
5392 data.recycle();
5393 return result;
5394 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005395
Jeff Sharkeya4620792011-05-20 15:29:23 -07005396 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5397 Parcel data = Parcel.obtain();
5398 Parcel reply = Parcel.obtain();
5399 data.writeInterfaceToken(IActivityManager.descriptor);
5400 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5401 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5402 reply.readException();
5403 data.recycle();
5404 reply.recycle();
5405 }
5406
5407 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5408 Parcel data = Parcel.obtain();
5409 Parcel reply = Parcel.obtain();
5410 data.writeInterfaceToken(IActivityManager.descriptor);
5411 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5412 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5413 reply.readException();
5414 data.recycle();
5415 reply.recycle();
5416 }
5417
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005418 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005419 Parcel data = Parcel.obtain();
5420 Parcel reply = Parcel.obtain();
5421 data.writeInterfaceToken(IActivityManager.descriptor);
5422 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005423 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005424 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5425 reply.readException();
5426 data.recycle();
5427 reply.recycle();
5428 }
5429
5430 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5431 Parcel data = Parcel.obtain();
5432 Parcel reply = Parcel.obtain();
5433 data.writeInterfaceToken(IActivityManager.descriptor);
5434 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5435 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5436 reply.readException();
5437 data.recycle();
5438 reply.recycle();
5439 }
5440
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005441 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5442 Parcel data = Parcel.obtain();
5443 Parcel reply = Parcel.obtain();
5444 data.writeInterfaceToken(IActivityManager.descriptor);
5445 data.writeStrongBinder(sender.asBinder());
5446 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5447 reply.readException();
5448 boolean res = reply.readInt() != 0;
5449 data.recycle();
5450 reply.recycle();
5451 return res;
5452 }
5453
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005454 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5455 Parcel data = Parcel.obtain();
5456 Parcel reply = Parcel.obtain();
5457 data.writeInterfaceToken(IActivityManager.descriptor);
5458 data.writeStrongBinder(sender.asBinder());
5459 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5460 reply.readException();
5461 boolean res = reply.readInt() != 0;
5462 data.recycle();
5463 reply.recycle();
5464 return res;
5465 }
5466
Dianne Hackborn81038902012-11-26 17:04:09 -08005467 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5468 Parcel data = Parcel.obtain();
5469 Parcel reply = Parcel.obtain();
5470 data.writeInterfaceToken(IActivityManager.descriptor);
5471 data.writeStrongBinder(sender.asBinder());
5472 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5473 reply.readException();
5474 Intent res = reply.readInt() != 0
5475 ? Intent.CREATOR.createFromParcel(reply) : null;
5476 data.recycle();
5477 reply.recycle();
5478 return res;
5479 }
5480
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005481 public String getTagForIntentSender(IIntentSender sender, String prefix)
5482 throws RemoteException {
5483 Parcel data = Parcel.obtain();
5484 Parcel reply = Parcel.obtain();
5485 data.writeInterfaceToken(IActivityManager.descriptor);
5486 data.writeStrongBinder(sender.asBinder());
5487 data.writeString(prefix);
5488 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5489 reply.readException();
5490 String res = reply.readString();
5491 data.recycle();
5492 reply.recycle();
5493 return res;
5494 }
5495
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005496 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5497 {
5498 Parcel data = Parcel.obtain();
5499 Parcel reply = Parcel.obtain();
5500 data.writeInterfaceToken(IActivityManager.descriptor);
5501 values.writeToParcel(data, 0);
5502 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5503 reply.readException();
5504 data.recycle();
5505 reply.recycle();
5506 }
5507
Dianne Hackbornb437e092011-08-05 17:50:29 -07005508 public long[] getProcessPss(int[] pids) throws RemoteException {
5509 Parcel data = Parcel.obtain();
5510 Parcel reply = Parcel.obtain();
5511 data.writeInterfaceToken(IActivityManager.descriptor);
5512 data.writeIntArray(pids);
5513 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5514 reply.readException();
5515 long[] res = reply.createLongArray();
5516 data.recycle();
5517 reply.recycle();
5518 return res;
5519 }
5520
Dianne Hackborn661cd522011-08-22 00:26:20 -07005521 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5522 Parcel data = Parcel.obtain();
5523 Parcel reply = Parcel.obtain();
5524 data.writeInterfaceToken(IActivityManager.descriptor);
5525 TextUtils.writeToParcel(msg, data, 0);
5526 data.writeInt(always ? 1 : 0);
5527 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5528 reply.readException();
5529 data.recycle();
5530 reply.recycle();
5531 }
5532
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005533 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005534 Parcel data = Parcel.obtain();
5535 Parcel reply = Parcel.obtain();
5536 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005537 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005538 reply.readException();
5539 data.recycle();
5540 reply.recycle();
5541 }
5542
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005543 public void keyguardGoingAway(boolean disableWindowAnimations,
5544 boolean keyguardGoingToNotificationShade) throws RemoteException {
5545 Parcel data = Parcel.obtain();
5546 Parcel reply = Parcel.obtain();
5547 data.writeInterfaceToken(IActivityManager.descriptor);
5548 data.writeInt(disableWindowAnimations ? 1 : 0);
5549 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5550 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5551 reply.readException();
5552 data.recycle();
5553 reply.recycle();
5554 }
5555
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005556 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005557 throws RemoteException {
5558 Parcel data = Parcel.obtain();
5559 Parcel reply = Parcel.obtain();
5560 data.writeInterfaceToken(IActivityManager.descriptor);
5561 data.writeStrongBinder(token);
5562 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005563 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005564 reply.readException();
5565 boolean result = reply.readInt() != 0;
5566 data.recycle();
5567 reply.recycle();
5568 return result;
5569 }
5570
5571 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5572 throws RemoteException {
5573 Parcel data = Parcel.obtain();
5574 Parcel reply = Parcel.obtain();
5575 data.writeInterfaceToken(IActivityManager.descriptor);
5576 data.writeStrongBinder(token);
5577 target.writeToParcel(data, 0);
5578 data.writeInt(resultCode);
5579 if (resultData != null) {
5580 data.writeInt(1);
5581 resultData.writeToParcel(data, 0);
5582 } else {
5583 data.writeInt(0);
5584 }
5585 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5586 reply.readException();
5587 boolean result = reply.readInt() != 0;
5588 data.recycle();
5589 reply.recycle();
5590 return result;
5591 }
5592
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005593 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5594 Parcel data = Parcel.obtain();
5595 Parcel reply = Parcel.obtain();
5596 data.writeInterfaceToken(IActivityManager.descriptor);
5597 data.writeStrongBinder(activityToken);
5598 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5599 reply.readException();
5600 int result = reply.readInt();
5601 data.recycle();
5602 reply.recycle();
5603 return result;
5604 }
5605
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005606 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5607 Parcel data = Parcel.obtain();
5608 Parcel reply = Parcel.obtain();
5609 data.writeInterfaceToken(IActivityManager.descriptor);
5610 data.writeStrongBinder(activityToken);
5611 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5612 reply.readException();
5613 String result = reply.readString();
5614 data.recycle();
5615 reply.recycle();
5616 return result;
5617 }
5618
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005619 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5620 Parcel data = Parcel.obtain();
5621 Parcel reply = Parcel.obtain();
5622 data.writeInterfaceToken(IActivityManager.descriptor);
5623 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5624 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5625 reply.readException();
5626 data.recycle();
5627 reply.recycle();
5628 }
5629
5630 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5631 Parcel data = Parcel.obtain();
5632 Parcel reply = Parcel.obtain();
5633 data.writeInterfaceToken(IActivityManager.descriptor);
5634 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5635 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5636 reply.readException();
5637 data.recycle();
5638 reply.recycle();
5639 }
5640
Felipe Leme4cc86332015-12-04 16:37:28 -08005641 public void requestBugReport(boolean progress) throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005642 Parcel data = Parcel.obtain();
5643 Parcel reply = Parcel.obtain();
5644 data.writeInterfaceToken(IActivityManager.descriptor);
Felipe Leme4cc86332015-12-04 16:37:28 -08005645 data.writeInt(progress ? 1 : 0);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005646 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5647 reply.readException();
5648 data.recycle();
5649 reply.recycle();
5650 }
5651
Jeff Brownbd181bb2013-09-10 16:44:24 -07005652 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5653 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005654 Parcel data = Parcel.obtain();
5655 Parcel reply = Parcel.obtain();
5656 data.writeInterfaceToken(IActivityManager.descriptor);
5657 data.writeInt(pid);
5658 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005659 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005660 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5661 reply.readException();
5662 long res = reply.readInt();
5663 data.recycle();
5664 reply.recycle();
5665 return res;
5666 }
5667
Adam Skorydfc7fd72013-08-05 19:23:41 -07005668 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005669 Parcel data = Parcel.obtain();
5670 Parcel reply = Parcel.obtain();
5671 data.writeInterfaceToken(IActivityManager.descriptor);
5672 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005673 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005674 reply.readException();
5675 Bundle res = reply.readBundle();
5676 data.recycle();
5677 reply.recycle();
5678 return res;
5679 }
5680
Dianne Hackborn17f69352015-07-17 18:04:14 -07005681 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5682 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005683 Parcel data = Parcel.obtain();
5684 Parcel reply = Parcel.obtain();
5685 data.writeInterfaceToken(IActivityManager.descriptor);
5686 data.writeInt(requestType);
5687 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005688 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005689 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5690 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005691 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005692 data.recycle();
5693 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005694 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005695 }
5696
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005697 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005698 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005699 Parcel data = Parcel.obtain();
5700 Parcel reply = Parcel.obtain();
5701 data.writeInterfaceToken(IActivityManager.descriptor);
5702 data.writeStrongBinder(token);
5703 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005704 structure.writeToParcel(data, 0);
5705 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005706 if (referrer != null) {
5707 data.writeInt(1);
5708 referrer.writeToParcel(data, 0);
5709 } else {
5710 data.writeInt(0);
5711 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005712 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005713 reply.readException();
5714 data.recycle();
5715 reply.recycle();
5716 }
5717
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005718 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5719 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005720 Parcel data = Parcel.obtain();
5721 Parcel reply = Parcel.obtain();
5722 data.writeInterfaceToken(IActivityManager.descriptor);
5723 intent.writeToParcel(data, 0);
5724 data.writeInt(requestType);
5725 data.writeString(hint);
5726 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005727 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005728 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5729 reply.readException();
5730 boolean res = reply.readInt() != 0;
5731 data.recycle();
5732 reply.recycle();
5733 return res;
5734 }
5735
Dianne Hackborn17f69352015-07-17 18:04:14 -07005736 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005737 Parcel data = Parcel.obtain();
5738 Parcel reply = Parcel.obtain();
5739 data.writeInterfaceToken(IActivityManager.descriptor);
5740 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5741 reply.readException();
5742 boolean res = reply.readInt() != 0;
5743 data.recycle();
5744 reply.recycle();
5745 return res;
5746 }
5747
Dianne Hackborn17f69352015-07-17 18:04:14 -07005748 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5749 Parcel data = Parcel.obtain();
5750 Parcel reply = Parcel.obtain();
5751 data.writeInterfaceToken(IActivityManager.descriptor);
5752 data.writeStrongBinder(token);
5753 data.writeBundle(args);
5754 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5755 reply.readException();
5756 boolean res = reply.readInt() != 0;
5757 data.recycle();
5758 reply.recycle();
5759 return res;
5760 }
5761
Svetoslavaa41add2015-08-06 15:03:55 -07005762 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005763 Parcel data = Parcel.obtain();
5764 Parcel reply = Parcel.obtain();
5765 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005766 data.writeInt(appId);
5767 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005768 data.writeString(reason);
5769 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5770 reply.readException();
5771 data.recycle();
5772 reply.recycle();
5773 }
5774
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005775 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5776 Parcel data = Parcel.obtain();
5777 Parcel reply = Parcel.obtain();
5778 data.writeInterfaceToken(IActivityManager.descriptor);
5779 data.writeStrongBinder(who);
5780 data.writeInt(allowRestart ? 1 : 0);
5781 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5782 reply.readException();
5783 data.recycle();
5784 reply.recycle();
5785 }
5786
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005787 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5788 Parcel data = Parcel.obtain();
5789 Parcel reply = Parcel.obtain();
5790 data.writeInterfaceToken(IActivityManager.descriptor);
5791 data.writeStrongBinder(token);
5792 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5793 reply.readException();
5794 data.recycle();
5795 reply.recycle();
5796 }
5797
Craig Mautner5eda9b32013-07-02 11:58:16 -07005798 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5799 Parcel data = Parcel.obtain();
5800 Parcel reply = Parcel.obtain();
5801 data.writeInterfaceToken(IActivityManager.descriptor);
5802 data.writeStrongBinder(token);
5803 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5804 reply.readException();
5805 data.recycle();
5806 reply.recycle();
5807 }
5808
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005809 public void restart() throws RemoteException {
5810 Parcel data = Parcel.obtain();
5811 Parcel reply = Parcel.obtain();
5812 data.writeInterfaceToken(IActivityManager.descriptor);
5813 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5814 reply.readException();
5815 data.recycle();
5816 reply.recycle();
5817 }
5818
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005819 public void performIdleMaintenance() throws RemoteException {
5820 Parcel data = Parcel.obtain();
5821 Parcel reply = Parcel.obtain();
5822 data.writeInterfaceToken(IActivityManager.descriptor);
5823 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5824 reply.readException();
5825 data.recycle();
5826 reply.recycle();
5827 }
5828
Todd Kennedyca4d8422015-01-15 15:19:22 -08005829 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005830 IActivityContainerCallback callback) throws RemoteException {
5831 Parcel data = Parcel.obtain();
5832 Parcel reply = Parcel.obtain();
5833 data.writeInterfaceToken(IActivityManager.descriptor);
5834 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005835 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005836 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005837 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005838 final int result = reply.readInt();
5839 final IActivityContainer res;
5840 if (result == 1) {
5841 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5842 } else {
5843 res = null;
5844 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005845 data.recycle();
5846 reply.recycle();
5847 return res;
5848 }
5849
Craig Mautner95da1082014-02-24 17:54:35 -08005850 public void deleteActivityContainer(IActivityContainer activityContainer)
5851 throws RemoteException {
5852 Parcel data = Parcel.obtain();
5853 Parcel reply = Parcel.obtain();
5854 data.writeInterfaceToken(IActivityManager.descriptor);
5855 data.writeStrongBinder(activityContainer.asBinder());
5856 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5857 reply.readException();
5858 data.recycle();
5859 reply.recycle();
5860 }
5861
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005862 public boolean startBinderTracking() throws RemoteException {
5863 Parcel data = Parcel.obtain();
5864 Parcel reply = Parcel.obtain();
5865 data.writeInterfaceToken(IActivityManager.descriptor);
5866 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5867 reply.readException();
5868 boolean res = reply.readInt() != 0;
5869 reply.recycle();
5870 data.recycle();
5871 return res;
5872 }
5873
5874 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5875 Parcel data = Parcel.obtain();
5876 Parcel reply = Parcel.obtain();
5877 data.writeInterfaceToken(IActivityManager.descriptor);
5878 if (fd != null) {
5879 data.writeInt(1);
5880 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5881 } else {
5882 data.writeInt(0);
5883 }
5884 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5885 reply.readException();
5886 boolean res = reply.readInt() != 0;
5887 reply.recycle();
5888 data.recycle();
5889 return res;
5890 }
5891
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005892 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005893 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5894 Parcel data = Parcel.obtain();
5895 Parcel reply = Parcel.obtain();
5896 data.writeInterfaceToken(IActivityManager.descriptor);
5897 data.writeInt(displayId);
5898 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5899 reply.readException();
5900 final int result = reply.readInt();
5901 final IActivityContainer res;
5902 if (result == 1) {
5903 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5904 } else {
5905 res = null;
5906 }
5907 data.recycle();
5908 reply.recycle();
5909 return res;
5910 }
5911
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005912 @Override
5913 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005914 throws RemoteException {
5915 Parcel data = Parcel.obtain();
5916 Parcel reply = Parcel.obtain();
5917 data.writeInterfaceToken(IActivityManager.descriptor);
5918 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005919 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005920 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005921 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005922 data.recycle();
5923 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005924 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005925 }
5926
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005927 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005928 public void startLockTaskMode(int taskId) throws RemoteException {
5929 Parcel data = Parcel.obtain();
5930 Parcel reply = Parcel.obtain();
5931 data.writeInterfaceToken(IActivityManager.descriptor);
5932 data.writeInt(taskId);
5933 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5934 reply.readException();
5935 data.recycle();
5936 reply.recycle();
5937 }
5938
5939 @Override
5940 public void startLockTaskMode(IBinder token) throws RemoteException {
5941 Parcel data = Parcel.obtain();
5942 Parcel reply = Parcel.obtain();
5943 data.writeInterfaceToken(IActivityManager.descriptor);
5944 data.writeStrongBinder(token);
5945 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5946 reply.readException();
5947 data.recycle();
5948 reply.recycle();
5949 }
5950
5951 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005952 public void startLockTaskModeOnCurrent() throws RemoteException {
5953 Parcel data = Parcel.obtain();
5954 Parcel reply = Parcel.obtain();
5955 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005956 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005957 reply.readException();
5958 data.recycle();
5959 reply.recycle();
5960 }
5961
5962 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005963 public void stopLockTaskMode() throws RemoteException {
5964 Parcel data = Parcel.obtain();
5965 Parcel reply = Parcel.obtain();
5966 data.writeInterfaceToken(IActivityManager.descriptor);
5967 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5968 reply.readException();
5969 data.recycle();
5970 reply.recycle();
5971 }
5972
5973 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005974 public void stopLockTaskModeOnCurrent() throws RemoteException {
5975 Parcel data = Parcel.obtain();
5976 Parcel reply = Parcel.obtain();
5977 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005978 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005979 reply.readException();
5980 data.recycle();
5981 reply.recycle();
5982 }
5983
5984 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005985 public boolean isInLockTaskMode() throws RemoteException {
5986 Parcel data = Parcel.obtain();
5987 Parcel reply = Parcel.obtain();
5988 data.writeInterfaceToken(IActivityManager.descriptor);
5989 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5990 reply.readException();
5991 boolean isInLockTaskMode = reply.readInt() == 1;
5992 data.recycle();
5993 reply.recycle();
5994 return isInLockTaskMode;
5995 }
5996
Craig Mautner688b5102014-03-27 16:55:03 -07005997 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005998 public int getLockTaskModeState() throws RemoteException {
5999 Parcel data = Parcel.obtain();
6000 Parcel reply = Parcel.obtain();
6001 data.writeInterfaceToken(IActivityManager.descriptor);
6002 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6003 reply.readException();
6004 int lockTaskModeState = reply.readInt();
6005 data.recycle();
6006 reply.recycle();
6007 return lockTaskModeState;
6008 }
6009
6010 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006011 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6012 Parcel data = Parcel.obtain();
6013 Parcel reply = Parcel.obtain();
6014 data.writeInterfaceToken(IActivityManager.descriptor);
6015 data.writeStrongBinder(token);
6016 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6017 IBinder.FLAG_ONEWAY);
6018 reply.readException();
6019 data.recycle();
6020 reply.recycle();
6021 }
6022
6023 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006024 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006025 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006026 Parcel data = Parcel.obtain();
6027 Parcel reply = Parcel.obtain();
6028 data.writeInterfaceToken(IActivityManager.descriptor);
6029 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006030 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006031 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006032 reply.readException();
6033 data.recycle();
6034 reply.recycle();
6035 }
6036
Craig Mautneree2e45a2014-06-27 12:10:03 -07006037 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006038 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
6039 Parcel data = Parcel.obtain();
6040 Parcel reply = Parcel.obtain();
6041 data.writeInterfaceToken(IActivityManager.descriptor);
6042 data.writeInt(taskId);
6043 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006044 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006045 reply.readException();
6046 data.recycle();
6047 reply.recycle();
6048 }
6049
6050 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006051 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006052 {
6053 Parcel data = Parcel.obtain();
6054 Parcel reply = Parcel.obtain();
6055 data.writeInterfaceToken(IActivityManager.descriptor);
6056 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006057 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006058 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006059 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006060 reply.readException();
6061 data.recycle();
6062 reply.recycle();
6063 }
6064
6065 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006066 public Rect getTaskBounds(int taskId) throws RemoteException
6067 {
6068 Parcel data = Parcel.obtain();
6069 Parcel reply = Parcel.obtain();
6070 data.writeInterfaceToken(IActivityManager.descriptor);
6071 data.writeInt(taskId);
6072 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6073 reply.readException();
6074 Rect rect = Rect.CREATOR.createFromParcel(reply);
6075 data.recycle();
6076 reply.recycle();
6077 return rect;
6078 }
6079
6080 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006081 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006082 Parcel data = Parcel.obtain();
6083 Parcel reply = Parcel.obtain();
6084 data.writeInterfaceToken(IActivityManager.descriptor);
6085 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006086 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006087 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6088 reply.readException();
6089 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6090 data.recycle();
6091 reply.recycle();
6092 return icon;
6093 }
6094
6095 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006096 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6097 throws RemoteException {
6098 Parcel data = Parcel.obtain();
6099 Parcel reply = Parcel.obtain();
6100 data.writeInterfaceToken(IActivityManager.descriptor);
6101 if (options == null) {
6102 data.writeInt(0);
6103 } else {
6104 data.writeInt(1);
6105 data.writeBundle(options.toBundle());
6106 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006107 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006108 reply.readException();
6109 data.recycle();
6110 reply.recycle();
6111 }
6112
6113 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006114 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006115 Parcel data = Parcel.obtain();
6116 Parcel reply = Parcel.obtain();
6117 data.writeInterfaceToken(IActivityManager.descriptor);
6118 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006119 data.writeInt(visible ? 1 : 0);
6120 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006121 reply.readException();
6122 boolean success = reply.readInt() > 0;
6123 data.recycle();
6124 reply.recycle();
6125 return success;
6126 }
6127
6128 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006129 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006130 Parcel data = Parcel.obtain();
6131 Parcel reply = Parcel.obtain();
6132 data.writeInterfaceToken(IActivityManager.descriptor);
6133 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006134 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006135 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006136 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006137 data.recycle();
6138 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006139 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006140 }
6141
6142 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006143 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006144 Parcel data = Parcel.obtain();
6145 Parcel reply = Parcel.obtain();
6146 data.writeInterfaceToken(IActivityManager.descriptor);
6147 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006148 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006149 reply.readException();
6150 data.recycle();
6151 reply.recycle();
6152 }
6153
6154 @Override
6155 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6156 Parcel data = Parcel.obtain();
6157 Parcel reply = Parcel.obtain();
6158 data.writeInterfaceToken(IActivityManager.descriptor);
6159 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006160 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006161 reply.readException();
6162 data.recycle();
6163 reply.recycle();
6164 }
6165
Craig Mautner8746a472014-07-24 15:12:54 -07006166 @Override
6167 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6168 Parcel data = Parcel.obtain();
6169 Parcel reply = Parcel.obtain();
6170 data.writeInterfaceToken(IActivityManager.descriptor);
6171 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006172 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006173 reply.readException();
6174 data.recycle();
6175 reply.recycle();
6176 }
6177
Craig Mautner6e2f3952014-09-09 14:26:41 -07006178 @Override
6179 public void bootAnimationComplete() throws RemoteException {
6180 Parcel data = Parcel.obtain();
6181 Parcel reply = Parcel.obtain();
6182 data.writeInterfaceToken(IActivityManager.descriptor);
6183 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6184 reply.readException();
6185 data.recycle();
6186 reply.recycle();
6187 }
6188
Wale Ogunwale18795a22014-12-03 11:38:33 -08006189 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006190 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6191 Parcel data = Parcel.obtain();
6192 Parcel reply = Parcel.obtain();
6193 data.writeInterfaceToken(IActivityManager.descriptor);
6194 data.writeInt(uid);
6195 data.writeByteArray(firstPacket);
6196 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6197 reply.readException();
6198 data.recycle();
6199 reply.recycle();
6200 }
6201
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006202 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006203 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6204 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006205 Parcel data = Parcel.obtain();
6206 Parcel reply = Parcel.obtain();
6207 data.writeInterfaceToken(IActivityManager.descriptor);
6208 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006209 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006210 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006211 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006212 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6213 reply.readException();
6214 data.recycle();
6215 reply.recycle();
6216 }
6217
6218 @Override
6219 public void dumpHeapFinished(String path) throws RemoteException {
6220 Parcel data = Parcel.obtain();
6221 Parcel reply = Parcel.obtain();
6222 data.writeInterfaceToken(IActivityManager.descriptor);
6223 data.writeString(path);
6224 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6225 reply.readException();
6226 data.recycle();
6227 reply.recycle();
6228 }
6229
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006230 @Override
6231 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6232 throws RemoteException {
6233 Parcel data = Parcel.obtain();
6234 Parcel reply = Parcel.obtain();
6235 data.writeInterfaceToken(IActivityManager.descriptor);
6236 data.writeStrongBinder(session.asBinder());
6237 data.writeInt(keepAwake ? 1 : 0);
6238 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6239 reply.readException();
6240 data.recycle();
6241 reply.recycle();
6242 }
6243
Craig Mautnere5600772015-04-03 21:36:37 -07006244 @Override
6245 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6246 Parcel data = Parcel.obtain();
6247 Parcel reply = Parcel.obtain();
6248 data.writeInterfaceToken(IActivityManager.descriptor);
6249 data.writeInt(userId);
6250 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006251 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006252 reply.readException();
6253 data.recycle();
6254 reply.recycle();
6255 }
6256
Dianne Hackborn1e383822015-04-10 14:02:33 -07006257 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006258 public void updateDeviceOwner(String packageName) throws RemoteException {
6259 Parcel data = Parcel.obtain();
6260 Parcel reply = Parcel.obtain();
6261 data.writeInterfaceToken(IActivityManager.descriptor);
6262 data.writeString(packageName);
6263 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6264 reply.readException();
6265 data.recycle();
6266 reply.recycle();
6267 }
6268
6269 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006270 public int getPackageProcessState(String packageName, String callingPackage)
6271 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006272 Parcel data = Parcel.obtain();
6273 Parcel reply = Parcel.obtain();
6274 data.writeInterfaceToken(IActivityManager.descriptor);
6275 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006276 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006277 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6278 reply.readException();
6279 int res = reply.readInt();
6280 data.recycle();
6281 reply.recycle();
6282 return res;
6283 }
6284
Stefan Kuhne16045c22015-06-05 07:18:06 -07006285 @Override
6286 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6287 throws RemoteException {
6288 Parcel data = Parcel.obtain();
6289 Parcel reply = Parcel.obtain();
6290 data.writeInterfaceToken(IActivityManager.descriptor);
6291 data.writeString(process);
6292 data.writeInt(userId);
6293 data.writeInt(level);
6294 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6295 reply.readException();
6296 int res = reply.readInt();
6297 data.recycle();
6298 reply.recycle();
6299 return res != 0;
6300 }
6301
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006302 @Override
6303 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6304 Parcel data = Parcel.obtain();
6305 Parcel reply = Parcel.obtain();
6306 data.writeInterfaceToken(IActivityManager.descriptor);
6307 data.writeStrongBinder(token);
6308 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6309 reply.readException();
6310 int res = reply.readInt();
6311 data.recycle();
6312 reply.recycle();
6313 return res != 0;
6314 }
6315
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006316 @Override
6317 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6318 Parcel data = Parcel.obtain();
6319 Parcel reply = Parcel.obtain();
6320 data.writeInterfaceToken(IActivityManager.descriptor);
6321 data.writeStrongBinder(token);
6322 data.writeInt(stackId);
6323 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6324 reply.readException();
6325 data.recycle();
6326 reply.recycle();
6327 }
6328
6329 @Override
6330 public int getActivityStackId(IBinder token) throws RemoteException {
6331 Parcel data = Parcel.obtain();
6332 Parcel reply = Parcel.obtain();
6333 data.writeInterfaceToken(IActivityManager.descriptor);
6334 data.writeStrongBinder(token);
6335 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6336 reply.readException();
6337 int stackId = reply.readInt();
6338 data.recycle();
6339 reply.recycle();
6340 return stackId;
6341 }
6342
Filip Gruszczynski23493322015-07-29 17:02:59 -07006343 @Override
6344 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006345 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6346 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006347 Parcel data = Parcel.obtain();
6348 Parcel reply = Parcel.obtain();
6349 data.writeInterfaceToken(IActivityManager.descriptor);
6350 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006351 writeIntArray(horizontalSizeConfiguration, data);
6352 writeIntArray(verticalSizeConfigurations, data);
6353 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006354 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6355 reply.readException();
6356 data.recycle();
6357 reply.recycle();
6358 }
6359
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006360 private static void writeIntArray(int[] array, Parcel data) {
6361 if (array == null) {
6362 data.writeInt(0);
6363 } else {
6364 data.writeInt(array.length);
6365 data.writeIntArray(array);
6366 }
6367 }
6368
Wale Ogunwale83301a92015-09-24 15:54:08 -07006369 @Override
6370 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6371 Parcel data = Parcel.obtain();
6372 Parcel reply = Parcel.obtain();
6373 data.writeInterfaceToken(IActivityManager.descriptor);
6374 data.writeInt(suppress ? 1 : 0);
6375 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6376 reply.readException();
6377 data.recycle();
6378 reply.recycle();
6379 }
6380
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006381 @Override
6382 public void removeStack(int stackId) throws RemoteException {
6383 Parcel data = Parcel.obtain();
6384 Parcel reply = Parcel.obtain();
6385 data.writeInterfaceToken(IActivityManager.descriptor);
6386 data.writeInt(stackId);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006387 mRemote.transact(REMOVE_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006388 reply.readException();
6389 data.recycle();
6390 reply.recycle();
6391 }
6392
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006393 @Override
6394 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6395 Parcel data = Parcel.obtain();
6396 Parcel reply = Parcel.obtain();
6397 data.writeInterfaceToken(IActivityManager.descriptor);
6398 data.writeInt(uid);
6399 data.writeString(packageName);
6400 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6401 reply.readException();
6402 int res = reply.readInt();
6403 data.recycle();
6404 reply.recycle();
6405 return res;
6406 }
6407
Wale Ogunwale5f986092015-12-04 15:35:38 -08006408 @Override
6409 public boolean inMultiWindowMode(IBinder token) throws RemoteException {
6410 Parcel data = Parcel.obtain();
6411 Parcel reply = Parcel.obtain();
6412 data.writeInterfaceToken(IActivityManager.descriptor);
6413 data.writeStrongBinder(token);
6414 mRemote.transact(IN_MULTI_WINDOW_MODE_TRANSACTION, data, reply, 0);
6415 reply.readException();
6416 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6417 data.recycle();
6418 reply.recycle();
6419 return multiWindowMode;
6420 }
6421
6422 @Override
6423 public boolean inPictureInPictureMode(IBinder token) throws RemoteException {
6424 Parcel data = Parcel.obtain();
6425 Parcel reply = Parcel.obtain();
6426 data.writeInterfaceToken(IActivityManager.descriptor);
6427 data.writeStrongBinder(token);
6428 mRemote.transact(IN_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6429 reply.readException();
6430 final boolean pipMode = reply.readInt() == 1 ? true : false;
6431 data.recycle();
6432 reply.recycle();
6433 return pipMode;
6434 }
6435
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006436 private IBinder mRemote;
6437}