blob: 4bf48a3389564cb6be4a1e0d9367bed3249e44c7 [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
Tony Mak9c6e8ce2016-03-21 12:07:16 +000019import android.annotation.UserIdInt;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080020import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070021import android.app.assist.AssistContent;
22import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070024import android.content.IIntentReceiver;
25import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.Intent;
27import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070028import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070029import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070030import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import android.content.pm.ConfigurationInfo;
32import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070033import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070034import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070036import android.graphics.Bitmap;
37import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080038import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.net.Uri;
40import android.os.Binder;
41import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070042import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.os.IBinder;
Jeff Sharkeybd91e2f2016-03-22 15:32:31 -060044import android.os.IProgressListener;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070046import android.os.ParcelFileDescriptor;
47import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070048import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070049import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070051import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070052import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080055import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070056import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080057import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080059import java.util.ArrayList;
60import java.util.List;
61
62/** {@hide} */
63public abstract class ActivityManagerNative extends Binder implements IActivityManager
64{
65 /**
66 * Cast a Binder object into an activity manager interface, generating
67 * a proxy if needed.
68 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 if (obj == null) {
71 return null;
72 }
73 IActivityManager in =
74 (IActivityManager)obj.queryLocalInterface(descriptor);
75 if (in != null) {
76 return in;
77 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080078
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079 return new ActivityManagerProxy(obj);
80 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080081
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 /**
83 * Retrieve the system's default/global activity manager.
84 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080085 static public IActivityManager getDefault() {
86 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 }
88
89 /**
90 * Convenience for checking whether the system is ready. For internal use only.
91 */
92 static public boolean isSystemReady() {
93 if (!sSystemReady) {
94 sSystemReady = getDefault().testIsSystemReady();
95 }
96 return sSystemReady;
97 }
98 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080099
Svet Ganov16a16892015-04-16 10:32:04 -0700100 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
101 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
102 }
103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 /**
105 * Convenience for sending a sticky broadcast. For internal use only.
106 * If you don't care about permission, use null.
107 */
Svet Ganov16a16892015-04-16 10:32:04 -0700108 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
109 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 try {
111 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700112 null, intent, null, null, Activity.RESULT_OK, null, null,
113 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114 } catch (RemoteException ex) {
115 }
116 }
117
Dianne Hackborn1e383822015-04-10 14:02:33 -0700118 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
119 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700121 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
122 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700123 } catch (RemoteException ex) {
124 }
125 }
126
127 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
128 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700129 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700130 } catch (RemoteException ex) {
131 }
132 }
133
134 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
135 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700136 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137 } catch (RemoteException ex) {
138 }
139 }
140
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800141 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 attachInterface(this, descriptor);
143 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700144
145 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800146 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
147 throws RemoteException {
148 switch (code) {
149 case START_ACTIVITY_TRANSACTION:
150 {
151 data.enforceInterface(IActivityManager.descriptor);
152 IBinder b = data.readStrongBinder();
153 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800154 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 Intent intent = Intent.CREATOR.createFromParcel(data);
156 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800158 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700160 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700161 ProfilerInfo profilerInfo = data.readInt() != 0
162 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700163 Bundle options = data.readInt() != 0
164 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800165 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700166 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800167 reply.writeNoException();
168 reply.writeInt(result);
169 return true;
170 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700171
Amith Yamasani82644082012-08-03 13:09:11 -0700172 case START_ACTIVITY_AS_USER_TRANSACTION:
173 {
174 data.enforceInterface(IActivityManager.descriptor);
175 IBinder b = data.readStrongBinder();
176 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800177 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700178 Intent intent = Intent.CREATOR.createFromParcel(data);
179 String resolvedType = data.readString();
180 IBinder resultTo = data.readStrongBinder();
181 String resultWho = data.readString();
182 int requestCode = data.readInt();
183 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700184 ProfilerInfo profilerInfo = data.readInt() != 0
185 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700186 Bundle options = data.readInt() != 0
187 ? Bundle.CREATOR.createFromParcel(data) : null;
188 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800189 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700190 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700191 reply.writeNoException();
192 reply.writeInt(result);
193 return true;
194 }
195
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700196 case START_ACTIVITY_AS_CALLER_TRANSACTION:
197 {
198 data.enforceInterface(IActivityManager.descriptor);
199 IBinder b = data.readStrongBinder();
200 IApplicationThread app = ApplicationThreadNative.asInterface(b);
201 String callingPackage = data.readString();
202 Intent intent = Intent.CREATOR.createFromParcel(data);
203 String resolvedType = data.readString();
204 IBinder resultTo = data.readStrongBinder();
205 String resultWho = data.readString();
206 int requestCode = data.readInt();
207 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700208 ProfilerInfo profilerInfo = data.readInt() != 0
209 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700210 Bundle options = data.readInt() != 0
211 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700212 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700213 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700214 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700215 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
216 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700217 reply.writeNoException();
218 reply.writeInt(result);
219 return true;
220 }
221
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800222 case START_ACTIVITY_AND_WAIT_TRANSACTION:
223 {
224 data.enforceInterface(IActivityManager.descriptor);
225 IBinder b = data.readStrongBinder();
226 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800227 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800228 Intent intent = Intent.CREATOR.createFromParcel(data);
229 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800230 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800231 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800232 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700233 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700234 ProfilerInfo profilerInfo = data.readInt() != 0
235 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700236 Bundle options = data.readInt() != 0
237 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700238 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800239 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700240 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800241 reply.writeNoException();
242 result.writeToParcel(reply, 0);
243 return true;
244 }
245
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700246 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
247 {
248 data.enforceInterface(IActivityManager.descriptor);
249 IBinder b = data.readStrongBinder();
250 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800251 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 Intent intent = Intent.CREATOR.createFromParcel(data);
253 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700254 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700255 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700256 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700258 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700259 Bundle options = data.readInt() != 0
260 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700261 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800262 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700263 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700264 reply.writeNoException();
265 reply.writeInt(result);
266 return true;
267 }
268
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700269 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700270 {
271 data.enforceInterface(IActivityManager.descriptor);
272 IBinder b = data.readStrongBinder();
273 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700274 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700275 Intent fillInIntent = null;
276 if (data.readInt() != 0) {
277 fillInIntent = Intent.CREATOR.createFromParcel(data);
278 }
279 String resolvedType = data.readString();
280 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700281 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700282 int requestCode = data.readInt();
283 int flagsMask = data.readInt();
284 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700285 Bundle options = data.readInt() != 0
286 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700287 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700288 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700289 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700290 reply.writeNoException();
291 reply.writeInt(result);
292 return true;
293 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700294
Dianne Hackborn91097de2014-04-04 18:02:06 -0700295 case START_VOICE_ACTIVITY_TRANSACTION:
296 {
297 data.enforceInterface(IActivityManager.descriptor);
298 String callingPackage = data.readString();
299 int callingPid = data.readInt();
300 int callingUid = data.readInt();
301 Intent intent = Intent.CREATOR.createFromParcel(data);
302 String resolvedType = data.readString();
303 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
304 data.readStrongBinder());
305 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
306 data.readStrongBinder());
307 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700308 ProfilerInfo profilerInfo = data.readInt() != 0
309 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700310 Bundle options = data.readInt() != 0
311 ? Bundle.CREATOR.createFromParcel(data) : null;
312 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700313 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
314 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700315 reply.writeNoException();
316 reply.writeInt(result);
317 return true;
318 }
319
Amith Yamasani0af6fa72016-01-17 15:36:19 -0800320 case START_LOCAL_VOICE_INTERACTION_TRANSACTION:
321 {
322 data.enforceInterface(IActivityManager.descriptor);
323 IBinder token = data.readStrongBinder();
324 Bundle options = data.readBundle();
325 startLocalVoiceInteraction(token, options);
326 reply.writeNoException();
327 return true;
328 }
329
330 case STOP_LOCAL_VOICE_INTERACTION_TRANSACTION:
331 {
332 data.enforceInterface(IActivityManager.descriptor);
333 IBinder token = data.readStrongBinder();
334 stopLocalVoiceInteraction(token);
335 reply.writeNoException();
336 return true;
337 }
338
339 case SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION:
340 {
341 data.enforceInterface(IActivityManager.descriptor);
342 boolean result = supportsLocalVoiceInteraction();
343 reply.writeNoException();
344 reply.writeInt(result? 1 : 0);
345 return true;
346 }
347
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
349 {
350 data.enforceInterface(IActivityManager.descriptor);
351 IBinder callingActivity = data.readStrongBinder();
352 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700353 Bundle options = data.readInt() != 0
354 ? Bundle.CREATOR.createFromParcel(data) : null;
355 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800356 reply.writeNoException();
357 reply.writeInt(result ? 1 : 0);
358 return true;
359 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700360
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700361 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
362 {
363 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700364 final int taskId = data.readInt();
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700365 final Bundle options =
366 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
Wale Ogunwale854809c2015-12-27 16:18:19 -0800367 final int result = startActivityFromRecents(taskId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700368 reply.writeNoException();
369 reply.writeInt(result);
370 return true;
371 }
372
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 case FINISH_ACTIVITY_TRANSACTION: {
374 data.enforceInterface(IActivityManager.descriptor);
375 IBinder token = data.readStrongBinder();
376 Intent resultData = null;
377 int resultCode = data.readInt();
378 if (data.readInt() != 0) {
379 resultData = Intent.CREATOR.createFromParcel(data);
380 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700381 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700382 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800383 reply.writeNoException();
384 reply.writeInt(res ? 1 : 0);
385 return true;
386 }
387
388 case FINISH_SUB_ACTIVITY_TRANSACTION: {
389 data.enforceInterface(IActivityManager.descriptor);
390 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700391 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 int requestCode = data.readInt();
393 finishSubActivity(token, resultWho, requestCode);
394 reply.writeNoException();
395 return true;
396 }
397
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700398 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
399 data.enforceInterface(IActivityManager.descriptor);
400 IBinder token = data.readStrongBinder();
401 boolean res = finishActivityAffinity(token);
402 reply.writeNoException();
403 reply.writeInt(res ? 1 : 0);
404 return true;
405 }
406
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700407 case FINISH_VOICE_TASK_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
410 data.readStrongBinder());
411 finishVoiceTask(session);
412 reply.writeNoException();
413 return true;
414 }
415
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700416 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
417 data.enforceInterface(IActivityManager.descriptor);
418 IBinder token = data.readStrongBinder();
419 boolean res = releaseActivityInstance(token);
420 reply.writeNoException();
421 reply.writeInt(res ? 1 : 0);
422 return true;
423 }
424
425 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
426 data.enforceInterface(IActivityManager.descriptor);
427 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
428 releaseSomeActivities(app);
429 reply.writeNoException();
430 return true;
431 }
432
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800433 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
434 data.enforceInterface(IActivityManager.descriptor);
435 IBinder token = data.readStrongBinder();
436 boolean res = willActivityBeVisible(token);
437 reply.writeNoException();
438 reply.writeInt(res ? 1 : 0);
439 return true;
440 }
441
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 case REGISTER_RECEIVER_TRANSACTION:
443 {
444 data.enforceInterface(IActivityManager.descriptor);
445 IBinder b = data.readStrongBinder();
446 IApplicationThread app =
447 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700448 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 b = data.readStrongBinder();
450 IIntentReceiver rec
451 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
452 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
453 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700454 int userId = data.readInt();
455 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800456 reply.writeNoException();
457 if (intent != null) {
458 reply.writeInt(1);
459 intent.writeToParcel(reply, 0);
460 } else {
461 reply.writeInt(0);
462 }
463 return true;
464 }
465
466 case UNREGISTER_RECEIVER_TRANSACTION:
467 {
468 data.enforceInterface(IActivityManager.descriptor);
469 IBinder b = data.readStrongBinder();
470 if (b == null) {
471 return true;
472 }
473 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
474 unregisterReceiver(rec);
475 reply.writeNoException();
476 return true;
477 }
478
479 case BROADCAST_INTENT_TRANSACTION:
480 {
481 data.enforceInterface(IActivityManager.descriptor);
482 IBinder b = data.readStrongBinder();
483 IApplicationThread app =
484 b != null ? ApplicationThreadNative.asInterface(b) : null;
485 Intent intent = Intent.CREATOR.createFromParcel(data);
486 String resolvedType = data.readString();
487 b = data.readStrongBinder();
488 IIntentReceiver resultTo =
489 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
490 int resultCode = data.readInt();
491 String resultData = data.readString();
492 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700493 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800494 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700495 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 boolean serialized = data.readInt() != 0;
497 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700498 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700500 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700501 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 reply.writeNoException();
503 reply.writeInt(res);
504 return true;
505 }
506
507 case UNBROADCAST_INTENT_TRANSACTION:
508 {
509 data.enforceInterface(IActivityManager.descriptor);
510 IBinder b = data.readStrongBinder();
511 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
512 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700513 int userId = data.readInt();
514 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800515 reply.writeNoException();
516 return true;
517 }
518
519 case FINISH_RECEIVER_TRANSACTION: {
520 data.enforceInterface(IActivityManager.descriptor);
521 IBinder who = data.readStrongBinder();
522 int resultCode = data.readInt();
523 String resultData = data.readString();
524 Bundle resultExtras = data.readBundle();
525 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800526 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800528 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800529 }
530 reply.writeNoException();
531 return true;
532 }
533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 case ATTACH_APPLICATION_TRANSACTION: {
535 data.enforceInterface(IActivityManager.descriptor);
536 IApplicationThread app = ApplicationThreadNative.asInterface(
537 data.readStrongBinder());
538 if (app != null) {
539 attachApplication(app);
540 }
541 reply.writeNoException();
542 return true;
543 }
544
545 case ACTIVITY_IDLE_TRANSACTION: {
546 data.enforceInterface(IActivityManager.descriptor);
547 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700548 Configuration config = null;
549 if (data.readInt() != 0) {
550 config = Configuration.CREATOR.createFromParcel(data);
551 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700552 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700554 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800555 }
556 reply.writeNoException();
557 return true;
558 }
559
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700560 case ACTIVITY_RESUMED_TRANSACTION: {
561 data.enforceInterface(IActivityManager.descriptor);
562 IBinder token = data.readStrongBinder();
563 activityResumed(token);
564 reply.writeNoException();
565 return true;
566 }
567
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800568 case ACTIVITY_PAUSED_TRANSACTION: {
569 data.enforceInterface(IActivityManager.descriptor);
570 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700571 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800572 reply.writeNoException();
573 return true;
574 }
575
576 case ACTIVITY_STOPPED_TRANSACTION: {
577 data.enforceInterface(IActivityManager.descriptor);
578 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800579 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700580 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700582 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800583 reply.writeNoException();
584 return true;
585 }
586
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800587 case ACTIVITY_SLEPT_TRANSACTION: {
588 data.enforceInterface(IActivityManager.descriptor);
589 IBinder token = data.readStrongBinder();
590 activitySlept(token);
591 reply.writeNoException();
592 return true;
593 }
594
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800595 case ACTIVITY_DESTROYED_TRANSACTION: {
596 data.enforceInterface(IActivityManager.descriptor);
597 IBinder token = data.readStrongBinder();
598 activityDestroyed(token);
599 reply.writeNoException();
600 return true;
601 }
602
Jorim Jaggife89d122015-12-22 16:28:44 +0100603 case ACTIVITY_RELAUNCHED_TRANSACTION: {
604 data.enforceInterface(IActivityManager.descriptor);
605 IBinder token = data.readStrongBinder();
606 activityRelaunched(token);
607 reply.writeNoException();
608 return true;
609 }
610
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 case GET_CALLING_PACKAGE_TRANSACTION: {
612 data.enforceInterface(IActivityManager.descriptor);
613 IBinder token = data.readStrongBinder();
614 String res = token != null ? getCallingPackage(token) : null;
615 reply.writeNoException();
616 reply.writeString(res);
617 return true;
618 }
619
620 case GET_CALLING_ACTIVITY_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 IBinder token = data.readStrongBinder();
623 ComponentName cn = getCallingActivity(token);
624 reply.writeNoException();
625 ComponentName.writeToParcel(cn, reply);
626 return true;
627 }
628
Winson Chung1147c402014-05-14 11:05:00 -0700629 case GET_APP_TASKS_TRANSACTION: {
630 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700631 String callingPackage = data.readString();
632 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700633 reply.writeNoException();
634 int N = list != null ? list.size() : -1;
635 reply.writeInt(N);
636 int i;
637 for (i=0; i<N; i++) {
638 IAppTask task = list.get(i);
639 reply.writeStrongBinder(task.asBinder());
640 }
641 return true;
642 }
643
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700644 case ADD_APP_TASK_TRANSACTION: {
645 data.enforceInterface(IActivityManager.descriptor);
646 IBinder activityToken = data.readStrongBinder();
647 Intent intent = Intent.CREATOR.createFromParcel(data);
648 ActivityManager.TaskDescription descr
649 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
650 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
651 int res = addAppTask(activityToken, intent, descr, thumbnail);
652 reply.writeNoException();
653 reply.writeInt(res);
654 return true;
655 }
656
657 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 Point size = getAppTaskThumbnailSize();
660 reply.writeNoException();
661 size.writeToParcel(reply, 0);
662 return true;
663 }
664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 case GET_TASKS_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 int maxNum = data.readInt();
668 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700669 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 reply.writeNoException();
671 int N = list != null ? list.size() : -1;
672 reply.writeInt(N);
673 int i;
674 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700675 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800676 info.writeToParcel(reply, 0);
677 }
678 return true;
679 }
680
681 case GET_RECENT_TASKS_TRANSACTION: {
682 data.enforceInterface(IActivityManager.descriptor);
683 int maxNum = data.readInt();
684 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700685 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800686 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700687 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 reply.writeNoException();
689 reply.writeTypedList(list);
690 return true;
691 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700692
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700693 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800694 data.enforceInterface(IActivityManager.descriptor);
695 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700696 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800697 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700698 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800699 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700700 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700701 } else {
702 reply.writeInt(0);
703 }
704 return true;
705 }
706
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 case GET_SERVICES_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 int maxNum = data.readInt();
710 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700711 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800712 reply.writeNoException();
713 int N = list != null ? list.size() : -1;
714 reply.writeInt(N);
715 int i;
716 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700717 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 info.writeToParcel(reply, 0);
719 }
720 return true;
721 }
722
723 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
724 data.enforceInterface(IActivityManager.descriptor);
725 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
726 reply.writeNoException();
727 reply.writeTypedList(list);
728 return true;
729 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700730
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800731 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
734 reply.writeNoException();
735 reply.writeTypedList(list);
736 return true;
737 }
738
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700739 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
740 data.enforceInterface(IActivityManager.descriptor);
741 List<ApplicationInfo> list = getRunningExternalApplications();
742 reply.writeNoException();
743 reply.writeTypedList(list);
744 return true;
745 }
746
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800747 case MOVE_TASK_TO_FRONT_TRANSACTION: {
748 data.enforceInterface(IActivityManager.descriptor);
749 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800750 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700751 Bundle options = data.readInt() != 0
752 ? Bundle.CREATOR.createFromParcel(data) : null;
753 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800754 reply.writeNoException();
755 return true;
756 }
757
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800758 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
759 data.enforceInterface(IActivityManager.descriptor);
760 IBinder token = data.readStrongBinder();
761 boolean nonRoot = data.readInt() != 0;
762 boolean res = moveActivityTaskToBack(token, nonRoot);
763 reply.writeNoException();
764 reply.writeInt(res ? 1 : 0);
765 return true;
766 }
767
768 case MOVE_TASK_BACKWARDS_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 int task = data.readInt();
771 moveTaskBackwards(task);
772 reply.writeNoException();
773 return true;
774 }
775
Craig Mautnerc00204b2013-03-05 15:02:14 -0800776 case MOVE_TASK_TO_STACK_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 int taskId = data.readInt();
779 int stackId = data.readInt();
780 boolean toTop = data.readInt() != 0;
781 moveTaskToStack(taskId, stackId, toTop);
782 reply.writeNoException();
783 return true;
784 }
785
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700786 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 int taskId = data.readInt();
789 int createMode = data.readInt();
790 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800791 boolean animate = data.readInt() != 0;
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -0800792 Rect bounds = null;
793 boolean hasBounds = data.readInt() != 0;
794 if (hasBounds) {
795 bounds = Rect.CREATOR.createFromParcel(data);
796 }
Chong Zhange4fbd322016-03-01 14:44:03 -0800797 boolean res = moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700798 reply.writeNoException();
Chong Zhange4fbd322016-03-01 14:44:03 -0800799 reply.writeInt(res ? 1 : 0);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700800 return true;
801 }
802
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700803 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700804 data.enforceInterface(IActivityManager.descriptor);
805 final int stackId = data.readInt();
806 final Rect r = Rect.CREATOR.createFromParcel(data);
807 final boolean res = moveTopActivityToPinnedStack(stackId, r);
808 reply.writeNoException();
809 reply.writeInt(res ? 1 : 0);
810 return true;
811 }
812
Craig Mautnerc00204b2013-03-05 15:02:14 -0800813 case RESIZE_STACK_TRANSACTION: {
814 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700815 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100816 final boolean hasRect = data.readInt() != 0;
817 Rect r = null;
818 if (hasRect) {
819 r = Rect.CREATOR.createFromParcel(data);
820 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700821 final boolean allowResizeInDockedMode = data.readInt() == 1;
Filip Gruszczynski84fa3352016-01-25 16:28:49 -0800822 final boolean preserveWindows = data.readInt() == 1;
823 final boolean animate = data.readInt() == 1;
Wale Ogunwalee75a9ad2016-03-18 20:43:49 -0700824 final int animationDuration = data.readInt();
825 resizeStack(stackId,
826 r, allowResizeInDockedMode, preserveWindows, animate, animationDuration);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800827 reply.writeNoException();
828 return true;
829 }
Robert Carr0d00c2e2016-02-29 17:45:02 -0800830 case RESIZE_PINNED_STACK_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 final boolean hasBounds = data.readInt() != 0;
833 Rect bounds = null;
834 if (hasBounds) {
835 bounds = Rect.CREATOR.createFromParcel(data);
836 }
837 final boolean hasTempPinnedTaskBounds = data.readInt() != 0;
838 Rect tempPinnedTaskBounds = null;
839 if (hasTempPinnedTaskBounds) {
840 tempPinnedTaskBounds = Rect.CREATOR.createFromParcel(data);
841 }
842 resizePinnedStack(bounds, tempPinnedTaskBounds);
843 return true;
844 }
Jorim Jaggid47e7e12016-03-01 09:57:38 +0100845 case SWAP_DOCKED_AND_FULLSCREEN_STACK: {
846 data.enforceInterface(IActivityManager.descriptor);
847 swapDockedAndFullscreenStack();
848 reply.writeNoException();
849 return true;
850 }
Jorim Jaggidc249c42015-12-15 14:57:31 -0800851 case RESIZE_DOCKED_STACK_TRANSACTION: {
852 data.enforceInterface(IActivityManager.descriptor);
853 final boolean hasBounds = data.readInt() != 0;
854 Rect bounds = null;
855 if (hasBounds) {
856 bounds = Rect.CREATOR.createFromParcel(data);
857 }
858 final boolean hasTempDockedTaskBounds = data.readInt() != 0;
859 Rect tempDockedTaskBounds = null;
860 if (hasTempDockedTaskBounds) {
861 tempDockedTaskBounds = Rect.CREATOR.createFromParcel(data);
862 }
863 final boolean hasTempDockedTaskInsetBounds = data.readInt() != 0;
864 Rect tempDockedTaskInsetBounds = null;
865 if (hasTempDockedTaskInsetBounds) {
866 tempDockedTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
867 }
868 final boolean hasTempOtherTaskBounds = data.readInt() != 0;
869 Rect tempOtherTaskBounds = null;
870 if (hasTempOtherTaskBounds) {
871 tempOtherTaskBounds = Rect.CREATOR.createFromParcel(data);
872 }
873 final boolean hasTempOtherTaskInsetBounds = data.readInt() != 0;
874 Rect tempOtherTaskInsetBounds = null;
875 if (hasTempOtherTaskInsetBounds) {
876 tempOtherTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
877 }
878 resizeDockedStack(bounds, tempDockedTaskBounds, tempDockedTaskInsetBounds,
879 tempOtherTaskBounds, tempOtherTaskInsetBounds);
880 reply.writeNoException();
881 return true;
882 }
883
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700884 case POSITION_TASK_IN_STACK_TRANSACTION: {
885 data.enforceInterface(IActivityManager.descriptor);
886 int taskId = data.readInt();
887 int stackId = data.readInt();
888 int position = data.readInt();
889 positionTaskInStack(taskId, stackId, position);
890 reply.writeNoException();
891 return true;
892 }
893
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800894 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700895 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800896 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700897 reply.writeNoException();
898 reply.writeTypedList(list);
899 return true;
900 }
901
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800902 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700903 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800904 int stackId = data.readInt();
905 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700906 reply.writeNoException();
907 if (info != null) {
908 reply.writeInt(1);
909 info.writeToParcel(reply, 0);
910 } else {
911 reply.writeInt(0);
912 }
913 return true;
914 }
915
Winson Chung303e1ff2014-03-07 15:06:19 -0800916 case IS_IN_HOME_STACK_TRANSACTION: {
917 data.enforceInterface(IActivityManager.descriptor);
918 int taskId = data.readInt();
919 boolean isInHomeStack = isInHomeStack(taskId);
920 reply.writeNoException();
921 reply.writeInt(isInHomeStack ? 1 : 0);
922 return true;
923 }
924
Craig Mautnercf910b02013-04-23 11:23:27 -0700925 case SET_FOCUSED_STACK_TRANSACTION: {
926 data.enforceInterface(IActivityManager.descriptor);
927 int stackId = data.readInt();
928 setFocusedStack(stackId);
929 reply.writeNoException();
930 return true;
931 }
932
Winson Chungd16c5652015-01-26 16:11:07 -0800933 case GET_FOCUSED_STACK_ID_TRANSACTION: {
934 data.enforceInterface(IActivityManager.descriptor);
935 int focusedStackId = getFocusedStackId();
936 reply.writeNoException();
937 reply.writeInt(focusedStackId);
938 return true;
939 }
940
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700941 case SET_FOCUSED_TASK_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700944 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700945 reply.writeNoException();
946 return true;
947 }
948
Winson Chung740c3ac2014-11-12 16:14:38 -0800949 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
950 data.enforceInterface(IActivityManager.descriptor);
951 IBinder token = data.readStrongBinder();
952 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
953 reply.writeNoException();
954 return true;
955 }
956
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800957 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 IBinder token = data.readStrongBinder();
960 boolean onlyRoot = data.readInt() != 0;
961 int res = token != null
962 ? getTaskForActivity(token, onlyRoot) : -1;
963 reply.writeNoException();
964 reply.writeInt(res);
965 return true;
966 }
967
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800968 case GET_CONTENT_PROVIDER_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder b = data.readStrongBinder();
971 IApplicationThread app = ApplicationThreadNative.asInterface(b);
972 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700973 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700974 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700975 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800976 reply.writeNoException();
977 if (cph != null) {
978 reply.writeInt(1);
979 cph.writeToParcel(reply, 0);
980 } else {
981 reply.writeInt(0);
982 }
983 return true;
984 }
985
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800986 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700989 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800990 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700991 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800992 reply.writeNoException();
993 if (cph != null) {
994 reply.writeInt(1);
995 cph.writeToParcel(reply, 0);
996 } else {
997 reply.writeInt(0);
998 }
999 return true;
1000 }
1001
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001002 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
1003 data.enforceInterface(IActivityManager.descriptor);
1004 IBinder b = data.readStrongBinder();
1005 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1006 ArrayList<ContentProviderHolder> providers =
1007 data.createTypedArrayList(ContentProviderHolder.CREATOR);
1008 publishContentProviders(app, providers);
1009 reply.writeNoException();
1010 return true;
1011 }
1012
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001013 case REF_CONTENT_PROVIDER_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 IBinder b = data.readStrongBinder();
1016 int stable = data.readInt();
1017 int unstable = data.readInt();
1018 boolean res = refContentProvider(b, stable, unstable);
1019 reply.writeNoException();
1020 reply.writeInt(res ? 1 : 0);
1021 return true;
1022 }
1023
1024 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
1025 data.enforceInterface(IActivityManager.descriptor);
1026 IBinder b = data.readStrongBinder();
1027 unstableProviderDied(b);
1028 reply.writeNoException();
1029 return true;
1030 }
1031
Jeff Sharkey7aa76012013-09-30 14:26:27 -07001032 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
1033 data.enforceInterface(IActivityManager.descriptor);
1034 IBinder b = data.readStrongBinder();
1035 appNotRespondingViaProvider(b);
1036 reply.writeNoException();
1037 return true;
1038 }
1039
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001040 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001043 boolean stable = data.readInt() != 0;
1044 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001045 reply.writeNoException();
1046 return true;
1047 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08001048
1049 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 String name = data.readString();
1052 IBinder token = data.readStrongBinder();
1053 removeContentProviderExternal(name, token);
1054 reply.writeNoException();
1055 return true;
1056 }
1057
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001058 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
1061 PendingIntent pi = getRunningServiceControlPanel(comp);
1062 reply.writeNoException();
1063 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
1064 return true;
1065 }
1066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001067 case START_SERVICE_TRANSACTION: {
1068 data.enforceInterface(IActivityManager.descriptor);
1069 IBinder b = data.readStrongBinder();
1070 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1071 Intent service = Intent.CREATOR.createFromParcel(data);
1072 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001073 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001074 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001075 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001076 reply.writeNoException();
1077 ComponentName.writeToParcel(cn, reply);
1078 return true;
1079 }
1080
1081 case STOP_SERVICE_TRANSACTION: {
1082 data.enforceInterface(IActivityManager.descriptor);
1083 IBinder b = data.readStrongBinder();
1084 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1085 Intent service = Intent.CREATOR.createFromParcel(data);
1086 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001087 int userId = data.readInt();
1088 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001089 reply.writeNoException();
1090 reply.writeInt(res);
1091 return true;
1092 }
1093
1094 case STOP_SERVICE_TOKEN_TRANSACTION: {
1095 data.enforceInterface(IActivityManager.descriptor);
1096 ComponentName className = ComponentName.readFromParcel(data);
1097 IBinder token = data.readStrongBinder();
1098 int startId = data.readInt();
1099 boolean res = stopServiceToken(className, token, startId);
1100 reply.writeNoException();
1101 reply.writeInt(res ? 1 : 0);
1102 return true;
1103 }
1104
1105 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1106 data.enforceInterface(IActivityManager.descriptor);
1107 ComponentName className = ComponentName.readFromParcel(data);
1108 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001109 int id = data.readInt();
1110 Notification notification = null;
1111 if (data.readInt() != 0) {
1112 notification = Notification.CREATOR.createFromParcel(data);
1113 }
1114 boolean removeNotification = data.readInt() != 0;
1115 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001116 reply.writeNoException();
1117 return true;
1118 }
1119
1120 case BIND_SERVICE_TRANSACTION: {
1121 data.enforceInterface(IActivityManager.descriptor);
1122 IBinder b = data.readStrongBinder();
1123 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1124 IBinder token = data.readStrongBinder();
1125 Intent service = Intent.CREATOR.createFromParcel(data);
1126 String resolvedType = data.readString();
1127 b = data.readStrongBinder();
1128 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001129 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001130 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001131 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001132 int res = bindService(app, token, service, resolvedType, conn, fl,
1133 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001134 reply.writeNoException();
1135 reply.writeInt(res);
1136 return true;
1137 }
1138
1139 case UNBIND_SERVICE_TRANSACTION: {
1140 data.enforceInterface(IActivityManager.descriptor);
1141 IBinder b = data.readStrongBinder();
1142 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1143 boolean res = unbindService(conn);
1144 reply.writeNoException();
1145 reply.writeInt(res ? 1 : 0);
1146 return true;
1147 }
1148
1149 case PUBLISH_SERVICE_TRANSACTION: {
1150 data.enforceInterface(IActivityManager.descriptor);
1151 IBinder token = data.readStrongBinder();
1152 Intent intent = Intent.CREATOR.createFromParcel(data);
1153 IBinder service = data.readStrongBinder();
1154 publishService(token, intent, service);
1155 reply.writeNoException();
1156 return true;
1157 }
1158
1159 case UNBIND_FINISHED_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 IBinder token = data.readStrongBinder();
1162 Intent intent = Intent.CREATOR.createFromParcel(data);
1163 boolean doRebind = data.readInt() != 0;
1164 unbindFinished(token, intent, doRebind);
1165 reply.writeNoException();
1166 return true;
1167 }
1168
1169 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1170 data.enforceInterface(IActivityManager.descriptor);
1171 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001172 int type = data.readInt();
1173 int startId = data.readInt();
1174 int res = data.readInt();
1175 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 reply.writeNoException();
1177 return true;
1178 }
1179
1180 case START_INSTRUMENTATION_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 ComponentName className = ComponentName.readFromParcel(data);
1183 String profileFile = data.readString();
1184 int fl = data.readInt();
1185 Bundle arguments = data.readBundle();
1186 IBinder b = data.readStrongBinder();
1187 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001188 b = data.readStrongBinder();
1189 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001190 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001191 String abiOverride = data.readString();
1192 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1193 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 reply.writeNoException();
1195 reply.writeInt(res ? 1 : 0);
1196 return true;
1197 }
1198
1199
1200 case FINISH_INSTRUMENTATION_TRANSACTION: {
1201 data.enforceInterface(IActivityManager.descriptor);
1202 IBinder b = data.readStrongBinder();
1203 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1204 int resultCode = data.readInt();
1205 Bundle results = data.readBundle();
1206 finishInstrumentation(app, resultCode, results);
1207 reply.writeNoException();
1208 return true;
1209 }
1210
1211 case GET_CONFIGURATION_TRANSACTION: {
1212 data.enforceInterface(IActivityManager.descriptor);
1213 Configuration config = getConfiguration();
1214 reply.writeNoException();
1215 config.writeToParcel(reply, 0);
1216 return true;
1217 }
1218
1219 case UPDATE_CONFIGURATION_TRANSACTION: {
1220 data.enforceInterface(IActivityManager.descriptor);
1221 Configuration config = Configuration.CREATOR.createFromParcel(data);
1222 updateConfiguration(config);
1223 reply.writeNoException();
1224 return true;
1225 }
1226
1227 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 IBinder token = data.readStrongBinder();
1230 int requestedOrientation = data.readInt();
1231 setRequestedOrientation(token, requestedOrientation);
1232 reply.writeNoException();
1233 return true;
1234 }
1235
1236 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1237 data.enforceInterface(IActivityManager.descriptor);
1238 IBinder token = data.readStrongBinder();
1239 int req = getRequestedOrientation(token);
1240 reply.writeNoException();
1241 reply.writeInt(req);
1242 return true;
1243 }
1244
1245 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1246 data.enforceInterface(IActivityManager.descriptor);
1247 IBinder token = data.readStrongBinder();
1248 ComponentName cn = getActivityClassForToken(token);
1249 reply.writeNoException();
1250 ComponentName.writeToParcel(cn, reply);
1251 return true;
1252 }
1253
1254 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
1256 IBinder token = data.readStrongBinder();
1257 reply.writeNoException();
1258 reply.writeString(getPackageForToken(token));
1259 return true;
1260 }
1261
1262 case GET_INTENT_SENDER_TRANSACTION: {
1263 data.enforceInterface(IActivityManager.descriptor);
1264 int type = data.readInt();
1265 String packageName = data.readString();
1266 IBinder token = data.readStrongBinder();
1267 String resultWho = data.readString();
1268 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001269 Intent[] requestIntents;
1270 String[] requestResolvedTypes;
1271 if (data.readInt() != 0) {
1272 requestIntents = data.createTypedArray(Intent.CREATOR);
1273 requestResolvedTypes = data.createStringArray();
1274 } else {
1275 requestIntents = null;
1276 requestResolvedTypes = null;
1277 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001279 Bundle options = data.readInt() != 0
1280 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001281 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001282 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001283 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001284 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 reply.writeNoException();
1286 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1287 return true;
1288 }
1289
1290 case CANCEL_INTENT_SENDER_TRANSACTION: {
1291 data.enforceInterface(IActivityManager.descriptor);
1292 IIntentSender r = IIntentSender.Stub.asInterface(
1293 data.readStrongBinder());
1294 cancelIntentSender(r);
1295 reply.writeNoException();
1296 return true;
1297 }
1298
1299 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1300 data.enforceInterface(IActivityManager.descriptor);
1301 IIntentSender r = IIntentSender.Stub.asInterface(
1302 data.readStrongBinder());
1303 String res = getPackageForIntentSender(r);
1304 reply.writeNoException();
1305 reply.writeString(res);
1306 return true;
1307 }
1308
Christopher Tatec4a07d12012-04-06 14:19:13 -07001309 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 IIntentSender r = IIntentSender.Stub.asInterface(
1312 data.readStrongBinder());
1313 int res = getUidForIntentSender(r);
1314 reply.writeNoException();
1315 reply.writeInt(res);
1316 return true;
1317 }
1318
Dianne Hackborn41203752012-08-31 14:05:51 -07001319 case HANDLE_INCOMING_USER_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 int callingPid = data.readInt();
1322 int callingUid = data.readInt();
1323 int userId = data.readInt();
1324 boolean allowAll = data.readInt() != 0 ;
1325 boolean requireFull = data.readInt() != 0;
1326 String name = data.readString();
1327 String callerPackage = data.readString();
1328 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1329 requireFull, name, callerPackage);
1330 reply.writeNoException();
1331 reply.writeInt(res);
1332 return true;
1333 }
1334
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001335 case SET_PROCESS_LIMIT_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 int max = data.readInt();
1338 setProcessLimit(max);
1339 reply.writeNoException();
1340 return true;
1341 }
1342
1343 case GET_PROCESS_LIMIT_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
1345 int limit = getProcessLimit();
1346 reply.writeNoException();
1347 reply.writeInt(limit);
1348 return true;
1349 }
1350
1351 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1352 data.enforceInterface(IActivityManager.descriptor);
1353 IBinder token = data.readStrongBinder();
1354 int pid = data.readInt();
1355 boolean isForeground = data.readInt() != 0;
1356 setProcessForeground(token, pid, isForeground);
1357 reply.writeNoException();
1358 return true;
1359 }
1360
1361 case CHECK_PERMISSION_TRANSACTION: {
1362 data.enforceInterface(IActivityManager.descriptor);
1363 String perm = data.readString();
1364 int pid = data.readInt();
1365 int uid = data.readInt();
1366 int res = checkPermission(perm, pid, uid);
1367 reply.writeNoException();
1368 reply.writeInt(res);
1369 return true;
1370 }
1371
Dianne Hackbornff170242014-11-19 10:59:01 -08001372 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 String perm = data.readString();
1375 int pid = data.readInt();
1376 int uid = data.readInt();
1377 IBinder token = data.readStrongBinder();
1378 int res = checkPermissionWithToken(perm, pid, uid, token);
1379 reply.writeNoException();
1380 reply.writeInt(res);
1381 return true;
1382 }
1383
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 case CHECK_URI_PERMISSION_TRANSACTION: {
1385 data.enforceInterface(IActivityManager.descriptor);
1386 Uri uri = Uri.CREATOR.createFromParcel(data);
1387 int pid = data.readInt();
1388 int uid = data.readInt();
1389 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001390 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001391 IBinder callerToken = data.readStrongBinder();
1392 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001393 reply.writeNoException();
1394 reply.writeInt(res);
1395 return true;
1396 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001397
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001398 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001399 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001400 String packageName = data.readString();
1401 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1402 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001403 int userId = data.readInt();
1404 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001405 reply.writeNoException();
1406 reply.writeInt(res ? 1 : 0);
1407 return true;
1408 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001409
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001410 case GRANT_URI_PERMISSION_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 IBinder b = data.readStrongBinder();
1413 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1414 String targetPkg = data.readString();
1415 Uri uri = Uri.CREATOR.createFromParcel(data);
1416 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001417 int userId = data.readInt();
1418 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001419 reply.writeNoException();
1420 return true;
1421 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001422
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001423 case REVOKE_URI_PERMISSION_TRANSACTION: {
1424 data.enforceInterface(IActivityManager.descriptor);
1425 IBinder b = data.readStrongBinder();
1426 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1427 Uri uri = Uri.CREATOR.createFromParcel(data);
1428 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001429 int userId = data.readInt();
1430 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001431 reply.writeNoException();
1432 return true;
1433 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001434
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001435 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1436 data.enforceInterface(IActivityManager.descriptor);
1437 Uri uri = Uri.CREATOR.createFromParcel(data);
1438 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001439 int userId = data.readInt();
1440 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001441 reply.writeNoException();
1442 return true;
1443 }
1444
1445 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 Uri uri = Uri.CREATOR.createFromParcel(data);
1448 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001449 int userId = data.readInt();
1450 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001451 reply.writeNoException();
1452 return true;
1453 }
1454
1455 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1456 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001457 final String packageName = data.readString();
1458 final boolean incoming = data.readInt() != 0;
1459 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1460 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001461 reply.writeNoException();
1462 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1463 return true;
1464 }
1465
Felipe Lemef3fa0f82016-01-07 12:08:19 -08001466 case GET_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1467 data.enforceInterface(IActivityManager.descriptor);
1468 final String packageName = data.readString();
1469 final int userId = data.readInt();
1470 final ParceledListSlice<UriPermission> perms = getGrantedUriPermissions(packageName,
1471 userId);
1472 reply.writeNoException();
1473 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1474 return true;
1475 }
1476
1477 case CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1478 data.enforceInterface(IActivityManager.descriptor);
1479 final String packageName = data.readString();
1480 final int userId = data.readInt();
1481 clearGrantedUriPermissions(packageName, userId);
1482 reply.writeNoException();
1483 return true;
1484 }
1485
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001486 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1487 data.enforceInterface(IActivityManager.descriptor);
1488 IBinder b = data.readStrongBinder();
1489 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1490 boolean waiting = data.readInt() != 0;
1491 showWaitingForDebugger(app, waiting);
1492 reply.writeNoException();
1493 return true;
1494 }
1495
1496 case GET_MEMORY_INFO_TRANSACTION: {
1497 data.enforceInterface(IActivityManager.descriptor);
1498 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1499 getMemoryInfo(mi);
1500 reply.writeNoException();
1501 mi.writeToParcel(reply, 0);
1502 return true;
1503 }
1504
1505 case UNHANDLED_BACK_TRANSACTION: {
1506 data.enforceInterface(IActivityManager.descriptor);
1507 unhandledBack();
1508 reply.writeNoException();
1509 return true;
1510 }
1511
1512 case OPEN_CONTENT_URI_TRANSACTION: {
1513 data.enforceInterface(IActivityManager.descriptor);
1514 Uri uri = Uri.parse(data.readString());
1515 ParcelFileDescriptor pfd = openContentUri(uri);
1516 reply.writeNoException();
1517 if (pfd != null) {
1518 reply.writeInt(1);
1519 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1520 } else {
1521 reply.writeInt(0);
1522 }
1523 return true;
1524 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001525
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001526 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1527 data.enforceInterface(IActivityManager.descriptor);
1528 setLockScreenShown(data.readInt() != 0);
1529 reply.writeNoException();
1530 return true;
1531 }
1532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001533 case SET_DEBUG_APP_TRANSACTION: {
1534 data.enforceInterface(IActivityManager.descriptor);
1535 String pn = data.readString();
1536 boolean wfd = data.readInt() != 0;
1537 boolean per = data.readInt() != 0;
1538 setDebugApp(pn, wfd, per);
1539 reply.writeNoException();
1540 return true;
1541 }
1542
1543 case SET_ALWAYS_FINISH_TRANSACTION: {
1544 data.enforceInterface(IActivityManager.descriptor);
1545 boolean enabled = data.readInt() != 0;
1546 setAlwaysFinish(enabled);
1547 reply.writeNoException();
1548 return true;
1549 }
1550
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001551 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001552 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001553 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001554 data.readStrongBinder());
Dianne Hackborn4a18c262016-02-26 17:23:48 -08001555 boolean imAMonkey = data.readInt() != 0;
1556 setActivityController(watcher, imAMonkey);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001557 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001558 return true;
1559 }
1560
Dianne Hackbornb2117d12016-02-16 18:26:35 -08001561 case SET_LENIENT_BACKGROUND_CHECK_TRANSACTION: {
1562 data.enforceInterface(IActivityManager.descriptor);
1563 boolean enabled = data.readInt() != 0;
1564 setLenientBackgroundCheck(enabled);
1565 reply.writeNoException();
1566 return true;
1567 }
1568
Dianne Hackborn970510b2016-02-24 16:56:42 -08001569 case GET_MEMORY_TRIM_LEVEL_TRANSACTION: {
1570 data.enforceInterface(IActivityManager.descriptor);
1571 int level = getMemoryTrimLevel();
1572 reply.writeNoException();
1573 reply.writeInt(level);
1574 return true;
1575 }
1576
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001577 case ENTER_SAFE_MODE_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 enterSafeMode();
1580 reply.writeNoException();
1581 return true;
1582 }
1583
1584 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1585 data.enforceInterface(IActivityManager.descriptor);
1586 IIntentSender is = IIntentSender.Stub.asInterface(
1587 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001588 int sourceUid = data.readInt();
1589 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001590 String tag = data.readString();
1591 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1592 reply.writeNoException();
1593 return true;
1594 }
1595
1596 case NOTE_ALARM_START_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 IIntentSender is = IIntentSender.Stub.asInterface(
1599 data.readStrongBinder());
1600 int sourceUid = data.readInt();
1601 String tag = data.readString();
1602 noteAlarmStart(is, sourceUid, tag);
1603 reply.writeNoException();
1604 return true;
1605 }
1606
1607 case NOTE_ALARM_FINISH_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 IIntentSender is = IIntentSender.Stub.asInterface(
1610 data.readStrongBinder());
1611 int sourceUid = data.readInt();
1612 String tag = data.readString();
1613 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001614 reply.writeNoException();
1615 return true;
1616 }
1617
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001618 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001619 data.enforceInterface(IActivityManager.descriptor);
1620 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001621 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001622 boolean secure = data.readInt() != 0;
1623 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001624 reply.writeNoException();
1625 reply.writeInt(res ? 1 : 0);
1626 return true;
1627 }
1628
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001629 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 String reason = data.readString();
1632 boolean res = killProcessesBelowForeground(reason);
1633 reply.writeNoException();
1634 reply.writeInt(res ? 1 : 0);
1635 return true;
1636 }
1637
Dan Egnor60d87622009-12-16 16:32:58 -08001638 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 IBinder app = data.readStrongBinder();
1641 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1642 handleApplicationCrash(app, ci);
1643 reply.writeNoException();
1644 return true;
1645 }
1646
1647 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001648 data.enforceInterface(IActivityManager.descriptor);
1649 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001650 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001651 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001652 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001653 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001654 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001655 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001656 return true;
1657 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001658
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001659 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001662 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001663 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1664 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001665 reply.writeNoException();
1666 return true;
1667 }
1668
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001669 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1670 data.enforceInterface(IActivityManager.descriptor);
1671 int sig = data.readInt();
1672 signalPersistentProcesses(sig);
1673 reply.writeNoException();
1674 return true;
1675 }
1676
Dianne Hackborn03abb812010-01-04 18:43:19 -08001677 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1678 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001679 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001680 int userId = data.readInt();
1681 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001682 reply.writeNoException();
1683 return true;
1684 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001685
1686 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 killAllBackgroundProcesses();
1689 reply.writeNoException();
1690 return true;
1691 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001692
Gustav Sennton6258dcd2015-10-30 19:25:37 +00001693 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: {
1694 data.enforceInterface(IActivityManager.descriptor);
1695 String packageName = data.readString();
1696 int userId = data.readInt();
1697 killPackageDependents(packageName, userId);
1698 reply.writeNoException();
1699 return true;
1700 }
1701
Dianne Hackborn03abb812010-01-04 18:43:19 -08001702 case FORCE_STOP_PACKAGE_TRANSACTION: {
1703 data.enforceInterface(IActivityManager.descriptor);
1704 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001705 int userId = data.readInt();
1706 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001707 reply.writeNoException();
1708 return true;
1709 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001710
1711 case GET_MY_MEMORY_STATE_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
1713 ActivityManager.RunningAppProcessInfo info =
1714 new ActivityManager.RunningAppProcessInfo();
1715 getMyMemoryState(info);
1716 reply.writeNoException();
1717 info.writeToParcel(reply, 0);
1718 return true;
1719 }
1720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001721 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1722 data.enforceInterface(IActivityManager.descriptor);
1723 ConfigurationInfo config = getDeviceConfigurationInfo();
1724 reply.writeNoException();
1725 config.writeToParcel(reply, 0);
1726 return true;
1727 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001728
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001729 case PROFILE_CONTROL_TRANSACTION: {
1730 data.enforceInterface(IActivityManager.descriptor);
1731 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001732 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001733 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001734 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001735 ProfilerInfo profilerInfo = data.readInt() != 0
1736 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1737 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001738 reply.writeNoException();
1739 reply.writeInt(res ? 1 : 0);
1740 return true;
1741 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001742
Dianne Hackborn55280a92009-05-07 15:53:46 -07001743 case SHUTDOWN_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 boolean res = shutdown(data.readInt());
1746 reply.writeNoException();
1747 reply.writeInt(res ? 1 : 0);
1748 return true;
1749 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001750
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001751 case STOP_APP_SWITCHES_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 stopAppSwitches();
1754 reply.writeNoException();
1755 return true;
1756 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001757
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001758 case RESUME_APP_SWITCHES_TRANSACTION: {
1759 data.enforceInterface(IActivityManager.descriptor);
1760 resumeAppSwitches();
1761 reply.writeNoException();
1762 return true;
1763 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001764
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001765 case PEEK_SERVICE_TRANSACTION: {
1766 data.enforceInterface(IActivityManager.descriptor);
1767 Intent service = Intent.CREATOR.createFromParcel(data);
1768 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001769 String callingPackage = data.readString();
1770 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001771 reply.writeNoException();
1772 reply.writeStrongBinder(binder);
1773 return true;
1774 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001775
Christopher Tate181fafa2009-05-14 11:12:14 -07001776 case START_BACKUP_AGENT_TRANSACTION: {
1777 data.enforceInterface(IActivityManager.descriptor);
1778 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1779 int backupRestoreMode = data.readInt();
1780 boolean success = bindBackupAgent(info, backupRestoreMode);
1781 reply.writeNoException();
1782 reply.writeInt(success ? 1 : 0);
1783 return true;
1784 }
1785
1786 case BACKUP_AGENT_CREATED_TRANSACTION: {
1787 data.enforceInterface(IActivityManager.descriptor);
1788 String packageName = data.readString();
1789 IBinder agent = data.readStrongBinder();
1790 backupAgentCreated(packageName, agent);
1791 reply.writeNoException();
1792 return true;
1793 }
1794
1795 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1796 data.enforceInterface(IActivityManager.descriptor);
1797 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1798 unbindBackupAgent(info);
1799 reply.writeNoException();
1800 return true;
1801 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001802
1803 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1804 data.enforceInterface(IActivityManager.descriptor);
1805 String packageName = data.readString();
1806 addPackageDependency(packageName);
1807 reply.writeNoException();
1808 return true;
1809 }
1810
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001811 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001812 data.enforceInterface(IActivityManager.descriptor);
1813 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001814 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001815 String reason = data.readString();
1816 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001817 reply.writeNoException();
1818 return true;
1819 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001820
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001821 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1822 data.enforceInterface(IActivityManager.descriptor);
1823 String reason = data.readString();
1824 closeSystemDialogs(reason);
1825 reply.writeNoException();
1826 return true;
1827 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001828
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001829 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001831 int[] pids = data.createIntArray();
1832 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001833 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001834 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001835 return true;
1836 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001837
1838 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1839 data.enforceInterface(IActivityManager.descriptor);
1840 String processName = data.readString();
1841 int uid = data.readInt();
1842 killApplicationProcess(processName, uid);
1843 reply.writeNoException();
1844 return true;
1845 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001846
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001847 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1848 data.enforceInterface(IActivityManager.descriptor);
1849 IBinder token = data.readStrongBinder();
1850 String packageName = data.readString();
1851 int enterAnim = data.readInt();
1852 int exitAnim = data.readInt();
1853 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001854 reply.writeNoException();
1855 return true;
1856 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001857
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001858 case IS_USER_A_MONKEY_TRANSACTION: {
1859 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001860 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001861 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001862 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001863 return true;
1864 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001865
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001866 case SET_USER_IS_MONKEY_TRANSACTION: {
1867 data.enforceInterface(IActivityManager.descriptor);
1868 final boolean monkey = (data.readInt() == 1);
1869 setUserIsMonkey(monkey);
1870 reply.writeNoException();
1871 return true;
1872 }
1873
Dianne Hackborn860755f2010-06-03 18:47:52 -07001874 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1875 data.enforceInterface(IActivityManager.descriptor);
1876 finishHeavyWeightApp();
1877 reply.writeNoException();
1878 return true;
1879 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001880
1881 case IS_IMMERSIVE_TRANSACTION: {
1882 data.enforceInterface(IActivityManager.descriptor);
1883 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001884 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001885 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001886 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001887 return true;
1888 }
1889
Craig Mautnerd61dc202014-07-07 11:09:11 -07001890 case IS_TOP_OF_TASK_TRANSACTION: {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 IBinder token = data.readStrongBinder();
1893 final boolean isTopOfTask = isTopOfTask(token);
1894 reply.writeNoException();
1895 reply.writeInt(isTopOfTask ? 1 : 0);
1896 return true;
1897 }
1898
Craig Mautner5eda9b32013-07-02 11:58:16 -07001899 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001900 data.enforceInterface(IActivityManager.descriptor);
1901 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001902 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001903 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001904 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001905 return true;
1906 }
1907
1908 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001911 final Bundle bundle;
1912 if (data.readInt() == 0) {
1913 bundle = null;
1914 } else {
1915 bundle = data.readBundle();
1916 }
Chong Zhang280d3322015-11-03 17:27:26 -08001917 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001918 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001919 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001920 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001921 return true;
1922 }
1923
Craig Mautner233ceee2014-05-09 17:05:11 -07001924 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 IBinder token = data.readStrongBinder();
1927 final ActivityOptions options = getActivityOptions(token);
1928 reply.writeNoException();
1929 reply.writeBundle(options == null ? null : options.toBundle());
1930 return true;
1931 }
1932
Daniel Sandler69a48172010-06-23 16:29:36 -04001933 case SET_IMMERSIVE_TRANSACTION: {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 IBinder token = data.readStrongBinder();
1936 boolean imm = data.readInt() == 1;
1937 setImmersive(token, imm);
1938 reply.writeNoException();
1939 return true;
1940 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001941
Daniel Sandler69a48172010-06-23 16:29:36 -04001942 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001944 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001945 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001946 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001947 return true;
1948 }
1949
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001950 case CRASH_APPLICATION_TRANSACTION: {
1951 data.enforceInterface(IActivityManager.descriptor);
1952 int uid = data.readInt();
1953 int initialPid = data.readInt();
1954 String packageName = data.readString();
1955 String message = data.readString();
1956 crashApplication(uid, initialPid, packageName, message);
1957 reply.writeNoException();
1958 return true;
1959 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001960
1961 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1962 data.enforceInterface(IActivityManager.descriptor);
1963 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001964 int userId = data.readInt();
1965 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001966 reply.writeNoException();
1967 reply.writeString(type);
1968 return true;
1969 }
1970
Dianne Hackborn7e269642010-08-25 19:50:20 -07001971 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1972 data.enforceInterface(IActivityManager.descriptor);
1973 String name = data.readString();
1974 IBinder perm = newUriPermissionOwner(name);
1975 reply.writeNoException();
1976 reply.writeStrongBinder(perm);
1977 return true;
1978 }
1979
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08001980 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: {
1981 data.enforceInterface(IActivityManager.descriptor);
1982 IBinder activityToken = data.readStrongBinder();
1983 IBinder perm = getUriPermissionOwnerForActivity(activityToken);
1984 reply.writeNoException();
1985 reply.writeStrongBinder(perm);
1986 return true;
1987 }
1988
Dianne Hackborn7e269642010-08-25 19:50:20 -07001989 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1990 data.enforceInterface(IActivityManager.descriptor);
1991 IBinder owner = data.readStrongBinder();
1992 int fromUid = data.readInt();
1993 String targetPkg = data.readString();
1994 Uri uri = Uri.CREATOR.createFromParcel(data);
1995 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001996 int sourceUserId = data.readInt();
1997 int targetUserId = data.readInt();
1998 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1999 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07002000 reply.writeNoException();
2001 return true;
2002 }
2003
2004 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
2005 data.enforceInterface(IActivityManager.descriptor);
2006 IBinder owner = data.readStrongBinder();
2007 Uri uri = null;
2008 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01002009 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07002010 }
2011 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01002012 int userId = data.readInt();
2013 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07002014 reply.writeNoException();
2015 return true;
2016 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07002017
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07002018 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 int callingUid = data.readInt();
2021 String targetPkg = data.readString();
2022 Uri uri = Uri.CREATOR.createFromParcel(data);
2023 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01002024 int userId = data.readInt();
2025 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07002026 reply.writeNoException();
2027 reply.writeInt(res);
2028 return true;
2029 }
2030
Andy McFadden824c5102010-07-09 16:26:57 -07002031 case DUMP_HEAP_TRANSACTION: {
2032 data.enforceInterface(IActivityManager.descriptor);
2033 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07002034 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07002035 boolean managed = data.readInt() != 0;
2036 String path = data.readString();
2037 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07002038 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07002039 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07002040 reply.writeNoException();
2041 reply.writeInt(res ? 1 : 0);
2042 return true;
2043 }
2044
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002045 case START_ACTIVITIES_TRANSACTION:
2046 {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 IBinder b = data.readStrongBinder();
2049 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002050 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002051 Intent[] intents = data.createTypedArray(Intent.CREATOR);
2052 String[] resolvedTypes = data.createStringArray();
2053 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07002054 Bundle options = data.readInt() != 0
2055 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002056 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002057 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002058 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002059 reply.writeNoException();
2060 reply.writeInt(result);
2061 return true;
2062 }
2063
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002064 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2065 {
2066 data.enforceInterface(IActivityManager.descriptor);
2067 int mode = getFrontActivityScreenCompatMode();
2068 reply.writeNoException();
2069 reply.writeInt(mode);
2070 return true;
2071 }
2072
2073 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2074 {
2075 data.enforceInterface(IActivityManager.descriptor);
2076 int mode = data.readInt();
2077 setFrontActivityScreenCompatMode(mode);
2078 reply.writeNoException();
2079 reply.writeInt(mode);
2080 return true;
2081 }
2082
2083 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2084 {
2085 data.enforceInterface(IActivityManager.descriptor);
2086 String pkg = data.readString();
2087 int mode = getPackageScreenCompatMode(pkg);
2088 reply.writeNoException();
2089 reply.writeInt(mode);
2090 return true;
2091 }
2092
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002093 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2094 {
2095 data.enforceInterface(IActivityManager.descriptor);
2096 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002097 int mode = data.readInt();
2098 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002099 reply.writeNoException();
2100 return true;
2101 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002102
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002103 case SWITCH_USER_TRANSACTION: {
2104 data.enforceInterface(IActivityManager.descriptor);
2105 int userid = data.readInt();
2106 boolean result = switchUser(userid);
2107 reply.writeNoException();
2108 reply.writeInt(result ? 1 : 0);
2109 return true;
2110 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07002111
Kenny Guy08488bf2014-02-21 17:40:37 +00002112 case START_USER_IN_BACKGROUND_TRANSACTION: {
2113 data.enforceInterface(IActivityManager.descriptor);
2114 int userid = data.readInt();
2115 boolean result = startUserInBackground(userid);
2116 reply.writeNoException();
2117 reply.writeInt(result ? 1 : 0);
2118 return true;
2119 }
2120
Jeff Sharkeyba512352015-11-12 20:17:45 -08002121 case UNLOCK_USER_TRANSACTION: {
2122 data.enforceInterface(IActivityManager.descriptor);
2123 int userId = data.readInt();
2124 byte[] token = data.createByteArray();
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00002125 byte[] secret = data.createByteArray();
Jeff Sharkeybd91e2f2016-03-22 15:32:31 -06002126 IProgressListener listener = IProgressListener.Stub
2127 .asInterface(data.readStrongBinder());
2128 boolean result = unlockUser(userId, token, secret, listener);
Jeff Sharkeyba512352015-11-12 20:17:45 -08002129 reply.writeNoException();
2130 reply.writeInt(result ? 1 : 0);
2131 return true;
2132 }
2133
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002134 case STOP_USER_TRANSACTION: {
2135 data.enforceInterface(IActivityManager.descriptor);
2136 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002137 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002138 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2139 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002140 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002141 reply.writeNoException();
2142 reply.writeInt(result);
2143 return true;
2144 }
2145
Amith Yamasani52f1d752012-03-28 18:19:29 -07002146 case GET_CURRENT_USER_TRANSACTION: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 UserInfo userInfo = getCurrentUser();
2149 reply.writeNoException();
2150 userInfo.writeToParcel(reply, 0);
2151 return true;
2152 }
2153
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002154 case IS_USER_RUNNING_TRANSACTION: {
2155 data.enforceInterface(IActivityManager.descriptor);
2156 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002157 int _flags = data.readInt();
2158 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002159 reply.writeNoException();
2160 reply.writeInt(result ? 1 : 0);
2161 return true;
2162 }
2163
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002164 case GET_RUNNING_USER_IDS_TRANSACTION: {
2165 data.enforceInterface(IActivityManager.descriptor);
2166 int[] result = getRunningUserIds();
2167 reply.writeNoException();
2168 reply.writeIntArray(result);
2169 return true;
2170 }
2171
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002172 case REMOVE_TASK_TRANSACTION:
2173 {
2174 data.enforceInterface(IActivityManager.descriptor);
2175 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002176 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002177 reply.writeNoException();
2178 reply.writeInt(result ? 1 : 0);
2179 return true;
2180 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002181
Jeff Sharkeya4620792011-05-20 15:29:23 -07002182 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2183 data.enforceInterface(IActivityManager.descriptor);
2184 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2185 data.readStrongBinder());
2186 registerProcessObserver(observer);
2187 return true;
2188 }
2189
2190 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2191 data.enforceInterface(IActivityManager.descriptor);
2192 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2193 data.readStrongBinder());
2194 unregisterProcessObserver(observer);
2195 return true;
2196 }
2197
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002198 case REGISTER_UID_OBSERVER_TRANSACTION: {
2199 data.enforceInterface(IActivityManager.descriptor);
2200 IUidObserver observer = IUidObserver.Stub.asInterface(
2201 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002202 int which = data.readInt();
2203 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002204 return true;
2205 }
2206
2207 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2208 data.enforceInterface(IActivityManager.descriptor);
2209 IUidObserver observer = IUidObserver.Stub.asInterface(
2210 data.readStrongBinder());
2211 unregisterUidObserver(observer);
2212 return true;
2213 }
2214
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002215 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2216 {
2217 data.enforceInterface(IActivityManager.descriptor);
2218 String pkg = data.readString();
2219 boolean ask = getPackageAskScreenCompat(pkg);
2220 reply.writeNoException();
2221 reply.writeInt(ask ? 1 : 0);
2222 return true;
2223 }
2224
2225 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2226 {
2227 data.enforceInterface(IActivityManager.descriptor);
2228 String pkg = data.readString();
2229 boolean ask = data.readInt() != 0;
2230 setPackageAskScreenCompat(pkg, ask);
2231 reply.writeNoException();
2232 return true;
2233 }
2234
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002235 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2236 data.enforceInterface(IActivityManager.descriptor);
2237 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002238 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002239 boolean res = isIntentSenderTargetedToPackage(r);
2240 reply.writeNoException();
2241 reply.writeInt(res ? 1 : 0);
2242 return true;
2243 }
2244
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002245 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2246 data.enforceInterface(IActivityManager.descriptor);
2247 IIntentSender r = IIntentSender.Stub.asInterface(
2248 data.readStrongBinder());
2249 boolean res = isIntentSenderAnActivity(r);
2250 reply.writeNoException();
2251 reply.writeInt(res ? 1 : 0);
2252 return true;
2253 }
2254
Dianne Hackborn81038902012-11-26 17:04:09 -08002255 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2256 data.enforceInterface(IActivityManager.descriptor);
2257 IIntentSender r = IIntentSender.Stub.asInterface(
2258 data.readStrongBinder());
2259 Intent intent = getIntentForIntentSender(r);
2260 reply.writeNoException();
2261 if (intent != null) {
2262 reply.writeInt(1);
2263 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2264 } else {
2265 reply.writeInt(0);
2266 }
2267 return true;
2268 }
2269
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002270 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2271 data.enforceInterface(IActivityManager.descriptor);
2272 IIntentSender r = IIntentSender.Stub.asInterface(
2273 data.readStrongBinder());
2274 String prefix = data.readString();
2275 String tag = getTagForIntentSender(r, prefix);
2276 reply.writeNoException();
2277 reply.writeString(tag);
2278 return true;
2279 }
2280
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002281 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2282 data.enforceInterface(IActivityManager.descriptor);
2283 Configuration config = Configuration.CREATOR.createFromParcel(data);
2284 updatePersistentConfiguration(config);
2285 reply.writeNoException();
2286 return true;
2287 }
2288
Dianne Hackbornb437e092011-08-05 17:50:29 -07002289 case GET_PROCESS_PSS_TRANSACTION: {
2290 data.enforceInterface(IActivityManager.descriptor);
2291 int[] pids = data.createIntArray();
2292 long[] pss = getProcessPss(pids);
2293 reply.writeNoException();
2294 reply.writeLongArray(pss);
2295 return true;
2296 }
2297
Dianne Hackborn661cd522011-08-22 00:26:20 -07002298 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2299 data.enforceInterface(IActivityManager.descriptor);
2300 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2301 boolean always = data.readInt() != 0;
2302 showBootMessage(msg, always);
2303 reply.writeNoException();
2304 return true;
2305 }
2306
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002307 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002308 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002309 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002310 reply.writeNoException();
2311 return true;
2312 }
2313
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002314 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2315 data.enforceInterface(IActivityManager.descriptor);
Adrian Roosd5c2db62016-03-08 16:11:31 -08002316 keyguardGoingAway(data.readInt());
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002317 reply.writeNoException();
2318 return true;
2319 }
2320
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002321 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002322 data.enforceInterface(IActivityManager.descriptor);
2323 IBinder token = data.readStrongBinder();
2324 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002325 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002326 reply.writeNoException();
2327 reply.writeInt(res ? 1 : 0);
2328 return true;
2329 }
2330
2331 case NAVIGATE_UP_TO_TRANSACTION: {
2332 data.enforceInterface(IActivityManager.descriptor);
2333 IBinder token = data.readStrongBinder();
2334 Intent target = Intent.CREATOR.createFromParcel(data);
2335 int resultCode = data.readInt();
2336 Intent resultData = null;
2337 if (data.readInt() != 0) {
2338 resultData = Intent.CREATOR.createFromParcel(data);
2339 }
2340 boolean res = navigateUpTo(token, target, resultCode, resultData);
2341 reply.writeNoException();
2342 reply.writeInt(res ? 1 : 0);
2343 return true;
2344 }
2345
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002346 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2347 data.enforceInterface(IActivityManager.descriptor);
2348 IBinder token = data.readStrongBinder();
2349 int res = getLaunchedFromUid(token);
2350 reply.writeNoException();
2351 reply.writeInt(res);
2352 return true;
2353 }
2354
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002355 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2356 data.enforceInterface(IActivityManager.descriptor);
2357 IBinder token = data.readStrongBinder();
2358 String res = getLaunchedFromPackage(token);
2359 reply.writeNoException();
2360 reply.writeString(res);
2361 return true;
2362 }
2363
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002364 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2365 data.enforceInterface(IActivityManager.descriptor);
2366 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2367 data.readStrongBinder());
2368 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002369 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002370 return true;
2371 }
2372
2373 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2374 data.enforceInterface(IActivityManager.descriptor);
2375 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2376 data.readStrongBinder());
2377 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002378 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002379 return true;
2380 }
2381
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002382 case REQUEST_BUG_REPORT_TRANSACTION: {
2383 data.enforceInterface(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00002384 int bugreportType = data.readInt();
2385 requestBugReport(bugreportType);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002386 reply.writeNoException();
2387 return true;
2388 }
2389
2390 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2391 data.enforceInterface(IActivityManager.descriptor);
2392 int pid = data.readInt();
2393 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002394 String reason = data.readString();
2395 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002396 reply.writeNoException();
2397 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002398 return true;
2399 }
2400
Adam Skorydfc7fd72013-08-05 19:23:41 -07002401 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002402 data.enforceInterface(IActivityManager.descriptor);
2403 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002404 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002405 reply.writeNoException();
2406 reply.writeBundle(res);
2407 return true;
2408 }
2409
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002410 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2411 data.enforceInterface(IActivityManager.descriptor);
2412 int requestType = data.readInt();
2413 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002414 IBinder activityToken = data.readStrongBinder();
2415 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002416 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002417 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002418 return true;
2419 }
2420
Adam Skorydfc7fd72013-08-05 19:23:41 -07002421 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002422 data.enforceInterface(IActivityManager.descriptor);
2423 IBinder token = data.readStrongBinder();
2424 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002425 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2426 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002427 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2428 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002429 reply.writeNoException();
2430 return true;
2431 }
2432
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002433 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2434 data.enforceInterface(IActivityManager.descriptor);
2435 Intent intent = Intent.CREATOR.createFromParcel(data);
2436 int requestType = data.readInt();
2437 String hint = data.readString();
2438 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002439 Bundle args = data.readBundle();
2440 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002441 reply.writeNoException();
2442 reply.writeInt(res ? 1 : 0);
2443 return true;
2444 }
2445
Benjamin Franzc200f442015-06-25 18:20:04 +01002446 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2447 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002448 boolean res = isAssistDataAllowedOnCurrentActivity();
2449 reply.writeNoException();
2450 reply.writeInt(res ? 1 : 0);
2451 return true;
2452 }
2453
2454 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2455 data.enforceInterface(IActivityManager.descriptor);
2456 IBinder token = data.readStrongBinder();
2457 Bundle args = data.readBundle();
2458 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002459 reply.writeNoException();
2460 reply.writeInt(res ? 1 : 0);
2461 return true;
2462 }
2463
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002464 case KILL_UID_TRANSACTION: {
2465 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002466 int appId = data.readInt();
2467 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002468 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002469 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002470 reply.writeNoException();
2471 return true;
2472 }
2473
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002474 case HANG_TRANSACTION: {
2475 data.enforceInterface(IActivityManager.descriptor);
2476 IBinder who = data.readStrongBinder();
2477 boolean allowRestart = data.readInt() != 0;
2478 hang(who, allowRestart);
2479 reply.writeNoException();
2480 return true;
2481 }
2482
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002483 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2484 data.enforceInterface(IActivityManager.descriptor);
2485 IBinder token = data.readStrongBinder();
2486 reportActivityFullyDrawn(token);
2487 reply.writeNoException();
2488 return true;
2489 }
2490
Craig Mautner5eda9b32013-07-02 11:58:16 -07002491 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2492 data.enforceInterface(IActivityManager.descriptor);
2493 IBinder token = data.readStrongBinder();
2494 notifyActivityDrawn(token);
2495 reply.writeNoException();
2496 return true;
2497 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002498
2499 case RESTART_TRANSACTION: {
2500 data.enforceInterface(IActivityManager.descriptor);
2501 restart();
2502 reply.writeNoException();
2503 return true;
2504 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002505
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002506 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2507 data.enforceInterface(IActivityManager.descriptor);
2508 performIdleMaintenance();
2509 reply.writeNoException();
2510 return true;
2511 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002512
Todd Kennedyca4d8422015-01-15 15:19:22 -08002513 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002514 data.enforceInterface(IActivityManager.descriptor);
2515 IBinder parentActivityToken = data.readStrongBinder();
2516 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002517 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002518 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002519 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002520 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002521 if (activityContainer != null) {
2522 reply.writeInt(1);
2523 reply.writeStrongBinder(activityContainer.asBinder());
2524 } else {
2525 reply.writeInt(0);
2526 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002527 return true;
2528 }
2529
Craig Mautner95da1082014-02-24 17:54:35 -08002530 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2531 data.enforceInterface(IActivityManager.descriptor);
2532 IActivityContainer activityContainer =
2533 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2534 deleteActivityContainer(activityContainer);
2535 reply.writeNoException();
2536 return true;
2537 }
2538
Todd Kennedy4900bf92015-01-16 16:05:14 -08002539 case CREATE_STACK_ON_DISPLAY: {
2540 data.enforceInterface(IActivityManager.descriptor);
2541 int displayId = data.readInt();
2542 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2543 reply.writeNoException();
2544 if (activityContainer != null) {
2545 reply.writeInt(1);
2546 reply.writeStrongBinder(activityContainer.asBinder());
2547 } else {
2548 reply.writeInt(0);
2549 }
2550 return true;
2551 }
2552
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002553 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002554 data.enforceInterface(IActivityManager.descriptor);
2555 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002556 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002557 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002558 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002559 return true;
2560 }
2561
Craig Mautneraea74a52014-03-08 14:23:10 -08002562 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2563 data.enforceInterface(IActivityManager.descriptor);
2564 final int taskId = data.readInt();
2565 startLockTaskMode(taskId);
2566 reply.writeNoException();
2567 return true;
2568 }
2569
2570 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2571 data.enforceInterface(IActivityManager.descriptor);
2572 IBinder token = data.readStrongBinder();
2573 startLockTaskMode(token);
2574 reply.writeNoException();
2575 return true;
2576 }
2577
Craig Mautnerd61dc202014-07-07 11:09:11 -07002578 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002579 data.enforceInterface(IActivityManager.descriptor);
2580 startLockTaskModeOnCurrent();
2581 reply.writeNoException();
2582 return true;
2583 }
2584
Craig Mautneraea74a52014-03-08 14:23:10 -08002585 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2586 data.enforceInterface(IActivityManager.descriptor);
2587 stopLockTaskMode();
2588 reply.writeNoException();
2589 return true;
2590 }
2591
Craig Mautnerd61dc202014-07-07 11:09:11 -07002592 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002593 data.enforceInterface(IActivityManager.descriptor);
2594 stopLockTaskModeOnCurrent();
2595 reply.writeNoException();
2596 return true;
2597 }
2598
Craig Mautneraea74a52014-03-08 14:23:10 -08002599 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2600 data.enforceInterface(IActivityManager.descriptor);
2601 final boolean isInLockTaskMode = isInLockTaskMode();
2602 reply.writeNoException();
2603 reply.writeInt(isInLockTaskMode ? 1 : 0);
2604 return true;
2605 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002606
Benjamin Franz43261142015-02-11 15:59:44 +00002607 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2608 data.enforceInterface(IActivityManager.descriptor);
2609 final int lockTaskModeState = getLockTaskModeState();
2610 reply.writeNoException();
2611 reply.writeInt(lockTaskModeState);
2612 return true;
2613 }
2614
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002615 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2616 data.enforceInterface(IActivityManager.descriptor);
2617 final IBinder token = data.readStrongBinder();
2618 showLockTaskEscapeMessage(token);
2619 reply.writeNoException();
2620 return true;
2621 }
2622
Winson Chunga449dc02014-05-16 11:15:04 -07002623 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002624 data.enforceInterface(IActivityManager.descriptor);
2625 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002626 ActivityManager.TaskDescription values =
2627 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2628 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002629 reply.writeNoException();
2630 return true;
2631 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002632
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002633 case SET_TASK_RESIZEABLE_TRANSACTION: {
2634 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08002635 final int taskId = data.readInt();
2636 final int resizeableMode = data.readInt();
2637 setTaskResizeable(taskId, resizeableMode);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002638 reply.writeNoException();
2639 return true;
2640 }
2641
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002642 case RESIZE_TASK_TRANSACTION: {
2643 data.enforceInterface(IActivityManager.descriptor);
2644 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002645 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002646 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002647 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002648 reply.writeNoException();
2649 return true;
2650 }
2651
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002652 case GET_TASK_BOUNDS_TRANSACTION: {
2653 data.enforceInterface(IActivityManager.descriptor);
2654 int taskId = data.readInt();
2655 Rect r = getTaskBounds(taskId);
2656 reply.writeNoException();
2657 r.writeToParcel(reply, 0);
2658 return true;
2659 }
2660
Craig Mautner648f69b2014-09-18 14:16:26 -07002661 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2662 data.enforceInterface(IActivityManager.descriptor);
2663 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002664 int userId = data.readInt();
2665 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002666 reply.writeNoException();
2667 if (icon == null) {
2668 reply.writeInt(0);
2669 } else {
2670 reply.writeInt(1);
2671 icon.writeToParcel(reply, 0);
2672 }
2673 return true;
2674 }
2675
Winson Chung044d5292014-11-06 11:05:19 -08002676 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2677 data.enforceInterface(IActivityManager.descriptor);
2678 final Bundle bundle;
2679 if (data.readInt() == 0) {
2680 bundle = null;
2681 } else {
2682 bundle = data.readBundle();
2683 }
Chong Zhang280d3322015-11-03 17:27:26 -08002684 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002685 startInPlaceAnimationOnFrontMostApplication(options);
2686 reply.writeNoException();
2687 return true;
2688 }
2689
Jose Lima4b6c6692014-08-12 17:41:12 -07002690 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002691 data.enforceInterface(IActivityManager.descriptor);
2692 IBinder token = data.readStrongBinder();
2693 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002694 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002695 reply.writeNoException();
2696 reply.writeInt(success ? 1 : 0);
2697 return true;
2698 }
2699
Jose Lima4b6c6692014-08-12 17:41:12 -07002700 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002701 data.enforceInterface(IActivityManager.descriptor);
2702 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002703 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002704 reply.writeNoException();
2705 reply.writeInt(enabled ? 1 : 0);
2706 return true;
2707 }
2708
Jose Lima4b6c6692014-08-12 17:41:12 -07002709 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002710 data.enforceInterface(IActivityManager.descriptor);
2711 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002712 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002713 reply.writeNoException();
2714 return true;
2715 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002716
2717 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2718 data.enforceInterface(IActivityManager.descriptor);
2719 IBinder token = data.readStrongBinder();
2720 notifyLaunchTaskBehindComplete(token);
2721 reply.writeNoException();
2722 return true;
2723 }
Craig Mautner8746a472014-07-24 15:12:54 -07002724
2725 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2726 data.enforceInterface(IActivityManager.descriptor);
2727 IBinder token = data.readStrongBinder();
2728 notifyEnterAnimationComplete(token);
2729 reply.writeNoException();
2730 return true;
2731 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002732
2733 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2734 data.enforceInterface(IActivityManager.descriptor);
2735 bootAnimationComplete();
2736 reply.writeNoException();
2737 return true;
2738 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002739
Jeff Sharkey605eb792014-11-04 13:34:06 -08002740 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2741 data.enforceInterface(IActivityManager.descriptor);
2742 final int uid = data.readInt();
2743 final byte[] firstPacket = data.createByteArray();
2744 notifyCleartextNetwork(uid, firstPacket);
2745 reply.writeNoException();
2746 return true;
2747 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002748
2749 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2750 data.enforceInterface(IActivityManager.descriptor);
2751 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002752 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002753 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002754 String reportPackage = data.readString();
2755 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002756 reply.writeNoException();
2757 return true;
2758 }
2759
2760 case DUMP_HEAP_FINISHED_TRANSACTION: {
2761 data.enforceInterface(IActivityManager.descriptor);
2762 String path = data.readString();
2763 dumpHeapFinished(path);
2764 reply.writeNoException();
2765 return true;
2766 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002767
2768 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2769 data.enforceInterface(IActivityManager.descriptor);
2770 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2771 data.readStrongBinder());
2772 boolean keepAwake = data.readInt() != 0;
2773 setVoiceKeepAwake(session, keepAwake);
2774 reply.writeNoException();
2775 return true;
2776 }
Craig Mautnere5600772015-04-03 21:36:37 -07002777
2778 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2779 data.enforceInterface(IActivityManager.descriptor);
2780 int userId = data.readInt();
2781 String[] packages = data.readStringArray();
2782 updateLockTaskPackages(userId, packages);
2783 reply.writeNoException();
2784 return true;
2785 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002786
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002787 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2788 data.enforceInterface(IActivityManager.descriptor);
2789 String packageName = data.readString();
2790 updateDeviceOwner(packageName);
2791 reply.writeNoException();
2792 return true;
2793 }
2794
Dianne Hackborn1e383822015-04-10 14:02:33 -07002795 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2796 data.enforceInterface(IActivityManager.descriptor);
2797 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002798 String callingPackage = data.readString();
2799 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002800 reply.writeNoException();
2801 reply.writeInt(res);
2802 return true;
2803 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002804
2805 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2806 data.enforceInterface(IActivityManager.descriptor);
2807 String process = data.readString();
2808 int userId = data.readInt();
2809 int level = data.readInt();
2810 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2811 reply.writeNoException();
2812 reply.writeInt(res ? 1 : 0);
2813 return true;
2814 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002815
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002816 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2817 data.enforceInterface(IActivityManager.descriptor);
2818 IBinder token = data.readStrongBinder();
2819 boolean res = isRootVoiceInteraction(token);
2820 reply.writeNoException();
2821 reply.writeInt(res ? 1 : 0);
2822 return true;
2823 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002824
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002825 case START_BINDER_TRACKING_TRANSACTION: {
2826 data.enforceInterface(IActivityManager.descriptor);
2827 boolean res = startBinderTracking();
2828 reply.writeNoException();
2829 reply.writeInt(res ? 1 : 0);
2830 return true;
2831 }
2832
2833 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2834 data.enforceInterface(IActivityManager.descriptor);
2835 ParcelFileDescriptor fd = data.readInt() != 0
2836 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2837 boolean res = stopBinderTrackingAndDump(fd);
2838 reply.writeNoException();
2839 reply.writeInt(res ? 1 : 0);
2840 return true;
2841 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002842 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2843 data.enforceInterface(IActivityManager.descriptor);
2844 IBinder token = data.readStrongBinder();
2845 int stackId = getActivityStackId(token);
2846 reply.writeNoException();
2847 reply.writeInt(stackId);
2848 return true;
2849 }
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002850 case EXIT_FREEFORM_MODE_TRANSACTION: {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002851 data.enforceInterface(IActivityManager.descriptor);
2852 IBinder token = data.readStrongBinder();
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002853 exitFreeformMode(token);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002854 reply.writeNoException();
2855 return true;
2856 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002857 case REPORT_SIZE_CONFIGURATIONS: {
2858 data.enforceInterface(IActivityManager.descriptor);
2859 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002860 int[] horizontal = readIntArray(data);
2861 int[] vertical = readIntArray(data);
2862 int[] smallest = readIntArray(data);
2863 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002864 return true;
2865 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002866 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2867 data.enforceInterface(IActivityManager.descriptor);
2868 final boolean suppress = data.readInt() == 1;
2869 suppressResizeConfigChanges(suppress);
2870 reply.writeNoException();
2871 return true;
2872 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002873 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002874 data.enforceInterface(IActivityManager.descriptor);
2875 final int stackId = data.readInt();
Wale Ogunwale9101d262016-01-15 08:56:11 -08002876 final boolean onTop = data.readInt() == 1;
2877 moveTasksToFullscreenStack(stackId, onTop);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002878 reply.writeNoException();
2879 return true;
2880 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002881 case GET_APP_START_MODE_TRANSACTION: {
2882 data.enforceInterface(IActivityManager.descriptor);
2883 final int uid = data.readInt();
2884 final String pkg = data.readString();
2885 int res = getAppStartMode(uid, pkg);
2886 reply.writeNoException();
2887 reply.writeInt(res);
2888 return true;
2889 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002890 case IN_MULTI_WINDOW_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002891 data.enforceInterface(IActivityManager.descriptor);
2892 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002893 final boolean inMultiWindow = inMultiWindow(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002894 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002895 reply.writeInt(inMultiWindow ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002896 return true;
2897 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002898 case IN_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002899 data.enforceInterface(IActivityManager.descriptor);
2900 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002901 final boolean inPip = inPictureInPicture(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002902 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002903 reply.writeInt(inPip ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002904 return true;
2905 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002906 case ENTER_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002907 data.enforceInterface(IActivityManager.descriptor);
2908 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002909 enterPictureInPicture(token);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002910 reply.writeNoException();
2911 return true;
2912 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002913 case SET_VR_MODE_TRANSACTION: {
2914 data.enforceInterface(IActivityManager.descriptor);
2915 final IBinder token = data.readStrongBinder();
2916 final boolean enable = data.readInt() == 1;
Ruben Brunke24b9a62016-02-16 21:38:24 -08002917 final ComponentName packageName = ComponentName.CREATOR.createFromParcel(data);
2918 int res = setVrMode(token, enable, packageName);
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002919 reply.writeNoException();
Ruben Brunke24b9a62016-02-16 21:38:24 -08002920 reply.writeInt(res);
2921 return true;
2922 }
2923 case IS_VR_PACKAGE_ENABLED_TRANSACTION: {
2924 data.enforceInterface(IActivityManager.descriptor);
2925 final ComponentName packageName = ComponentName.CREATOR.createFromParcel(data);
2926 boolean res = isVrModePackageEnabled(packageName);
2927 reply.writeNoException();
2928 reply.writeInt(res ? 1 : 0);
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002929 return true;
2930 }
Christopher Tate63fec3e2015-12-11 18:35:28 -08002931 case IS_APP_FOREGROUND_TRANSACTION: {
2932 data.enforceInterface(IActivityManager.descriptor);
2933 final int userHandle = data.readInt();
2934 final boolean isForeground = isAppForeground(userHandle);
2935 reply.writeNoException();
2936 reply.writeInt(isForeground ? 1 : 0);
2937 return true;
2938 }
Wale Ogunwale480dca02016-02-06 13:58:29 -08002939 case NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION: {
2940 data.enforceInterface(IActivityManager.descriptor);
2941 reply.writeNoException();
2942 return true;
2943 }
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08002944 case REMOVE_STACK: {
2945 data.enforceInterface(IActivityManager.descriptor);
2946 final int stackId = data.readInt();
2947 removeStack(stackId);
2948 reply.writeNoException();
2949 return true;
2950 }
Tony Mak9c6e8ce2016-03-21 12:07:16 +00002951 case NOTIFY_LOCKED_PROFILE: {
2952 data.enforceInterface(IActivityManager.descriptor);
2953 final int userId = data.readInt();
2954 notifyLockedProfile(userId);
2955 reply.writeNoException();
2956 return true;
2957 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002958 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002959
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002960 return super.onTransact(code, data, reply, flags);
2961 }
2962
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002963 private int[] readIntArray(Parcel data) {
2964 int[] smallest = null;
2965 int smallestSize = data.readInt();
2966 if (smallestSize > 0) {
2967 smallest = new int[smallestSize];
2968 data.readIntArray(smallest);
2969 }
2970 return smallest;
2971 }
2972
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002973 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002974 return this;
2975 }
2976
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002977 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2978 protected IActivityManager create() {
2979 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002980 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002981 Log.v("ActivityManager", "default service binder = " + b);
2982 }
2983 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002984 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002985 Log.v("ActivityManager", "default service = " + am);
2986 }
2987 return am;
2988 }
2989 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002990}
2991
2992class ActivityManagerProxy implements IActivityManager
2993{
2994 public ActivityManagerProxy(IBinder remote)
2995 {
2996 mRemote = remote;
2997 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002998
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 public IBinder asBinder()
3000 {
3001 return mRemote;
3002 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08003003
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003004 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003005 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07003006 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 Parcel data = Parcel.obtain();
3008 Parcel reply = Parcel.obtain();
3009 data.writeInterfaceToken(IActivityManager.descriptor);
3010 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003011 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003012 intent.writeToParcel(data, 0);
3013 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003014 data.writeStrongBinder(resultTo);
3015 data.writeString(resultWho);
3016 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003017 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003018 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003019 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003020 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003021 } else {
3022 data.writeInt(0);
3023 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003024 if (options != null) {
3025 data.writeInt(1);
3026 options.writeToParcel(data, 0);
3027 } else {
3028 data.writeInt(0);
3029 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003030 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3031 reply.readException();
3032 int result = reply.readInt();
3033 reply.recycle();
3034 data.recycle();
3035 return result;
3036 }
Amith Yamasani82644082012-08-03 13:09:11 -07003037
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003038 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07003039 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07003040 int startFlags, ProfilerInfo profilerInfo, Bundle options,
3041 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07003042 Parcel data = Parcel.obtain();
3043 Parcel reply = Parcel.obtain();
3044 data.writeInterfaceToken(IActivityManager.descriptor);
3045 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003046 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07003047 intent.writeToParcel(data, 0);
3048 data.writeString(resolvedType);
3049 data.writeStrongBinder(resultTo);
3050 data.writeString(resultWho);
3051 data.writeInt(requestCode);
3052 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003053 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07003054 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003055 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07003056 } else {
3057 data.writeInt(0);
3058 }
3059 if (options != null) {
3060 data.writeInt(1);
3061 options.writeToParcel(data, 0);
3062 } else {
3063 data.writeInt(0);
3064 }
3065 data.writeInt(userId);
3066 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
3067 reply.readException();
3068 int result = reply.readInt();
3069 reply.recycle();
3070 data.recycle();
3071 return result;
3072 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003073 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
3074 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003075 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
3076 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003077 Parcel data = Parcel.obtain();
3078 Parcel reply = Parcel.obtain();
3079 data.writeInterfaceToken(IActivityManager.descriptor);
3080 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3081 data.writeString(callingPackage);
3082 intent.writeToParcel(data, 0);
3083 data.writeString(resolvedType);
3084 data.writeStrongBinder(resultTo);
3085 data.writeString(resultWho);
3086 data.writeInt(requestCode);
3087 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003088 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003089 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003090 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003091 } else {
3092 data.writeInt(0);
3093 }
3094 if (options != null) {
3095 data.writeInt(1);
3096 options.writeToParcel(data, 0);
3097 } else {
3098 data.writeInt(0);
3099 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003100 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07003101 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003102 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
3103 reply.readException();
3104 int result = reply.readInt();
3105 reply.recycle();
3106 data.recycle();
3107 return result;
3108 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003109 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
3110 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07003111 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
3112 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003117 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003118 intent.writeToParcel(data, 0);
3119 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003120 data.writeStrongBinder(resultTo);
3121 data.writeString(resultWho);
3122 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003123 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003124 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003125 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003126 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003127 } else {
3128 data.writeInt(0);
3129 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003130 if (options != null) {
3131 data.writeInt(1);
3132 options.writeToParcel(data, 0);
3133 } else {
3134 data.writeInt(0);
3135 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003136 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003137 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3138 reply.readException();
3139 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3140 reply.recycle();
3141 data.recycle();
3142 return result;
3143 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003144 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3145 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003146 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003147 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003148 Parcel data = Parcel.obtain();
3149 Parcel reply = Parcel.obtain();
3150 data.writeInterfaceToken(IActivityManager.descriptor);
3151 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003152 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003153 intent.writeToParcel(data, 0);
3154 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003155 data.writeStrongBinder(resultTo);
3156 data.writeString(resultWho);
3157 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003158 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003159 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003160 if (options != null) {
3161 data.writeInt(1);
3162 options.writeToParcel(data, 0);
3163 } else {
3164 data.writeInt(0);
3165 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003166 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003167 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3168 reply.readException();
3169 int result = reply.readInt();
3170 reply.recycle();
3171 data.recycle();
3172 return result;
3173 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003174 public int startActivityIntentSender(IApplicationThread caller,
3175 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003176 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003177 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003178 Parcel data = Parcel.obtain();
3179 Parcel reply = Parcel.obtain();
3180 data.writeInterfaceToken(IActivityManager.descriptor);
3181 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3182 intent.writeToParcel(data, 0);
3183 if (fillInIntent != null) {
3184 data.writeInt(1);
3185 fillInIntent.writeToParcel(data, 0);
3186 } else {
3187 data.writeInt(0);
3188 }
3189 data.writeString(resolvedType);
3190 data.writeStrongBinder(resultTo);
3191 data.writeString(resultWho);
3192 data.writeInt(requestCode);
3193 data.writeInt(flagsMask);
3194 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003195 if (options != null) {
3196 data.writeInt(1);
3197 options.writeToParcel(data, 0);
3198 } else {
3199 data.writeInt(0);
3200 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003201 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003202 reply.readException();
3203 int result = reply.readInt();
3204 reply.recycle();
3205 data.recycle();
3206 return result;
3207 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003208 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3209 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003210 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3211 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeString(callingPackage);
3216 data.writeInt(callingPid);
3217 data.writeInt(callingUid);
3218 intent.writeToParcel(data, 0);
3219 data.writeString(resolvedType);
3220 data.writeStrongBinder(session.asBinder());
3221 data.writeStrongBinder(interactor.asBinder());
3222 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003223 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003224 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003225 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003226 } else {
3227 data.writeInt(0);
3228 }
3229 if (options != null) {
3230 data.writeInt(1);
3231 options.writeToParcel(data, 0);
3232 } else {
3233 data.writeInt(0);
3234 }
3235 data.writeInt(userId);
3236 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 int result = reply.readInt();
3239 reply.recycle();
3240 data.recycle();
3241 return result;
3242 }
Amith Yamasani0af6fa72016-01-17 15:36:19 -08003243
3244 public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options)
3245 throws RemoteException {
3246 Parcel data = Parcel.obtain();
3247 Parcel reply = Parcel.obtain();
3248 data.writeInterfaceToken(IActivityManager.descriptor);
3249 data.writeStrongBinder(callingActivity);
3250 data.writeBundle(options);
3251 mRemote.transact(START_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3252 reply.readException();
3253 reply.recycle();
3254 data.recycle();
3255 }
3256
3257 public void stopLocalVoiceInteraction(IBinder callingActivity) throws RemoteException {
3258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 data.writeStrongBinder(callingActivity);
3262 mRemote.transact(STOP_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3263 reply.readException();
3264 reply.recycle();
3265 data.recycle();
3266 }
3267
3268 public boolean supportsLocalVoiceInteraction() throws RemoteException {
3269 Parcel data = Parcel.obtain();
3270 Parcel reply = Parcel.obtain();
3271 data.writeInterfaceToken(IActivityManager.descriptor);
3272 mRemote.transact(SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3273 reply.readException();
3274 int result = reply.readInt();
3275 reply.recycle();
3276 data.recycle();
3277 return result != 0;
3278 }
3279
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003280 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003281 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 Parcel data = Parcel.obtain();
3283 Parcel reply = Parcel.obtain();
3284 data.writeInterfaceToken(IActivityManager.descriptor);
3285 data.writeStrongBinder(callingActivity);
3286 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003287 if (options != null) {
3288 data.writeInt(1);
3289 options.writeToParcel(data, 0);
3290 } else {
3291 data.writeInt(0);
3292 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003293 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3294 reply.readException();
3295 int result = reply.readInt();
3296 reply.recycle();
3297 data.recycle();
3298 return result != 0;
3299 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003300 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003301 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003302 Parcel data = Parcel.obtain();
3303 Parcel reply = Parcel.obtain();
3304 data.writeInterfaceToken(IActivityManager.descriptor);
3305 data.writeInt(taskId);
3306 if (options == null) {
3307 data.writeInt(0);
3308 } else {
3309 data.writeInt(1);
3310 options.writeToParcel(data, 0);
3311 }
3312 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3313 reply.readException();
3314 int result = reply.readInt();
3315 reply.recycle();
3316 data.recycle();
3317 return result;
3318 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003319 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003320 throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 data.writeStrongBinder(token);
3325 data.writeInt(resultCode);
3326 if (resultData != null) {
3327 data.writeInt(1);
3328 resultData.writeToParcel(data, 0);
3329 } else {
3330 data.writeInt(0);
3331 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003332 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3334 reply.readException();
3335 boolean res = reply.readInt() != 0;
3336 data.recycle();
3337 reply.recycle();
3338 return res;
3339 }
3340 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3341 {
3342 Parcel data = Parcel.obtain();
3343 Parcel reply = Parcel.obtain();
3344 data.writeInterfaceToken(IActivityManager.descriptor);
3345 data.writeStrongBinder(token);
3346 data.writeString(resultWho);
3347 data.writeInt(requestCode);
3348 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3349 reply.readException();
3350 data.recycle();
3351 reply.recycle();
3352 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003353 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
3356 data.writeInterfaceToken(IActivityManager.descriptor);
3357 data.writeStrongBinder(token);
3358 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3359 reply.readException();
3360 boolean res = reply.readInt() != 0;
3361 data.recycle();
3362 reply.recycle();
3363 return res;
3364 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003365 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3366 Parcel data = Parcel.obtain();
3367 Parcel reply = Parcel.obtain();
3368 data.writeInterfaceToken(IActivityManager.descriptor);
3369 data.writeStrongBinder(session.asBinder());
3370 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3371 reply.readException();
3372 data.recycle();
3373 reply.recycle();
3374 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003375 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(token);
3380 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3381 reply.readException();
3382 boolean res = reply.readInt() != 0;
3383 data.recycle();
3384 reply.recycle();
3385 return res;
3386 }
3387 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 data.writeStrongBinder(app.asBinder());
3392 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3393 reply.readException();
3394 data.recycle();
3395 reply.recycle();
3396 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003397 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3398 Parcel data = Parcel.obtain();
3399 Parcel reply = Parcel.obtain();
3400 data.writeInterfaceToken(IActivityManager.descriptor);
3401 data.writeStrongBinder(token);
3402 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3403 reply.readException();
3404 boolean res = reply.readInt() != 0;
3405 data.recycle();
3406 reply.recycle();
3407 return res;
3408 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003409 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003410 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003411 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003412 {
3413 Parcel data = Parcel.obtain();
3414 Parcel reply = Parcel.obtain();
3415 data.writeInterfaceToken(IActivityManager.descriptor);
3416 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003417 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003418 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3419 filter.writeToParcel(data, 0);
3420 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003421 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003422 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3423 reply.readException();
3424 Intent intent = null;
3425 int haveIntent = reply.readInt();
3426 if (haveIntent != 0) {
3427 intent = Intent.CREATOR.createFromParcel(reply);
3428 }
3429 reply.recycle();
3430 data.recycle();
3431 return intent;
3432 }
3433 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3434 {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 data.writeStrongBinder(receiver.asBinder());
3439 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3440 reply.readException();
3441 data.recycle();
3442 reply.recycle();
3443 }
3444 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003445 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003446 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003447 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003448 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003449 {
3450 Parcel data = Parcel.obtain();
3451 Parcel reply = Parcel.obtain();
3452 data.writeInterfaceToken(IActivityManager.descriptor);
3453 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3454 intent.writeToParcel(data, 0);
3455 data.writeString(resolvedType);
3456 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3457 data.writeInt(resultCode);
3458 data.writeString(resultData);
3459 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003460 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003461 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003462 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003463 data.writeInt(serialized ? 1 : 0);
3464 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003465 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003466 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3467 reply.readException();
3468 int res = reply.readInt();
3469 reply.recycle();
3470 data.recycle();
3471 return res;
3472 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003473 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3474 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003475 {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3480 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003481 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003482 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3483 reply.readException();
3484 data.recycle();
3485 reply.recycle();
3486 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003487 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3488 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003489 {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 data.writeStrongBinder(who);
3494 data.writeInt(resultCode);
3495 data.writeString(resultData);
3496 data.writeBundle(map);
3497 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003498 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3500 reply.readException();
3501 data.recycle();
3502 reply.recycle();
3503 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003504 public void attachApplication(IApplicationThread app) throws RemoteException
3505 {
3506 Parcel data = Parcel.obtain();
3507 Parcel reply = Parcel.obtain();
3508 data.writeInterfaceToken(IActivityManager.descriptor);
3509 data.writeStrongBinder(app.asBinder());
3510 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3511 reply.readException();
3512 data.recycle();
3513 reply.recycle();
3514 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003515 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3516 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003517 {
3518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003522 if (config != null) {
3523 data.writeInt(1);
3524 config.writeToParcel(data, 0);
3525 } else {
3526 data.writeInt(0);
3527 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003528 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003529 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3530 reply.readException();
3531 data.recycle();
3532 reply.recycle();
3533 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003534 public void activityResumed(IBinder token) throws RemoteException
3535 {
3536 Parcel data = Parcel.obtain();
3537 Parcel reply = Parcel.obtain();
3538 data.writeInterfaceToken(IActivityManager.descriptor);
3539 data.writeStrongBinder(token);
3540 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3541 reply.readException();
3542 data.recycle();
3543 reply.recycle();
3544 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003545 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003546 {
3547 Parcel data = Parcel.obtain();
3548 Parcel reply = Parcel.obtain();
3549 data.writeInterfaceToken(IActivityManager.descriptor);
3550 data.writeStrongBinder(token);
3551 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3552 reply.readException();
3553 data.recycle();
3554 reply.recycle();
3555 }
3556 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003557 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003558 {
3559 Parcel data = Parcel.obtain();
3560 Parcel reply = Parcel.obtain();
3561 data.writeInterfaceToken(IActivityManager.descriptor);
3562 data.writeStrongBinder(token);
3563 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003564 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003565 TextUtils.writeToParcel(description, data, 0);
3566 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3567 reply.readException();
3568 data.recycle();
3569 reply.recycle();
3570 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003571 public void activitySlept(IBinder token) throws RemoteException
3572 {
3573 Parcel data = Parcel.obtain();
3574 Parcel reply = Parcel.obtain();
3575 data.writeInterfaceToken(IActivityManager.descriptor);
3576 data.writeStrongBinder(token);
3577 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3578 reply.readException();
3579 data.recycle();
3580 reply.recycle();
3581 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003582 public void activityDestroyed(IBinder token) throws RemoteException
3583 {
3584 Parcel data = Parcel.obtain();
3585 Parcel reply = Parcel.obtain();
3586 data.writeInterfaceToken(IActivityManager.descriptor);
3587 data.writeStrongBinder(token);
3588 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3589 reply.readException();
3590 data.recycle();
3591 reply.recycle();
3592 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003593 public void activityRelaunched(IBinder token) throws RemoteException
3594 {
3595 Parcel data = Parcel.obtain();
3596 Parcel reply = Parcel.obtain();
3597 data.writeInterfaceToken(IActivityManager.descriptor);
3598 data.writeStrongBinder(token);
3599 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 data.recycle();
3602 reply.recycle();
3603 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003604 public String getCallingPackage(IBinder token) throws RemoteException
3605 {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeStrongBinder(token);
3610 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3611 reply.readException();
3612 String res = reply.readString();
3613 data.recycle();
3614 reply.recycle();
3615 return res;
3616 }
3617 public ComponentName getCallingActivity(IBinder token)
3618 throws RemoteException {
3619 Parcel data = Parcel.obtain();
3620 Parcel reply = Parcel.obtain();
3621 data.writeInterfaceToken(IActivityManager.descriptor);
3622 data.writeStrongBinder(token);
3623 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3624 reply.readException();
3625 ComponentName res = ComponentName.readFromParcel(reply);
3626 data.recycle();
3627 reply.recycle();
3628 return res;
3629 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003630 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003634 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003635 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3636 reply.readException();
3637 ArrayList<IAppTask> list = null;
3638 int N = reply.readInt();
3639 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003640 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003641 while (N > 0) {
3642 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3643 list.add(task);
3644 N--;
3645 }
3646 }
3647 data.recycle();
3648 reply.recycle();
3649 return list;
3650 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003651 public int addAppTask(IBinder activityToken, Intent intent,
3652 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 data.writeStrongBinder(activityToken);
3657 intent.writeToParcel(data, 0);
3658 description.writeToParcel(data, 0);
3659 thumbnail.writeToParcel(data, 0);
3660 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3661 reply.readException();
3662 int res = reply.readInt();
3663 data.recycle();
3664 reply.recycle();
3665 return res;
3666 }
3667 public Point getAppTaskThumbnailSize() throws RemoteException {
3668 Parcel data = Parcel.obtain();
3669 Parcel reply = Parcel.obtain();
3670 data.writeInterfaceToken(IActivityManager.descriptor);
3671 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3672 reply.readException();
3673 Point size = Point.CREATOR.createFromParcel(reply);
3674 data.recycle();
3675 reply.recycle();
3676 return size;
3677 }
Todd Kennedye635f662015-01-20 10:36:49 -08003678 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3679 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003680 Parcel data = Parcel.obtain();
3681 Parcel reply = Parcel.obtain();
3682 data.writeInterfaceToken(IActivityManager.descriptor);
3683 data.writeInt(maxNum);
3684 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003685 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3686 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003687 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003688 int N = reply.readInt();
3689 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003690 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003691 while (N > 0) {
3692 ActivityManager.RunningTaskInfo info =
3693 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003694 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003695 list.add(info);
3696 N--;
3697 }
3698 }
3699 data.recycle();
3700 reply.recycle();
3701 return list;
3702 }
3703 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003704 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003705 Parcel data = Parcel.obtain();
3706 Parcel reply = Parcel.obtain();
3707 data.writeInterfaceToken(IActivityManager.descriptor);
3708 data.writeInt(maxNum);
3709 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003710 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003711 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3712 reply.readException();
3713 ArrayList<ActivityManager.RecentTaskInfo> list
3714 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3715 data.recycle();
3716 reply.recycle();
3717 return list;
3718 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003719 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003720 Parcel data = Parcel.obtain();
3721 Parcel reply = Parcel.obtain();
3722 data.writeInterfaceToken(IActivityManager.descriptor);
3723 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003724 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003725 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003726 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003727 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003728 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003729 }
3730 data.recycle();
3731 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003732 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003733 }
Todd Kennedye635f662015-01-20 10:36:49 -08003734 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3735 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003736 Parcel data = Parcel.obtain();
3737 Parcel reply = Parcel.obtain();
3738 data.writeInterfaceToken(IActivityManager.descriptor);
3739 data.writeInt(maxNum);
3740 data.writeInt(flags);
3741 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3742 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003743 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003744 int N = reply.readInt();
3745 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003746 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003747 while (N > 0) {
3748 ActivityManager.RunningServiceInfo info =
3749 ActivityManager.RunningServiceInfo.CREATOR
3750 .createFromParcel(reply);
3751 list.add(info);
3752 N--;
3753 }
3754 }
3755 data.recycle();
3756 reply.recycle();
3757 return list;
3758 }
3759 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3760 throws RemoteException {
3761 Parcel data = Parcel.obtain();
3762 Parcel reply = Parcel.obtain();
3763 data.writeInterfaceToken(IActivityManager.descriptor);
3764 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3765 reply.readException();
3766 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3767 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3768 data.recycle();
3769 reply.recycle();
3770 return list;
3771 }
3772 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3773 throws RemoteException {
3774 Parcel data = Parcel.obtain();
3775 Parcel reply = Parcel.obtain();
3776 data.writeInterfaceToken(IActivityManager.descriptor);
3777 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3778 reply.readException();
3779 ArrayList<ActivityManager.RunningAppProcessInfo> list
3780 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3781 data.recycle();
3782 reply.recycle();
3783 return list;
3784 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003785 public List<ApplicationInfo> getRunningExternalApplications()
3786 throws RemoteException {
3787 Parcel data = Parcel.obtain();
3788 Parcel reply = Parcel.obtain();
3789 data.writeInterfaceToken(IActivityManager.descriptor);
3790 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3791 reply.readException();
3792 ArrayList<ApplicationInfo> list
3793 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3794 data.recycle();
3795 reply.recycle();
3796 return list;
3797 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003798 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003799 {
3800 Parcel data = Parcel.obtain();
3801 Parcel reply = Parcel.obtain();
3802 data.writeInterfaceToken(IActivityManager.descriptor);
3803 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003804 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003805 if (options != null) {
3806 data.writeInt(1);
3807 options.writeToParcel(data, 0);
3808 } else {
3809 data.writeInt(0);
3810 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003811 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3812 reply.readException();
3813 data.recycle();
3814 reply.recycle();
3815 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003816 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3817 throws RemoteException {
3818 Parcel data = Parcel.obtain();
3819 Parcel reply = Parcel.obtain();
3820 data.writeInterfaceToken(IActivityManager.descriptor);
3821 data.writeStrongBinder(token);
3822 data.writeInt(nonRoot ? 1 : 0);
3823 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3824 reply.readException();
3825 boolean res = reply.readInt() != 0;
3826 data.recycle();
3827 reply.recycle();
3828 return res;
3829 }
3830 public void moveTaskBackwards(int task) throws RemoteException
3831 {
3832 Parcel data = Parcel.obtain();
3833 Parcel reply = Parcel.obtain();
3834 data.writeInterfaceToken(IActivityManager.descriptor);
3835 data.writeInt(task);
3836 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3837 reply.readException();
3838 data.recycle();
3839 reply.recycle();
3840 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003841 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003842 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3843 {
3844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003846 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003847 data.writeInt(taskId);
3848 data.writeInt(stackId);
3849 data.writeInt(toTop ? 1 : 0);
3850 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3851 reply.readException();
3852 data.recycle();
3853 reply.recycle();
3854 }
3855 @Override
Chong Zhange4fbd322016-03-01 14:44:03 -08003856 public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003857 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003858 {
3859 Parcel data = Parcel.obtain();
3860 Parcel reply = Parcel.obtain();
3861 data.writeInterfaceToken(IActivityManager.descriptor);
3862 data.writeInt(taskId);
3863 data.writeInt(createMode);
3864 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003865 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003866 if (initialBounds != null) {
3867 data.writeInt(1);
3868 initialBounds.writeToParcel(data, 0);
3869 } else {
3870 data.writeInt(0);
3871 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003872 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3873 reply.readException();
Chong Zhange4fbd322016-03-01 14:44:03 -08003874 boolean res = reply.readInt() > 0;
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003875 data.recycle();
3876 reply.recycle();
Chong Zhange4fbd322016-03-01 14:44:03 -08003877 return res;
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003878 }
3879 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003880 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3881 throws RemoteException
3882 {
3883 Parcel data = Parcel.obtain();
3884 Parcel reply = Parcel.obtain();
3885 data.writeInterfaceToken(IActivityManager.descriptor);
3886 data.writeInt(stackId);
3887 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003888 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003889 reply.readException();
3890 final boolean res = reply.readInt() != 0;
3891 data.recycle();
3892 reply.recycle();
3893 return res;
3894 }
3895 @Override
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003896 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode,
Wale Ogunwalee75a9ad2016-03-18 20:43:49 -07003897 boolean preserveWindows, boolean animate, int animationDuration)
3898 throws RemoteException {
Craig Mautnerc00204b2013-03-05 15:02:14 -08003899 Parcel data = Parcel.obtain();
3900 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003901 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003902 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003903 if (r != null) {
3904 data.writeInt(1);
3905 r.writeToParcel(data, 0);
3906 } else {
3907 data.writeInt(0);
3908 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003909 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003910 data.writeInt(preserveWindows ? 1 : 0);
3911 data.writeInt(animate ? 1 : 0);
Wale Ogunwalee75a9ad2016-03-18 20:43:49 -07003912 data.writeInt(animationDuration);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003913 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003914 reply.readException();
3915 data.recycle();
3916 reply.recycle();
3917 }
Craig Mautner967212c2013-04-13 21:10:58 -07003918 @Override
Jorim Jaggid47e7e12016-03-01 09:57:38 +01003919 public void swapDockedAndFullscreenStack() throws RemoteException
3920 {
3921 Parcel data = Parcel.obtain();
3922 Parcel reply = Parcel.obtain();
3923 data.writeInterfaceToken(IActivityManager.descriptor);
3924 mRemote.transact(SWAP_DOCKED_AND_FULLSCREEN_STACK, data, reply, 0);
3925 reply.readException();
3926 data.recycle();
3927 reply.recycle();
3928 }
3929 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003930 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3931 Rect tempDockedTaskInsetBounds,
3932 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3933 throws RemoteException
3934 {
3935 Parcel data = Parcel.obtain();
3936 Parcel reply = Parcel.obtain();
3937 data.writeInterfaceToken(IActivityManager.descriptor);
3938 if (dockedBounds != null) {
3939 data.writeInt(1);
3940 dockedBounds.writeToParcel(data, 0);
3941 } else {
3942 data.writeInt(0);
3943 }
3944 if (tempDockedTaskBounds != null) {
3945 data.writeInt(1);
3946 tempDockedTaskBounds.writeToParcel(data, 0);
3947 } else {
3948 data.writeInt(0);
3949 }
3950 if (tempDockedTaskInsetBounds != null) {
3951 data.writeInt(1);
3952 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3953 } else {
3954 data.writeInt(0);
3955 }
3956 if (tempOtherTaskBounds != null) {
3957 data.writeInt(1);
3958 tempOtherTaskBounds.writeToParcel(data, 0);
3959 } else {
3960 data.writeInt(0);
3961 }
3962 if (tempOtherTaskInsetBounds != null) {
3963 data.writeInt(1);
3964 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3965 } else {
3966 data.writeInt(0);
3967 }
3968 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3969 reply.readException();
3970 data.recycle();
3971 reply.recycle();
3972 }
Robert Carr0d00c2e2016-02-29 17:45:02 -08003973
3974 @Override
3975 public void resizePinnedStack(Rect pinnedBounds, Rect tempPinnedTaskBounds) throws RemoteException
3976 {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 if (pinnedBounds != null) {
3981 data.writeInt(1);
3982 pinnedBounds.writeToParcel(data, 0);
3983 } else {
3984 data.writeInt(0);
3985 }
3986 if (tempPinnedTaskBounds != null) {
3987 data.writeInt(1);
3988 tempPinnedTaskBounds.writeToParcel(data, 0);
3989 } else {
3990 data.writeInt(0);
3991 }
3992 mRemote.transact(RESIZE_PINNED_STACK_TRANSACTION, data, reply, 0);
3993 reply.readException();
3994 data.recycle();
3995 reply.recycle();
3996 }
3997
Jorim Jaggidc249c42015-12-15 14:57:31 -08003998 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003999 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
4000 {
4001 Parcel data = Parcel.obtain();
4002 Parcel reply = Parcel.obtain();
4003 data.writeInterfaceToken(IActivityManager.descriptor);
4004 data.writeInt(taskId);
4005 data.writeInt(stackId);
4006 data.writeInt(position);
4007 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
4008 reply.readException();
4009 data.recycle();
4010 reply.recycle();
4011 }
4012 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004013 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07004014 {
4015 Parcel data = Parcel.obtain();
4016 Parcel reply = Parcel.obtain();
4017 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004018 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07004019 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004020 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07004021 data.recycle();
4022 reply.recycle();
4023 return list;
4024 }
Craig Mautnercf910b02013-04-23 11:23:27 -07004025 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004026 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004027 {
4028 Parcel data = Parcel.obtain();
4029 Parcel reply = Parcel.obtain();
4030 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004031 data.writeInt(stackId);
4032 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004033 reply.readException();
4034 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004035 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004036 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004037 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004038 }
4039 data.recycle();
4040 reply.recycle();
4041 return info;
4042 }
4043 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08004044 public boolean isInHomeStack(int taskId) throws RemoteException {
4045 Parcel data = Parcel.obtain();
4046 Parcel reply = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 data.writeInt(taskId);
4049 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
4050 reply.readException();
4051 boolean isInHomeStack = reply.readInt() > 0;
4052 data.recycle();
4053 reply.recycle();
4054 return isInHomeStack;
4055 }
4056 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07004057 public void setFocusedStack(int stackId) throws RemoteException
4058 {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004063 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07004064 reply.readException();
4065 data.recycle();
4066 reply.recycle();
4067 }
Winson Chung740c3ac2014-11-12 16:14:38 -08004068 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08004069 public int getFocusedStackId() throws RemoteException {
4070 Parcel data = Parcel.obtain();
4071 Parcel reply = Parcel.obtain();
4072 data.writeInterfaceToken(IActivityManager.descriptor);
4073 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
4074 reply.readException();
4075 int focusedStackId = reply.readInt();
4076 data.recycle();
4077 reply.recycle();
4078 return focusedStackId;
4079 }
4080 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07004081 public void setFocusedTask(int taskId) throws RemoteException
4082 {
4083 Parcel data = Parcel.obtain();
4084 Parcel reply = Parcel.obtain();
4085 data.writeInterfaceToken(IActivityManager.descriptor);
4086 data.writeInt(taskId);
4087 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
4088 reply.readException();
4089 data.recycle();
4090 reply.recycle();
4091 }
4092 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08004093 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
4094 {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07004099 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08004100 reply.readException();
4101 data.recycle();
4102 reply.recycle();
4103 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004104 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
4105 {
4106 Parcel data = Parcel.obtain();
4107 Parcel reply = Parcel.obtain();
4108 data.writeInterfaceToken(IActivityManager.descriptor);
4109 data.writeStrongBinder(token);
4110 data.writeInt(onlyRoot ? 1 : 0);
4111 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
4112 reply.readException();
4113 int res = reply.readInt();
4114 data.recycle();
4115 reply.recycle();
4116 return res;
4117 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004118 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07004119 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004120 Parcel data = Parcel.obtain();
4121 Parcel reply = Parcel.obtain();
4122 data.writeInterfaceToken(IActivityManager.descriptor);
4123 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4124 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004125 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004126 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004127 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4128 reply.readException();
4129 int res = reply.readInt();
4130 ContentProviderHolder cph = null;
4131 if (res != 0) {
4132 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4133 }
4134 data.recycle();
4135 reply.recycle();
4136 return cph;
4137 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07004138 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
4139 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004140 Parcel data = Parcel.obtain();
4141 Parcel reply = Parcel.obtain();
4142 data.writeInterfaceToken(IActivityManager.descriptor);
4143 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004144 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004145 data.writeStrongBinder(token);
4146 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 int res = reply.readInt();
4149 ContentProviderHolder cph = null;
4150 if (res != 0) {
4151 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4152 }
4153 data.recycle();
4154 reply.recycle();
4155 return cph;
4156 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004157 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004158 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004159 {
4160 Parcel data = Parcel.obtain();
4161 Parcel reply = Parcel.obtain();
4162 data.writeInterfaceToken(IActivityManager.descriptor);
4163 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4164 data.writeTypedList(providers);
4165 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
4166 reply.readException();
4167 data.recycle();
4168 reply.recycle();
4169 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004170 public boolean refContentProvider(IBinder connection, int stable, int unstable)
4171 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004175 data.writeStrongBinder(connection);
4176 data.writeInt(stable);
4177 data.writeInt(unstable);
4178 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4179 reply.readException();
4180 boolean res = reply.readInt() != 0;
4181 data.recycle();
4182 reply.recycle();
4183 return res;
4184 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004185
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004186 public void unstableProviderDied(IBinder connection) throws RemoteException {
4187 Parcel data = Parcel.obtain();
4188 Parcel reply = Parcel.obtain();
4189 data.writeInterfaceToken(IActivityManager.descriptor);
4190 data.writeStrongBinder(connection);
4191 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
4192 reply.readException();
4193 data.recycle();
4194 reply.recycle();
4195 }
4196
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004197 @Override
4198 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
4199 Parcel data = Parcel.obtain();
4200 Parcel reply = Parcel.obtain();
4201 data.writeInterfaceToken(IActivityManager.descriptor);
4202 data.writeStrongBinder(connection);
4203 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
4204 reply.readException();
4205 data.recycle();
4206 reply.recycle();
4207 }
4208
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004209 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4210 Parcel data = Parcel.obtain();
4211 Parcel reply = Parcel.obtain();
4212 data.writeInterfaceToken(IActivityManager.descriptor);
4213 data.writeStrongBinder(connection);
4214 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004215 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4216 reply.readException();
4217 data.recycle();
4218 reply.recycle();
4219 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004220
4221 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4222 Parcel data = Parcel.obtain();
4223 Parcel reply = Parcel.obtain();
4224 data.writeInterfaceToken(IActivityManager.descriptor);
4225 data.writeString(name);
4226 data.writeStrongBinder(token);
4227 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4228 reply.readException();
4229 data.recycle();
4230 reply.recycle();
4231 }
4232
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004233 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4234 throws RemoteException
4235 {
4236 Parcel data = Parcel.obtain();
4237 Parcel reply = Parcel.obtain();
4238 data.writeInterfaceToken(IActivityManager.descriptor);
4239 service.writeToParcel(data, 0);
4240 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4241 reply.readException();
4242 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4243 data.recycle();
4244 reply.recycle();
4245 return res;
4246 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004248 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004249 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004250 {
4251 Parcel data = Parcel.obtain();
4252 Parcel reply = Parcel.obtain();
4253 data.writeInterfaceToken(IActivityManager.descriptor);
4254 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4255 service.writeToParcel(data, 0);
4256 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004257 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004258 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004259 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4260 reply.readException();
4261 ComponentName res = ComponentName.readFromParcel(reply);
4262 data.recycle();
4263 reply.recycle();
4264 return res;
4265 }
4266 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004267 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004268 {
4269 Parcel data = Parcel.obtain();
4270 Parcel reply = Parcel.obtain();
4271 data.writeInterfaceToken(IActivityManager.descriptor);
4272 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4273 service.writeToParcel(data, 0);
4274 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004275 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004276 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4277 reply.readException();
4278 int res = reply.readInt();
4279 reply.recycle();
4280 data.recycle();
4281 return res;
4282 }
4283 public boolean stopServiceToken(ComponentName className, IBinder token,
4284 int startId) throws RemoteException {
4285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 ComponentName.writeToParcel(className, data);
4289 data.writeStrongBinder(token);
4290 data.writeInt(startId);
4291 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4292 reply.readException();
4293 boolean res = reply.readInt() != 0;
4294 data.recycle();
4295 reply.recycle();
4296 return res;
4297 }
4298 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004299 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004300 Parcel data = Parcel.obtain();
4301 Parcel reply = Parcel.obtain();
4302 data.writeInterfaceToken(IActivityManager.descriptor);
4303 ComponentName.writeToParcel(className, data);
4304 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004305 data.writeInt(id);
4306 if (notification != null) {
4307 data.writeInt(1);
4308 notification.writeToParcel(data, 0);
4309 } else {
4310 data.writeInt(0);
4311 }
4312 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004313 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4314 reply.readException();
4315 data.recycle();
4316 reply.recycle();
4317 }
4318 public int bindService(IApplicationThread caller, IBinder token,
4319 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004320 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004321 Parcel data = Parcel.obtain();
4322 Parcel reply = Parcel.obtain();
4323 data.writeInterfaceToken(IActivityManager.descriptor);
4324 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4325 data.writeStrongBinder(token);
4326 service.writeToParcel(data, 0);
4327 data.writeString(resolvedType);
4328 data.writeStrongBinder(connection.asBinder());
4329 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004330 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004331 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004332 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4333 reply.readException();
4334 int res = reply.readInt();
4335 data.recycle();
4336 reply.recycle();
4337 return res;
4338 }
4339 public boolean unbindService(IServiceConnection connection) throws RemoteException
4340 {
4341 Parcel data = Parcel.obtain();
4342 Parcel reply = Parcel.obtain();
4343 data.writeInterfaceToken(IActivityManager.descriptor);
4344 data.writeStrongBinder(connection.asBinder());
4345 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4346 reply.readException();
4347 boolean res = reply.readInt() != 0;
4348 data.recycle();
4349 reply.recycle();
4350 return res;
4351 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004352
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004353 public void publishService(IBinder token,
4354 Intent intent, IBinder service) throws RemoteException {
4355 Parcel data = Parcel.obtain();
4356 Parcel reply = Parcel.obtain();
4357 data.writeInterfaceToken(IActivityManager.descriptor);
4358 data.writeStrongBinder(token);
4359 intent.writeToParcel(data, 0);
4360 data.writeStrongBinder(service);
4361 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4362 reply.readException();
4363 data.recycle();
4364 reply.recycle();
4365 }
4366
4367 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4368 throws RemoteException {
4369 Parcel data = Parcel.obtain();
4370 Parcel reply = Parcel.obtain();
4371 data.writeInterfaceToken(IActivityManager.descriptor);
4372 data.writeStrongBinder(token);
4373 intent.writeToParcel(data, 0);
4374 data.writeInt(doRebind ? 1 : 0);
4375 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4376 reply.readException();
4377 data.recycle();
4378 reply.recycle();
4379 }
4380
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004381 public void serviceDoneExecuting(IBinder token, int type, int startId,
4382 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004387 data.writeInt(type);
4388 data.writeInt(startId);
4389 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004390 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4391 reply.readException();
4392 data.recycle();
4393 reply.recycle();
4394 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004395
Svet Ganov99b60432015-06-27 13:15:22 -07004396 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4397 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004398 Parcel data = Parcel.obtain();
4399 Parcel reply = Parcel.obtain();
4400 data.writeInterfaceToken(IActivityManager.descriptor);
4401 service.writeToParcel(data, 0);
4402 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004403 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004404 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4405 reply.readException();
4406 IBinder binder = reply.readStrongBinder();
4407 reply.recycle();
4408 data.recycle();
4409 return binder;
4410 }
4411
Christopher Tate181fafa2009-05-14 11:12:14 -07004412 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4413 throws RemoteException {
4414 Parcel data = Parcel.obtain();
4415 Parcel reply = Parcel.obtain();
4416 data.writeInterfaceToken(IActivityManager.descriptor);
4417 app.writeToParcel(data, 0);
4418 data.writeInt(backupRestoreMode);
4419 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4420 reply.readException();
4421 boolean success = reply.readInt() != 0;
4422 reply.recycle();
4423 data.recycle();
4424 return success;
4425 }
4426
Christopher Tate346acb12012-10-15 19:20:25 -07004427 public void clearPendingBackup() throws RemoteException {
4428 Parcel data = Parcel.obtain();
4429 Parcel reply = Parcel.obtain();
4430 data.writeInterfaceToken(IActivityManager.descriptor);
4431 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4432 reply.recycle();
4433 data.recycle();
4434 }
4435
Christopher Tate181fafa2009-05-14 11:12:14 -07004436 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4437 Parcel data = Parcel.obtain();
4438 Parcel reply = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 data.writeString(packageName);
4441 data.writeStrongBinder(agent);
4442 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4443 reply.recycle();
4444 data.recycle();
4445 }
4446
4447 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4448 Parcel data = Parcel.obtain();
4449 Parcel reply = Parcel.obtain();
4450 data.writeInterfaceToken(IActivityManager.descriptor);
4451 app.writeToParcel(data, 0);
4452 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4453 reply.readException();
4454 reply.recycle();
4455 data.recycle();
4456 }
4457
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004458 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004459 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004460 IUiAutomationConnection connection, int userId, String instructionSet)
4461 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004462 Parcel data = Parcel.obtain();
4463 Parcel reply = Parcel.obtain();
4464 data.writeInterfaceToken(IActivityManager.descriptor);
4465 ComponentName.writeToParcel(className, data);
4466 data.writeString(profileFile);
4467 data.writeInt(flags);
4468 data.writeBundle(arguments);
4469 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004470 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004471 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004472 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004473 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4474 reply.readException();
4475 boolean res = reply.readInt() != 0;
4476 reply.recycle();
4477 data.recycle();
4478 return res;
4479 }
4480
4481 public void finishInstrumentation(IApplicationThread target,
4482 int resultCode, Bundle results) throws RemoteException {
4483 Parcel data = Parcel.obtain();
4484 Parcel reply = Parcel.obtain();
4485 data.writeInterfaceToken(IActivityManager.descriptor);
4486 data.writeStrongBinder(target != null ? target.asBinder() : null);
4487 data.writeInt(resultCode);
4488 data.writeBundle(results);
4489 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4490 reply.readException();
4491 data.recycle();
4492 reply.recycle();
4493 }
4494 public Configuration getConfiguration() throws RemoteException
4495 {
4496 Parcel data = Parcel.obtain();
4497 Parcel reply = Parcel.obtain();
4498 data.writeInterfaceToken(IActivityManager.descriptor);
4499 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4500 reply.readException();
4501 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4502 reply.recycle();
4503 data.recycle();
4504 return res;
4505 }
4506 public void updateConfiguration(Configuration values) throws RemoteException
4507 {
4508 Parcel data = Parcel.obtain();
4509 Parcel reply = Parcel.obtain();
4510 data.writeInterfaceToken(IActivityManager.descriptor);
4511 values.writeToParcel(data, 0);
4512 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4513 reply.readException();
4514 data.recycle();
4515 reply.recycle();
4516 }
4517 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4518 throws RemoteException {
4519 Parcel data = Parcel.obtain();
4520 Parcel reply = Parcel.obtain();
4521 data.writeInterfaceToken(IActivityManager.descriptor);
4522 data.writeStrongBinder(token);
4523 data.writeInt(requestedOrientation);
4524 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4525 reply.readException();
4526 data.recycle();
4527 reply.recycle();
4528 }
4529 public int getRequestedOrientation(IBinder token) throws RemoteException {
4530 Parcel data = Parcel.obtain();
4531 Parcel reply = Parcel.obtain();
4532 data.writeInterfaceToken(IActivityManager.descriptor);
4533 data.writeStrongBinder(token);
4534 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4535 reply.readException();
4536 int res = reply.readInt();
4537 data.recycle();
4538 reply.recycle();
4539 return res;
4540 }
4541 public ComponentName getActivityClassForToken(IBinder token)
4542 throws RemoteException {
4543 Parcel data = Parcel.obtain();
4544 Parcel reply = Parcel.obtain();
4545 data.writeInterfaceToken(IActivityManager.descriptor);
4546 data.writeStrongBinder(token);
4547 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4548 reply.readException();
4549 ComponentName res = ComponentName.readFromParcel(reply);
4550 data.recycle();
4551 reply.recycle();
4552 return res;
4553 }
4554 public String getPackageForToken(IBinder token) throws RemoteException
4555 {
4556 Parcel data = Parcel.obtain();
4557 Parcel reply = Parcel.obtain();
4558 data.writeInterfaceToken(IActivityManager.descriptor);
4559 data.writeStrongBinder(token);
4560 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4561 reply.readException();
4562 String res = reply.readString();
4563 data.recycle();
4564 reply.recycle();
4565 return res;
4566 }
4567 public IIntentSender getIntentSender(int type,
4568 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004569 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004570 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004571 Parcel data = Parcel.obtain();
4572 Parcel reply = Parcel.obtain();
4573 data.writeInterfaceToken(IActivityManager.descriptor);
4574 data.writeInt(type);
4575 data.writeString(packageName);
4576 data.writeStrongBinder(token);
4577 data.writeString(resultWho);
4578 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004579 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004580 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004581 data.writeTypedArray(intents, 0);
4582 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004583 } else {
4584 data.writeInt(0);
4585 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004586 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004587 if (options != null) {
4588 data.writeInt(1);
4589 options.writeToParcel(data, 0);
4590 } else {
4591 data.writeInt(0);
4592 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004593 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004594 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4595 reply.readException();
4596 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004597 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004598 data.recycle();
4599 reply.recycle();
4600 return res;
4601 }
4602 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4603 Parcel data = Parcel.obtain();
4604 Parcel reply = Parcel.obtain();
4605 data.writeInterfaceToken(IActivityManager.descriptor);
4606 data.writeStrongBinder(sender.asBinder());
4607 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4608 reply.readException();
4609 data.recycle();
4610 reply.recycle();
4611 }
4612 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4613 Parcel data = Parcel.obtain();
4614 Parcel reply = Parcel.obtain();
4615 data.writeInterfaceToken(IActivityManager.descriptor);
4616 data.writeStrongBinder(sender.asBinder());
4617 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4618 reply.readException();
4619 String res = reply.readString();
4620 data.recycle();
4621 reply.recycle();
4622 return res;
4623 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004624 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4625 Parcel data = Parcel.obtain();
4626 Parcel reply = Parcel.obtain();
4627 data.writeInterfaceToken(IActivityManager.descriptor);
4628 data.writeStrongBinder(sender.asBinder());
4629 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4630 reply.readException();
4631 int res = reply.readInt();
4632 data.recycle();
4633 reply.recycle();
4634 return res;
4635 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004636 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4637 boolean requireFull, String name, String callerPackage) throws RemoteException {
4638 Parcel data = Parcel.obtain();
4639 Parcel reply = Parcel.obtain();
4640 data.writeInterfaceToken(IActivityManager.descriptor);
4641 data.writeInt(callingPid);
4642 data.writeInt(callingUid);
4643 data.writeInt(userId);
4644 data.writeInt(allowAll ? 1 : 0);
4645 data.writeInt(requireFull ? 1 : 0);
4646 data.writeString(name);
4647 data.writeString(callerPackage);
4648 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4649 reply.readException();
4650 int res = reply.readInt();
4651 data.recycle();
4652 reply.recycle();
4653 return res;
4654 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004655 public void setProcessLimit(int max) throws RemoteException
4656 {
4657 Parcel data = Parcel.obtain();
4658 Parcel reply = Parcel.obtain();
4659 data.writeInterfaceToken(IActivityManager.descriptor);
4660 data.writeInt(max);
4661 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4662 reply.readException();
4663 data.recycle();
4664 reply.recycle();
4665 }
4666 public int getProcessLimit() throws RemoteException
4667 {
4668 Parcel data = Parcel.obtain();
4669 Parcel reply = Parcel.obtain();
4670 data.writeInterfaceToken(IActivityManager.descriptor);
4671 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4672 reply.readException();
4673 int res = reply.readInt();
4674 data.recycle();
4675 reply.recycle();
4676 return res;
4677 }
4678 public void setProcessForeground(IBinder token, int pid,
4679 boolean isForeground) throws RemoteException {
4680 Parcel data = Parcel.obtain();
4681 Parcel reply = Parcel.obtain();
4682 data.writeInterfaceToken(IActivityManager.descriptor);
4683 data.writeStrongBinder(token);
4684 data.writeInt(pid);
4685 data.writeInt(isForeground ? 1 : 0);
4686 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4687 reply.readException();
4688 data.recycle();
4689 reply.recycle();
4690 }
4691 public int checkPermission(String permission, int pid, int uid)
4692 throws RemoteException {
4693 Parcel data = Parcel.obtain();
4694 Parcel reply = Parcel.obtain();
4695 data.writeInterfaceToken(IActivityManager.descriptor);
4696 data.writeString(permission);
4697 data.writeInt(pid);
4698 data.writeInt(uid);
4699 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4700 reply.readException();
4701 int res = reply.readInt();
4702 data.recycle();
4703 reply.recycle();
4704 return res;
4705 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004706 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4707 throws RemoteException {
4708 Parcel data = Parcel.obtain();
4709 Parcel reply = Parcel.obtain();
4710 data.writeInterfaceToken(IActivityManager.descriptor);
4711 data.writeString(permission);
4712 data.writeInt(pid);
4713 data.writeInt(uid);
4714 data.writeStrongBinder(callerToken);
4715 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4716 reply.readException();
4717 int res = reply.readInt();
4718 data.recycle();
4719 reply.recycle();
4720 return res;
4721 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004722 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004723 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004724 Parcel data = Parcel.obtain();
4725 Parcel reply = Parcel.obtain();
4726 data.writeInterfaceToken(IActivityManager.descriptor);
4727 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004728 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004729 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004730 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4731 reply.readException();
4732 boolean res = reply.readInt() != 0;
4733 data.recycle();
4734 reply.recycle();
4735 return res;
4736 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004737 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4738 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004739 Parcel data = Parcel.obtain();
4740 Parcel reply = Parcel.obtain();
4741 data.writeInterfaceToken(IActivityManager.descriptor);
4742 uri.writeToParcel(data, 0);
4743 data.writeInt(pid);
4744 data.writeInt(uid);
4745 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004746 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004747 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004748 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4749 reply.readException();
4750 int res = reply.readInt();
4751 data.recycle();
4752 reply.recycle();
4753 return res;
4754 }
4755 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004756 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004757 Parcel data = Parcel.obtain();
4758 Parcel reply = Parcel.obtain();
4759 data.writeInterfaceToken(IActivityManager.descriptor);
4760 data.writeStrongBinder(caller.asBinder());
4761 data.writeString(targetPkg);
4762 uri.writeToParcel(data, 0);
4763 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004764 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004765 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4766 reply.readException();
4767 data.recycle();
4768 reply.recycle();
4769 }
4770 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004771 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004772 Parcel data = Parcel.obtain();
4773 Parcel reply = Parcel.obtain();
4774 data.writeInterfaceToken(IActivityManager.descriptor);
4775 data.writeStrongBinder(caller.asBinder());
4776 uri.writeToParcel(data, 0);
4777 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004778 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004779 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4780 reply.readException();
4781 data.recycle();
4782 reply.recycle();
4783 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004784
4785 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004786 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4787 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004788 Parcel data = Parcel.obtain();
4789 Parcel reply = Parcel.obtain();
4790 data.writeInterfaceToken(IActivityManager.descriptor);
4791 uri.writeToParcel(data, 0);
4792 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004793 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004794 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4795 reply.readException();
4796 data.recycle();
4797 reply.recycle();
4798 }
4799
4800 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004801 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4802 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004803 Parcel data = Parcel.obtain();
4804 Parcel reply = Parcel.obtain();
4805 data.writeInterfaceToken(IActivityManager.descriptor);
4806 uri.writeToParcel(data, 0);
4807 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004808 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004809 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4810 reply.readException();
4811 data.recycle();
4812 reply.recycle();
4813 }
4814
4815 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004816 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4817 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004818 Parcel data = Parcel.obtain();
4819 Parcel reply = Parcel.obtain();
4820 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004821 data.writeString(packageName);
4822 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004823 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4824 reply.readException();
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004825 @SuppressWarnings("unchecked")
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004826 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4827 reply);
4828 data.recycle();
4829 reply.recycle();
4830 return perms;
4831 }
4832
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004833 @Override
4834 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId)
4835 throws RemoteException {
4836 Parcel data = Parcel.obtain();
4837 Parcel reply = Parcel.obtain();
4838 data.writeInterfaceToken(IActivityManager.descriptor);
4839 data.writeString(packageName);
4840 data.writeInt(userId);
4841 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4842 reply.readException();
4843 @SuppressWarnings("unchecked")
4844 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4845 reply);
4846 data.recycle();
4847 reply.recycle();
4848 return perms;
4849 }
4850
4851 @Override
4852 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException {
4853 Parcel data = Parcel.obtain();
4854 Parcel reply = Parcel.obtain();
4855 data.writeInterfaceToken(IActivityManager.descriptor);
4856 data.writeString(packageName);
4857 data.writeInt(userId);
4858 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4859 reply.readException();
4860 data.recycle();
4861 reply.recycle();
4862 }
4863
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004864 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4865 throws RemoteException {
4866 Parcel data = Parcel.obtain();
4867 Parcel reply = Parcel.obtain();
4868 data.writeInterfaceToken(IActivityManager.descriptor);
4869 data.writeStrongBinder(who.asBinder());
4870 data.writeInt(waiting ? 1 : 0);
4871 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4872 reply.readException();
4873 data.recycle();
4874 reply.recycle();
4875 }
4876 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4877 Parcel data = Parcel.obtain();
4878 Parcel reply = Parcel.obtain();
4879 data.writeInterfaceToken(IActivityManager.descriptor);
4880 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4881 reply.readException();
4882 outInfo.readFromParcel(reply);
4883 data.recycle();
4884 reply.recycle();
4885 }
4886 public void unhandledBack() throws RemoteException
4887 {
4888 Parcel data = Parcel.obtain();
4889 Parcel reply = Parcel.obtain();
4890 data.writeInterfaceToken(IActivityManager.descriptor);
4891 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4892 reply.readException();
4893 data.recycle();
4894 reply.recycle();
4895 }
4896 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4897 {
4898 Parcel data = Parcel.obtain();
4899 Parcel reply = Parcel.obtain();
4900 data.writeInterfaceToken(IActivityManager.descriptor);
4901 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4902 reply.readException();
4903 ParcelFileDescriptor pfd = null;
4904 if (reply.readInt() != 0) {
4905 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4906 }
4907 data.recycle();
4908 reply.recycle();
4909 return pfd;
4910 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004911 public void setLockScreenShown(boolean shown) throws RemoteException
4912 {
4913 Parcel data = Parcel.obtain();
4914 Parcel reply = Parcel.obtain();
4915 data.writeInterfaceToken(IActivityManager.descriptor);
4916 data.writeInt(shown ? 1 : 0);
4917 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4918 reply.readException();
4919 data.recycle();
4920 reply.recycle();
4921 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004922 public void setDebugApp(
4923 String packageName, boolean waitForDebugger, boolean persistent)
4924 throws RemoteException
4925 {
4926 Parcel data = Parcel.obtain();
4927 Parcel reply = Parcel.obtain();
4928 data.writeInterfaceToken(IActivityManager.descriptor);
4929 data.writeString(packageName);
4930 data.writeInt(waitForDebugger ? 1 : 0);
4931 data.writeInt(persistent ? 1 : 0);
4932 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4933 reply.readException();
4934 data.recycle();
4935 reply.recycle();
4936 }
4937 public void setAlwaysFinish(boolean enabled) throws RemoteException
4938 {
4939 Parcel data = Parcel.obtain();
4940 Parcel reply = Parcel.obtain();
4941 data.writeInterfaceToken(IActivityManager.descriptor);
4942 data.writeInt(enabled ? 1 : 0);
4943 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4944 reply.readException();
4945 data.recycle();
4946 reply.recycle();
4947 }
Dianne Hackborn4a18c262016-02-26 17:23:48 -08004948 public void setActivityController(IActivityController watcher, boolean imAMonkey)
4949 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004950 {
4951 Parcel data = Parcel.obtain();
4952 Parcel reply = Parcel.obtain();
4953 data.writeInterfaceToken(IActivityManager.descriptor);
4954 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn4a18c262016-02-26 17:23:48 -08004955 data.writeInt(imAMonkey ? 1 : 0);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004956 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004957 reply.readException();
4958 data.recycle();
4959 reply.recycle();
4960 }
Dianne Hackbornb2117d12016-02-16 18:26:35 -08004961 public void setLenientBackgroundCheck(boolean enabled) throws RemoteException
4962 {
4963 Parcel data = Parcel.obtain();
4964 Parcel reply = Parcel.obtain();
4965 data.writeInterfaceToken(IActivityManager.descriptor);
4966 data.writeInt(enabled ? 1 : 0);
4967 mRemote.transact(SET_LENIENT_BACKGROUND_CHECK_TRANSACTION, data, reply, 0);
4968 reply.readException();
4969 data.recycle();
4970 reply.recycle();
4971 }
Dianne Hackborn970510b2016-02-24 16:56:42 -08004972 public int getMemoryTrimLevel() throws RemoteException
4973 {
4974 Parcel data = Parcel.obtain();
4975 Parcel reply = Parcel.obtain();
4976 data.writeInterfaceToken(IActivityManager.descriptor);
4977 mRemote.transact(GET_MEMORY_TRIM_LEVEL_TRANSACTION, data, reply, 0);
4978 reply.readException();
4979 int level = reply.readInt();
4980 data.recycle();
4981 reply.recycle();
4982 return level;
4983 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004984 public void enterSafeMode() throws RemoteException {
4985 Parcel data = Parcel.obtain();
4986 data.writeInterfaceToken(IActivityManager.descriptor);
4987 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4988 data.recycle();
4989 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004990 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004991 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004992 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004993 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004994 data.writeStrongBinder(sender.asBinder());
4995 data.writeInt(sourceUid);
4996 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004997 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004998 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4999 data.recycle();
5000 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005001 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
5002 throws RemoteException {
5003 Parcel data = Parcel.obtain();
5004 data.writeInterfaceToken(IActivityManager.descriptor);
5005 data.writeStrongBinder(sender.asBinder());
5006 data.writeInt(sourceUid);
5007 data.writeString(tag);
5008 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
5009 data.recycle();
5010 }
5011 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
5012 throws RemoteException {
5013 Parcel data = Parcel.obtain();
5014 data.writeInterfaceToken(IActivityManager.descriptor);
5015 data.writeStrongBinder(sender.asBinder());
5016 data.writeInt(sourceUid);
5017 data.writeString(tag);
5018 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
5019 data.recycle();
5020 }
Dianne Hackborn64825172011-03-02 21:32:58 -08005021 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005022 Parcel data = Parcel.obtain();
5023 Parcel reply = Parcel.obtain();
5024 data.writeInterfaceToken(IActivityManager.descriptor);
5025 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07005026 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08005027 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07005028 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005029 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005030 boolean res = reply.readInt() != 0;
5031 data.recycle();
5032 reply.recycle();
5033 return res;
5034 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07005035 @Override
5036 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
5037 Parcel data = Parcel.obtain();
5038 Parcel reply = Parcel.obtain();
5039 data.writeInterfaceToken(IActivityManager.descriptor);
5040 data.writeString(reason);
5041 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
5042 boolean res = reply.readInt() != 0;
5043 data.recycle();
5044 reply.recycle();
5045 return res;
5046 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005047 public boolean testIsSystemReady()
5048 {
5049 /* this base class version is never called */
5050 return true;
5051 }
Dan Egnor60d87622009-12-16 16:32:58 -08005052 public void handleApplicationCrash(IBinder app,
5053 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
5054 {
5055 Parcel data = Parcel.obtain();
5056 Parcel reply = Parcel.obtain();
5057 data.writeInterfaceToken(IActivityManager.descriptor);
5058 data.writeStrongBinder(app);
5059 crashInfo.writeToParcel(data, 0);
5060 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
5061 reply.readException();
5062 reply.recycle();
5063 data.recycle();
5064 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005065
Dianne Hackborn52322712014-08-26 22:47:26 -07005066 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08005067 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005068 {
5069 Parcel data = Parcel.obtain();
5070 Parcel reply = Parcel.obtain();
5071 data.writeInterfaceToken(IActivityManager.descriptor);
5072 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005073 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07005074 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08005075 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08005076 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005077 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08005078 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005079 reply.recycle();
5080 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08005081 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005082 }
Dan Egnorb7f03672009-12-09 16:22:32 -08005083
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005084 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07005085 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07005086 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005087 {
5088 Parcel data = Parcel.obtain();
5089 Parcel reply = Parcel.obtain();
5090 data.writeInterfaceToken(IActivityManager.descriptor);
5091 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07005092 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07005093 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005094 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
5095 reply.readException();
5096 reply.recycle();
5097 data.recycle();
5098 }
5099
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005100 public void signalPersistentProcesses(int sig) throws RemoteException {
5101 Parcel data = Parcel.obtain();
5102 Parcel reply = Parcel.obtain();
5103 data.writeInterfaceToken(IActivityManager.descriptor);
5104 data.writeInt(sig);
5105 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
5106 reply.readException();
5107 data.recycle();
5108 reply.recycle();
5109 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005110
Dianne Hackborn1676c852012-09-10 14:52:30 -07005111 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005112 Parcel data = Parcel.obtain();
5113 Parcel reply = Parcel.obtain();
5114 data.writeInterfaceToken(IActivityManager.descriptor);
5115 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005116 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005117 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5118 reply.readException();
5119 data.recycle();
5120 reply.recycle();
5121 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005122
5123 public void killAllBackgroundProcesses() throws RemoteException {
5124 Parcel data = Parcel.obtain();
5125 Parcel reply = Parcel.obtain();
5126 data.writeInterfaceToken(IActivityManager.descriptor);
5127 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5128 reply.readException();
5129 data.recycle();
5130 reply.recycle();
5131 }
5132
Gustav Sennton6258dcd2015-10-30 19:25:37 +00005133 public void killPackageDependents(String packageName, int userId) throws RemoteException {
5134 Parcel data = Parcel.obtain();
5135 Parcel reply = Parcel.obtain();
5136 data.writeInterfaceToken(IActivityManager.descriptor);
5137 data.writeString(packageName);
5138 data.writeInt(userId);
5139 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
5140 reply.readException();
5141 data.recycle();
5142 reply.recycle();
5143 }
5144
Dianne Hackborn1676c852012-09-10 14:52:30 -07005145 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08005146 Parcel data = Parcel.obtain();
5147 Parcel reply = Parcel.obtain();
5148 data.writeInterfaceToken(IActivityManager.descriptor);
5149 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005150 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005151 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005152 reply.readException();
5153 data.recycle();
5154 reply.recycle();
5155 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005156
Dianne Hackborn27ff9132012-03-06 14:57:58 -08005157 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
5158 throws RemoteException
5159 {
5160 Parcel data = Parcel.obtain();
5161 Parcel reply = Parcel.obtain();
5162 data.writeInterfaceToken(IActivityManager.descriptor);
5163 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
5164 reply.readException();
5165 outInfo.readFromParcel(reply);
5166 reply.recycle();
5167 data.recycle();
5168 }
5169
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005170 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
5171 {
5172 Parcel data = Parcel.obtain();
5173 Parcel reply = Parcel.obtain();
5174 data.writeInterfaceToken(IActivityManager.descriptor);
5175 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
5176 reply.readException();
5177 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
5178 reply.recycle();
5179 data.recycle();
5180 return res;
5181 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005182
Dianne Hackborn1676c852012-09-10 14:52:30 -07005183 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07005184 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005185 {
5186 Parcel data = Parcel.obtain();
5187 Parcel reply = Parcel.obtain();
5188 data.writeInterfaceToken(IActivityManager.descriptor);
5189 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005190 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005191 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07005192 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07005193 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005194 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07005195 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005196 } else {
5197 data.writeInt(0);
5198 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005199 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
5200 reply.readException();
5201 boolean res = reply.readInt() != 0;
5202 reply.recycle();
5203 data.recycle();
5204 return res;
5205 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005206
Dianne Hackborn55280a92009-05-07 15:53:46 -07005207 public boolean shutdown(int timeout) throws RemoteException
5208 {
5209 Parcel data = Parcel.obtain();
5210 Parcel reply = Parcel.obtain();
5211 data.writeInterfaceToken(IActivityManager.descriptor);
5212 data.writeInt(timeout);
5213 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
5214 reply.readException();
5215 boolean res = reply.readInt() != 0;
5216 reply.recycle();
5217 data.recycle();
5218 return res;
5219 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005220
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005221 public void stopAppSwitches() throws RemoteException {
5222 Parcel data = Parcel.obtain();
5223 Parcel reply = Parcel.obtain();
5224 data.writeInterfaceToken(IActivityManager.descriptor);
5225 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
5226 reply.readException();
5227 reply.recycle();
5228 data.recycle();
5229 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005230
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005231 public void resumeAppSwitches() throws RemoteException {
5232 Parcel data = Parcel.obtain();
5233 Parcel reply = Parcel.obtain();
5234 data.writeInterfaceToken(IActivityManager.descriptor);
5235 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
5236 reply.readException();
5237 reply.recycle();
5238 data.recycle();
5239 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07005240
5241 public void addPackageDependency(String packageName) throws RemoteException {
5242 Parcel data = Parcel.obtain();
5243 Parcel reply = Parcel.obtain();
5244 data.writeInterfaceToken(IActivityManager.descriptor);
5245 data.writeString(packageName);
5246 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
5247 reply.readException();
5248 data.recycle();
5249 reply.recycle();
5250 }
5251
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005252 public void killApplicationWithAppId(String pkg, int appid, String reason)
5253 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005254 Parcel data = Parcel.obtain();
5255 Parcel reply = Parcel.obtain();
5256 data.writeInterfaceToken(IActivityManager.descriptor);
5257 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005258 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005259 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005260 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005261 reply.readException();
5262 data.recycle();
5263 reply.recycle();
5264 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005265
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07005266 public void closeSystemDialogs(String reason) throws RemoteException {
5267 Parcel data = Parcel.obtain();
5268 Parcel reply = Parcel.obtain();
5269 data.writeInterfaceToken(IActivityManager.descriptor);
5270 data.writeString(reason);
5271 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5272 reply.readException();
5273 data.recycle();
5274 reply.recycle();
5275 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005276
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005277 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005278 throws RemoteException {
5279 Parcel data = Parcel.obtain();
5280 Parcel reply = Parcel.obtain();
5281 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005282 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005283 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5284 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005285 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005286 data.recycle();
5287 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005288 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005289 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005290
5291 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5292 Parcel data = Parcel.obtain();
5293 Parcel reply = Parcel.obtain();
5294 data.writeInterfaceToken(IActivityManager.descriptor);
5295 data.writeString(processName);
5296 data.writeInt(uid);
5297 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5298 reply.readException();
5299 data.recycle();
5300 reply.recycle();
5301 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005302
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005303 public void overridePendingTransition(IBinder token, String packageName,
5304 int enterAnim, int exitAnim) throws RemoteException {
5305 Parcel data = Parcel.obtain();
5306 Parcel reply = Parcel.obtain();
5307 data.writeInterfaceToken(IActivityManager.descriptor);
5308 data.writeStrongBinder(token);
5309 data.writeString(packageName);
5310 data.writeInt(enterAnim);
5311 data.writeInt(exitAnim);
5312 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5313 reply.readException();
5314 data.recycle();
5315 reply.recycle();
5316 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005317
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005318 public boolean isUserAMonkey() throws RemoteException {
5319 Parcel data = Parcel.obtain();
5320 Parcel reply = Parcel.obtain();
5321 data.writeInterfaceToken(IActivityManager.descriptor);
5322 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5323 reply.readException();
5324 boolean res = reply.readInt() != 0;
5325 data.recycle();
5326 reply.recycle();
5327 return res;
5328 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005329
5330 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5331 Parcel data = Parcel.obtain();
5332 Parcel reply = Parcel.obtain();
5333 data.writeInterfaceToken(IActivityManager.descriptor);
5334 data.writeInt(monkey ? 1 : 0);
5335 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5336 reply.readException();
5337 data.recycle();
5338 reply.recycle();
5339 }
5340
Dianne Hackborn860755f2010-06-03 18:47:52 -07005341 public void finishHeavyWeightApp() throws RemoteException {
5342 Parcel data = Parcel.obtain();
5343 Parcel reply = Parcel.obtain();
5344 data.writeInterfaceToken(IActivityManager.descriptor);
5345 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5346 reply.readException();
5347 data.recycle();
5348 reply.recycle();
5349 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005350
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005351 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005352 throws RemoteException {
5353 Parcel data = Parcel.obtain();
5354 Parcel reply = Parcel.obtain();
5355 data.writeInterfaceToken(IActivityManager.descriptor);
5356 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005357 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5358 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005359 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005360 data.recycle();
5361 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005362 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005363 }
5364
Craig Mautner233ceee2014-05-09 17:05:11 -07005365 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005366 throws RemoteException {
5367 Parcel data = Parcel.obtain();
5368 Parcel reply = Parcel.obtain();
5369 data.writeInterfaceToken(IActivityManager.descriptor);
5370 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005371 if (options == null) {
5372 data.writeInt(0);
5373 } else {
5374 data.writeInt(1);
5375 data.writeBundle(options.toBundle());
5376 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005377 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005378 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005379 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005380 data.recycle();
5381 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005382 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005383 }
5384
Craig Mautner233ceee2014-05-09 17:05:11 -07005385 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5386 Parcel data = Parcel.obtain();
5387 Parcel reply = Parcel.obtain();
5388 data.writeInterfaceToken(IActivityManager.descriptor);
5389 data.writeStrongBinder(token);
5390 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5391 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005392 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005393 data.recycle();
5394 reply.recycle();
5395 return options;
5396 }
5397
Daniel Sandler69a48172010-06-23 16:29:36 -04005398 public void setImmersive(IBinder token, boolean immersive)
5399 throws RemoteException {
5400 Parcel data = Parcel.obtain();
5401 Parcel reply = Parcel.obtain();
5402 data.writeInterfaceToken(IActivityManager.descriptor);
5403 data.writeStrongBinder(token);
5404 data.writeInt(immersive ? 1 : 0);
5405 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5406 reply.readException();
5407 data.recycle();
5408 reply.recycle();
5409 }
5410
5411 public boolean isImmersive(IBinder token)
5412 throws RemoteException {
5413 Parcel data = Parcel.obtain();
5414 Parcel reply = Parcel.obtain();
5415 data.writeInterfaceToken(IActivityManager.descriptor);
5416 data.writeStrongBinder(token);
5417 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005418 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005419 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005420 data.recycle();
5421 reply.recycle();
5422 return res;
5423 }
5424
Craig Mautnerd61dc202014-07-07 11:09:11 -07005425 public boolean isTopOfTask(IBinder token) throws RemoteException {
5426 Parcel data = Parcel.obtain();
5427 Parcel reply = Parcel.obtain();
5428 data.writeInterfaceToken(IActivityManager.descriptor);
5429 data.writeStrongBinder(token);
5430 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5431 reply.readException();
5432 boolean res = reply.readInt() == 1;
5433 data.recycle();
5434 reply.recycle();
5435 return res;
5436 }
5437
Daniel Sandler69a48172010-06-23 16:29:36 -04005438 public boolean isTopActivityImmersive()
5439 throws RemoteException {
5440 Parcel data = Parcel.obtain();
5441 Parcel reply = Parcel.obtain();
5442 data.writeInterfaceToken(IActivityManager.descriptor);
5443 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005444 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005445 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005446 data.recycle();
5447 reply.recycle();
5448 return res;
5449 }
5450
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005451 public void crashApplication(int uid, int initialPid, String packageName,
5452 String message) throws RemoteException {
5453 Parcel data = Parcel.obtain();
5454 Parcel reply = Parcel.obtain();
5455 data.writeInterfaceToken(IActivityManager.descriptor);
5456 data.writeInt(uid);
5457 data.writeInt(initialPid);
5458 data.writeString(packageName);
5459 data.writeString(message);
5460 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5461 reply.readException();
5462 data.recycle();
5463 reply.recycle();
5464 }
Andy McFadden824c5102010-07-09 16:26:57 -07005465
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005466 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005467 Parcel data = Parcel.obtain();
5468 Parcel reply = Parcel.obtain();
5469 data.writeInterfaceToken(IActivityManager.descriptor);
5470 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005471 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005472 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5473 reply.readException();
5474 String res = reply.readString();
5475 data.recycle();
5476 reply.recycle();
5477 return res;
5478 }
5479
Dianne Hackborn7e269642010-08-25 19:50:20 -07005480 public IBinder newUriPermissionOwner(String name)
5481 throws RemoteException {
5482 Parcel data = Parcel.obtain();
5483 Parcel reply = Parcel.obtain();
5484 data.writeInterfaceToken(IActivityManager.descriptor);
5485 data.writeString(name);
5486 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5487 reply.readException();
5488 IBinder res = reply.readStrongBinder();
5489 data.recycle();
5490 reply.recycle();
5491 return res;
5492 }
5493
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005494 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5495 Parcel data = Parcel.obtain();
5496 Parcel reply = Parcel.obtain();
5497 data.writeInterfaceToken(IActivityManager.descriptor);
5498 data.writeStrongBinder(activityToken);
5499 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5500 reply.readException();
5501 IBinder res = reply.readStrongBinder();
5502 data.recycle();
5503 reply.recycle();
5504 return res;
5505 }
5506
Dianne Hackborn7e269642010-08-25 19:50:20 -07005507 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005508 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005509 Parcel data = Parcel.obtain();
5510 Parcel reply = Parcel.obtain();
5511 data.writeInterfaceToken(IActivityManager.descriptor);
5512 data.writeStrongBinder(owner);
5513 data.writeInt(fromUid);
5514 data.writeString(targetPkg);
5515 uri.writeToParcel(data, 0);
5516 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005517 data.writeInt(sourceUserId);
5518 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005519 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5520 reply.readException();
5521 data.recycle();
5522 reply.recycle();
5523 }
5524
5525 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005526 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005527 Parcel data = Parcel.obtain();
5528 Parcel reply = Parcel.obtain();
5529 data.writeInterfaceToken(IActivityManager.descriptor);
5530 data.writeStrongBinder(owner);
5531 if (uri != null) {
5532 data.writeInt(1);
5533 uri.writeToParcel(data, 0);
5534 } else {
5535 data.writeInt(0);
5536 }
5537 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005538 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005539 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5540 reply.readException();
5541 data.recycle();
5542 reply.recycle();
5543 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005544
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005545 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005546 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005547 Parcel data = Parcel.obtain();
5548 Parcel reply = Parcel.obtain();
5549 data.writeInterfaceToken(IActivityManager.descriptor);
5550 data.writeInt(callingUid);
5551 data.writeString(targetPkg);
5552 uri.writeToParcel(data, 0);
5553 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005554 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005555 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5556 reply.readException();
5557 int res = reply.readInt();
5558 data.recycle();
5559 reply.recycle();
5560 return res;
5561 }
5562
Dianne Hackborn1676c852012-09-10 14:52:30 -07005563 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005564 String path, ParcelFileDescriptor fd) throws RemoteException {
5565 Parcel data = Parcel.obtain();
5566 Parcel reply = Parcel.obtain();
5567 data.writeInterfaceToken(IActivityManager.descriptor);
5568 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005569 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005570 data.writeInt(managed ? 1 : 0);
5571 data.writeString(path);
5572 if (fd != null) {
5573 data.writeInt(1);
5574 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5575 } else {
5576 data.writeInt(0);
5577 }
5578 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5579 reply.readException();
5580 boolean res = reply.readInt() != 0;
5581 reply.recycle();
5582 data.recycle();
5583 return res;
5584 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005585
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005586 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005587 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005588 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005589 Parcel data = Parcel.obtain();
5590 Parcel reply = Parcel.obtain();
5591 data.writeInterfaceToken(IActivityManager.descriptor);
5592 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005593 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005594 data.writeTypedArray(intents, 0);
5595 data.writeStringArray(resolvedTypes);
5596 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005597 if (options != null) {
5598 data.writeInt(1);
5599 options.writeToParcel(data, 0);
5600 } else {
5601 data.writeInt(0);
5602 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005603 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005604 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5605 reply.readException();
5606 int result = reply.readInt();
5607 reply.recycle();
5608 data.recycle();
5609 return result;
5610 }
5611
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005612 public int getFrontActivityScreenCompatMode() throws RemoteException {
5613 Parcel data = Parcel.obtain();
5614 Parcel reply = Parcel.obtain();
5615 data.writeInterfaceToken(IActivityManager.descriptor);
5616 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5617 reply.readException();
5618 int mode = reply.readInt();
5619 reply.recycle();
5620 data.recycle();
5621 return mode;
5622 }
5623
5624 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5625 Parcel data = Parcel.obtain();
5626 Parcel reply = Parcel.obtain();
5627 data.writeInterfaceToken(IActivityManager.descriptor);
5628 data.writeInt(mode);
5629 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5630 reply.readException();
5631 reply.recycle();
5632 data.recycle();
5633 }
5634
5635 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5636 Parcel data = Parcel.obtain();
5637 Parcel reply = Parcel.obtain();
5638 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005639 data.writeString(packageName);
5640 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005641 reply.readException();
5642 int mode = reply.readInt();
5643 reply.recycle();
5644 data.recycle();
5645 return mode;
5646 }
5647
5648 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005649 throws RemoteException {
5650 Parcel data = Parcel.obtain();
5651 Parcel reply = Parcel.obtain();
5652 data.writeInterfaceToken(IActivityManager.descriptor);
5653 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005654 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005655 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5656 reply.readException();
5657 reply.recycle();
5658 data.recycle();
5659 }
5660
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005661 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5662 Parcel data = Parcel.obtain();
5663 Parcel reply = Parcel.obtain();
5664 data.writeInterfaceToken(IActivityManager.descriptor);
5665 data.writeString(packageName);
5666 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5667 reply.readException();
5668 boolean ask = reply.readInt() != 0;
5669 reply.recycle();
5670 data.recycle();
5671 return ask;
5672 }
5673
5674 public void setPackageAskScreenCompat(String packageName, boolean ask)
5675 throws RemoteException {
5676 Parcel data = Parcel.obtain();
5677 Parcel reply = Parcel.obtain();
5678 data.writeInterfaceToken(IActivityManager.descriptor);
5679 data.writeString(packageName);
5680 data.writeInt(ask ? 1 : 0);
5681 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5682 reply.readException();
5683 reply.recycle();
5684 data.recycle();
5685 }
5686
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005687 public boolean switchUser(int userid) throws RemoteException {
5688 Parcel data = Parcel.obtain();
5689 Parcel reply = Parcel.obtain();
5690 data.writeInterfaceToken(IActivityManager.descriptor);
5691 data.writeInt(userid);
5692 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5693 reply.readException();
5694 boolean result = reply.readInt() != 0;
5695 reply.recycle();
5696 data.recycle();
5697 return result;
5698 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005699
Kenny Guy08488bf2014-02-21 17:40:37 +00005700 public boolean startUserInBackground(int userid) throws RemoteException {
5701 Parcel data = Parcel.obtain();
5702 Parcel reply = Parcel.obtain();
5703 data.writeInterfaceToken(IActivityManager.descriptor);
5704 data.writeInt(userid);
5705 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5706 reply.readException();
5707 boolean result = reply.readInt() != 0;
5708 reply.recycle();
5709 data.recycle();
5710 return result;
5711 }
5712
Jeff Sharkeybd91e2f2016-03-22 15:32:31 -06005713 public boolean unlockUser(int userId, byte[] token, byte[] secret, IProgressListener listener)
5714 throws RemoteException {
Jeff Sharkeyba512352015-11-12 20:17:45 -08005715 Parcel data = Parcel.obtain();
5716 Parcel reply = Parcel.obtain();
5717 data.writeInterfaceToken(IActivityManager.descriptor);
5718 data.writeInt(userId);
5719 data.writeByteArray(token);
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005720 data.writeByteArray(secret);
Jeff Sharkeybd91e2f2016-03-22 15:32:31 -06005721 data.writeStrongInterface(listener);
Jeff Sharkeyba512352015-11-12 20:17:45 -08005722 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5723 reply.readException();
5724 boolean result = reply.readInt() != 0;
5725 reply.recycle();
5726 data.recycle();
5727 return result;
5728 }
5729
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005730 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5731 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005732 Parcel data = Parcel.obtain();
5733 Parcel reply = Parcel.obtain();
5734 data.writeInterfaceToken(IActivityManager.descriptor);
5735 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005736 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005737 data.writeStrongInterface(callback);
5738 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5739 reply.readException();
5740 int result = reply.readInt();
5741 reply.recycle();
5742 data.recycle();
5743 return result;
5744 }
5745
Amith Yamasani52f1d752012-03-28 18:19:29 -07005746 public UserInfo getCurrentUser() throws RemoteException {
5747 Parcel data = Parcel.obtain();
5748 Parcel reply = Parcel.obtain();
5749 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005750 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005751 reply.readException();
5752 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5753 reply.recycle();
5754 data.recycle();
5755 return userInfo;
5756 }
5757
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005758 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005759 Parcel data = Parcel.obtain();
5760 Parcel reply = Parcel.obtain();
5761 data.writeInterfaceToken(IActivityManager.descriptor);
5762 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005763 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005764 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5765 reply.readException();
5766 boolean result = reply.readInt() != 0;
5767 reply.recycle();
5768 data.recycle();
5769 return result;
5770 }
5771
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005772 public int[] getRunningUserIds() throws RemoteException {
5773 Parcel data = Parcel.obtain();
5774 Parcel reply = Parcel.obtain();
5775 data.writeInterfaceToken(IActivityManager.descriptor);
5776 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5777 reply.readException();
5778 int[] result = reply.createIntArray();
5779 reply.recycle();
5780 data.recycle();
5781 return result;
5782 }
5783
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005784 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005785 Parcel data = Parcel.obtain();
5786 Parcel reply = Parcel.obtain();
5787 data.writeInterfaceToken(IActivityManager.descriptor);
5788 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005789 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5790 reply.readException();
5791 boolean result = reply.readInt() != 0;
5792 reply.recycle();
5793 data.recycle();
5794 return result;
5795 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005796
Jeff Sharkeya4620792011-05-20 15:29:23 -07005797 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5798 Parcel data = Parcel.obtain();
5799 Parcel reply = Parcel.obtain();
5800 data.writeInterfaceToken(IActivityManager.descriptor);
5801 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5802 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5803 reply.readException();
5804 data.recycle();
5805 reply.recycle();
5806 }
5807
5808 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5809 Parcel data = Parcel.obtain();
5810 Parcel reply = Parcel.obtain();
5811 data.writeInterfaceToken(IActivityManager.descriptor);
5812 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5813 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5814 reply.readException();
5815 data.recycle();
5816 reply.recycle();
5817 }
5818
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005819 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005820 Parcel data = Parcel.obtain();
5821 Parcel reply = Parcel.obtain();
5822 data.writeInterfaceToken(IActivityManager.descriptor);
5823 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005824 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005825 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5826 reply.readException();
5827 data.recycle();
5828 reply.recycle();
5829 }
5830
5831 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5832 Parcel data = Parcel.obtain();
5833 Parcel reply = Parcel.obtain();
5834 data.writeInterfaceToken(IActivityManager.descriptor);
5835 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5836 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5837 reply.readException();
5838 data.recycle();
5839 reply.recycle();
5840 }
5841
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005842 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5843 Parcel data = Parcel.obtain();
5844 Parcel reply = Parcel.obtain();
5845 data.writeInterfaceToken(IActivityManager.descriptor);
5846 data.writeStrongBinder(sender.asBinder());
5847 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5848 reply.readException();
5849 boolean res = reply.readInt() != 0;
5850 data.recycle();
5851 reply.recycle();
5852 return res;
5853 }
5854
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005855 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5856 Parcel data = Parcel.obtain();
5857 Parcel reply = Parcel.obtain();
5858 data.writeInterfaceToken(IActivityManager.descriptor);
5859 data.writeStrongBinder(sender.asBinder());
5860 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5861 reply.readException();
5862 boolean res = reply.readInt() != 0;
5863 data.recycle();
5864 reply.recycle();
5865 return res;
5866 }
5867
Dianne Hackborn81038902012-11-26 17:04:09 -08005868 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5869 Parcel data = Parcel.obtain();
5870 Parcel reply = Parcel.obtain();
5871 data.writeInterfaceToken(IActivityManager.descriptor);
5872 data.writeStrongBinder(sender.asBinder());
5873 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5874 reply.readException();
5875 Intent res = reply.readInt() != 0
5876 ? Intent.CREATOR.createFromParcel(reply) : null;
5877 data.recycle();
5878 reply.recycle();
5879 return res;
5880 }
5881
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005882 public String getTagForIntentSender(IIntentSender sender, String prefix)
5883 throws RemoteException {
5884 Parcel data = Parcel.obtain();
5885 Parcel reply = Parcel.obtain();
5886 data.writeInterfaceToken(IActivityManager.descriptor);
5887 data.writeStrongBinder(sender.asBinder());
5888 data.writeString(prefix);
5889 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5890 reply.readException();
5891 String res = reply.readString();
5892 data.recycle();
5893 reply.recycle();
5894 return res;
5895 }
5896
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005897 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5898 {
5899 Parcel data = Parcel.obtain();
5900 Parcel reply = Parcel.obtain();
5901 data.writeInterfaceToken(IActivityManager.descriptor);
5902 values.writeToParcel(data, 0);
5903 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5904 reply.readException();
5905 data.recycle();
5906 reply.recycle();
5907 }
5908
Dianne Hackbornb437e092011-08-05 17:50:29 -07005909 public long[] getProcessPss(int[] pids) throws RemoteException {
5910 Parcel data = Parcel.obtain();
5911 Parcel reply = Parcel.obtain();
5912 data.writeInterfaceToken(IActivityManager.descriptor);
5913 data.writeIntArray(pids);
5914 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5915 reply.readException();
5916 long[] res = reply.createLongArray();
5917 data.recycle();
5918 reply.recycle();
5919 return res;
5920 }
5921
Dianne Hackborn661cd522011-08-22 00:26:20 -07005922 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5923 Parcel data = Parcel.obtain();
5924 Parcel reply = Parcel.obtain();
5925 data.writeInterfaceToken(IActivityManager.descriptor);
5926 TextUtils.writeToParcel(msg, data, 0);
5927 data.writeInt(always ? 1 : 0);
5928 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5929 reply.readException();
5930 data.recycle();
5931 reply.recycle();
5932 }
5933
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005934 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005935 Parcel data = Parcel.obtain();
5936 Parcel reply = Parcel.obtain();
5937 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005938 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005939 reply.readException();
5940 data.recycle();
5941 reply.recycle();
5942 }
5943
Adrian Roosd5c2db62016-03-08 16:11:31 -08005944 public void keyguardGoingAway(int flags)
5945 throws RemoteException {
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005946 Parcel data = Parcel.obtain();
5947 Parcel reply = Parcel.obtain();
5948 data.writeInterfaceToken(IActivityManager.descriptor);
Adrian Roosd5c2db62016-03-08 16:11:31 -08005949 data.writeInt(flags);
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005950 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5951 reply.readException();
5952 data.recycle();
5953 reply.recycle();
5954 }
5955
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005956 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005957 throws RemoteException {
5958 Parcel data = Parcel.obtain();
5959 Parcel reply = Parcel.obtain();
5960 data.writeInterfaceToken(IActivityManager.descriptor);
5961 data.writeStrongBinder(token);
5962 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005963 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005964 reply.readException();
5965 boolean result = reply.readInt() != 0;
5966 data.recycle();
5967 reply.recycle();
5968 return result;
5969 }
5970
5971 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5972 throws RemoteException {
5973 Parcel data = Parcel.obtain();
5974 Parcel reply = Parcel.obtain();
5975 data.writeInterfaceToken(IActivityManager.descriptor);
5976 data.writeStrongBinder(token);
5977 target.writeToParcel(data, 0);
5978 data.writeInt(resultCode);
5979 if (resultData != null) {
5980 data.writeInt(1);
5981 resultData.writeToParcel(data, 0);
5982 } else {
5983 data.writeInt(0);
5984 }
5985 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5986 reply.readException();
5987 boolean result = reply.readInt() != 0;
5988 data.recycle();
5989 reply.recycle();
5990 return result;
5991 }
5992
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005993 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5994 Parcel data = Parcel.obtain();
5995 Parcel reply = Parcel.obtain();
5996 data.writeInterfaceToken(IActivityManager.descriptor);
5997 data.writeStrongBinder(activityToken);
5998 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5999 reply.readException();
6000 int result = reply.readInt();
6001 data.recycle();
6002 reply.recycle();
6003 return result;
6004 }
6005
Dianne Hackbornf265ea92013-01-31 15:00:51 -08006006 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
6007 Parcel data = Parcel.obtain();
6008 Parcel reply = Parcel.obtain();
6009 data.writeInterfaceToken(IActivityManager.descriptor);
6010 data.writeStrongBinder(activityToken);
6011 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
6012 reply.readException();
6013 String result = reply.readString();
6014 data.recycle();
6015 reply.recycle();
6016 return result;
6017 }
6018
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07006019 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
6020 Parcel data = Parcel.obtain();
6021 Parcel reply = Parcel.obtain();
6022 data.writeInterfaceToken(IActivityManager.descriptor);
6023 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
6024 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
6025 reply.readException();
6026 data.recycle();
6027 reply.recycle();
6028 }
6029
6030 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
6031 Parcel data = Parcel.obtain();
6032 Parcel reply = Parcel.obtain();
6033 data.writeInterfaceToken(IActivityManager.descriptor);
6034 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
6035 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
6036 reply.readException();
6037 data.recycle();
6038 reply.recycle();
6039 }
6040
Michal Karpinski3da5c972015-12-11 18:16:30 +00006041 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType)
6042 throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07006043 Parcel data = Parcel.obtain();
6044 Parcel reply = Parcel.obtain();
6045 data.writeInterfaceToken(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00006046 data.writeInt(bugreportType);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07006047 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
6048 reply.readException();
6049 data.recycle();
6050 reply.recycle();
6051 }
6052
Jeff Brownbd181bb2013-09-10 16:44:24 -07006053 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
6054 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07006055 Parcel data = Parcel.obtain();
6056 Parcel reply = Parcel.obtain();
6057 data.writeInterfaceToken(IActivityManager.descriptor);
6058 data.writeInt(pid);
6059 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07006060 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07006061 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
6062 reply.readException();
6063 long res = reply.readInt();
6064 data.recycle();
6065 reply.recycle();
6066 return res;
6067 }
6068
Adam Skorydfc7fd72013-08-05 19:23:41 -07006069 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006070 Parcel data = Parcel.obtain();
6071 Parcel reply = Parcel.obtain();
6072 data.writeInterfaceToken(IActivityManager.descriptor);
6073 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07006074 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006075 reply.readException();
6076 Bundle res = reply.readBundle();
6077 data.recycle();
6078 reply.recycle();
6079 return res;
6080 }
6081
Dianne Hackborn17f69352015-07-17 18:04:14 -07006082 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
6083 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006084 Parcel data = Parcel.obtain();
6085 Parcel reply = Parcel.obtain();
6086 data.writeInterfaceToken(IActivityManager.descriptor);
6087 data.writeInt(requestType);
6088 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07006089 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006090 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
6091 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07006092 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006093 data.recycle();
6094 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07006095 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006096 }
6097
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07006098 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07006099 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006100 Parcel data = Parcel.obtain();
6101 Parcel reply = Parcel.obtain();
6102 data.writeInterfaceToken(IActivityManager.descriptor);
6103 data.writeStrongBinder(token);
6104 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07006105 structure.writeToParcel(data, 0);
6106 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07006107 if (referrer != null) {
6108 data.writeInt(1);
6109 referrer.writeToParcel(data, 0);
6110 } else {
6111 data.writeInt(0);
6112 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07006113 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006114 reply.readException();
6115 data.recycle();
6116 reply.recycle();
6117 }
6118
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006119 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
6120 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006121 Parcel data = Parcel.obtain();
6122 Parcel reply = Parcel.obtain();
6123 data.writeInterfaceToken(IActivityManager.descriptor);
6124 intent.writeToParcel(data, 0);
6125 data.writeInt(requestType);
6126 data.writeString(hint);
6127 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006128 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006129 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
6130 reply.readException();
6131 boolean res = reply.readInt() != 0;
6132 data.recycle();
6133 reply.recycle();
6134 return res;
6135 }
6136
Dianne Hackborn17f69352015-07-17 18:04:14 -07006137 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01006138 Parcel data = Parcel.obtain();
6139 Parcel reply = Parcel.obtain();
6140 data.writeInterfaceToken(IActivityManager.descriptor);
6141 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
6142 reply.readException();
6143 boolean res = reply.readInt() != 0;
6144 data.recycle();
6145 reply.recycle();
6146 return res;
6147 }
6148
Dianne Hackborn17f69352015-07-17 18:04:14 -07006149 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
6150 Parcel data = Parcel.obtain();
6151 Parcel reply = Parcel.obtain();
6152 data.writeInterfaceToken(IActivityManager.descriptor);
6153 data.writeStrongBinder(token);
6154 data.writeBundle(args);
6155 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
6156 reply.readException();
6157 boolean res = reply.readInt() != 0;
6158 data.recycle();
6159 reply.recycle();
6160 return res;
6161 }
6162
Svetoslavaa41add2015-08-06 15:03:55 -07006163 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006164 Parcel data = Parcel.obtain();
6165 Parcel reply = Parcel.obtain();
6166 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07006167 data.writeInt(appId);
6168 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006169 data.writeString(reason);
6170 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
6171 reply.readException();
6172 data.recycle();
6173 reply.recycle();
6174 }
6175
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07006176 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
6177 Parcel data = Parcel.obtain();
6178 Parcel reply = Parcel.obtain();
6179 data.writeInterfaceToken(IActivityManager.descriptor);
6180 data.writeStrongBinder(who);
6181 data.writeInt(allowRestart ? 1 : 0);
6182 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
6183 reply.readException();
6184 data.recycle();
6185 reply.recycle();
6186 }
6187
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07006188 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
6189 Parcel data = Parcel.obtain();
6190 Parcel reply = Parcel.obtain();
6191 data.writeInterfaceToken(IActivityManager.descriptor);
6192 data.writeStrongBinder(token);
6193 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
6194 reply.readException();
6195 data.recycle();
6196 reply.recycle();
6197 }
6198
Craig Mautner5eda9b32013-07-02 11:58:16 -07006199 public void notifyActivityDrawn(IBinder token) throws RemoteException {
6200 Parcel data = Parcel.obtain();
6201 Parcel reply = Parcel.obtain();
6202 data.writeInterfaceToken(IActivityManager.descriptor);
6203 data.writeStrongBinder(token);
6204 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
6205 reply.readException();
6206 data.recycle();
6207 reply.recycle();
6208 }
6209
Dianne Hackborn57a7f592013-07-22 18:21:32 -07006210 public void restart() throws RemoteException {
6211 Parcel data = Parcel.obtain();
6212 Parcel reply = Parcel.obtain();
6213 data.writeInterfaceToken(IActivityManager.descriptor);
6214 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
6215 reply.readException();
6216 data.recycle();
6217 reply.recycle();
6218 }
6219
Dianne Hackborn35f72be2013-09-16 10:57:39 -07006220 public void performIdleMaintenance() throws RemoteException {
6221 Parcel data = Parcel.obtain();
6222 Parcel reply = Parcel.obtain();
6223 data.writeInterfaceToken(IActivityManager.descriptor);
6224 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
6225 reply.readException();
6226 data.recycle();
6227 reply.recycle();
6228 }
6229
Todd Kennedyca4d8422015-01-15 15:19:22 -08006230 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08006231 IActivityContainerCallback callback) throws RemoteException {
6232 Parcel data = Parcel.obtain();
6233 Parcel reply = Parcel.obtain();
6234 data.writeInterfaceToken(IActivityManager.descriptor);
6235 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07006236 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08006237 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08006238 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08006239 final int result = reply.readInt();
6240 final IActivityContainer res;
6241 if (result == 1) {
6242 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6243 } else {
6244 res = null;
6245 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08006246 data.recycle();
6247 reply.recycle();
6248 return res;
6249 }
6250
Craig Mautner95da1082014-02-24 17:54:35 -08006251 public void deleteActivityContainer(IActivityContainer activityContainer)
6252 throws RemoteException {
6253 Parcel data = Parcel.obtain();
6254 Parcel reply = Parcel.obtain();
6255 data.writeInterfaceToken(IActivityManager.descriptor);
6256 data.writeStrongBinder(activityContainer.asBinder());
6257 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
6258 reply.readException();
6259 data.recycle();
6260 reply.recycle();
6261 }
6262
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04006263 public boolean startBinderTracking() throws RemoteException {
6264 Parcel data = Parcel.obtain();
6265 Parcel reply = Parcel.obtain();
6266 data.writeInterfaceToken(IActivityManager.descriptor);
6267 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
6268 reply.readException();
6269 boolean res = reply.readInt() != 0;
6270 reply.recycle();
6271 data.recycle();
6272 return res;
6273 }
6274
6275 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6276 Parcel data = Parcel.obtain();
6277 Parcel reply = Parcel.obtain();
6278 data.writeInterfaceToken(IActivityManager.descriptor);
6279 if (fd != null) {
6280 data.writeInt(1);
6281 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6282 } else {
6283 data.writeInt(0);
6284 }
6285 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6286 reply.readException();
6287 boolean res = reply.readInt() != 0;
6288 reply.recycle();
6289 data.recycle();
6290 return res;
6291 }
6292
Ruben Brunke24b9a62016-02-16 21:38:24 -08006293 public int setVrMode(IBinder token, boolean enabled, ComponentName packageName)
6294 throws RemoteException {
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006295 Parcel data = Parcel.obtain();
6296 Parcel reply = Parcel.obtain();
6297 data.writeInterfaceToken(IActivityManager.descriptor);
6298 data.writeStrongBinder(token);
6299 data.writeInt(enabled ? 1 : 0);
Ruben Brunke24b9a62016-02-16 21:38:24 -08006300 packageName.writeToParcel(data, 0);
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006301 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6302 reply.readException();
Ruben Brunke24b9a62016-02-16 21:38:24 -08006303 int res = reply.readInt();
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006304 data.recycle();
6305 reply.recycle();
Ruben Brunke24b9a62016-02-16 21:38:24 -08006306 return res;
6307 }
6308
6309 public boolean isVrModePackageEnabled(ComponentName packageName)
6310 throws RemoteException {
6311 Parcel data = Parcel.obtain();
6312 Parcel reply = Parcel.obtain();
6313 data.writeInterfaceToken(IActivityManager.descriptor);
6314 packageName.writeToParcel(data, 0);
6315 mRemote.transact(IS_VR_PACKAGE_ENABLED_TRANSACTION, data, reply, 0);
6316 reply.readException();
6317 int res = reply.readInt();
6318 data.recycle();
6319 reply.recycle();
6320 return res == 1;
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006321 }
6322
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006323 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006324 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6325 Parcel data = Parcel.obtain();
6326 Parcel reply = Parcel.obtain();
6327 data.writeInterfaceToken(IActivityManager.descriptor);
6328 data.writeInt(displayId);
6329 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6330 reply.readException();
6331 final int result = reply.readInt();
6332 final IActivityContainer res;
6333 if (result == 1) {
6334 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6335 } else {
6336 res = null;
6337 }
6338 data.recycle();
6339 reply.recycle();
6340 return res;
6341 }
6342
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006343 @Override
6344 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006345 throws RemoteException {
6346 Parcel data = Parcel.obtain();
6347 Parcel reply = Parcel.obtain();
6348 data.writeInterfaceToken(IActivityManager.descriptor);
6349 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006350 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006351 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006352 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006353 data.recycle();
6354 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006355 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006356 }
6357
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006358 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006359 public void startLockTaskMode(int taskId) throws RemoteException {
6360 Parcel data = Parcel.obtain();
6361 Parcel reply = Parcel.obtain();
6362 data.writeInterfaceToken(IActivityManager.descriptor);
6363 data.writeInt(taskId);
6364 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6365 reply.readException();
6366 data.recycle();
6367 reply.recycle();
6368 }
6369
6370 @Override
6371 public void startLockTaskMode(IBinder token) throws RemoteException {
6372 Parcel data = Parcel.obtain();
6373 Parcel reply = Parcel.obtain();
6374 data.writeInterfaceToken(IActivityManager.descriptor);
6375 data.writeStrongBinder(token);
6376 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6377 reply.readException();
6378 data.recycle();
6379 reply.recycle();
6380 }
6381
6382 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006383 public void startLockTaskModeOnCurrent() throws RemoteException {
6384 Parcel data = Parcel.obtain();
6385 Parcel reply = Parcel.obtain();
6386 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006387 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006388 reply.readException();
6389 data.recycle();
6390 reply.recycle();
6391 }
6392
6393 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006394 public void stopLockTaskMode() throws RemoteException {
6395 Parcel data = Parcel.obtain();
6396 Parcel reply = Parcel.obtain();
6397 data.writeInterfaceToken(IActivityManager.descriptor);
6398 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6399 reply.readException();
6400 data.recycle();
6401 reply.recycle();
6402 }
6403
6404 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006405 public void stopLockTaskModeOnCurrent() throws RemoteException {
6406 Parcel data = Parcel.obtain();
6407 Parcel reply = Parcel.obtain();
6408 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006409 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006410 reply.readException();
6411 data.recycle();
6412 reply.recycle();
6413 }
6414
6415 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006416 public boolean isInLockTaskMode() throws RemoteException {
6417 Parcel data = Parcel.obtain();
6418 Parcel reply = Parcel.obtain();
6419 data.writeInterfaceToken(IActivityManager.descriptor);
6420 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6421 reply.readException();
6422 boolean isInLockTaskMode = reply.readInt() == 1;
6423 data.recycle();
6424 reply.recycle();
6425 return isInLockTaskMode;
6426 }
6427
Craig Mautner688b5102014-03-27 16:55:03 -07006428 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006429 public int getLockTaskModeState() throws RemoteException {
6430 Parcel data = Parcel.obtain();
6431 Parcel reply = Parcel.obtain();
6432 data.writeInterfaceToken(IActivityManager.descriptor);
6433 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6434 reply.readException();
6435 int lockTaskModeState = reply.readInt();
6436 data.recycle();
6437 reply.recycle();
6438 return lockTaskModeState;
6439 }
6440
6441 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006442 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6443 Parcel data = Parcel.obtain();
6444 Parcel reply = Parcel.obtain();
6445 data.writeInterfaceToken(IActivityManager.descriptor);
6446 data.writeStrongBinder(token);
6447 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6448 IBinder.FLAG_ONEWAY);
6449 reply.readException();
6450 data.recycle();
6451 reply.recycle();
6452 }
6453
6454 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006455 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006456 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006457 Parcel data = Parcel.obtain();
6458 Parcel reply = Parcel.obtain();
6459 data.writeInterfaceToken(IActivityManager.descriptor);
6460 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006461 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006462 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006463 reply.readException();
6464 data.recycle();
6465 reply.recycle();
6466 }
6467
Craig Mautneree2e45a2014-06-27 12:10:03 -07006468 @Override
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006469 public void setTaskResizeable(int taskId, int resizeableMode) throws RemoteException {
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006470 Parcel data = Parcel.obtain();
6471 Parcel reply = Parcel.obtain();
6472 data.writeInterfaceToken(IActivityManager.descriptor);
6473 data.writeInt(taskId);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006474 data.writeInt(resizeableMode);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006475 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006476 reply.readException();
6477 data.recycle();
6478 reply.recycle();
6479 }
6480
6481 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006482 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006483 {
6484 Parcel data = Parcel.obtain();
6485 Parcel reply = Parcel.obtain();
6486 data.writeInterfaceToken(IActivityManager.descriptor);
6487 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006488 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006489 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006490 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006491 reply.readException();
6492 data.recycle();
6493 reply.recycle();
6494 }
6495
6496 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006497 public Rect getTaskBounds(int taskId) throws RemoteException
6498 {
6499 Parcel data = Parcel.obtain();
6500 Parcel reply = Parcel.obtain();
6501 data.writeInterfaceToken(IActivityManager.descriptor);
6502 data.writeInt(taskId);
6503 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6504 reply.readException();
6505 Rect rect = Rect.CREATOR.createFromParcel(reply);
6506 data.recycle();
6507 reply.recycle();
6508 return rect;
6509 }
6510
6511 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006512 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006513 Parcel data = Parcel.obtain();
6514 Parcel reply = Parcel.obtain();
6515 data.writeInterfaceToken(IActivityManager.descriptor);
6516 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006517 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006518 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6519 reply.readException();
6520 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6521 data.recycle();
6522 reply.recycle();
6523 return icon;
6524 }
6525
6526 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006527 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6528 throws RemoteException {
6529 Parcel data = Parcel.obtain();
6530 Parcel reply = Parcel.obtain();
6531 data.writeInterfaceToken(IActivityManager.descriptor);
6532 if (options == null) {
6533 data.writeInt(0);
6534 } else {
6535 data.writeInt(1);
6536 data.writeBundle(options.toBundle());
6537 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006538 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006539 reply.readException();
6540 data.recycle();
6541 reply.recycle();
6542 }
6543
6544 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006545 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006546 Parcel data = Parcel.obtain();
6547 Parcel reply = Parcel.obtain();
6548 data.writeInterfaceToken(IActivityManager.descriptor);
6549 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006550 data.writeInt(visible ? 1 : 0);
6551 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006552 reply.readException();
6553 boolean success = reply.readInt() > 0;
6554 data.recycle();
6555 reply.recycle();
6556 return success;
6557 }
6558
6559 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006560 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006561 Parcel data = Parcel.obtain();
6562 Parcel reply = Parcel.obtain();
6563 data.writeInterfaceToken(IActivityManager.descriptor);
6564 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006565 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006566 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006567 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006568 data.recycle();
6569 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006570 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006571 }
6572
6573 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006574 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006575 Parcel data = Parcel.obtain();
6576 Parcel reply = Parcel.obtain();
6577 data.writeInterfaceToken(IActivityManager.descriptor);
6578 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006579 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006580 reply.readException();
6581 data.recycle();
6582 reply.recycle();
6583 }
6584
6585 @Override
6586 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6587 Parcel data = Parcel.obtain();
6588 Parcel reply = Parcel.obtain();
6589 data.writeInterfaceToken(IActivityManager.descriptor);
6590 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006591 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006592 reply.readException();
6593 data.recycle();
6594 reply.recycle();
6595 }
6596
Craig Mautner8746a472014-07-24 15:12:54 -07006597 @Override
6598 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6599 Parcel data = Parcel.obtain();
6600 Parcel reply = Parcel.obtain();
6601 data.writeInterfaceToken(IActivityManager.descriptor);
6602 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006603 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006604 reply.readException();
6605 data.recycle();
6606 reply.recycle();
6607 }
6608
Craig Mautner6e2f3952014-09-09 14:26:41 -07006609 @Override
6610 public void bootAnimationComplete() throws RemoteException {
6611 Parcel data = Parcel.obtain();
6612 Parcel reply = Parcel.obtain();
6613 data.writeInterfaceToken(IActivityManager.descriptor);
6614 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6615 reply.readException();
6616 data.recycle();
6617 reply.recycle();
6618 }
6619
Wale Ogunwale18795a22014-12-03 11:38:33 -08006620 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006621 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6622 Parcel data = Parcel.obtain();
6623 Parcel reply = Parcel.obtain();
6624 data.writeInterfaceToken(IActivityManager.descriptor);
6625 data.writeInt(uid);
6626 data.writeByteArray(firstPacket);
6627 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6628 reply.readException();
6629 data.recycle();
6630 reply.recycle();
6631 }
6632
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006633 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006634 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6635 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006636 Parcel data = Parcel.obtain();
6637 Parcel reply = Parcel.obtain();
6638 data.writeInterfaceToken(IActivityManager.descriptor);
6639 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006640 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006641 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006642 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006643 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6644 reply.readException();
6645 data.recycle();
6646 reply.recycle();
6647 }
6648
6649 @Override
6650 public void dumpHeapFinished(String path) throws RemoteException {
6651 Parcel data = Parcel.obtain();
6652 Parcel reply = Parcel.obtain();
6653 data.writeInterfaceToken(IActivityManager.descriptor);
6654 data.writeString(path);
6655 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6656 reply.readException();
6657 data.recycle();
6658 reply.recycle();
6659 }
6660
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006661 @Override
6662 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6663 throws RemoteException {
6664 Parcel data = Parcel.obtain();
6665 Parcel reply = Parcel.obtain();
6666 data.writeInterfaceToken(IActivityManager.descriptor);
6667 data.writeStrongBinder(session.asBinder());
6668 data.writeInt(keepAwake ? 1 : 0);
6669 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6670 reply.readException();
6671 data.recycle();
6672 reply.recycle();
6673 }
6674
Craig Mautnere5600772015-04-03 21:36:37 -07006675 @Override
6676 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6677 Parcel data = Parcel.obtain();
6678 Parcel reply = Parcel.obtain();
6679 data.writeInterfaceToken(IActivityManager.descriptor);
6680 data.writeInt(userId);
6681 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006682 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006683 reply.readException();
6684 data.recycle();
6685 reply.recycle();
6686 }
6687
Dianne Hackborn1e383822015-04-10 14:02:33 -07006688 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006689 public void updateDeviceOwner(String packageName) throws RemoteException {
6690 Parcel data = Parcel.obtain();
6691 Parcel reply = Parcel.obtain();
6692 data.writeInterfaceToken(IActivityManager.descriptor);
6693 data.writeString(packageName);
6694 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6695 reply.readException();
6696 data.recycle();
6697 reply.recycle();
6698 }
6699
6700 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006701 public int getPackageProcessState(String packageName, String callingPackage)
6702 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006703 Parcel data = Parcel.obtain();
6704 Parcel reply = Parcel.obtain();
6705 data.writeInterfaceToken(IActivityManager.descriptor);
6706 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006707 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006708 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6709 reply.readException();
6710 int res = reply.readInt();
6711 data.recycle();
6712 reply.recycle();
6713 return res;
6714 }
6715
Stefan Kuhne16045c22015-06-05 07:18:06 -07006716 @Override
6717 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6718 throws RemoteException {
6719 Parcel data = Parcel.obtain();
6720 Parcel reply = Parcel.obtain();
6721 data.writeInterfaceToken(IActivityManager.descriptor);
6722 data.writeString(process);
6723 data.writeInt(userId);
6724 data.writeInt(level);
6725 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6726 reply.readException();
6727 int res = reply.readInt();
6728 data.recycle();
6729 reply.recycle();
6730 return res != 0;
6731 }
6732
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006733 @Override
6734 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6735 Parcel data = Parcel.obtain();
6736 Parcel reply = Parcel.obtain();
6737 data.writeInterfaceToken(IActivityManager.descriptor);
6738 data.writeStrongBinder(token);
6739 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6740 reply.readException();
6741 int res = reply.readInt();
6742 data.recycle();
6743 reply.recycle();
6744 return res != 0;
6745 }
6746
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006747 @Override
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006748 public void exitFreeformMode(IBinder token) throws RemoteException {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006749 Parcel data = Parcel.obtain();
6750 Parcel reply = Parcel.obtain();
6751 data.writeInterfaceToken(IActivityManager.descriptor);
6752 data.writeStrongBinder(token);
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006753 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006754 reply.readException();
6755 data.recycle();
6756 reply.recycle();
6757 }
6758
6759 @Override
6760 public int getActivityStackId(IBinder token) throws RemoteException {
6761 Parcel data = Parcel.obtain();
6762 Parcel reply = Parcel.obtain();
6763 data.writeInterfaceToken(IActivityManager.descriptor);
6764 data.writeStrongBinder(token);
6765 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6766 reply.readException();
6767 int stackId = reply.readInt();
6768 data.recycle();
6769 reply.recycle();
6770 return stackId;
6771 }
6772
Filip Gruszczynski23493322015-07-29 17:02:59 -07006773 @Override
6774 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006775 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6776 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006777 Parcel data = Parcel.obtain();
6778 Parcel reply = Parcel.obtain();
6779 data.writeInterfaceToken(IActivityManager.descriptor);
6780 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006781 writeIntArray(horizontalSizeConfiguration, data);
6782 writeIntArray(verticalSizeConfigurations, data);
6783 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006784 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6785 reply.readException();
6786 data.recycle();
6787 reply.recycle();
6788 }
6789
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006790 private static void writeIntArray(int[] array, Parcel data) {
6791 if (array == null) {
6792 data.writeInt(0);
6793 } else {
6794 data.writeInt(array.length);
6795 data.writeIntArray(array);
6796 }
6797 }
6798
Wale Ogunwale83301a92015-09-24 15:54:08 -07006799 @Override
6800 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6801 Parcel data = Parcel.obtain();
6802 Parcel reply = Parcel.obtain();
6803 data.writeInterfaceToken(IActivityManager.descriptor);
6804 data.writeInt(suppress ? 1 : 0);
6805 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6806 reply.readException();
6807 data.recycle();
6808 reply.recycle();
6809 }
6810
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006811 @Override
Wale Ogunwale9101d262016-01-15 08:56:11 -08006812 public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006813 Parcel data = Parcel.obtain();
6814 Parcel reply = Parcel.obtain();
6815 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006816 data.writeInt(fromStackId);
Wale Ogunwale9101d262016-01-15 08:56:11 -08006817 data.writeInt(onTop ? 1 : 0);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006818 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006819 reply.readException();
6820 data.recycle();
6821 reply.recycle();
6822 }
6823
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006824 @Override
6825 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6826 Parcel data = Parcel.obtain();
6827 Parcel reply = Parcel.obtain();
6828 data.writeInterfaceToken(IActivityManager.descriptor);
6829 data.writeInt(uid);
6830 data.writeString(packageName);
6831 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6832 reply.readException();
6833 int res = reply.readInt();
6834 data.recycle();
6835 reply.recycle();
6836 return res;
6837 }
6838
Wale Ogunwale5f986092015-12-04 15:35:38 -08006839 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006840 public boolean inMultiWindow(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006841 Parcel data = Parcel.obtain();
6842 Parcel reply = Parcel.obtain();
6843 data.writeInterfaceToken(IActivityManager.descriptor);
6844 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006845 mRemote.transact(IN_MULTI_WINDOW_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006846 reply.readException();
6847 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6848 data.recycle();
6849 reply.recycle();
6850 return multiWindowMode;
6851 }
6852
6853 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006854 public boolean inPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006855 Parcel data = Parcel.obtain();
6856 Parcel reply = Parcel.obtain();
6857 data.writeInterfaceToken(IActivityManager.descriptor);
6858 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006859 mRemote.transact(IN_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006860 reply.readException();
6861 final boolean pipMode = reply.readInt() == 1 ? true : false;
6862 data.recycle();
6863 reply.recycle();
6864 return pipMode;
6865 }
6866
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006867 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006868 public void enterPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006869 Parcel data = Parcel.obtain();
6870 Parcel reply = Parcel.obtain();
6871 data.writeInterfaceToken(IActivityManager.descriptor);
6872 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006873 mRemote.transact(ENTER_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006874 reply.readException();
6875 data.recycle();
6876 reply.recycle();
6877 }
6878
Christopher Tate63fec3e2015-12-11 18:35:28 -08006879 @Override
6880 public boolean isAppForeground(int uid) throws RemoteException {
6881 Parcel data = Parcel.obtain();
6882 Parcel reply = Parcel.obtain();
6883 data.writeInterfaceToken(IActivityManager.descriptor);
6884 data.writeInt(uid);
6885 mRemote.transact(IS_APP_FOREGROUND_TRANSACTION, data, reply, 0);
6886 final boolean isForeground = reply.readInt() == 1 ? true : false;
6887 data.recycle();
6888 reply.recycle();
6889 return isForeground;
6890 };
6891
Wale Ogunwale480dca02016-02-06 13:58:29 -08006892 @Override
6893 public void notifyPinnedStackAnimationEnded() throws RemoteException {
6894 Parcel data = Parcel.obtain();
6895 Parcel reply = Parcel.obtain();
6896 data.writeInterfaceToken(IActivityManager.descriptor);
6897 mRemote.transact(NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION, data, reply, 0);
6898 data.recycle();
6899 reply.recycle();
6900 };
6901
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08006902 @Override
6903 public void removeStack(int stackId) throws RemoteException {
6904 Parcel data = Parcel.obtain();
6905 Parcel reply = Parcel.obtain();
6906 data.writeInterfaceToken(IActivityManager.descriptor);
6907 data.writeInt(stackId);
6908 mRemote.transact(REMOVE_STACK, data, reply, 0);
6909 reply.readException();
6910 data.recycle();
6911 reply.recycle();
6912 }
6913
Tony Mak9c6e8ce2016-03-21 12:07:16 +00006914 public void notifyLockedProfile(@UserIdInt int userId) throws RemoteException
6915 {
6916 Parcel data = Parcel.obtain();
6917 Parcel reply = Parcel.obtain();
6918 data.writeInterfaceToken(IActivityManager.descriptor);
6919 data.writeInt(userId);
6920 mRemote.transact(NOTIFY_LOCKED_PROFILE, data, reply, 0);
6921 reply.readException();
6922 data.recycle();
6923 reply.recycle();
6924 }
6925
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006926 private IBinder mRemote;
6927}