blob: 3a3aa92697e69131a719e6d37370cde60956f631 [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
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08001848 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 IBinder activityToken = data.readStrongBinder();
1851 IBinder perm = getUriPermissionOwnerForActivity(activityToken);
1852 reply.writeNoException();
1853 reply.writeStrongBinder(perm);
1854 return true;
1855 }
1856
Dianne Hackborn7e269642010-08-25 19:50:20 -07001857 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1858 data.enforceInterface(IActivityManager.descriptor);
1859 IBinder owner = data.readStrongBinder();
1860 int fromUid = data.readInt();
1861 String targetPkg = data.readString();
1862 Uri uri = Uri.CREATOR.createFromParcel(data);
1863 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001864 int sourceUserId = data.readInt();
1865 int targetUserId = data.readInt();
1866 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1867 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001868 reply.writeNoException();
1869 return true;
1870 }
1871
1872 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1873 data.enforceInterface(IActivityManager.descriptor);
1874 IBinder owner = data.readStrongBinder();
1875 Uri uri = null;
1876 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001877 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001878 }
1879 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001880 int userId = data.readInt();
1881 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001882 reply.writeNoException();
1883 return true;
1884 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001885
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001886 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1887 data.enforceInterface(IActivityManager.descriptor);
1888 int callingUid = data.readInt();
1889 String targetPkg = data.readString();
1890 Uri uri = Uri.CREATOR.createFromParcel(data);
1891 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001892 int userId = data.readInt();
1893 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001894 reply.writeNoException();
1895 reply.writeInt(res);
1896 return true;
1897 }
1898
Andy McFadden824c5102010-07-09 16:26:57 -07001899 case DUMP_HEAP_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001902 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001903 boolean managed = data.readInt() != 0;
1904 String path = data.readString();
1905 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001906 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001907 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001908 reply.writeNoException();
1909 reply.writeInt(res ? 1 : 0);
1910 return true;
1911 }
1912
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001913 case START_ACTIVITIES_TRANSACTION:
1914 {
1915 data.enforceInterface(IActivityManager.descriptor);
1916 IBinder b = data.readStrongBinder();
1917 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001918 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001919 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1920 String[] resolvedTypes = data.createStringArray();
1921 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001922 Bundle options = data.readInt() != 0
1923 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001924 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001925 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001926 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001927 reply.writeNoException();
1928 reply.writeInt(result);
1929 return true;
1930 }
1931
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001932 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1933 {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 int mode = getFrontActivityScreenCompatMode();
1936 reply.writeNoException();
1937 reply.writeInt(mode);
1938 return true;
1939 }
1940
1941 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1942 {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 int mode = data.readInt();
1945 setFrontActivityScreenCompatMode(mode);
1946 reply.writeNoException();
1947 reply.writeInt(mode);
1948 return true;
1949 }
1950
1951 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1952 {
1953 data.enforceInterface(IActivityManager.descriptor);
1954 String pkg = data.readString();
1955 int mode = getPackageScreenCompatMode(pkg);
1956 reply.writeNoException();
1957 reply.writeInt(mode);
1958 return true;
1959 }
1960
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001961 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1962 {
1963 data.enforceInterface(IActivityManager.descriptor);
1964 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001965 int mode = data.readInt();
1966 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001967 reply.writeNoException();
1968 return true;
1969 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001970
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001971 case SWITCH_USER_TRANSACTION: {
1972 data.enforceInterface(IActivityManager.descriptor);
1973 int userid = data.readInt();
1974 boolean result = switchUser(userid);
1975 reply.writeNoException();
1976 reply.writeInt(result ? 1 : 0);
1977 return true;
1978 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001979
Kenny Guy08488bf2014-02-21 17:40:37 +00001980 case START_USER_IN_BACKGROUND_TRANSACTION: {
1981 data.enforceInterface(IActivityManager.descriptor);
1982 int userid = data.readInt();
1983 boolean result = startUserInBackground(userid);
1984 reply.writeNoException();
1985 reply.writeInt(result ? 1 : 0);
1986 return true;
1987 }
1988
Jeff Sharkeyba512352015-11-12 20:17:45 -08001989 case UNLOCK_USER_TRANSACTION: {
1990 data.enforceInterface(IActivityManager.descriptor);
1991 int userId = data.readInt();
1992 byte[] token = data.createByteArray();
1993 boolean result = unlockUser(userId, token);
1994 reply.writeNoException();
1995 reply.writeInt(result ? 1 : 0);
1996 return true;
1997 }
1998
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001999 case STOP_USER_TRANSACTION: {
2000 data.enforceInterface(IActivityManager.descriptor);
2001 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002002 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002003 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2004 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002005 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002006 reply.writeNoException();
2007 reply.writeInt(result);
2008 return true;
2009 }
2010
Amith Yamasani52f1d752012-03-28 18:19:29 -07002011 case GET_CURRENT_USER_TRANSACTION: {
2012 data.enforceInterface(IActivityManager.descriptor);
2013 UserInfo userInfo = getCurrentUser();
2014 reply.writeNoException();
2015 userInfo.writeToParcel(reply, 0);
2016 return true;
2017 }
2018
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002019 case IS_USER_RUNNING_TRANSACTION: {
2020 data.enforceInterface(IActivityManager.descriptor);
2021 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002022 int _flags = data.readInt();
2023 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002024 reply.writeNoException();
2025 reply.writeInt(result ? 1 : 0);
2026 return true;
2027 }
2028
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002029 case GET_RUNNING_USER_IDS_TRANSACTION: {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 int[] result = getRunningUserIds();
2032 reply.writeNoException();
2033 reply.writeIntArray(result);
2034 return true;
2035 }
2036
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002037 case REMOVE_TASK_TRANSACTION:
2038 {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002041 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002042 reply.writeNoException();
2043 reply.writeInt(result ? 1 : 0);
2044 return true;
2045 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002046
Jeff Sharkeya4620792011-05-20 15:29:23 -07002047 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2048 data.enforceInterface(IActivityManager.descriptor);
2049 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2050 data.readStrongBinder());
2051 registerProcessObserver(observer);
2052 return true;
2053 }
2054
2055 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2056 data.enforceInterface(IActivityManager.descriptor);
2057 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2058 data.readStrongBinder());
2059 unregisterProcessObserver(observer);
2060 return true;
2061 }
2062
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002063 case REGISTER_UID_OBSERVER_TRANSACTION: {
2064 data.enforceInterface(IActivityManager.descriptor);
2065 IUidObserver observer = IUidObserver.Stub.asInterface(
2066 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002067 int which = data.readInt();
2068 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002069 return true;
2070 }
2071
2072 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2073 data.enforceInterface(IActivityManager.descriptor);
2074 IUidObserver observer = IUidObserver.Stub.asInterface(
2075 data.readStrongBinder());
2076 unregisterUidObserver(observer);
2077 return true;
2078 }
2079
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002080 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2081 {
2082 data.enforceInterface(IActivityManager.descriptor);
2083 String pkg = data.readString();
2084 boolean ask = getPackageAskScreenCompat(pkg);
2085 reply.writeNoException();
2086 reply.writeInt(ask ? 1 : 0);
2087 return true;
2088 }
2089
2090 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2091 {
2092 data.enforceInterface(IActivityManager.descriptor);
2093 String pkg = data.readString();
2094 boolean ask = data.readInt() != 0;
2095 setPackageAskScreenCompat(pkg, ask);
2096 reply.writeNoException();
2097 return true;
2098 }
2099
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002100 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2101 data.enforceInterface(IActivityManager.descriptor);
2102 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002103 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002104 boolean res = isIntentSenderTargetedToPackage(r);
2105 reply.writeNoException();
2106 reply.writeInt(res ? 1 : 0);
2107 return true;
2108 }
2109
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002110 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2111 data.enforceInterface(IActivityManager.descriptor);
2112 IIntentSender r = IIntentSender.Stub.asInterface(
2113 data.readStrongBinder());
2114 boolean res = isIntentSenderAnActivity(r);
2115 reply.writeNoException();
2116 reply.writeInt(res ? 1 : 0);
2117 return true;
2118 }
2119
Dianne Hackborn81038902012-11-26 17:04:09 -08002120 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2121 data.enforceInterface(IActivityManager.descriptor);
2122 IIntentSender r = IIntentSender.Stub.asInterface(
2123 data.readStrongBinder());
2124 Intent intent = getIntentForIntentSender(r);
2125 reply.writeNoException();
2126 if (intent != null) {
2127 reply.writeInt(1);
2128 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2129 } else {
2130 reply.writeInt(0);
2131 }
2132 return true;
2133 }
2134
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002135 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2136 data.enforceInterface(IActivityManager.descriptor);
2137 IIntentSender r = IIntentSender.Stub.asInterface(
2138 data.readStrongBinder());
2139 String prefix = data.readString();
2140 String tag = getTagForIntentSender(r, prefix);
2141 reply.writeNoException();
2142 reply.writeString(tag);
2143 return true;
2144 }
2145
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002146 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 Configuration config = Configuration.CREATOR.createFromParcel(data);
2149 updatePersistentConfiguration(config);
2150 reply.writeNoException();
2151 return true;
2152 }
2153
Dianne Hackbornb437e092011-08-05 17:50:29 -07002154 case GET_PROCESS_PSS_TRANSACTION: {
2155 data.enforceInterface(IActivityManager.descriptor);
2156 int[] pids = data.createIntArray();
2157 long[] pss = getProcessPss(pids);
2158 reply.writeNoException();
2159 reply.writeLongArray(pss);
2160 return true;
2161 }
2162
Dianne Hackborn661cd522011-08-22 00:26:20 -07002163 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2164 data.enforceInterface(IActivityManager.descriptor);
2165 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2166 boolean always = data.readInt() != 0;
2167 showBootMessage(msg, always);
2168 reply.writeNoException();
2169 return true;
2170 }
2171
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002172 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002173 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002174 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002175 reply.writeNoException();
2176 return true;
2177 }
2178
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002179 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2180 data.enforceInterface(IActivityManager.descriptor);
2181 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2182 reply.writeNoException();
2183 return true;
2184 }
2185
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002186 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002187 data.enforceInterface(IActivityManager.descriptor);
2188 IBinder token = data.readStrongBinder();
2189 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002190 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002191 reply.writeNoException();
2192 reply.writeInt(res ? 1 : 0);
2193 return true;
2194 }
2195
2196 case NAVIGATE_UP_TO_TRANSACTION: {
2197 data.enforceInterface(IActivityManager.descriptor);
2198 IBinder token = data.readStrongBinder();
2199 Intent target = Intent.CREATOR.createFromParcel(data);
2200 int resultCode = data.readInt();
2201 Intent resultData = null;
2202 if (data.readInt() != 0) {
2203 resultData = Intent.CREATOR.createFromParcel(data);
2204 }
2205 boolean res = navigateUpTo(token, target, resultCode, resultData);
2206 reply.writeNoException();
2207 reply.writeInt(res ? 1 : 0);
2208 return true;
2209 }
2210
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002211 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2212 data.enforceInterface(IActivityManager.descriptor);
2213 IBinder token = data.readStrongBinder();
2214 int res = getLaunchedFromUid(token);
2215 reply.writeNoException();
2216 reply.writeInt(res);
2217 return true;
2218 }
2219
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002220 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2221 data.enforceInterface(IActivityManager.descriptor);
2222 IBinder token = data.readStrongBinder();
2223 String res = getLaunchedFromPackage(token);
2224 reply.writeNoException();
2225 reply.writeString(res);
2226 return true;
2227 }
2228
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002229 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2230 data.enforceInterface(IActivityManager.descriptor);
2231 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2232 data.readStrongBinder());
2233 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002234 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002235 return true;
2236 }
2237
2238 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2239 data.enforceInterface(IActivityManager.descriptor);
2240 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2241 data.readStrongBinder());
2242 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002243 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002244 return true;
2245 }
2246
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002247 case REQUEST_BUG_REPORT_TRANSACTION: {
2248 data.enforceInterface(IActivityManager.descriptor);
Felipe Leme4cc86332015-12-04 16:37:28 -08002249 boolean progress = data.readInt() != 0;
2250 requestBugReport(progress);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002251 reply.writeNoException();
2252 return true;
2253 }
2254
2255 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2256 data.enforceInterface(IActivityManager.descriptor);
2257 int pid = data.readInt();
2258 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002259 String reason = data.readString();
2260 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002261 reply.writeNoException();
2262 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002263 return true;
2264 }
2265
Adam Skorydfc7fd72013-08-05 19:23:41 -07002266 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002267 data.enforceInterface(IActivityManager.descriptor);
2268 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002269 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002270 reply.writeNoException();
2271 reply.writeBundle(res);
2272 return true;
2273 }
2274
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002275 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2276 data.enforceInterface(IActivityManager.descriptor);
2277 int requestType = data.readInt();
2278 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002279 IBinder activityToken = data.readStrongBinder();
2280 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002281 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002282 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002283 return true;
2284 }
2285
Adam Skorydfc7fd72013-08-05 19:23:41 -07002286 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002287 data.enforceInterface(IActivityManager.descriptor);
2288 IBinder token = data.readStrongBinder();
2289 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002290 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2291 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002292 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2293 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002294 reply.writeNoException();
2295 return true;
2296 }
2297
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002298 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2299 data.enforceInterface(IActivityManager.descriptor);
2300 Intent intent = Intent.CREATOR.createFromParcel(data);
2301 int requestType = data.readInt();
2302 String hint = data.readString();
2303 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002304 Bundle args = data.readBundle();
2305 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002306 reply.writeNoException();
2307 reply.writeInt(res ? 1 : 0);
2308 return true;
2309 }
2310
Benjamin Franzc200f442015-06-25 18:20:04 +01002311 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2312 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002313 boolean res = isAssistDataAllowedOnCurrentActivity();
2314 reply.writeNoException();
2315 reply.writeInt(res ? 1 : 0);
2316 return true;
2317 }
2318
2319 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2320 data.enforceInterface(IActivityManager.descriptor);
2321 IBinder token = data.readStrongBinder();
2322 Bundle args = data.readBundle();
2323 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002324 reply.writeNoException();
2325 reply.writeInt(res ? 1 : 0);
2326 return true;
2327 }
2328
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002329 case KILL_UID_TRANSACTION: {
2330 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002331 int appId = data.readInt();
2332 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002333 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002334 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002335 reply.writeNoException();
2336 return true;
2337 }
2338
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002339 case HANG_TRANSACTION: {
2340 data.enforceInterface(IActivityManager.descriptor);
2341 IBinder who = data.readStrongBinder();
2342 boolean allowRestart = data.readInt() != 0;
2343 hang(who, allowRestart);
2344 reply.writeNoException();
2345 return true;
2346 }
2347
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002348 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2349 data.enforceInterface(IActivityManager.descriptor);
2350 IBinder token = data.readStrongBinder();
2351 reportActivityFullyDrawn(token);
2352 reply.writeNoException();
2353 return true;
2354 }
2355
Craig Mautner5eda9b32013-07-02 11:58:16 -07002356 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2357 data.enforceInterface(IActivityManager.descriptor);
2358 IBinder token = data.readStrongBinder();
2359 notifyActivityDrawn(token);
2360 reply.writeNoException();
2361 return true;
2362 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002363
2364 case RESTART_TRANSACTION: {
2365 data.enforceInterface(IActivityManager.descriptor);
2366 restart();
2367 reply.writeNoException();
2368 return true;
2369 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002370
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002371 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2372 data.enforceInterface(IActivityManager.descriptor);
2373 performIdleMaintenance();
2374 reply.writeNoException();
2375 return true;
2376 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002377
Todd Kennedyca4d8422015-01-15 15:19:22 -08002378 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002379 data.enforceInterface(IActivityManager.descriptor);
2380 IBinder parentActivityToken = data.readStrongBinder();
2381 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002382 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002383 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002384 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002385 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002386 if (activityContainer != null) {
2387 reply.writeInt(1);
2388 reply.writeStrongBinder(activityContainer.asBinder());
2389 } else {
2390 reply.writeInt(0);
2391 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002392 return true;
2393 }
2394
Craig Mautner95da1082014-02-24 17:54:35 -08002395 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2396 data.enforceInterface(IActivityManager.descriptor);
2397 IActivityContainer activityContainer =
2398 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2399 deleteActivityContainer(activityContainer);
2400 reply.writeNoException();
2401 return true;
2402 }
2403
Todd Kennedy4900bf92015-01-16 16:05:14 -08002404 case CREATE_STACK_ON_DISPLAY: {
2405 data.enforceInterface(IActivityManager.descriptor);
2406 int displayId = data.readInt();
2407 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2408 reply.writeNoException();
2409 if (activityContainer != null) {
2410 reply.writeInt(1);
2411 reply.writeStrongBinder(activityContainer.asBinder());
2412 } else {
2413 reply.writeInt(0);
2414 }
2415 return true;
2416 }
2417
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002418 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002419 data.enforceInterface(IActivityManager.descriptor);
2420 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002421 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002422 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002423 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002424 return true;
2425 }
2426
Craig Mautneraea74a52014-03-08 14:23:10 -08002427 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2428 data.enforceInterface(IActivityManager.descriptor);
2429 final int taskId = data.readInt();
2430 startLockTaskMode(taskId);
2431 reply.writeNoException();
2432 return true;
2433 }
2434
2435 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2436 data.enforceInterface(IActivityManager.descriptor);
2437 IBinder token = data.readStrongBinder();
2438 startLockTaskMode(token);
2439 reply.writeNoException();
2440 return true;
2441 }
2442
Craig Mautnerd61dc202014-07-07 11:09:11 -07002443 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002444 data.enforceInterface(IActivityManager.descriptor);
2445 startLockTaskModeOnCurrent();
2446 reply.writeNoException();
2447 return true;
2448 }
2449
Craig Mautneraea74a52014-03-08 14:23:10 -08002450 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2451 data.enforceInterface(IActivityManager.descriptor);
2452 stopLockTaskMode();
2453 reply.writeNoException();
2454 return true;
2455 }
2456
Craig Mautnerd61dc202014-07-07 11:09:11 -07002457 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002458 data.enforceInterface(IActivityManager.descriptor);
2459 stopLockTaskModeOnCurrent();
2460 reply.writeNoException();
2461 return true;
2462 }
2463
Craig Mautneraea74a52014-03-08 14:23:10 -08002464 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2465 data.enforceInterface(IActivityManager.descriptor);
2466 final boolean isInLockTaskMode = isInLockTaskMode();
2467 reply.writeNoException();
2468 reply.writeInt(isInLockTaskMode ? 1 : 0);
2469 return true;
2470 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002471
Benjamin Franz43261142015-02-11 15:59:44 +00002472 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2473 data.enforceInterface(IActivityManager.descriptor);
2474 final int lockTaskModeState = getLockTaskModeState();
2475 reply.writeNoException();
2476 reply.writeInt(lockTaskModeState);
2477 return true;
2478 }
2479
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002480 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2481 data.enforceInterface(IActivityManager.descriptor);
2482 final IBinder token = data.readStrongBinder();
2483 showLockTaskEscapeMessage(token);
2484 reply.writeNoException();
2485 return true;
2486 }
2487
Winson Chunga449dc02014-05-16 11:15:04 -07002488 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002489 data.enforceInterface(IActivityManager.descriptor);
2490 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002491 ActivityManager.TaskDescription values =
2492 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2493 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002494 reply.writeNoException();
2495 return true;
2496 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002497
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002498 case SET_TASK_RESIZEABLE_TRANSACTION: {
2499 data.enforceInterface(IActivityManager.descriptor);
2500 int taskId = data.readInt();
2501 boolean resizeable = (data.readInt() == 1) ? true : false;
2502 setTaskResizeable(taskId, resizeable);
2503 reply.writeNoException();
2504 return true;
2505 }
2506
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002507 case RESIZE_TASK_TRANSACTION: {
2508 data.enforceInterface(IActivityManager.descriptor);
2509 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002510 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002511 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002512 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002513 reply.writeNoException();
2514 return true;
2515 }
2516
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002517 case GET_TASK_BOUNDS_TRANSACTION: {
2518 data.enforceInterface(IActivityManager.descriptor);
2519 int taskId = data.readInt();
2520 Rect r = getTaskBounds(taskId);
2521 reply.writeNoException();
2522 r.writeToParcel(reply, 0);
2523 return true;
2524 }
2525
Craig Mautner648f69b2014-09-18 14:16:26 -07002526 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2527 data.enforceInterface(IActivityManager.descriptor);
2528 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002529 int userId = data.readInt();
2530 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002531 reply.writeNoException();
2532 if (icon == null) {
2533 reply.writeInt(0);
2534 } else {
2535 reply.writeInt(1);
2536 icon.writeToParcel(reply, 0);
2537 }
2538 return true;
2539 }
2540
Winson Chung044d5292014-11-06 11:05:19 -08002541 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2542 data.enforceInterface(IActivityManager.descriptor);
2543 final Bundle bundle;
2544 if (data.readInt() == 0) {
2545 bundle = null;
2546 } else {
2547 bundle = data.readBundle();
2548 }
Chong Zhang280d3322015-11-03 17:27:26 -08002549 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002550 startInPlaceAnimationOnFrontMostApplication(options);
2551 reply.writeNoException();
2552 return true;
2553 }
2554
Jose Lima4b6c6692014-08-12 17:41:12 -07002555 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002556 data.enforceInterface(IActivityManager.descriptor);
2557 IBinder token = data.readStrongBinder();
2558 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002559 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002560 reply.writeNoException();
2561 reply.writeInt(success ? 1 : 0);
2562 return true;
2563 }
2564
Jose Lima4b6c6692014-08-12 17:41:12 -07002565 case IS_BACKGROUND_VISIBLE_BEHIND_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 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002569 reply.writeNoException();
2570 reply.writeInt(enabled ? 1 : 0);
2571 return true;
2572 }
2573
Jose Lima4b6c6692014-08-12 17:41:12 -07002574 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002575 data.enforceInterface(IActivityManager.descriptor);
2576 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002577 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002578 reply.writeNoException();
2579 return true;
2580 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002581
2582 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2583 data.enforceInterface(IActivityManager.descriptor);
2584 IBinder token = data.readStrongBinder();
2585 notifyLaunchTaskBehindComplete(token);
2586 reply.writeNoException();
2587 return true;
2588 }
Craig Mautner8746a472014-07-24 15:12:54 -07002589
2590 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2591 data.enforceInterface(IActivityManager.descriptor);
2592 IBinder token = data.readStrongBinder();
2593 notifyEnterAnimationComplete(token);
2594 reply.writeNoException();
2595 return true;
2596 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002597
2598 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2599 data.enforceInterface(IActivityManager.descriptor);
2600 bootAnimationComplete();
2601 reply.writeNoException();
2602 return true;
2603 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002604
Jeff Sharkey605eb792014-11-04 13:34:06 -08002605 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2606 data.enforceInterface(IActivityManager.descriptor);
2607 final int uid = data.readInt();
2608 final byte[] firstPacket = data.createByteArray();
2609 notifyCleartextNetwork(uid, firstPacket);
2610 reply.writeNoException();
2611 return true;
2612 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002613
2614 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2615 data.enforceInterface(IActivityManager.descriptor);
2616 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002617 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002618 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002619 String reportPackage = data.readString();
2620 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002621 reply.writeNoException();
2622 return true;
2623 }
2624
2625 case DUMP_HEAP_FINISHED_TRANSACTION: {
2626 data.enforceInterface(IActivityManager.descriptor);
2627 String path = data.readString();
2628 dumpHeapFinished(path);
2629 reply.writeNoException();
2630 return true;
2631 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002632
2633 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2634 data.enforceInterface(IActivityManager.descriptor);
2635 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2636 data.readStrongBinder());
2637 boolean keepAwake = data.readInt() != 0;
2638 setVoiceKeepAwake(session, keepAwake);
2639 reply.writeNoException();
2640 return true;
2641 }
Craig Mautnere5600772015-04-03 21:36:37 -07002642
2643 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2644 data.enforceInterface(IActivityManager.descriptor);
2645 int userId = data.readInt();
2646 String[] packages = data.readStringArray();
2647 updateLockTaskPackages(userId, packages);
2648 reply.writeNoException();
2649 return true;
2650 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002651
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002652 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2653 data.enforceInterface(IActivityManager.descriptor);
2654 String packageName = data.readString();
2655 updateDeviceOwner(packageName);
2656 reply.writeNoException();
2657 return true;
2658 }
2659
Dianne Hackborn1e383822015-04-10 14:02:33 -07002660 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2661 data.enforceInterface(IActivityManager.descriptor);
2662 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002663 String callingPackage = data.readString();
2664 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002665 reply.writeNoException();
2666 reply.writeInt(res);
2667 return true;
2668 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002669
2670 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2671 data.enforceInterface(IActivityManager.descriptor);
2672 String process = data.readString();
2673 int userId = data.readInt();
2674 int level = data.readInt();
2675 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2676 reply.writeNoException();
2677 reply.writeInt(res ? 1 : 0);
2678 return true;
2679 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002680
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002681 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2682 data.enforceInterface(IActivityManager.descriptor);
2683 IBinder token = data.readStrongBinder();
2684 boolean res = isRootVoiceInteraction(token);
2685 reply.writeNoException();
2686 reply.writeInt(res ? 1 : 0);
2687 return true;
2688 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002689
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002690 case START_BINDER_TRACKING_TRANSACTION: {
2691 data.enforceInterface(IActivityManager.descriptor);
2692 boolean res = startBinderTracking();
2693 reply.writeNoException();
2694 reply.writeInt(res ? 1 : 0);
2695 return true;
2696 }
2697
2698 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2699 data.enforceInterface(IActivityManager.descriptor);
2700 ParcelFileDescriptor fd = data.readInt() != 0
2701 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2702 boolean res = stopBinderTrackingAndDump(fd);
2703 reply.writeNoException();
2704 reply.writeInt(res ? 1 : 0);
2705 return true;
2706 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002707 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2708 data.enforceInterface(IActivityManager.descriptor);
2709 IBinder token = data.readStrongBinder();
2710 int stackId = getActivityStackId(token);
2711 reply.writeNoException();
2712 reply.writeInt(stackId);
2713 return true;
2714 }
2715 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2716 data.enforceInterface(IActivityManager.descriptor);
2717 IBinder token = data.readStrongBinder();
2718 int stackId = data.readInt();
2719 moveActivityToStack(token, stackId);
2720 reply.writeNoException();
2721 return true;
2722 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002723 case REPORT_SIZE_CONFIGURATIONS: {
2724 data.enforceInterface(IActivityManager.descriptor);
2725 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002726 int[] horizontal = readIntArray(data);
2727 int[] vertical = readIntArray(data);
2728 int[] smallest = readIntArray(data);
2729 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002730 return true;
2731 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002732 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2733 data.enforceInterface(IActivityManager.descriptor);
2734 final boolean suppress = data.readInt() == 1;
2735 suppressResizeConfigChanges(suppress);
2736 reply.writeNoException();
2737 return true;
2738 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002739 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002740 data.enforceInterface(IActivityManager.descriptor);
2741 final int stackId = data.readInt();
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002742 moveTasksToFullscreenStack(stackId);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002743 reply.writeNoException();
2744 return true;
2745 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002746 case GET_APP_START_MODE_TRANSACTION: {
2747 data.enforceInterface(IActivityManager.descriptor);
2748 final int uid = data.readInt();
2749 final String pkg = data.readString();
2750 int res = getAppStartMode(uid, pkg);
2751 reply.writeNoException();
2752 reply.writeInt(res);
2753 return true;
2754 }
Wale Ogunwale5f986092015-12-04 15:35:38 -08002755 case IN_MULTI_WINDOW_MODE_TRANSACTION: {
2756 data.enforceInterface(IActivityManager.descriptor);
2757 final IBinder token = data.readStrongBinder();
2758 final boolean multiWindowMode = inMultiWindowMode(token);
2759 reply.writeNoException();
2760 reply.writeInt(multiWindowMode ? 1 : 0);
2761 return true;
2762 }
2763 case IN_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2764 data.enforceInterface(IActivityManager.descriptor);
2765 final IBinder token = data.readStrongBinder();
2766 final boolean pipMode = inPictureInPictureMode(token);
2767 reply.writeNoException();
2768 reply.writeInt(pipMode ? 1 : 0);
2769 return true;
2770 }
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002771 case ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2772 data.enforceInterface(IActivityManager.descriptor);
2773 final IBinder token = data.readStrongBinder();
2774 enterPictureInPictureMode(token);
2775 reply.writeNoException();
2776 return true;
2777 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002778 case SET_VR_MODE_TRANSACTION: {
2779 data.enforceInterface(IActivityManager.descriptor);
2780 final IBinder token = data.readStrongBinder();
2781 final boolean enable = data.readInt() == 1;
2782 setVrMode(token, enable);
2783 reply.writeNoException();
2784 return true;
2785 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002786 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002787
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002788 return super.onTransact(code, data, reply, flags);
2789 }
2790
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002791 private int[] readIntArray(Parcel data) {
2792 int[] smallest = null;
2793 int smallestSize = data.readInt();
2794 if (smallestSize > 0) {
2795 smallest = new int[smallestSize];
2796 data.readIntArray(smallest);
2797 }
2798 return smallest;
2799 }
2800
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002801 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002802 return this;
2803 }
2804
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002805 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2806 protected IActivityManager create() {
2807 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002808 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002809 Log.v("ActivityManager", "default service binder = " + b);
2810 }
2811 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002812 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002813 Log.v("ActivityManager", "default service = " + am);
2814 }
2815 return am;
2816 }
2817 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818}
2819
2820class ActivityManagerProxy implements IActivityManager
2821{
2822 public ActivityManagerProxy(IBinder remote)
2823 {
2824 mRemote = remote;
2825 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002826
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002827 public IBinder asBinder()
2828 {
2829 return mRemote;
2830 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002831
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002832 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002833 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002834 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002835 Parcel data = Parcel.obtain();
2836 Parcel reply = Parcel.obtain();
2837 data.writeInterfaceToken(IActivityManager.descriptor);
2838 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002839 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002840 intent.writeToParcel(data, 0);
2841 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002842 data.writeStrongBinder(resultTo);
2843 data.writeString(resultWho);
2844 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002845 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002846 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002847 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002848 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002849 } else {
2850 data.writeInt(0);
2851 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002852 if (options != null) {
2853 data.writeInt(1);
2854 options.writeToParcel(data, 0);
2855 } else {
2856 data.writeInt(0);
2857 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002858 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2859 reply.readException();
2860 int result = reply.readInt();
2861 reply.recycle();
2862 data.recycle();
2863 return result;
2864 }
Amith Yamasani82644082012-08-03 13:09:11 -07002865
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002866 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002867 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002868 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2869 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002870 Parcel data = Parcel.obtain();
2871 Parcel reply = Parcel.obtain();
2872 data.writeInterfaceToken(IActivityManager.descriptor);
2873 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002874 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002875 intent.writeToParcel(data, 0);
2876 data.writeString(resolvedType);
2877 data.writeStrongBinder(resultTo);
2878 data.writeString(resultWho);
2879 data.writeInt(requestCode);
2880 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002881 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002882 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002883 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002884 } else {
2885 data.writeInt(0);
2886 }
2887 if (options != null) {
2888 data.writeInt(1);
2889 options.writeToParcel(data, 0);
2890 } else {
2891 data.writeInt(0);
2892 }
2893 data.writeInt(userId);
2894 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2895 reply.readException();
2896 int result = reply.readInt();
2897 reply.recycle();
2898 data.recycle();
2899 return result;
2900 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002901 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2902 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002903 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2904 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002905 Parcel data = Parcel.obtain();
2906 Parcel reply = Parcel.obtain();
2907 data.writeInterfaceToken(IActivityManager.descriptor);
2908 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2909 data.writeString(callingPackage);
2910 intent.writeToParcel(data, 0);
2911 data.writeString(resolvedType);
2912 data.writeStrongBinder(resultTo);
2913 data.writeString(resultWho);
2914 data.writeInt(requestCode);
2915 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002916 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002917 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002918 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002919 } else {
2920 data.writeInt(0);
2921 }
2922 if (options != null) {
2923 data.writeInt(1);
2924 options.writeToParcel(data, 0);
2925 } else {
2926 data.writeInt(0);
2927 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002928 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002929 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002930 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2931 reply.readException();
2932 int result = reply.readInt();
2933 reply.recycle();
2934 data.recycle();
2935 return result;
2936 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002937 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2938 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002939 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2940 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
2944 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002945 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002946 intent.writeToParcel(data, 0);
2947 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002948 data.writeStrongBinder(resultTo);
2949 data.writeString(resultWho);
2950 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002951 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002952 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002953 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002954 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002955 } else {
2956 data.writeInt(0);
2957 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002958 if (options != null) {
2959 data.writeInt(1);
2960 options.writeToParcel(data, 0);
2961 } else {
2962 data.writeInt(0);
2963 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002964 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002965 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2966 reply.readException();
2967 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2968 reply.recycle();
2969 data.recycle();
2970 return result;
2971 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002972 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2973 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002974 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002975 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002976 Parcel data = Parcel.obtain();
2977 Parcel reply = Parcel.obtain();
2978 data.writeInterfaceToken(IActivityManager.descriptor);
2979 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002980 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002981 intent.writeToParcel(data, 0);
2982 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002983 data.writeStrongBinder(resultTo);
2984 data.writeString(resultWho);
2985 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002986 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002987 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002988 if (options != null) {
2989 data.writeInt(1);
2990 options.writeToParcel(data, 0);
2991 } else {
2992 data.writeInt(0);
2993 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002994 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002995 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2996 reply.readException();
2997 int result = reply.readInt();
2998 reply.recycle();
2999 data.recycle();
3000 return result;
3001 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003002 public int startActivityIntentSender(IApplicationThread caller,
3003 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003004 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003005 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003006 Parcel data = Parcel.obtain();
3007 Parcel reply = Parcel.obtain();
3008 data.writeInterfaceToken(IActivityManager.descriptor);
3009 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3010 intent.writeToParcel(data, 0);
3011 if (fillInIntent != null) {
3012 data.writeInt(1);
3013 fillInIntent.writeToParcel(data, 0);
3014 } else {
3015 data.writeInt(0);
3016 }
3017 data.writeString(resolvedType);
3018 data.writeStrongBinder(resultTo);
3019 data.writeString(resultWho);
3020 data.writeInt(requestCode);
3021 data.writeInt(flagsMask);
3022 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003023 if (options != null) {
3024 data.writeInt(1);
3025 options.writeToParcel(data, 0);
3026 } else {
3027 data.writeInt(0);
3028 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003029 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003030 reply.readException();
3031 int result = reply.readInt();
3032 reply.recycle();
3033 data.recycle();
3034 return result;
3035 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003036 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3037 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003038 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3039 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003040 Parcel data = Parcel.obtain();
3041 Parcel reply = Parcel.obtain();
3042 data.writeInterfaceToken(IActivityManager.descriptor);
3043 data.writeString(callingPackage);
3044 data.writeInt(callingPid);
3045 data.writeInt(callingUid);
3046 intent.writeToParcel(data, 0);
3047 data.writeString(resolvedType);
3048 data.writeStrongBinder(session.asBinder());
3049 data.writeStrongBinder(interactor.asBinder());
3050 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003051 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003052 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003053 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003054 } else {
3055 data.writeInt(0);
3056 }
3057 if (options != null) {
3058 data.writeInt(1);
3059 options.writeToParcel(data, 0);
3060 } else {
3061 data.writeInt(0);
3062 }
3063 data.writeInt(userId);
3064 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3065 reply.readException();
3066 int result = reply.readInt();
3067 reply.recycle();
3068 data.recycle();
3069 return result;
3070 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003071 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003072 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003073 Parcel data = Parcel.obtain();
3074 Parcel reply = Parcel.obtain();
3075 data.writeInterfaceToken(IActivityManager.descriptor);
3076 data.writeStrongBinder(callingActivity);
3077 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003078 if (options != null) {
3079 data.writeInt(1);
3080 options.writeToParcel(data, 0);
3081 } else {
3082 data.writeInt(0);
3083 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003084 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 int result = reply.readInt();
3087 reply.recycle();
3088 data.recycle();
3089 return result != 0;
3090 }
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003091 public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
3092 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 data.writeInt(taskId);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003097 data.writeInt(launchStackId);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003098 if (options == null) {
3099 data.writeInt(0);
3100 } else {
3101 data.writeInt(1);
3102 options.writeToParcel(data, 0);
3103 }
3104 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3105 reply.readException();
3106 int result = reply.readInt();
3107 reply.recycle();
3108 data.recycle();
3109 return result;
3110 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003111 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003112 throws RemoteException {
3113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeStrongBinder(token);
3117 data.writeInt(resultCode);
3118 if (resultData != null) {
3119 data.writeInt(1);
3120 resultData.writeToParcel(data, 0);
3121 } else {
3122 data.writeInt(0);
3123 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003124 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003125 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3126 reply.readException();
3127 boolean res = reply.readInt() != 0;
3128 data.recycle();
3129 reply.recycle();
3130 return res;
3131 }
3132 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3133 {
3134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
3137 data.writeStrongBinder(token);
3138 data.writeString(resultWho);
3139 data.writeInt(requestCode);
3140 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3141 reply.readException();
3142 data.recycle();
3143 reply.recycle();
3144 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003145 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3146 Parcel data = Parcel.obtain();
3147 Parcel reply = Parcel.obtain();
3148 data.writeInterfaceToken(IActivityManager.descriptor);
3149 data.writeStrongBinder(token);
3150 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3151 reply.readException();
3152 boolean res = reply.readInt() != 0;
3153 data.recycle();
3154 reply.recycle();
3155 return res;
3156 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003157 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3158 Parcel data = Parcel.obtain();
3159 Parcel reply = Parcel.obtain();
3160 data.writeInterfaceToken(IActivityManager.descriptor);
3161 data.writeStrongBinder(session.asBinder());
3162 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 data.recycle();
3165 reply.recycle();
3166 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003167 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3168 Parcel data = Parcel.obtain();
3169 Parcel reply = Parcel.obtain();
3170 data.writeInterfaceToken(IActivityManager.descriptor);
3171 data.writeStrongBinder(token);
3172 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3173 reply.readException();
3174 boolean res = reply.readInt() != 0;
3175 data.recycle();
3176 reply.recycle();
3177 return res;
3178 }
3179 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3180 Parcel data = Parcel.obtain();
3181 Parcel reply = Parcel.obtain();
3182 data.writeInterfaceToken(IActivityManager.descriptor);
3183 data.writeStrongBinder(app.asBinder());
3184 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3185 reply.readException();
3186 data.recycle();
3187 reply.recycle();
3188 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003189 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3190 Parcel data = Parcel.obtain();
3191 Parcel reply = Parcel.obtain();
3192 data.writeInterfaceToken(IActivityManager.descriptor);
3193 data.writeStrongBinder(token);
3194 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3195 reply.readException();
3196 boolean res = reply.readInt() != 0;
3197 data.recycle();
3198 reply.recycle();
3199 return res;
3200 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003201 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003202 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003203 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003204 {
3205 Parcel data = Parcel.obtain();
3206 Parcel reply = Parcel.obtain();
3207 data.writeInterfaceToken(IActivityManager.descriptor);
3208 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003209 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003210 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3211 filter.writeToParcel(data, 0);
3212 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003213 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003214 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3215 reply.readException();
3216 Intent intent = null;
3217 int haveIntent = reply.readInt();
3218 if (haveIntent != 0) {
3219 intent = Intent.CREATOR.createFromParcel(reply);
3220 }
3221 reply.recycle();
3222 data.recycle();
3223 return intent;
3224 }
3225 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3226 {
3227 Parcel data = Parcel.obtain();
3228 Parcel reply = Parcel.obtain();
3229 data.writeInterfaceToken(IActivityManager.descriptor);
3230 data.writeStrongBinder(receiver.asBinder());
3231 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3232 reply.readException();
3233 data.recycle();
3234 reply.recycle();
3235 }
3236 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003237 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003239 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003240 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003241 {
3242 Parcel data = Parcel.obtain();
3243 Parcel reply = Parcel.obtain();
3244 data.writeInterfaceToken(IActivityManager.descriptor);
3245 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3246 intent.writeToParcel(data, 0);
3247 data.writeString(resolvedType);
3248 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3249 data.writeInt(resultCode);
3250 data.writeString(resultData);
3251 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003252 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003253 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003254 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 data.writeInt(serialized ? 1 : 0);
3256 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003257 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003258 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3259 reply.readException();
3260 int res = reply.readInt();
3261 reply.recycle();
3262 data.recycle();
3263 return res;
3264 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003265 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3266 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003267 {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3272 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003273 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003274 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3275 reply.readException();
3276 data.recycle();
3277 reply.recycle();
3278 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003279 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3280 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003281 {
3282 Parcel data = Parcel.obtain();
3283 Parcel reply = Parcel.obtain();
3284 data.writeInterfaceToken(IActivityManager.descriptor);
3285 data.writeStrongBinder(who);
3286 data.writeInt(resultCode);
3287 data.writeString(resultData);
3288 data.writeBundle(map);
3289 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003290 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003291 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3292 reply.readException();
3293 data.recycle();
3294 reply.recycle();
3295 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 public void attachApplication(IApplicationThread app) throws RemoteException
3297 {
3298 Parcel data = Parcel.obtain();
3299 Parcel reply = Parcel.obtain();
3300 data.writeInterfaceToken(IActivityManager.descriptor);
3301 data.writeStrongBinder(app.asBinder());
3302 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3303 reply.readException();
3304 data.recycle();
3305 reply.recycle();
3306 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003307 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3308 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003309 {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003314 if (config != null) {
3315 data.writeInt(1);
3316 config.writeToParcel(data, 0);
3317 } else {
3318 data.writeInt(0);
3319 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003320 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003321 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3322 reply.readException();
3323 data.recycle();
3324 reply.recycle();
3325 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003326 public void activityResumed(IBinder token) throws RemoteException
3327 {
3328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeStrongBinder(token);
3332 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3333 reply.readException();
3334 data.recycle();
3335 reply.recycle();
3336 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003337 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003338 {
3339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 data.writeStrongBinder(token);
3343 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3344 reply.readException();
3345 data.recycle();
3346 reply.recycle();
3347 }
3348 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003349 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 {
3351 Parcel data = Parcel.obtain();
3352 Parcel reply = Parcel.obtain();
3353 data.writeInterfaceToken(IActivityManager.descriptor);
3354 data.writeStrongBinder(token);
3355 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003356 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003357 TextUtils.writeToParcel(description, data, 0);
3358 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3359 reply.readException();
3360 data.recycle();
3361 reply.recycle();
3362 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003363 public void activitySlept(IBinder token) throws RemoteException
3364 {
3365 Parcel data = Parcel.obtain();
3366 Parcel reply = Parcel.obtain();
3367 data.writeInterfaceToken(IActivityManager.descriptor);
3368 data.writeStrongBinder(token);
3369 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3370 reply.readException();
3371 data.recycle();
3372 reply.recycle();
3373 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003374 public void activityDestroyed(IBinder token) throws RemoteException
3375 {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(token);
3380 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3381 reply.readException();
3382 data.recycle();
3383 reply.recycle();
3384 }
3385 public String getCallingPackage(IBinder token) throws RemoteException
3386 {
3387 Parcel data = Parcel.obtain();
3388 Parcel reply = Parcel.obtain();
3389 data.writeInterfaceToken(IActivityManager.descriptor);
3390 data.writeStrongBinder(token);
3391 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3392 reply.readException();
3393 String res = reply.readString();
3394 data.recycle();
3395 reply.recycle();
3396 return res;
3397 }
3398 public ComponentName getCallingActivity(IBinder token)
3399 throws RemoteException {
3400 Parcel data = Parcel.obtain();
3401 Parcel reply = Parcel.obtain();
3402 data.writeInterfaceToken(IActivityManager.descriptor);
3403 data.writeStrongBinder(token);
3404 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3405 reply.readException();
3406 ComponentName res = ComponentName.readFromParcel(reply);
3407 data.recycle();
3408 reply.recycle();
3409 return res;
3410 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003411 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003412 Parcel data = Parcel.obtain();
3413 Parcel reply = Parcel.obtain();
3414 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003415 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003416 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3417 reply.readException();
3418 ArrayList<IAppTask> list = null;
3419 int N = reply.readInt();
3420 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003421 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003422 while (N > 0) {
3423 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3424 list.add(task);
3425 N--;
3426 }
3427 }
3428 data.recycle();
3429 reply.recycle();
3430 return list;
3431 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003432 public int addAppTask(IBinder activityToken, Intent intent,
3433 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3434 Parcel data = Parcel.obtain();
3435 Parcel reply = Parcel.obtain();
3436 data.writeInterfaceToken(IActivityManager.descriptor);
3437 data.writeStrongBinder(activityToken);
3438 intent.writeToParcel(data, 0);
3439 description.writeToParcel(data, 0);
3440 thumbnail.writeToParcel(data, 0);
3441 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3442 reply.readException();
3443 int res = reply.readInt();
3444 data.recycle();
3445 reply.recycle();
3446 return res;
3447 }
3448 public Point getAppTaskThumbnailSize() throws RemoteException {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
3452 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3453 reply.readException();
3454 Point size = Point.CREATOR.createFromParcel(reply);
3455 data.recycle();
3456 reply.recycle();
3457 return size;
3458 }
Todd Kennedye635f662015-01-20 10:36:49 -08003459 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3460 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003461 Parcel data = Parcel.obtain();
3462 Parcel reply = Parcel.obtain();
3463 data.writeInterfaceToken(IActivityManager.descriptor);
3464 data.writeInt(maxNum);
3465 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003466 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3467 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003468 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003469 int N = reply.readInt();
3470 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003471 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003472 while (N > 0) {
3473 ActivityManager.RunningTaskInfo info =
3474 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003475 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003476 list.add(info);
3477 N--;
3478 }
3479 }
3480 data.recycle();
3481 reply.recycle();
3482 return list;
3483 }
3484 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003485 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 data.writeInt(maxNum);
3490 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003491 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3493 reply.readException();
3494 ArrayList<ActivityManager.RecentTaskInfo> list
3495 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3496 data.recycle();
3497 reply.recycle();
3498 return list;
3499 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003500 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003505 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003506 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003507 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003508 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003509 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003510 }
3511 data.recycle();
3512 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003513 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003514 }
Todd Kennedye635f662015-01-20 10:36:49 -08003515 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3516 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003517 Parcel data = Parcel.obtain();
3518 Parcel reply = Parcel.obtain();
3519 data.writeInterfaceToken(IActivityManager.descriptor);
3520 data.writeInt(maxNum);
3521 data.writeInt(flags);
3522 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3523 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003524 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003525 int N = reply.readInt();
3526 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003527 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003528 while (N > 0) {
3529 ActivityManager.RunningServiceInfo info =
3530 ActivityManager.RunningServiceInfo.CREATOR
3531 .createFromParcel(reply);
3532 list.add(info);
3533 N--;
3534 }
3535 }
3536 data.recycle();
3537 reply.recycle();
3538 return list;
3539 }
3540 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3541 throws RemoteException {
3542 Parcel data = Parcel.obtain();
3543 Parcel reply = Parcel.obtain();
3544 data.writeInterfaceToken(IActivityManager.descriptor);
3545 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3546 reply.readException();
3547 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3548 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3549 data.recycle();
3550 reply.recycle();
3551 return list;
3552 }
3553 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3554 throws RemoteException {
3555 Parcel data = Parcel.obtain();
3556 Parcel reply = Parcel.obtain();
3557 data.writeInterfaceToken(IActivityManager.descriptor);
3558 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3559 reply.readException();
3560 ArrayList<ActivityManager.RunningAppProcessInfo> list
3561 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3562 data.recycle();
3563 reply.recycle();
3564 return list;
3565 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003566 public List<ApplicationInfo> getRunningExternalApplications()
3567 throws RemoteException {
3568 Parcel data = Parcel.obtain();
3569 Parcel reply = Parcel.obtain();
3570 data.writeInterfaceToken(IActivityManager.descriptor);
3571 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3572 reply.readException();
3573 ArrayList<ApplicationInfo> list
3574 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3575 data.recycle();
3576 reply.recycle();
3577 return list;
3578 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003579 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003580 {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003585 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003586 if (options != null) {
3587 data.writeInt(1);
3588 options.writeToParcel(data, 0);
3589 } else {
3590 data.writeInt(0);
3591 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003592 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3593 reply.readException();
3594 data.recycle();
3595 reply.recycle();
3596 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003597 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3598 throws RemoteException {
3599 Parcel data = Parcel.obtain();
3600 Parcel reply = Parcel.obtain();
3601 data.writeInterfaceToken(IActivityManager.descriptor);
3602 data.writeStrongBinder(token);
3603 data.writeInt(nonRoot ? 1 : 0);
3604 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3605 reply.readException();
3606 boolean res = reply.readInt() != 0;
3607 data.recycle();
3608 reply.recycle();
3609 return res;
3610 }
3611 public void moveTaskBackwards(int task) throws RemoteException
3612 {
3613 Parcel data = Parcel.obtain();
3614 Parcel reply = Parcel.obtain();
3615 data.writeInterfaceToken(IActivityManager.descriptor);
3616 data.writeInt(task);
3617 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3618 reply.readException();
3619 data.recycle();
3620 reply.recycle();
3621 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003622 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003623 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3624 {
3625 Parcel data = Parcel.obtain();
3626 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003627 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003628 data.writeInt(taskId);
3629 data.writeInt(stackId);
3630 data.writeInt(toTop ? 1 : 0);
3631 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3632 reply.readException();
3633 data.recycle();
3634 reply.recycle();
3635 }
3636 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003637 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3638 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003639 {
3640 Parcel data = Parcel.obtain();
3641 Parcel reply = Parcel.obtain();
3642 data.writeInterfaceToken(IActivityManager.descriptor);
3643 data.writeInt(taskId);
3644 data.writeInt(createMode);
3645 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003646 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003647 if (initialBounds != null) {
3648 data.writeInt(1);
3649 initialBounds.writeToParcel(data, 0);
3650 } else {
3651 data.writeInt(0);
3652 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003653 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3654 reply.readException();
3655 data.recycle();
3656 reply.recycle();
3657 }
3658 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003659 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3660 throws RemoteException
3661 {
3662 Parcel data = Parcel.obtain();
3663 Parcel reply = Parcel.obtain();
3664 data.writeInterfaceToken(IActivityManager.descriptor);
3665 data.writeInt(stackId);
3666 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003667 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003668 reply.readException();
3669 final boolean res = reply.readInt() != 0;
3670 data.recycle();
3671 reply.recycle();
3672 return res;
3673 }
3674 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003675 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3676 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003677 {
3678 Parcel data = Parcel.obtain();
3679 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003680 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003681 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003682 if (r != null) {
3683 data.writeInt(1);
3684 r.writeToParcel(data, 0);
3685 } else {
3686 data.writeInt(0);
3687 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003688 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003689 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003690 reply.readException();
3691 data.recycle();
3692 reply.recycle();
3693 }
Craig Mautner967212c2013-04-13 21:10:58 -07003694 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003695 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3696 {
3697 Parcel data = Parcel.obtain();
3698 Parcel reply = Parcel.obtain();
3699 data.writeInterfaceToken(IActivityManager.descriptor);
3700 data.writeInt(taskId);
3701 data.writeInt(stackId);
3702 data.writeInt(position);
3703 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3704 reply.readException();
3705 data.recycle();
3706 reply.recycle();
3707 }
3708 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003709 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003710 {
3711 Parcel data = Parcel.obtain();
3712 Parcel reply = Parcel.obtain();
3713 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003714 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003715 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003716 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003717 data.recycle();
3718 reply.recycle();
3719 return list;
3720 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003721 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003722 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003723 {
3724 Parcel data = Parcel.obtain();
3725 Parcel reply = Parcel.obtain();
3726 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003727 data.writeInt(stackId);
3728 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003729 reply.readException();
3730 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003731 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003732 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003733 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003734 }
3735 data.recycle();
3736 reply.recycle();
3737 return info;
3738 }
3739 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003740 public boolean isInHomeStack(int taskId) throws RemoteException {
3741 Parcel data = Parcel.obtain();
3742 Parcel reply = Parcel.obtain();
3743 data.writeInterfaceToken(IActivityManager.descriptor);
3744 data.writeInt(taskId);
3745 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3746 reply.readException();
3747 boolean isInHomeStack = reply.readInt() > 0;
3748 data.recycle();
3749 reply.recycle();
3750 return isInHomeStack;
3751 }
3752 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003753 public void setFocusedStack(int stackId) throws RemoteException
3754 {
3755 Parcel data = Parcel.obtain();
3756 Parcel reply = Parcel.obtain();
3757 data.writeInterfaceToken(IActivityManager.descriptor);
3758 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003759 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003760 reply.readException();
3761 data.recycle();
3762 reply.recycle();
3763 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003764 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003765 public int getFocusedStackId() throws RemoteException {
3766 Parcel data = Parcel.obtain();
3767 Parcel reply = Parcel.obtain();
3768 data.writeInterfaceToken(IActivityManager.descriptor);
3769 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3770 reply.readException();
3771 int focusedStackId = reply.readInt();
3772 data.recycle();
3773 reply.recycle();
3774 return focusedStackId;
3775 }
3776 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003777 public void setFocusedTask(int taskId) throws RemoteException
3778 {
3779 Parcel data = Parcel.obtain();
3780 Parcel reply = Parcel.obtain();
3781 data.writeInterfaceToken(IActivityManager.descriptor);
3782 data.writeInt(taskId);
3783 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 data.recycle();
3786 reply.recycle();
3787 }
3788 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003789 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3790 {
3791 Parcel data = Parcel.obtain();
3792 Parcel reply = Parcel.obtain();
3793 data.writeInterfaceToken(IActivityManager.descriptor);
3794 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003795 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003796 reply.readException();
3797 data.recycle();
3798 reply.recycle();
3799 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003800 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3801 {
3802 Parcel data = Parcel.obtain();
3803 Parcel reply = Parcel.obtain();
3804 data.writeInterfaceToken(IActivityManager.descriptor);
3805 data.writeStrongBinder(token);
3806 data.writeInt(onlyRoot ? 1 : 0);
3807 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3808 reply.readException();
3809 int res = reply.readInt();
3810 data.recycle();
3811 reply.recycle();
3812 return res;
3813 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003814 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003815 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003816 Parcel data = Parcel.obtain();
3817 Parcel reply = Parcel.obtain();
3818 data.writeInterfaceToken(IActivityManager.descriptor);
3819 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3820 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003821 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003822 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003823 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3824 reply.readException();
3825 int res = reply.readInt();
3826 ContentProviderHolder cph = null;
3827 if (res != 0) {
3828 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3829 }
3830 data.recycle();
3831 reply.recycle();
3832 return cph;
3833 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003834 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3835 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
3839 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003840 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003841 data.writeStrongBinder(token);
3842 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3843 reply.readException();
3844 int res = reply.readInt();
3845 ContentProviderHolder cph = null;
3846 if (res != 0) {
3847 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3848 }
3849 data.recycle();
3850 reply.recycle();
3851 return cph;
3852 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003854 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003855 {
3856 Parcel data = Parcel.obtain();
3857 Parcel reply = Parcel.obtain();
3858 data.writeInterfaceToken(IActivityManager.descriptor);
3859 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3860 data.writeTypedList(providers);
3861 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3862 reply.readException();
3863 data.recycle();
3864 reply.recycle();
3865 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003866 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3867 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003868 Parcel data = Parcel.obtain();
3869 Parcel reply = Parcel.obtain();
3870 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003871 data.writeStrongBinder(connection);
3872 data.writeInt(stable);
3873 data.writeInt(unstable);
3874 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3875 reply.readException();
3876 boolean res = reply.readInt() != 0;
3877 data.recycle();
3878 reply.recycle();
3879 return res;
3880 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003881
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003882 public void unstableProviderDied(IBinder connection) throws RemoteException {
3883 Parcel data = Parcel.obtain();
3884 Parcel reply = Parcel.obtain();
3885 data.writeInterfaceToken(IActivityManager.descriptor);
3886 data.writeStrongBinder(connection);
3887 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3888 reply.readException();
3889 data.recycle();
3890 reply.recycle();
3891 }
3892
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003893 @Override
3894 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3895 Parcel data = Parcel.obtain();
3896 Parcel reply = Parcel.obtain();
3897 data.writeInterfaceToken(IActivityManager.descriptor);
3898 data.writeStrongBinder(connection);
3899 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3900 reply.readException();
3901 data.recycle();
3902 reply.recycle();
3903 }
3904
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003905 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3906 Parcel data = Parcel.obtain();
3907 Parcel reply = Parcel.obtain();
3908 data.writeInterfaceToken(IActivityManager.descriptor);
3909 data.writeStrongBinder(connection);
3910 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003911 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 data.recycle();
3914 reply.recycle();
3915 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003916
3917 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 data.writeString(name);
3922 data.writeStrongBinder(token);
3923 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3924 reply.readException();
3925 data.recycle();
3926 reply.recycle();
3927 }
3928
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003929 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3930 throws RemoteException
3931 {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 service.writeToParcel(data, 0);
3936 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3937 reply.readException();
3938 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3939 data.recycle();
3940 reply.recycle();
3941 return res;
3942 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003943
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003944 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003945 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003946 {
3947 Parcel data = Parcel.obtain();
3948 Parcel reply = Parcel.obtain();
3949 data.writeInterfaceToken(IActivityManager.descriptor);
3950 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3951 service.writeToParcel(data, 0);
3952 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003953 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003954 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003955 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3956 reply.readException();
3957 ComponentName res = ComponentName.readFromParcel(reply);
3958 data.recycle();
3959 reply.recycle();
3960 return res;
3961 }
3962 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003963 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003964 {
3965 Parcel data = Parcel.obtain();
3966 Parcel reply = Parcel.obtain();
3967 data.writeInterfaceToken(IActivityManager.descriptor);
3968 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3969 service.writeToParcel(data, 0);
3970 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003971 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003972 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3973 reply.readException();
3974 int res = reply.readInt();
3975 reply.recycle();
3976 data.recycle();
3977 return res;
3978 }
3979 public boolean stopServiceToken(ComponentName className, IBinder token,
3980 int startId) throws RemoteException {
3981 Parcel data = Parcel.obtain();
3982 Parcel reply = Parcel.obtain();
3983 data.writeInterfaceToken(IActivityManager.descriptor);
3984 ComponentName.writeToParcel(className, data);
3985 data.writeStrongBinder(token);
3986 data.writeInt(startId);
3987 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3988 reply.readException();
3989 boolean res = reply.readInt() != 0;
3990 data.recycle();
3991 reply.recycle();
3992 return res;
3993 }
3994 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003995 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003996 Parcel data = Parcel.obtain();
3997 Parcel reply = Parcel.obtain();
3998 data.writeInterfaceToken(IActivityManager.descriptor);
3999 ComponentName.writeToParcel(className, data);
4000 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004001 data.writeInt(id);
4002 if (notification != null) {
4003 data.writeInt(1);
4004 notification.writeToParcel(data, 0);
4005 } else {
4006 data.writeInt(0);
4007 }
4008 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004009 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4010 reply.readException();
4011 data.recycle();
4012 reply.recycle();
4013 }
4014 public int bindService(IApplicationThread caller, IBinder token,
4015 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004016 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004017 Parcel data = Parcel.obtain();
4018 Parcel reply = Parcel.obtain();
4019 data.writeInterfaceToken(IActivityManager.descriptor);
4020 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4021 data.writeStrongBinder(token);
4022 service.writeToParcel(data, 0);
4023 data.writeString(resolvedType);
4024 data.writeStrongBinder(connection.asBinder());
4025 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004026 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004027 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004028 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4029 reply.readException();
4030 int res = reply.readInt();
4031 data.recycle();
4032 reply.recycle();
4033 return res;
4034 }
4035 public boolean unbindService(IServiceConnection connection) throws RemoteException
4036 {
4037 Parcel data = Parcel.obtain();
4038 Parcel reply = Parcel.obtain();
4039 data.writeInterfaceToken(IActivityManager.descriptor);
4040 data.writeStrongBinder(connection.asBinder());
4041 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4042 reply.readException();
4043 boolean res = reply.readInt() != 0;
4044 data.recycle();
4045 reply.recycle();
4046 return res;
4047 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004048
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004049 public void publishService(IBinder token,
4050 Intent intent, IBinder service) throws RemoteException {
4051 Parcel data = Parcel.obtain();
4052 Parcel reply = Parcel.obtain();
4053 data.writeInterfaceToken(IActivityManager.descriptor);
4054 data.writeStrongBinder(token);
4055 intent.writeToParcel(data, 0);
4056 data.writeStrongBinder(service);
4057 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4058 reply.readException();
4059 data.recycle();
4060 reply.recycle();
4061 }
4062
4063 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4064 throws RemoteException {
4065 Parcel data = Parcel.obtain();
4066 Parcel reply = Parcel.obtain();
4067 data.writeInterfaceToken(IActivityManager.descriptor);
4068 data.writeStrongBinder(token);
4069 intent.writeToParcel(data, 0);
4070 data.writeInt(doRebind ? 1 : 0);
4071 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4072 reply.readException();
4073 data.recycle();
4074 reply.recycle();
4075 }
4076
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004077 public void serviceDoneExecuting(IBinder token, int type, int startId,
4078 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004083 data.writeInt(type);
4084 data.writeInt(startId);
4085 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004086 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4087 reply.readException();
4088 data.recycle();
4089 reply.recycle();
4090 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004091
Svet Ganov99b60432015-06-27 13:15:22 -07004092 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4093 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004094 Parcel data = Parcel.obtain();
4095 Parcel reply = Parcel.obtain();
4096 data.writeInterfaceToken(IActivityManager.descriptor);
4097 service.writeToParcel(data, 0);
4098 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004099 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004100 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4101 reply.readException();
4102 IBinder binder = reply.readStrongBinder();
4103 reply.recycle();
4104 data.recycle();
4105 return binder;
4106 }
4107
Christopher Tate181fafa2009-05-14 11:12:14 -07004108 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4109 throws RemoteException {
4110 Parcel data = Parcel.obtain();
4111 Parcel reply = Parcel.obtain();
4112 data.writeInterfaceToken(IActivityManager.descriptor);
4113 app.writeToParcel(data, 0);
4114 data.writeInt(backupRestoreMode);
4115 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4116 reply.readException();
4117 boolean success = reply.readInt() != 0;
4118 reply.recycle();
4119 data.recycle();
4120 return success;
4121 }
4122
Christopher Tate346acb12012-10-15 19:20:25 -07004123 public void clearPendingBackup() throws RemoteException {
4124 Parcel data = Parcel.obtain();
4125 Parcel reply = Parcel.obtain();
4126 data.writeInterfaceToken(IActivityManager.descriptor);
4127 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4128 reply.recycle();
4129 data.recycle();
4130 }
4131
Christopher Tate181fafa2009-05-14 11:12:14 -07004132 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4133 Parcel data = Parcel.obtain();
4134 Parcel reply = Parcel.obtain();
4135 data.writeInterfaceToken(IActivityManager.descriptor);
4136 data.writeString(packageName);
4137 data.writeStrongBinder(agent);
4138 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4139 reply.recycle();
4140 data.recycle();
4141 }
4142
4143 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4144 Parcel data = Parcel.obtain();
4145 Parcel reply = Parcel.obtain();
4146 data.writeInterfaceToken(IActivityManager.descriptor);
4147 app.writeToParcel(data, 0);
4148 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4149 reply.readException();
4150 reply.recycle();
4151 data.recycle();
4152 }
4153
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004154 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004155 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004156 IUiAutomationConnection connection, int userId, String instructionSet)
4157 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004158 Parcel data = Parcel.obtain();
4159 Parcel reply = Parcel.obtain();
4160 data.writeInterfaceToken(IActivityManager.descriptor);
4161 ComponentName.writeToParcel(className, data);
4162 data.writeString(profileFile);
4163 data.writeInt(flags);
4164 data.writeBundle(arguments);
4165 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004166 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004167 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004168 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004169 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4170 reply.readException();
4171 boolean res = reply.readInt() != 0;
4172 reply.recycle();
4173 data.recycle();
4174 return res;
4175 }
4176
4177 public void finishInstrumentation(IApplicationThread target,
4178 int resultCode, Bundle results) throws RemoteException {
4179 Parcel data = Parcel.obtain();
4180 Parcel reply = Parcel.obtain();
4181 data.writeInterfaceToken(IActivityManager.descriptor);
4182 data.writeStrongBinder(target != null ? target.asBinder() : null);
4183 data.writeInt(resultCode);
4184 data.writeBundle(results);
4185 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4186 reply.readException();
4187 data.recycle();
4188 reply.recycle();
4189 }
4190 public Configuration getConfiguration() throws RemoteException
4191 {
4192 Parcel data = Parcel.obtain();
4193 Parcel reply = Parcel.obtain();
4194 data.writeInterfaceToken(IActivityManager.descriptor);
4195 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4196 reply.readException();
4197 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4198 reply.recycle();
4199 data.recycle();
4200 return res;
4201 }
4202 public void updateConfiguration(Configuration values) throws RemoteException
4203 {
4204 Parcel data = Parcel.obtain();
4205 Parcel reply = Parcel.obtain();
4206 data.writeInterfaceToken(IActivityManager.descriptor);
4207 values.writeToParcel(data, 0);
4208 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4209 reply.readException();
4210 data.recycle();
4211 reply.recycle();
4212 }
4213 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4214 throws RemoteException {
4215 Parcel data = Parcel.obtain();
4216 Parcel reply = Parcel.obtain();
4217 data.writeInterfaceToken(IActivityManager.descriptor);
4218 data.writeStrongBinder(token);
4219 data.writeInt(requestedOrientation);
4220 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4221 reply.readException();
4222 data.recycle();
4223 reply.recycle();
4224 }
4225 public int getRequestedOrientation(IBinder token) throws RemoteException {
4226 Parcel data = Parcel.obtain();
4227 Parcel reply = Parcel.obtain();
4228 data.writeInterfaceToken(IActivityManager.descriptor);
4229 data.writeStrongBinder(token);
4230 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4231 reply.readException();
4232 int res = reply.readInt();
4233 data.recycle();
4234 reply.recycle();
4235 return res;
4236 }
4237 public ComponentName getActivityClassForToken(IBinder token)
4238 throws RemoteException {
4239 Parcel data = Parcel.obtain();
4240 Parcel reply = Parcel.obtain();
4241 data.writeInterfaceToken(IActivityManager.descriptor);
4242 data.writeStrongBinder(token);
4243 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4244 reply.readException();
4245 ComponentName res = ComponentName.readFromParcel(reply);
4246 data.recycle();
4247 reply.recycle();
4248 return res;
4249 }
4250 public String getPackageForToken(IBinder token) throws RemoteException
4251 {
4252 Parcel data = Parcel.obtain();
4253 Parcel reply = Parcel.obtain();
4254 data.writeInterfaceToken(IActivityManager.descriptor);
4255 data.writeStrongBinder(token);
4256 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4257 reply.readException();
4258 String res = reply.readString();
4259 data.recycle();
4260 reply.recycle();
4261 return res;
4262 }
4263 public IIntentSender getIntentSender(int type,
4264 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004265 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004266 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004267 Parcel data = Parcel.obtain();
4268 Parcel reply = Parcel.obtain();
4269 data.writeInterfaceToken(IActivityManager.descriptor);
4270 data.writeInt(type);
4271 data.writeString(packageName);
4272 data.writeStrongBinder(token);
4273 data.writeString(resultWho);
4274 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004275 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004276 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004277 data.writeTypedArray(intents, 0);
4278 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004279 } else {
4280 data.writeInt(0);
4281 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004282 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004283 if (options != null) {
4284 data.writeInt(1);
4285 options.writeToParcel(data, 0);
4286 } else {
4287 data.writeInt(0);
4288 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004289 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004290 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4291 reply.readException();
4292 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004293 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004294 data.recycle();
4295 reply.recycle();
4296 return res;
4297 }
4298 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4299 Parcel data = Parcel.obtain();
4300 Parcel reply = Parcel.obtain();
4301 data.writeInterfaceToken(IActivityManager.descriptor);
4302 data.writeStrongBinder(sender.asBinder());
4303 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4304 reply.readException();
4305 data.recycle();
4306 reply.recycle();
4307 }
4308 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4309 Parcel data = Parcel.obtain();
4310 Parcel reply = Parcel.obtain();
4311 data.writeInterfaceToken(IActivityManager.descriptor);
4312 data.writeStrongBinder(sender.asBinder());
4313 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4314 reply.readException();
4315 String res = reply.readString();
4316 data.recycle();
4317 reply.recycle();
4318 return res;
4319 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004320 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4321 Parcel data = Parcel.obtain();
4322 Parcel reply = Parcel.obtain();
4323 data.writeInterfaceToken(IActivityManager.descriptor);
4324 data.writeStrongBinder(sender.asBinder());
4325 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4326 reply.readException();
4327 int res = reply.readInt();
4328 data.recycle();
4329 reply.recycle();
4330 return res;
4331 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004332 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4333 boolean requireFull, String name, String callerPackage) throws RemoteException {
4334 Parcel data = Parcel.obtain();
4335 Parcel reply = Parcel.obtain();
4336 data.writeInterfaceToken(IActivityManager.descriptor);
4337 data.writeInt(callingPid);
4338 data.writeInt(callingUid);
4339 data.writeInt(userId);
4340 data.writeInt(allowAll ? 1 : 0);
4341 data.writeInt(requireFull ? 1 : 0);
4342 data.writeString(name);
4343 data.writeString(callerPackage);
4344 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4345 reply.readException();
4346 int res = reply.readInt();
4347 data.recycle();
4348 reply.recycle();
4349 return res;
4350 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004351 public void setProcessLimit(int max) throws RemoteException
4352 {
4353 Parcel data = Parcel.obtain();
4354 Parcel reply = Parcel.obtain();
4355 data.writeInterfaceToken(IActivityManager.descriptor);
4356 data.writeInt(max);
4357 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4358 reply.readException();
4359 data.recycle();
4360 reply.recycle();
4361 }
4362 public int getProcessLimit() throws RemoteException
4363 {
4364 Parcel data = Parcel.obtain();
4365 Parcel reply = Parcel.obtain();
4366 data.writeInterfaceToken(IActivityManager.descriptor);
4367 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4368 reply.readException();
4369 int res = reply.readInt();
4370 data.recycle();
4371 reply.recycle();
4372 return res;
4373 }
4374 public void setProcessForeground(IBinder token, int pid,
4375 boolean isForeground) throws RemoteException {
4376 Parcel data = Parcel.obtain();
4377 Parcel reply = Parcel.obtain();
4378 data.writeInterfaceToken(IActivityManager.descriptor);
4379 data.writeStrongBinder(token);
4380 data.writeInt(pid);
4381 data.writeInt(isForeground ? 1 : 0);
4382 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4383 reply.readException();
4384 data.recycle();
4385 reply.recycle();
4386 }
4387 public int checkPermission(String permission, int pid, int uid)
4388 throws RemoteException {
4389 Parcel data = Parcel.obtain();
4390 Parcel reply = Parcel.obtain();
4391 data.writeInterfaceToken(IActivityManager.descriptor);
4392 data.writeString(permission);
4393 data.writeInt(pid);
4394 data.writeInt(uid);
4395 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4396 reply.readException();
4397 int res = reply.readInt();
4398 data.recycle();
4399 reply.recycle();
4400 return res;
4401 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004402 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4403 throws RemoteException {
4404 Parcel data = Parcel.obtain();
4405 Parcel reply = Parcel.obtain();
4406 data.writeInterfaceToken(IActivityManager.descriptor);
4407 data.writeString(permission);
4408 data.writeInt(pid);
4409 data.writeInt(uid);
4410 data.writeStrongBinder(callerToken);
4411 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4412 reply.readException();
4413 int res = reply.readInt();
4414 data.recycle();
4415 reply.recycle();
4416 return res;
4417 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004418 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004419 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004420 Parcel data = Parcel.obtain();
4421 Parcel reply = Parcel.obtain();
4422 data.writeInterfaceToken(IActivityManager.descriptor);
4423 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004424 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004425 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004426 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4427 reply.readException();
4428 boolean res = reply.readInt() != 0;
4429 data.recycle();
4430 reply.recycle();
4431 return res;
4432 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004433 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4434 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 uri.writeToParcel(data, 0);
4439 data.writeInt(pid);
4440 data.writeInt(uid);
4441 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004442 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004443 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004444 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4445 reply.readException();
4446 int res = reply.readInt();
4447 data.recycle();
4448 reply.recycle();
4449 return res;
4450 }
4451 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004452 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004453 Parcel data = Parcel.obtain();
4454 Parcel reply = Parcel.obtain();
4455 data.writeInterfaceToken(IActivityManager.descriptor);
4456 data.writeStrongBinder(caller.asBinder());
4457 data.writeString(targetPkg);
4458 uri.writeToParcel(data, 0);
4459 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004460 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004461 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4462 reply.readException();
4463 data.recycle();
4464 reply.recycle();
4465 }
4466 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004467 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004468 Parcel data = Parcel.obtain();
4469 Parcel reply = Parcel.obtain();
4470 data.writeInterfaceToken(IActivityManager.descriptor);
4471 data.writeStrongBinder(caller.asBinder());
4472 uri.writeToParcel(data, 0);
4473 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004474 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004475 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4476 reply.readException();
4477 data.recycle();
4478 reply.recycle();
4479 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004480
4481 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004482 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4483 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004484 Parcel data = Parcel.obtain();
4485 Parcel reply = Parcel.obtain();
4486 data.writeInterfaceToken(IActivityManager.descriptor);
4487 uri.writeToParcel(data, 0);
4488 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004489 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004490 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4491 reply.readException();
4492 data.recycle();
4493 reply.recycle();
4494 }
4495
4496 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004497 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4498 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004499 Parcel data = Parcel.obtain();
4500 Parcel reply = Parcel.obtain();
4501 data.writeInterfaceToken(IActivityManager.descriptor);
4502 uri.writeToParcel(data, 0);
4503 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004504 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004505 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4506 reply.readException();
4507 data.recycle();
4508 reply.recycle();
4509 }
4510
4511 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004512 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4513 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004514 Parcel data = Parcel.obtain();
4515 Parcel reply = Parcel.obtain();
4516 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004517 data.writeString(packageName);
4518 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004519 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4520 reply.readException();
4521 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4522 reply);
4523 data.recycle();
4524 reply.recycle();
4525 return perms;
4526 }
4527
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004528 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4529 throws RemoteException {
4530 Parcel data = Parcel.obtain();
4531 Parcel reply = Parcel.obtain();
4532 data.writeInterfaceToken(IActivityManager.descriptor);
4533 data.writeStrongBinder(who.asBinder());
4534 data.writeInt(waiting ? 1 : 0);
4535 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4536 reply.readException();
4537 data.recycle();
4538 reply.recycle();
4539 }
4540 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4545 reply.readException();
4546 outInfo.readFromParcel(reply);
4547 data.recycle();
4548 reply.recycle();
4549 }
4550 public void unhandledBack() throws RemoteException
4551 {
4552 Parcel data = Parcel.obtain();
4553 Parcel reply = Parcel.obtain();
4554 data.writeInterfaceToken(IActivityManager.descriptor);
4555 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4556 reply.readException();
4557 data.recycle();
4558 reply.recycle();
4559 }
4560 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4561 {
4562 Parcel data = Parcel.obtain();
4563 Parcel reply = Parcel.obtain();
4564 data.writeInterfaceToken(IActivityManager.descriptor);
4565 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4566 reply.readException();
4567 ParcelFileDescriptor pfd = null;
4568 if (reply.readInt() != 0) {
4569 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4570 }
4571 data.recycle();
4572 reply.recycle();
4573 return pfd;
4574 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004575 public void setLockScreenShown(boolean shown) throws RemoteException
4576 {
4577 Parcel data = Parcel.obtain();
4578 Parcel reply = Parcel.obtain();
4579 data.writeInterfaceToken(IActivityManager.descriptor);
4580 data.writeInt(shown ? 1 : 0);
4581 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4582 reply.readException();
4583 data.recycle();
4584 reply.recycle();
4585 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004586 public void setDebugApp(
4587 String packageName, boolean waitForDebugger, boolean persistent)
4588 throws RemoteException
4589 {
4590 Parcel data = Parcel.obtain();
4591 Parcel reply = Parcel.obtain();
4592 data.writeInterfaceToken(IActivityManager.descriptor);
4593 data.writeString(packageName);
4594 data.writeInt(waitForDebugger ? 1 : 0);
4595 data.writeInt(persistent ? 1 : 0);
4596 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4597 reply.readException();
4598 data.recycle();
4599 reply.recycle();
4600 }
4601 public void setAlwaysFinish(boolean enabled) throws RemoteException
4602 {
4603 Parcel data = Parcel.obtain();
4604 Parcel reply = Parcel.obtain();
4605 data.writeInterfaceToken(IActivityManager.descriptor);
4606 data.writeInt(enabled ? 1 : 0);
4607 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4608 reply.readException();
4609 data.recycle();
4610 reply.recycle();
4611 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004612 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004613 {
4614 Parcel data = Parcel.obtain();
4615 Parcel reply = Parcel.obtain();
4616 data.writeInterfaceToken(IActivityManager.descriptor);
4617 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004618 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004619 reply.readException();
4620 data.recycle();
4621 reply.recycle();
4622 }
4623 public void enterSafeMode() throws RemoteException {
4624 Parcel data = Parcel.obtain();
4625 data.writeInterfaceToken(IActivityManager.descriptor);
4626 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4627 data.recycle();
4628 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004629 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004630 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004631 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004632 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004633 data.writeStrongBinder(sender.asBinder());
4634 data.writeInt(sourceUid);
4635 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004636 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004637 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4638 data.recycle();
4639 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004640 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4641 throws RemoteException {
4642 Parcel data = Parcel.obtain();
4643 data.writeInterfaceToken(IActivityManager.descriptor);
4644 data.writeStrongBinder(sender.asBinder());
4645 data.writeInt(sourceUid);
4646 data.writeString(tag);
4647 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4648 data.recycle();
4649 }
4650 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4651 throws RemoteException {
4652 Parcel data = Parcel.obtain();
4653 data.writeInterfaceToken(IActivityManager.descriptor);
4654 data.writeStrongBinder(sender.asBinder());
4655 data.writeInt(sourceUid);
4656 data.writeString(tag);
4657 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4658 data.recycle();
4659 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004660 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004661 Parcel data = Parcel.obtain();
4662 Parcel reply = Parcel.obtain();
4663 data.writeInterfaceToken(IActivityManager.descriptor);
4664 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004665 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004666 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004667 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004668 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004669 boolean res = reply.readInt() != 0;
4670 data.recycle();
4671 reply.recycle();
4672 return res;
4673 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004674 @Override
4675 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 data.writeString(reason);
4680 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4681 boolean res = reply.readInt() != 0;
4682 data.recycle();
4683 reply.recycle();
4684 return res;
4685 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004686 public boolean testIsSystemReady()
4687 {
4688 /* this base class version is never called */
4689 return true;
4690 }
Dan Egnor60d87622009-12-16 16:32:58 -08004691 public void handleApplicationCrash(IBinder app,
4692 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4693 {
4694 Parcel data = Parcel.obtain();
4695 Parcel reply = Parcel.obtain();
4696 data.writeInterfaceToken(IActivityManager.descriptor);
4697 data.writeStrongBinder(app);
4698 crashInfo.writeToParcel(data, 0);
4699 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4700 reply.readException();
4701 reply.recycle();
4702 data.recycle();
4703 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004704
Dianne Hackborn52322712014-08-26 22:47:26 -07004705 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004706 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004707 {
4708 Parcel data = Parcel.obtain();
4709 Parcel reply = Parcel.obtain();
4710 data.writeInterfaceToken(IActivityManager.descriptor);
4711 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004712 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004713 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004714 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004715 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004716 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004717 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004718 reply.recycle();
4719 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004720 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004721 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004722
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004723 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004724 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004725 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004726 {
4727 Parcel data = Parcel.obtain();
4728 Parcel reply = Parcel.obtain();
4729 data.writeInterfaceToken(IActivityManager.descriptor);
4730 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004731 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004732 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004733 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4734 reply.readException();
4735 reply.recycle();
4736 data.recycle();
4737 }
4738
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004739 public void signalPersistentProcesses(int sig) throws RemoteException {
4740 Parcel data = Parcel.obtain();
4741 Parcel reply = Parcel.obtain();
4742 data.writeInterfaceToken(IActivityManager.descriptor);
4743 data.writeInt(sig);
4744 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4745 reply.readException();
4746 data.recycle();
4747 reply.recycle();
4748 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004749
Dianne Hackborn1676c852012-09-10 14:52:30 -07004750 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004751 Parcel data = Parcel.obtain();
4752 Parcel reply = Parcel.obtain();
4753 data.writeInterfaceToken(IActivityManager.descriptor);
4754 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004755 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004756 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4757 reply.readException();
4758 data.recycle();
4759 reply.recycle();
4760 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004761
4762 public void killAllBackgroundProcesses() throws RemoteException {
4763 Parcel data = Parcel.obtain();
4764 Parcel reply = Parcel.obtain();
4765 data.writeInterfaceToken(IActivityManager.descriptor);
4766 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4767 reply.readException();
4768 data.recycle();
4769 reply.recycle();
4770 }
4771
Gustav Sennton6258dcd2015-10-30 19:25:37 +00004772 public void killPackageDependents(String packageName, int userId) throws RemoteException {
4773 Parcel data = Parcel.obtain();
4774 Parcel reply = Parcel.obtain();
4775 data.writeInterfaceToken(IActivityManager.descriptor);
4776 data.writeString(packageName);
4777 data.writeInt(userId);
4778 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
4779 reply.readException();
4780 data.recycle();
4781 reply.recycle();
4782 }
4783
Dianne Hackborn1676c852012-09-10 14:52:30 -07004784 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004785 Parcel data = Parcel.obtain();
4786 Parcel reply = Parcel.obtain();
4787 data.writeInterfaceToken(IActivityManager.descriptor);
4788 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004789 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004790 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004791 reply.readException();
4792 data.recycle();
4793 reply.recycle();
4794 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004795
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004796 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4797 throws RemoteException
4798 {
4799 Parcel data = Parcel.obtain();
4800 Parcel reply = Parcel.obtain();
4801 data.writeInterfaceToken(IActivityManager.descriptor);
4802 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4803 reply.readException();
4804 outInfo.readFromParcel(reply);
4805 reply.recycle();
4806 data.recycle();
4807 }
4808
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004809 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4810 {
4811 Parcel data = Parcel.obtain();
4812 Parcel reply = Parcel.obtain();
4813 data.writeInterfaceToken(IActivityManager.descriptor);
4814 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4815 reply.readException();
4816 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4817 reply.recycle();
4818 data.recycle();
4819 return res;
4820 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004821
Dianne Hackborn1676c852012-09-10 14:52:30 -07004822 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004823 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004824 {
4825 Parcel data = Parcel.obtain();
4826 Parcel reply = Parcel.obtain();
4827 data.writeInterfaceToken(IActivityManager.descriptor);
4828 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004829 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004830 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004831 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004832 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004833 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004834 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004835 } else {
4836 data.writeInt(0);
4837 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004838 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4839 reply.readException();
4840 boolean res = reply.readInt() != 0;
4841 reply.recycle();
4842 data.recycle();
4843 return res;
4844 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004845
Dianne Hackborn55280a92009-05-07 15:53:46 -07004846 public boolean shutdown(int timeout) throws RemoteException
4847 {
4848 Parcel data = Parcel.obtain();
4849 Parcel reply = Parcel.obtain();
4850 data.writeInterfaceToken(IActivityManager.descriptor);
4851 data.writeInt(timeout);
4852 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4853 reply.readException();
4854 boolean res = reply.readInt() != 0;
4855 reply.recycle();
4856 data.recycle();
4857 return res;
4858 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004859
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004860 public void stopAppSwitches() throws RemoteException {
4861 Parcel data = Parcel.obtain();
4862 Parcel reply = Parcel.obtain();
4863 data.writeInterfaceToken(IActivityManager.descriptor);
4864 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4865 reply.readException();
4866 reply.recycle();
4867 data.recycle();
4868 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004869
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004870 public void resumeAppSwitches() throws RemoteException {
4871 Parcel data = Parcel.obtain();
4872 Parcel reply = Parcel.obtain();
4873 data.writeInterfaceToken(IActivityManager.descriptor);
4874 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4875 reply.readException();
4876 reply.recycle();
4877 data.recycle();
4878 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004879
4880 public void addPackageDependency(String packageName) throws RemoteException {
4881 Parcel data = Parcel.obtain();
4882 Parcel reply = Parcel.obtain();
4883 data.writeInterfaceToken(IActivityManager.descriptor);
4884 data.writeString(packageName);
4885 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4886 reply.readException();
4887 data.recycle();
4888 reply.recycle();
4889 }
4890
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004891 public void killApplicationWithAppId(String pkg, int appid, String reason)
4892 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004893 Parcel data = Parcel.obtain();
4894 Parcel reply = Parcel.obtain();
4895 data.writeInterfaceToken(IActivityManager.descriptor);
4896 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004897 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004898 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004899 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004900 reply.readException();
4901 data.recycle();
4902 reply.recycle();
4903 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004904
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004905 public void closeSystemDialogs(String reason) throws RemoteException {
4906 Parcel data = Parcel.obtain();
4907 Parcel reply = Parcel.obtain();
4908 data.writeInterfaceToken(IActivityManager.descriptor);
4909 data.writeString(reason);
4910 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4911 reply.readException();
4912 data.recycle();
4913 reply.recycle();
4914 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004915
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004916 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004917 throws RemoteException {
4918 Parcel data = Parcel.obtain();
4919 Parcel reply = Parcel.obtain();
4920 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004921 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004922 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4923 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004924 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004925 data.recycle();
4926 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004927 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004928 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004929
4930 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4931 Parcel data = Parcel.obtain();
4932 Parcel reply = Parcel.obtain();
4933 data.writeInterfaceToken(IActivityManager.descriptor);
4934 data.writeString(processName);
4935 data.writeInt(uid);
4936 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4937 reply.readException();
4938 data.recycle();
4939 reply.recycle();
4940 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004941
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004942 public void overridePendingTransition(IBinder token, String packageName,
4943 int enterAnim, int exitAnim) throws RemoteException {
4944 Parcel data = Parcel.obtain();
4945 Parcel reply = Parcel.obtain();
4946 data.writeInterfaceToken(IActivityManager.descriptor);
4947 data.writeStrongBinder(token);
4948 data.writeString(packageName);
4949 data.writeInt(enterAnim);
4950 data.writeInt(exitAnim);
4951 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4952 reply.readException();
4953 data.recycle();
4954 reply.recycle();
4955 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004956
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004957 public boolean isUserAMonkey() throws RemoteException {
4958 Parcel data = Parcel.obtain();
4959 Parcel reply = Parcel.obtain();
4960 data.writeInterfaceToken(IActivityManager.descriptor);
4961 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4962 reply.readException();
4963 boolean res = reply.readInt() != 0;
4964 data.recycle();
4965 reply.recycle();
4966 return res;
4967 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004968
4969 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4970 Parcel data = Parcel.obtain();
4971 Parcel reply = Parcel.obtain();
4972 data.writeInterfaceToken(IActivityManager.descriptor);
4973 data.writeInt(monkey ? 1 : 0);
4974 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4975 reply.readException();
4976 data.recycle();
4977 reply.recycle();
4978 }
4979
Dianne Hackborn860755f2010-06-03 18:47:52 -07004980 public void finishHeavyWeightApp() throws RemoteException {
4981 Parcel data = Parcel.obtain();
4982 Parcel reply = Parcel.obtain();
4983 data.writeInterfaceToken(IActivityManager.descriptor);
4984 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4985 reply.readException();
4986 data.recycle();
4987 reply.recycle();
4988 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004989
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004990 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004991 throws RemoteException {
4992 Parcel data = Parcel.obtain();
4993 Parcel reply = Parcel.obtain();
4994 data.writeInterfaceToken(IActivityManager.descriptor);
4995 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004996 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4997 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004998 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004999 data.recycle();
5000 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005001 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005002 }
5003
Craig Mautner233ceee2014-05-09 17:05:11 -07005004 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005005 throws RemoteException {
5006 Parcel data = Parcel.obtain();
5007 Parcel reply = Parcel.obtain();
5008 data.writeInterfaceToken(IActivityManager.descriptor);
5009 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005010 if (options == null) {
5011 data.writeInt(0);
5012 } else {
5013 data.writeInt(1);
5014 data.writeBundle(options.toBundle());
5015 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005016 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005017 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005018 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005019 data.recycle();
5020 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005021 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005022 }
5023
Craig Mautner233ceee2014-05-09 17:05:11 -07005024 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5025 Parcel data = Parcel.obtain();
5026 Parcel reply = Parcel.obtain();
5027 data.writeInterfaceToken(IActivityManager.descriptor);
5028 data.writeStrongBinder(token);
5029 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5030 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005031 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005032 data.recycle();
5033 reply.recycle();
5034 return options;
5035 }
5036
Daniel Sandler69a48172010-06-23 16:29:36 -04005037 public void setImmersive(IBinder token, boolean immersive)
5038 throws RemoteException {
5039 Parcel data = Parcel.obtain();
5040 Parcel reply = Parcel.obtain();
5041 data.writeInterfaceToken(IActivityManager.descriptor);
5042 data.writeStrongBinder(token);
5043 data.writeInt(immersive ? 1 : 0);
5044 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5045 reply.readException();
5046 data.recycle();
5047 reply.recycle();
5048 }
5049
5050 public boolean isImmersive(IBinder token)
5051 throws RemoteException {
5052 Parcel data = Parcel.obtain();
5053 Parcel reply = Parcel.obtain();
5054 data.writeInterfaceToken(IActivityManager.descriptor);
5055 data.writeStrongBinder(token);
5056 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005057 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005058 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005059 data.recycle();
5060 reply.recycle();
5061 return res;
5062 }
5063
Craig Mautnerd61dc202014-07-07 11:09:11 -07005064 public boolean isTopOfTask(IBinder token) throws RemoteException {
5065 Parcel data = Parcel.obtain();
5066 Parcel reply = Parcel.obtain();
5067 data.writeInterfaceToken(IActivityManager.descriptor);
5068 data.writeStrongBinder(token);
5069 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5070 reply.readException();
5071 boolean res = reply.readInt() == 1;
5072 data.recycle();
5073 reply.recycle();
5074 return res;
5075 }
5076
Daniel Sandler69a48172010-06-23 16:29:36 -04005077 public boolean isTopActivityImmersive()
5078 throws RemoteException {
5079 Parcel data = Parcel.obtain();
5080 Parcel reply = Parcel.obtain();
5081 data.writeInterfaceToken(IActivityManager.descriptor);
5082 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005083 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005084 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005085 data.recycle();
5086 reply.recycle();
5087 return res;
5088 }
5089
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005090 public void crashApplication(int uid, int initialPid, String packageName,
5091 String message) throws RemoteException {
5092 Parcel data = Parcel.obtain();
5093 Parcel reply = Parcel.obtain();
5094 data.writeInterfaceToken(IActivityManager.descriptor);
5095 data.writeInt(uid);
5096 data.writeInt(initialPid);
5097 data.writeString(packageName);
5098 data.writeString(message);
5099 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5100 reply.readException();
5101 data.recycle();
5102 reply.recycle();
5103 }
Andy McFadden824c5102010-07-09 16:26:57 -07005104
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005105 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005106 Parcel data = Parcel.obtain();
5107 Parcel reply = Parcel.obtain();
5108 data.writeInterfaceToken(IActivityManager.descriptor);
5109 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005110 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005111 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5112 reply.readException();
5113 String res = reply.readString();
5114 data.recycle();
5115 reply.recycle();
5116 return res;
5117 }
5118
Dianne Hackborn7e269642010-08-25 19:50:20 -07005119 public IBinder newUriPermissionOwner(String name)
5120 throws RemoteException {
5121 Parcel data = Parcel.obtain();
5122 Parcel reply = Parcel.obtain();
5123 data.writeInterfaceToken(IActivityManager.descriptor);
5124 data.writeString(name);
5125 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5126 reply.readException();
5127 IBinder res = reply.readStrongBinder();
5128 data.recycle();
5129 reply.recycle();
5130 return res;
5131 }
5132
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005133 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5134 Parcel data = Parcel.obtain();
5135 Parcel reply = Parcel.obtain();
5136 data.writeInterfaceToken(IActivityManager.descriptor);
5137 data.writeStrongBinder(activityToken);
5138 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5139 reply.readException();
5140 IBinder res = reply.readStrongBinder();
5141 data.recycle();
5142 reply.recycle();
5143 return res;
5144 }
5145
Dianne Hackborn7e269642010-08-25 19:50:20 -07005146 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005147 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005148 Parcel data = Parcel.obtain();
5149 Parcel reply = Parcel.obtain();
5150 data.writeInterfaceToken(IActivityManager.descriptor);
5151 data.writeStrongBinder(owner);
5152 data.writeInt(fromUid);
5153 data.writeString(targetPkg);
5154 uri.writeToParcel(data, 0);
5155 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005156 data.writeInt(sourceUserId);
5157 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005158 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5159 reply.readException();
5160 data.recycle();
5161 reply.recycle();
5162 }
5163
5164 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005165 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005166 Parcel data = Parcel.obtain();
5167 Parcel reply = Parcel.obtain();
5168 data.writeInterfaceToken(IActivityManager.descriptor);
5169 data.writeStrongBinder(owner);
5170 if (uri != null) {
5171 data.writeInt(1);
5172 uri.writeToParcel(data, 0);
5173 } else {
5174 data.writeInt(0);
5175 }
5176 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005177 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005178 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5179 reply.readException();
5180 data.recycle();
5181 reply.recycle();
5182 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005183
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005184 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005185 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005186 Parcel data = Parcel.obtain();
5187 Parcel reply = Parcel.obtain();
5188 data.writeInterfaceToken(IActivityManager.descriptor);
5189 data.writeInt(callingUid);
5190 data.writeString(targetPkg);
5191 uri.writeToParcel(data, 0);
5192 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005193 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005194 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5195 reply.readException();
5196 int res = reply.readInt();
5197 data.recycle();
5198 reply.recycle();
5199 return res;
5200 }
5201
Dianne Hackborn1676c852012-09-10 14:52:30 -07005202 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005203 String path, ParcelFileDescriptor fd) throws RemoteException {
5204 Parcel data = Parcel.obtain();
5205 Parcel reply = Parcel.obtain();
5206 data.writeInterfaceToken(IActivityManager.descriptor);
5207 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005208 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005209 data.writeInt(managed ? 1 : 0);
5210 data.writeString(path);
5211 if (fd != null) {
5212 data.writeInt(1);
5213 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5214 } else {
5215 data.writeInt(0);
5216 }
5217 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5218 reply.readException();
5219 boolean res = reply.readInt() != 0;
5220 reply.recycle();
5221 data.recycle();
5222 return res;
5223 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005224
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005225 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005226 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005227 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005228 Parcel data = Parcel.obtain();
5229 Parcel reply = Parcel.obtain();
5230 data.writeInterfaceToken(IActivityManager.descriptor);
5231 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005232 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005233 data.writeTypedArray(intents, 0);
5234 data.writeStringArray(resolvedTypes);
5235 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005236 if (options != null) {
5237 data.writeInt(1);
5238 options.writeToParcel(data, 0);
5239 } else {
5240 data.writeInt(0);
5241 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005242 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005243 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5244 reply.readException();
5245 int result = reply.readInt();
5246 reply.recycle();
5247 data.recycle();
5248 return result;
5249 }
5250
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005251 public int getFrontActivityScreenCompatMode() throws RemoteException {
5252 Parcel data = Parcel.obtain();
5253 Parcel reply = Parcel.obtain();
5254 data.writeInterfaceToken(IActivityManager.descriptor);
5255 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5256 reply.readException();
5257 int mode = reply.readInt();
5258 reply.recycle();
5259 data.recycle();
5260 return mode;
5261 }
5262
5263 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5264 Parcel data = Parcel.obtain();
5265 Parcel reply = Parcel.obtain();
5266 data.writeInterfaceToken(IActivityManager.descriptor);
5267 data.writeInt(mode);
5268 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5269 reply.readException();
5270 reply.recycle();
5271 data.recycle();
5272 }
5273
5274 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5275 Parcel data = Parcel.obtain();
5276 Parcel reply = Parcel.obtain();
5277 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005278 data.writeString(packageName);
5279 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005280 reply.readException();
5281 int mode = reply.readInt();
5282 reply.recycle();
5283 data.recycle();
5284 return mode;
5285 }
5286
5287 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005288 throws RemoteException {
5289 Parcel data = Parcel.obtain();
5290 Parcel reply = Parcel.obtain();
5291 data.writeInterfaceToken(IActivityManager.descriptor);
5292 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005293 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005294 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5295 reply.readException();
5296 reply.recycle();
5297 data.recycle();
5298 }
5299
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005300 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5301 Parcel data = Parcel.obtain();
5302 Parcel reply = Parcel.obtain();
5303 data.writeInterfaceToken(IActivityManager.descriptor);
5304 data.writeString(packageName);
5305 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5306 reply.readException();
5307 boolean ask = reply.readInt() != 0;
5308 reply.recycle();
5309 data.recycle();
5310 return ask;
5311 }
5312
5313 public void setPackageAskScreenCompat(String packageName, boolean ask)
5314 throws RemoteException {
5315 Parcel data = Parcel.obtain();
5316 Parcel reply = Parcel.obtain();
5317 data.writeInterfaceToken(IActivityManager.descriptor);
5318 data.writeString(packageName);
5319 data.writeInt(ask ? 1 : 0);
5320 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5321 reply.readException();
5322 reply.recycle();
5323 data.recycle();
5324 }
5325
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005326 public boolean switchUser(int userid) throws RemoteException {
5327 Parcel data = Parcel.obtain();
5328 Parcel reply = Parcel.obtain();
5329 data.writeInterfaceToken(IActivityManager.descriptor);
5330 data.writeInt(userid);
5331 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5332 reply.readException();
5333 boolean result = reply.readInt() != 0;
5334 reply.recycle();
5335 data.recycle();
5336 return result;
5337 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005338
Kenny Guy08488bf2014-02-21 17:40:37 +00005339 public boolean startUserInBackground(int userid) throws RemoteException {
5340 Parcel data = Parcel.obtain();
5341 Parcel reply = Parcel.obtain();
5342 data.writeInterfaceToken(IActivityManager.descriptor);
5343 data.writeInt(userid);
5344 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5345 reply.readException();
5346 boolean result = reply.readInt() != 0;
5347 reply.recycle();
5348 data.recycle();
5349 return result;
5350 }
5351
Jeff Sharkeyba512352015-11-12 20:17:45 -08005352 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5353 Parcel data = Parcel.obtain();
5354 Parcel reply = Parcel.obtain();
5355 data.writeInterfaceToken(IActivityManager.descriptor);
5356 data.writeInt(userId);
5357 data.writeByteArray(token);
5358 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5359 reply.readException();
5360 boolean result = reply.readInt() != 0;
5361 reply.recycle();
5362 data.recycle();
5363 return result;
5364 }
5365
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005366 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5367 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005368 Parcel data = Parcel.obtain();
5369 Parcel reply = Parcel.obtain();
5370 data.writeInterfaceToken(IActivityManager.descriptor);
5371 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005372 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005373 data.writeStrongInterface(callback);
5374 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5375 reply.readException();
5376 int result = reply.readInt();
5377 reply.recycle();
5378 data.recycle();
5379 return result;
5380 }
5381
Amith Yamasani52f1d752012-03-28 18:19:29 -07005382 public UserInfo getCurrentUser() throws RemoteException {
5383 Parcel data = Parcel.obtain();
5384 Parcel reply = Parcel.obtain();
5385 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005386 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005387 reply.readException();
5388 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5389 reply.recycle();
5390 data.recycle();
5391 return userInfo;
5392 }
5393
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005394 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005395 Parcel data = Parcel.obtain();
5396 Parcel reply = Parcel.obtain();
5397 data.writeInterfaceToken(IActivityManager.descriptor);
5398 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005399 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005400 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5401 reply.readException();
5402 boolean result = reply.readInt() != 0;
5403 reply.recycle();
5404 data.recycle();
5405 return result;
5406 }
5407
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005408 public int[] getRunningUserIds() throws RemoteException {
5409 Parcel data = Parcel.obtain();
5410 Parcel reply = Parcel.obtain();
5411 data.writeInterfaceToken(IActivityManager.descriptor);
5412 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5413 reply.readException();
5414 int[] result = reply.createIntArray();
5415 reply.recycle();
5416 data.recycle();
5417 return result;
5418 }
5419
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005420 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005421 Parcel data = Parcel.obtain();
5422 Parcel reply = Parcel.obtain();
5423 data.writeInterfaceToken(IActivityManager.descriptor);
5424 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005425 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5426 reply.readException();
5427 boolean result = reply.readInt() != 0;
5428 reply.recycle();
5429 data.recycle();
5430 return result;
5431 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005432
Jeff Sharkeya4620792011-05-20 15:29:23 -07005433 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5434 Parcel data = Parcel.obtain();
5435 Parcel reply = Parcel.obtain();
5436 data.writeInterfaceToken(IActivityManager.descriptor);
5437 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5438 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5439 reply.readException();
5440 data.recycle();
5441 reply.recycle();
5442 }
5443
5444 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5445 Parcel data = Parcel.obtain();
5446 Parcel reply = Parcel.obtain();
5447 data.writeInterfaceToken(IActivityManager.descriptor);
5448 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5449 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5450 reply.readException();
5451 data.recycle();
5452 reply.recycle();
5453 }
5454
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005455 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005456 Parcel data = Parcel.obtain();
5457 Parcel reply = Parcel.obtain();
5458 data.writeInterfaceToken(IActivityManager.descriptor);
5459 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005460 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005461 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5462 reply.readException();
5463 data.recycle();
5464 reply.recycle();
5465 }
5466
5467 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5468 Parcel data = Parcel.obtain();
5469 Parcel reply = Parcel.obtain();
5470 data.writeInterfaceToken(IActivityManager.descriptor);
5471 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5472 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5473 reply.readException();
5474 data.recycle();
5475 reply.recycle();
5476 }
5477
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005478 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5479 Parcel data = Parcel.obtain();
5480 Parcel reply = Parcel.obtain();
5481 data.writeInterfaceToken(IActivityManager.descriptor);
5482 data.writeStrongBinder(sender.asBinder());
5483 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5484 reply.readException();
5485 boolean res = reply.readInt() != 0;
5486 data.recycle();
5487 reply.recycle();
5488 return res;
5489 }
5490
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005491 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5492 Parcel data = Parcel.obtain();
5493 Parcel reply = Parcel.obtain();
5494 data.writeInterfaceToken(IActivityManager.descriptor);
5495 data.writeStrongBinder(sender.asBinder());
5496 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5497 reply.readException();
5498 boolean res = reply.readInt() != 0;
5499 data.recycle();
5500 reply.recycle();
5501 return res;
5502 }
5503
Dianne Hackborn81038902012-11-26 17:04:09 -08005504 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5505 Parcel data = Parcel.obtain();
5506 Parcel reply = Parcel.obtain();
5507 data.writeInterfaceToken(IActivityManager.descriptor);
5508 data.writeStrongBinder(sender.asBinder());
5509 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5510 reply.readException();
5511 Intent res = reply.readInt() != 0
5512 ? Intent.CREATOR.createFromParcel(reply) : null;
5513 data.recycle();
5514 reply.recycle();
5515 return res;
5516 }
5517
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005518 public String getTagForIntentSender(IIntentSender sender, String prefix)
5519 throws RemoteException {
5520 Parcel data = Parcel.obtain();
5521 Parcel reply = Parcel.obtain();
5522 data.writeInterfaceToken(IActivityManager.descriptor);
5523 data.writeStrongBinder(sender.asBinder());
5524 data.writeString(prefix);
5525 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5526 reply.readException();
5527 String res = reply.readString();
5528 data.recycle();
5529 reply.recycle();
5530 return res;
5531 }
5532
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005533 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5534 {
5535 Parcel data = Parcel.obtain();
5536 Parcel reply = Parcel.obtain();
5537 data.writeInterfaceToken(IActivityManager.descriptor);
5538 values.writeToParcel(data, 0);
5539 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5540 reply.readException();
5541 data.recycle();
5542 reply.recycle();
5543 }
5544
Dianne Hackbornb437e092011-08-05 17:50:29 -07005545 public long[] getProcessPss(int[] pids) throws RemoteException {
5546 Parcel data = Parcel.obtain();
5547 Parcel reply = Parcel.obtain();
5548 data.writeInterfaceToken(IActivityManager.descriptor);
5549 data.writeIntArray(pids);
5550 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5551 reply.readException();
5552 long[] res = reply.createLongArray();
5553 data.recycle();
5554 reply.recycle();
5555 return res;
5556 }
5557
Dianne Hackborn661cd522011-08-22 00:26:20 -07005558 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5559 Parcel data = Parcel.obtain();
5560 Parcel reply = Parcel.obtain();
5561 data.writeInterfaceToken(IActivityManager.descriptor);
5562 TextUtils.writeToParcel(msg, data, 0);
5563 data.writeInt(always ? 1 : 0);
5564 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5565 reply.readException();
5566 data.recycle();
5567 reply.recycle();
5568 }
5569
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005570 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005571 Parcel data = Parcel.obtain();
5572 Parcel reply = Parcel.obtain();
5573 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005574 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005575 reply.readException();
5576 data.recycle();
5577 reply.recycle();
5578 }
5579
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005580 public void keyguardGoingAway(boolean disableWindowAnimations,
5581 boolean keyguardGoingToNotificationShade) throws RemoteException {
5582 Parcel data = Parcel.obtain();
5583 Parcel reply = Parcel.obtain();
5584 data.writeInterfaceToken(IActivityManager.descriptor);
5585 data.writeInt(disableWindowAnimations ? 1 : 0);
5586 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5587 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5588 reply.readException();
5589 data.recycle();
5590 reply.recycle();
5591 }
5592
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005593 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005594 throws RemoteException {
5595 Parcel data = Parcel.obtain();
5596 Parcel reply = Parcel.obtain();
5597 data.writeInterfaceToken(IActivityManager.descriptor);
5598 data.writeStrongBinder(token);
5599 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005600 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005601 reply.readException();
5602 boolean result = reply.readInt() != 0;
5603 data.recycle();
5604 reply.recycle();
5605 return result;
5606 }
5607
5608 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5609 throws RemoteException {
5610 Parcel data = Parcel.obtain();
5611 Parcel reply = Parcel.obtain();
5612 data.writeInterfaceToken(IActivityManager.descriptor);
5613 data.writeStrongBinder(token);
5614 target.writeToParcel(data, 0);
5615 data.writeInt(resultCode);
5616 if (resultData != null) {
5617 data.writeInt(1);
5618 resultData.writeToParcel(data, 0);
5619 } else {
5620 data.writeInt(0);
5621 }
5622 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5623 reply.readException();
5624 boolean result = reply.readInt() != 0;
5625 data.recycle();
5626 reply.recycle();
5627 return result;
5628 }
5629
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005630 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5631 Parcel data = Parcel.obtain();
5632 Parcel reply = Parcel.obtain();
5633 data.writeInterfaceToken(IActivityManager.descriptor);
5634 data.writeStrongBinder(activityToken);
5635 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5636 reply.readException();
5637 int result = reply.readInt();
5638 data.recycle();
5639 reply.recycle();
5640 return result;
5641 }
5642
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005643 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5644 Parcel data = Parcel.obtain();
5645 Parcel reply = Parcel.obtain();
5646 data.writeInterfaceToken(IActivityManager.descriptor);
5647 data.writeStrongBinder(activityToken);
5648 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5649 reply.readException();
5650 String result = reply.readString();
5651 data.recycle();
5652 reply.recycle();
5653 return result;
5654 }
5655
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005656 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5657 Parcel data = Parcel.obtain();
5658 Parcel reply = Parcel.obtain();
5659 data.writeInterfaceToken(IActivityManager.descriptor);
5660 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5661 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5662 reply.readException();
5663 data.recycle();
5664 reply.recycle();
5665 }
5666
5667 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5668 Parcel data = Parcel.obtain();
5669 Parcel reply = Parcel.obtain();
5670 data.writeInterfaceToken(IActivityManager.descriptor);
5671 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5672 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5673 reply.readException();
5674 data.recycle();
5675 reply.recycle();
5676 }
5677
Felipe Leme4cc86332015-12-04 16:37:28 -08005678 public void requestBugReport(boolean progress) throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005679 Parcel data = Parcel.obtain();
5680 Parcel reply = Parcel.obtain();
5681 data.writeInterfaceToken(IActivityManager.descriptor);
Felipe Leme4cc86332015-12-04 16:37:28 -08005682 data.writeInt(progress ? 1 : 0);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005683 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5684 reply.readException();
5685 data.recycle();
5686 reply.recycle();
5687 }
5688
Jeff Brownbd181bb2013-09-10 16:44:24 -07005689 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5690 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005691 Parcel data = Parcel.obtain();
5692 Parcel reply = Parcel.obtain();
5693 data.writeInterfaceToken(IActivityManager.descriptor);
5694 data.writeInt(pid);
5695 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005696 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005697 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5698 reply.readException();
5699 long res = reply.readInt();
5700 data.recycle();
5701 reply.recycle();
5702 return res;
5703 }
5704
Adam Skorydfc7fd72013-08-05 19:23:41 -07005705 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005706 Parcel data = Parcel.obtain();
5707 Parcel reply = Parcel.obtain();
5708 data.writeInterfaceToken(IActivityManager.descriptor);
5709 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005710 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005711 reply.readException();
5712 Bundle res = reply.readBundle();
5713 data.recycle();
5714 reply.recycle();
5715 return res;
5716 }
5717
Dianne Hackborn17f69352015-07-17 18:04:14 -07005718 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5719 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005720 Parcel data = Parcel.obtain();
5721 Parcel reply = Parcel.obtain();
5722 data.writeInterfaceToken(IActivityManager.descriptor);
5723 data.writeInt(requestType);
5724 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005725 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005726 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5727 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005728 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005729 data.recycle();
5730 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005731 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005732 }
5733
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005734 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005735 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005736 Parcel data = Parcel.obtain();
5737 Parcel reply = Parcel.obtain();
5738 data.writeInterfaceToken(IActivityManager.descriptor);
5739 data.writeStrongBinder(token);
5740 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005741 structure.writeToParcel(data, 0);
5742 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005743 if (referrer != null) {
5744 data.writeInt(1);
5745 referrer.writeToParcel(data, 0);
5746 } else {
5747 data.writeInt(0);
5748 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005749 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005750 reply.readException();
5751 data.recycle();
5752 reply.recycle();
5753 }
5754
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005755 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5756 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005757 Parcel data = Parcel.obtain();
5758 Parcel reply = Parcel.obtain();
5759 data.writeInterfaceToken(IActivityManager.descriptor);
5760 intent.writeToParcel(data, 0);
5761 data.writeInt(requestType);
5762 data.writeString(hint);
5763 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005764 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005765 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5766 reply.readException();
5767 boolean res = reply.readInt() != 0;
5768 data.recycle();
5769 reply.recycle();
5770 return res;
5771 }
5772
Dianne Hackborn17f69352015-07-17 18:04:14 -07005773 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005774 Parcel data = Parcel.obtain();
5775 Parcel reply = Parcel.obtain();
5776 data.writeInterfaceToken(IActivityManager.descriptor);
5777 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5778 reply.readException();
5779 boolean res = reply.readInt() != 0;
5780 data.recycle();
5781 reply.recycle();
5782 return res;
5783 }
5784
Dianne Hackborn17f69352015-07-17 18:04:14 -07005785 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5786 Parcel data = Parcel.obtain();
5787 Parcel reply = Parcel.obtain();
5788 data.writeInterfaceToken(IActivityManager.descriptor);
5789 data.writeStrongBinder(token);
5790 data.writeBundle(args);
5791 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5792 reply.readException();
5793 boolean res = reply.readInt() != 0;
5794 data.recycle();
5795 reply.recycle();
5796 return res;
5797 }
5798
Svetoslavaa41add2015-08-06 15:03:55 -07005799 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005800 Parcel data = Parcel.obtain();
5801 Parcel reply = Parcel.obtain();
5802 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005803 data.writeInt(appId);
5804 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005805 data.writeString(reason);
5806 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5807 reply.readException();
5808 data.recycle();
5809 reply.recycle();
5810 }
5811
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005812 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5813 Parcel data = Parcel.obtain();
5814 Parcel reply = Parcel.obtain();
5815 data.writeInterfaceToken(IActivityManager.descriptor);
5816 data.writeStrongBinder(who);
5817 data.writeInt(allowRestart ? 1 : 0);
5818 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5819 reply.readException();
5820 data.recycle();
5821 reply.recycle();
5822 }
5823
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005824 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5825 Parcel data = Parcel.obtain();
5826 Parcel reply = Parcel.obtain();
5827 data.writeInterfaceToken(IActivityManager.descriptor);
5828 data.writeStrongBinder(token);
5829 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5830 reply.readException();
5831 data.recycle();
5832 reply.recycle();
5833 }
5834
Craig Mautner5eda9b32013-07-02 11:58:16 -07005835 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5836 Parcel data = Parcel.obtain();
5837 Parcel reply = Parcel.obtain();
5838 data.writeInterfaceToken(IActivityManager.descriptor);
5839 data.writeStrongBinder(token);
5840 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5841 reply.readException();
5842 data.recycle();
5843 reply.recycle();
5844 }
5845
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005846 public void restart() throws RemoteException {
5847 Parcel data = Parcel.obtain();
5848 Parcel reply = Parcel.obtain();
5849 data.writeInterfaceToken(IActivityManager.descriptor);
5850 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5851 reply.readException();
5852 data.recycle();
5853 reply.recycle();
5854 }
5855
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005856 public void performIdleMaintenance() throws RemoteException {
5857 Parcel data = Parcel.obtain();
5858 Parcel reply = Parcel.obtain();
5859 data.writeInterfaceToken(IActivityManager.descriptor);
5860 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5861 reply.readException();
5862 data.recycle();
5863 reply.recycle();
5864 }
5865
Todd Kennedyca4d8422015-01-15 15:19:22 -08005866 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005867 IActivityContainerCallback callback) throws RemoteException {
5868 Parcel data = Parcel.obtain();
5869 Parcel reply = Parcel.obtain();
5870 data.writeInterfaceToken(IActivityManager.descriptor);
5871 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005872 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005873 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005874 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005875 final int result = reply.readInt();
5876 final IActivityContainer res;
5877 if (result == 1) {
5878 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5879 } else {
5880 res = null;
5881 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005882 data.recycle();
5883 reply.recycle();
5884 return res;
5885 }
5886
Craig Mautner95da1082014-02-24 17:54:35 -08005887 public void deleteActivityContainer(IActivityContainer activityContainer)
5888 throws RemoteException {
5889 Parcel data = Parcel.obtain();
5890 Parcel reply = Parcel.obtain();
5891 data.writeInterfaceToken(IActivityManager.descriptor);
5892 data.writeStrongBinder(activityContainer.asBinder());
5893 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5894 reply.readException();
5895 data.recycle();
5896 reply.recycle();
5897 }
5898
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005899 public boolean startBinderTracking() throws RemoteException {
5900 Parcel data = Parcel.obtain();
5901 Parcel reply = Parcel.obtain();
5902 data.writeInterfaceToken(IActivityManager.descriptor);
5903 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5904 reply.readException();
5905 boolean res = reply.readInt() != 0;
5906 reply.recycle();
5907 data.recycle();
5908 return res;
5909 }
5910
5911 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5912 Parcel data = Parcel.obtain();
5913 Parcel reply = Parcel.obtain();
5914 data.writeInterfaceToken(IActivityManager.descriptor);
5915 if (fd != null) {
5916 data.writeInt(1);
5917 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5918 } else {
5919 data.writeInt(0);
5920 }
5921 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5922 reply.readException();
5923 boolean res = reply.readInt() != 0;
5924 reply.recycle();
5925 data.recycle();
5926 return res;
5927 }
5928
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08005929 public void setVrMode(IBinder token, boolean enabled) throws RemoteException {
5930 Parcel data = Parcel.obtain();
5931 Parcel reply = Parcel.obtain();
5932 data.writeInterfaceToken(IActivityManager.descriptor);
5933 data.writeStrongBinder(token);
5934 data.writeInt(enabled ? 1 : 0);
5935 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
5936 reply.readException();
5937 data.recycle();
5938 reply.recycle();
5939 }
5940
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005941 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005942 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5943 Parcel data = Parcel.obtain();
5944 Parcel reply = Parcel.obtain();
5945 data.writeInterfaceToken(IActivityManager.descriptor);
5946 data.writeInt(displayId);
5947 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5948 reply.readException();
5949 final int result = reply.readInt();
5950 final IActivityContainer res;
5951 if (result == 1) {
5952 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5953 } else {
5954 res = null;
5955 }
5956 data.recycle();
5957 reply.recycle();
5958 return res;
5959 }
5960
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005961 @Override
5962 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005963 throws RemoteException {
5964 Parcel data = Parcel.obtain();
5965 Parcel reply = Parcel.obtain();
5966 data.writeInterfaceToken(IActivityManager.descriptor);
5967 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005968 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005969 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005970 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005971 data.recycle();
5972 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005973 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005974 }
5975
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005976 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005977 public void startLockTaskMode(int taskId) throws RemoteException {
5978 Parcel data = Parcel.obtain();
5979 Parcel reply = Parcel.obtain();
5980 data.writeInterfaceToken(IActivityManager.descriptor);
5981 data.writeInt(taskId);
5982 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5983 reply.readException();
5984 data.recycle();
5985 reply.recycle();
5986 }
5987
5988 @Override
5989 public void startLockTaskMode(IBinder token) throws RemoteException {
5990 Parcel data = Parcel.obtain();
5991 Parcel reply = Parcel.obtain();
5992 data.writeInterfaceToken(IActivityManager.descriptor);
5993 data.writeStrongBinder(token);
5994 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5995 reply.readException();
5996 data.recycle();
5997 reply.recycle();
5998 }
5999
6000 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006001 public void startLockTaskModeOnCurrent() throws RemoteException {
6002 Parcel data = Parcel.obtain();
6003 Parcel reply = Parcel.obtain();
6004 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006005 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006006 reply.readException();
6007 data.recycle();
6008 reply.recycle();
6009 }
6010
6011 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006012 public void stopLockTaskMode() throws RemoteException {
6013 Parcel data = Parcel.obtain();
6014 Parcel reply = Parcel.obtain();
6015 data.writeInterfaceToken(IActivityManager.descriptor);
6016 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6017 reply.readException();
6018 data.recycle();
6019 reply.recycle();
6020 }
6021
6022 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006023 public void stopLockTaskModeOnCurrent() throws RemoteException {
6024 Parcel data = Parcel.obtain();
6025 Parcel reply = Parcel.obtain();
6026 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006027 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006028 reply.readException();
6029 data.recycle();
6030 reply.recycle();
6031 }
6032
6033 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006034 public boolean isInLockTaskMode() throws RemoteException {
6035 Parcel data = Parcel.obtain();
6036 Parcel reply = Parcel.obtain();
6037 data.writeInterfaceToken(IActivityManager.descriptor);
6038 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6039 reply.readException();
6040 boolean isInLockTaskMode = reply.readInt() == 1;
6041 data.recycle();
6042 reply.recycle();
6043 return isInLockTaskMode;
6044 }
6045
Craig Mautner688b5102014-03-27 16:55:03 -07006046 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006047 public int getLockTaskModeState() throws RemoteException {
6048 Parcel data = Parcel.obtain();
6049 Parcel reply = Parcel.obtain();
6050 data.writeInterfaceToken(IActivityManager.descriptor);
6051 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6052 reply.readException();
6053 int lockTaskModeState = reply.readInt();
6054 data.recycle();
6055 reply.recycle();
6056 return lockTaskModeState;
6057 }
6058
6059 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006060 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6061 Parcel data = Parcel.obtain();
6062 Parcel reply = Parcel.obtain();
6063 data.writeInterfaceToken(IActivityManager.descriptor);
6064 data.writeStrongBinder(token);
6065 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6066 IBinder.FLAG_ONEWAY);
6067 reply.readException();
6068 data.recycle();
6069 reply.recycle();
6070 }
6071
6072 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006073 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006074 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006075 Parcel data = Parcel.obtain();
6076 Parcel reply = Parcel.obtain();
6077 data.writeInterfaceToken(IActivityManager.descriptor);
6078 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006079 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006080 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006081 reply.readException();
6082 data.recycle();
6083 reply.recycle();
6084 }
6085
Craig Mautneree2e45a2014-06-27 12:10:03 -07006086 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006087 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
6088 Parcel data = Parcel.obtain();
6089 Parcel reply = Parcel.obtain();
6090 data.writeInterfaceToken(IActivityManager.descriptor);
6091 data.writeInt(taskId);
6092 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006093 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006094 reply.readException();
6095 data.recycle();
6096 reply.recycle();
6097 }
6098
6099 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006100 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006101 {
6102 Parcel data = Parcel.obtain();
6103 Parcel reply = Parcel.obtain();
6104 data.writeInterfaceToken(IActivityManager.descriptor);
6105 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006106 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006107 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006108 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006109 reply.readException();
6110 data.recycle();
6111 reply.recycle();
6112 }
6113
6114 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006115 public Rect getTaskBounds(int taskId) throws RemoteException
6116 {
6117 Parcel data = Parcel.obtain();
6118 Parcel reply = Parcel.obtain();
6119 data.writeInterfaceToken(IActivityManager.descriptor);
6120 data.writeInt(taskId);
6121 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6122 reply.readException();
6123 Rect rect = Rect.CREATOR.createFromParcel(reply);
6124 data.recycle();
6125 reply.recycle();
6126 return rect;
6127 }
6128
6129 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006130 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006131 Parcel data = Parcel.obtain();
6132 Parcel reply = Parcel.obtain();
6133 data.writeInterfaceToken(IActivityManager.descriptor);
6134 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006135 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006136 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6137 reply.readException();
6138 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6139 data.recycle();
6140 reply.recycle();
6141 return icon;
6142 }
6143
6144 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006145 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6146 throws RemoteException {
6147 Parcel data = Parcel.obtain();
6148 Parcel reply = Parcel.obtain();
6149 data.writeInterfaceToken(IActivityManager.descriptor);
6150 if (options == null) {
6151 data.writeInt(0);
6152 } else {
6153 data.writeInt(1);
6154 data.writeBundle(options.toBundle());
6155 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006156 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006157 reply.readException();
6158 data.recycle();
6159 reply.recycle();
6160 }
6161
6162 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006163 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006164 Parcel data = Parcel.obtain();
6165 Parcel reply = Parcel.obtain();
6166 data.writeInterfaceToken(IActivityManager.descriptor);
6167 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006168 data.writeInt(visible ? 1 : 0);
6169 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006170 reply.readException();
6171 boolean success = reply.readInt() > 0;
6172 data.recycle();
6173 reply.recycle();
6174 return success;
6175 }
6176
6177 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006178 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006179 Parcel data = Parcel.obtain();
6180 Parcel reply = Parcel.obtain();
6181 data.writeInterfaceToken(IActivityManager.descriptor);
6182 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006183 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006184 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006185 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006186 data.recycle();
6187 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006188 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006189 }
6190
6191 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006192 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006193 Parcel data = Parcel.obtain();
6194 Parcel reply = Parcel.obtain();
6195 data.writeInterfaceToken(IActivityManager.descriptor);
6196 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006197 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006198 reply.readException();
6199 data.recycle();
6200 reply.recycle();
6201 }
6202
6203 @Override
6204 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6205 Parcel data = Parcel.obtain();
6206 Parcel reply = Parcel.obtain();
6207 data.writeInterfaceToken(IActivityManager.descriptor);
6208 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006209 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006210 reply.readException();
6211 data.recycle();
6212 reply.recycle();
6213 }
6214
Craig Mautner8746a472014-07-24 15:12:54 -07006215 @Override
6216 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6217 Parcel data = Parcel.obtain();
6218 Parcel reply = Parcel.obtain();
6219 data.writeInterfaceToken(IActivityManager.descriptor);
6220 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006221 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006222 reply.readException();
6223 data.recycle();
6224 reply.recycle();
6225 }
6226
Craig Mautner6e2f3952014-09-09 14:26:41 -07006227 @Override
6228 public void bootAnimationComplete() throws RemoteException {
6229 Parcel data = Parcel.obtain();
6230 Parcel reply = Parcel.obtain();
6231 data.writeInterfaceToken(IActivityManager.descriptor);
6232 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6233 reply.readException();
6234 data.recycle();
6235 reply.recycle();
6236 }
6237
Wale Ogunwale18795a22014-12-03 11:38:33 -08006238 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006239 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6240 Parcel data = Parcel.obtain();
6241 Parcel reply = Parcel.obtain();
6242 data.writeInterfaceToken(IActivityManager.descriptor);
6243 data.writeInt(uid);
6244 data.writeByteArray(firstPacket);
6245 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6246 reply.readException();
6247 data.recycle();
6248 reply.recycle();
6249 }
6250
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006251 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006252 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6253 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006254 Parcel data = Parcel.obtain();
6255 Parcel reply = Parcel.obtain();
6256 data.writeInterfaceToken(IActivityManager.descriptor);
6257 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006258 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006259 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006260 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006261 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6262 reply.readException();
6263 data.recycle();
6264 reply.recycle();
6265 }
6266
6267 @Override
6268 public void dumpHeapFinished(String path) throws RemoteException {
6269 Parcel data = Parcel.obtain();
6270 Parcel reply = Parcel.obtain();
6271 data.writeInterfaceToken(IActivityManager.descriptor);
6272 data.writeString(path);
6273 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6274 reply.readException();
6275 data.recycle();
6276 reply.recycle();
6277 }
6278
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006279 @Override
6280 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6281 throws RemoteException {
6282 Parcel data = Parcel.obtain();
6283 Parcel reply = Parcel.obtain();
6284 data.writeInterfaceToken(IActivityManager.descriptor);
6285 data.writeStrongBinder(session.asBinder());
6286 data.writeInt(keepAwake ? 1 : 0);
6287 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6288 reply.readException();
6289 data.recycle();
6290 reply.recycle();
6291 }
6292
Craig Mautnere5600772015-04-03 21:36:37 -07006293 @Override
6294 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6295 Parcel data = Parcel.obtain();
6296 Parcel reply = Parcel.obtain();
6297 data.writeInterfaceToken(IActivityManager.descriptor);
6298 data.writeInt(userId);
6299 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006300 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006301 reply.readException();
6302 data.recycle();
6303 reply.recycle();
6304 }
6305
Dianne Hackborn1e383822015-04-10 14:02:33 -07006306 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006307 public void updateDeviceOwner(String packageName) throws RemoteException {
6308 Parcel data = Parcel.obtain();
6309 Parcel reply = Parcel.obtain();
6310 data.writeInterfaceToken(IActivityManager.descriptor);
6311 data.writeString(packageName);
6312 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6313 reply.readException();
6314 data.recycle();
6315 reply.recycle();
6316 }
6317
6318 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006319 public int getPackageProcessState(String packageName, String callingPackage)
6320 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006321 Parcel data = Parcel.obtain();
6322 Parcel reply = Parcel.obtain();
6323 data.writeInterfaceToken(IActivityManager.descriptor);
6324 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006325 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006326 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6327 reply.readException();
6328 int res = reply.readInt();
6329 data.recycle();
6330 reply.recycle();
6331 return res;
6332 }
6333
Stefan Kuhne16045c22015-06-05 07:18:06 -07006334 @Override
6335 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6336 throws RemoteException {
6337 Parcel data = Parcel.obtain();
6338 Parcel reply = Parcel.obtain();
6339 data.writeInterfaceToken(IActivityManager.descriptor);
6340 data.writeString(process);
6341 data.writeInt(userId);
6342 data.writeInt(level);
6343 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6344 reply.readException();
6345 int res = reply.readInt();
6346 data.recycle();
6347 reply.recycle();
6348 return res != 0;
6349 }
6350
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006351 @Override
6352 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6353 Parcel data = Parcel.obtain();
6354 Parcel reply = Parcel.obtain();
6355 data.writeInterfaceToken(IActivityManager.descriptor);
6356 data.writeStrongBinder(token);
6357 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6358 reply.readException();
6359 int res = reply.readInt();
6360 data.recycle();
6361 reply.recycle();
6362 return res != 0;
6363 }
6364
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006365 @Override
6366 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6367 Parcel data = Parcel.obtain();
6368 Parcel reply = Parcel.obtain();
6369 data.writeInterfaceToken(IActivityManager.descriptor);
6370 data.writeStrongBinder(token);
6371 data.writeInt(stackId);
6372 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6373 reply.readException();
6374 data.recycle();
6375 reply.recycle();
6376 }
6377
6378 @Override
6379 public int getActivityStackId(IBinder token) throws RemoteException {
6380 Parcel data = Parcel.obtain();
6381 Parcel reply = Parcel.obtain();
6382 data.writeInterfaceToken(IActivityManager.descriptor);
6383 data.writeStrongBinder(token);
6384 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6385 reply.readException();
6386 int stackId = reply.readInt();
6387 data.recycle();
6388 reply.recycle();
6389 return stackId;
6390 }
6391
Filip Gruszczynski23493322015-07-29 17:02:59 -07006392 @Override
6393 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006394 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6395 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006396 Parcel data = Parcel.obtain();
6397 Parcel reply = Parcel.obtain();
6398 data.writeInterfaceToken(IActivityManager.descriptor);
6399 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006400 writeIntArray(horizontalSizeConfiguration, data);
6401 writeIntArray(verticalSizeConfigurations, data);
6402 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006403 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6404 reply.readException();
6405 data.recycle();
6406 reply.recycle();
6407 }
6408
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006409 private static void writeIntArray(int[] array, Parcel data) {
6410 if (array == null) {
6411 data.writeInt(0);
6412 } else {
6413 data.writeInt(array.length);
6414 data.writeIntArray(array);
6415 }
6416 }
6417
Wale Ogunwale83301a92015-09-24 15:54:08 -07006418 @Override
6419 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6420 Parcel data = Parcel.obtain();
6421 Parcel reply = Parcel.obtain();
6422 data.writeInterfaceToken(IActivityManager.descriptor);
6423 data.writeInt(suppress ? 1 : 0);
6424 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6425 reply.readException();
6426 data.recycle();
6427 reply.recycle();
6428 }
6429
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006430 @Override
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006431 public void moveTasksToFullscreenStack(int fromStackId) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006432 Parcel data = Parcel.obtain();
6433 Parcel reply = Parcel.obtain();
6434 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006435 data.writeInt(fromStackId);
6436 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006437 reply.readException();
6438 data.recycle();
6439 reply.recycle();
6440 }
6441
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006442 @Override
6443 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6444 Parcel data = Parcel.obtain();
6445 Parcel reply = Parcel.obtain();
6446 data.writeInterfaceToken(IActivityManager.descriptor);
6447 data.writeInt(uid);
6448 data.writeString(packageName);
6449 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6450 reply.readException();
6451 int res = reply.readInt();
6452 data.recycle();
6453 reply.recycle();
6454 return res;
6455 }
6456
Wale Ogunwale5f986092015-12-04 15:35:38 -08006457 @Override
6458 public boolean inMultiWindowMode(IBinder token) throws RemoteException {
6459 Parcel data = Parcel.obtain();
6460 Parcel reply = Parcel.obtain();
6461 data.writeInterfaceToken(IActivityManager.descriptor);
6462 data.writeStrongBinder(token);
6463 mRemote.transact(IN_MULTI_WINDOW_MODE_TRANSACTION, data, reply, 0);
6464 reply.readException();
6465 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6466 data.recycle();
6467 reply.recycle();
6468 return multiWindowMode;
6469 }
6470
6471 @Override
6472 public boolean inPictureInPictureMode(IBinder token) throws RemoteException {
6473 Parcel data = Parcel.obtain();
6474 Parcel reply = Parcel.obtain();
6475 data.writeInterfaceToken(IActivityManager.descriptor);
6476 data.writeStrongBinder(token);
6477 mRemote.transact(IN_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6478 reply.readException();
6479 final boolean pipMode = reply.readInt() == 1 ? true : false;
6480 data.recycle();
6481 reply.recycle();
6482 return pipMode;
6483 }
6484
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006485 @Override
6486 public void enterPictureInPictureMode(IBinder token) throws RemoteException {
6487 Parcel data = Parcel.obtain();
6488 Parcel reply = Parcel.obtain();
6489 data.writeInterfaceToken(IActivityManager.descriptor);
6490 data.writeStrongBinder(token);
6491 mRemote.transact(ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6492 reply.readException();
6493 data.recycle();
6494 reply.recycle();
6495 }
6496
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006497 private IBinder mRemote;
6498}