blob: 1954774e1177caa336af214f31e651de43e41fee [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();
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00002083 byte[] secret = data.createByteArray();
2084 boolean result = unlockUser(userId, token, secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08002085 reply.writeNoException();
2086 reply.writeInt(result ? 1 : 0);
2087 return true;
2088 }
2089
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002090 case STOP_USER_TRANSACTION: {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002093 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002094 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2095 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002096 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002097 reply.writeNoException();
2098 reply.writeInt(result);
2099 return true;
2100 }
2101
Amith Yamasani52f1d752012-03-28 18:19:29 -07002102 case GET_CURRENT_USER_TRANSACTION: {
2103 data.enforceInterface(IActivityManager.descriptor);
2104 UserInfo userInfo = getCurrentUser();
2105 reply.writeNoException();
2106 userInfo.writeToParcel(reply, 0);
2107 return true;
2108 }
2109
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002110 case IS_USER_RUNNING_TRANSACTION: {
2111 data.enforceInterface(IActivityManager.descriptor);
2112 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002113 int _flags = data.readInt();
2114 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002115 reply.writeNoException();
2116 reply.writeInt(result ? 1 : 0);
2117 return true;
2118 }
2119
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002120 case GET_RUNNING_USER_IDS_TRANSACTION: {
2121 data.enforceInterface(IActivityManager.descriptor);
2122 int[] result = getRunningUserIds();
2123 reply.writeNoException();
2124 reply.writeIntArray(result);
2125 return true;
2126 }
2127
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002128 case REMOVE_TASK_TRANSACTION:
2129 {
2130 data.enforceInterface(IActivityManager.descriptor);
2131 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002132 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002133 reply.writeNoException();
2134 reply.writeInt(result ? 1 : 0);
2135 return true;
2136 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002137
Jeff Sharkeya4620792011-05-20 15:29:23 -07002138 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2139 data.enforceInterface(IActivityManager.descriptor);
2140 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2141 data.readStrongBinder());
2142 registerProcessObserver(observer);
2143 return true;
2144 }
2145
2146 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2149 data.readStrongBinder());
2150 unregisterProcessObserver(observer);
2151 return true;
2152 }
2153
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002154 case REGISTER_UID_OBSERVER_TRANSACTION: {
2155 data.enforceInterface(IActivityManager.descriptor);
2156 IUidObserver observer = IUidObserver.Stub.asInterface(
2157 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002158 int which = data.readInt();
2159 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002160 return true;
2161 }
2162
2163 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2164 data.enforceInterface(IActivityManager.descriptor);
2165 IUidObserver observer = IUidObserver.Stub.asInterface(
2166 data.readStrongBinder());
2167 unregisterUidObserver(observer);
2168 return true;
2169 }
2170
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002171 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2172 {
2173 data.enforceInterface(IActivityManager.descriptor);
2174 String pkg = data.readString();
2175 boolean ask = getPackageAskScreenCompat(pkg);
2176 reply.writeNoException();
2177 reply.writeInt(ask ? 1 : 0);
2178 return true;
2179 }
2180
2181 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2182 {
2183 data.enforceInterface(IActivityManager.descriptor);
2184 String pkg = data.readString();
2185 boolean ask = data.readInt() != 0;
2186 setPackageAskScreenCompat(pkg, ask);
2187 reply.writeNoException();
2188 return true;
2189 }
2190
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002191 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2192 data.enforceInterface(IActivityManager.descriptor);
2193 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002194 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002195 boolean res = isIntentSenderTargetedToPackage(r);
2196 reply.writeNoException();
2197 reply.writeInt(res ? 1 : 0);
2198 return true;
2199 }
2200
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002201 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2202 data.enforceInterface(IActivityManager.descriptor);
2203 IIntentSender r = IIntentSender.Stub.asInterface(
2204 data.readStrongBinder());
2205 boolean res = isIntentSenderAnActivity(r);
2206 reply.writeNoException();
2207 reply.writeInt(res ? 1 : 0);
2208 return true;
2209 }
2210
Dianne Hackborn81038902012-11-26 17:04:09 -08002211 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2212 data.enforceInterface(IActivityManager.descriptor);
2213 IIntentSender r = IIntentSender.Stub.asInterface(
2214 data.readStrongBinder());
2215 Intent intent = getIntentForIntentSender(r);
2216 reply.writeNoException();
2217 if (intent != null) {
2218 reply.writeInt(1);
2219 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2220 } else {
2221 reply.writeInt(0);
2222 }
2223 return true;
2224 }
2225
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002226 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2227 data.enforceInterface(IActivityManager.descriptor);
2228 IIntentSender r = IIntentSender.Stub.asInterface(
2229 data.readStrongBinder());
2230 String prefix = data.readString();
2231 String tag = getTagForIntentSender(r, prefix);
2232 reply.writeNoException();
2233 reply.writeString(tag);
2234 return true;
2235 }
2236
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002237 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2238 data.enforceInterface(IActivityManager.descriptor);
2239 Configuration config = Configuration.CREATOR.createFromParcel(data);
2240 updatePersistentConfiguration(config);
2241 reply.writeNoException();
2242 return true;
2243 }
2244
Dianne Hackbornb437e092011-08-05 17:50:29 -07002245 case GET_PROCESS_PSS_TRANSACTION: {
2246 data.enforceInterface(IActivityManager.descriptor);
2247 int[] pids = data.createIntArray();
2248 long[] pss = getProcessPss(pids);
2249 reply.writeNoException();
2250 reply.writeLongArray(pss);
2251 return true;
2252 }
2253
Dianne Hackborn661cd522011-08-22 00:26:20 -07002254 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2255 data.enforceInterface(IActivityManager.descriptor);
2256 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2257 boolean always = data.readInt() != 0;
2258 showBootMessage(msg, always);
2259 reply.writeNoException();
2260 return true;
2261 }
2262
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002263 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002264 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002265 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002266 reply.writeNoException();
2267 return true;
2268 }
2269
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002270 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2271 data.enforceInterface(IActivityManager.descriptor);
2272 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2273 reply.writeNoException();
2274 return true;
2275 }
2276
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002277 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002278 data.enforceInterface(IActivityManager.descriptor);
2279 IBinder token = data.readStrongBinder();
2280 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002281 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002282 reply.writeNoException();
2283 reply.writeInt(res ? 1 : 0);
2284 return true;
2285 }
2286
2287 case NAVIGATE_UP_TO_TRANSACTION: {
2288 data.enforceInterface(IActivityManager.descriptor);
2289 IBinder token = data.readStrongBinder();
2290 Intent target = Intent.CREATOR.createFromParcel(data);
2291 int resultCode = data.readInt();
2292 Intent resultData = null;
2293 if (data.readInt() != 0) {
2294 resultData = Intent.CREATOR.createFromParcel(data);
2295 }
2296 boolean res = navigateUpTo(token, target, resultCode, resultData);
2297 reply.writeNoException();
2298 reply.writeInt(res ? 1 : 0);
2299 return true;
2300 }
2301
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002302 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2303 data.enforceInterface(IActivityManager.descriptor);
2304 IBinder token = data.readStrongBinder();
2305 int res = getLaunchedFromUid(token);
2306 reply.writeNoException();
2307 reply.writeInt(res);
2308 return true;
2309 }
2310
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002311 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2312 data.enforceInterface(IActivityManager.descriptor);
2313 IBinder token = data.readStrongBinder();
2314 String res = getLaunchedFromPackage(token);
2315 reply.writeNoException();
2316 reply.writeString(res);
2317 return true;
2318 }
2319
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002320 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2321 data.enforceInterface(IActivityManager.descriptor);
2322 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2323 data.readStrongBinder());
2324 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002325 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002326 return true;
2327 }
2328
2329 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2330 data.enforceInterface(IActivityManager.descriptor);
2331 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2332 data.readStrongBinder());
2333 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002334 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002335 return true;
2336 }
2337
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002338 case REQUEST_BUG_REPORT_TRANSACTION: {
2339 data.enforceInterface(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00002340 int bugreportType = data.readInt();
2341 requestBugReport(bugreportType);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002342 reply.writeNoException();
2343 return true;
2344 }
2345
2346 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2347 data.enforceInterface(IActivityManager.descriptor);
2348 int pid = data.readInt();
2349 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002350 String reason = data.readString();
2351 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002352 reply.writeNoException();
2353 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002354 return true;
2355 }
2356
Adam Skorydfc7fd72013-08-05 19:23:41 -07002357 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002358 data.enforceInterface(IActivityManager.descriptor);
2359 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002360 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002361 reply.writeNoException();
2362 reply.writeBundle(res);
2363 return true;
2364 }
2365
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002366 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2367 data.enforceInterface(IActivityManager.descriptor);
2368 int requestType = data.readInt();
2369 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002370 IBinder activityToken = data.readStrongBinder();
2371 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002372 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002373 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002374 return true;
2375 }
2376
Adam Skorydfc7fd72013-08-05 19:23:41 -07002377 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002378 data.enforceInterface(IActivityManager.descriptor);
2379 IBinder token = data.readStrongBinder();
2380 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002381 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2382 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002383 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2384 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002385 reply.writeNoException();
2386 return true;
2387 }
2388
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002389 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2390 data.enforceInterface(IActivityManager.descriptor);
2391 Intent intent = Intent.CREATOR.createFromParcel(data);
2392 int requestType = data.readInt();
2393 String hint = data.readString();
2394 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002395 Bundle args = data.readBundle();
2396 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002397 reply.writeNoException();
2398 reply.writeInt(res ? 1 : 0);
2399 return true;
2400 }
2401
Benjamin Franzc200f442015-06-25 18:20:04 +01002402 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2403 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002404 boolean res = isAssistDataAllowedOnCurrentActivity();
2405 reply.writeNoException();
2406 reply.writeInt(res ? 1 : 0);
2407 return true;
2408 }
2409
2410 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2411 data.enforceInterface(IActivityManager.descriptor);
2412 IBinder token = data.readStrongBinder();
2413 Bundle args = data.readBundle();
2414 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002415 reply.writeNoException();
2416 reply.writeInt(res ? 1 : 0);
2417 return true;
2418 }
2419
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002420 case KILL_UID_TRANSACTION: {
2421 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002422 int appId = data.readInt();
2423 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002424 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002425 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002426 reply.writeNoException();
2427 return true;
2428 }
2429
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002430 case HANG_TRANSACTION: {
2431 data.enforceInterface(IActivityManager.descriptor);
2432 IBinder who = data.readStrongBinder();
2433 boolean allowRestart = data.readInt() != 0;
2434 hang(who, allowRestart);
2435 reply.writeNoException();
2436 return true;
2437 }
2438
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002439 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2440 data.enforceInterface(IActivityManager.descriptor);
2441 IBinder token = data.readStrongBinder();
2442 reportActivityFullyDrawn(token);
2443 reply.writeNoException();
2444 return true;
2445 }
2446
Craig Mautner5eda9b32013-07-02 11:58:16 -07002447 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2448 data.enforceInterface(IActivityManager.descriptor);
2449 IBinder token = data.readStrongBinder();
2450 notifyActivityDrawn(token);
2451 reply.writeNoException();
2452 return true;
2453 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002454
2455 case RESTART_TRANSACTION: {
2456 data.enforceInterface(IActivityManager.descriptor);
2457 restart();
2458 reply.writeNoException();
2459 return true;
2460 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002461
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002462 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2463 data.enforceInterface(IActivityManager.descriptor);
2464 performIdleMaintenance();
2465 reply.writeNoException();
2466 return true;
2467 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002468
Todd Kennedyca4d8422015-01-15 15:19:22 -08002469 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002470 data.enforceInterface(IActivityManager.descriptor);
2471 IBinder parentActivityToken = data.readStrongBinder();
2472 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002473 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002474 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002475 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002476 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002477 if (activityContainer != null) {
2478 reply.writeInt(1);
2479 reply.writeStrongBinder(activityContainer.asBinder());
2480 } else {
2481 reply.writeInt(0);
2482 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002483 return true;
2484 }
2485
Craig Mautner95da1082014-02-24 17:54:35 -08002486 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2487 data.enforceInterface(IActivityManager.descriptor);
2488 IActivityContainer activityContainer =
2489 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2490 deleteActivityContainer(activityContainer);
2491 reply.writeNoException();
2492 return true;
2493 }
2494
Todd Kennedy4900bf92015-01-16 16:05:14 -08002495 case CREATE_STACK_ON_DISPLAY: {
2496 data.enforceInterface(IActivityManager.descriptor);
2497 int displayId = data.readInt();
2498 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2499 reply.writeNoException();
2500 if (activityContainer != null) {
2501 reply.writeInt(1);
2502 reply.writeStrongBinder(activityContainer.asBinder());
2503 } else {
2504 reply.writeInt(0);
2505 }
2506 return true;
2507 }
2508
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002509 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002510 data.enforceInterface(IActivityManager.descriptor);
2511 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002512 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002513 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002514 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002515 return true;
2516 }
2517
Craig Mautneraea74a52014-03-08 14:23:10 -08002518 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2519 data.enforceInterface(IActivityManager.descriptor);
2520 final int taskId = data.readInt();
2521 startLockTaskMode(taskId);
2522 reply.writeNoException();
2523 return true;
2524 }
2525
2526 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2527 data.enforceInterface(IActivityManager.descriptor);
2528 IBinder token = data.readStrongBinder();
2529 startLockTaskMode(token);
2530 reply.writeNoException();
2531 return true;
2532 }
2533
Craig Mautnerd61dc202014-07-07 11:09:11 -07002534 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002535 data.enforceInterface(IActivityManager.descriptor);
2536 startLockTaskModeOnCurrent();
2537 reply.writeNoException();
2538 return true;
2539 }
2540
Craig Mautneraea74a52014-03-08 14:23:10 -08002541 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2542 data.enforceInterface(IActivityManager.descriptor);
2543 stopLockTaskMode();
2544 reply.writeNoException();
2545 return true;
2546 }
2547
Craig Mautnerd61dc202014-07-07 11:09:11 -07002548 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002549 data.enforceInterface(IActivityManager.descriptor);
2550 stopLockTaskModeOnCurrent();
2551 reply.writeNoException();
2552 return true;
2553 }
2554
Craig Mautneraea74a52014-03-08 14:23:10 -08002555 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2556 data.enforceInterface(IActivityManager.descriptor);
2557 final boolean isInLockTaskMode = isInLockTaskMode();
2558 reply.writeNoException();
2559 reply.writeInt(isInLockTaskMode ? 1 : 0);
2560 return true;
2561 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002562
Benjamin Franz43261142015-02-11 15:59:44 +00002563 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2564 data.enforceInterface(IActivityManager.descriptor);
2565 final int lockTaskModeState = getLockTaskModeState();
2566 reply.writeNoException();
2567 reply.writeInt(lockTaskModeState);
2568 return true;
2569 }
2570
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002571 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2572 data.enforceInterface(IActivityManager.descriptor);
2573 final IBinder token = data.readStrongBinder();
2574 showLockTaskEscapeMessage(token);
2575 reply.writeNoException();
2576 return true;
2577 }
2578
Winson Chunga449dc02014-05-16 11:15:04 -07002579 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002580 data.enforceInterface(IActivityManager.descriptor);
2581 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002582 ActivityManager.TaskDescription values =
2583 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2584 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002585 reply.writeNoException();
2586 return true;
2587 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002588
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002589 case SET_TASK_RESIZEABLE_TRANSACTION: {
2590 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08002591 final int taskId = data.readInt();
2592 final int resizeableMode = data.readInt();
2593 setTaskResizeable(taskId, resizeableMode);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002594 reply.writeNoException();
2595 return true;
2596 }
2597
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002598 case RESIZE_TASK_TRANSACTION: {
2599 data.enforceInterface(IActivityManager.descriptor);
2600 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002601 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002602 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002603 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002604 reply.writeNoException();
2605 return true;
2606 }
2607
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002608 case GET_TASK_BOUNDS_TRANSACTION: {
2609 data.enforceInterface(IActivityManager.descriptor);
2610 int taskId = data.readInt();
2611 Rect r = getTaskBounds(taskId);
2612 reply.writeNoException();
2613 r.writeToParcel(reply, 0);
2614 return true;
2615 }
2616
Craig Mautner648f69b2014-09-18 14:16:26 -07002617 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2618 data.enforceInterface(IActivityManager.descriptor);
2619 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002620 int userId = data.readInt();
2621 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002622 reply.writeNoException();
2623 if (icon == null) {
2624 reply.writeInt(0);
2625 } else {
2626 reply.writeInt(1);
2627 icon.writeToParcel(reply, 0);
2628 }
2629 return true;
2630 }
2631
Winson Chung044d5292014-11-06 11:05:19 -08002632 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2633 data.enforceInterface(IActivityManager.descriptor);
2634 final Bundle bundle;
2635 if (data.readInt() == 0) {
2636 bundle = null;
2637 } else {
2638 bundle = data.readBundle();
2639 }
Chong Zhang280d3322015-11-03 17:27:26 -08002640 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002641 startInPlaceAnimationOnFrontMostApplication(options);
2642 reply.writeNoException();
2643 return true;
2644 }
2645
Jose Lima4b6c6692014-08-12 17:41:12 -07002646 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002647 data.enforceInterface(IActivityManager.descriptor);
2648 IBinder token = data.readStrongBinder();
2649 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002650 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002651 reply.writeNoException();
2652 reply.writeInt(success ? 1 : 0);
2653 return true;
2654 }
2655
Jose Lima4b6c6692014-08-12 17:41:12 -07002656 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002657 data.enforceInterface(IActivityManager.descriptor);
2658 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002659 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002660 reply.writeNoException();
2661 reply.writeInt(enabled ? 1 : 0);
2662 return true;
2663 }
2664
Jose Lima4b6c6692014-08-12 17:41:12 -07002665 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002666 data.enforceInterface(IActivityManager.descriptor);
2667 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002668 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002669 reply.writeNoException();
2670 return true;
2671 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002672
2673 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2674 data.enforceInterface(IActivityManager.descriptor);
2675 IBinder token = data.readStrongBinder();
2676 notifyLaunchTaskBehindComplete(token);
2677 reply.writeNoException();
2678 return true;
2679 }
Craig Mautner8746a472014-07-24 15:12:54 -07002680
2681 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2682 data.enforceInterface(IActivityManager.descriptor);
2683 IBinder token = data.readStrongBinder();
2684 notifyEnterAnimationComplete(token);
2685 reply.writeNoException();
2686 return true;
2687 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002688
2689 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2690 data.enforceInterface(IActivityManager.descriptor);
2691 bootAnimationComplete();
2692 reply.writeNoException();
2693 return true;
2694 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002695
Jeff Sharkey605eb792014-11-04 13:34:06 -08002696 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2697 data.enforceInterface(IActivityManager.descriptor);
2698 final int uid = data.readInt();
2699 final byte[] firstPacket = data.createByteArray();
2700 notifyCleartextNetwork(uid, firstPacket);
2701 reply.writeNoException();
2702 return true;
2703 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002704
2705 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2706 data.enforceInterface(IActivityManager.descriptor);
2707 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002708 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002709 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002710 String reportPackage = data.readString();
2711 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002712 reply.writeNoException();
2713 return true;
2714 }
2715
2716 case DUMP_HEAP_FINISHED_TRANSACTION: {
2717 data.enforceInterface(IActivityManager.descriptor);
2718 String path = data.readString();
2719 dumpHeapFinished(path);
2720 reply.writeNoException();
2721 return true;
2722 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002723
2724 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2725 data.enforceInterface(IActivityManager.descriptor);
2726 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2727 data.readStrongBinder());
2728 boolean keepAwake = data.readInt() != 0;
2729 setVoiceKeepAwake(session, keepAwake);
2730 reply.writeNoException();
2731 return true;
2732 }
Craig Mautnere5600772015-04-03 21:36:37 -07002733
2734 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2735 data.enforceInterface(IActivityManager.descriptor);
2736 int userId = data.readInt();
2737 String[] packages = data.readStringArray();
2738 updateLockTaskPackages(userId, packages);
2739 reply.writeNoException();
2740 return true;
2741 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002742
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002743 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2744 data.enforceInterface(IActivityManager.descriptor);
2745 String packageName = data.readString();
2746 updateDeviceOwner(packageName);
2747 reply.writeNoException();
2748 return true;
2749 }
2750
Dianne Hackborn1e383822015-04-10 14:02:33 -07002751 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2752 data.enforceInterface(IActivityManager.descriptor);
2753 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002754 String callingPackage = data.readString();
2755 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002756 reply.writeNoException();
2757 reply.writeInt(res);
2758 return true;
2759 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002760
2761 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2762 data.enforceInterface(IActivityManager.descriptor);
2763 String process = data.readString();
2764 int userId = data.readInt();
2765 int level = data.readInt();
2766 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2767 reply.writeNoException();
2768 reply.writeInt(res ? 1 : 0);
2769 return true;
2770 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002771
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002772 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2773 data.enforceInterface(IActivityManager.descriptor);
2774 IBinder token = data.readStrongBinder();
2775 boolean res = isRootVoiceInteraction(token);
2776 reply.writeNoException();
2777 reply.writeInt(res ? 1 : 0);
2778 return true;
2779 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002780
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002781 case START_BINDER_TRACKING_TRANSACTION: {
2782 data.enforceInterface(IActivityManager.descriptor);
2783 boolean res = startBinderTracking();
2784 reply.writeNoException();
2785 reply.writeInt(res ? 1 : 0);
2786 return true;
2787 }
2788
2789 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2790 data.enforceInterface(IActivityManager.descriptor);
2791 ParcelFileDescriptor fd = data.readInt() != 0
2792 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2793 boolean res = stopBinderTrackingAndDump(fd);
2794 reply.writeNoException();
2795 reply.writeInt(res ? 1 : 0);
2796 return true;
2797 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002798 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2799 data.enforceInterface(IActivityManager.descriptor);
2800 IBinder token = data.readStrongBinder();
2801 int stackId = getActivityStackId(token);
2802 reply.writeNoException();
2803 reply.writeInt(stackId);
2804 return true;
2805 }
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002806 case EXIT_FREEFORM_MODE_TRANSACTION: {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002807 data.enforceInterface(IActivityManager.descriptor);
2808 IBinder token = data.readStrongBinder();
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002809 exitFreeformMode(token);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002810 reply.writeNoException();
2811 return true;
2812 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002813 case REPORT_SIZE_CONFIGURATIONS: {
2814 data.enforceInterface(IActivityManager.descriptor);
2815 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002816 int[] horizontal = readIntArray(data);
2817 int[] vertical = readIntArray(data);
2818 int[] smallest = readIntArray(data);
2819 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002820 return true;
2821 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002822 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2823 data.enforceInterface(IActivityManager.descriptor);
2824 final boolean suppress = data.readInt() == 1;
2825 suppressResizeConfigChanges(suppress);
2826 reply.writeNoException();
2827 return true;
2828 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002829 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002830 data.enforceInterface(IActivityManager.descriptor);
2831 final int stackId = data.readInt();
Wale Ogunwale9101d262016-01-15 08:56:11 -08002832 final boolean onTop = data.readInt() == 1;
2833 moveTasksToFullscreenStack(stackId, onTop);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002834 reply.writeNoException();
2835 return true;
2836 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002837 case GET_APP_START_MODE_TRANSACTION: {
2838 data.enforceInterface(IActivityManager.descriptor);
2839 final int uid = data.readInt();
2840 final String pkg = data.readString();
2841 int res = getAppStartMode(uid, pkg);
2842 reply.writeNoException();
2843 reply.writeInt(res);
2844 return true;
2845 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002846 case IN_MULTI_WINDOW_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002847 data.enforceInterface(IActivityManager.descriptor);
2848 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002849 final boolean inMultiWindow = inMultiWindow(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002850 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002851 reply.writeInt(inMultiWindow ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002852 return true;
2853 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002854 case IN_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002855 data.enforceInterface(IActivityManager.descriptor);
2856 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002857 final boolean inPip = inPictureInPicture(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002858 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002859 reply.writeInt(inPip ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002860 return true;
2861 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002862 case ENTER_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002863 data.enforceInterface(IActivityManager.descriptor);
2864 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002865 enterPictureInPicture(token);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002866 reply.writeNoException();
2867 return true;
2868 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002869 case SET_VR_MODE_TRANSACTION: {
2870 data.enforceInterface(IActivityManager.descriptor);
2871 final IBinder token = data.readStrongBinder();
2872 final boolean enable = data.readInt() == 1;
2873 setVrMode(token, enable);
2874 reply.writeNoException();
2875 return true;
2876 }
Christopher Tate63fec3e2015-12-11 18:35:28 -08002877 case IS_APP_FOREGROUND_TRANSACTION: {
2878 data.enforceInterface(IActivityManager.descriptor);
2879 final int userHandle = data.readInt();
2880 final boolean isForeground = isAppForeground(userHandle);
2881 reply.writeNoException();
2882 reply.writeInt(isForeground ? 1 : 0);
2883 return true;
2884 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002885 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002886
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002887 return super.onTransact(code, data, reply, flags);
2888 }
2889
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002890 private int[] readIntArray(Parcel data) {
2891 int[] smallest = null;
2892 int smallestSize = data.readInt();
2893 if (smallestSize > 0) {
2894 smallest = new int[smallestSize];
2895 data.readIntArray(smallest);
2896 }
2897 return smallest;
2898 }
2899
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002900 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002901 return this;
2902 }
2903
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002904 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2905 protected IActivityManager create() {
2906 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002907 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002908 Log.v("ActivityManager", "default service binder = " + b);
2909 }
2910 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002911 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002912 Log.v("ActivityManager", "default service = " + am);
2913 }
2914 return am;
2915 }
2916 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002917}
2918
2919class ActivityManagerProxy implements IActivityManager
2920{
2921 public ActivityManagerProxy(IBinder remote)
2922 {
2923 mRemote = remote;
2924 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002925
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002926 public IBinder asBinder()
2927 {
2928 return mRemote;
2929 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002930
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002931 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002932 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002933 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002934 Parcel data = Parcel.obtain();
2935 Parcel reply = Parcel.obtain();
2936 data.writeInterfaceToken(IActivityManager.descriptor);
2937 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002938 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002939 intent.writeToParcel(data, 0);
2940 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002941 data.writeStrongBinder(resultTo);
2942 data.writeString(resultWho);
2943 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002944 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002945 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002946 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002947 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002948 } else {
2949 data.writeInt(0);
2950 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002951 if (options != null) {
2952 data.writeInt(1);
2953 options.writeToParcel(data, 0);
2954 } else {
2955 data.writeInt(0);
2956 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002957 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2958 reply.readException();
2959 int result = reply.readInt();
2960 reply.recycle();
2961 data.recycle();
2962 return result;
2963 }
Amith Yamasani82644082012-08-03 13:09:11 -07002964
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002965 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002966 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002967 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2968 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002969 Parcel data = Parcel.obtain();
2970 Parcel reply = Parcel.obtain();
2971 data.writeInterfaceToken(IActivityManager.descriptor);
2972 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002973 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002974 intent.writeToParcel(data, 0);
2975 data.writeString(resolvedType);
2976 data.writeStrongBinder(resultTo);
2977 data.writeString(resultWho);
2978 data.writeInt(requestCode);
2979 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002980 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002981 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002982 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002983 } else {
2984 data.writeInt(0);
2985 }
2986 if (options != null) {
2987 data.writeInt(1);
2988 options.writeToParcel(data, 0);
2989 } else {
2990 data.writeInt(0);
2991 }
2992 data.writeInt(userId);
2993 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2994 reply.readException();
2995 int result = reply.readInt();
2996 reply.recycle();
2997 data.recycle();
2998 return result;
2999 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003000 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
3001 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003002 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
3003 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003004 Parcel data = Parcel.obtain();
3005 Parcel reply = Parcel.obtain();
3006 data.writeInterfaceToken(IActivityManager.descriptor);
3007 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3008 data.writeString(callingPackage);
3009 intent.writeToParcel(data, 0);
3010 data.writeString(resolvedType);
3011 data.writeStrongBinder(resultTo);
3012 data.writeString(resultWho);
3013 data.writeInt(requestCode);
3014 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003015 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003016 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003017 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003018 } else {
3019 data.writeInt(0);
3020 }
3021 if (options != null) {
3022 data.writeInt(1);
3023 options.writeToParcel(data, 0);
3024 } else {
3025 data.writeInt(0);
3026 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003027 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07003028 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003029 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
3030 reply.readException();
3031 int result = reply.readInt();
3032 reply.recycle();
3033 data.recycle();
3034 return result;
3035 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003036 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
3037 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07003038 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
3039 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003040 Parcel data = Parcel.obtain();
3041 Parcel reply = Parcel.obtain();
3042 data.writeInterfaceToken(IActivityManager.descriptor);
3043 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003044 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003045 intent.writeToParcel(data, 0);
3046 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003047 data.writeStrongBinder(resultTo);
3048 data.writeString(resultWho);
3049 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003050 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003051 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003052 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003053 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003054 } else {
3055 data.writeInt(0);
3056 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003057 if (options != null) {
3058 data.writeInt(1);
3059 options.writeToParcel(data, 0);
3060 } else {
3061 data.writeInt(0);
3062 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003063 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003064 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3065 reply.readException();
3066 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3067 reply.recycle();
3068 data.recycle();
3069 return result;
3070 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003071 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3072 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003073 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003074 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003079 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003080 intent.writeToParcel(data, 0);
3081 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003082 data.writeStrongBinder(resultTo);
3083 data.writeString(resultWho);
3084 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003085 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003086 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003087 if (options != null) {
3088 data.writeInt(1);
3089 options.writeToParcel(data, 0);
3090 } else {
3091 data.writeInt(0);
3092 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003093 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003094 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3095 reply.readException();
3096 int result = reply.readInt();
3097 reply.recycle();
3098 data.recycle();
3099 return result;
3100 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003101 public int startActivityIntentSender(IApplicationThread caller,
3102 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003103 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003104 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003105 Parcel data = Parcel.obtain();
3106 Parcel reply = Parcel.obtain();
3107 data.writeInterfaceToken(IActivityManager.descriptor);
3108 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3109 intent.writeToParcel(data, 0);
3110 if (fillInIntent != null) {
3111 data.writeInt(1);
3112 fillInIntent.writeToParcel(data, 0);
3113 } else {
3114 data.writeInt(0);
3115 }
3116 data.writeString(resolvedType);
3117 data.writeStrongBinder(resultTo);
3118 data.writeString(resultWho);
3119 data.writeInt(requestCode);
3120 data.writeInt(flagsMask);
3121 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003122 if (options != null) {
3123 data.writeInt(1);
3124 options.writeToParcel(data, 0);
3125 } else {
3126 data.writeInt(0);
3127 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003128 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003129 reply.readException();
3130 int result = reply.readInt();
3131 reply.recycle();
3132 data.recycle();
3133 return result;
3134 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003135 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3136 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003137 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3138 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003139 Parcel data = Parcel.obtain();
3140 Parcel reply = Parcel.obtain();
3141 data.writeInterfaceToken(IActivityManager.descriptor);
3142 data.writeString(callingPackage);
3143 data.writeInt(callingPid);
3144 data.writeInt(callingUid);
3145 intent.writeToParcel(data, 0);
3146 data.writeString(resolvedType);
3147 data.writeStrongBinder(session.asBinder());
3148 data.writeStrongBinder(interactor.asBinder());
3149 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003150 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003151 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003152 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003153 } else {
3154 data.writeInt(0);
3155 }
3156 if (options != null) {
3157 data.writeInt(1);
3158 options.writeToParcel(data, 0);
3159 } else {
3160 data.writeInt(0);
3161 }
3162 data.writeInt(userId);
3163 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3164 reply.readException();
3165 int result = reply.readInt();
3166 reply.recycle();
3167 data.recycle();
3168 return result;
3169 }
Amith Yamasani0af6fa72016-01-17 15:36:19 -08003170
3171 public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options)
3172 throws RemoteException {
3173 Parcel data = Parcel.obtain();
3174 Parcel reply = Parcel.obtain();
3175 data.writeInterfaceToken(IActivityManager.descriptor);
3176 data.writeStrongBinder(callingActivity);
3177 data.writeBundle(options);
3178 mRemote.transact(START_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3179 reply.readException();
3180 reply.recycle();
3181 data.recycle();
3182 }
3183
3184 public void stopLocalVoiceInteraction(IBinder callingActivity) throws RemoteException {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeStrongBinder(callingActivity);
3189 mRemote.transact(STOP_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 reply.recycle();
3192 data.recycle();
3193 }
3194
3195 public boolean supportsLocalVoiceInteraction() throws RemoteException {
3196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 mRemote.transact(SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3200 reply.readException();
3201 int result = reply.readInt();
3202 reply.recycle();
3203 data.recycle();
3204 return result != 0;
3205 }
3206
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003208 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003209 Parcel data = Parcel.obtain();
3210 Parcel reply = Parcel.obtain();
3211 data.writeInterfaceToken(IActivityManager.descriptor);
3212 data.writeStrongBinder(callingActivity);
3213 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003214 if (options != null) {
3215 data.writeInt(1);
3216 options.writeToParcel(data, 0);
3217 } else {
3218 data.writeInt(0);
3219 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003220 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3221 reply.readException();
3222 int result = reply.readInt();
3223 reply.recycle();
3224 data.recycle();
3225 return result != 0;
3226 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003227 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003228 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 data.writeInt(taskId);
3233 if (options == null) {
3234 data.writeInt(0);
3235 } else {
3236 data.writeInt(1);
3237 options.writeToParcel(data, 0);
3238 }
3239 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3240 reply.readException();
3241 int result = reply.readInt();
3242 reply.recycle();
3243 data.recycle();
3244 return result;
3245 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003246 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003247 throws RemoteException {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeStrongBinder(token);
3252 data.writeInt(resultCode);
3253 if (resultData != null) {
3254 data.writeInt(1);
3255 resultData.writeToParcel(data, 0);
3256 } else {
3257 data.writeInt(0);
3258 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003259 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003260 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3261 reply.readException();
3262 boolean res = reply.readInt() != 0;
3263 data.recycle();
3264 reply.recycle();
3265 return res;
3266 }
3267 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3268 {
3269 Parcel data = Parcel.obtain();
3270 Parcel reply = Parcel.obtain();
3271 data.writeInterfaceToken(IActivityManager.descriptor);
3272 data.writeStrongBinder(token);
3273 data.writeString(resultWho);
3274 data.writeInt(requestCode);
3275 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3276 reply.readException();
3277 data.recycle();
3278 reply.recycle();
3279 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003280 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 data.writeStrongBinder(token);
3285 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3286 reply.readException();
3287 boolean res = reply.readInt() != 0;
3288 data.recycle();
3289 reply.recycle();
3290 return res;
3291 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003292 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3293 Parcel data = Parcel.obtain();
3294 Parcel reply = Parcel.obtain();
3295 data.writeInterfaceToken(IActivityManager.descriptor);
3296 data.writeStrongBinder(session.asBinder());
3297 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3298 reply.readException();
3299 data.recycle();
3300 reply.recycle();
3301 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003302 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3303 Parcel data = Parcel.obtain();
3304 Parcel reply = Parcel.obtain();
3305 data.writeInterfaceToken(IActivityManager.descriptor);
3306 data.writeStrongBinder(token);
3307 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3308 reply.readException();
3309 boolean res = reply.readInt() != 0;
3310 data.recycle();
3311 reply.recycle();
3312 return res;
3313 }
3314 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3315 Parcel data = Parcel.obtain();
3316 Parcel reply = Parcel.obtain();
3317 data.writeInterfaceToken(IActivityManager.descriptor);
3318 data.writeStrongBinder(app.asBinder());
3319 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3320 reply.readException();
3321 data.recycle();
3322 reply.recycle();
3323 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003324 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3325 Parcel data = Parcel.obtain();
3326 Parcel reply = Parcel.obtain();
3327 data.writeInterfaceToken(IActivityManager.descriptor);
3328 data.writeStrongBinder(token);
3329 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 boolean res = reply.readInt() != 0;
3332 data.recycle();
3333 reply.recycle();
3334 return res;
3335 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003336 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003337 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003338 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003339 {
3340 Parcel data = Parcel.obtain();
3341 Parcel reply = Parcel.obtain();
3342 data.writeInterfaceToken(IActivityManager.descriptor);
3343 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003344 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003345 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3346 filter.writeToParcel(data, 0);
3347 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003348 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003349 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3350 reply.readException();
3351 Intent intent = null;
3352 int haveIntent = reply.readInt();
3353 if (haveIntent != 0) {
3354 intent = Intent.CREATOR.createFromParcel(reply);
3355 }
3356 reply.recycle();
3357 data.recycle();
3358 return intent;
3359 }
3360 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3361 {
3362 Parcel data = Parcel.obtain();
3363 Parcel reply = Parcel.obtain();
3364 data.writeInterfaceToken(IActivityManager.descriptor);
3365 data.writeStrongBinder(receiver.asBinder());
3366 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3367 reply.readException();
3368 data.recycle();
3369 reply.recycle();
3370 }
3371 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003372 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003373 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003374 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003375 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003376 {
3377 Parcel data = Parcel.obtain();
3378 Parcel reply = Parcel.obtain();
3379 data.writeInterfaceToken(IActivityManager.descriptor);
3380 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3381 intent.writeToParcel(data, 0);
3382 data.writeString(resolvedType);
3383 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3384 data.writeInt(resultCode);
3385 data.writeString(resultData);
3386 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003387 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003388 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003389 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003390 data.writeInt(serialized ? 1 : 0);
3391 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003392 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003393 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3394 reply.readException();
3395 int res = reply.readInt();
3396 reply.recycle();
3397 data.recycle();
3398 return res;
3399 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003400 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3401 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003402 {
3403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3407 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003408 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003409 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 data.recycle();
3412 reply.recycle();
3413 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003414 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3415 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003416 {
3417 Parcel data = Parcel.obtain();
3418 Parcel reply = Parcel.obtain();
3419 data.writeInterfaceToken(IActivityManager.descriptor);
3420 data.writeStrongBinder(who);
3421 data.writeInt(resultCode);
3422 data.writeString(resultData);
3423 data.writeBundle(map);
3424 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003425 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003426 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3427 reply.readException();
3428 data.recycle();
3429 reply.recycle();
3430 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003431 public void attachApplication(IApplicationThread app) throws RemoteException
3432 {
3433 Parcel data = Parcel.obtain();
3434 Parcel reply = Parcel.obtain();
3435 data.writeInterfaceToken(IActivityManager.descriptor);
3436 data.writeStrongBinder(app.asBinder());
3437 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3438 reply.readException();
3439 data.recycle();
3440 reply.recycle();
3441 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003442 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3443 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003444 {
3445 Parcel data = Parcel.obtain();
3446 Parcel reply = Parcel.obtain();
3447 data.writeInterfaceToken(IActivityManager.descriptor);
3448 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003449 if (config != null) {
3450 data.writeInt(1);
3451 config.writeToParcel(data, 0);
3452 } else {
3453 data.writeInt(0);
3454 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003455 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003456 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3457 reply.readException();
3458 data.recycle();
3459 reply.recycle();
3460 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003461 public void activityResumed(IBinder token) throws RemoteException
3462 {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 data.writeStrongBinder(token);
3467 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 data.recycle();
3470 reply.recycle();
3471 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003472 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003473 {
3474 Parcel data = Parcel.obtain();
3475 Parcel reply = Parcel.obtain();
3476 data.writeInterfaceToken(IActivityManager.descriptor);
3477 data.writeStrongBinder(token);
3478 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3479 reply.readException();
3480 data.recycle();
3481 reply.recycle();
3482 }
3483 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003484 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003485 {
3486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 data.writeStrongBinder(token);
3490 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003491 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 TextUtils.writeToParcel(description, data, 0);
3493 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3494 reply.readException();
3495 data.recycle();
3496 reply.recycle();
3497 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003498 public void activitySlept(IBinder token) throws RemoteException
3499 {
3500 Parcel data = Parcel.obtain();
3501 Parcel reply = Parcel.obtain();
3502 data.writeInterfaceToken(IActivityManager.descriptor);
3503 data.writeStrongBinder(token);
3504 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3505 reply.readException();
3506 data.recycle();
3507 reply.recycle();
3508 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003509 public void activityDestroyed(IBinder token) throws RemoteException
3510 {
3511 Parcel data = Parcel.obtain();
3512 Parcel reply = Parcel.obtain();
3513 data.writeInterfaceToken(IActivityManager.descriptor);
3514 data.writeStrongBinder(token);
3515 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3516 reply.readException();
3517 data.recycle();
3518 reply.recycle();
3519 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003520 public void activityRelaunched(IBinder token) throws RemoteException
3521 {
3522 Parcel data = Parcel.obtain();
3523 Parcel reply = Parcel.obtain();
3524 data.writeInterfaceToken(IActivityManager.descriptor);
3525 data.writeStrongBinder(token);
3526 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3527 reply.readException();
3528 data.recycle();
3529 reply.recycle();
3530 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003531 public String getCallingPackage(IBinder token) throws RemoteException
3532 {
3533 Parcel data = Parcel.obtain();
3534 Parcel reply = Parcel.obtain();
3535 data.writeInterfaceToken(IActivityManager.descriptor);
3536 data.writeStrongBinder(token);
3537 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 String res = reply.readString();
3540 data.recycle();
3541 reply.recycle();
3542 return res;
3543 }
3544 public ComponentName getCallingActivity(IBinder token)
3545 throws RemoteException {
3546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 data.writeStrongBinder(token);
3550 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3551 reply.readException();
3552 ComponentName res = ComponentName.readFromParcel(reply);
3553 data.recycle();
3554 reply.recycle();
3555 return res;
3556 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003557 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003558 Parcel data = Parcel.obtain();
3559 Parcel reply = Parcel.obtain();
3560 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003561 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003562 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3563 reply.readException();
3564 ArrayList<IAppTask> list = null;
3565 int N = reply.readInt();
3566 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003567 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003568 while (N > 0) {
3569 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3570 list.add(task);
3571 N--;
3572 }
3573 }
3574 data.recycle();
3575 reply.recycle();
3576 return list;
3577 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003578 public int addAppTask(IBinder activityToken, Intent intent,
3579 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3580 Parcel data = Parcel.obtain();
3581 Parcel reply = Parcel.obtain();
3582 data.writeInterfaceToken(IActivityManager.descriptor);
3583 data.writeStrongBinder(activityToken);
3584 intent.writeToParcel(data, 0);
3585 description.writeToParcel(data, 0);
3586 thumbnail.writeToParcel(data, 0);
3587 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3588 reply.readException();
3589 int res = reply.readInt();
3590 data.recycle();
3591 reply.recycle();
3592 return res;
3593 }
3594 public Point getAppTaskThumbnailSize() throws RemoteException {
3595 Parcel data = Parcel.obtain();
3596 Parcel reply = Parcel.obtain();
3597 data.writeInterfaceToken(IActivityManager.descriptor);
3598 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3599 reply.readException();
3600 Point size = Point.CREATOR.createFromParcel(reply);
3601 data.recycle();
3602 reply.recycle();
3603 return size;
3604 }
Todd Kennedye635f662015-01-20 10:36:49 -08003605 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3606 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003607 Parcel data = Parcel.obtain();
3608 Parcel reply = Parcel.obtain();
3609 data.writeInterfaceToken(IActivityManager.descriptor);
3610 data.writeInt(maxNum);
3611 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003612 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3613 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003614 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003615 int N = reply.readInt();
3616 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003617 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003618 while (N > 0) {
3619 ActivityManager.RunningTaskInfo info =
3620 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003621 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003622 list.add(info);
3623 N--;
3624 }
3625 }
3626 data.recycle();
3627 reply.recycle();
3628 return list;
3629 }
3630 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003631 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeInt(maxNum);
3636 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003637 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003638 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3639 reply.readException();
3640 ArrayList<ActivityManager.RecentTaskInfo> list
3641 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3642 data.recycle();
3643 reply.recycle();
3644 return list;
3645 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003646 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003647 Parcel data = Parcel.obtain();
3648 Parcel reply = Parcel.obtain();
3649 data.writeInterfaceToken(IActivityManager.descriptor);
3650 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003651 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003652 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003653 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003654 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003655 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003656 }
3657 data.recycle();
3658 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003659 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003660 }
Todd Kennedye635f662015-01-20 10:36:49 -08003661 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3662 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003663 Parcel data = Parcel.obtain();
3664 Parcel reply = Parcel.obtain();
3665 data.writeInterfaceToken(IActivityManager.descriptor);
3666 data.writeInt(maxNum);
3667 data.writeInt(flags);
3668 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3669 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003670 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003671 int N = reply.readInt();
3672 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003673 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003674 while (N > 0) {
3675 ActivityManager.RunningServiceInfo info =
3676 ActivityManager.RunningServiceInfo.CREATOR
3677 .createFromParcel(reply);
3678 list.add(info);
3679 N--;
3680 }
3681 }
3682 data.recycle();
3683 reply.recycle();
3684 return list;
3685 }
3686 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3687 throws RemoteException {
3688 Parcel data = Parcel.obtain();
3689 Parcel reply = Parcel.obtain();
3690 data.writeInterfaceToken(IActivityManager.descriptor);
3691 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3692 reply.readException();
3693 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3694 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3695 data.recycle();
3696 reply.recycle();
3697 return list;
3698 }
3699 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3700 throws RemoteException {
3701 Parcel data = Parcel.obtain();
3702 Parcel reply = Parcel.obtain();
3703 data.writeInterfaceToken(IActivityManager.descriptor);
3704 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3705 reply.readException();
3706 ArrayList<ActivityManager.RunningAppProcessInfo> list
3707 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3708 data.recycle();
3709 reply.recycle();
3710 return list;
3711 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003712 public List<ApplicationInfo> getRunningExternalApplications()
3713 throws RemoteException {
3714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3718 reply.readException();
3719 ArrayList<ApplicationInfo> list
3720 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3721 data.recycle();
3722 reply.recycle();
3723 return list;
3724 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003725 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003726 {
3727 Parcel data = Parcel.obtain();
3728 Parcel reply = Parcel.obtain();
3729 data.writeInterfaceToken(IActivityManager.descriptor);
3730 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003731 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003732 if (options != null) {
3733 data.writeInt(1);
3734 options.writeToParcel(data, 0);
3735 } else {
3736 data.writeInt(0);
3737 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003738 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3739 reply.readException();
3740 data.recycle();
3741 reply.recycle();
3742 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003743 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3744 throws RemoteException {
3745 Parcel data = Parcel.obtain();
3746 Parcel reply = Parcel.obtain();
3747 data.writeInterfaceToken(IActivityManager.descriptor);
3748 data.writeStrongBinder(token);
3749 data.writeInt(nonRoot ? 1 : 0);
3750 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 boolean res = reply.readInt() != 0;
3753 data.recycle();
3754 reply.recycle();
3755 return res;
3756 }
3757 public void moveTaskBackwards(int task) throws RemoteException
3758 {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeInt(task);
3763 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3764 reply.readException();
3765 data.recycle();
3766 reply.recycle();
3767 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003768 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003769 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3770 {
3771 Parcel data = Parcel.obtain();
3772 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003773 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003774 data.writeInt(taskId);
3775 data.writeInt(stackId);
3776 data.writeInt(toTop ? 1 : 0);
3777 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3778 reply.readException();
3779 data.recycle();
3780 reply.recycle();
3781 }
3782 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003783 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3784 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003785 {
3786 Parcel data = Parcel.obtain();
3787 Parcel reply = Parcel.obtain();
3788 data.writeInterfaceToken(IActivityManager.descriptor);
3789 data.writeInt(taskId);
3790 data.writeInt(createMode);
3791 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003792 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003793 if (initialBounds != null) {
3794 data.writeInt(1);
3795 initialBounds.writeToParcel(data, 0);
3796 } else {
3797 data.writeInt(0);
3798 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003799 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 data.recycle();
3802 reply.recycle();
3803 }
3804 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003805 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3806 throws RemoteException
3807 {
3808 Parcel data = Parcel.obtain();
3809 Parcel reply = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 data.writeInt(stackId);
3812 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003813 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003814 reply.readException();
3815 final boolean res = reply.readInt() != 0;
3816 data.recycle();
3817 reply.recycle();
3818 return res;
3819 }
3820 @Override
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003821 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode,
3822 boolean preserveWindows, boolean animate) throws RemoteException {
Craig Mautnerc00204b2013-03-05 15:02:14 -08003823 Parcel data = Parcel.obtain();
3824 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003825 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003826 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003827 if (r != null) {
3828 data.writeInt(1);
3829 r.writeToParcel(data, 0);
3830 } else {
3831 data.writeInt(0);
3832 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003833 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003834 data.writeInt(preserveWindows ? 1 : 0);
3835 data.writeInt(animate ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003836 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003837 reply.readException();
3838 data.recycle();
3839 reply.recycle();
3840 }
Craig Mautner967212c2013-04-13 21:10:58 -07003841 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003842 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3843 Rect tempDockedTaskInsetBounds,
3844 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3845 throws RemoteException
3846 {
3847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 if (dockedBounds != null) {
3851 data.writeInt(1);
3852 dockedBounds.writeToParcel(data, 0);
3853 } else {
3854 data.writeInt(0);
3855 }
3856 if (tempDockedTaskBounds != null) {
3857 data.writeInt(1);
3858 tempDockedTaskBounds.writeToParcel(data, 0);
3859 } else {
3860 data.writeInt(0);
3861 }
3862 if (tempDockedTaskInsetBounds != null) {
3863 data.writeInt(1);
3864 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3865 } else {
3866 data.writeInt(0);
3867 }
3868 if (tempOtherTaskBounds != null) {
3869 data.writeInt(1);
3870 tempOtherTaskBounds.writeToParcel(data, 0);
3871 } else {
3872 data.writeInt(0);
3873 }
3874 if (tempOtherTaskInsetBounds != null) {
3875 data.writeInt(1);
3876 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3877 } else {
3878 data.writeInt(0);
3879 }
3880 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3881 reply.readException();
3882 data.recycle();
3883 reply.recycle();
3884 }
3885 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003886 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3887 {
3888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 data.writeInt(taskId);
3892 data.writeInt(stackId);
3893 data.writeInt(position);
3894 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3895 reply.readException();
3896 data.recycle();
3897 reply.recycle();
3898 }
3899 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003900 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003901 {
3902 Parcel data = Parcel.obtain();
3903 Parcel reply = Parcel.obtain();
3904 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003905 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003906 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003907 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003908 data.recycle();
3909 reply.recycle();
3910 return list;
3911 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003912 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003913 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003914 {
3915 Parcel data = Parcel.obtain();
3916 Parcel reply = Parcel.obtain();
3917 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003918 data.writeInt(stackId);
3919 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003920 reply.readException();
3921 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003922 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003923 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003924 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003925 }
3926 data.recycle();
3927 reply.recycle();
3928 return info;
3929 }
3930 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003931 public boolean isInHomeStack(int taskId) throws RemoteException {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 data.writeInt(taskId);
3936 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3937 reply.readException();
3938 boolean isInHomeStack = reply.readInt() > 0;
3939 data.recycle();
3940 reply.recycle();
3941 return isInHomeStack;
3942 }
3943 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003944 public void setFocusedStack(int stackId) throws RemoteException
3945 {
3946 Parcel data = Parcel.obtain();
3947 Parcel reply = Parcel.obtain();
3948 data.writeInterfaceToken(IActivityManager.descriptor);
3949 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003950 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003951 reply.readException();
3952 data.recycle();
3953 reply.recycle();
3954 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003955 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003956 public int getFocusedStackId() throws RemoteException {
3957 Parcel data = Parcel.obtain();
3958 Parcel reply = Parcel.obtain();
3959 data.writeInterfaceToken(IActivityManager.descriptor);
3960 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3961 reply.readException();
3962 int focusedStackId = reply.readInt();
3963 data.recycle();
3964 reply.recycle();
3965 return focusedStackId;
3966 }
3967 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003968 public void setFocusedTask(int taskId) throws RemoteException
3969 {
3970 Parcel data = Parcel.obtain();
3971 Parcel reply = Parcel.obtain();
3972 data.writeInterfaceToken(IActivityManager.descriptor);
3973 data.writeInt(taskId);
3974 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3975 reply.readException();
3976 data.recycle();
3977 reply.recycle();
3978 }
3979 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003980 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3981 {
3982 Parcel data = Parcel.obtain();
3983 Parcel reply = Parcel.obtain();
3984 data.writeInterfaceToken(IActivityManager.descriptor);
3985 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003986 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003987 reply.readException();
3988 data.recycle();
3989 reply.recycle();
3990 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003991 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3992 {
3993 Parcel data = Parcel.obtain();
3994 Parcel reply = Parcel.obtain();
3995 data.writeInterfaceToken(IActivityManager.descriptor);
3996 data.writeStrongBinder(token);
3997 data.writeInt(onlyRoot ? 1 : 0);
3998 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3999 reply.readException();
4000 int res = reply.readInt();
4001 data.recycle();
4002 reply.recycle();
4003 return res;
4004 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004005 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07004006 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004007 Parcel data = Parcel.obtain();
4008 Parcel reply = Parcel.obtain();
4009 data.writeInterfaceToken(IActivityManager.descriptor);
4010 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4011 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004012 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004013 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004014 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4015 reply.readException();
4016 int res = reply.readInt();
4017 ContentProviderHolder cph = null;
4018 if (res != 0) {
4019 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4020 }
4021 data.recycle();
4022 reply.recycle();
4023 return cph;
4024 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07004025 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
4026 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004027 Parcel data = Parcel.obtain();
4028 Parcel reply = Parcel.obtain();
4029 data.writeInterfaceToken(IActivityManager.descriptor);
4030 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004031 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004032 data.writeStrongBinder(token);
4033 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4034 reply.readException();
4035 int res = reply.readInt();
4036 ContentProviderHolder cph = null;
4037 if (res != 0) {
4038 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4039 }
4040 data.recycle();
4041 reply.recycle();
4042 return cph;
4043 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004044 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004045 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004046 {
4047 Parcel data = Parcel.obtain();
4048 Parcel reply = Parcel.obtain();
4049 data.writeInterfaceToken(IActivityManager.descriptor);
4050 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4051 data.writeTypedList(providers);
4052 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
4053 reply.readException();
4054 data.recycle();
4055 reply.recycle();
4056 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004057 public boolean refContentProvider(IBinder connection, int stable, int unstable)
4058 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004062 data.writeStrongBinder(connection);
4063 data.writeInt(stable);
4064 data.writeInt(unstable);
4065 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 boolean res = reply.readInt() != 0;
4068 data.recycle();
4069 reply.recycle();
4070 return res;
4071 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004072
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004073 public void unstableProviderDied(IBinder connection) throws RemoteException {
4074 Parcel data = Parcel.obtain();
4075 Parcel reply = Parcel.obtain();
4076 data.writeInterfaceToken(IActivityManager.descriptor);
4077 data.writeStrongBinder(connection);
4078 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
4079 reply.readException();
4080 data.recycle();
4081 reply.recycle();
4082 }
4083
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004084 @Override
4085 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
4086 Parcel data = Parcel.obtain();
4087 Parcel reply = Parcel.obtain();
4088 data.writeInterfaceToken(IActivityManager.descriptor);
4089 data.writeStrongBinder(connection);
4090 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
4091 reply.readException();
4092 data.recycle();
4093 reply.recycle();
4094 }
4095
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004096 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4097 Parcel data = Parcel.obtain();
4098 Parcel reply = Parcel.obtain();
4099 data.writeInterfaceToken(IActivityManager.descriptor);
4100 data.writeStrongBinder(connection);
4101 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004102 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4103 reply.readException();
4104 data.recycle();
4105 reply.recycle();
4106 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004107
4108 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4109 Parcel data = Parcel.obtain();
4110 Parcel reply = Parcel.obtain();
4111 data.writeInterfaceToken(IActivityManager.descriptor);
4112 data.writeString(name);
4113 data.writeStrongBinder(token);
4114 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4115 reply.readException();
4116 data.recycle();
4117 reply.recycle();
4118 }
4119
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004120 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4121 throws RemoteException
4122 {
4123 Parcel data = Parcel.obtain();
4124 Parcel reply = Parcel.obtain();
4125 data.writeInterfaceToken(IActivityManager.descriptor);
4126 service.writeToParcel(data, 0);
4127 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4128 reply.readException();
4129 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4130 data.recycle();
4131 reply.recycle();
4132 return res;
4133 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004135 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004136 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004137 {
4138 Parcel data = Parcel.obtain();
4139 Parcel reply = Parcel.obtain();
4140 data.writeInterfaceToken(IActivityManager.descriptor);
4141 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4142 service.writeToParcel(data, 0);
4143 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004144 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004145 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004146 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 ComponentName res = ComponentName.readFromParcel(reply);
4149 data.recycle();
4150 reply.recycle();
4151 return res;
4152 }
4153 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004154 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004155 {
4156 Parcel data = Parcel.obtain();
4157 Parcel reply = Parcel.obtain();
4158 data.writeInterfaceToken(IActivityManager.descriptor);
4159 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4160 service.writeToParcel(data, 0);
4161 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004162 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004163 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4164 reply.readException();
4165 int res = reply.readInt();
4166 reply.recycle();
4167 data.recycle();
4168 return res;
4169 }
4170 public boolean stopServiceToken(ComponentName className, IBinder token,
4171 int startId) throws RemoteException {
4172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 ComponentName.writeToParcel(className, data);
4176 data.writeStrongBinder(token);
4177 data.writeInt(startId);
4178 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4179 reply.readException();
4180 boolean res = reply.readInt() != 0;
4181 data.recycle();
4182 reply.recycle();
4183 return res;
4184 }
4185 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004186 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004187 Parcel data = Parcel.obtain();
4188 Parcel reply = Parcel.obtain();
4189 data.writeInterfaceToken(IActivityManager.descriptor);
4190 ComponentName.writeToParcel(className, data);
4191 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004192 data.writeInt(id);
4193 if (notification != null) {
4194 data.writeInt(1);
4195 notification.writeToParcel(data, 0);
4196 } else {
4197 data.writeInt(0);
4198 }
4199 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004200 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4201 reply.readException();
4202 data.recycle();
4203 reply.recycle();
4204 }
4205 public int bindService(IApplicationThread caller, IBinder token,
4206 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004207 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004208 Parcel data = Parcel.obtain();
4209 Parcel reply = Parcel.obtain();
4210 data.writeInterfaceToken(IActivityManager.descriptor);
4211 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4212 data.writeStrongBinder(token);
4213 service.writeToParcel(data, 0);
4214 data.writeString(resolvedType);
4215 data.writeStrongBinder(connection.asBinder());
4216 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004217 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004218 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004219 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4220 reply.readException();
4221 int res = reply.readInt();
4222 data.recycle();
4223 reply.recycle();
4224 return res;
4225 }
4226 public boolean unbindService(IServiceConnection connection) throws RemoteException
4227 {
4228 Parcel data = Parcel.obtain();
4229 Parcel reply = Parcel.obtain();
4230 data.writeInterfaceToken(IActivityManager.descriptor);
4231 data.writeStrongBinder(connection.asBinder());
4232 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4233 reply.readException();
4234 boolean res = reply.readInt() != 0;
4235 data.recycle();
4236 reply.recycle();
4237 return res;
4238 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004239
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004240 public void publishService(IBinder token,
4241 Intent intent, IBinder service) throws RemoteException {
4242 Parcel data = Parcel.obtain();
4243 Parcel reply = Parcel.obtain();
4244 data.writeInterfaceToken(IActivityManager.descriptor);
4245 data.writeStrongBinder(token);
4246 intent.writeToParcel(data, 0);
4247 data.writeStrongBinder(service);
4248 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4249 reply.readException();
4250 data.recycle();
4251 reply.recycle();
4252 }
4253
4254 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4255 throws RemoteException {
4256 Parcel data = Parcel.obtain();
4257 Parcel reply = Parcel.obtain();
4258 data.writeInterfaceToken(IActivityManager.descriptor);
4259 data.writeStrongBinder(token);
4260 intent.writeToParcel(data, 0);
4261 data.writeInt(doRebind ? 1 : 0);
4262 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4263 reply.readException();
4264 data.recycle();
4265 reply.recycle();
4266 }
4267
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004268 public void serviceDoneExecuting(IBinder token, int type, int startId,
4269 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004270 Parcel data = Parcel.obtain();
4271 Parcel reply = Parcel.obtain();
4272 data.writeInterfaceToken(IActivityManager.descriptor);
4273 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004274 data.writeInt(type);
4275 data.writeInt(startId);
4276 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004277 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4278 reply.readException();
4279 data.recycle();
4280 reply.recycle();
4281 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004282
Svet Ganov99b60432015-06-27 13:15:22 -07004283 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4284 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 service.writeToParcel(data, 0);
4289 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004290 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004291 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4292 reply.readException();
4293 IBinder binder = reply.readStrongBinder();
4294 reply.recycle();
4295 data.recycle();
4296 return binder;
4297 }
4298
Christopher Tate181fafa2009-05-14 11:12:14 -07004299 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4300 throws RemoteException {
4301 Parcel data = Parcel.obtain();
4302 Parcel reply = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 app.writeToParcel(data, 0);
4305 data.writeInt(backupRestoreMode);
4306 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4307 reply.readException();
4308 boolean success = reply.readInt() != 0;
4309 reply.recycle();
4310 data.recycle();
4311 return success;
4312 }
4313
Christopher Tate346acb12012-10-15 19:20:25 -07004314 public void clearPendingBackup() throws RemoteException {
4315 Parcel data = Parcel.obtain();
4316 Parcel reply = Parcel.obtain();
4317 data.writeInterfaceToken(IActivityManager.descriptor);
4318 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4319 reply.recycle();
4320 data.recycle();
4321 }
4322
Christopher Tate181fafa2009-05-14 11:12:14 -07004323 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4324 Parcel data = Parcel.obtain();
4325 Parcel reply = Parcel.obtain();
4326 data.writeInterfaceToken(IActivityManager.descriptor);
4327 data.writeString(packageName);
4328 data.writeStrongBinder(agent);
4329 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4330 reply.recycle();
4331 data.recycle();
4332 }
4333
4334 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4335 Parcel data = Parcel.obtain();
4336 Parcel reply = Parcel.obtain();
4337 data.writeInterfaceToken(IActivityManager.descriptor);
4338 app.writeToParcel(data, 0);
4339 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4340 reply.readException();
4341 reply.recycle();
4342 data.recycle();
4343 }
4344
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004345 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004346 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004347 IUiAutomationConnection connection, int userId, String instructionSet)
4348 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004349 Parcel data = Parcel.obtain();
4350 Parcel reply = Parcel.obtain();
4351 data.writeInterfaceToken(IActivityManager.descriptor);
4352 ComponentName.writeToParcel(className, data);
4353 data.writeString(profileFile);
4354 data.writeInt(flags);
4355 data.writeBundle(arguments);
4356 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004357 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004358 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004359 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004360 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4361 reply.readException();
4362 boolean res = reply.readInt() != 0;
4363 reply.recycle();
4364 data.recycle();
4365 return res;
4366 }
4367
4368 public void finishInstrumentation(IApplicationThread target,
4369 int resultCode, Bundle results) throws RemoteException {
4370 Parcel data = Parcel.obtain();
4371 Parcel reply = Parcel.obtain();
4372 data.writeInterfaceToken(IActivityManager.descriptor);
4373 data.writeStrongBinder(target != null ? target.asBinder() : null);
4374 data.writeInt(resultCode);
4375 data.writeBundle(results);
4376 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 data.recycle();
4379 reply.recycle();
4380 }
4381 public Configuration getConfiguration() throws RemoteException
4382 {
4383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4387 reply.readException();
4388 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4389 reply.recycle();
4390 data.recycle();
4391 return res;
4392 }
4393 public void updateConfiguration(Configuration values) throws RemoteException
4394 {
4395 Parcel data = Parcel.obtain();
4396 Parcel reply = Parcel.obtain();
4397 data.writeInterfaceToken(IActivityManager.descriptor);
4398 values.writeToParcel(data, 0);
4399 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4400 reply.readException();
4401 data.recycle();
4402 reply.recycle();
4403 }
4404 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4405 throws RemoteException {
4406 Parcel data = Parcel.obtain();
4407 Parcel reply = Parcel.obtain();
4408 data.writeInterfaceToken(IActivityManager.descriptor);
4409 data.writeStrongBinder(token);
4410 data.writeInt(requestedOrientation);
4411 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4412 reply.readException();
4413 data.recycle();
4414 reply.recycle();
4415 }
4416 public int getRequestedOrientation(IBinder token) throws RemoteException {
4417 Parcel data = Parcel.obtain();
4418 Parcel reply = Parcel.obtain();
4419 data.writeInterfaceToken(IActivityManager.descriptor);
4420 data.writeStrongBinder(token);
4421 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4422 reply.readException();
4423 int res = reply.readInt();
4424 data.recycle();
4425 reply.recycle();
4426 return res;
4427 }
4428 public ComponentName getActivityClassForToken(IBinder token)
4429 throws RemoteException {
4430 Parcel data = Parcel.obtain();
4431 Parcel reply = Parcel.obtain();
4432 data.writeInterfaceToken(IActivityManager.descriptor);
4433 data.writeStrongBinder(token);
4434 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4435 reply.readException();
4436 ComponentName res = ComponentName.readFromParcel(reply);
4437 data.recycle();
4438 reply.recycle();
4439 return res;
4440 }
4441 public String getPackageForToken(IBinder token) throws RemoteException
4442 {
4443 Parcel data = Parcel.obtain();
4444 Parcel reply = Parcel.obtain();
4445 data.writeInterfaceToken(IActivityManager.descriptor);
4446 data.writeStrongBinder(token);
4447 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4448 reply.readException();
4449 String res = reply.readString();
4450 data.recycle();
4451 reply.recycle();
4452 return res;
4453 }
4454 public IIntentSender getIntentSender(int type,
4455 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004456 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004457 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004458 Parcel data = Parcel.obtain();
4459 Parcel reply = Parcel.obtain();
4460 data.writeInterfaceToken(IActivityManager.descriptor);
4461 data.writeInt(type);
4462 data.writeString(packageName);
4463 data.writeStrongBinder(token);
4464 data.writeString(resultWho);
4465 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004466 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004467 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004468 data.writeTypedArray(intents, 0);
4469 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004470 } else {
4471 data.writeInt(0);
4472 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004473 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004474 if (options != null) {
4475 data.writeInt(1);
4476 options.writeToParcel(data, 0);
4477 } else {
4478 data.writeInt(0);
4479 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004480 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004481 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4482 reply.readException();
4483 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004484 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004485 data.recycle();
4486 reply.recycle();
4487 return res;
4488 }
4489 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeStrongBinder(sender.asBinder());
4494 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4495 reply.readException();
4496 data.recycle();
4497 reply.recycle();
4498 }
4499 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4500 Parcel data = Parcel.obtain();
4501 Parcel reply = Parcel.obtain();
4502 data.writeInterfaceToken(IActivityManager.descriptor);
4503 data.writeStrongBinder(sender.asBinder());
4504 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4505 reply.readException();
4506 String res = reply.readString();
4507 data.recycle();
4508 reply.recycle();
4509 return res;
4510 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004511 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4512 Parcel data = Parcel.obtain();
4513 Parcel reply = Parcel.obtain();
4514 data.writeInterfaceToken(IActivityManager.descriptor);
4515 data.writeStrongBinder(sender.asBinder());
4516 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4517 reply.readException();
4518 int res = reply.readInt();
4519 data.recycle();
4520 reply.recycle();
4521 return res;
4522 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004523 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4524 boolean requireFull, String name, String callerPackage) throws RemoteException {
4525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 data.writeInt(callingPid);
4529 data.writeInt(callingUid);
4530 data.writeInt(userId);
4531 data.writeInt(allowAll ? 1 : 0);
4532 data.writeInt(requireFull ? 1 : 0);
4533 data.writeString(name);
4534 data.writeString(callerPackage);
4535 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4536 reply.readException();
4537 int res = reply.readInt();
4538 data.recycle();
4539 reply.recycle();
4540 return res;
4541 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004542 public void setProcessLimit(int max) throws RemoteException
4543 {
4544 Parcel data = Parcel.obtain();
4545 Parcel reply = Parcel.obtain();
4546 data.writeInterfaceToken(IActivityManager.descriptor);
4547 data.writeInt(max);
4548 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4549 reply.readException();
4550 data.recycle();
4551 reply.recycle();
4552 }
4553 public int getProcessLimit() throws RemoteException
4554 {
4555 Parcel data = Parcel.obtain();
4556 Parcel reply = Parcel.obtain();
4557 data.writeInterfaceToken(IActivityManager.descriptor);
4558 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4559 reply.readException();
4560 int res = reply.readInt();
4561 data.recycle();
4562 reply.recycle();
4563 return res;
4564 }
4565 public void setProcessForeground(IBinder token, int pid,
4566 boolean isForeground) throws RemoteException {
4567 Parcel data = Parcel.obtain();
4568 Parcel reply = Parcel.obtain();
4569 data.writeInterfaceToken(IActivityManager.descriptor);
4570 data.writeStrongBinder(token);
4571 data.writeInt(pid);
4572 data.writeInt(isForeground ? 1 : 0);
4573 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4574 reply.readException();
4575 data.recycle();
4576 reply.recycle();
4577 }
4578 public int checkPermission(String permission, int pid, int uid)
4579 throws RemoteException {
4580 Parcel data = Parcel.obtain();
4581 Parcel reply = Parcel.obtain();
4582 data.writeInterfaceToken(IActivityManager.descriptor);
4583 data.writeString(permission);
4584 data.writeInt(pid);
4585 data.writeInt(uid);
4586 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4587 reply.readException();
4588 int res = reply.readInt();
4589 data.recycle();
4590 reply.recycle();
4591 return res;
4592 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004593 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4594 throws RemoteException {
4595 Parcel data = Parcel.obtain();
4596 Parcel reply = Parcel.obtain();
4597 data.writeInterfaceToken(IActivityManager.descriptor);
4598 data.writeString(permission);
4599 data.writeInt(pid);
4600 data.writeInt(uid);
4601 data.writeStrongBinder(callerToken);
4602 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4603 reply.readException();
4604 int res = reply.readInt();
4605 data.recycle();
4606 reply.recycle();
4607 return res;
4608 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004609 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004610 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004611 Parcel data = Parcel.obtain();
4612 Parcel reply = Parcel.obtain();
4613 data.writeInterfaceToken(IActivityManager.descriptor);
4614 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004615 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004616 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004617 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4618 reply.readException();
4619 boolean res = reply.readInt() != 0;
4620 data.recycle();
4621 reply.recycle();
4622 return res;
4623 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004624 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4625 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004626 Parcel data = Parcel.obtain();
4627 Parcel reply = Parcel.obtain();
4628 data.writeInterfaceToken(IActivityManager.descriptor);
4629 uri.writeToParcel(data, 0);
4630 data.writeInt(pid);
4631 data.writeInt(uid);
4632 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004633 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004634 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004635 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4636 reply.readException();
4637 int res = reply.readInt();
4638 data.recycle();
4639 reply.recycle();
4640 return res;
4641 }
4642 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004643 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004644 Parcel data = Parcel.obtain();
4645 Parcel reply = Parcel.obtain();
4646 data.writeInterfaceToken(IActivityManager.descriptor);
4647 data.writeStrongBinder(caller.asBinder());
4648 data.writeString(targetPkg);
4649 uri.writeToParcel(data, 0);
4650 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004651 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004652 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4653 reply.readException();
4654 data.recycle();
4655 reply.recycle();
4656 }
4657 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004658 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004659 Parcel data = Parcel.obtain();
4660 Parcel reply = Parcel.obtain();
4661 data.writeInterfaceToken(IActivityManager.descriptor);
4662 data.writeStrongBinder(caller.asBinder());
4663 uri.writeToParcel(data, 0);
4664 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004665 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004666 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4667 reply.readException();
4668 data.recycle();
4669 reply.recycle();
4670 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004671
4672 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004673 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4674 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004675 Parcel data = Parcel.obtain();
4676 Parcel reply = Parcel.obtain();
4677 data.writeInterfaceToken(IActivityManager.descriptor);
4678 uri.writeToParcel(data, 0);
4679 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004680 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004681 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4682 reply.readException();
4683 data.recycle();
4684 reply.recycle();
4685 }
4686
4687 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004688 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4689 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004690 Parcel data = Parcel.obtain();
4691 Parcel reply = Parcel.obtain();
4692 data.writeInterfaceToken(IActivityManager.descriptor);
4693 uri.writeToParcel(data, 0);
4694 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004695 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004696 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4697 reply.readException();
4698 data.recycle();
4699 reply.recycle();
4700 }
4701
4702 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004703 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4704 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004705 Parcel data = Parcel.obtain();
4706 Parcel reply = Parcel.obtain();
4707 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004708 data.writeString(packageName);
4709 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004710 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4711 reply.readException();
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004712 @SuppressWarnings("unchecked")
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004713 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4714 reply);
4715 data.recycle();
4716 reply.recycle();
4717 return perms;
4718 }
4719
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004720 @Override
4721 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId)
4722 throws RemoteException {
4723 Parcel data = Parcel.obtain();
4724 Parcel reply = Parcel.obtain();
4725 data.writeInterfaceToken(IActivityManager.descriptor);
4726 data.writeString(packageName);
4727 data.writeInt(userId);
4728 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4729 reply.readException();
4730 @SuppressWarnings("unchecked")
4731 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4732 reply);
4733 data.recycle();
4734 reply.recycle();
4735 return perms;
4736 }
4737
4738 @Override
4739 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException {
4740 Parcel data = Parcel.obtain();
4741 Parcel reply = Parcel.obtain();
4742 data.writeInterfaceToken(IActivityManager.descriptor);
4743 data.writeString(packageName);
4744 data.writeInt(userId);
4745 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4746 reply.readException();
4747 data.recycle();
4748 reply.recycle();
4749 }
4750
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004751 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4752 throws RemoteException {
4753 Parcel data = Parcel.obtain();
4754 Parcel reply = Parcel.obtain();
4755 data.writeInterfaceToken(IActivityManager.descriptor);
4756 data.writeStrongBinder(who.asBinder());
4757 data.writeInt(waiting ? 1 : 0);
4758 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4759 reply.readException();
4760 data.recycle();
4761 reply.recycle();
4762 }
4763 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4764 Parcel data = Parcel.obtain();
4765 Parcel reply = Parcel.obtain();
4766 data.writeInterfaceToken(IActivityManager.descriptor);
4767 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4768 reply.readException();
4769 outInfo.readFromParcel(reply);
4770 data.recycle();
4771 reply.recycle();
4772 }
4773 public void unhandledBack() throws RemoteException
4774 {
4775 Parcel data = Parcel.obtain();
4776 Parcel reply = Parcel.obtain();
4777 data.writeInterfaceToken(IActivityManager.descriptor);
4778 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4779 reply.readException();
4780 data.recycle();
4781 reply.recycle();
4782 }
4783 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4784 {
4785 Parcel data = Parcel.obtain();
4786 Parcel reply = Parcel.obtain();
4787 data.writeInterfaceToken(IActivityManager.descriptor);
4788 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4789 reply.readException();
4790 ParcelFileDescriptor pfd = null;
4791 if (reply.readInt() != 0) {
4792 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4793 }
4794 data.recycle();
4795 reply.recycle();
4796 return pfd;
4797 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004798 public void setLockScreenShown(boolean shown) throws RemoteException
4799 {
4800 Parcel data = Parcel.obtain();
4801 Parcel reply = Parcel.obtain();
4802 data.writeInterfaceToken(IActivityManager.descriptor);
4803 data.writeInt(shown ? 1 : 0);
4804 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4805 reply.readException();
4806 data.recycle();
4807 reply.recycle();
4808 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004809 public void setDebugApp(
4810 String packageName, boolean waitForDebugger, boolean persistent)
4811 throws RemoteException
4812 {
4813 Parcel data = Parcel.obtain();
4814 Parcel reply = Parcel.obtain();
4815 data.writeInterfaceToken(IActivityManager.descriptor);
4816 data.writeString(packageName);
4817 data.writeInt(waitForDebugger ? 1 : 0);
4818 data.writeInt(persistent ? 1 : 0);
4819 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4820 reply.readException();
4821 data.recycle();
4822 reply.recycle();
4823 }
4824 public void setAlwaysFinish(boolean enabled) throws RemoteException
4825 {
4826 Parcel data = Parcel.obtain();
4827 Parcel reply = Parcel.obtain();
4828 data.writeInterfaceToken(IActivityManager.descriptor);
4829 data.writeInt(enabled ? 1 : 0);
4830 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4831 reply.readException();
4832 data.recycle();
4833 reply.recycle();
4834 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004835 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004836 {
4837 Parcel data = Parcel.obtain();
4838 Parcel reply = Parcel.obtain();
4839 data.writeInterfaceToken(IActivityManager.descriptor);
4840 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004841 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004842 reply.readException();
4843 data.recycle();
4844 reply.recycle();
4845 }
4846 public void enterSafeMode() throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 data.writeInterfaceToken(IActivityManager.descriptor);
4849 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4850 data.recycle();
4851 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004852 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004853 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004854 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004855 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004856 data.writeStrongBinder(sender.asBinder());
4857 data.writeInt(sourceUid);
4858 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004859 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004860 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4861 data.recycle();
4862 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004863 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4864 throws RemoteException {
4865 Parcel data = Parcel.obtain();
4866 data.writeInterfaceToken(IActivityManager.descriptor);
4867 data.writeStrongBinder(sender.asBinder());
4868 data.writeInt(sourceUid);
4869 data.writeString(tag);
4870 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4871 data.recycle();
4872 }
4873 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4874 throws RemoteException {
4875 Parcel data = Parcel.obtain();
4876 data.writeInterfaceToken(IActivityManager.descriptor);
4877 data.writeStrongBinder(sender.asBinder());
4878 data.writeInt(sourceUid);
4879 data.writeString(tag);
4880 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4881 data.recycle();
4882 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004883 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004884 Parcel data = Parcel.obtain();
4885 Parcel reply = Parcel.obtain();
4886 data.writeInterfaceToken(IActivityManager.descriptor);
4887 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004888 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004889 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004890 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004891 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004892 boolean res = reply.readInt() != 0;
4893 data.recycle();
4894 reply.recycle();
4895 return res;
4896 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004897 @Override
4898 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4899 Parcel data = Parcel.obtain();
4900 Parcel reply = Parcel.obtain();
4901 data.writeInterfaceToken(IActivityManager.descriptor);
4902 data.writeString(reason);
4903 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4904 boolean res = reply.readInt() != 0;
4905 data.recycle();
4906 reply.recycle();
4907 return res;
4908 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004909 public boolean testIsSystemReady()
4910 {
4911 /* this base class version is never called */
4912 return true;
4913 }
Dan Egnor60d87622009-12-16 16:32:58 -08004914 public void handleApplicationCrash(IBinder app,
4915 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4916 {
4917 Parcel data = Parcel.obtain();
4918 Parcel reply = Parcel.obtain();
4919 data.writeInterfaceToken(IActivityManager.descriptor);
4920 data.writeStrongBinder(app);
4921 crashInfo.writeToParcel(data, 0);
4922 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4923 reply.readException();
4924 reply.recycle();
4925 data.recycle();
4926 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004927
Dianne Hackborn52322712014-08-26 22:47:26 -07004928 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004929 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004930 {
4931 Parcel data = Parcel.obtain();
4932 Parcel reply = Parcel.obtain();
4933 data.writeInterfaceToken(IActivityManager.descriptor);
4934 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004935 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004936 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004937 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004938 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004939 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004940 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004941 reply.recycle();
4942 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004943 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004944 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004945
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004946 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004947 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004948 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004949 {
4950 Parcel data = Parcel.obtain();
4951 Parcel reply = Parcel.obtain();
4952 data.writeInterfaceToken(IActivityManager.descriptor);
4953 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004954 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004955 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004956 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4957 reply.readException();
4958 reply.recycle();
4959 data.recycle();
4960 }
4961
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004962 public void signalPersistentProcesses(int sig) throws RemoteException {
4963 Parcel data = Parcel.obtain();
4964 Parcel reply = Parcel.obtain();
4965 data.writeInterfaceToken(IActivityManager.descriptor);
4966 data.writeInt(sig);
4967 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4968 reply.readException();
4969 data.recycle();
4970 reply.recycle();
4971 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004972
Dianne Hackborn1676c852012-09-10 14:52:30 -07004973 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004974 Parcel data = Parcel.obtain();
4975 Parcel reply = Parcel.obtain();
4976 data.writeInterfaceToken(IActivityManager.descriptor);
4977 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004978 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004979 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4980 reply.readException();
4981 data.recycle();
4982 reply.recycle();
4983 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004984
4985 public void killAllBackgroundProcesses() throws RemoteException {
4986 Parcel data = Parcel.obtain();
4987 Parcel reply = Parcel.obtain();
4988 data.writeInterfaceToken(IActivityManager.descriptor);
4989 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4990 reply.readException();
4991 data.recycle();
4992 reply.recycle();
4993 }
4994
Gustav Sennton6258dcd2015-10-30 19:25:37 +00004995 public void killPackageDependents(String packageName, int userId) throws RemoteException {
4996 Parcel data = Parcel.obtain();
4997 Parcel reply = Parcel.obtain();
4998 data.writeInterfaceToken(IActivityManager.descriptor);
4999 data.writeString(packageName);
5000 data.writeInt(userId);
5001 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
5002 reply.readException();
5003 data.recycle();
5004 reply.recycle();
5005 }
5006
Dianne Hackborn1676c852012-09-10 14:52:30 -07005007 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08005008 Parcel data = Parcel.obtain();
5009 Parcel reply = Parcel.obtain();
5010 data.writeInterfaceToken(IActivityManager.descriptor);
5011 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005012 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005013 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005014 reply.readException();
5015 data.recycle();
5016 reply.recycle();
5017 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005018
Dianne Hackborn27ff9132012-03-06 14:57:58 -08005019 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
5020 throws RemoteException
5021 {
5022 Parcel data = Parcel.obtain();
5023 Parcel reply = Parcel.obtain();
5024 data.writeInterfaceToken(IActivityManager.descriptor);
5025 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
5026 reply.readException();
5027 outInfo.readFromParcel(reply);
5028 reply.recycle();
5029 data.recycle();
5030 }
5031
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005032 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
5033 {
5034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
5037 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
5038 reply.readException();
5039 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
5040 reply.recycle();
5041 data.recycle();
5042 return res;
5043 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005044
Dianne Hackborn1676c852012-09-10 14:52:30 -07005045 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07005046 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005047 {
5048 Parcel data = Parcel.obtain();
5049 Parcel reply = Parcel.obtain();
5050 data.writeInterfaceToken(IActivityManager.descriptor);
5051 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005052 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005053 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07005054 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07005055 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005056 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07005057 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005058 } else {
5059 data.writeInt(0);
5060 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005061 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
5062 reply.readException();
5063 boolean res = reply.readInt() != 0;
5064 reply.recycle();
5065 data.recycle();
5066 return res;
5067 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005068
Dianne Hackborn55280a92009-05-07 15:53:46 -07005069 public boolean shutdown(int timeout) throws RemoteException
5070 {
5071 Parcel data = Parcel.obtain();
5072 Parcel reply = Parcel.obtain();
5073 data.writeInterfaceToken(IActivityManager.descriptor);
5074 data.writeInt(timeout);
5075 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
5076 reply.readException();
5077 boolean res = reply.readInt() != 0;
5078 reply.recycle();
5079 data.recycle();
5080 return res;
5081 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005082
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005083 public void stopAppSwitches() throws RemoteException {
5084 Parcel data = Parcel.obtain();
5085 Parcel reply = Parcel.obtain();
5086 data.writeInterfaceToken(IActivityManager.descriptor);
5087 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
5088 reply.readException();
5089 reply.recycle();
5090 data.recycle();
5091 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005092
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005093 public void resumeAppSwitches() throws RemoteException {
5094 Parcel data = Parcel.obtain();
5095 Parcel reply = Parcel.obtain();
5096 data.writeInterfaceToken(IActivityManager.descriptor);
5097 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
5098 reply.readException();
5099 reply.recycle();
5100 data.recycle();
5101 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07005102
5103 public void addPackageDependency(String packageName) throws RemoteException {
5104 Parcel data = Parcel.obtain();
5105 Parcel reply = Parcel.obtain();
5106 data.writeInterfaceToken(IActivityManager.descriptor);
5107 data.writeString(packageName);
5108 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
5109 reply.readException();
5110 data.recycle();
5111 reply.recycle();
5112 }
5113
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005114 public void killApplicationWithAppId(String pkg, int appid, String reason)
5115 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005116 Parcel data = Parcel.obtain();
5117 Parcel reply = Parcel.obtain();
5118 data.writeInterfaceToken(IActivityManager.descriptor);
5119 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005120 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005121 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005122 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005123 reply.readException();
5124 data.recycle();
5125 reply.recycle();
5126 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005127
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07005128 public void closeSystemDialogs(String reason) throws RemoteException {
5129 Parcel data = Parcel.obtain();
5130 Parcel reply = Parcel.obtain();
5131 data.writeInterfaceToken(IActivityManager.descriptor);
5132 data.writeString(reason);
5133 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5134 reply.readException();
5135 data.recycle();
5136 reply.recycle();
5137 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005138
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005139 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005140 throws RemoteException {
5141 Parcel data = Parcel.obtain();
5142 Parcel reply = Parcel.obtain();
5143 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005144 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005145 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5146 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005147 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005148 data.recycle();
5149 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005150 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005151 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005152
5153 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5154 Parcel data = Parcel.obtain();
5155 Parcel reply = Parcel.obtain();
5156 data.writeInterfaceToken(IActivityManager.descriptor);
5157 data.writeString(processName);
5158 data.writeInt(uid);
5159 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5160 reply.readException();
5161 data.recycle();
5162 reply.recycle();
5163 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005164
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005165 public void overridePendingTransition(IBinder token, String packageName,
5166 int enterAnim, int exitAnim) throws RemoteException {
5167 Parcel data = Parcel.obtain();
5168 Parcel reply = Parcel.obtain();
5169 data.writeInterfaceToken(IActivityManager.descriptor);
5170 data.writeStrongBinder(token);
5171 data.writeString(packageName);
5172 data.writeInt(enterAnim);
5173 data.writeInt(exitAnim);
5174 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5175 reply.readException();
5176 data.recycle();
5177 reply.recycle();
5178 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005179
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005180 public boolean isUserAMonkey() throws RemoteException {
5181 Parcel data = Parcel.obtain();
5182 Parcel reply = Parcel.obtain();
5183 data.writeInterfaceToken(IActivityManager.descriptor);
5184 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5185 reply.readException();
5186 boolean res = reply.readInt() != 0;
5187 data.recycle();
5188 reply.recycle();
5189 return res;
5190 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005191
5192 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5193 Parcel data = Parcel.obtain();
5194 Parcel reply = Parcel.obtain();
5195 data.writeInterfaceToken(IActivityManager.descriptor);
5196 data.writeInt(monkey ? 1 : 0);
5197 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5198 reply.readException();
5199 data.recycle();
5200 reply.recycle();
5201 }
5202
Dianne Hackborn860755f2010-06-03 18:47:52 -07005203 public void finishHeavyWeightApp() throws RemoteException {
5204 Parcel data = Parcel.obtain();
5205 Parcel reply = Parcel.obtain();
5206 data.writeInterfaceToken(IActivityManager.descriptor);
5207 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5208 reply.readException();
5209 data.recycle();
5210 reply.recycle();
5211 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005212
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005213 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005214 throws RemoteException {
5215 Parcel data = Parcel.obtain();
5216 Parcel reply = Parcel.obtain();
5217 data.writeInterfaceToken(IActivityManager.descriptor);
5218 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005219 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5220 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005221 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005222 data.recycle();
5223 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005224 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005225 }
5226
Craig Mautner233ceee2014-05-09 17:05:11 -07005227 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005228 throws RemoteException {
5229 Parcel data = Parcel.obtain();
5230 Parcel reply = Parcel.obtain();
5231 data.writeInterfaceToken(IActivityManager.descriptor);
5232 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005233 if (options == null) {
5234 data.writeInt(0);
5235 } else {
5236 data.writeInt(1);
5237 data.writeBundle(options.toBundle());
5238 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005239 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005240 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005241 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005242 data.recycle();
5243 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005244 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005245 }
5246
Craig Mautner233ceee2014-05-09 17:05:11 -07005247 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5248 Parcel data = Parcel.obtain();
5249 Parcel reply = Parcel.obtain();
5250 data.writeInterfaceToken(IActivityManager.descriptor);
5251 data.writeStrongBinder(token);
5252 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5253 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005254 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005255 data.recycle();
5256 reply.recycle();
5257 return options;
5258 }
5259
Daniel Sandler69a48172010-06-23 16:29:36 -04005260 public void setImmersive(IBinder token, boolean immersive)
5261 throws RemoteException {
5262 Parcel data = Parcel.obtain();
5263 Parcel reply = Parcel.obtain();
5264 data.writeInterfaceToken(IActivityManager.descriptor);
5265 data.writeStrongBinder(token);
5266 data.writeInt(immersive ? 1 : 0);
5267 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5268 reply.readException();
5269 data.recycle();
5270 reply.recycle();
5271 }
5272
5273 public boolean isImmersive(IBinder token)
5274 throws RemoteException {
5275 Parcel data = Parcel.obtain();
5276 Parcel reply = Parcel.obtain();
5277 data.writeInterfaceToken(IActivityManager.descriptor);
5278 data.writeStrongBinder(token);
5279 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005280 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005281 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005282 data.recycle();
5283 reply.recycle();
5284 return res;
5285 }
5286
Craig Mautnerd61dc202014-07-07 11:09:11 -07005287 public boolean isTopOfTask(IBinder token) throws RemoteException {
5288 Parcel data = Parcel.obtain();
5289 Parcel reply = Parcel.obtain();
5290 data.writeInterfaceToken(IActivityManager.descriptor);
5291 data.writeStrongBinder(token);
5292 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5293 reply.readException();
5294 boolean res = reply.readInt() == 1;
5295 data.recycle();
5296 reply.recycle();
5297 return res;
5298 }
5299
Daniel Sandler69a48172010-06-23 16:29:36 -04005300 public boolean isTopActivityImmersive()
5301 throws RemoteException {
5302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005306 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005307 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005308 data.recycle();
5309 reply.recycle();
5310 return res;
5311 }
5312
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005313 public void crashApplication(int uid, int initialPid, String packageName,
5314 String message) throws RemoteException {
5315 Parcel data = Parcel.obtain();
5316 Parcel reply = Parcel.obtain();
5317 data.writeInterfaceToken(IActivityManager.descriptor);
5318 data.writeInt(uid);
5319 data.writeInt(initialPid);
5320 data.writeString(packageName);
5321 data.writeString(message);
5322 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5323 reply.readException();
5324 data.recycle();
5325 reply.recycle();
5326 }
Andy McFadden824c5102010-07-09 16:26:57 -07005327
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005328 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005329 Parcel data = Parcel.obtain();
5330 Parcel reply = Parcel.obtain();
5331 data.writeInterfaceToken(IActivityManager.descriptor);
5332 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005333 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005334 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5335 reply.readException();
5336 String res = reply.readString();
5337 data.recycle();
5338 reply.recycle();
5339 return res;
5340 }
5341
Dianne Hackborn7e269642010-08-25 19:50:20 -07005342 public IBinder newUriPermissionOwner(String name)
5343 throws RemoteException {
5344 Parcel data = Parcel.obtain();
5345 Parcel reply = Parcel.obtain();
5346 data.writeInterfaceToken(IActivityManager.descriptor);
5347 data.writeString(name);
5348 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5349 reply.readException();
5350 IBinder res = reply.readStrongBinder();
5351 data.recycle();
5352 reply.recycle();
5353 return res;
5354 }
5355
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005356 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5357 Parcel data = Parcel.obtain();
5358 Parcel reply = Parcel.obtain();
5359 data.writeInterfaceToken(IActivityManager.descriptor);
5360 data.writeStrongBinder(activityToken);
5361 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5362 reply.readException();
5363 IBinder res = reply.readStrongBinder();
5364 data.recycle();
5365 reply.recycle();
5366 return res;
5367 }
5368
Dianne Hackborn7e269642010-08-25 19:50:20 -07005369 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005370 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005371 Parcel data = Parcel.obtain();
5372 Parcel reply = Parcel.obtain();
5373 data.writeInterfaceToken(IActivityManager.descriptor);
5374 data.writeStrongBinder(owner);
5375 data.writeInt(fromUid);
5376 data.writeString(targetPkg);
5377 uri.writeToParcel(data, 0);
5378 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005379 data.writeInt(sourceUserId);
5380 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005381 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5382 reply.readException();
5383 data.recycle();
5384 reply.recycle();
5385 }
5386
5387 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005388 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005389 Parcel data = Parcel.obtain();
5390 Parcel reply = Parcel.obtain();
5391 data.writeInterfaceToken(IActivityManager.descriptor);
5392 data.writeStrongBinder(owner);
5393 if (uri != null) {
5394 data.writeInt(1);
5395 uri.writeToParcel(data, 0);
5396 } else {
5397 data.writeInt(0);
5398 }
5399 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005400 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005401 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5402 reply.readException();
5403 data.recycle();
5404 reply.recycle();
5405 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005406
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005407 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005408 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005409 Parcel data = Parcel.obtain();
5410 Parcel reply = Parcel.obtain();
5411 data.writeInterfaceToken(IActivityManager.descriptor);
5412 data.writeInt(callingUid);
5413 data.writeString(targetPkg);
5414 uri.writeToParcel(data, 0);
5415 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005416 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005417 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5418 reply.readException();
5419 int res = reply.readInt();
5420 data.recycle();
5421 reply.recycle();
5422 return res;
5423 }
5424
Dianne Hackborn1676c852012-09-10 14:52:30 -07005425 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005426 String path, ParcelFileDescriptor fd) throws RemoteException {
5427 Parcel data = Parcel.obtain();
5428 Parcel reply = Parcel.obtain();
5429 data.writeInterfaceToken(IActivityManager.descriptor);
5430 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005431 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005432 data.writeInt(managed ? 1 : 0);
5433 data.writeString(path);
5434 if (fd != null) {
5435 data.writeInt(1);
5436 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5437 } else {
5438 data.writeInt(0);
5439 }
5440 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5441 reply.readException();
5442 boolean res = reply.readInt() != 0;
5443 reply.recycle();
5444 data.recycle();
5445 return res;
5446 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005447
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005448 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005449 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005450 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005451 Parcel data = Parcel.obtain();
5452 Parcel reply = Parcel.obtain();
5453 data.writeInterfaceToken(IActivityManager.descriptor);
5454 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005455 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005456 data.writeTypedArray(intents, 0);
5457 data.writeStringArray(resolvedTypes);
5458 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005459 if (options != null) {
5460 data.writeInt(1);
5461 options.writeToParcel(data, 0);
5462 } else {
5463 data.writeInt(0);
5464 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005465 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005466 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5467 reply.readException();
5468 int result = reply.readInt();
5469 reply.recycle();
5470 data.recycle();
5471 return result;
5472 }
5473
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005474 public int getFrontActivityScreenCompatMode() throws RemoteException {
5475 Parcel data = Parcel.obtain();
5476 Parcel reply = Parcel.obtain();
5477 data.writeInterfaceToken(IActivityManager.descriptor);
5478 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5479 reply.readException();
5480 int mode = reply.readInt();
5481 reply.recycle();
5482 data.recycle();
5483 return mode;
5484 }
5485
5486 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5487 Parcel data = Parcel.obtain();
5488 Parcel reply = Parcel.obtain();
5489 data.writeInterfaceToken(IActivityManager.descriptor);
5490 data.writeInt(mode);
5491 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5492 reply.readException();
5493 reply.recycle();
5494 data.recycle();
5495 }
5496
5497 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5498 Parcel data = Parcel.obtain();
5499 Parcel reply = Parcel.obtain();
5500 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005501 data.writeString(packageName);
5502 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005503 reply.readException();
5504 int mode = reply.readInt();
5505 reply.recycle();
5506 data.recycle();
5507 return mode;
5508 }
5509
5510 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005511 throws RemoteException {
5512 Parcel data = Parcel.obtain();
5513 Parcel reply = Parcel.obtain();
5514 data.writeInterfaceToken(IActivityManager.descriptor);
5515 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005516 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005517 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5518 reply.readException();
5519 reply.recycle();
5520 data.recycle();
5521 }
5522
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005523 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5524 Parcel data = Parcel.obtain();
5525 Parcel reply = Parcel.obtain();
5526 data.writeInterfaceToken(IActivityManager.descriptor);
5527 data.writeString(packageName);
5528 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5529 reply.readException();
5530 boolean ask = reply.readInt() != 0;
5531 reply.recycle();
5532 data.recycle();
5533 return ask;
5534 }
5535
5536 public void setPackageAskScreenCompat(String packageName, boolean ask)
5537 throws RemoteException {
5538 Parcel data = Parcel.obtain();
5539 Parcel reply = Parcel.obtain();
5540 data.writeInterfaceToken(IActivityManager.descriptor);
5541 data.writeString(packageName);
5542 data.writeInt(ask ? 1 : 0);
5543 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5544 reply.readException();
5545 reply.recycle();
5546 data.recycle();
5547 }
5548
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005549 public boolean switchUser(int userid) throws RemoteException {
5550 Parcel data = Parcel.obtain();
5551 Parcel reply = Parcel.obtain();
5552 data.writeInterfaceToken(IActivityManager.descriptor);
5553 data.writeInt(userid);
5554 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5555 reply.readException();
5556 boolean result = reply.readInt() != 0;
5557 reply.recycle();
5558 data.recycle();
5559 return result;
5560 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005561
Kenny Guy08488bf2014-02-21 17:40:37 +00005562 public boolean startUserInBackground(int userid) throws RemoteException {
5563 Parcel data = Parcel.obtain();
5564 Parcel reply = Parcel.obtain();
5565 data.writeInterfaceToken(IActivityManager.descriptor);
5566 data.writeInt(userid);
5567 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5568 reply.readException();
5569 boolean result = reply.readInt() != 0;
5570 reply.recycle();
5571 data.recycle();
5572 return result;
5573 }
5574
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005575 public boolean unlockUser(int userId, byte[] token, byte[] secret) throws RemoteException {
Jeff Sharkeyba512352015-11-12 20:17:45 -08005576 Parcel data = Parcel.obtain();
5577 Parcel reply = Parcel.obtain();
5578 data.writeInterfaceToken(IActivityManager.descriptor);
5579 data.writeInt(userId);
5580 data.writeByteArray(token);
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005581 data.writeByteArray(secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08005582 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5583 reply.readException();
5584 boolean result = reply.readInt() != 0;
5585 reply.recycle();
5586 data.recycle();
5587 return result;
5588 }
5589
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005590 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5591 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005592 Parcel data = Parcel.obtain();
5593 Parcel reply = Parcel.obtain();
5594 data.writeInterfaceToken(IActivityManager.descriptor);
5595 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005596 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005597 data.writeStrongInterface(callback);
5598 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5599 reply.readException();
5600 int result = reply.readInt();
5601 reply.recycle();
5602 data.recycle();
5603 return result;
5604 }
5605
Amith Yamasani52f1d752012-03-28 18:19:29 -07005606 public UserInfo getCurrentUser() throws RemoteException {
5607 Parcel data = Parcel.obtain();
5608 Parcel reply = Parcel.obtain();
5609 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005610 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005611 reply.readException();
5612 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5613 reply.recycle();
5614 data.recycle();
5615 return userInfo;
5616 }
5617
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005618 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005619 Parcel data = Parcel.obtain();
5620 Parcel reply = Parcel.obtain();
5621 data.writeInterfaceToken(IActivityManager.descriptor);
5622 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005623 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005624 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5625 reply.readException();
5626 boolean result = reply.readInt() != 0;
5627 reply.recycle();
5628 data.recycle();
5629 return result;
5630 }
5631
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005632 public int[] getRunningUserIds() throws RemoteException {
5633 Parcel data = Parcel.obtain();
5634 Parcel reply = Parcel.obtain();
5635 data.writeInterfaceToken(IActivityManager.descriptor);
5636 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5637 reply.readException();
5638 int[] result = reply.createIntArray();
5639 reply.recycle();
5640 data.recycle();
5641 return result;
5642 }
5643
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005644 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005645 Parcel data = Parcel.obtain();
5646 Parcel reply = Parcel.obtain();
5647 data.writeInterfaceToken(IActivityManager.descriptor);
5648 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005649 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5650 reply.readException();
5651 boolean result = reply.readInt() != 0;
5652 reply.recycle();
5653 data.recycle();
5654 return result;
5655 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005656
Jeff Sharkeya4620792011-05-20 15:29:23 -07005657 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5658 Parcel data = Parcel.obtain();
5659 Parcel reply = Parcel.obtain();
5660 data.writeInterfaceToken(IActivityManager.descriptor);
5661 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5662 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5663 reply.readException();
5664 data.recycle();
5665 reply.recycle();
5666 }
5667
5668 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5669 Parcel data = Parcel.obtain();
5670 Parcel reply = Parcel.obtain();
5671 data.writeInterfaceToken(IActivityManager.descriptor);
5672 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5673 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5674 reply.readException();
5675 data.recycle();
5676 reply.recycle();
5677 }
5678
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005679 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005680 Parcel data = Parcel.obtain();
5681 Parcel reply = Parcel.obtain();
5682 data.writeInterfaceToken(IActivityManager.descriptor);
5683 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005684 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005685 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5686 reply.readException();
5687 data.recycle();
5688 reply.recycle();
5689 }
5690
5691 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5692 Parcel data = Parcel.obtain();
5693 Parcel reply = Parcel.obtain();
5694 data.writeInterfaceToken(IActivityManager.descriptor);
5695 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5696 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5697 reply.readException();
5698 data.recycle();
5699 reply.recycle();
5700 }
5701
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005702 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5703 Parcel data = Parcel.obtain();
5704 Parcel reply = Parcel.obtain();
5705 data.writeInterfaceToken(IActivityManager.descriptor);
5706 data.writeStrongBinder(sender.asBinder());
5707 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5708 reply.readException();
5709 boolean res = reply.readInt() != 0;
5710 data.recycle();
5711 reply.recycle();
5712 return res;
5713 }
5714
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005715 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5716 Parcel data = Parcel.obtain();
5717 Parcel reply = Parcel.obtain();
5718 data.writeInterfaceToken(IActivityManager.descriptor);
5719 data.writeStrongBinder(sender.asBinder());
5720 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5721 reply.readException();
5722 boolean res = reply.readInt() != 0;
5723 data.recycle();
5724 reply.recycle();
5725 return res;
5726 }
5727
Dianne Hackborn81038902012-11-26 17:04:09 -08005728 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5729 Parcel data = Parcel.obtain();
5730 Parcel reply = Parcel.obtain();
5731 data.writeInterfaceToken(IActivityManager.descriptor);
5732 data.writeStrongBinder(sender.asBinder());
5733 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5734 reply.readException();
5735 Intent res = reply.readInt() != 0
5736 ? Intent.CREATOR.createFromParcel(reply) : null;
5737 data.recycle();
5738 reply.recycle();
5739 return res;
5740 }
5741
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005742 public String getTagForIntentSender(IIntentSender sender, String prefix)
5743 throws RemoteException {
5744 Parcel data = Parcel.obtain();
5745 Parcel reply = Parcel.obtain();
5746 data.writeInterfaceToken(IActivityManager.descriptor);
5747 data.writeStrongBinder(sender.asBinder());
5748 data.writeString(prefix);
5749 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5750 reply.readException();
5751 String res = reply.readString();
5752 data.recycle();
5753 reply.recycle();
5754 return res;
5755 }
5756
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005757 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5758 {
5759 Parcel data = Parcel.obtain();
5760 Parcel reply = Parcel.obtain();
5761 data.writeInterfaceToken(IActivityManager.descriptor);
5762 values.writeToParcel(data, 0);
5763 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5764 reply.readException();
5765 data.recycle();
5766 reply.recycle();
5767 }
5768
Dianne Hackbornb437e092011-08-05 17:50:29 -07005769 public long[] getProcessPss(int[] pids) throws RemoteException {
5770 Parcel data = Parcel.obtain();
5771 Parcel reply = Parcel.obtain();
5772 data.writeInterfaceToken(IActivityManager.descriptor);
5773 data.writeIntArray(pids);
5774 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5775 reply.readException();
5776 long[] res = reply.createLongArray();
5777 data.recycle();
5778 reply.recycle();
5779 return res;
5780 }
5781
Dianne Hackborn661cd522011-08-22 00:26:20 -07005782 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5783 Parcel data = Parcel.obtain();
5784 Parcel reply = Parcel.obtain();
5785 data.writeInterfaceToken(IActivityManager.descriptor);
5786 TextUtils.writeToParcel(msg, data, 0);
5787 data.writeInt(always ? 1 : 0);
5788 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5789 reply.readException();
5790 data.recycle();
5791 reply.recycle();
5792 }
5793
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005794 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005795 Parcel data = Parcel.obtain();
5796 Parcel reply = Parcel.obtain();
5797 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005798 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005799 reply.readException();
5800 data.recycle();
5801 reply.recycle();
5802 }
5803
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005804 public void keyguardGoingAway(boolean disableWindowAnimations,
5805 boolean keyguardGoingToNotificationShade) throws RemoteException {
5806 Parcel data = Parcel.obtain();
5807 Parcel reply = Parcel.obtain();
5808 data.writeInterfaceToken(IActivityManager.descriptor);
5809 data.writeInt(disableWindowAnimations ? 1 : 0);
5810 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5811 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5812 reply.readException();
5813 data.recycle();
5814 reply.recycle();
5815 }
5816
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005817 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005818 throws RemoteException {
5819 Parcel data = Parcel.obtain();
5820 Parcel reply = Parcel.obtain();
5821 data.writeInterfaceToken(IActivityManager.descriptor);
5822 data.writeStrongBinder(token);
5823 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005824 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005825 reply.readException();
5826 boolean result = reply.readInt() != 0;
5827 data.recycle();
5828 reply.recycle();
5829 return result;
5830 }
5831
5832 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5833 throws RemoteException {
5834 Parcel data = Parcel.obtain();
5835 Parcel reply = Parcel.obtain();
5836 data.writeInterfaceToken(IActivityManager.descriptor);
5837 data.writeStrongBinder(token);
5838 target.writeToParcel(data, 0);
5839 data.writeInt(resultCode);
5840 if (resultData != null) {
5841 data.writeInt(1);
5842 resultData.writeToParcel(data, 0);
5843 } else {
5844 data.writeInt(0);
5845 }
5846 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5847 reply.readException();
5848 boolean result = reply.readInt() != 0;
5849 data.recycle();
5850 reply.recycle();
5851 return result;
5852 }
5853
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005854 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5855 Parcel data = Parcel.obtain();
5856 Parcel reply = Parcel.obtain();
5857 data.writeInterfaceToken(IActivityManager.descriptor);
5858 data.writeStrongBinder(activityToken);
5859 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5860 reply.readException();
5861 int result = reply.readInt();
5862 data.recycle();
5863 reply.recycle();
5864 return result;
5865 }
5866
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005867 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5868 Parcel data = Parcel.obtain();
5869 Parcel reply = Parcel.obtain();
5870 data.writeInterfaceToken(IActivityManager.descriptor);
5871 data.writeStrongBinder(activityToken);
5872 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5873 reply.readException();
5874 String result = reply.readString();
5875 data.recycle();
5876 reply.recycle();
5877 return result;
5878 }
5879
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005880 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5881 Parcel data = Parcel.obtain();
5882 Parcel reply = Parcel.obtain();
5883 data.writeInterfaceToken(IActivityManager.descriptor);
5884 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5885 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5886 reply.readException();
5887 data.recycle();
5888 reply.recycle();
5889 }
5890
5891 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5892 Parcel data = Parcel.obtain();
5893 Parcel reply = Parcel.obtain();
5894 data.writeInterfaceToken(IActivityManager.descriptor);
5895 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5896 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5897 reply.readException();
5898 data.recycle();
5899 reply.recycle();
5900 }
5901
Michal Karpinski3da5c972015-12-11 18:16:30 +00005902 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType)
5903 throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005904 Parcel data = Parcel.obtain();
5905 Parcel reply = Parcel.obtain();
5906 data.writeInterfaceToken(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00005907 data.writeInt(bugreportType);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005908 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5909 reply.readException();
5910 data.recycle();
5911 reply.recycle();
5912 }
5913
Jeff Brownbd181bb2013-09-10 16:44:24 -07005914 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5915 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005916 Parcel data = Parcel.obtain();
5917 Parcel reply = Parcel.obtain();
5918 data.writeInterfaceToken(IActivityManager.descriptor);
5919 data.writeInt(pid);
5920 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005921 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005922 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5923 reply.readException();
5924 long res = reply.readInt();
5925 data.recycle();
5926 reply.recycle();
5927 return res;
5928 }
5929
Adam Skorydfc7fd72013-08-05 19:23:41 -07005930 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005931 Parcel data = Parcel.obtain();
5932 Parcel reply = Parcel.obtain();
5933 data.writeInterfaceToken(IActivityManager.descriptor);
5934 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005935 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005936 reply.readException();
5937 Bundle res = reply.readBundle();
5938 data.recycle();
5939 reply.recycle();
5940 return res;
5941 }
5942
Dianne Hackborn17f69352015-07-17 18:04:14 -07005943 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5944 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005945 Parcel data = Parcel.obtain();
5946 Parcel reply = Parcel.obtain();
5947 data.writeInterfaceToken(IActivityManager.descriptor);
5948 data.writeInt(requestType);
5949 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005950 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005951 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5952 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005953 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005954 data.recycle();
5955 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005956 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005957 }
5958
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005959 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005960 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005961 Parcel data = Parcel.obtain();
5962 Parcel reply = Parcel.obtain();
5963 data.writeInterfaceToken(IActivityManager.descriptor);
5964 data.writeStrongBinder(token);
5965 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005966 structure.writeToParcel(data, 0);
5967 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005968 if (referrer != null) {
5969 data.writeInt(1);
5970 referrer.writeToParcel(data, 0);
5971 } else {
5972 data.writeInt(0);
5973 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005974 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005975 reply.readException();
5976 data.recycle();
5977 reply.recycle();
5978 }
5979
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005980 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5981 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005982 Parcel data = Parcel.obtain();
5983 Parcel reply = Parcel.obtain();
5984 data.writeInterfaceToken(IActivityManager.descriptor);
5985 intent.writeToParcel(data, 0);
5986 data.writeInt(requestType);
5987 data.writeString(hint);
5988 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005989 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005990 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5991 reply.readException();
5992 boolean res = reply.readInt() != 0;
5993 data.recycle();
5994 reply.recycle();
5995 return res;
5996 }
5997
Dianne Hackborn17f69352015-07-17 18:04:14 -07005998 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005999 Parcel data = Parcel.obtain();
6000 Parcel reply = Parcel.obtain();
6001 data.writeInterfaceToken(IActivityManager.descriptor);
6002 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
6003 reply.readException();
6004 boolean res = reply.readInt() != 0;
6005 data.recycle();
6006 reply.recycle();
6007 return res;
6008 }
6009
Dianne Hackborn17f69352015-07-17 18:04:14 -07006010 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
6011 Parcel data = Parcel.obtain();
6012 Parcel reply = Parcel.obtain();
6013 data.writeInterfaceToken(IActivityManager.descriptor);
6014 data.writeStrongBinder(token);
6015 data.writeBundle(args);
6016 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
6017 reply.readException();
6018 boolean res = reply.readInt() != 0;
6019 data.recycle();
6020 reply.recycle();
6021 return res;
6022 }
6023
Svetoslavaa41add2015-08-06 15:03:55 -07006024 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006025 Parcel data = Parcel.obtain();
6026 Parcel reply = Parcel.obtain();
6027 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07006028 data.writeInt(appId);
6029 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006030 data.writeString(reason);
6031 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
6032 reply.readException();
6033 data.recycle();
6034 reply.recycle();
6035 }
6036
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07006037 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
6038 Parcel data = Parcel.obtain();
6039 Parcel reply = Parcel.obtain();
6040 data.writeInterfaceToken(IActivityManager.descriptor);
6041 data.writeStrongBinder(who);
6042 data.writeInt(allowRestart ? 1 : 0);
6043 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
6044 reply.readException();
6045 data.recycle();
6046 reply.recycle();
6047 }
6048
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07006049 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
6050 Parcel data = Parcel.obtain();
6051 Parcel reply = Parcel.obtain();
6052 data.writeInterfaceToken(IActivityManager.descriptor);
6053 data.writeStrongBinder(token);
6054 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
6055 reply.readException();
6056 data.recycle();
6057 reply.recycle();
6058 }
6059
Craig Mautner5eda9b32013-07-02 11:58:16 -07006060 public void notifyActivityDrawn(IBinder token) throws RemoteException {
6061 Parcel data = Parcel.obtain();
6062 Parcel reply = Parcel.obtain();
6063 data.writeInterfaceToken(IActivityManager.descriptor);
6064 data.writeStrongBinder(token);
6065 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
6066 reply.readException();
6067 data.recycle();
6068 reply.recycle();
6069 }
6070
Dianne Hackborn57a7f592013-07-22 18:21:32 -07006071 public void restart() throws RemoteException {
6072 Parcel data = Parcel.obtain();
6073 Parcel reply = Parcel.obtain();
6074 data.writeInterfaceToken(IActivityManager.descriptor);
6075 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
6076 reply.readException();
6077 data.recycle();
6078 reply.recycle();
6079 }
6080
Dianne Hackborn35f72be2013-09-16 10:57:39 -07006081 public void performIdleMaintenance() throws RemoteException {
6082 Parcel data = Parcel.obtain();
6083 Parcel reply = Parcel.obtain();
6084 data.writeInterfaceToken(IActivityManager.descriptor);
6085 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
6086 reply.readException();
6087 data.recycle();
6088 reply.recycle();
6089 }
6090
Todd Kennedyca4d8422015-01-15 15:19:22 -08006091 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08006092 IActivityContainerCallback callback) throws RemoteException {
6093 Parcel data = Parcel.obtain();
6094 Parcel reply = Parcel.obtain();
6095 data.writeInterfaceToken(IActivityManager.descriptor);
6096 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07006097 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08006098 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08006099 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08006100 final int result = reply.readInt();
6101 final IActivityContainer res;
6102 if (result == 1) {
6103 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6104 } else {
6105 res = null;
6106 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08006107 data.recycle();
6108 reply.recycle();
6109 return res;
6110 }
6111
Craig Mautner95da1082014-02-24 17:54:35 -08006112 public void deleteActivityContainer(IActivityContainer activityContainer)
6113 throws RemoteException {
6114 Parcel data = Parcel.obtain();
6115 Parcel reply = Parcel.obtain();
6116 data.writeInterfaceToken(IActivityManager.descriptor);
6117 data.writeStrongBinder(activityContainer.asBinder());
6118 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
6119 reply.readException();
6120 data.recycle();
6121 reply.recycle();
6122 }
6123
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04006124 public boolean startBinderTracking() throws RemoteException {
6125 Parcel data = Parcel.obtain();
6126 Parcel reply = Parcel.obtain();
6127 data.writeInterfaceToken(IActivityManager.descriptor);
6128 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
6129 reply.readException();
6130 boolean res = reply.readInt() != 0;
6131 reply.recycle();
6132 data.recycle();
6133 return res;
6134 }
6135
6136 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6137 Parcel data = Parcel.obtain();
6138 Parcel reply = Parcel.obtain();
6139 data.writeInterfaceToken(IActivityManager.descriptor);
6140 if (fd != null) {
6141 data.writeInt(1);
6142 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6143 } else {
6144 data.writeInt(0);
6145 }
6146 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6147 reply.readException();
6148 boolean res = reply.readInt() != 0;
6149 reply.recycle();
6150 data.recycle();
6151 return res;
6152 }
6153
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006154 public void setVrMode(IBinder token, boolean enabled) throws RemoteException {
6155 Parcel data = Parcel.obtain();
6156 Parcel reply = Parcel.obtain();
6157 data.writeInterfaceToken(IActivityManager.descriptor);
6158 data.writeStrongBinder(token);
6159 data.writeInt(enabled ? 1 : 0);
6160 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6161 reply.readException();
6162 data.recycle();
6163 reply.recycle();
6164 }
6165
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006166 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006167 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6168 Parcel data = Parcel.obtain();
6169 Parcel reply = Parcel.obtain();
6170 data.writeInterfaceToken(IActivityManager.descriptor);
6171 data.writeInt(displayId);
6172 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6173 reply.readException();
6174 final int result = reply.readInt();
6175 final IActivityContainer res;
6176 if (result == 1) {
6177 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6178 } else {
6179 res = null;
6180 }
6181 data.recycle();
6182 reply.recycle();
6183 return res;
6184 }
6185
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006186 @Override
6187 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006188 throws RemoteException {
6189 Parcel data = Parcel.obtain();
6190 Parcel reply = Parcel.obtain();
6191 data.writeInterfaceToken(IActivityManager.descriptor);
6192 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006193 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006194 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006195 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006196 data.recycle();
6197 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006198 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006199 }
6200
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006201 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006202 public void startLockTaskMode(int taskId) throws RemoteException {
6203 Parcel data = Parcel.obtain();
6204 Parcel reply = Parcel.obtain();
6205 data.writeInterfaceToken(IActivityManager.descriptor);
6206 data.writeInt(taskId);
6207 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6208 reply.readException();
6209 data.recycle();
6210 reply.recycle();
6211 }
6212
6213 @Override
6214 public void startLockTaskMode(IBinder token) throws RemoteException {
6215 Parcel data = Parcel.obtain();
6216 Parcel reply = Parcel.obtain();
6217 data.writeInterfaceToken(IActivityManager.descriptor);
6218 data.writeStrongBinder(token);
6219 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6220 reply.readException();
6221 data.recycle();
6222 reply.recycle();
6223 }
6224
6225 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006226 public void startLockTaskModeOnCurrent() throws RemoteException {
6227 Parcel data = Parcel.obtain();
6228 Parcel reply = Parcel.obtain();
6229 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006230 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006231 reply.readException();
6232 data.recycle();
6233 reply.recycle();
6234 }
6235
6236 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006237 public void stopLockTaskMode() throws RemoteException {
6238 Parcel data = Parcel.obtain();
6239 Parcel reply = Parcel.obtain();
6240 data.writeInterfaceToken(IActivityManager.descriptor);
6241 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6242 reply.readException();
6243 data.recycle();
6244 reply.recycle();
6245 }
6246
6247 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006248 public void stopLockTaskModeOnCurrent() throws RemoteException {
6249 Parcel data = Parcel.obtain();
6250 Parcel reply = Parcel.obtain();
6251 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006252 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006253 reply.readException();
6254 data.recycle();
6255 reply.recycle();
6256 }
6257
6258 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006259 public boolean isInLockTaskMode() throws RemoteException {
6260 Parcel data = Parcel.obtain();
6261 Parcel reply = Parcel.obtain();
6262 data.writeInterfaceToken(IActivityManager.descriptor);
6263 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6264 reply.readException();
6265 boolean isInLockTaskMode = reply.readInt() == 1;
6266 data.recycle();
6267 reply.recycle();
6268 return isInLockTaskMode;
6269 }
6270
Craig Mautner688b5102014-03-27 16:55:03 -07006271 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006272 public int getLockTaskModeState() throws RemoteException {
6273 Parcel data = Parcel.obtain();
6274 Parcel reply = Parcel.obtain();
6275 data.writeInterfaceToken(IActivityManager.descriptor);
6276 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6277 reply.readException();
6278 int lockTaskModeState = reply.readInt();
6279 data.recycle();
6280 reply.recycle();
6281 return lockTaskModeState;
6282 }
6283
6284 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006285 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6286 Parcel data = Parcel.obtain();
6287 Parcel reply = Parcel.obtain();
6288 data.writeInterfaceToken(IActivityManager.descriptor);
6289 data.writeStrongBinder(token);
6290 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6291 IBinder.FLAG_ONEWAY);
6292 reply.readException();
6293 data.recycle();
6294 reply.recycle();
6295 }
6296
6297 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006298 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006299 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006300 Parcel data = Parcel.obtain();
6301 Parcel reply = Parcel.obtain();
6302 data.writeInterfaceToken(IActivityManager.descriptor);
6303 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006304 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006305 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006306 reply.readException();
6307 data.recycle();
6308 reply.recycle();
6309 }
6310
Craig Mautneree2e45a2014-06-27 12:10:03 -07006311 @Override
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006312 public void setTaskResizeable(int taskId, int resizeableMode) throws RemoteException {
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006313 Parcel data = Parcel.obtain();
6314 Parcel reply = Parcel.obtain();
6315 data.writeInterfaceToken(IActivityManager.descriptor);
6316 data.writeInt(taskId);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006317 data.writeInt(resizeableMode);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006318 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006319 reply.readException();
6320 data.recycle();
6321 reply.recycle();
6322 }
6323
6324 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006325 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006326 {
6327 Parcel data = Parcel.obtain();
6328 Parcel reply = Parcel.obtain();
6329 data.writeInterfaceToken(IActivityManager.descriptor);
6330 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006331 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006332 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006333 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006334 reply.readException();
6335 data.recycle();
6336 reply.recycle();
6337 }
6338
6339 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006340 public Rect getTaskBounds(int taskId) throws RemoteException
6341 {
6342 Parcel data = Parcel.obtain();
6343 Parcel reply = Parcel.obtain();
6344 data.writeInterfaceToken(IActivityManager.descriptor);
6345 data.writeInt(taskId);
6346 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6347 reply.readException();
6348 Rect rect = Rect.CREATOR.createFromParcel(reply);
6349 data.recycle();
6350 reply.recycle();
6351 return rect;
6352 }
6353
6354 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006355 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006356 Parcel data = Parcel.obtain();
6357 Parcel reply = Parcel.obtain();
6358 data.writeInterfaceToken(IActivityManager.descriptor);
6359 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006360 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006361 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6362 reply.readException();
6363 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6364 data.recycle();
6365 reply.recycle();
6366 return icon;
6367 }
6368
6369 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006370 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6371 throws RemoteException {
6372 Parcel data = Parcel.obtain();
6373 Parcel reply = Parcel.obtain();
6374 data.writeInterfaceToken(IActivityManager.descriptor);
6375 if (options == null) {
6376 data.writeInt(0);
6377 } else {
6378 data.writeInt(1);
6379 data.writeBundle(options.toBundle());
6380 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006381 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006382 reply.readException();
6383 data.recycle();
6384 reply.recycle();
6385 }
6386
6387 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006388 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006389 Parcel data = Parcel.obtain();
6390 Parcel reply = Parcel.obtain();
6391 data.writeInterfaceToken(IActivityManager.descriptor);
6392 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006393 data.writeInt(visible ? 1 : 0);
6394 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006395 reply.readException();
6396 boolean success = reply.readInt() > 0;
6397 data.recycle();
6398 reply.recycle();
6399 return success;
6400 }
6401
6402 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006403 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006404 Parcel data = Parcel.obtain();
6405 Parcel reply = Parcel.obtain();
6406 data.writeInterfaceToken(IActivityManager.descriptor);
6407 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006408 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006409 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006410 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006411 data.recycle();
6412 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006413 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006414 }
6415
6416 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006417 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006418 Parcel data = Parcel.obtain();
6419 Parcel reply = Parcel.obtain();
6420 data.writeInterfaceToken(IActivityManager.descriptor);
6421 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006422 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006423 reply.readException();
6424 data.recycle();
6425 reply.recycle();
6426 }
6427
6428 @Override
6429 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6430 Parcel data = Parcel.obtain();
6431 Parcel reply = Parcel.obtain();
6432 data.writeInterfaceToken(IActivityManager.descriptor);
6433 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006434 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006435 reply.readException();
6436 data.recycle();
6437 reply.recycle();
6438 }
6439
Craig Mautner8746a472014-07-24 15:12:54 -07006440 @Override
6441 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6442 Parcel data = Parcel.obtain();
6443 Parcel reply = Parcel.obtain();
6444 data.writeInterfaceToken(IActivityManager.descriptor);
6445 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006446 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006447 reply.readException();
6448 data.recycle();
6449 reply.recycle();
6450 }
6451
Craig Mautner6e2f3952014-09-09 14:26:41 -07006452 @Override
6453 public void bootAnimationComplete() throws RemoteException {
6454 Parcel data = Parcel.obtain();
6455 Parcel reply = Parcel.obtain();
6456 data.writeInterfaceToken(IActivityManager.descriptor);
6457 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6458 reply.readException();
6459 data.recycle();
6460 reply.recycle();
6461 }
6462
Wale Ogunwale18795a22014-12-03 11:38:33 -08006463 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006464 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6465 Parcel data = Parcel.obtain();
6466 Parcel reply = Parcel.obtain();
6467 data.writeInterfaceToken(IActivityManager.descriptor);
6468 data.writeInt(uid);
6469 data.writeByteArray(firstPacket);
6470 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6471 reply.readException();
6472 data.recycle();
6473 reply.recycle();
6474 }
6475
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006476 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006477 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6478 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006479 Parcel data = Parcel.obtain();
6480 Parcel reply = Parcel.obtain();
6481 data.writeInterfaceToken(IActivityManager.descriptor);
6482 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006483 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006484 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006485 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006486 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6487 reply.readException();
6488 data.recycle();
6489 reply.recycle();
6490 }
6491
6492 @Override
6493 public void dumpHeapFinished(String path) throws RemoteException {
6494 Parcel data = Parcel.obtain();
6495 Parcel reply = Parcel.obtain();
6496 data.writeInterfaceToken(IActivityManager.descriptor);
6497 data.writeString(path);
6498 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6499 reply.readException();
6500 data.recycle();
6501 reply.recycle();
6502 }
6503
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006504 @Override
6505 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6506 throws RemoteException {
6507 Parcel data = Parcel.obtain();
6508 Parcel reply = Parcel.obtain();
6509 data.writeInterfaceToken(IActivityManager.descriptor);
6510 data.writeStrongBinder(session.asBinder());
6511 data.writeInt(keepAwake ? 1 : 0);
6512 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6513 reply.readException();
6514 data.recycle();
6515 reply.recycle();
6516 }
6517
Craig Mautnere5600772015-04-03 21:36:37 -07006518 @Override
6519 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6520 Parcel data = Parcel.obtain();
6521 Parcel reply = Parcel.obtain();
6522 data.writeInterfaceToken(IActivityManager.descriptor);
6523 data.writeInt(userId);
6524 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006525 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006526 reply.readException();
6527 data.recycle();
6528 reply.recycle();
6529 }
6530
Dianne Hackborn1e383822015-04-10 14:02:33 -07006531 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006532 public void updateDeviceOwner(String packageName) throws RemoteException {
6533 Parcel data = Parcel.obtain();
6534 Parcel reply = Parcel.obtain();
6535 data.writeInterfaceToken(IActivityManager.descriptor);
6536 data.writeString(packageName);
6537 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6538 reply.readException();
6539 data.recycle();
6540 reply.recycle();
6541 }
6542
6543 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006544 public int getPackageProcessState(String packageName, String callingPackage)
6545 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006546 Parcel data = Parcel.obtain();
6547 Parcel reply = Parcel.obtain();
6548 data.writeInterfaceToken(IActivityManager.descriptor);
6549 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006550 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006551 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6552 reply.readException();
6553 int res = reply.readInt();
6554 data.recycle();
6555 reply.recycle();
6556 return res;
6557 }
6558
Stefan Kuhne16045c22015-06-05 07:18:06 -07006559 @Override
6560 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6561 throws RemoteException {
6562 Parcel data = Parcel.obtain();
6563 Parcel reply = Parcel.obtain();
6564 data.writeInterfaceToken(IActivityManager.descriptor);
6565 data.writeString(process);
6566 data.writeInt(userId);
6567 data.writeInt(level);
6568 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6569 reply.readException();
6570 int res = reply.readInt();
6571 data.recycle();
6572 reply.recycle();
6573 return res != 0;
6574 }
6575
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006576 @Override
6577 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6578 Parcel data = Parcel.obtain();
6579 Parcel reply = Parcel.obtain();
6580 data.writeInterfaceToken(IActivityManager.descriptor);
6581 data.writeStrongBinder(token);
6582 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6583 reply.readException();
6584 int res = reply.readInt();
6585 data.recycle();
6586 reply.recycle();
6587 return res != 0;
6588 }
6589
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006590 @Override
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006591 public void exitFreeformMode(IBinder token) throws RemoteException {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006592 Parcel data = Parcel.obtain();
6593 Parcel reply = Parcel.obtain();
6594 data.writeInterfaceToken(IActivityManager.descriptor);
6595 data.writeStrongBinder(token);
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006596 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006597 reply.readException();
6598 data.recycle();
6599 reply.recycle();
6600 }
6601
6602 @Override
6603 public int getActivityStackId(IBinder token) throws RemoteException {
6604 Parcel data = Parcel.obtain();
6605 Parcel reply = Parcel.obtain();
6606 data.writeInterfaceToken(IActivityManager.descriptor);
6607 data.writeStrongBinder(token);
6608 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6609 reply.readException();
6610 int stackId = reply.readInt();
6611 data.recycle();
6612 reply.recycle();
6613 return stackId;
6614 }
6615
Filip Gruszczynski23493322015-07-29 17:02:59 -07006616 @Override
6617 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006618 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6619 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006620 Parcel data = Parcel.obtain();
6621 Parcel reply = Parcel.obtain();
6622 data.writeInterfaceToken(IActivityManager.descriptor);
6623 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006624 writeIntArray(horizontalSizeConfiguration, data);
6625 writeIntArray(verticalSizeConfigurations, data);
6626 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006627 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6628 reply.readException();
6629 data.recycle();
6630 reply.recycle();
6631 }
6632
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006633 private static void writeIntArray(int[] array, Parcel data) {
6634 if (array == null) {
6635 data.writeInt(0);
6636 } else {
6637 data.writeInt(array.length);
6638 data.writeIntArray(array);
6639 }
6640 }
6641
Wale Ogunwale83301a92015-09-24 15:54:08 -07006642 @Override
6643 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6644 Parcel data = Parcel.obtain();
6645 Parcel reply = Parcel.obtain();
6646 data.writeInterfaceToken(IActivityManager.descriptor);
6647 data.writeInt(suppress ? 1 : 0);
6648 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6649 reply.readException();
6650 data.recycle();
6651 reply.recycle();
6652 }
6653
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006654 @Override
Wale Ogunwale9101d262016-01-15 08:56:11 -08006655 public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006656 Parcel data = Parcel.obtain();
6657 Parcel reply = Parcel.obtain();
6658 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006659 data.writeInt(fromStackId);
Wale Ogunwale9101d262016-01-15 08:56:11 -08006660 data.writeInt(onTop ? 1 : 0);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006661 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006662 reply.readException();
6663 data.recycle();
6664 reply.recycle();
6665 }
6666
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006667 @Override
6668 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6669 Parcel data = Parcel.obtain();
6670 Parcel reply = Parcel.obtain();
6671 data.writeInterfaceToken(IActivityManager.descriptor);
6672 data.writeInt(uid);
6673 data.writeString(packageName);
6674 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6675 reply.readException();
6676 int res = reply.readInt();
6677 data.recycle();
6678 reply.recycle();
6679 return res;
6680 }
6681
Wale Ogunwale5f986092015-12-04 15:35:38 -08006682 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006683 public boolean inMultiWindow(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006684 Parcel data = Parcel.obtain();
6685 Parcel reply = Parcel.obtain();
6686 data.writeInterfaceToken(IActivityManager.descriptor);
6687 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006688 mRemote.transact(IN_MULTI_WINDOW_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006689 reply.readException();
6690 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6691 data.recycle();
6692 reply.recycle();
6693 return multiWindowMode;
6694 }
6695
6696 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006697 public boolean inPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006698 Parcel data = Parcel.obtain();
6699 Parcel reply = Parcel.obtain();
6700 data.writeInterfaceToken(IActivityManager.descriptor);
6701 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006702 mRemote.transact(IN_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006703 reply.readException();
6704 final boolean pipMode = reply.readInt() == 1 ? true : false;
6705 data.recycle();
6706 reply.recycle();
6707 return pipMode;
6708 }
6709
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006710 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006711 public void enterPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006712 Parcel data = Parcel.obtain();
6713 Parcel reply = Parcel.obtain();
6714 data.writeInterfaceToken(IActivityManager.descriptor);
6715 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006716 mRemote.transact(ENTER_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006717 reply.readException();
6718 data.recycle();
6719 reply.recycle();
6720 }
6721
Christopher Tate63fec3e2015-12-11 18:35:28 -08006722 @Override
6723 public boolean isAppForeground(int uid) throws RemoteException {
6724 Parcel data = Parcel.obtain();
6725 Parcel reply = Parcel.obtain();
6726 data.writeInterfaceToken(IActivityManager.descriptor);
6727 data.writeInt(uid);
6728 mRemote.transact(IS_APP_FOREGROUND_TRANSACTION, data, reply, 0);
6729 final boolean isForeground = reply.readInt() == 1 ? true : false;
6730 data.recycle();
6731 reply.recycle();
6732 return isForeground;
6733 };
6734
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006735 private IBinder mRemote;
6736}