blob: 138ff6d08419dab8d8a87e8b956fbb87cbd1572f [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
Amith Yamasani0af6fa72016-01-17 15:36:19 -0800318 case START_LOCAL_VOICE_INTERACTION_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder token = data.readStrongBinder();
322 Bundle options = data.readBundle();
323 startLocalVoiceInteraction(token, options);
324 reply.writeNoException();
325 return true;
326 }
327
328 case STOP_LOCAL_VOICE_INTERACTION_TRANSACTION:
329 {
330 data.enforceInterface(IActivityManager.descriptor);
331 IBinder token = data.readStrongBinder();
332 stopLocalVoiceInteraction(token);
333 reply.writeNoException();
334 return true;
335 }
336
337 case SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION:
338 {
339 data.enforceInterface(IActivityManager.descriptor);
340 boolean result = supportsLocalVoiceInteraction();
341 reply.writeNoException();
342 reply.writeInt(result? 1 : 0);
343 return true;
344 }
345
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800346 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
347 {
348 data.enforceInterface(IActivityManager.descriptor);
349 IBinder callingActivity = data.readStrongBinder();
350 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700351 Bundle options = data.readInt() != 0
352 ? Bundle.CREATOR.createFromParcel(data) : null;
353 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(result ? 1 : 0);
356 return true;
357 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700358
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700359 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
360 {
361 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700362 final int taskId = data.readInt();
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700363 final Bundle options =
364 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
Wale Ogunwale854809c2015-12-27 16:18:19 -0800365 final int result = startActivityFromRecents(taskId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700366 reply.writeNoException();
367 reply.writeInt(result);
368 return true;
369 }
370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 case FINISH_ACTIVITY_TRANSACTION: {
372 data.enforceInterface(IActivityManager.descriptor);
373 IBinder token = data.readStrongBinder();
374 Intent resultData = null;
375 int resultCode = data.readInt();
376 if (data.readInt() != 0) {
377 resultData = Intent.CREATOR.createFromParcel(data);
378 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700379 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700380 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 reply.writeNoException();
382 reply.writeInt(res ? 1 : 0);
383 return true;
384 }
385
386 case FINISH_SUB_ACTIVITY_TRANSACTION: {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700389 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 int requestCode = data.readInt();
391 finishSubActivity(token, resultWho, requestCode);
392 reply.writeNoException();
393 return true;
394 }
395
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700396 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder token = data.readStrongBinder();
399 boolean res = finishActivityAffinity(token);
400 reply.writeNoException();
401 reply.writeInt(res ? 1 : 0);
402 return true;
403 }
404
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700405 case FINISH_VOICE_TASK_TRANSACTION: {
406 data.enforceInterface(IActivityManager.descriptor);
407 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
408 data.readStrongBinder());
409 finishVoiceTask(session);
410 reply.writeNoException();
411 return true;
412 }
413
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700414 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder token = data.readStrongBinder();
417 boolean res = releaseActivityInstance(token);
418 reply.writeNoException();
419 reply.writeInt(res ? 1 : 0);
420 return true;
421 }
422
423 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
426 releaseSomeActivities(app);
427 reply.writeNoException();
428 return true;
429 }
430
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800431 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
432 data.enforceInterface(IActivityManager.descriptor);
433 IBinder token = data.readStrongBinder();
434 boolean res = willActivityBeVisible(token);
435 reply.writeNoException();
436 reply.writeInt(res ? 1 : 0);
437 return true;
438 }
439
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 case REGISTER_RECEIVER_TRANSACTION:
441 {
442 data.enforceInterface(IActivityManager.descriptor);
443 IBinder b = data.readStrongBinder();
444 IApplicationThread app =
445 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700446 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 b = data.readStrongBinder();
448 IIntentReceiver rec
449 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
450 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
451 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700452 int userId = data.readInt();
453 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800454 reply.writeNoException();
455 if (intent != null) {
456 reply.writeInt(1);
457 intent.writeToParcel(reply, 0);
458 } else {
459 reply.writeInt(0);
460 }
461 return true;
462 }
463
464 case UNREGISTER_RECEIVER_TRANSACTION:
465 {
466 data.enforceInterface(IActivityManager.descriptor);
467 IBinder b = data.readStrongBinder();
468 if (b == null) {
469 return true;
470 }
471 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
472 unregisterReceiver(rec);
473 reply.writeNoException();
474 return true;
475 }
476
477 case BROADCAST_INTENT_TRANSACTION:
478 {
479 data.enforceInterface(IActivityManager.descriptor);
480 IBinder b = data.readStrongBinder();
481 IApplicationThread app =
482 b != null ? ApplicationThreadNative.asInterface(b) : null;
483 Intent intent = Intent.CREATOR.createFromParcel(data);
484 String resolvedType = data.readString();
485 b = data.readStrongBinder();
486 IIntentReceiver resultTo =
487 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
488 int resultCode = data.readInt();
489 String resultData = data.readString();
490 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700491 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800492 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700493 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 boolean serialized = data.readInt() != 0;
495 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700496 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700498 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700499 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 reply.writeNoException();
501 reply.writeInt(res);
502 return true;
503 }
504
505 case UNBROADCAST_INTENT_TRANSACTION:
506 {
507 data.enforceInterface(IActivityManager.descriptor);
508 IBinder b = data.readStrongBinder();
509 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
510 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700511 int userId = data.readInt();
512 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 reply.writeNoException();
514 return true;
515 }
516
517 case FINISH_RECEIVER_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 IBinder who = data.readStrongBinder();
520 int resultCode = data.readInt();
521 String resultData = data.readString();
522 Bundle resultExtras = data.readBundle();
523 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800524 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800526 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527 }
528 reply.writeNoException();
529 return true;
530 }
531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 case ATTACH_APPLICATION_TRANSACTION: {
533 data.enforceInterface(IActivityManager.descriptor);
534 IApplicationThread app = ApplicationThreadNative.asInterface(
535 data.readStrongBinder());
536 if (app != null) {
537 attachApplication(app);
538 }
539 reply.writeNoException();
540 return true;
541 }
542
543 case ACTIVITY_IDLE_TRANSACTION: {
544 data.enforceInterface(IActivityManager.descriptor);
545 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700546 Configuration config = null;
547 if (data.readInt() != 0) {
548 config = Configuration.CREATOR.createFromParcel(data);
549 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700550 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700552 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 }
554 reply.writeNoException();
555 return true;
556 }
557
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700558 case ACTIVITY_RESUMED_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activityResumed(token);
562 reply.writeNoException();
563 return true;
564 }
565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 case ACTIVITY_PAUSED_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700569 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800570 reply.writeNoException();
571 return true;
572 }
573
574 case ACTIVITY_STOPPED_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800577 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700578 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700580 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 reply.writeNoException();
582 return true;
583 }
584
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800585 case ACTIVITY_SLEPT_TRANSACTION: {
586 data.enforceInterface(IActivityManager.descriptor);
587 IBinder token = data.readStrongBinder();
588 activitySlept(token);
589 reply.writeNoException();
590 return true;
591 }
592
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800593 case ACTIVITY_DESTROYED_TRANSACTION: {
594 data.enforceInterface(IActivityManager.descriptor);
595 IBinder token = data.readStrongBinder();
596 activityDestroyed(token);
597 reply.writeNoException();
598 return true;
599 }
600
Jorim Jaggife89d122015-12-22 16:28:44 +0100601 case ACTIVITY_RELAUNCHED_TRANSACTION: {
602 data.enforceInterface(IActivityManager.descriptor);
603 IBinder token = data.readStrongBinder();
604 activityRelaunched(token);
605 reply.writeNoException();
606 return true;
607 }
608
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 case GET_CALLING_PACKAGE_TRANSACTION: {
610 data.enforceInterface(IActivityManager.descriptor);
611 IBinder token = data.readStrongBinder();
612 String res = token != null ? getCallingPackage(token) : null;
613 reply.writeNoException();
614 reply.writeString(res);
615 return true;
616 }
617
618 case GET_CALLING_ACTIVITY_TRANSACTION: {
619 data.enforceInterface(IActivityManager.descriptor);
620 IBinder token = data.readStrongBinder();
621 ComponentName cn = getCallingActivity(token);
622 reply.writeNoException();
623 ComponentName.writeToParcel(cn, reply);
624 return true;
625 }
626
Winson Chung1147c402014-05-14 11:05:00 -0700627 case GET_APP_TASKS_TRANSACTION: {
628 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700629 String callingPackage = data.readString();
630 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700631 reply.writeNoException();
632 int N = list != null ? list.size() : -1;
633 reply.writeInt(N);
634 int i;
635 for (i=0; i<N; i++) {
636 IAppTask task = list.get(i);
637 reply.writeStrongBinder(task.asBinder());
638 }
639 return true;
640 }
641
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700642 case ADD_APP_TASK_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 IBinder activityToken = data.readStrongBinder();
645 Intent intent = Intent.CREATOR.createFromParcel(data);
646 ActivityManager.TaskDescription descr
647 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
648 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
649 int res = addAppTask(activityToken, intent, descr, thumbnail);
650 reply.writeNoException();
651 reply.writeInt(res);
652 return true;
653 }
654
655 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
656 data.enforceInterface(IActivityManager.descriptor);
657 Point size = getAppTaskThumbnailSize();
658 reply.writeNoException();
659 size.writeToParcel(reply, 0);
660 return true;
661 }
662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800663 case GET_TASKS_TRANSACTION: {
664 data.enforceInterface(IActivityManager.descriptor);
665 int maxNum = data.readInt();
666 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700667 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 reply.writeNoException();
669 int N = list != null ? list.size() : -1;
670 reply.writeInt(N);
671 int i;
672 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700673 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800674 info.writeToParcel(reply, 0);
675 }
676 return true;
677 }
678
679 case GET_RECENT_TASKS_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 int maxNum = data.readInt();
682 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700683 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700685 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800686 reply.writeNoException();
687 reply.writeTypedList(list);
688 return true;
689 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700690
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700691 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800692 data.enforceInterface(IActivityManager.descriptor);
693 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700694 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800695 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700696 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800697 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700698 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700699 } else {
700 reply.writeInt(0);
701 }
702 return true;
703 }
704
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 case GET_SERVICES_TRANSACTION: {
706 data.enforceInterface(IActivityManager.descriptor);
707 int maxNum = data.readInt();
708 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700709 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 reply.writeNoException();
711 int N = list != null ? list.size() : -1;
712 reply.writeInt(N);
713 int i;
714 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700715 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716 info.writeToParcel(reply, 0);
717 }
718 return true;
719 }
720
721 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
724 reply.writeNoException();
725 reply.writeTypedList(list);
726 return true;
727 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700728
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
730 data.enforceInterface(IActivityManager.descriptor);
731 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
732 reply.writeNoException();
733 reply.writeTypedList(list);
734 return true;
735 }
736
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700737 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
738 data.enforceInterface(IActivityManager.descriptor);
739 List<ApplicationInfo> list = getRunningExternalApplications();
740 reply.writeNoException();
741 reply.writeTypedList(list);
742 return true;
743 }
744
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 case MOVE_TASK_TO_FRONT_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800748 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700749 Bundle options = data.readInt() != 0
750 ? Bundle.CREATOR.createFromParcel(data) : null;
751 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 reply.writeNoException();
753 return true;
754 }
755
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800756 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
758 IBinder token = data.readStrongBinder();
759 boolean nonRoot = data.readInt() != 0;
760 boolean res = moveActivityTaskToBack(token, nonRoot);
761 reply.writeNoException();
762 reply.writeInt(res ? 1 : 0);
763 return true;
764 }
765
766 case MOVE_TASK_BACKWARDS_TRANSACTION: {
767 data.enforceInterface(IActivityManager.descriptor);
768 int task = data.readInt();
769 moveTaskBackwards(task);
770 reply.writeNoException();
771 return true;
772 }
773
Craig Mautnerc00204b2013-03-05 15:02:14 -0800774 case MOVE_TASK_TO_STACK_TRANSACTION: {
775 data.enforceInterface(IActivityManager.descriptor);
776 int taskId = data.readInt();
777 int stackId = data.readInt();
778 boolean toTop = data.readInt() != 0;
779 moveTaskToStack(taskId, stackId, toTop);
780 reply.writeNoException();
781 return true;
782 }
783
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700784 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 int taskId = data.readInt();
787 int createMode = data.readInt();
788 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800789 boolean animate = data.readInt() != 0;
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -0800790 Rect bounds = null;
791 boolean hasBounds = data.readInt() != 0;
792 if (hasBounds) {
793 bounds = Rect.CREATOR.createFromParcel(data);
794 }
795 moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700796 reply.writeNoException();
797 return true;
798 }
799
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700800 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700801 data.enforceInterface(IActivityManager.descriptor);
802 final int stackId = data.readInt();
803 final Rect r = Rect.CREATOR.createFromParcel(data);
804 final boolean res = moveTopActivityToPinnedStack(stackId, r);
805 reply.writeNoException();
806 reply.writeInt(res ? 1 : 0);
807 return true;
808 }
809
Craig Mautnerc00204b2013-03-05 15:02:14 -0800810 case RESIZE_STACK_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700812 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100813 final boolean hasRect = data.readInt() != 0;
814 Rect r = null;
815 if (hasRect) {
816 r = Rect.CREATOR.createFromParcel(data);
817 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700818 final boolean allowResizeInDockedMode = data.readInt() == 1;
Filip Gruszczynski84fa3352016-01-25 16:28:49 -0800819 final boolean preserveWindows = data.readInt() == 1;
820 final boolean animate = data.readInt() == 1;
821 resizeStack(stackId, r, allowResizeInDockedMode, preserveWindows, animate);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800822 reply.writeNoException();
823 return true;
824 }
825
Jorim Jaggidc249c42015-12-15 14:57:31 -0800826 case RESIZE_DOCKED_STACK_TRANSACTION: {
827 data.enforceInterface(IActivityManager.descriptor);
828 final boolean hasBounds = data.readInt() != 0;
829 Rect bounds = null;
830 if (hasBounds) {
831 bounds = Rect.CREATOR.createFromParcel(data);
832 }
833 final boolean hasTempDockedTaskBounds = data.readInt() != 0;
834 Rect tempDockedTaskBounds = null;
835 if (hasTempDockedTaskBounds) {
836 tempDockedTaskBounds = Rect.CREATOR.createFromParcel(data);
837 }
838 final boolean hasTempDockedTaskInsetBounds = data.readInt() != 0;
839 Rect tempDockedTaskInsetBounds = null;
840 if (hasTempDockedTaskInsetBounds) {
841 tempDockedTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
842 }
843 final boolean hasTempOtherTaskBounds = data.readInt() != 0;
844 Rect tempOtherTaskBounds = null;
845 if (hasTempOtherTaskBounds) {
846 tempOtherTaskBounds = Rect.CREATOR.createFromParcel(data);
847 }
848 final boolean hasTempOtherTaskInsetBounds = data.readInt() != 0;
849 Rect tempOtherTaskInsetBounds = null;
850 if (hasTempOtherTaskInsetBounds) {
851 tempOtherTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
852 }
853 resizeDockedStack(bounds, tempDockedTaskBounds, tempDockedTaskInsetBounds,
854 tempOtherTaskBounds, tempOtherTaskInsetBounds);
855 reply.writeNoException();
856 return true;
857 }
858
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700859 case POSITION_TASK_IN_STACK_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 int taskId = data.readInt();
862 int stackId = data.readInt();
863 int position = data.readInt();
864 positionTaskInStack(taskId, stackId, position);
865 reply.writeNoException();
866 return true;
867 }
868
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800869 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700870 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800871 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700872 reply.writeNoException();
873 reply.writeTypedList(list);
874 return true;
875 }
876
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800877 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700878 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800879 int stackId = data.readInt();
880 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700881 reply.writeNoException();
882 if (info != null) {
883 reply.writeInt(1);
884 info.writeToParcel(reply, 0);
885 } else {
886 reply.writeInt(0);
887 }
888 return true;
889 }
890
Winson Chung303e1ff2014-03-07 15:06:19 -0800891 case IS_IN_HOME_STACK_TRANSACTION: {
892 data.enforceInterface(IActivityManager.descriptor);
893 int taskId = data.readInt();
894 boolean isInHomeStack = isInHomeStack(taskId);
895 reply.writeNoException();
896 reply.writeInt(isInHomeStack ? 1 : 0);
897 return true;
898 }
899
Craig Mautnercf910b02013-04-23 11:23:27 -0700900 case SET_FOCUSED_STACK_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 int stackId = data.readInt();
903 setFocusedStack(stackId);
904 reply.writeNoException();
905 return true;
906 }
907
Winson Chungd16c5652015-01-26 16:11:07 -0800908 case GET_FOCUSED_STACK_ID_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 int focusedStackId = getFocusedStackId();
911 reply.writeNoException();
912 reply.writeInt(focusedStackId);
913 return true;
914 }
915
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700916 case SET_FOCUSED_TASK_TRANSACTION: {
917 data.enforceInterface(IActivityManager.descriptor);
918 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700919 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700920 reply.writeNoException();
921 return true;
922 }
923
Winson Chung740c3ac2014-11-12 16:14:38 -0800924 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 IBinder token = data.readStrongBinder();
927 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
928 reply.writeNoException();
929 return true;
930 }
931
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800932 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 IBinder token = data.readStrongBinder();
935 boolean onlyRoot = data.readInt() != 0;
936 int res = token != null
937 ? getTaskForActivity(token, onlyRoot) : -1;
938 reply.writeNoException();
939 reply.writeInt(res);
940 return true;
941 }
942
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 case GET_CONTENT_PROVIDER_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 IBinder b = data.readStrongBinder();
946 IApplicationThread app = ApplicationThreadNative.asInterface(b);
947 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700948 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700949 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700950 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800951 reply.writeNoException();
952 if (cph != null) {
953 reply.writeInt(1);
954 cph.writeToParcel(reply, 0);
955 } else {
956 reply.writeInt(0);
957 }
958 return true;
959 }
960
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800961 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
962 data.enforceInterface(IActivityManager.descriptor);
963 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700964 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800965 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700966 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800967 reply.writeNoException();
968 if (cph != null) {
969 reply.writeInt(1);
970 cph.writeToParcel(reply, 0);
971 } else {
972 reply.writeInt(0);
973 }
974 return true;
975 }
976
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder b = data.readStrongBinder();
980 IApplicationThread app = ApplicationThreadNative.asInterface(b);
981 ArrayList<ContentProviderHolder> providers =
982 data.createTypedArrayList(ContentProviderHolder.CREATOR);
983 publishContentProviders(app, providers);
984 reply.writeNoException();
985 return true;
986 }
987
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700988 case REF_CONTENT_PROVIDER_TRANSACTION: {
989 data.enforceInterface(IActivityManager.descriptor);
990 IBinder b = data.readStrongBinder();
991 int stable = data.readInt();
992 int unstable = data.readInt();
993 boolean res = refContentProvider(b, stable, unstable);
994 reply.writeNoException();
995 reply.writeInt(res ? 1 : 0);
996 return true;
997 }
998
999 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
1000 data.enforceInterface(IActivityManager.descriptor);
1001 IBinder b = data.readStrongBinder();
1002 unstableProviderDied(b);
1003 reply.writeNoException();
1004 return true;
1005 }
1006
Jeff Sharkey7aa76012013-09-30 14:26:27 -07001007 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
1008 data.enforceInterface(IActivityManager.descriptor);
1009 IBinder b = data.readStrongBinder();
1010 appNotRespondingViaProvider(b);
1011 reply.writeNoException();
1012 return true;
1013 }
1014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
1016 data.enforceInterface(IActivityManager.descriptor);
1017 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001018 boolean stable = data.readInt() != 0;
1019 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001020 reply.writeNoException();
1021 return true;
1022 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08001023
1024 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
1025 data.enforceInterface(IActivityManager.descriptor);
1026 String name = data.readString();
1027 IBinder token = data.readStrongBinder();
1028 removeContentProviderExternal(name, token);
1029 reply.writeNoException();
1030 return true;
1031 }
1032
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001033 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
1036 PendingIntent pi = getRunningServiceControlPanel(comp);
1037 reply.writeNoException();
1038 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
1039 return true;
1040 }
1041
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001042 case START_SERVICE_TRANSACTION: {
1043 data.enforceInterface(IActivityManager.descriptor);
1044 IBinder b = data.readStrongBinder();
1045 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1046 Intent service = Intent.CREATOR.createFromParcel(data);
1047 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001048 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001049 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001050 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001051 reply.writeNoException();
1052 ComponentName.writeToParcel(cn, reply);
1053 return true;
1054 }
1055
1056 case STOP_SERVICE_TRANSACTION: {
1057 data.enforceInterface(IActivityManager.descriptor);
1058 IBinder b = data.readStrongBinder();
1059 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1060 Intent service = Intent.CREATOR.createFromParcel(data);
1061 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001062 int userId = data.readInt();
1063 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001064 reply.writeNoException();
1065 reply.writeInt(res);
1066 return true;
1067 }
1068
1069 case STOP_SERVICE_TOKEN_TRANSACTION: {
1070 data.enforceInterface(IActivityManager.descriptor);
1071 ComponentName className = ComponentName.readFromParcel(data);
1072 IBinder token = data.readStrongBinder();
1073 int startId = data.readInt();
1074 boolean res = stopServiceToken(className, token, startId);
1075 reply.writeNoException();
1076 reply.writeInt(res ? 1 : 0);
1077 return true;
1078 }
1079
1080 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 ComponentName className = ComponentName.readFromParcel(data);
1083 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001084 int id = data.readInt();
1085 Notification notification = null;
1086 if (data.readInt() != 0) {
1087 notification = Notification.CREATOR.createFromParcel(data);
1088 }
1089 boolean removeNotification = data.readInt() != 0;
1090 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 reply.writeNoException();
1092 return true;
1093 }
1094
1095 case BIND_SERVICE_TRANSACTION: {
1096 data.enforceInterface(IActivityManager.descriptor);
1097 IBinder b = data.readStrongBinder();
1098 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1099 IBinder token = data.readStrongBinder();
1100 Intent service = Intent.CREATOR.createFromParcel(data);
1101 String resolvedType = data.readString();
1102 b = data.readStrongBinder();
1103 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001104 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001105 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001106 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001107 int res = bindService(app, token, service, resolvedType, conn, fl,
1108 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001109 reply.writeNoException();
1110 reply.writeInt(res);
1111 return true;
1112 }
1113
1114 case UNBIND_SERVICE_TRANSACTION: {
1115 data.enforceInterface(IActivityManager.descriptor);
1116 IBinder b = data.readStrongBinder();
1117 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1118 boolean res = unbindService(conn);
1119 reply.writeNoException();
1120 reply.writeInt(res ? 1 : 0);
1121 return true;
1122 }
1123
1124 case PUBLISH_SERVICE_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 IBinder token = data.readStrongBinder();
1127 Intent intent = Intent.CREATOR.createFromParcel(data);
1128 IBinder service = data.readStrongBinder();
1129 publishService(token, intent, service);
1130 reply.writeNoException();
1131 return true;
1132 }
1133
1134 case UNBIND_FINISHED_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 IBinder token = data.readStrongBinder();
1137 Intent intent = Intent.CREATOR.createFromParcel(data);
1138 boolean doRebind = data.readInt() != 0;
1139 unbindFinished(token, intent, doRebind);
1140 reply.writeNoException();
1141 return true;
1142 }
1143
1144 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001147 int type = data.readInt();
1148 int startId = data.readInt();
1149 int res = data.readInt();
1150 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 reply.writeNoException();
1152 return true;
1153 }
1154
1155 case START_INSTRUMENTATION_TRANSACTION: {
1156 data.enforceInterface(IActivityManager.descriptor);
1157 ComponentName className = ComponentName.readFromParcel(data);
1158 String profileFile = data.readString();
1159 int fl = data.readInt();
1160 Bundle arguments = data.readBundle();
1161 IBinder b = data.readStrongBinder();
1162 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001163 b = data.readStrongBinder();
1164 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001165 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001166 String abiOverride = data.readString();
1167 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1168 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001169 reply.writeNoException();
1170 reply.writeInt(res ? 1 : 0);
1171 return true;
1172 }
1173
1174
1175 case FINISH_INSTRUMENTATION_TRANSACTION: {
1176 data.enforceInterface(IActivityManager.descriptor);
1177 IBinder b = data.readStrongBinder();
1178 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1179 int resultCode = data.readInt();
1180 Bundle results = data.readBundle();
1181 finishInstrumentation(app, resultCode, results);
1182 reply.writeNoException();
1183 return true;
1184 }
1185
1186 case GET_CONFIGURATION_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 Configuration config = getConfiguration();
1189 reply.writeNoException();
1190 config.writeToParcel(reply, 0);
1191 return true;
1192 }
1193
1194 case UPDATE_CONFIGURATION_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 Configuration config = Configuration.CREATOR.createFromParcel(data);
1197 updateConfiguration(config);
1198 reply.writeNoException();
1199 return true;
1200 }
1201
1202 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 IBinder token = data.readStrongBinder();
1205 int requestedOrientation = data.readInt();
1206 setRequestedOrientation(token, requestedOrientation);
1207 reply.writeNoException();
1208 return true;
1209 }
1210
1211 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1212 data.enforceInterface(IActivityManager.descriptor);
1213 IBinder token = data.readStrongBinder();
1214 int req = getRequestedOrientation(token);
1215 reply.writeNoException();
1216 reply.writeInt(req);
1217 return true;
1218 }
1219
1220 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1221 data.enforceInterface(IActivityManager.descriptor);
1222 IBinder token = data.readStrongBinder();
1223 ComponentName cn = getActivityClassForToken(token);
1224 reply.writeNoException();
1225 ComponentName.writeToParcel(cn, reply);
1226 return true;
1227 }
1228
1229 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1230 data.enforceInterface(IActivityManager.descriptor);
1231 IBinder token = data.readStrongBinder();
1232 reply.writeNoException();
1233 reply.writeString(getPackageForToken(token));
1234 return true;
1235 }
1236
1237 case GET_INTENT_SENDER_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 int type = data.readInt();
1240 String packageName = data.readString();
1241 IBinder token = data.readStrongBinder();
1242 String resultWho = data.readString();
1243 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001244 Intent[] requestIntents;
1245 String[] requestResolvedTypes;
1246 if (data.readInt() != 0) {
1247 requestIntents = data.createTypedArray(Intent.CREATOR);
1248 requestResolvedTypes = data.createStringArray();
1249 } else {
1250 requestIntents = null;
1251 requestResolvedTypes = null;
1252 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001254 Bundle options = data.readInt() != 0
1255 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001256 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001258 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001259 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001260 reply.writeNoException();
1261 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1262 return true;
1263 }
1264
1265 case CANCEL_INTENT_SENDER_TRANSACTION: {
1266 data.enforceInterface(IActivityManager.descriptor);
1267 IIntentSender r = IIntentSender.Stub.asInterface(
1268 data.readStrongBinder());
1269 cancelIntentSender(r);
1270 reply.writeNoException();
1271 return true;
1272 }
1273
1274 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1275 data.enforceInterface(IActivityManager.descriptor);
1276 IIntentSender r = IIntentSender.Stub.asInterface(
1277 data.readStrongBinder());
1278 String res = getPackageForIntentSender(r);
1279 reply.writeNoException();
1280 reply.writeString(res);
1281 return true;
1282 }
1283
Christopher Tatec4a07d12012-04-06 14:19:13 -07001284 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1285 data.enforceInterface(IActivityManager.descriptor);
1286 IIntentSender r = IIntentSender.Stub.asInterface(
1287 data.readStrongBinder());
1288 int res = getUidForIntentSender(r);
1289 reply.writeNoException();
1290 reply.writeInt(res);
1291 return true;
1292 }
1293
Dianne Hackborn41203752012-08-31 14:05:51 -07001294 case HANDLE_INCOMING_USER_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 int callingPid = data.readInt();
1297 int callingUid = data.readInt();
1298 int userId = data.readInt();
1299 boolean allowAll = data.readInt() != 0 ;
1300 boolean requireFull = data.readInt() != 0;
1301 String name = data.readString();
1302 String callerPackage = data.readString();
1303 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1304 requireFull, name, callerPackage);
1305 reply.writeNoException();
1306 reply.writeInt(res);
1307 return true;
1308 }
1309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 case SET_PROCESS_LIMIT_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 int max = data.readInt();
1313 setProcessLimit(max);
1314 reply.writeNoException();
1315 return true;
1316 }
1317
1318 case GET_PROCESS_LIMIT_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 int limit = getProcessLimit();
1321 reply.writeNoException();
1322 reply.writeInt(limit);
1323 return true;
1324 }
1325
1326 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 IBinder token = data.readStrongBinder();
1329 int pid = data.readInt();
1330 boolean isForeground = data.readInt() != 0;
1331 setProcessForeground(token, pid, isForeground);
1332 reply.writeNoException();
1333 return true;
1334 }
1335
1336 case CHECK_PERMISSION_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
1338 String perm = data.readString();
1339 int pid = data.readInt();
1340 int uid = data.readInt();
1341 int res = checkPermission(perm, pid, uid);
1342 reply.writeNoException();
1343 reply.writeInt(res);
1344 return true;
1345 }
1346
Dianne Hackbornff170242014-11-19 10:59:01 -08001347 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 String perm = data.readString();
1350 int pid = data.readInt();
1351 int uid = data.readInt();
1352 IBinder token = data.readStrongBinder();
1353 int res = checkPermissionWithToken(perm, pid, uid, token);
1354 reply.writeNoException();
1355 reply.writeInt(res);
1356 return true;
1357 }
1358
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 case CHECK_URI_PERMISSION_TRANSACTION: {
1360 data.enforceInterface(IActivityManager.descriptor);
1361 Uri uri = Uri.CREATOR.createFromParcel(data);
1362 int pid = data.readInt();
1363 int uid = data.readInt();
1364 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001365 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001366 IBinder callerToken = data.readStrongBinder();
1367 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 reply.writeNoException();
1369 reply.writeInt(res);
1370 return true;
1371 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001372
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001373 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001374 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001375 String packageName = data.readString();
1376 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1377 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001378 int userId = data.readInt();
1379 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 reply.writeNoException();
1381 reply.writeInt(res ? 1 : 0);
1382 return true;
1383 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 case GRANT_URI_PERMISSION_TRANSACTION: {
1386 data.enforceInterface(IActivityManager.descriptor);
1387 IBinder b = data.readStrongBinder();
1388 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1389 String targetPkg = data.readString();
1390 Uri uri = Uri.CREATOR.createFromParcel(data);
1391 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001392 int userId = data.readInt();
1393 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001394 reply.writeNoException();
1395 return true;
1396 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001397
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001398 case REVOKE_URI_PERMISSION_TRANSACTION: {
1399 data.enforceInterface(IActivityManager.descriptor);
1400 IBinder b = data.readStrongBinder();
1401 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1402 Uri uri = Uri.CREATOR.createFromParcel(data);
1403 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001404 int userId = data.readInt();
1405 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001406 reply.writeNoException();
1407 return true;
1408 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001409
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001410 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 Uri uri = Uri.CREATOR.createFromParcel(data);
1413 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001414 int userId = data.readInt();
1415 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001416 reply.writeNoException();
1417 return true;
1418 }
1419
1420 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1421 data.enforceInterface(IActivityManager.descriptor);
1422 Uri uri = Uri.CREATOR.createFromParcel(data);
1423 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001424 int userId = data.readInt();
1425 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001426 reply.writeNoException();
1427 return true;
1428 }
1429
1430 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1431 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001432 final String packageName = data.readString();
1433 final boolean incoming = data.readInt() != 0;
1434 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1435 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001436 reply.writeNoException();
1437 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1438 return true;
1439 }
1440
Felipe Lemef3fa0f82016-01-07 12:08:19 -08001441 case GET_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 final String packageName = data.readString();
1444 final int userId = data.readInt();
1445 final ParceledListSlice<UriPermission> perms = getGrantedUriPermissions(packageName,
1446 userId);
1447 reply.writeNoException();
1448 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1449 return true;
1450 }
1451
1452 case CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 final String packageName = data.readString();
1455 final int userId = data.readInt();
1456 clearGrantedUriPermissions(packageName, userId);
1457 reply.writeNoException();
1458 return true;
1459 }
1460
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001461 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 IBinder b = data.readStrongBinder();
1464 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1465 boolean waiting = data.readInt() != 0;
1466 showWaitingForDebugger(app, waiting);
1467 reply.writeNoException();
1468 return true;
1469 }
1470
1471 case GET_MEMORY_INFO_TRANSACTION: {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1474 getMemoryInfo(mi);
1475 reply.writeNoException();
1476 mi.writeToParcel(reply, 0);
1477 return true;
1478 }
1479
1480 case UNHANDLED_BACK_TRANSACTION: {
1481 data.enforceInterface(IActivityManager.descriptor);
1482 unhandledBack();
1483 reply.writeNoException();
1484 return true;
1485 }
1486
1487 case OPEN_CONTENT_URI_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
1489 Uri uri = Uri.parse(data.readString());
1490 ParcelFileDescriptor pfd = openContentUri(uri);
1491 reply.writeNoException();
1492 if (pfd != null) {
1493 reply.writeInt(1);
1494 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1495 } else {
1496 reply.writeInt(0);
1497 }
1498 return true;
1499 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001500
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001501 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
1503 setLockScreenShown(data.readInt() != 0);
1504 reply.writeNoException();
1505 return true;
1506 }
1507
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001508 case SET_DEBUG_APP_TRANSACTION: {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 String pn = data.readString();
1511 boolean wfd = data.readInt() != 0;
1512 boolean per = data.readInt() != 0;
1513 setDebugApp(pn, wfd, per);
1514 reply.writeNoException();
1515 return true;
1516 }
1517
1518 case SET_ALWAYS_FINISH_TRANSACTION: {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 boolean enabled = data.readInt() != 0;
1521 setAlwaysFinish(enabled);
1522 reply.writeNoException();
1523 return true;
1524 }
1525
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001526 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001527 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001528 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001529 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001530 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001531 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001532 return true;
1533 }
1534
1535 case ENTER_SAFE_MODE_TRANSACTION: {
1536 data.enforceInterface(IActivityManager.descriptor);
1537 enterSafeMode();
1538 reply.writeNoException();
1539 return true;
1540 }
1541
1542 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 IIntentSender is = IIntentSender.Stub.asInterface(
1545 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001546 int sourceUid = data.readInt();
1547 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001548 String tag = data.readString();
1549 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1550 reply.writeNoException();
1551 return true;
1552 }
1553
1554 case NOTE_ALARM_START_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 IIntentSender is = IIntentSender.Stub.asInterface(
1557 data.readStrongBinder());
1558 int sourceUid = data.readInt();
1559 String tag = data.readString();
1560 noteAlarmStart(is, sourceUid, tag);
1561 reply.writeNoException();
1562 return true;
1563 }
1564
1565 case NOTE_ALARM_FINISH_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 IIntentSender is = IIntentSender.Stub.asInterface(
1568 data.readStrongBinder());
1569 int sourceUid = data.readInt();
1570 String tag = data.readString();
1571 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001572 reply.writeNoException();
1573 return true;
1574 }
1575
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001576 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001577 data.enforceInterface(IActivityManager.descriptor);
1578 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001579 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001580 boolean secure = data.readInt() != 0;
1581 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001582 reply.writeNoException();
1583 reply.writeInt(res ? 1 : 0);
1584 return true;
1585 }
1586
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001587 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1588 data.enforceInterface(IActivityManager.descriptor);
1589 String reason = data.readString();
1590 boolean res = killProcessesBelowForeground(reason);
1591 reply.writeNoException();
1592 reply.writeInt(res ? 1 : 0);
1593 return true;
1594 }
1595
Dan Egnor60d87622009-12-16 16:32:58 -08001596 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 IBinder app = data.readStrongBinder();
1599 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1600 handleApplicationCrash(app, ci);
1601 reply.writeNoException();
1602 return true;
1603 }
1604
1605 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001606 data.enforceInterface(IActivityManager.descriptor);
1607 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001608 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001609 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001610 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001611 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001612 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001613 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001614 return true;
1615 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001616
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001617 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1618 data.enforceInterface(IActivityManager.descriptor);
1619 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001620 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001621 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1622 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001623 reply.writeNoException();
1624 return true;
1625 }
1626
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001627 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1628 data.enforceInterface(IActivityManager.descriptor);
1629 int sig = data.readInt();
1630 signalPersistentProcesses(sig);
1631 reply.writeNoException();
1632 return true;
1633 }
1634
Dianne Hackborn03abb812010-01-04 18:43:19 -08001635 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1636 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001637 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001638 int userId = data.readInt();
1639 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001640 reply.writeNoException();
1641 return true;
1642 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001643
1644 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1645 data.enforceInterface(IActivityManager.descriptor);
1646 killAllBackgroundProcesses();
1647 reply.writeNoException();
1648 return true;
1649 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001650
Gustav Sennton6258dcd2015-10-30 19:25:37 +00001651 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: {
1652 data.enforceInterface(IActivityManager.descriptor);
1653 String packageName = data.readString();
1654 int userId = data.readInt();
1655 killPackageDependents(packageName, userId);
1656 reply.writeNoException();
1657 return true;
1658 }
1659
Dianne Hackborn03abb812010-01-04 18:43:19 -08001660 case FORCE_STOP_PACKAGE_TRANSACTION: {
1661 data.enforceInterface(IActivityManager.descriptor);
1662 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001663 int userId = data.readInt();
1664 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001665 reply.writeNoException();
1666 return true;
1667 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001668
1669 case GET_MY_MEMORY_STATE_TRANSACTION: {
1670 data.enforceInterface(IActivityManager.descriptor);
1671 ActivityManager.RunningAppProcessInfo info =
1672 new ActivityManager.RunningAppProcessInfo();
1673 getMyMemoryState(info);
1674 reply.writeNoException();
1675 info.writeToParcel(reply, 0);
1676 return true;
1677 }
1678
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001679 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1680 data.enforceInterface(IActivityManager.descriptor);
1681 ConfigurationInfo config = getDeviceConfigurationInfo();
1682 reply.writeNoException();
1683 config.writeToParcel(reply, 0);
1684 return true;
1685 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001686
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001687 case PROFILE_CONTROL_TRANSACTION: {
1688 data.enforceInterface(IActivityManager.descriptor);
1689 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001690 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001691 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001692 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001693 ProfilerInfo profilerInfo = data.readInt() != 0
1694 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1695 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001696 reply.writeNoException();
1697 reply.writeInt(res ? 1 : 0);
1698 return true;
1699 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001700
Dianne Hackborn55280a92009-05-07 15:53:46 -07001701 case SHUTDOWN_TRANSACTION: {
1702 data.enforceInterface(IActivityManager.descriptor);
1703 boolean res = shutdown(data.readInt());
1704 reply.writeNoException();
1705 reply.writeInt(res ? 1 : 0);
1706 return true;
1707 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001708
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001709 case STOP_APP_SWITCHES_TRANSACTION: {
1710 data.enforceInterface(IActivityManager.descriptor);
1711 stopAppSwitches();
1712 reply.writeNoException();
1713 return true;
1714 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001715
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001716 case RESUME_APP_SWITCHES_TRANSACTION: {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 resumeAppSwitches();
1719 reply.writeNoException();
1720 return true;
1721 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001722
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001723 case PEEK_SERVICE_TRANSACTION: {
1724 data.enforceInterface(IActivityManager.descriptor);
1725 Intent service = Intent.CREATOR.createFromParcel(data);
1726 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001727 String callingPackage = data.readString();
1728 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001729 reply.writeNoException();
1730 reply.writeStrongBinder(binder);
1731 return true;
1732 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001733
Christopher Tate181fafa2009-05-14 11:12:14 -07001734 case START_BACKUP_AGENT_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1737 int backupRestoreMode = data.readInt();
1738 boolean success = bindBackupAgent(info, backupRestoreMode);
1739 reply.writeNoException();
1740 reply.writeInt(success ? 1 : 0);
1741 return true;
1742 }
1743
1744 case BACKUP_AGENT_CREATED_TRANSACTION: {
1745 data.enforceInterface(IActivityManager.descriptor);
1746 String packageName = data.readString();
1747 IBinder agent = data.readStrongBinder();
1748 backupAgentCreated(packageName, agent);
1749 reply.writeNoException();
1750 return true;
1751 }
1752
1753 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1754 data.enforceInterface(IActivityManager.descriptor);
1755 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1756 unbindBackupAgent(info);
1757 reply.writeNoException();
1758 return true;
1759 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001760
1761 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 String packageName = data.readString();
1764 addPackageDependency(packageName);
1765 reply.writeNoException();
1766 return true;
1767 }
1768
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001769 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001770 data.enforceInterface(IActivityManager.descriptor);
1771 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001772 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001773 String reason = data.readString();
1774 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001775 reply.writeNoException();
1776 return true;
1777 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001778
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001779 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1780 data.enforceInterface(IActivityManager.descriptor);
1781 String reason = data.readString();
1782 closeSystemDialogs(reason);
1783 reply.writeNoException();
1784 return true;
1785 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001786
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001787 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1788 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001789 int[] pids = data.createIntArray();
1790 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001791 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001792 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001793 return true;
1794 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001795
1796 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
1798 String processName = data.readString();
1799 int uid = data.readInt();
1800 killApplicationProcess(processName, uid);
1801 reply.writeNoException();
1802 return true;
1803 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001804
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001805 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1806 data.enforceInterface(IActivityManager.descriptor);
1807 IBinder token = data.readStrongBinder();
1808 String packageName = data.readString();
1809 int enterAnim = data.readInt();
1810 int exitAnim = data.readInt();
1811 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001812 reply.writeNoException();
1813 return true;
1814 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001815
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001816 case IS_USER_A_MONKEY_TRANSACTION: {
1817 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001818 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001819 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001820 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001821 return true;
1822 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001823
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001824 case SET_USER_IS_MONKEY_TRANSACTION: {
1825 data.enforceInterface(IActivityManager.descriptor);
1826 final boolean monkey = (data.readInt() == 1);
1827 setUserIsMonkey(monkey);
1828 reply.writeNoException();
1829 return true;
1830 }
1831
Dianne Hackborn860755f2010-06-03 18:47:52 -07001832 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1833 data.enforceInterface(IActivityManager.descriptor);
1834 finishHeavyWeightApp();
1835 reply.writeNoException();
1836 return true;
1837 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001838
1839 case IS_IMMERSIVE_TRANSACTION: {
1840 data.enforceInterface(IActivityManager.descriptor);
1841 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001842 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001843 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001844 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001845 return true;
1846 }
1847
Craig Mautnerd61dc202014-07-07 11:09:11 -07001848 case IS_TOP_OF_TASK_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 IBinder token = data.readStrongBinder();
1851 final boolean isTopOfTask = isTopOfTask(token);
1852 reply.writeNoException();
1853 reply.writeInt(isTopOfTask ? 1 : 0);
1854 return true;
1855 }
1856
Craig Mautner5eda9b32013-07-02 11:58:16 -07001857 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001858 data.enforceInterface(IActivityManager.descriptor);
1859 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001860 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001861 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001862 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001863 return true;
1864 }
1865
1866 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1867 data.enforceInterface(IActivityManager.descriptor);
1868 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001869 final Bundle bundle;
1870 if (data.readInt() == 0) {
1871 bundle = null;
1872 } else {
1873 bundle = data.readBundle();
1874 }
Chong Zhang280d3322015-11-03 17:27:26 -08001875 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001876 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001877 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001878 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001879 return true;
1880 }
1881
Craig Mautner233ceee2014-05-09 17:05:11 -07001882 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1883 data.enforceInterface(IActivityManager.descriptor);
1884 IBinder token = data.readStrongBinder();
1885 final ActivityOptions options = getActivityOptions(token);
1886 reply.writeNoException();
1887 reply.writeBundle(options == null ? null : options.toBundle());
1888 return true;
1889 }
1890
Daniel Sandler69a48172010-06-23 16:29:36 -04001891 case SET_IMMERSIVE_TRANSACTION: {
1892 data.enforceInterface(IActivityManager.descriptor);
1893 IBinder token = data.readStrongBinder();
1894 boolean imm = data.readInt() == 1;
1895 setImmersive(token, imm);
1896 reply.writeNoException();
1897 return true;
1898 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001899
Daniel Sandler69a48172010-06-23 16:29:36 -04001900 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1901 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001902 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001903 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001904 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001905 return true;
1906 }
1907
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001908 case CRASH_APPLICATION_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 int uid = data.readInt();
1911 int initialPid = data.readInt();
1912 String packageName = data.readString();
1913 String message = data.readString();
1914 crashApplication(uid, initialPid, packageName, message);
1915 reply.writeNoException();
1916 return true;
1917 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001918
1919 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1920 data.enforceInterface(IActivityManager.descriptor);
1921 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001922 int userId = data.readInt();
1923 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001924 reply.writeNoException();
1925 reply.writeString(type);
1926 return true;
1927 }
1928
Dianne Hackborn7e269642010-08-25 19:50:20 -07001929 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 String name = data.readString();
1932 IBinder perm = newUriPermissionOwner(name);
1933 reply.writeNoException();
1934 reply.writeStrongBinder(perm);
1935 return true;
1936 }
1937
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08001938 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: {
1939 data.enforceInterface(IActivityManager.descriptor);
1940 IBinder activityToken = data.readStrongBinder();
1941 IBinder perm = getUriPermissionOwnerForActivity(activityToken);
1942 reply.writeNoException();
1943 reply.writeStrongBinder(perm);
1944 return true;
1945 }
1946
Dianne Hackborn7e269642010-08-25 19:50:20 -07001947 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1948 data.enforceInterface(IActivityManager.descriptor);
1949 IBinder owner = data.readStrongBinder();
1950 int fromUid = data.readInt();
1951 String targetPkg = data.readString();
1952 Uri uri = Uri.CREATOR.createFromParcel(data);
1953 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001954 int sourceUserId = data.readInt();
1955 int targetUserId = data.readInt();
1956 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1957 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001958 reply.writeNoException();
1959 return true;
1960 }
1961
1962 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1963 data.enforceInterface(IActivityManager.descriptor);
1964 IBinder owner = data.readStrongBinder();
1965 Uri uri = null;
1966 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001967 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001968 }
1969 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001970 int userId = data.readInt();
1971 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001972 reply.writeNoException();
1973 return true;
1974 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001975
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001976 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 int callingUid = data.readInt();
1979 String targetPkg = data.readString();
1980 Uri uri = Uri.CREATOR.createFromParcel(data);
1981 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001982 int userId = data.readInt();
1983 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001984 reply.writeNoException();
1985 reply.writeInt(res);
1986 return true;
1987 }
1988
Andy McFadden824c5102010-07-09 16:26:57 -07001989 case DUMP_HEAP_TRANSACTION: {
1990 data.enforceInterface(IActivityManager.descriptor);
1991 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001992 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001993 boolean managed = data.readInt() != 0;
1994 String path = data.readString();
1995 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001996 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001997 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001998 reply.writeNoException();
1999 reply.writeInt(res ? 1 : 0);
2000 return true;
2001 }
2002
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002003 case START_ACTIVITIES_TRANSACTION:
2004 {
2005 data.enforceInterface(IActivityManager.descriptor);
2006 IBinder b = data.readStrongBinder();
2007 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002008 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002009 Intent[] intents = data.createTypedArray(Intent.CREATOR);
2010 String[] resolvedTypes = data.createStringArray();
2011 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07002012 Bundle options = data.readInt() != 0
2013 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002014 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002015 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002016 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002017 reply.writeNoException();
2018 reply.writeInt(result);
2019 return true;
2020 }
2021
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002022 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2023 {
2024 data.enforceInterface(IActivityManager.descriptor);
2025 int mode = getFrontActivityScreenCompatMode();
2026 reply.writeNoException();
2027 reply.writeInt(mode);
2028 return true;
2029 }
2030
2031 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2032 {
2033 data.enforceInterface(IActivityManager.descriptor);
2034 int mode = data.readInt();
2035 setFrontActivityScreenCompatMode(mode);
2036 reply.writeNoException();
2037 reply.writeInt(mode);
2038 return true;
2039 }
2040
2041 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2042 {
2043 data.enforceInterface(IActivityManager.descriptor);
2044 String pkg = data.readString();
2045 int mode = getPackageScreenCompatMode(pkg);
2046 reply.writeNoException();
2047 reply.writeInt(mode);
2048 return true;
2049 }
2050
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002051 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2052 {
2053 data.enforceInterface(IActivityManager.descriptor);
2054 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002055 int mode = data.readInt();
2056 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002057 reply.writeNoException();
2058 return true;
2059 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002060
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002061 case SWITCH_USER_TRANSACTION: {
2062 data.enforceInterface(IActivityManager.descriptor);
2063 int userid = data.readInt();
2064 boolean result = switchUser(userid);
2065 reply.writeNoException();
2066 reply.writeInt(result ? 1 : 0);
2067 return true;
2068 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07002069
Kenny Guy08488bf2014-02-21 17:40:37 +00002070 case START_USER_IN_BACKGROUND_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 int userid = data.readInt();
2073 boolean result = startUserInBackground(userid);
2074 reply.writeNoException();
2075 reply.writeInt(result ? 1 : 0);
2076 return true;
2077 }
2078
Jeff Sharkeyba512352015-11-12 20:17:45 -08002079 case UNLOCK_USER_TRANSACTION: {
2080 data.enforceInterface(IActivityManager.descriptor);
2081 int userId = data.readInt();
2082 byte[] token = data.createByteArray();
2083 boolean result = unlockUser(userId, token);
2084 reply.writeNoException();
2085 reply.writeInt(result ? 1 : 0);
2086 return true;
2087 }
2088
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002089 case STOP_USER_TRANSACTION: {
2090 data.enforceInterface(IActivityManager.descriptor);
2091 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002092 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002093 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2094 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002095 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002096 reply.writeNoException();
2097 reply.writeInt(result);
2098 return true;
2099 }
2100
Amith Yamasani52f1d752012-03-28 18:19:29 -07002101 case GET_CURRENT_USER_TRANSACTION: {
2102 data.enforceInterface(IActivityManager.descriptor);
2103 UserInfo userInfo = getCurrentUser();
2104 reply.writeNoException();
2105 userInfo.writeToParcel(reply, 0);
2106 return true;
2107 }
2108
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002109 case IS_USER_RUNNING_TRANSACTION: {
2110 data.enforceInterface(IActivityManager.descriptor);
2111 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002112 int _flags = data.readInt();
2113 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002114 reply.writeNoException();
2115 reply.writeInt(result ? 1 : 0);
2116 return true;
2117 }
2118
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002119 case GET_RUNNING_USER_IDS_TRANSACTION: {
2120 data.enforceInterface(IActivityManager.descriptor);
2121 int[] result = getRunningUserIds();
2122 reply.writeNoException();
2123 reply.writeIntArray(result);
2124 return true;
2125 }
2126
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002127 case REMOVE_TASK_TRANSACTION:
2128 {
2129 data.enforceInterface(IActivityManager.descriptor);
2130 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002131 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002132 reply.writeNoException();
2133 reply.writeInt(result ? 1 : 0);
2134 return true;
2135 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002136
Jeff Sharkeya4620792011-05-20 15:29:23 -07002137 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2138 data.enforceInterface(IActivityManager.descriptor);
2139 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2140 data.readStrongBinder());
2141 registerProcessObserver(observer);
2142 return true;
2143 }
2144
2145 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2146 data.enforceInterface(IActivityManager.descriptor);
2147 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2148 data.readStrongBinder());
2149 unregisterProcessObserver(observer);
2150 return true;
2151 }
2152
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002153 case REGISTER_UID_OBSERVER_TRANSACTION: {
2154 data.enforceInterface(IActivityManager.descriptor);
2155 IUidObserver observer = IUidObserver.Stub.asInterface(
2156 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002157 int which = data.readInt();
2158 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002159 return true;
2160 }
2161
2162 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2163 data.enforceInterface(IActivityManager.descriptor);
2164 IUidObserver observer = IUidObserver.Stub.asInterface(
2165 data.readStrongBinder());
2166 unregisterUidObserver(observer);
2167 return true;
2168 }
2169
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002170 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2171 {
2172 data.enforceInterface(IActivityManager.descriptor);
2173 String pkg = data.readString();
2174 boolean ask = getPackageAskScreenCompat(pkg);
2175 reply.writeNoException();
2176 reply.writeInt(ask ? 1 : 0);
2177 return true;
2178 }
2179
2180 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2181 {
2182 data.enforceInterface(IActivityManager.descriptor);
2183 String pkg = data.readString();
2184 boolean ask = data.readInt() != 0;
2185 setPackageAskScreenCompat(pkg, ask);
2186 reply.writeNoException();
2187 return true;
2188 }
2189
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002190 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2191 data.enforceInterface(IActivityManager.descriptor);
2192 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002193 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002194 boolean res = isIntentSenderTargetedToPackage(r);
2195 reply.writeNoException();
2196 reply.writeInt(res ? 1 : 0);
2197 return true;
2198 }
2199
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002200 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2201 data.enforceInterface(IActivityManager.descriptor);
2202 IIntentSender r = IIntentSender.Stub.asInterface(
2203 data.readStrongBinder());
2204 boolean res = isIntentSenderAnActivity(r);
2205 reply.writeNoException();
2206 reply.writeInt(res ? 1 : 0);
2207 return true;
2208 }
2209
Dianne Hackborn81038902012-11-26 17:04:09 -08002210 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2211 data.enforceInterface(IActivityManager.descriptor);
2212 IIntentSender r = IIntentSender.Stub.asInterface(
2213 data.readStrongBinder());
2214 Intent intent = getIntentForIntentSender(r);
2215 reply.writeNoException();
2216 if (intent != null) {
2217 reply.writeInt(1);
2218 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2219 } else {
2220 reply.writeInt(0);
2221 }
2222 return true;
2223 }
2224
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002225 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2226 data.enforceInterface(IActivityManager.descriptor);
2227 IIntentSender r = IIntentSender.Stub.asInterface(
2228 data.readStrongBinder());
2229 String prefix = data.readString();
2230 String tag = getTagForIntentSender(r, prefix);
2231 reply.writeNoException();
2232 reply.writeString(tag);
2233 return true;
2234 }
2235
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002236 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 Configuration config = Configuration.CREATOR.createFromParcel(data);
2239 updatePersistentConfiguration(config);
2240 reply.writeNoException();
2241 return true;
2242 }
2243
Dianne Hackbornb437e092011-08-05 17:50:29 -07002244 case GET_PROCESS_PSS_TRANSACTION: {
2245 data.enforceInterface(IActivityManager.descriptor);
2246 int[] pids = data.createIntArray();
2247 long[] pss = getProcessPss(pids);
2248 reply.writeNoException();
2249 reply.writeLongArray(pss);
2250 return true;
2251 }
2252
Dianne Hackborn661cd522011-08-22 00:26:20 -07002253 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2254 data.enforceInterface(IActivityManager.descriptor);
2255 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2256 boolean always = data.readInt() != 0;
2257 showBootMessage(msg, always);
2258 reply.writeNoException();
2259 return true;
2260 }
2261
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002262 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002263 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002264 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002265 reply.writeNoException();
2266 return true;
2267 }
2268
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002269 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2270 data.enforceInterface(IActivityManager.descriptor);
2271 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2272 reply.writeNoException();
2273 return true;
2274 }
2275
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002276 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002277 data.enforceInterface(IActivityManager.descriptor);
2278 IBinder token = data.readStrongBinder();
2279 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002280 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002281 reply.writeNoException();
2282 reply.writeInt(res ? 1 : 0);
2283 return true;
2284 }
2285
2286 case NAVIGATE_UP_TO_TRANSACTION: {
2287 data.enforceInterface(IActivityManager.descriptor);
2288 IBinder token = data.readStrongBinder();
2289 Intent target = Intent.CREATOR.createFromParcel(data);
2290 int resultCode = data.readInt();
2291 Intent resultData = null;
2292 if (data.readInt() != 0) {
2293 resultData = Intent.CREATOR.createFromParcel(data);
2294 }
2295 boolean res = navigateUpTo(token, target, resultCode, resultData);
2296 reply.writeNoException();
2297 reply.writeInt(res ? 1 : 0);
2298 return true;
2299 }
2300
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002301 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2302 data.enforceInterface(IActivityManager.descriptor);
2303 IBinder token = data.readStrongBinder();
2304 int res = getLaunchedFromUid(token);
2305 reply.writeNoException();
2306 reply.writeInt(res);
2307 return true;
2308 }
2309
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002310 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2311 data.enforceInterface(IActivityManager.descriptor);
2312 IBinder token = data.readStrongBinder();
2313 String res = getLaunchedFromPackage(token);
2314 reply.writeNoException();
2315 reply.writeString(res);
2316 return true;
2317 }
2318
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002319 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2320 data.enforceInterface(IActivityManager.descriptor);
2321 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2322 data.readStrongBinder());
2323 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002324 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002325 return true;
2326 }
2327
2328 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2329 data.enforceInterface(IActivityManager.descriptor);
2330 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2331 data.readStrongBinder());
2332 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002333 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002334 return true;
2335 }
2336
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002337 case REQUEST_BUG_REPORT_TRANSACTION: {
2338 data.enforceInterface(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00002339 int bugreportType = data.readInt();
2340 requestBugReport(bugreportType);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002341 reply.writeNoException();
2342 return true;
2343 }
2344
2345 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2346 data.enforceInterface(IActivityManager.descriptor);
2347 int pid = data.readInt();
2348 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002349 String reason = data.readString();
2350 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002351 reply.writeNoException();
2352 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002353 return true;
2354 }
2355
Adam Skorydfc7fd72013-08-05 19:23:41 -07002356 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002357 data.enforceInterface(IActivityManager.descriptor);
2358 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002359 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002360 reply.writeNoException();
2361 reply.writeBundle(res);
2362 return true;
2363 }
2364
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002365 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2366 data.enforceInterface(IActivityManager.descriptor);
2367 int requestType = data.readInt();
2368 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002369 IBinder activityToken = data.readStrongBinder();
2370 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002371 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002372 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002373 return true;
2374 }
2375
Adam Skorydfc7fd72013-08-05 19:23:41 -07002376 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002377 data.enforceInterface(IActivityManager.descriptor);
2378 IBinder token = data.readStrongBinder();
2379 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002380 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2381 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002382 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2383 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002384 reply.writeNoException();
2385 return true;
2386 }
2387
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002388 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2389 data.enforceInterface(IActivityManager.descriptor);
2390 Intent intent = Intent.CREATOR.createFromParcel(data);
2391 int requestType = data.readInt();
2392 String hint = data.readString();
2393 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002394 Bundle args = data.readBundle();
2395 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002396 reply.writeNoException();
2397 reply.writeInt(res ? 1 : 0);
2398 return true;
2399 }
2400
Benjamin Franzc200f442015-06-25 18:20:04 +01002401 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2402 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002403 boolean res = isAssistDataAllowedOnCurrentActivity();
2404 reply.writeNoException();
2405 reply.writeInt(res ? 1 : 0);
2406 return true;
2407 }
2408
2409 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2410 data.enforceInterface(IActivityManager.descriptor);
2411 IBinder token = data.readStrongBinder();
2412 Bundle args = data.readBundle();
2413 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002414 reply.writeNoException();
2415 reply.writeInt(res ? 1 : 0);
2416 return true;
2417 }
2418
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002419 case KILL_UID_TRANSACTION: {
2420 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002421 int appId = data.readInt();
2422 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002423 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002424 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002425 reply.writeNoException();
2426 return true;
2427 }
2428
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002429 case HANG_TRANSACTION: {
2430 data.enforceInterface(IActivityManager.descriptor);
2431 IBinder who = data.readStrongBinder();
2432 boolean allowRestart = data.readInt() != 0;
2433 hang(who, allowRestart);
2434 reply.writeNoException();
2435 return true;
2436 }
2437
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002438 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2439 data.enforceInterface(IActivityManager.descriptor);
2440 IBinder token = data.readStrongBinder();
2441 reportActivityFullyDrawn(token);
2442 reply.writeNoException();
2443 return true;
2444 }
2445
Craig Mautner5eda9b32013-07-02 11:58:16 -07002446 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2447 data.enforceInterface(IActivityManager.descriptor);
2448 IBinder token = data.readStrongBinder();
2449 notifyActivityDrawn(token);
2450 reply.writeNoException();
2451 return true;
2452 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002453
2454 case RESTART_TRANSACTION: {
2455 data.enforceInterface(IActivityManager.descriptor);
2456 restart();
2457 reply.writeNoException();
2458 return true;
2459 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002460
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002461 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2462 data.enforceInterface(IActivityManager.descriptor);
2463 performIdleMaintenance();
2464 reply.writeNoException();
2465 return true;
2466 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002467
Todd Kennedyca4d8422015-01-15 15:19:22 -08002468 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002469 data.enforceInterface(IActivityManager.descriptor);
2470 IBinder parentActivityToken = data.readStrongBinder();
2471 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002472 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002473 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002474 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002475 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002476 if (activityContainer != null) {
2477 reply.writeInt(1);
2478 reply.writeStrongBinder(activityContainer.asBinder());
2479 } else {
2480 reply.writeInt(0);
2481 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002482 return true;
2483 }
2484
Craig Mautner95da1082014-02-24 17:54:35 -08002485 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2486 data.enforceInterface(IActivityManager.descriptor);
2487 IActivityContainer activityContainer =
2488 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2489 deleteActivityContainer(activityContainer);
2490 reply.writeNoException();
2491 return true;
2492 }
2493
Todd Kennedy4900bf92015-01-16 16:05:14 -08002494 case CREATE_STACK_ON_DISPLAY: {
2495 data.enforceInterface(IActivityManager.descriptor);
2496 int displayId = data.readInt();
2497 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2498 reply.writeNoException();
2499 if (activityContainer != null) {
2500 reply.writeInt(1);
2501 reply.writeStrongBinder(activityContainer.asBinder());
2502 } else {
2503 reply.writeInt(0);
2504 }
2505 return true;
2506 }
2507
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002508 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002509 data.enforceInterface(IActivityManager.descriptor);
2510 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002511 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002512 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002513 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002514 return true;
2515 }
2516
Craig Mautneraea74a52014-03-08 14:23:10 -08002517 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2518 data.enforceInterface(IActivityManager.descriptor);
2519 final int taskId = data.readInt();
2520 startLockTaskMode(taskId);
2521 reply.writeNoException();
2522 return true;
2523 }
2524
2525 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2526 data.enforceInterface(IActivityManager.descriptor);
2527 IBinder token = data.readStrongBinder();
2528 startLockTaskMode(token);
2529 reply.writeNoException();
2530 return true;
2531 }
2532
Craig Mautnerd61dc202014-07-07 11:09:11 -07002533 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002534 data.enforceInterface(IActivityManager.descriptor);
2535 startLockTaskModeOnCurrent();
2536 reply.writeNoException();
2537 return true;
2538 }
2539
Craig Mautneraea74a52014-03-08 14:23:10 -08002540 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2541 data.enforceInterface(IActivityManager.descriptor);
2542 stopLockTaskMode();
2543 reply.writeNoException();
2544 return true;
2545 }
2546
Craig Mautnerd61dc202014-07-07 11:09:11 -07002547 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002548 data.enforceInterface(IActivityManager.descriptor);
2549 stopLockTaskModeOnCurrent();
2550 reply.writeNoException();
2551 return true;
2552 }
2553
Craig Mautneraea74a52014-03-08 14:23:10 -08002554 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2555 data.enforceInterface(IActivityManager.descriptor);
2556 final boolean isInLockTaskMode = isInLockTaskMode();
2557 reply.writeNoException();
2558 reply.writeInt(isInLockTaskMode ? 1 : 0);
2559 return true;
2560 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002561
Benjamin Franz43261142015-02-11 15:59:44 +00002562 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2563 data.enforceInterface(IActivityManager.descriptor);
2564 final int lockTaskModeState = getLockTaskModeState();
2565 reply.writeNoException();
2566 reply.writeInt(lockTaskModeState);
2567 return true;
2568 }
2569
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002570 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2571 data.enforceInterface(IActivityManager.descriptor);
2572 final IBinder token = data.readStrongBinder();
2573 showLockTaskEscapeMessage(token);
2574 reply.writeNoException();
2575 return true;
2576 }
2577
Winson Chunga449dc02014-05-16 11:15:04 -07002578 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002579 data.enforceInterface(IActivityManager.descriptor);
2580 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002581 ActivityManager.TaskDescription values =
2582 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2583 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002584 reply.writeNoException();
2585 return true;
2586 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002587
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002588 case SET_TASK_RESIZEABLE_TRANSACTION: {
2589 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08002590 final int taskId = data.readInt();
2591 final int resizeableMode = data.readInt();
2592 setTaskResizeable(taskId, resizeableMode);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002593 reply.writeNoException();
2594 return true;
2595 }
2596
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002597 case RESIZE_TASK_TRANSACTION: {
2598 data.enforceInterface(IActivityManager.descriptor);
2599 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002600 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002601 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002602 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002603 reply.writeNoException();
2604 return true;
2605 }
2606
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002607 case GET_TASK_BOUNDS_TRANSACTION: {
2608 data.enforceInterface(IActivityManager.descriptor);
2609 int taskId = data.readInt();
2610 Rect r = getTaskBounds(taskId);
2611 reply.writeNoException();
2612 r.writeToParcel(reply, 0);
2613 return true;
2614 }
2615
Craig Mautner648f69b2014-09-18 14:16:26 -07002616 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2617 data.enforceInterface(IActivityManager.descriptor);
2618 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002619 int userId = data.readInt();
2620 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002621 reply.writeNoException();
2622 if (icon == null) {
2623 reply.writeInt(0);
2624 } else {
2625 reply.writeInt(1);
2626 icon.writeToParcel(reply, 0);
2627 }
2628 return true;
2629 }
2630
Winson Chung044d5292014-11-06 11:05:19 -08002631 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2632 data.enforceInterface(IActivityManager.descriptor);
2633 final Bundle bundle;
2634 if (data.readInt() == 0) {
2635 bundle = null;
2636 } else {
2637 bundle = data.readBundle();
2638 }
Chong Zhang280d3322015-11-03 17:27:26 -08002639 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002640 startInPlaceAnimationOnFrontMostApplication(options);
2641 reply.writeNoException();
2642 return true;
2643 }
2644
Jose Lima4b6c6692014-08-12 17:41:12 -07002645 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002646 data.enforceInterface(IActivityManager.descriptor);
2647 IBinder token = data.readStrongBinder();
2648 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002649 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002650 reply.writeNoException();
2651 reply.writeInt(success ? 1 : 0);
2652 return true;
2653 }
2654
Jose Lima4b6c6692014-08-12 17:41:12 -07002655 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002656 data.enforceInterface(IActivityManager.descriptor);
2657 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002658 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002659 reply.writeNoException();
2660 reply.writeInt(enabled ? 1 : 0);
2661 return true;
2662 }
2663
Jose Lima4b6c6692014-08-12 17:41:12 -07002664 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002665 data.enforceInterface(IActivityManager.descriptor);
2666 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002667 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002668 reply.writeNoException();
2669 return true;
2670 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002671
2672 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2673 data.enforceInterface(IActivityManager.descriptor);
2674 IBinder token = data.readStrongBinder();
2675 notifyLaunchTaskBehindComplete(token);
2676 reply.writeNoException();
2677 return true;
2678 }
Craig Mautner8746a472014-07-24 15:12:54 -07002679
2680 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2681 data.enforceInterface(IActivityManager.descriptor);
2682 IBinder token = data.readStrongBinder();
2683 notifyEnterAnimationComplete(token);
2684 reply.writeNoException();
2685 return true;
2686 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002687
2688 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2689 data.enforceInterface(IActivityManager.descriptor);
2690 bootAnimationComplete();
2691 reply.writeNoException();
2692 return true;
2693 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002694
Jeff Sharkey605eb792014-11-04 13:34:06 -08002695 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2696 data.enforceInterface(IActivityManager.descriptor);
2697 final int uid = data.readInt();
2698 final byte[] firstPacket = data.createByteArray();
2699 notifyCleartextNetwork(uid, firstPacket);
2700 reply.writeNoException();
2701 return true;
2702 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002703
2704 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2705 data.enforceInterface(IActivityManager.descriptor);
2706 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002707 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002708 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002709 String reportPackage = data.readString();
2710 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002711 reply.writeNoException();
2712 return true;
2713 }
2714
2715 case DUMP_HEAP_FINISHED_TRANSACTION: {
2716 data.enforceInterface(IActivityManager.descriptor);
2717 String path = data.readString();
2718 dumpHeapFinished(path);
2719 reply.writeNoException();
2720 return true;
2721 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002722
2723 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2724 data.enforceInterface(IActivityManager.descriptor);
2725 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2726 data.readStrongBinder());
2727 boolean keepAwake = data.readInt() != 0;
2728 setVoiceKeepAwake(session, keepAwake);
2729 reply.writeNoException();
2730 return true;
2731 }
Craig Mautnere5600772015-04-03 21:36:37 -07002732
2733 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2734 data.enforceInterface(IActivityManager.descriptor);
2735 int userId = data.readInt();
2736 String[] packages = data.readStringArray();
2737 updateLockTaskPackages(userId, packages);
2738 reply.writeNoException();
2739 return true;
2740 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002741
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002742 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2743 data.enforceInterface(IActivityManager.descriptor);
2744 String packageName = data.readString();
2745 updateDeviceOwner(packageName);
2746 reply.writeNoException();
2747 return true;
2748 }
2749
Dianne Hackborn1e383822015-04-10 14:02:33 -07002750 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2751 data.enforceInterface(IActivityManager.descriptor);
2752 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002753 String callingPackage = data.readString();
2754 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002755 reply.writeNoException();
2756 reply.writeInt(res);
2757 return true;
2758 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002759
2760 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2761 data.enforceInterface(IActivityManager.descriptor);
2762 String process = data.readString();
2763 int userId = data.readInt();
2764 int level = data.readInt();
2765 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2766 reply.writeNoException();
2767 reply.writeInt(res ? 1 : 0);
2768 return true;
2769 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002770
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002771 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2772 data.enforceInterface(IActivityManager.descriptor);
2773 IBinder token = data.readStrongBinder();
2774 boolean res = isRootVoiceInteraction(token);
2775 reply.writeNoException();
2776 reply.writeInt(res ? 1 : 0);
2777 return true;
2778 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002779
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002780 case START_BINDER_TRACKING_TRANSACTION: {
2781 data.enforceInterface(IActivityManager.descriptor);
2782 boolean res = startBinderTracking();
2783 reply.writeNoException();
2784 reply.writeInt(res ? 1 : 0);
2785 return true;
2786 }
2787
2788 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2789 data.enforceInterface(IActivityManager.descriptor);
2790 ParcelFileDescriptor fd = data.readInt() != 0
2791 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2792 boolean res = stopBinderTrackingAndDump(fd);
2793 reply.writeNoException();
2794 reply.writeInt(res ? 1 : 0);
2795 return true;
2796 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002797 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2798 data.enforceInterface(IActivityManager.descriptor);
2799 IBinder token = data.readStrongBinder();
2800 int stackId = getActivityStackId(token);
2801 reply.writeNoException();
2802 reply.writeInt(stackId);
2803 return true;
2804 }
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002805 case EXIT_FREEFORM_MODE_TRANSACTION: {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002806 data.enforceInterface(IActivityManager.descriptor);
2807 IBinder token = data.readStrongBinder();
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002808 exitFreeformMode(token);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002809 reply.writeNoException();
2810 return true;
2811 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002812 case REPORT_SIZE_CONFIGURATIONS: {
2813 data.enforceInterface(IActivityManager.descriptor);
2814 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002815 int[] horizontal = readIntArray(data);
2816 int[] vertical = readIntArray(data);
2817 int[] smallest = readIntArray(data);
2818 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002819 return true;
2820 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002821 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2822 data.enforceInterface(IActivityManager.descriptor);
2823 final boolean suppress = data.readInt() == 1;
2824 suppressResizeConfigChanges(suppress);
2825 reply.writeNoException();
2826 return true;
2827 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002828 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002829 data.enforceInterface(IActivityManager.descriptor);
2830 final int stackId = data.readInt();
Wale Ogunwale9101d262016-01-15 08:56:11 -08002831 final boolean onTop = data.readInt() == 1;
2832 moveTasksToFullscreenStack(stackId, onTop);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002833 reply.writeNoException();
2834 return true;
2835 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002836 case GET_APP_START_MODE_TRANSACTION: {
2837 data.enforceInterface(IActivityManager.descriptor);
2838 final int uid = data.readInt();
2839 final String pkg = data.readString();
2840 int res = getAppStartMode(uid, pkg);
2841 reply.writeNoException();
2842 reply.writeInt(res);
2843 return true;
2844 }
Wale Ogunwale5f986092015-12-04 15:35:38 -08002845 case IN_MULTI_WINDOW_MODE_TRANSACTION: {
2846 data.enforceInterface(IActivityManager.descriptor);
2847 final IBinder token = data.readStrongBinder();
2848 final boolean multiWindowMode = inMultiWindowMode(token);
2849 reply.writeNoException();
2850 reply.writeInt(multiWindowMode ? 1 : 0);
2851 return true;
2852 }
2853 case IN_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2854 data.enforceInterface(IActivityManager.descriptor);
2855 final IBinder token = data.readStrongBinder();
2856 final boolean pipMode = inPictureInPictureMode(token);
2857 reply.writeNoException();
2858 reply.writeInt(pipMode ? 1 : 0);
2859 return true;
2860 }
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002861 case ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2862 data.enforceInterface(IActivityManager.descriptor);
2863 final IBinder token = data.readStrongBinder();
2864 enterPictureInPictureMode(token);
2865 reply.writeNoException();
2866 return true;
2867 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002868 case SET_VR_MODE_TRANSACTION: {
2869 data.enforceInterface(IActivityManager.descriptor);
2870 final IBinder token = data.readStrongBinder();
2871 final boolean enable = data.readInt() == 1;
2872 setVrMode(token, enable);
2873 reply.writeNoException();
2874 return true;
2875 }
Christopher Tate63fec3e2015-12-11 18:35:28 -08002876 case IS_APP_FOREGROUND_TRANSACTION: {
2877 data.enforceInterface(IActivityManager.descriptor);
2878 final int userHandle = data.readInt();
2879 final boolean isForeground = isAppForeground(userHandle);
2880 reply.writeNoException();
2881 reply.writeInt(isForeground ? 1 : 0);
2882 return true;
2883 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002884 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002886 return super.onTransact(code, data, reply, flags);
2887 }
2888
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002889 private int[] readIntArray(Parcel data) {
2890 int[] smallest = null;
2891 int smallestSize = data.readInt();
2892 if (smallestSize > 0) {
2893 smallest = new int[smallestSize];
2894 data.readIntArray(smallest);
2895 }
2896 return smallest;
2897 }
2898
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002899 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002900 return this;
2901 }
2902
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002903 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2904 protected IActivityManager create() {
2905 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002906 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002907 Log.v("ActivityManager", "default service binder = " + b);
2908 }
2909 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002910 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002911 Log.v("ActivityManager", "default service = " + am);
2912 }
2913 return am;
2914 }
2915 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002916}
2917
2918class ActivityManagerProxy implements IActivityManager
2919{
2920 public ActivityManagerProxy(IBinder remote)
2921 {
2922 mRemote = remote;
2923 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002924
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002925 public IBinder asBinder()
2926 {
2927 return mRemote;
2928 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002929
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002930 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002931 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002932 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002933 Parcel data = Parcel.obtain();
2934 Parcel reply = Parcel.obtain();
2935 data.writeInterfaceToken(IActivityManager.descriptor);
2936 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002937 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002938 intent.writeToParcel(data, 0);
2939 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002940 data.writeStrongBinder(resultTo);
2941 data.writeString(resultWho);
2942 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002943 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002944 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002945 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002946 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002947 } else {
2948 data.writeInt(0);
2949 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002950 if (options != null) {
2951 data.writeInt(1);
2952 options.writeToParcel(data, 0);
2953 } else {
2954 data.writeInt(0);
2955 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002956 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2957 reply.readException();
2958 int result = reply.readInt();
2959 reply.recycle();
2960 data.recycle();
2961 return result;
2962 }
Amith Yamasani82644082012-08-03 13:09:11 -07002963
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002964 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002965 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002966 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2967 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002968 Parcel data = Parcel.obtain();
2969 Parcel reply = Parcel.obtain();
2970 data.writeInterfaceToken(IActivityManager.descriptor);
2971 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002972 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002973 intent.writeToParcel(data, 0);
2974 data.writeString(resolvedType);
2975 data.writeStrongBinder(resultTo);
2976 data.writeString(resultWho);
2977 data.writeInt(requestCode);
2978 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002979 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002980 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002981 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002982 } else {
2983 data.writeInt(0);
2984 }
2985 if (options != null) {
2986 data.writeInt(1);
2987 options.writeToParcel(data, 0);
2988 } else {
2989 data.writeInt(0);
2990 }
2991 data.writeInt(userId);
2992 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2993 reply.readException();
2994 int result = reply.readInt();
2995 reply.recycle();
2996 data.recycle();
2997 return result;
2998 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002999 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
3000 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003001 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
3002 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003003 Parcel data = Parcel.obtain();
3004 Parcel reply = Parcel.obtain();
3005 data.writeInterfaceToken(IActivityManager.descriptor);
3006 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3007 data.writeString(callingPackage);
3008 intent.writeToParcel(data, 0);
3009 data.writeString(resolvedType);
3010 data.writeStrongBinder(resultTo);
3011 data.writeString(resultWho);
3012 data.writeInt(requestCode);
3013 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003014 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003015 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003016 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003017 } else {
3018 data.writeInt(0);
3019 }
3020 if (options != null) {
3021 data.writeInt(1);
3022 options.writeToParcel(data, 0);
3023 } else {
3024 data.writeInt(0);
3025 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003026 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07003027 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003028 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 int result = reply.readInt();
3031 reply.recycle();
3032 data.recycle();
3033 return result;
3034 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003035 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
3036 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07003037 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
3038 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003039 Parcel data = Parcel.obtain();
3040 Parcel reply = Parcel.obtain();
3041 data.writeInterfaceToken(IActivityManager.descriptor);
3042 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003043 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003044 intent.writeToParcel(data, 0);
3045 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003046 data.writeStrongBinder(resultTo);
3047 data.writeString(resultWho);
3048 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003049 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003050 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003051 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003052 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003053 } else {
3054 data.writeInt(0);
3055 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003056 if (options != null) {
3057 data.writeInt(1);
3058 options.writeToParcel(data, 0);
3059 } else {
3060 data.writeInt(0);
3061 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003062 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003063 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3064 reply.readException();
3065 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3066 reply.recycle();
3067 data.recycle();
3068 return result;
3069 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003070 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3071 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003072 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003073 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003074 Parcel data = Parcel.obtain();
3075 Parcel reply = Parcel.obtain();
3076 data.writeInterfaceToken(IActivityManager.descriptor);
3077 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003078 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003079 intent.writeToParcel(data, 0);
3080 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003081 data.writeStrongBinder(resultTo);
3082 data.writeString(resultWho);
3083 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003084 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003085 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003086 if (options != null) {
3087 data.writeInt(1);
3088 options.writeToParcel(data, 0);
3089 } else {
3090 data.writeInt(0);
3091 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003092 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003093 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3094 reply.readException();
3095 int result = reply.readInt();
3096 reply.recycle();
3097 data.recycle();
3098 return result;
3099 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003100 public int startActivityIntentSender(IApplicationThread caller,
3101 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003102 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003103 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003104 Parcel data = Parcel.obtain();
3105 Parcel reply = Parcel.obtain();
3106 data.writeInterfaceToken(IActivityManager.descriptor);
3107 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3108 intent.writeToParcel(data, 0);
3109 if (fillInIntent != null) {
3110 data.writeInt(1);
3111 fillInIntent.writeToParcel(data, 0);
3112 } else {
3113 data.writeInt(0);
3114 }
3115 data.writeString(resolvedType);
3116 data.writeStrongBinder(resultTo);
3117 data.writeString(resultWho);
3118 data.writeInt(requestCode);
3119 data.writeInt(flagsMask);
3120 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003121 if (options != null) {
3122 data.writeInt(1);
3123 options.writeToParcel(data, 0);
3124 } else {
3125 data.writeInt(0);
3126 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003127 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003128 reply.readException();
3129 int result = reply.readInt();
3130 reply.recycle();
3131 data.recycle();
3132 return result;
3133 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003134 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3135 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003136 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3137 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003138 Parcel data = Parcel.obtain();
3139 Parcel reply = Parcel.obtain();
3140 data.writeInterfaceToken(IActivityManager.descriptor);
3141 data.writeString(callingPackage);
3142 data.writeInt(callingPid);
3143 data.writeInt(callingUid);
3144 intent.writeToParcel(data, 0);
3145 data.writeString(resolvedType);
3146 data.writeStrongBinder(session.asBinder());
3147 data.writeStrongBinder(interactor.asBinder());
3148 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003149 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003150 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003151 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003152 } else {
3153 data.writeInt(0);
3154 }
3155 if (options != null) {
3156 data.writeInt(1);
3157 options.writeToParcel(data, 0);
3158 } else {
3159 data.writeInt(0);
3160 }
3161 data.writeInt(userId);
3162 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 int result = reply.readInt();
3165 reply.recycle();
3166 data.recycle();
3167 return result;
3168 }
Amith Yamasani0af6fa72016-01-17 15:36:19 -08003169
3170 public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options)
3171 throws RemoteException {
3172 Parcel data = Parcel.obtain();
3173 Parcel reply = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 data.writeStrongBinder(callingActivity);
3176 data.writeBundle(options);
3177 mRemote.transact(START_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 reply.recycle();
3180 data.recycle();
3181 }
3182
3183 public void stopLocalVoiceInteraction(IBinder callingActivity) throws RemoteException {
3184 Parcel data = Parcel.obtain();
3185 Parcel reply = Parcel.obtain();
3186 data.writeInterfaceToken(IActivityManager.descriptor);
3187 data.writeStrongBinder(callingActivity);
3188 mRemote.transact(STOP_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3189 reply.readException();
3190 reply.recycle();
3191 data.recycle();
3192 }
3193
3194 public boolean supportsLocalVoiceInteraction() throws RemoteException {
3195 Parcel data = Parcel.obtain();
3196 Parcel reply = Parcel.obtain();
3197 data.writeInterfaceToken(IActivityManager.descriptor);
3198 mRemote.transact(SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 int result = reply.readInt();
3201 reply.recycle();
3202 data.recycle();
3203 return result != 0;
3204 }
3205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003206 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003207 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 data.writeStrongBinder(callingActivity);
3212 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003213 if (options != null) {
3214 data.writeInt(1);
3215 options.writeToParcel(data, 0);
3216 } else {
3217 data.writeInt(0);
3218 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003219 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3220 reply.readException();
3221 int result = reply.readInt();
3222 reply.recycle();
3223 data.recycle();
3224 return result != 0;
3225 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003226 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003227 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003228 Parcel data = Parcel.obtain();
3229 Parcel reply = Parcel.obtain();
3230 data.writeInterfaceToken(IActivityManager.descriptor);
3231 data.writeInt(taskId);
3232 if (options == null) {
3233 data.writeInt(0);
3234 } else {
3235 data.writeInt(1);
3236 options.writeToParcel(data, 0);
3237 }
3238 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3239 reply.readException();
3240 int result = reply.readInt();
3241 reply.recycle();
3242 data.recycle();
3243 return result;
3244 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003245 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003246 throws RemoteException {
3247 Parcel data = Parcel.obtain();
3248 Parcel reply = Parcel.obtain();
3249 data.writeInterfaceToken(IActivityManager.descriptor);
3250 data.writeStrongBinder(token);
3251 data.writeInt(resultCode);
3252 if (resultData != null) {
3253 data.writeInt(1);
3254 resultData.writeToParcel(data, 0);
3255 } else {
3256 data.writeInt(0);
3257 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003258 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003259 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 boolean res = reply.readInt() != 0;
3262 data.recycle();
3263 reply.recycle();
3264 return res;
3265 }
3266 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3267 {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 data.writeStrongBinder(token);
3272 data.writeString(resultWho);
3273 data.writeInt(requestCode);
3274 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3275 reply.readException();
3276 data.recycle();
3277 reply.recycle();
3278 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003279 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3280 Parcel data = Parcel.obtain();
3281 Parcel reply = Parcel.obtain();
3282 data.writeInterfaceToken(IActivityManager.descriptor);
3283 data.writeStrongBinder(token);
3284 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3285 reply.readException();
3286 boolean res = reply.readInt() != 0;
3287 data.recycle();
3288 reply.recycle();
3289 return res;
3290 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003291 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3292 Parcel data = Parcel.obtain();
3293 Parcel reply = Parcel.obtain();
3294 data.writeInterfaceToken(IActivityManager.descriptor);
3295 data.writeStrongBinder(session.asBinder());
3296 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3297 reply.readException();
3298 data.recycle();
3299 reply.recycle();
3300 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003301 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3302 Parcel data = Parcel.obtain();
3303 Parcel reply = Parcel.obtain();
3304 data.writeInterfaceToken(IActivityManager.descriptor);
3305 data.writeStrongBinder(token);
3306 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3307 reply.readException();
3308 boolean res = reply.readInt() != 0;
3309 data.recycle();
3310 reply.recycle();
3311 return res;
3312 }
3313 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 data.writeStrongBinder(app.asBinder());
3318 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3319 reply.readException();
3320 data.recycle();
3321 reply.recycle();
3322 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003323 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3324 Parcel data = Parcel.obtain();
3325 Parcel reply = Parcel.obtain();
3326 data.writeInterfaceToken(IActivityManager.descriptor);
3327 data.writeStrongBinder(token);
3328 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3329 reply.readException();
3330 boolean res = reply.readInt() != 0;
3331 data.recycle();
3332 reply.recycle();
3333 return res;
3334 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003335 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003336 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003337 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003338 {
3339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003343 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003344 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3345 filter.writeToParcel(data, 0);
3346 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003347 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003348 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3349 reply.readException();
3350 Intent intent = null;
3351 int haveIntent = reply.readInt();
3352 if (haveIntent != 0) {
3353 intent = Intent.CREATOR.createFromParcel(reply);
3354 }
3355 reply.recycle();
3356 data.recycle();
3357 return intent;
3358 }
3359 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3360 {
3361 Parcel data = Parcel.obtain();
3362 Parcel reply = Parcel.obtain();
3363 data.writeInterfaceToken(IActivityManager.descriptor);
3364 data.writeStrongBinder(receiver.asBinder());
3365 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3366 reply.readException();
3367 data.recycle();
3368 reply.recycle();
3369 }
3370 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003371 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003372 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003373 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003374 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003375 {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3380 intent.writeToParcel(data, 0);
3381 data.writeString(resolvedType);
3382 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3383 data.writeInt(resultCode);
3384 data.writeString(resultData);
3385 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003386 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003387 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003388 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003389 data.writeInt(serialized ? 1 : 0);
3390 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003391 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003392 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3393 reply.readException();
3394 int res = reply.readInt();
3395 reply.recycle();
3396 data.recycle();
3397 return res;
3398 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003399 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3400 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003401 {
3402 Parcel data = Parcel.obtain();
3403 Parcel reply = Parcel.obtain();
3404 data.writeInterfaceToken(IActivityManager.descriptor);
3405 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3406 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003407 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003408 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3409 reply.readException();
3410 data.recycle();
3411 reply.recycle();
3412 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003413 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3414 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003415 {
3416 Parcel data = Parcel.obtain();
3417 Parcel reply = Parcel.obtain();
3418 data.writeInterfaceToken(IActivityManager.descriptor);
3419 data.writeStrongBinder(who);
3420 data.writeInt(resultCode);
3421 data.writeString(resultData);
3422 data.writeBundle(map);
3423 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003424 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003425 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3426 reply.readException();
3427 data.recycle();
3428 reply.recycle();
3429 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003430 public void attachApplication(IApplicationThread app) throws RemoteException
3431 {
3432 Parcel data = Parcel.obtain();
3433 Parcel reply = Parcel.obtain();
3434 data.writeInterfaceToken(IActivityManager.descriptor);
3435 data.writeStrongBinder(app.asBinder());
3436 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3437 reply.readException();
3438 data.recycle();
3439 reply.recycle();
3440 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003441 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3442 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003443 {
3444 Parcel data = Parcel.obtain();
3445 Parcel reply = Parcel.obtain();
3446 data.writeInterfaceToken(IActivityManager.descriptor);
3447 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003448 if (config != null) {
3449 data.writeInt(1);
3450 config.writeToParcel(data, 0);
3451 } else {
3452 data.writeInt(0);
3453 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003454 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003455 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3456 reply.readException();
3457 data.recycle();
3458 reply.recycle();
3459 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003460 public void activityResumed(IBinder token) throws RemoteException
3461 {
3462 Parcel data = Parcel.obtain();
3463 Parcel reply = Parcel.obtain();
3464 data.writeInterfaceToken(IActivityManager.descriptor);
3465 data.writeStrongBinder(token);
3466 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3467 reply.readException();
3468 data.recycle();
3469 reply.recycle();
3470 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003471 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003472 {
3473 Parcel data = Parcel.obtain();
3474 Parcel reply = Parcel.obtain();
3475 data.writeInterfaceToken(IActivityManager.descriptor);
3476 data.writeStrongBinder(token);
3477 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3478 reply.readException();
3479 data.recycle();
3480 reply.recycle();
3481 }
3482 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003483 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003484 {
3485 Parcel data = Parcel.obtain();
3486 Parcel reply = Parcel.obtain();
3487 data.writeInterfaceToken(IActivityManager.descriptor);
3488 data.writeStrongBinder(token);
3489 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003490 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003491 TextUtils.writeToParcel(description, data, 0);
3492 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3493 reply.readException();
3494 data.recycle();
3495 reply.recycle();
3496 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003497 public void activitySlept(IBinder token) throws RemoteException
3498 {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 data.writeStrongBinder(token);
3503 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3504 reply.readException();
3505 data.recycle();
3506 reply.recycle();
3507 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003508 public void activityDestroyed(IBinder token) throws RemoteException
3509 {
3510 Parcel data = Parcel.obtain();
3511 Parcel reply = Parcel.obtain();
3512 data.writeInterfaceToken(IActivityManager.descriptor);
3513 data.writeStrongBinder(token);
3514 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3515 reply.readException();
3516 data.recycle();
3517 reply.recycle();
3518 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003519 public void activityRelaunched(IBinder token) throws RemoteException
3520 {
3521 Parcel data = Parcel.obtain();
3522 Parcel reply = Parcel.obtain();
3523 data.writeInterfaceToken(IActivityManager.descriptor);
3524 data.writeStrongBinder(token);
3525 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 data.recycle();
3528 reply.recycle();
3529 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003530 public String getCallingPackage(IBinder token) throws RemoteException
3531 {
3532 Parcel data = Parcel.obtain();
3533 Parcel reply = Parcel.obtain();
3534 data.writeInterfaceToken(IActivityManager.descriptor);
3535 data.writeStrongBinder(token);
3536 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3537 reply.readException();
3538 String res = reply.readString();
3539 data.recycle();
3540 reply.recycle();
3541 return res;
3542 }
3543 public ComponentName getCallingActivity(IBinder token)
3544 throws RemoteException {
3545 Parcel data = Parcel.obtain();
3546 Parcel reply = Parcel.obtain();
3547 data.writeInterfaceToken(IActivityManager.descriptor);
3548 data.writeStrongBinder(token);
3549 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 ComponentName res = ComponentName.readFromParcel(reply);
3552 data.recycle();
3553 reply.recycle();
3554 return res;
3555 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003556 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003557 Parcel data = Parcel.obtain();
3558 Parcel reply = Parcel.obtain();
3559 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003560 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003561 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 ArrayList<IAppTask> list = null;
3564 int N = reply.readInt();
3565 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003566 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003567 while (N > 0) {
3568 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3569 list.add(task);
3570 N--;
3571 }
3572 }
3573 data.recycle();
3574 reply.recycle();
3575 return list;
3576 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003577 public int addAppTask(IBinder activityToken, Intent intent,
3578 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3579 Parcel data = Parcel.obtain();
3580 Parcel reply = Parcel.obtain();
3581 data.writeInterfaceToken(IActivityManager.descriptor);
3582 data.writeStrongBinder(activityToken);
3583 intent.writeToParcel(data, 0);
3584 description.writeToParcel(data, 0);
3585 thumbnail.writeToParcel(data, 0);
3586 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3587 reply.readException();
3588 int res = reply.readInt();
3589 data.recycle();
3590 reply.recycle();
3591 return res;
3592 }
3593 public Point getAppTaskThumbnailSize() throws RemoteException {
3594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3598 reply.readException();
3599 Point size = Point.CREATOR.createFromParcel(reply);
3600 data.recycle();
3601 reply.recycle();
3602 return size;
3603 }
Todd Kennedye635f662015-01-20 10:36:49 -08003604 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3605 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeInt(maxNum);
3610 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003611 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3612 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003613 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003614 int N = reply.readInt();
3615 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003616 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003617 while (N > 0) {
3618 ActivityManager.RunningTaskInfo info =
3619 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003620 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003621 list.add(info);
3622 N--;
3623 }
3624 }
3625 data.recycle();
3626 reply.recycle();
3627 return list;
3628 }
3629 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003630 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeInt(maxNum);
3635 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003636 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003637 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3638 reply.readException();
3639 ArrayList<ActivityManager.RecentTaskInfo> list
3640 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3641 data.recycle();
3642 reply.recycle();
3643 return list;
3644 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003645 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003646 Parcel data = Parcel.obtain();
3647 Parcel reply = Parcel.obtain();
3648 data.writeInterfaceToken(IActivityManager.descriptor);
3649 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003650 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003651 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003652 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003653 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003654 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003655 }
3656 data.recycle();
3657 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003658 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003659 }
Todd Kennedye635f662015-01-20 10:36:49 -08003660 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3661 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003662 Parcel data = Parcel.obtain();
3663 Parcel reply = Parcel.obtain();
3664 data.writeInterfaceToken(IActivityManager.descriptor);
3665 data.writeInt(maxNum);
3666 data.writeInt(flags);
3667 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3668 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003669 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003670 int N = reply.readInt();
3671 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003672 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003673 while (N > 0) {
3674 ActivityManager.RunningServiceInfo info =
3675 ActivityManager.RunningServiceInfo.CREATOR
3676 .createFromParcel(reply);
3677 list.add(info);
3678 N--;
3679 }
3680 }
3681 data.recycle();
3682 reply.recycle();
3683 return list;
3684 }
3685 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3686 throws RemoteException {
3687 Parcel data = Parcel.obtain();
3688 Parcel reply = Parcel.obtain();
3689 data.writeInterfaceToken(IActivityManager.descriptor);
3690 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3691 reply.readException();
3692 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3693 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3694 data.recycle();
3695 reply.recycle();
3696 return list;
3697 }
3698 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3699 throws RemoteException {
3700 Parcel data = Parcel.obtain();
3701 Parcel reply = Parcel.obtain();
3702 data.writeInterfaceToken(IActivityManager.descriptor);
3703 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3704 reply.readException();
3705 ArrayList<ActivityManager.RunningAppProcessInfo> list
3706 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3707 data.recycle();
3708 reply.recycle();
3709 return list;
3710 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003711 public List<ApplicationInfo> getRunningExternalApplications()
3712 throws RemoteException {
3713 Parcel data = Parcel.obtain();
3714 Parcel reply = Parcel.obtain();
3715 data.writeInterfaceToken(IActivityManager.descriptor);
3716 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3717 reply.readException();
3718 ArrayList<ApplicationInfo> list
3719 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3720 data.recycle();
3721 reply.recycle();
3722 return list;
3723 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003724 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003725 {
3726 Parcel data = Parcel.obtain();
3727 Parcel reply = Parcel.obtain();
3728 data.writeInterfaceToken(IActivityManager.descriptor);
3729 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003730 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003731 if (options != null) {
3732 data.writeInt(1);
3733 options.writeToParcel(data, 0);
3734 } else {
3735 data.writeInt(0);
3736 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003737 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3738 reply.readException();
3739 data.recycle();
3740 reply.recycle();
3741 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003742 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3743 throws RemoteException {
3744 Parcel data = Parcel.obtain();
3745 Parcel reply = Parcel.obtain();
3746 data.writeInterfaceToken(IActivityManager.descriptor);
3747 data.writeStrongBinder(token);
3748 data.writeInt(nonRoot ? 1 : 0);
3749 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3750 reply.readException();
3751 boolean res = reply.readInt() != 0;
3752 data.recycle();
3753 reply.recycle();
3754 return res;
3755 }
3756 public void moveTaskBackwards(int task) throws RemoteException
3757 {
3758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
3761 data.writeInt(task);
3762 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3763 reply.readException();
3764 data.recycle();
3765 reply.recycle();
3766 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003767 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003768 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3769 {
3770 Parcel data = Parcel.obtain();
3771 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003772 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003773 data.writeInt(taskId);
3774 data.writeInt(stackId);
3775 data.writeInt(toTop ? 1 : 0);
3776 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3777 reply.readException();
3778 data.recycle();
3779 reply.recycle();
3780 }
3781 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003782 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3783 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003784 {
3785 Parcel data = Parcel.obtain();
3786 Parcel reply = Parcel.obtain();
3787 data.writeInterfaceToken(IActivityManager.descriptor);
3788 data.writeInt(taskId);
3789 data.writeInt(createMode);
3790 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003791 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003792 if (initialBounds != null) {
3793 data.writeInt(1);
3794 initialBounds.writeToParcel(data, 0);
3795 } else {
3796 data.writeInt(0);
3797 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003798 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3799 reply.readException();
3800 data.recycle();
3801 reply.recycle();
3802 }
3803 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003804 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3805 throws RemoteException
3806 {
3807 Parcel data = Parcel.obtain();
3808 Parcel reply = Parcel.obtain();
3809 data.writeInterfaceToken(IActivityManager.descriptor);
3810 data.writeInt(stackId);
3811 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003812 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003813 reply.readException();
3814 final boolean res = reply.readInt() != 0;
3815 data.recycle();
3816 reply.recycle();
3817 return res;
3818 }
3819 @Override
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003820 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode,
3821 boolean preserveWindows, boolean animate) throws RemoteException {
Craig Mautnerc00204b2013-03-05 15:02:14 -08003822 Parcel data = Parcel.obtain();
3823 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003824 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003825 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003826 if (r != null) {
3827 data.writeInt(1);
3828 r.writeToParcel(data, 0);
3829 } else {
3830 data.writeInt(0);
3831 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003832 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003833 data.writeInt(preserveWindows ? 1 : 0);
3834 data.writeInt(animate ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003835 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003836 reply.readException();
3837 data.recycle();
3838 reply.recycle();
3839 }
Craig Mautner967212c2013-04-13 21:10:58 -07003840 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003841 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3842 Rect tempDockedTaskInsetBounds,
3843 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3844 throws RemoteException
3845 {
3846 Parcel data = Parcel.obtain();
3847 Parcel reply = Parcel.obtain();
3848 data.writeInterfaceToken(IActivityManager.descriptor);
3849 if (dockedBounds != null) {
3850 data.writeInt(1);
3851 dockedBounds.writeToParcel(data, 0);
3852 } else {
3853 data.writeInt(0);
3854 }
3855 if (tempDockedTaskBounds != null) {
3856 data.writeInt(1);
3857 tempDockedTaskBounds.writeToParcel(data, 0);
3858 } else {
3859 data.writeInt(0);
3860 }
3861 if (tempDockedTaskInsetBounds != null) {
3862 data.writeInt(1);
3863 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3864 } else {
3865 data.writeInt(0);
3866 }
3867 if (tempOtherTaskBounds != null) {
3868 data.writeInt(1);
3869 tempOtherTaskBounds.writeToParcel(data, 0);
3870 } else {
3871 data.writeInt(0);
3872 }
3873 if (tempOtherTaskInsetBounds != null) {
3874 data.writeInt(1);
3875 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3876 } else {
3877 data.writeInt(0);
3878 }
3879 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3880 reply.readException();
3881 data.recycle();
3882 reply.recycle();
3883 }
3884 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003885 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3886 {
3887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 data.writeInt(taskId);
3891 data.writeInt(stackId);
3892 data.writeInt(position);
3893 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3894 reply.readException();
3895 data.recycle();
3896 reply.recycle();
3897 }
3898 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003899 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003900 {
3901 Parcel data = Parcel.obtain();
3902 Parcel reply = Parcel.obtain();
3903 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003904 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003905 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003906 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003907 data.recycle();
3908 reply.recycle();
3909 return list;
3910 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003911 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003912 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003913 {
3914 Parcel data = Parcel.obtain();
3915 Parcel reply = Parcel.obtain();
3916 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003917 data.writeInt(stackId);
3918 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003919 reply.readException();
3920 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003921 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003922 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003923 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003924 }
3925 data.recycle();
3926 reply.recycle();
3927 return info;
3928 }
3929 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003930 public boolean isInHomeStack(int taskId) throws RemoteException {
3931 Parcel data = Parcel.obtain();
3932 Parcel reply = Parcel.obtain();
3933 data.writeInterfaceToken(IActivityManager.descriptor);
3934 data.writeInt(taskId);
3935 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3936 reply.readException();
3937 boolean isInHomeStack = reply.readInt() > 0;
3938 data.recycle();
3939 reply.recycle();
3940 return isInHomeStack;
3941 }
3942 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003943 public void setFocusedStack(int stackId) throws RemoteException
3944 {
3945 Parcel data = Parcel.obtain();
3946 Parcel reply = Parcel.obtain();
3947 data.writeInterfaceToken(IActivityManager.descriptor);
3948 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003949 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003950 reply.readException();
3951 data.recycle();
3952 reply.recycle();
3953 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003954 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003955 public int getFocusedStackId() throws RemoteException {
3956 Parcel data = Parcel.obtain();
3957 Parcel reply = Parcel.obtain();
3958 data.writeInterfaceToken(IActivityManager.descriptor);
3959 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3960 reply.readException();
3961 int focusedStackId = reply.readInt();
3962 data.recycle();
3963 reply.recycle();
3964 return focusedStackId;
3965 }
3966 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003967 public void setFocusedTask(int taskId) throws RemoteException
3968 {
3969 Parcel data = Parcel.obtain();
3970 Parcel reply = Parcel.obtain();
3971 data.writeInterfaceToken(IActivityManager.descriptor);
3972 data.writeInt(taskId);
3973 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3974 reply.readException();
3975 data.recycle();
3976 reply.recycle();
3977 }
3978 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003979 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3980 {
3981 Parcel data = Parcel.obtain();
3982 Parcel reply = Parcel.obtain();
3983 data.writeInterfaceToken(IActivityManager.descriptor);
3984 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003985 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003986 reply.readException();
3987 data.recycle();
3988 reply.recycle();
3989 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003990 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3991 {
3992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
3995 data.writeStrongBinder(token);
3996 data.writeInt(onlyRoot ? 1 : 0);
3997 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3998 reply.readException();
3999 int res = reply.readInt();
4000 data.recycle();
4001 reply.recycle();
4002 return res;
4003 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004004 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07004005 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004006 Parcel data = Parcel.obtain();
4007 Parcel reply = Parcel.obtain();
4008 data.writeInterfaceToken(IActivityManager.descriptor);
4009 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4010 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004011 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004012 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004013 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4014 reply.readException();
4015 int res = reply.readInt();
4016 ContentProviderHolder cph = null;
4017 if (res != 0) {
4018 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4019 }
4020 data.recycle();
4021 reply.recycle();
4022 return cph;
4023 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07004024 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
4025 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004026 Parcel data = Parcel.obtain();
4027 Parcel reply = Parcel.obtain();
4028 data.writeInterfaceToken(IActivityManager.descriptor);
4029 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004030 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004031 data.writeStrongBinder(token);
4032 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4033 reply.readException();
4034 int res = reply.readInt();
4035 ContentProviderHolder cph = null;
4036 if (res != 0) {
4037 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4038 }
4039 data.recycle();
4040 reply.recycle();
4041 return cph;
4042 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004043 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004044 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004045 {
4046 Parcel data = Parcel.obtain();
4047 Parcel reply = Parcel.obtain();
4048 data.writeInterfaceToken(IActivityManager.descriptor);
4049 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4050 data.writeTypedList(providers);
4051 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
4052 reply.readException();
4053 data.recycle();
4054 reply.recycle();
4055 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004056 public boolean refContentProvider(IBinder connection, int stable, int unstable)
4057 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004058 Parcel data = Parcel.obtain();
4059 Parcel reply = Parcel.obtain();
4060 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004061 data.writeStrongBinder(connection);
4062 data.writeInt(stable);
4063 data.writeInt(unstable);
4064 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4065 reply.readException();
4066 boolean res = reply.readInt() != 0;
4067 data.recycle();
4068 reply.recycle();
4069 return res;
4070 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004071
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004072 public void unstableProviderDied(IBinder connection) throws RemoteException {
4073 Parcel data = Parcel.obtain();
4074 Parcel reply = Parcel.obtain();
4075 data.writeInterfaceToken(IActivityManager.descriptor);
4076 data.writeStrongBinder(connection);
4077 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
4078 reply.readException();
4079 data.recycle();
4080 reply.recycle();
4081 }
4082
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004083 @Override
4084 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
4085 Parcel data = Parcel.obtain();
4086 Parcel reply = Parcel.obtain();
4087 data.writeInterfaceToken(IActivityManager.descriptor);
4088 data.writeStrongBinder(connection);
4089 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
4090 reply.readException();
4091 data.recycle();
4092 reply.recycle();
4093 }
4094
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004095 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4096 Parcel data = Parcel.obtain();
4097 Parcel reply = Parcel.obtain();
4098 data.writeInterfaceToken(IActivityManager.descriptor);
4099 data.writeStrongBinder(connection);
4100 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004101 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4102 reply.readException();
4103 data.recycle();
4104 reply.recycle();
4105 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004106
4107 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4108 Parcel data = Parcel.obtain();
4109 Parcel reply = Parcel.obtain();
4110 data.writeInterfaceToken(IActivityManager.descriptor);
4111 data.writeString(name);
4112 data.writeStrongBinder(token);
4113 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4114 reply.readException();
4115 data.recycle();
4116 reply.recycle();
4117 }
4118
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004119 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4120 throws RemoteException
4121 {
4122 Parcel data = Parcel.obtain();
4123 Parcel reply = Parcel.obtain();
4124 data.writeInterfaceToken(IActivityManager.descriptor);
4125 service.writeToParcel(data, 0);
4126 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4127 reply.readException();
4128 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4129 data.recycle();
4130 reply.recycle();
4131 return res;
4132 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004133
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004134 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004135 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004136 {
4137 Parcel data = Parcel.obtain();
4138 Parcel reply = Parcel.obtain();
4139 data.writeInterfaceToken(IActivityManager.descriptor);
4140 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4141 service.writeToParcel(data, 0);
4142 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004143 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004144 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004145 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4146 reply.readException();
4147 ComponentName res = ComponentName.readFromParcel(reply);
4148 data.recycle();
4149 reply.recycle();
4150 return res;
4151 }
4152 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004153 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004154 {
4155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4159 service.writeToParcel(data, 0);
4160 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004161 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004162 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4163 reply.readException();
4164 int res = reply.readInt();
4165 reply.recycle();
4166 data.recycle();
4167 return res;
4168 }
4169 public boolean stopServiceToken(ComponentName className, IBinder token,
4170 int startId) throws RemoteException {
4171 Parcel data = Parcel.obtain();
4172 Parcel reply = Parcel.obtain();
4173 data.writeInterfaceToken(IActivityManager.descriptor);
4174 ComponentName.writeToParcel(className, data);
4175 data.writeStrongBinder(token);
4176 data.writeInt(startId);
4177 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4178 reply.readException();
4179 boolean res = reply.readInt() != 0;
4180 data.recycle();
4181 reply.recycle();
4182 return res;
4183 }
4184 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004185 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 ComponentName.writeToParcel(className, data);
4190 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004191 data.writeInt(id);
4192 if (notification != null) {
4193 data.writeInt(1);
4194 notification.writeToParcel(data, 0);
4195 } else {
4196 data.writeInt(0);
4197 }
4198 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004199 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4200 reply.readException();
4201 data.recycle();
4202 reply.recycle();
4203 }
4204 public int bindService(IApplicationThread caller, IBinder token,
4205 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004206 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004207 Parcel data = Parcel.obtain();
4208 Parcel reply = Parcel.obtain();
4209 data.writeInterfaceToken(IActivityManager.descriptor);
4210 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4211 data.writeStrongBinder(token);
4212 service.writeToParcel(data, 0);
4213 data.writeString(resolvedType);
4214 data.writeStrongBinder(connection.asBinder());
4215 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004216 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004217 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004218 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4219 reply.readException();
4220 int res = reply.readInt();
4221 data.recycle();
4222 reply.recycle();
4223 return res;
4224 }
4225 public boolean unbindService(IServiceConnection connection) throws RemoteException
4226 {
4227 Parcel data = Parcel.obtain();
4228 Parcel reply = Parcel.obtain();
4229 data.writeInterfaceToken(IActivityManager.descriptor);
4230 data.writeStrongBinder(connection.asBinder());
4231 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4232 reply.readException();
4233 boolean res = reply.readInt() != 0;
4234 data.recycle();
4235 reply.recycle();
4236 return res;
4237 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004238
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004239 public void publishService(IBinder token,
4240 Intent intent, IBinder service) throws RemoteException {
4241 Parcel data = Parcel.obtain();
4242 Parcel reply = Parcel.obtain();
4243 data.writeInterfaceToken(IActivityManager.descriptor);
4244 data.writeStrongBinder(token);
4245 intent.writeToParcel(data, 0);
4246 data.writeStrongBinder(service);
4247 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4248 reply.readException();
4249 data.recycle();
4250 reply.recycle();
4251 }
4252
4253 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4254 throws RemoteException {
4255 Parcel data = Parcel.obtain();
4256 Parcel reply = Parcel.obtain();
4257 data.writeInterfaceToken(IActivityManager.descriptor);
4258 data.writeStrongBinder(token);
4259 intent.writeToParcel(data, 0);
4260 data.writeInt(doRebind ? 1 : 0);
4261 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4262 reply.readException();
4263 data.recycle();
4264 reply.recycle();
4265 }
4266
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004267 public void serviceDoneExecuting(IBinder token, int type, int startId,
4268 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004269 Parcel data = Parcel.obtain();
4270 Parcel reply = Parcel.obtain();
4271 data.writeInterfaceToken(IActivityManager.descriptor);
4272 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004273 data.writeInt(type);
4274 data.writeInt(startId);
4275 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004276 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4277 reply.readException();
4278 data.recycle();
4279 reply.recycle();
4280 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004281
Svet Ganov99b60432015-06-27 13:15:22 -07004282 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4283 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004284 Parcel data = Parcel.obtain();
4285 Parcel reply = Parcel.obtain();
4286 data.writeInterfaceToken(IActivityManager.descriptor);
4287 service.writeToParcel(data, 0);
4288 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004289 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004290 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4291 reply.readException();
4292 IBinder binder = reply.readStrongBinder();
4293 reply.recycle();
4294 data.recycle();
4295 return binder;
4296 }
4297
Christopher Tate181fafa2009-05-14 11:12:14 -07004298 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4299 throws RemoteException {
4300 Parcel data = Parcel.obtain();
4301 Parcel reply = Parcel.obtain();
4302 data.writeInterfaceToken(IActivityManager.descriptor);
4303 app.writeToParcel(data, 0);
4304 data.writeInt(backupRestoreMode);
4305 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4306 reply.readException();
4307 boolean success = reply.readInt() != 0;
4308 reply.recycle();
4309 data.recycle();
4310 return success;
4311 }
4312
Christopher Tate346acb12012-10-15 19:20:25 -07004313 public void clearPendingBackup() throws RemoteException {
4314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4318 reply.recycle();
4319 data.recycle();
4320 }
4321
Christopher Tate181fafa2009-05-14 11:12:14 -07004322 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4323 Parcel data = Parcel.obtain();
4324 Parcel reply = Parcel.obtain();
4325 data.writeInterfaceToken(IActivityManager.descriptor);
4326 data.writeString(packageName);
4327 data.writeStrongBinder(agent);
4328 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4329 reply.recycle();
4330 data.recycle();
4331 }
4332
4333 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4334 Parcel data = Parcel.obtain();
4335 Parcel reply = Parcel.obtain();
4336 data.writeInterfaceToken(IActivityManager.descriptor);
4337 app.writeToParcel(data, 0);
4338 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4339 reply.readException();
4340 reply.recycle();
4341 data.recycle();
4342 }
4343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004344 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004345 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004346 IUiAutomationConnection connection, int userId, String instructionSet)
4347 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004348 Parcel data = Parcel.obtain();
4349 Parcel reply = Parcel.obtain();
4350 data.writeInterfaceToken(IActivityManager.descriptor);
4351 ComponentName.writeToParcel(className, data);
4352 data.writeString(profileFile);
4353 data.writeInt(flags);
4354 data.writeBundle(arguments);
4355 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004356 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004357 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004358 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004359 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4360 reply.readException();
4361 boolean res = reply.readInt() != 0;
4362 reply.recycle();
4363 data.recycle();
4364 return res;
4365 }
4366
4367 public void finishInstrumentation(IApplicationThread target,
4368 int resultCode, Bundle results) throws RemoteException {
4369 Parcel data = Parcel.obtain();
4370 Parcel reply = Parcel.obtain();
4371 data.writeInterfaceToken(IActivityManager.descriptor);
4372 data.writeStrongBinder(target != null ? target.asBinder() : null);
4373 data.writeInt(resultCode);
4374 data.writeBundle(results);
4375 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4376 reply.readException();
4377 data.recycle();
4378 reply.recycle();
4379 }
4380 public Configuration getConfiguration() throws RemoteException
4381 {
4382 Parcel data = Parcel.obtain();
4383 Parcel reply = Parcel.obtain();
4384 data.writeInterfaceToken(IActivityManager.descriptor);
4385 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4386 reply.readException();
4387 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4388 reply.recycle();
4389 data.recycle();
4390 return res;
4391 }
4392 public void updateConfiguration(Configuration values) throws RemoteException
4393 {
4394 Parcel data = Parcel.obtain();
4395 Parcel reply = Parcel.obtain();
4396 data.writeInterfaceToken(IActivityManager.descriptor);
4397 values.writeToParcel(data, 0);
4398 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4399 reply.readException();
4400 data.recycle();
4401 reply.recycle();
4402 }
4403 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4404 throws RemoteException {
4405 Parcel data = Parcel.obtain();
4406 Parcel reply = Parcel.obtain();
4407 data.writeInterfaceToken(IActivityManager.descriptor);
4408 data.writeStrongBinder(token);
4409 data.writeInt(requestedOrientation);
4410 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4411 reply.readException();
4412 data.recycle();
4413 reply.recycle();
4414 }
4415 public int getRequestedOrientation(IBinder token) throws RemoteException {
4416 Parcel data = Parcel.obtain();
4417 Parcel reply = Parcel.obtain();
4418 data.writeInterfaceToken(IActivityManager.descriptor);
4419 data.writeStrongBinder(token);
4420 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4421 reply.readException();
4422 int res = reply.readInt();
4423 data.recycle();
4424 reply.recycle();
4425 return res;
4426 }
4427 public ComponentName getActivityClassForToken(IBinder token)
4428 throws RemoteException {
4429 Parcel data = Parcel.obtain();
4430 Parcel reply = Parcel.obtain();
4431 data.writeInterfaceToken(IActivityManager.descriptor);
4432 data.writeStrongBinder(token);
4433 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4434 reply.readException();
4435 ComponentName res = ComponentName.readFromParcel(reply);
4436 data.recycle();
4437 reply.recycle();
4438 return res;
4439 }
4440 public String getPackageForToken(IBinder token) throws RemoteException
4441 {
4442 Parcel data = Parcel.obtain();
4443 Parcel reply = Parcel.obtain();
4444 data.writeInterfaceToken(IActivityManager.descriptor);
4445 data.writeStrongBinder(token);
4446 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4447 reply.readException();
4448 String res = reply.readString();
4449 data.recycle();
4450 reply.recycle();
4451 return res;
4452 }
4453 public IIntentSender getIntentSender(int type,
4454 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004455 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004456 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004457 Parcel data = Parcel.obtain();
4458 Parcel reply = Parcel.obtain();
4459 data.writeInterfaceToken(IActivityManager.descriptor);
4460 data.writeInt(type);
4461 data.writeString(packageName);
4462 data.writeStrongBinder(token);
4463 data.writeString(resultWho);
4464 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004465 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004466 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004467 data.writeTypedArray(intents, 0);
4468 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004469 } else {
4470 data.writeInt(0);
4471 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004472 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004473 if (options != null) {
4474 data.writeInt(1);
4475 options.writeToParcel(data, 0);
4476 } else {
4477 data.writeInt(0);
4478 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004479 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004480 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4481 reply.readException();
4482 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004483 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004484 data.recycle();
4485 reply.recycle();
4486 return res;
4487 }
4488 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4489 Parcel data = Parcel.obtain();
4490 Parcel reply = Parcel.obtain();
4491 data.writeInterfaceToken(IActivityManager.descriptor);
4492 data.writeStrongBinder(sender.asBinder());
4493 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4494 reply.readException();
4495 data.recycle();
4496 reply.recycle();
4497 }
4498 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4499 Parcel data = Parcel.obtain();
4500 Parcel reply = Parcel.obtain();
4501 data.writeInterfaceToken(IActivityManager.descriptor);
4502 data.writeStrongBinder(sender.asBinder());
4503 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4504 reply.readException();
4505 String res = reply.readString();
4506 data.recycle();
4507 reply.recycle();
4508 return res;
4509 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004510 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4511 Parcel data = Parcel.obtain();
4512 Parcel reply = Parcel.obtain();
4513 data.writeInterfaceToken(IActivityManager.descriptor);
4514 data.writeStrongBinder(sender.asBinder());
4515 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4516 reply.readException();
4517 int res = reply.readInt();
4518 data.recycle();
4519 reply.recycle();
4520 return res;
4521 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004522 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4523 boolean requireFull, String name, String callerPackage) throws RemoteException {
4524 Parcel data = Parcel.obtain();
4525 Parcel reply = Parcel.obtain();
4526 data.writeInterfaceToken(IActivityManager.descriptor);
4527 data.writeInt(callingPid);
4528 data.writeInt(callingUid);
4529 data.writeInt(userId);
4530 data.writeInt(allowAll ? 1 : 0);
4531 data.writeInt(requireFull ? 1 : 0);
4532 data.writeString(name);
4533 data.writeString(callerPackage);
4534 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4535 reply.readException();
4536 int res = reply.readInt();
4537 data.recycle();
4538 reply.recycle();
4539 return res;
4540 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004541 public void setProcessLimit(int max) throws RemoteException
4542 {
4543 Parcel data = Parcel.obtain();
4544 Parcel reply = Parcel.obtain();
4545 data.writeInterfaceToken(IActivityManager.descriptor);
4546 data.writeInt(max);
4547 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4548 reply.readException();
4549 data.recycle();
4550 reply.recycle();
4551 }
4552 public int getProcessLimit() throws RemoteException
4553 {
4554 Parcel data = Parcel.obtain();
4555 Parcel reply = Parcel.obtain();
4556 data.writeInterfaceToken(IActivityManager.descriptor);
4557 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4558 reply.readException();
4559 int res = reply.readInt();
4560 data.recycle();
4561 reply.recycle();
4562 return res;
4563 }
4564 public void setProcessForeground(IBinder token, int pid,
4565 boolean isForeground) throws RemoteException {
4566 Parcel data = Parcel.obtain();
4567 Parcel reply = Parcel.obtain();
4568 data.writeInterfaceToken(IActivityManager.descriptor);
4569 data.writeStrongBinder(token);
4570 data.writeInt(pid);
4571 data.writeInt(isForeground ? 1 : 0);
4572 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4573 reply.readException();
4574 data.recycle();
4575 reply.recycle();
4576 }
4577 public int checkPermission(String permission, int pid, int uid)
4578 throws RemoteException {
4579 Parcel data = Parcel.obtain();
4580 Parcel reply = Parcel.obtain();
4581 data.writeInterfaceToken(IActivityManager.descriptor);
4582 data.writeString(permission);
4583 data.writeInt(pid);
4584 data.writeInt(uid);
4585 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4586 reply.readException();
4587 int res = reply.readInt();
4588 data.recycle();
4589 reply.recycle();
4590 return res;
4591 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004592 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4593 throws RemoteException {
4594 Parcel data = Parcel.obtain();
4595 Parcel reply = Parcel.obtain();
4596 data.writeInterfaceToken(IActivityManager.descriptor);
4597 data.writeString(permission);
4598 data.writeInt(pid);
4599 data.writeInt(uid);
4600 data.writeStrongBinder(callerToken);
4601 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4602 reply.readException();
4603 int res = reply.readInt();
4604 data.recycle();
4605 reply.recycle();
4606 return res;
4607 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004608 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004609 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004610 Parcel data = Parcel.obtain();
4611 Parcel reply = Parcel.obtain();
4612 data.writeInterfaceToken(IActivityManager.descriptor);
4613 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004614 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004615 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004616 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4617 reply.readException();
4618 boolean res = reply.readInt() != 0;
4619 data.recycle();
4620 reply.recycle();
4621 return res;
4622 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004623 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4624 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004625 Parcel data = Parcel.obtain();
4626 Parcel reply = Parcel.obtain();
4627 data.writeInterfaceToken(IActivityManager.descriptor);
4628 uri.writeToParcel(data, 0);
4629 data.writeInt(pid);
4630 data.writeInt(uid);
4631 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004632 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004633 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004634 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4635 reply.readException();
4636 int res = reply.readInt();
4637 data.recycle();
4638 reply.recycle();
4639 return res;
4640 }
4641 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004642 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004643 Parcel data = Parcel.obtain();
4644 Parcel reply = Parcel.obtain();
4645 data.writeInterfaceToken(IActivityManager.descriptor);
4646 data.writeStrongBinder(caller.asBinder());
4647 data.writeString(targetPkg);
4648 uri.writeToParcel(data, 0);
4649 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004650 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004651 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4652 reply.readException();
4653 data.recycle();
4654 reply.recycle();
4655 }
4656 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004657 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004658 Parcel data = Parcel.obtain();
4659 Parcel reply = Parcel.obtain();
4660 data.writeInterfaceToken(IActivityManager.descriptor);
4661 data.writeStrongBinder(caller.asBinder());
4662 uri.writeToParcel(data, 0);
4663 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004664 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004665 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 data.recycle();
4668 reply.recycle();
4669 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004670
4671 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004672 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4673 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004674 Parcel data = Parcel.obtain();
4675 Parcel reply = Parcel.obtain();
4676 data.writeInterfaceToken(IActivityManager.descriptor);
4677 uri.writeToParcel(data, 0);
4678 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004679 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004680 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4681 reply.readException();
4682 data.recycle();
4683 reply.recycle();
4684 }
4685
4686 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004687 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4688 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004689 Parcel data = Parcel.obtain();
4690 Parcel reply = Parcel.obtain();
4691 data.writeInterfaceToken(IActivityManager.descriptor);
4692 uri.writeToParcel(data, 0);
4693 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004694 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004695 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4696 reply.readException();
4697 data.recycle();
4698 reply.recycle();
4699 }
4700
4701 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004702 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4703 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004704 Parcel data = Parcel.obtain();
4705 Parcel reply = Parcel.obtain();
4706 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004707 data.writeString(packageName);
4708 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004709 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4710 reply.readException();
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004711 @SuppressWarnings("unchecked")
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004712 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4713 reply);
4714 data.recycle();
4715 reply.recycle();
4716 return perms;
4717 }
4718
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004719 @Override
4720 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId)
4721 throws RemoteException {
4722 Parcel data = Parcel.obtain();
4723 Parcel reply = Parcel.obtain();
4724 data.writeInterfaceToken(IActivityManager.descriptor);
4725 data.writeString(packageName);
4726 data.writeInt(userId);
4727 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4728 reply.readException();
4729 @SuppressWarnings("unchecked")
4730 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4731 reply);
4732 data.recycle();
4733 reply.recycle();
4734 return perms;
4735 }
4736
4737 @Override
4738 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException {
4739 Parcel data = Parcel.obtain();
4740 Parcel reply = Parcel.obtain();
4741 data.writeInterfaceToken(IActivityManager.descriptor);
4742 data.writeString(packageName);
4743 data.writeInt(userId);
4744 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4745 reply.readException();
4746 data.recycle();
4747 reply.recycle();
4748 }
4749
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004750 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4751 throws RemoteException {
4752 Parcel data = Parcel.obtain();
4753 Parcel reply = Parcel.obtain();
4754 data.writeInterfaceToken(IActivityManager.descriptor);
4755 data.writeStrongBinder(who.asBinder());
4756 data.writeInt(waiting ? 1 : 0);
4757 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4758 reply.readException();
4759 data.recycle();
4760 reply.recycle();
4761 }
4762 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4763 Parcel data = Parcel.obtain();
4764 Parcel reply = Parcel.obtain();
4765 data.writeInterfaceToken(IActivityManager.descriptor);
4766 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4767 reply.readException();
4768 outInfo.readFromParcel(reply);
4769 data.recycle();
4770 reply.recycle();
4771 }
4772 public void unhandledBack() throws RemoteException
4773 {
4774 Parcel data = Parcel.obtain();
4775 Parcel reply = Parcel.obtain();
4776 data.writeInterfaceToken(IActivityManager.descriptor);
4777 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4778 reply.readException();
4779 data.recycle();
4780 reply.recycle();
4781 }
4782 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4783 {
4784 Parcel data = Parcel.obtain();
4785 Parcel reply = Parcel.obtain();
4786 data.writeInterfaceToken(IActivityManager.descriptor);
4787 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4788 reply.readException();
4789 ParcelFileDescriptor pfd = null;
4790 if (reply.readInt() != 0) {
4791 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4792 }
4793 data.recycle();
4794 reply.recycle();
4795 return pfd;
4796 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004797 public void setLockScreenShown(boolean shown) throws RemoteException
4798 {
4799 Parcel data = Parcel.obtain();
4800 Parcel reply = Parcel.obtain();
4801 data.writeInterfaceToken(IActivityManager.descriptor);
4802 data.writeInt(shown ? 1 : 0);
4803 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4804 reply.readException();
4805 data.recycle();
4806 reply.recycle();
4807 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004808 public void setDebugApp(
4809 String packageName, boolean waitForDebugger, boolean persistent)
4810 throws RemoteException
4811 {
4812 Parcel data = Parcel.obtain();
4813 Parcel reply = Parcel.obtain();
4814 data.writeInterfaceToken(IActivityManager.descriptor);
4815 data.writeString(packageName);
4816 data.writeInt(waitForDebugger ? 1 : 0);
4817 data.writeInt(persistent ? 1 : 0);
4818 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4819 reply.readException();
4820 data.recycle();
4821 reply.recycle();
4822 }
4823 public void setAlwaysFinish(boolean enabled) throws RemoteException
4824 {
4825 Parcel data = Parcel.obtain();
4826 Parcel reply = Parcel.obtain();
4827 data.writeInterfaceToken(IActivityManager.descriptor);
4828 data.writeInt(enabled ? 1 : 0);
4829 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4830 reply.readException();
4831 data.recycle();
4832 reply.recycle();
4833 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004834 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004835 {
4836 Parcel data = Parcel.obtain();
4837 Parcel reply = Parcel.obtain();
4838 data.writeInterfaceToken(IActivityManager.descriptor);
4839 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004840 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004841 reply.readException();
4842 data.recycle();
4843 reply.recycle();
4844 }
4845 public void enterSafeMode() throws RemoteException {
4846 Parcel data = Parcel.obtain();
4847 data.writeInterfaceToken(IActivityManager.descriptor);
4848 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4849 data.recycle();
4850 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004851 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004852 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004853 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004854 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004855 data.writeStrongBinder(sender.asBinder());
4856 data.writeInt(sourceUid);
4857 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004858 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004859 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4860 data.recycle();
4861 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004862 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4863 throws RemoteException {
4864 Parcel data = Parcel.obtain();
4865 data.writeInterfaceToken(IActivityManager.descriptor);
4866 data.writeStrongBinder(sender.asBinder());
4867 data.writeInt(sourceUid);
4868 data.writeString(tag);
4869 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4870 data.recycle();
4871 }
4872 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4873 throws RemoteException {
4874 Parcel data = Parcel.obtain();
4875 data.writeInterfaceToken(IActivityManager.descriptor);
4876 data.writeStrongBinder(sender.asBinder());
4877 data.writeInt(sourceUid);
4878 data.writeString(tag);
4879 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4880 data.recycle();
4881 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004882 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004883 Parcel data = Parcel.obtain();
4884 Parcel reply = Parcel.obtain();
4885 data.writeInterfaceToken(IActivityManager.descriptor);
4886 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004887 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004888 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004889 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004890 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004891 boolean res = reply.readInt() != 0;
4892 data.recycle();
4893 reply.recycle();
4894 return res;
4895 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004896 @Override
4897 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4898 Parcel data = Parcel.obtain();
4899 Parcel reply = Parcel.obtain();
4900 data.writeInterfaceToken(IActivityManager.descriptor);
4901 data.writeString(reason);
4902 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4903 boolean res = reply.readInt() != 0;
4904 data.recycle();
4905 reply.recycle();
4906 return res;
4907 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004908 public boolean testIsSystemReady()
4909 {
4910 /* this base class version is never called */
4911 return true;
4912 }
Dan Egnor60d87622009-12-16 16:32:58 -08004913 public void handleApplicationCrash(IBinder app,
4914 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4915 {
4916 Parcel data = Parcel.obtain();
4917 Parcel reply = Parcel.obtain();
4918 data.writeInterfaceToken(IActivityManager.descriptor);
4919 data.writeStrongBinder(app);
4920 crashInfo.writeToParcel(data, 0);
4921 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4922 reply.readException();
4923 reply.recycle();
4924 data.recycle();
4925 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004926
Dianne Hackborn52322712014-08-26 22:47:26 -07004927 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004928 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004929 {
4930 Parcel data = Parcel.obtain();
4931 Parcel reply = Parcel.obtain();
4932 data.writeInterfaceToken(IActivityManager.descriptor);
4933 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004934 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004935 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004936 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004937 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004938 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004939 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004940 reply.recycle();
4941 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004942 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004943 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004944
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004945 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004946 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004947 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004948 {
4949 Parcel data = Parcel.obtain();
4950 Parcel reply = Parcel.obtain();
4951 data.writeInterfaceToken(IActivityManager.descriptor);
4952 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004953 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004954 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004955 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4956 reply.readException();
4957 reply.recycle();
4958 data.recycle();
4959 }
4960
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004961 public void signalPersistentProcesses(int sig) throws RemoteException {
4962 Parcel data = Parcel.obtain();
4963 Parcel reply = Parcel.obtain();
4964 data.writeInterfaceToken(IActivityManager.descriptor);
4965 data.writeInt(sig);
4966 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4967 reply.readException();
4968 data.recycle();
4969 reply.recycle();
4970 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004971
Dianne Hackborn1676c852012-09-10 14:52:30 -07004972 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004973 Parcel data = Parcel.obtain();
4974 Parcel reply = Parcel.obtain();
4975 data.writeInterfaceToken(IActivityManager.descriptor);
4976 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004977 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004978 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4979 reply.readException();
4980 data.recycle();
4981 reply.recycle();
4982 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004983
4984 public void killAllBackgroundProcesses() throws RemoteException {
4985 Parcel data = Parcel.obtain();
4986 Parcel reply = Parcel.obtain();
4987 data.writeInterfaceToken(IActivityManager.descriptor);
4988 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4989 reply.readException();
4990 data.recycle();
4991 reply.recycle();
4992 }
4993
Gustav Sennton6258dcd2015-10-30 19:25:37 +00004994 public void killPackageDependents(String packageName, int userId) throws RemoteException {
4995 Parcel data = Parcel.obtain();
4996 Parcel reply = Parcel.obtain();
4997 data.writeInterfaceToken(IActivityManager.descriptor);
4998 data.writeString(packageName);
4999 data.writeInt(userId);
5000 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
5001 reply.readException();
5002 data.recycle();
5003 reply.recycle();
5004 }
5005
Dianne Hackborn1676c852012-09-10 14:52:30 -07005006 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08005007 Parcel data = Parcel.obtain();
5008 Parcel reply = Parcel.obtain();
5009 data.writeInterfaceToken(IActivityManager.descriptor);
5010 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005011 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005012 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005013 reply.readException();
5014 data.recycle();
5015 reply.recycle();
5016 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005017
Dianne Hackborn27ff9132012-03-06 14:57:58 -08005018 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
5019 throws RemoteException
5020 {
5021 Parcel data = Parcel.obtain();
5022 Parcel reply = Parcel.obtain();
5023 data.writeInterfaceToken(IActivityManager.descriptor);
5024 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
5025 reply.readException();
5026 outInfo.readFromParcel(reply);
5027 reply.recycle();
5028 data.recycle();
5029 }
5030
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005031 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
5032 {
5033 Parcel data = Parcel.obtain();
5034 Parcel reply = Parcel.obtain();
5035 data.writeInterfaceToken(IActivityManager.descriptor);
5036 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
5037 reply.readException();
5038 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
5039 reply.recycle();
5040 data.recycle();
5041 return res;
5042 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005043
Dianne Hackborn1676c852012-09-10 14:52:30 -07005044 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07005045 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005046 {
5047 Parcel data = Parcel.obtain();
5048 Parcel reply = Parcel.obtain();
5049 data.writeInterfaceToken(IActivityManager.descriptor);
5050 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005051 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005052 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07005053 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07005054 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005055 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07005056 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005057 } else {
5058 data.writeInt(0);
5059 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005060 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
5061 reply.readException();
5062 boolean res = reply.readInt() != 0;
5063 reply.recycle();
5064 data.recycle();
5065 return res;
5066 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005067
Dianne Hackborn55280a92009-05-07 15:53:46 -07005068 public boolean shutdown(int timeout) throws RemoteException
5069 {
5070 Parcel data = Parcel.obtain();
5071 Parcel reply = Parcel.obtain();
5072 data.writeInterfaceToken(IActivityManager.descriptor);
5073 data.writeInt(timeout);
5074 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
5075 reply.readException();
5076 boolean res = reply.readInt() != 0;
5077 reply.recycle();
5078 data.recycle();
5079 return res;
5080 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005081
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005082 public void stopAppSwitches() throws RemoteException {
5083 Parcel data = Parcel.obtain();
5084 Parcel reply = Parcel.obtain();
5085 data.writeInterfaceToken(IActivityManager.descriptor);
5086 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
5087 reply.readException();
5088 reply.recycle();
5089 data.recycle();
5090 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005091
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005092 public void resumeAppSwitches() throws RemoteException {
5093 Parcel data = Parcel.obtain();
5094 Parcel reply = Parcel.obtain();
5095 data.writeInterfaceToken(IActivityManager.descriptor);
5096 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
5097 reply.readException();
5098 reply.recycle();
5099 data.recycle();
5100 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07005101
5102 public void addPackageDependency(String packageName) throws RemoteException {
5103 Parcel data = Parcel.obtain();
5104 Parcel reply = Parcel.obtain();
5105 data.writeInterfaceToken(IActivityManager.descriptor);
5106 data.writeString(packageName);
5107 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
5108 reply.readException();
5109 data.recycle();
5110 reply.recycle();
5111 }
5112
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005113 public void killApplicationWithAppId(String pkg, int appid, String reason)
5114 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005115 Parcel data = Parcel.obtain();
5116 Parcel reply = Parcel.obtain();
5117 data.writeInterfaceToken(IActivityManager.descriptor);
5118 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005119 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005120 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005121 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005122 reply.readException();
5123 data.recycle();
5124 reply.recycle();
5125 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005126
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07005127 public void closeSystemDialogs(String reason) throws RemoteException {
5128 Parcel data = Parcel.obtain();
5129 Parcel reply = Parcel.obtain();
5130 data.writeInterfaceToken(IActivityManager.descriptor);
5131 data.writeString(reason);
5132 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5133 reply.readException();
5134 data.recycle();
5135 reply.recycle();
5136 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005137
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005138 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005139 throws RemoteException {
5140 Parcel data = Parcel.obtain();
5141 Parcel reply = Parcel.obtain();
5142 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005143 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005144 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5145 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005146 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005147 data.recycle();
5148 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005149 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005150 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005151
5152 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5153 Parcel data = Parcel.obtain();
5154 Parcel reply = Parcel.obtain();
5155 data.writeInterfaceToken(IActivityManager.descriptor);
5156 data.writeString(processName);
5157 data.writeInt(uid);
5158 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5159 reply.readException();
5160 data.recycle();
5161 reply.recycle();
5162 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005163
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005164 public void overridePendingTransition(IBinder token, String packageName,
5165 int enterAnim, int exitAnim) throws RemoteException {
5166 Parcel data = Parcel.obtain();
5167 Parcel reply = Parcel.obtain();
5168 data.writeInterfaceToken(IActivityManager.descriptor);
5169 data.writeStrongBinder(token);
5170 data.writeString(packageName);
5171 data.writeInt(enterAnim);
5172 data.writeInt(exitAnim);
5173 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5174 reply.readException();
5175 data.recycle();
5176 reply.recycle();
5177 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005178
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005179 public boolean isUserAMonkey() throws RemoteException {
5180 Parcel data = Parcel.obtain();
5181 Parcel reply = Parcel.obtain();
5182 data.writeInterfaceToken(IActivityManager.descriptor);
5183 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5184 reply.readException();
5185 boolean res = reply.readInt() != 0;
5186 data.recycle();
5187 reply.recycle();
5188 return res;
5189 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005190
5191 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5192 Parcel data = Parcel.obtain();
5193 Parcel reply = Parcel.obtain();
5194 data.writeInterfaceToken(IActivityManager.descriptor);
5195 data.writeInt(monkey ? 1 : 0);
5196 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5197 reply.readException();
5198 data.recycle();
5199 reply.recycle();
5200 }
5201
Dianne Hackborn860755f2010-06-03 18:47:52 -07005202 public void finishHeavyWeightApp() throws RemoteException {
5203 Parcel data = Parcel.obtain();
5204 Parcel reply = Parcel.obtain();
5205 data.writeInterfaceToken(IActivityManager.descriptor);
5206 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5207 reply.readException();
5208 data.recycle();
5209 reply.recycle();
5210 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005211
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005212 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005213 throws RemoteException {
5214 Parcel data = Parcel.obtain();
5215 Parcel reply = Parcel.obtain();
5216 data.writeInterfaceToken(IActivityManager.descriptor);
5217 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005218 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5219 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005220 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005221 data.recycle();
5222 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005223 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005224 }
5225
Craig Mautner233ceee2014-05-09 17:05:11 -07005226 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005227 throws RemoteException {
5228 Parcel data = Parcel.obtain();
5229 Parcel reply = Parcel.obtain();
5230 data.writeInterfaceToken(IActivityManager.descriptor);
5231 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005232 if (options == null) {
5233 data.writeInt(0);
5234 } else {
5235 data.writeInt(1);
5236 data.writeBundle(options.toBundle());
5237 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005238 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005239 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005240 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005241 data.recycle();
5242 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005243 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005244 }
5245
Craig Mautner233ceee2014-05-09 17:05:11 -07005246 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5247 Parcel data = Parcel.obtain();
5248 Parcel reply = Parcel.obtain();
5249 data.writeInterfaceToken(IActivityManager.descriptor);
5250 data.writeStrongBinder(token);
5251 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5252 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005253 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005254 data.recycle();
5255 reply.recycle();
5256 return options;
5257 }
5258
Daniel Sandler69a48172010-06-23 16:29:36 -04005259 public void setImmersive(IBinder token, boolean immersive)
5260 throws RemoteException {
5261 Parcel data = Parcel.obtain();
5262 Parcel reply = Parcel.obtain();
5263 data.writeInterfaceToken(IActivityManager.descriptor);
5264 data.writeStrongBinder(token);
5265 data.writeInt(immersive ? 1 : 0);
5266 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5267 reply.readException();
5268 data.recycle();
5269 reply.recycle();
5270 }
5271
5272 public boolean isImmersive(IBinder token)
5273 throws RemoteException {
5274 Parcel data = Parcel.obtain();
5275 Parcel reply = Parcel.obtain();
5276 data.writeInterfaceToken(IActivityManager.descriptor);
5277 data.writeStrongBinder(token);
5278 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005279 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005280 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005281 data.recycle();
5282 reply.recycle();
5283 return res;
5284 }
5285
Craig Mautnerd61dc202014-07-07 11:09:11 -07005286 public boolean isTopOfTask(IBinder token) throws RemoteException {
5287 Parcel data = Parcel.obtain();
5288 Parcel reply = Parcel.obtain();
5289 data.writeInterfaceToken(IActivityManager.descriptor);
5290 data.writeStrongBinder(token);
5291 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5292 reply.readException();
5293 boolean res = reply.readInt() == 1;
5294 data.recycle();
5295 reply.recycle();
5296 return res;
5297 }
5298
Daniel Sandler69a48172010-06-23 16:29:36 -04005299 public boolean isTopActivityImmersive()
5300 throws RemoteException {
5301 Parcel data = Parcel.obtain();
5302 Parcel reply = Parcel.obtain();
5303 data.writeInterfaceToken(IActivityManager.descriptor);
5304 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005305 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005306 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005307 data.recycle();
5308 reply.recycle();
5309 return res;
5310 }
5311
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005312 public void crashApplication(int uid, int initialPid, String packageName,
5313 String message) throws RemoteException {
5314 Parcel data = Parcel.obtain();
5315 Parcel reply = Parcel.obtain();
5316 data.writeInterfaceToken(IActivityManager.descriptor);
5317 data.writeInt(uid);
5318 data.writeInt(initialPid);
5319 data.writeString(packageName);
5320 data.writeString(message);
5321 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5322 reply.readException();
5323 data.recycle();
5324 reply.recycle();
5325 }
Andy McFadden824c5102010-07-09 16:26:57 -07005326
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005327 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005328 Parcel data = Parcel.obtain();
5329 Parcel reply = Parcel.obtain();
5330 data.writeInterfaceToken(IActivityManager.descriptor);
5331 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005332 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005333 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5334 reply.readException();
5335 String res = reply.readString();
5336 data.recycle();
5337 reply.recycle();
5338 return res;
5339 }
5340
Dianne Hackborn7e269642010-08-25 19:50:20 -07005341 public IBinder newUriPermissionOwner(String name)
5342 throws RemoteException {
5343 Parcel data = Parcel.obtain();
5344 Parcel reply = Parcel.obtain();
5345 data.writeInterfaceToken(IActivityManager.descriptor);
5346 data.writeString(name);
5347 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5348 reply.readException();
5349 IBinder res = reply.readStrongBinder();
5350 data.recycle();
5351 reply.recycle();
5352 return res;
5353 }
5354
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005355 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5356 Parcel data = Parcel.obtain();
5357 Parcel reply = Parcel.obtain();
5358 data.writeInterfaceToken(IActivityManager.descriptor);
5359 data.writeStrongBinder(activityToken);
5360 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5361 reply.readException();
5362 IBinder res = reply.readStrongBinder();
5363 data.recycle();
5364 reply.recycle();
5365 return res;
5366 }
5367
Dianne Hackborn7e269642010-08-25 19:50:20 -07005368 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005369 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005370 Parcel data = Parcel.obtain();
5371 Parcel reply = Parcel.obtain();
5372 data.writeInterfaceToken(IActivityManager.descriptor);
5373 data.writeStrongBinder(owner);
5374 data.writeInt(fromUid);
5375 data.writeString(targetPkg);
5376 uri.writeToParcel(data, 0);
5377 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005378 data.writeInt(sourceUserId);
5379 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005380 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5381 reply.readException();
5382 data.recycle();
5383 reply.recycle();
5384 }
5385
5386 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005387 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005388 Parcel data = Parcel.obtain();
5389 Parcel reply = Parcel.obtain();
5390 data.writeInterfaceToken(IActivityManager.descriptor);
5391 data.writeStrongBinder(owner);
5392 if (uri != null) {
5393 data.writeInt(1);
5394 uri.writeToParcel(data, 0);
5395 } else {
5396 data.writeInt(0);
5397 }
5398 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005399 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005400 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5401 reply.readException();
5402 data.recycle();
5403 reply.recycle();
5404 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005405
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005406 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005407 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005408 Parcel data = Parcel.obtain();
5409 Parcel reply = Parcel.obtain();
5410 data.writeInterfaceToken(IActivityManager.descriptor);
5411 data.writeInt(callingUid);
5412 data.writeString(targetPkg);
5413 uri.writeToParcel(data, 0);
5414 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005415 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005416 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5417 reply.readException();
5418 int res = reply.readInt();
5419 data.recycle();
5420 reply.recycle();
5421 return res;
5422 }
5423
Dianne Hackborn1676c852012-09-10 14:52:30 -07005424 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005425 String path, ParcelFileDescriptor fd) throws RemoteException {
5426 Parcel data = Parcel.obtain();
5427 Parcel reply = Parcel.obtain();
5428 data.writeInterfaceToken(IActivityManager.descriptor);
5429 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005430 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005431 data.writeInt(managed ? 1 : 0);
5432 data.writeString(path);
5433 if (fd != null) {
5434 data.writeInt(1);
5435 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5436 } else {
5437 data.writeInt(0);
5438 }
5439 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5440 reply.readException();
5441 boolean res = reply.readInt() != 0;
5442 reply.recycle();
5443 data.recycle();
5444 return res;
5445 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005446
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005447 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005448 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005449 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005450 Parcel data = Parcel.obtain();
5451 Parcel reply = Parcel.obtain();
5452 data.writeInterfaceToken(IActivityManager.descriptor);
5453 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005454 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005455 data.writeTypedArray(intents, 0);
5456 data.writeStringArray(resolvedTypes);
5457 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005458 if (options != null) {
5459 data.writeInt(1);
5460 options.writeToParcel(data, 0);
5461 } else {
5462 data.writeInt(0);
5463 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005464 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005465 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5466 reply.readException();
5467 int result = reply.readInt();
5468 reply.recycle();
5469 data.recycle();
5470 return result;
5471 }
5472
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005473 public int getFrontActivityScreenCompatMode() throws RemoteException {
5474 Parcel data = Parcel.obtain();
5475 Parcel reply = Parcel.obtain();
5476 data.writeInterfaceToken(IActivityManager.descriptor);
5477 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5478 reply.readException();
5479 int mode = reply.readInt();
5480 reply.recycle();
5481 data.recycle();
5482 return mode;
5483 }
5484
5485 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5486 Parcel data = Parcel.obtain();
5487 Parcel reply = Parcel.obtain();
5488 data.writeInterfaceToken(IActivityManager.descriptor);
5489 data.writeInt(mode);
5490 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5491 reply.readException();
5492 reply.recycle();
5493 data.recycle();
5494 }
5495
5496 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5497 Parcel data = Parcel.obtain();
5498 Parcel reply = Parcel.obtain();
5499 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005500 data.writeString(packageName);
5501 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005502 reply.readException();
5503 int mode = reply.readInt();
5504 reply.recycle();
5505 data.recycle();
5506 return mode;
5507 }
5508
5509 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005510 throws RemoteException {
5511 Parcel data = Parcel.obtain();
5512 Parcel reply = Parcel.obtain();
5513 data.writeInterfaceToken(IActivityManager.descriptor);
5514 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005515 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005516 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5517 reply.readException();
5518 reply.recycle();
5519 data.recycle();
5520 }
5521
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005522 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5523 Parcel data = Parcel.obtain();
5524 Parcel reply = Parcel.obtain();
5525 data.writeInterfaceToken(IActivityManager.descriptor);
5526 data.writeString(packageName);
5527 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5528 reply.readException();
5529 boolean ask = reply.readInt() != 0;
5530 reply.recycle();
5531 data.recycle();
5532 return ask;
5533 }
5534
5535 public void setPackageAskScreenCompat(String packageName, boolean ask)
5536 throws RemoteException {
5537 Parcel data = Parcel.obtain();
5538 Parcel reply = Parcel.obtain();
5539 data.writeInterfaceToken(IActivityManager.descriptor);
5540 data.writeString(packageName);
5541 data.writeInt(ask ? 1 : 0);
5542 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5543 reply.readException();
5544 reply.recycle();
5545 data.recycle();
5546 }
5547
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005548 public boolean switchUser(int userid) throws RemoteException {
5549 Parcel data = Parcel.obtain();
5550 Parcel reply = Parcel.obtain();
5551 data.writeInterfaceToken(IActivityManager.descriptor);
5552 data.writeInt(userid);
5553 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5554 reply.readException();
5555 boolean result = reply.readInt() != 0;
5556 reply.recycle();
5557 data.recycle();
5558 return result;
5559 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005560
Kenny Guy08488bf2014-02-21 17:40:37 +00005561 public boolean startUserInBackground(int userid) throws RemoteException {
5562 Parcel data = Parcel.obtain();
5563 Parcel reply = Parcel.obtain();
5564 data.writeInterfaceToken(IActivityManager.descriptor);
5565 data.writeInt(userid);
5566 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5567 reply.readException();
5568 boolean result = reply.readInt() != 0;
5569 reply.recycle();
5570 data.recycle();
5571 return result;
5572 }
5573
Jeff Sharkeyba512352015-11-12 20:17:45 -08005574 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5575 Parcel data = Parcel.obtain();
5576 Parcel reply = Parcel.obtain();
5577 data.writeInterfaceToken(IActivityManager.descriptor);
5578 data.writeInt(userId);
5579 data.writeByteArray(token);
5580 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5581 reply.readException();
5582 boolean result = reply.readInt() != 0;
5583 reply.recycle();
5584 data.recycle();
5585 return result;
5586 }
5587
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005588 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5589 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005590 Parcel data = Parcel.obtain();
5591 Parcel reply = Parcel.obtain();
5592 data.writeInterfaceToken(IActivityManager.descriptor);
5593 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005594 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005595 data.writeStrongInterface(callback);
5596 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5597 reply.readException();
5598 int result = reply.readInt();
5599 reply.recycle();
5600 data.recycle();
5601 return result;
5602 }
5603
Amith Yamasani52f1d752012-03-28 18:19:29 -07005604 public UserInfo getCurrentUser() throws RemoteException {
5605 Parcel data = Parcel.obtain();
5606 Parcel reply = Parcel.obtain();
5607 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005608 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005609 reply.readException();
5610 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5611 reply.recycle();
5612 data.recycle();
5613 return userInfo;
5614 }
5615
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005616 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005617 Parcel data = Parcel.obtain();
5618 Parcel reply = Parcel.obtain();
5619 data.writeInterfaceToken(IActivityManager.descriptor);
5620 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005621 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005622 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5623 reply.readException();
5624 boolean result = reply.readInt() != 0;
5625 reply.recycle();
5626 data.recycle();
5627 return result;
5628 }
5629
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005630 public int[] getRunningUserIds() throws RemoteException {
5631 Parcel data = Parcel.obtain();
5632 Parcel reply = Parcel.obtain();
5633 data.writeInterfaceToken(IActivityManager.descriptor);
5634 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5635 reply.readException();
5636 int[] result = reply.createIntArray();
5637 reply.recycle();
5638 data.recycle();
5639 return result;
5640 }
5641
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005642 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005643 Parcel data = Parcel.obtain();
5644 Parcel reply = Parcel.obtain();
5645 data.writeInterfaceToken(IActivityManager.descriptor);
5646 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005647 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5648 reply.readException();
5649 boolean result = reply.readInt() != 0;
5650 reply.recycle();
5651 data.recycle();
5652 return result;
5653 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005654
Jeff Sharkeya4620792011-05-20 15:29:23 -07005655 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5656 Parcel data = Parcel.obtain();
5657 Parcel reply = Parcel.obtain();
5658 data.writeInterfaceToken(IActivityManager.descriptor);
5659 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5660 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5661 reply.readException();
5662 data.recycle();
5663 reply.recycle();
5664 }
5665
5666 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5667 Parcel data = Parcel.obtain();
5668 Parcel reply = Parcel.obtain();
5669 data.writeInterfaceToken(IActivityManager.descriptor);
5670 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5671 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5672 reply.readException();
5673 data.recycle();
5674 reply.recycle();
5675 }
5676
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005677 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005678 Parcel data = Parcel.obtain();
5679 Parcel reply = Parcel.obtain();
5680 data.writeInterfaceToken(IActivityManager.descriptor);
5681 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005682 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005683 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5684 reply.readException();
5685 data.recycle();
5686 reply.recycle();
5687 }
5688
5689 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5690 Parcel data = Parcel.obtain();
5691 Parcel reply = Parcel.obtain();
5692 data.writeInterfaceToken(IActivityManager.descriptor);
5693 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5694 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5695 reply.readException();
5696 data.recycle();
5697 reply.recycle();
5698 }
5699
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005700 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5701 Parcel data = Parcel.obtain();
5702 Parcel reply = Parcel.obtain();
5703 data.writeInterfaceToken(IActivityManager.descriptor);
5704 data.writeStrongBinder(sender.asBinder());
5705 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5706 reply.readException();
5707 boolean res = reply.readInt() != 0;
5708 data.recycle();
5709 reply.recycle();
5710 return res;
5711 }
5712
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005713 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5714 Parcel data = Parcel.obtain();
5715 Parcel reply = Parcel.obtain();
5716 data.writeInterfaceToken(IActivityManager.descriptor);
5717 data.writeStrongBinder(sender.asBinder());
5718 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5719 reply.readException();
5720 boolean res = reply.readInt() != 0;
5721 data.recycle();
5722 reply.recycle();
5723 return res;
5724 }
5725
Dianne Hackborn81038902012-11-26 17:04:09 -08005726 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5727 Parcel data = Parcel.obtain();
5728 Parcel reply = Parcel.obtain();
5729 data.writeInterfaceToken(IActivityManager.descriptor);
5730 data.writeStrongBinder(sender.asBinder());
5731 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5732 reply.readException();
5733 Intent res = reply.readInt() != 0
5734 ? Intent.CREATOR.createFromParcel(reply) : null;
5735 data.recycle();
5736 reply.recycle();
5737 return res;
5738 }
5739
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005740 public String getTagForIntentSender(IIntentSender sender, String prefix)
5741 throws RemoteException {
5742 Parcel data = Parcel.obtain();
5743 Parcel reply = Parcel.obtain();
5744 data.writeInterfaceToken(IActivityManager.descriptor);
5745 data.writeStrongBinder(sender.asBinder());
5746 data.writeString(prefix);
5747 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5748 reply.readException();
5749 String res = reply.readString();
5750 data.recycle();
5751 reply.recycle();
5752 return res;
5753 }
5754
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005755 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5756 {
5757 Parcel data = Parcel.obtain();
5758 Parcel reply = Parcel.obtain();
5759 data.writeInterfaceToken(IActivityManager.descriptor);
5760 values.writeToParcel(data, 0);
5761 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5762 reply.readException();
5763 data.recycle();
5764 reply.recycle();
5765 }
5766
Dianne Hackbornb437e092011-08-05 17:50:29 -07005767 public long[] getProcessPss(int[] pids) throws RemoteException {
5768 Parcel data = Parcel.obtain();
5769 Parcel reply = Parcel.obtain();
5770 data.writeInterfaceToken(IActivityManager.descriptor);
5771 data.writeIntArray(pids);
5772 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5773 reply.readException();
5774 long[] res = reply.createLongArray();
5775 data.recycle();
5776 reply.recycle();
5777 return res;
5778 }
5779
Dianne Hackborn661cd522011-08-22 00:26:20 -07005780 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5781 Parcel data = Parcel.obtain();
5782 Parcel reply = Parcel.obtain();
5783 data.writeInterfaceToken(IActivityManager.descriptor);
5784 TextUtils.writeToParcel(msg, data, 0);
5785 data.writeInt(always ? 1 : 0);
5786 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5787 reply.readException();
5788 data.recycle();
5789 reply.recycle();
5790 }
5791
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005792 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005793 Parcel data = Parcel.obtain();
5794 Parcel reply = Parcel.obtain();
5795 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005796 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005797 reply.readException();
5798 data.recycle();
5799 reply.recycle();
5800 }
5801
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005802 public void keyguardGoingAway(boolean disableWindowAnimations,
5803 boolean keyguardGoingToNotificationShade) throws RemoteException {
5804 Parcel data = Parcel.obtain();
5805 Parcel reply = Parcel.obtain();
5806 data.writeInterfaceToken(IActivityManager.descriptor);
5807 data.writeInt(disableWindowAnimations ? 1 : 0);
5808 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5809 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5810 reply.readException();
5811 data.recycle();
5812 reply.recycle();
5813 }
5814
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005815 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005816 throws RemoteException {
5817 Parcel data = Parcel.obtain();
5818 Parcel reply = Parcel.obtain();
5819 data.writeInterfaceToken(IActivityManager.descriptor);
5820 data.writeStrongBinder(token);
5821 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005822 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005823 reply.readException();
5824 boolean result = reply.readInt() != 0;
5825 data.recycle();
5826 reply.recycle();
5827 return result;
5828 }
5829
5830 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5831 throws RemoteException {
5832 Parcel data = Parcel.obtain();
5833 Parcel reply = Parcel.obtain();
5834 data.writeInterfaceToken(IActivityManager.descriptor);
5835 data.writeStrongBinder(token);
5836 target.writeToParcel(data, 0);
5837 data.writeInt(resultCode);
5838 if (resultData != null) {
5839 data.writeInt(1);
5840 resultData.writeToParcel(data, 0);
5841 } else {
5842 data.writeInt(0);
5843 }
5844 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5845 reply.readException();
5846 boolean result = reply.readInt() != 0;
5847 data.recycle();
5848 reply.recycle();
5849 return result;
5850 }
5851
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005852 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5853 Parcel data = Parcel.obtain();
5854 Parcel reply = Parcel.obtain();
5855 data.writeInterfaceToken(IActivityManager.descriptor);
5856 data.writeStrongBinder(activityToken);
5857 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5858 reply.readException();
5859 int result = reply.readInt();
5860 data.recycle();
5861 reply.recycle();
5862 return result;
5863 }
5864
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005865 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5866 Parcel data = Parcel.obtain();
5867 Parcel reply = Parcel.obtain();
5868 data.writeInterfaceToken(IActivityManager.descriptor);
5869 data.writeStrongBinder(activityToken);
5870 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5871 reply.readException();
5872 String result = reply.readString();
5873 data.recycle();
5874 reply.recycle();
5875 return result;
5876 }
5877
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005878 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5879 Parcel data = Parcel.obtain();
5880 Parcel reply = Parcel.obtain();
5881 data.writeInterfaceToken(IActivityManager.descriptor);
5882 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5883 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5884 reply.readException();
5885 data.recycle();
5886 reply.recycle();
5887 }
5888
5889 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5890 Parcel data = Parcel.obtain();
5891 Parcel reply = Parcel.obtain();
5892 data.writeInterfaceToken(IActivityManager.descriptor);
5893 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5894 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5895 reply.readException();
5896 data.recycle();
5897 reply.recycle();
5898 }
5899
Michal Karpinski3da5c972015-12-11 18:16:30 +00005900 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType)
5901 throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005902 Parcel data = Parcel.obtain();
5903 Parcel reply = Parcel.obtain();
5904 data.writeInterfaceToken(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00005905 data.writeInt(bugreportType);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005906 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5907 reply.readException();
5908 data.recycle();
5909 reply.recycle();
5910 }
5911
Jeff Brownbd181bb2013-09-10 16:44:24 -07005912 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5913 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005914 Parcel data = Parcel.obtain();
5915 Parcel reply = Parcel.obtain();
5916 data.writeInterfaceToken(IActivityManager.descriptor);
5917 data.writeInt(pid);
5918 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005919 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005920 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5921 reply.readException();
5922 long res = reply.readInt();
5923 data.recycle();
5924 reply.recycle();
5925 return res;
5926 }
5927
Adam Skorydfc7fd72013-08-05 19:23:41 -07005928 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005929 Parcel data = Parcel.obtain();
5930 Parcel reply = Parcel.obtain();
5931 data.writeInterfaceToken(IActivityManager.descriptor);
5932 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005933 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005934 reply.readException();
5935 Bundle res = reply.readBundle();
5936 data.recycle();
5937 reply.recycle();
5938 return res;
5939 }
5940
Dianne Hackborn17f69352015-07-17 18:04:14 -07005941 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5942 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005943 Parcel data = Parcel.obtain();
5944 Parcel reply = Parcel.obtain();
5945 data.writeInterfaceToken(IActivityManager.descriptor);
5946 data.writeInt(requestType);
5947 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005948 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005949 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5950 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005951 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005952 data.recycle();
5953 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005954 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005955 }
5956
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005957 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005958 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005959 Parcel data = Parcel.obtain();
5960 Parcel reply = Parcel.obtain();
5961 data.writeInterfaceToken(IActivityManager.descriptor);
5962 data.writeStrongBinder(token);
5963 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005964 structure.writeToParcel(data, 0);
5965 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005966 if (referrer != null) {
5967 data.writeInt(1);
5968 referrer.writeToParcel(data, 0);
5969 } else {
5970 data.writeInt(0);
5971 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005972 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005973 reply.readException();
5974 data.recycle();
5975 reply.recycle();
5976 }
5977
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005978 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5979 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005980 Parcel data = Parcel.obtain();
5981 Parcel reply = Parcel.obtain();
5982 data.writeInterfaceToken(IActivityManager.descriptor);
5983 intent.writeToParcel(data, 0);
5984 data.writeInt(requestType);
5985 data.writeString(hint);
5986 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005987 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005988 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5989 reply.readException();
5990 boolean res = reply.readInt() != 0;
5991 data.recycle();
5992 reply.recycle();
5993 return res;
5994 }
5995
Dianne Hackborn17f69352015-07-17 18:04:14 -07005996 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005997 Parcel data = Parcel.obtain();
5998 Parcel reply = Parcel.obtain();
5999 data.writeInterfaceToken(IActivityManager.descriptor);
6000 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
6001 reply.readException();
6002 boolean res = reply.readInt() != 0;
6003 data.recycle();
6004 reply.recycle();
6005 return res;
6006 }
6007
Dianne Hackborn17f69352015-07-17 18:04:14 -07006008 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
6009 Parcel data = Parcel.obtain();
6010 Parcel reply = Parcel.obtain();
6011 data.writeInterfaceToken(IActivityManager.descriptor);
6012 data.writeStrongBinder(token);
6013 data.writeBundle(args);
6014 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
6015 reply.readException();
6016 boolean res = reply.readInt() != 0;
6017 data.recycle();
6018 reply.recycle();
6019 return res;
6020 }
6021
Svetoslavaa41add2015-08-06 15:03:55 -07006022 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006023 Parcel data = Parcel.obtain();
6024 Parcel reply = Parcel.obtain();
6025 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07006026 data.writeInt(appId);
6027 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006028 data.writeString(reason);
6029 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
6030 reply.readException();
6031 data.recycle();
6032 reply.recycle();
6033 }
6034
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07006035 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
6036 Parcel data = Parcel.obtain();
6037 Parcel reply = Parcel.obtain();
6038 data.writeInterfaceToken(IActivityManager.descriptor);
6039 data.writeStrongBinder(who);
6040 data.writeInt(allowRestart ? 1 : 0);
6041 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
6042 reply.readException();
6043 data.recycle();
6044 reply.recycle();
6045 }
6046
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07006047 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
6048 Parcel data = Parcel.obtain();
6049 Parcel reply = Parcel.obtain();
6050 data.writeInterfaceToken(IActivityManager.descriptor);
6051 data.writeStrongBinder(token);
6052 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
6053 reply.readException();
6054 data.recycle();
6055 reply.recycle();
6056 }
6057
Craig Mautner5eda9b32013-07-02 11:58:16 -07006058 public void notifyActivityDrawn(IBinder token) throws RemoteException {
6059 Parcel data = Parcel.obtain();
6060 Parcel reply = Parcel.obtain();
6061 data.writeInterfaceToken(IActivityManager.descriptor);
6062 data.writeStrongBinder(token);
6063 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
6064 reply.readException();
6065 data.recycle();
6066 reply.recycle();
6067 }
6068
Dianne Hackborn57a7f592013-07-22 18:21:32 -07006069 public void restart() throws RemoteException {
6070 Parcel data = Parcel.obtain();
6071 Parcel reply = Parcel.obtain();
6072 data.writeInterfaceToken(IActivityManager.descriptor);
6073 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
6074 reply.readException();
6075 data.recycle();
6076 reply.recycle();
6077 }
6078
Dianne Hackborn35f72be2013-09-16 10:57:39 -07006079 public void performIdleMaintenance() throws RemoteException {
6080 Parcel data = Parcel.obtain();
6081 Parcel reply = Parcel.obtain();
6082 data.writeInterfaceToken(IActivityManager.descriptor);
6083 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
6084 reply.readException();
6085 data.recycle();
6086 reply.recycle();
6087 }
6088
Todd Kennedyca4d8422015-01-15 15:19:22 -08006089 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08006090 IActivityContainerCallback callback) throws RemoteException {
6091 Parcel data = Parcel.obtain();
6092 Parcel reply = Parcel.obtain();
6093 data.writeInterfaceToken(IActivityManager.descriptor);
6094 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07006095 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08006096 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08006097 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08006098 final int result = reply.readInt();
6099 final IActivityContainer res;
6100 if (result == 1) {
6101 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6102 } else {
6103 res = null;
6104 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08006105 data.recycle();
6106 reply.recycle();
6107 return res;
6108 }
6109
Craig Mautner95da1082014-02-24 17:54:35 -08006110 public void deleteActivityContainer(IActivityContainer activityContainer)
6111 throws RemoteException {
6112 Parcel data = Parcel.obtain();
6113 Parcel reply = Parcel.obtain();
6114 data.writeInterfaceToken(IActivityManager.descriptor);
6115 data.writeStrongBinder(activityContainer.asBinder());
6116 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
6117 reply.readException();
6118 data.recycle();
6119 reply.recycle();
6120 }
6121
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04006122 public boolean startBinderTracking() throws RemoteException {
6123 Parcel data = Parcel.obtain();
6124 Parcel reply = Parcel.obtain();
6125 data.writeInterfaceToken(IActivityManager.descriptor);
6126 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
6127 reply.readException();
6128 boolean res = reply.readInt() != 0;
6129 reply.recycle();
6130 data.recycle();
6131 return res;
6132 }
6133
6134 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6135 Parcel data = Parcel.obtain();
6136 Parcel reply = Parcel.obtain();
6137 data.writeInterfaceToken(IActivityManager.descriptor);
6138 if (fd != null) {
6139 data.writeInt(1);
6140 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6141 } else {
6142 data.writeInt(0);
6143 }
6144 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6145 reply.readException();
6146 boolean res = reply.readInt() != 0;
6147 reply.recycle();
6148 data.recycle();
6149 return res;
6150 }
6151
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006152 public void setVrMode(IBinder token, boolean enabled) throws RemoteException {
6153 Parcel data = Parcel.obtain();
6154 Parcel reply = Parcel.obtain();
6155 data.writeInterfaceToken(IActivityManager.descriptor);
6156 data.writeStrongBinder(token);
6157 data.writeInt(enabled ? 1 : 0);
6158 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6159 reply.readException();
6160 data.recycle();
6161 reply.recycle();
6162 }
6163
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006164 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006165 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6166 Parcel data = Parcel.obtain();
6167 Parcel reply = Parcel.obtain();
6168 data.writeInterfaceToken(IActivityManager.descriptor);
6169 data.writeInt(displayId);
6170 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6171 reply.readException();
6172 final int result = reply.readInt();
6173 final IActivityContainer res;
6174 if (result == 1) {
6175 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6176 } else {
6177 res = null;
6178 }
6179 data.recycle();
6180 reply.recycle();
6181 return res;
6182 }
6183
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006184 @Override
6185 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006186 throws RemoteException {
6187 Parcel data = Parcel.obtain();
6188 Parcel reply = Parcel.obtain();
6189 data.writeInterfaceToken(IActivityManager.descriptor);
6190 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006191 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006192 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006193 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006194 data.recycle();
6195 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006196 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006197 }
6198
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006199 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006200 public void startLockTaskMode(int taskId) throws RemoteException {
6201 Parcel data = Parcel.obtain();
6202 Parcel reply = Parcel.obtain();
6203 data.writeInterfaceToken(IActivityManager.descriptor);
6204 data.writeInt(taskId);
6205 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6206 reply.readException();
6207 data.recycle();
6208 reply.recycle();
6209 }
6210
6211 @Override
6212 public void startLockTaskMode(IBinder token) throws RemoteException {
6213 Parcel data = Parcel.obtain();
6214 Parcel reply = Parcel.obtain();
6215 data.writeInterfaceToken(IActivityManager.descriptor);
6216 data.writeStrongBinder(token);
6217 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6218 reply.readException();
6219 data.recycle();
6220 reply.recycle();
6221 }
6222
6223 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006224 public void startLockTaskModeOnCurrent() throws RemoteException {
6225 Parcel data = Parcel.obtain();
6226 Parcel reply = Parcel.obtain();
6227 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006228 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006229 reply.readException();
6230 data.recycle();
6231 reply.recycle();
6232 }
6233
6234 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006235 public void stopLockTaskMode() throws RemoteException {
6236 Parcel data = Parcel.obtain();
6237 Parcel reply = Parcel.obtain();
6238 data.writeInterfaceToken(IActivityManager.descriptor);
6239 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6240 reply.readException();
6241 data.recycle();
6242 reply.recycle();
6243 }
6244
6245 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006246 public void stopLockTaskModeOnCurrent() throws RemoteException {
6247 Parcel data = Parcel.obtain();
6248 Parcel reply = Parcel.obtain();
6249 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006250 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006251 reply.readException();
6252 data.recycle();
6253 reply.recycle();
6254 }
6255
6256 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006257 public boolean isInLockTaskMode() throws RemoteException {
6258 Parcel data = Parcel.obtain();
6259 Parcel reply = Parcel.obtain();
6260 data.writeInterfaceToken(IActivityManager.descriptor);
6261 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6262 reply.readException();
6263 boolean isInLockTaskMode = reply.readInt() == 1;
6264 data.recycle();
6265 reply.recycle();
6266 return isInLockTaskMode;
6267 }
6268
Craig Mautner688b5102014-03-27 16:55:03 -07006269 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006270 public int getLockTaskModeState() throws RemoteException {
6271 Parcel data = Parcel.obtain();
6272 Parcel reply = Parcel.obtain();
6273 data.writeInterfaceToken(IActivityManager.descriptor);
6274 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6275 reply.readException();
6276 int lockTaskModeState = reply.readInt();
6277 data.recycle();
6278 reply.recycle();
6279 return lockTaskModeState;
6280 }
6281
6282 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006283 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6284 Parcel data = Parcel.obtain();
6285 Parcel reply = Parcel.obtain();
6286 data.writeInterfaceToken(IActivityManager.descriptor);
6287 data.writeStrongBinder(token);
6288 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6289 IBinder.FLAG_ONEWAY);
6290 reply.readException();
6291 data.recycle();
6292 reply.recycle();
6293 }
6294
6295 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006296 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006297 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006298 Parcel data = Parcel.obtain();
6299 Parcel reply = Parcel.obtain();
6300 data.writeInterfaceToken(IActivityManager.descriptor);
6301 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006302 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006303 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006304 reply.readException();
6305 data.recycle();
6306 reply.recycle();
6307 }
6308
Craig Mautneree2e45a2014-06-27 12:10:03 -07006309 @Override
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006310 public void setTaskResizeable(int taskId, int resizeableMode) throws RemoteException {
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006311 Parcel data = Parcel.obtain();
6312 Parcel reply = Parcel.obtain();
6313 data.writeInterfaceToken(IActivityManager.descriptor);
6314 data.writeInt(taskId);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006315 data.writeInt(resizeableMode);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006316 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006317 reply.readException();
6318 data.recycle();
6319 reply.recycle();
6320 }
6321
6322 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006323 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006324 {
6325 Parcel data = Parcel.obtain();
6326 Parcel reply = Parcel.obtain();
6327 data.writeInterfaceToken(IActivityManager.descriptor);
6328 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006329 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006330 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006331 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006332 reply.readException();
6333 data.recycle();
6334 reply.recycle();
6335 }
6336
6337 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006338 public Rect getTaskBounds(int taskId) throws RemoteException
6339 {
6340 Parcel data = Parcel.obtain();
6341 Parcel reply = Parcel.obtain();
6342 data.writeInterfaceToken(IActivityManager.descriptor);
6343 data.writeInt(taskId);
6344 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6345 reply.readException();
6346 Rect rect = Rect.CREATOR.createFromParcel(reply);
6347 data.recycle();
6348 reply.recycle();
6349 return rect;
6350 }
6351
6352 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006353 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006354 Parcel data = Parcel.obtain();
6355 Parcel reply = Parcel.obtain();
6356 data.writeInterfaceToken(IActivityManager.descriptor);
6357 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006358 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006359 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6360 reply.readException();
6361 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6362 data.recycle();
6363 reply.recycle();
6364 return icon;
6365 }
6366
6367 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006368 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6369 throws RemoteException {
6370 Parcel data = Parcel.obtain();
6371 Parcel reply = Parcel.obtain();
6372 data.writeInterfaceToken(IActivityManager.descriptor);
6373 if (options == null) {
6374 data.writeInt(0);
6375 } else {
6376 data.writeInt(1);
6377 data.writeBundle(options.toBundle());
6378 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006379 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006380 reply.readException();
6381 data.recycle();
6382 reply.recycle();
6383 }
6384
6385 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006386 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006387 Parcel data = Parcel.obtain();
6388 Parcel reply = Parcel.obtain();
6389 data.writeInterfaceToken(IActivityManager.descriptor);
6390 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006391 data.writeInt(visible ? 1 : 0);
6392 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006393 reply.readException();
6394 boolean success = reply.readInt() > 0;
6395 data.recycle();
6396 reply.recycle();
6397 return success;
6398 }
6399
6400 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006401 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006402 Parcel data = Parcel.obtain();
6403 Parcel reply = Parcel.obtain();
6404 data.writeInterfaceToken(IActivityManager.descriptor);
6405 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006406 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006407 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006408 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006409 data.recycle();
6410 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006411 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006412 }
6413
6414 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006415 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006416 Parcel data = Parcel.obtain();
6417 Parcel reply = Parcel.obtain();
6418 data.writeInterfaceToken(IActivityManager.descriptor);
6419 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006420 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006421 reply.readException();
6422 data.recycle();
6423 reply.recycle();
6424 }
6425
6426 @Override
6427 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6428 Parcel data = Parcel.obtain();
6429 Parcel reply = Parcel.obtain();
6430 data.writeInterfaceToken(IActivityManager.descriptor);
6431 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006432 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006433 reply.readException();
6434 data.recycle();
6435 reply.recycle();
6436 }
6437
Craig Mautner8746a472014-07-24 15:12:54 -07006438 @Override
6439 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6440 Parcel data = Parcel.obtain();
6441 Parcel reply = Parcel.obtain();
6442 data.writeInterfaceToken(IActivityManager.descriptor);
6443 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006444 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006445 reply.readException();
6446 data.recycle();
6447 reply.recycle();
6448 }
6449
Craig Mautner6e2f3952014-09-09 14:26:41 -07006450 @Override
6451 public void bootAnimationComplete() throws RemoteException {
6452 Parcel data = Parcel.obtain();
6453 Parcel reply = Parcel.obtain();
6454 data.writeInterfaceToken(IActivityManager.descriptor);
6455 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6456 reply.readException();
6457 data.recycle();
6458 reply.recycle();
6459 }
6460
Wale Ogunwale18795a22014-12-03 11:38:33 -08006461 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006462 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6463 Parcel data = Parcel.obtain();
6464 Parcel reply = Parcel.obtain();
6465 data.writeInterfaceToken(IActivityManager.descriptor);
6466 data.writeInt(uid);
6467 data.writeByteArray(firstPacket);
6468 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6469 reply.readException();
6470 data.recycle();
6471 reply.recycle();
6472 }
6473
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006474 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006475 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6476 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006477 Parcel data = Parcel.obtain();
6478 Parcel reply = Parcel.obtain();
6479 data.writeInterfaceToken(IActivityManager.descriptor);
6480 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006481 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006482 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006483 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006484 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6485 reply.readException();
6486 data.recycle();
6487 reply.recycle();
6488 }
6489
6490 @Override
6491 public void dumpHeapFinished(String path) throws RemoteException {
6492 Parcel data = Parcel.obtain();
6493 Parcel reply = Parcel.obtain();
6494 data.writeInterfaceToken(IActivityManager.descriptor);
6495 data.writeString(path);
6496 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6497 reply.readException();
6498 data.recycle();
6499 reply.recycle();
6500 }
6501
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006502 @Override
6503 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6504 throws RemoteException {
6505 Parcel data = Parcel.obtain();
6506 Parcel reply = Parcel.obtain();
6507 data.writeInterfaceToken(IActivityManager.descriptor);
6508 data.writeStrongBinder(session.asBinder());
6509 data.writeInt(keepAwake ? 1 : 0);
6510 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6511 reply.readException();
6512 data.recycle();
6513 reply.recycle();
6514 }
6515
Craig Mautnere5600772015-04-03 21:36:37 -07006516 @Override
6517 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6518 Parcel data = Parcel.obtain();
6519 Parcel reply = Parcel.obtain();
6520 data.writeInterfaceToken(IActivityManager.descriptor);
6521 data.writeInt(userId);
6522 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006523 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006524 reply.readException();
6525 data.recycle();
6526 reply.recycle();
6527 }
6528
Dianne Hackborn1e383822015-04-10 14:02:33 -07006529 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006530 public void updateDeviceOwner(String packageName) throws RemoteException {
6531 Parcel data = Parcel.obtain();
6532 Parcel reply = Parcel.obtain();
6533 data.writeInterfaceToken(IActivityManager.descriptor);
6534 data.writeString(packageName);
6535 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6536 reply.readException();
6537 data.recycle();
6538 reply.recycle();
6539 }
6540
6541 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006542 public int getPackageProcessState(String packageName, String callingPackage)
6543 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006544 Parcel data = Parcel.obtain();
6545 Parcel reply = Parcel.obtain();
6546 data.writeInterfaceToken(IActivityManager.descriptor);
6547 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006548 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006549 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6550 reply.readException();
6551 int res = reply.readInt();
6552 data.recycle();
6553 reply.recycle();
6554 return res;
6555 }
6556
Stefan Kuhne16045c22015-06-05 07:18:06 -07006557 @Override
6558 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6559 throws RemoteException {
6560 Parcel data = Parcel.obtain();
6561 Parcel reply = Parcel.obtain();
6562 data.writeInterfaceToken(IActivityManager.descriptor);
6563 data.writeString(process);
6564 data.writeInt(userId);
6565 data.writeInt(level);
6566 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6567 reply.readException();
6568 int res = reply.readInt();
6569 data.recycle();
6570 reply.recycle();
6571 return res != 0;
6572 }
6573
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006574 @Override
6575 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6576 Parcel data = Parcel.obtain();
6577 Parcel reply = Parcel.obtain();
6578 data.writeInterfaceToken(IActivityManager.descriptor);
6579 data.writeStrongBinder(token);
6580 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6581 reply.readException();
6582 int res = reply.readInt();
6583 data.recycle();
6584 reply.recycle();
6585 return res != 0;
6586 }
6587
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006588 @Override
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006589 public void exitFreeformMode(IBinder token) throws RemoteException {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006590 Parcel data = Parcel.obtain();
6591 Parcel reply = Parcel.obtain();
6592 data.writeInterfaceToken(IActivityManager.descriptor);
6593 data.writeStrongBinder(token);
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006594 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006595 reply.readException();
6596 data.recycle();
6597 reply.recycle();
6598 }
6599
6600 @Override
6601 public int getActivityStackId(IBinder token) throws RemoteException {
6602 Parcel data = Parcel.obtain();
6603 Parcel reply = Parcel.obtain();
6604 data.writeInterfaceToken(IActivityManager.descriptor);
6605 data.writeStrongBinder(token);
6606 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6607 reply.readException();
6608 int stackId = reply.readInt();
6609 data.recycle();
6610 reply.recycle();
6611 return stackId;
6612 }
6613
Filip Gruszczynski23493322015-07-29 17:02:59 -07006614 @Override
6615 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006616 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6617 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006618 Parcel data = Parcel.obtain();
6619 Parcel reply = Parcel.obtain();
6620 data.writeInterfaceToken(IActivityManager.descriptor);
6621 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006622 writeIntArray(horizontalSizeConfiguration, data);
6623 writeIntArray(verticalSizeConfigurations, data);
6624 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006625 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6626 reply.readException();
6627 data.recycle();
6628 reply.recycle();
6629 }
6630
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006631 private static void writeIntArray(int[] array, Parcel data) {
6632 if (array == null) {
6633 data.writeInt(0);
6634 } else {
6635 data.writeInt(array.length);
6636 data.writeIntArray(array);
6637 }
6638 }
6639
Wale Ogunwale83301a92015-09-24 15:54:08 -07006640 @Override
6641 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6642 Parcel data = Parcel.obtain();
6643 Parcel reply = Parcel.obtain();
6644 data.writeInterfaceToken(IActivityManager.descriptor);
6645 data.writeInt(suppress ? 1 : 0);
6646 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6647 reply.readException();
6648 data.recycle();
6649 reply.recycle();
6650 }
6651
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006652 @Override
Wale Ogunwale9101d262016-01-15 08:56:11 -08006653 public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006654 Parcel data = Parcel.obtain();
6655 Parcel reply = Parcel.obtain();
6656 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006657 data.writeInt(fromStackId);
Wale Ogunwale9101d262016-01-15 08:56:11 -08006658 data.writeInt(onTop ? 1 : 0);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006659 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006660 reply.readException();
6661 data.recycle();
6662 reply.recycle();
6663 }
6664
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006665 @Override
6666 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6667 Parcel data = Parcel.obtain();
6668 Parcel reply = Parcel.obtain();
6669 data.writeInterfaceToken(IActivityManager.descriptor);
6670 data.writeInt(uid);
6671 data.writeString(packageName);
6672 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6673 reply.readException();
6674 int res = reply.readInt();
6675 data.recycle();
6676 reply.recycle();
6677 return res;
6678 }
6679
Wale Ogunwale5f986092015-12-04 15:35:38 -08006680 @Override
6681 public boolean inMultiWindowMode(IBinder token) throws RemoteException {
6682 Parcel data = Parcel.obtain();
6683 Parcel reply = Parcel.obtain();
6684 data.writeInterfaceToken(IActivityManager.descriptor);
6685 data.writeStrongBinder(token);
6686 mRemote.transact(IN_MULTI_WINDOW_MODE_TRANSACTION, data, reply, 0);
6687 reply.readException();
6688 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6689 data.recycle();
6690 reply.recycle();
6691 return multiWindowMode;
6692 }
6693
6694 @Override
6695 public boolean inPictureInPictureMode(IBinder token) throws RemoteException {
6696 Parcel data = Parcel.obtain();
6697 Parcel reply = Parcel.obtain();
6698 data.writeInterfaceToken(IActivityManager.descriptor);
6699 data.writeStrongBinder(token);
6700 mRemote.transact(IN_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6701 reply.readException();
6702 final boolean pipMode = reply.readInt() == 1 ? true : false;
6703 data.recycle();
6704 reply.recycle();
6705 return pipMode;
6706 }
6707
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006708 @Override
6709 public void enterPictureInPictureMode(IBinder token) throws RemoteException {
6710 Parcel data = Parcel.obtain();
6711 Parcel reply = Parcel.obtain();
6712 data.writeInterfaceToken(IActivityManager.descriptor);
6713 data.writeStrongBinder(token);
6714 mRemote.transact(ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6715 reply.readException();
6716 data.recycle();
6717 reply.recycle();
6718 }
6719
Christopher Tate63fec3e2015-12-11 18:35:28 -08006720 @Override
6721 public boolean isAppForeground(int uid) throws RemoteException {
6722 Parcel data = Parcel.obtain();
6723 Parcel reply = Parcel.obtain();
6724 data.writeInterfaceToken(IActivityManager.descriptor);
6725 data.writeInt(uid);
6726 mRemote.transact(IS_APP_FOREGROUND_TRANSACTION, data, reply, 0);
6727 final boolean isForeground = reply.readInt() == 1 ? true : false;
6728 data.recycle();
6729 reply.recycle();
6730 return isForeground;
6731 };
6732
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006733 private IBinder mRemote;
6734}