blob: bb36a3e587b94bfd315105801e54e86f69288b75 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700110 null, intent, null, null, Activity.RESULT_OK, null, null,
111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700119 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
120 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700121 } catch (RemoteException ex) {
122 }
123 }
124
125 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
126 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700127 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700128 } catch (RemoteException ex) {
129 }
130 }
131
132 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
133 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700134 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 } catch (RemoteException ex) {
136 }
137 }
138
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800139 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 attachInterface(this, descriptor);
141 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700142
143 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
145 throws RemoteException {
146 switch (code) {
147 case START_ACTIVITY_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800156 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800163 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700169
Amith Yamasani82644082012-08-03 13:09:11 -0700170 case START_ACTIVITY_AS_USER_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 IBinder resultTo = data.readStrongBinder();
179 String resultWho = data.readString();
180 int requestCode = data.readInt();
181 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700182 ProfilerInfo profilerInfo = data.readInt() != 0
183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
186 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800187 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700194 case START_ACTIVITY_AS_CALLER_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
199 String callingPackage = data.readString();
200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
202 IBinder resultTo = data.readStrongBinder();
203 String resultWho = data.readString();
204 int requestCode = data.readInt();
205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700210 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
214 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700215 reply.writeNoException();
216 reply.writeInt(result);
217 return true;
218 }
219
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 case START_ACTIVITY_AND_WAIT_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800225 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800228 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800229 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800230 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700232 ProfilerInfo profilerInfo = data.readInt() != 0
233 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 Bundle options = data.readInt() != 0
235 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700236 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800237 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700238 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800239 reply.writeNoException();
240 result.writeToParcel(reply, 0);
241 return true;
242 }
243
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700244 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
245 {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder b = data.readStrongBinder();
248 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800249 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700250 Intent intent = Intent.CREATOR.createFromParcel(data);
251 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700254 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700255 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700256 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700259 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800260 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700261 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
266
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700267 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 IBinder b = data.readStrongBinder();
271 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700272 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700273 Intent fillInIntent = null;
274 if (data.readInt() != 0) {
275 fillInIntent = Intent.CREATOR.createFromParcel(data);
276 }
277 String resolvedType = data.readString();
278 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700279 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700280 int requestCode = data.readInt();
281 int flagsMask = data.readInt();
282 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700285 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700286 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700287 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700292
Dianne Hackborn91097de2014-04-04 18:02:06 -0700293 case START_VOICE_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 String callingPackage = data.readString();
297 int callingPid = data.readInt();
298 int callingUid = data.readInt();
299 Intent intent = Intent.CREATOR.createFromParcel(data);
300 String resolvedType = data.readString();
301 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
302 data.readStrongBinder());
303 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
304 data.readStrongBinder());
305 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700306 ProfilerInfo profilerInfo = data.readInt() != 0
307 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700308 Bundle options = data.readInt() != 0
309 ? Bundle.CREATOR.createFromParcel(data) : null;
310 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700311 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
312 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700313 reply.writeNoException();
314 reply.writeInt(result);
315 return true;
316 }
317
Amith Yamasani0af6fa72016-01-17 15:36:19 -0800318 case START_LOCAL_VOICE_INTERACTION_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder token = data.readStrongBinder();
322 Bundle options = data.readBundle();
323 startLocalVoiceInteraction(token, options);
324 reply.writeNoException();
325 return true;
326 }
327
328 case STOP_LOCAL_VOICE_INTERACTION_TRANSACTION:
329 {
330 data.enforceInterface(IActivityManager.descriptor);
331 IBinder token = data.readStrongBinder();
332 stopLocalVoiceInteraction(token);
333 reply.writeNoException();
334 return true;
335 }
336
337 case SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION:
338 {
339 data.enforceInterface(IActivityManager.descriptor);
340 boolean result = supportsLocalVoiceInteraction();
341 reply.writeNoException();
342 reply.writeInt(result? 1 : 0);
343 return true;
344 }
345
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800346 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
347 {
348 data.enforceInterface(IActivityManager.descriptor);
349 IBinder callingActivity = data.readStrongBinder();
350 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700351 Bundle options = data.readInt() != 0
352 ? Bundle.CREATOR.createFromParcel(data) : null;
353 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(result ? 1 : 0);
356 return true;
357 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700358
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700359 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
360 {
361 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700362 final int taskId = data.readInt();
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700363 final Bundle options =
364 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
Wale Ogunwale854809c2015-12-27 16:18:19 -0800365 final int result = startActivityFromRecents(taskId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700366 reply.writeNoException();
367 reply.writeInt(result);
368 return true;
369 }
370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 case FINISH_ACTIVITY_TRANSACTION: {
372 data.enforceInterface(IActivityManager.descriptor);
373 IBinder token = data.readStrongBinder();
374 Intent resultData = null;
375 int resultCode = data.readInt();
376 if (data.readInt() != 0) {
377 resultData = Intent.CREATOR.createFromParcel(data);
378 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700379 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700380 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 reply.writeNoException();
382 reply.writeInt(res ? 1 : 0);
383 return true;
384 }
385
386 case FINISH_SUB_ACTIVITY_TRANSACTION: {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700389 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 int requestCode = data.readInt();
391 finishSubActivity(token, resultWho, requestCode);
392 reply.writeNoException();
393 return true;
394 }
395
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700396 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder token = data.readStrongBinder();
399 boolean res = finishActivityAffinity(token);
400 reply.writeNoException();
401 reply.writeInt(res ? 1 : 0);
402 return true;
403 }
404
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700405 case FINISH_VOICE_TASK_TRANSACTION: {
406 data.enforceInterface(IActivityManager.descriptor);
407 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
408 data.readStrongBinder());
409 finishVoiceTask(session);
410 reply.writeNoException();
411 return true;
412 }
413
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700414 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder token = data.readStrongBinder();
417 boolean res = releaseActivityInstance(token);
418 reply.writeNoException();
419 reply.writeInt(res ? 1 : 0);
420 return true;
421 }
422
423 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
426 releaseSomeActivities(app);
427 reply.writeNoException();
428 return true;
429 }
430
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800431 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
432 data.enforceInterface(IActivityManager.descriptor);
433 IBinder token = data.readStrongBinder();
434 boolean res = willActivityBeVisible(token);
435 reply.writeNoException();
436 reply.writeInt(res ? 1 : 0);
437 return true;
438 }
439
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 case REGISTER_RECEIVER_TRANSACTION:
441 {
442 data.enforceInterface(IActivityManager.descriptor);
443 IBinder b = data.readStrongBinder();
444 IApplicationThread app =
445 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700446 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 b = data.readStrongBinder();
448 IIntentReceiver rec
449 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
450 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
451 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700452 int userId = data.readInt();
453 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800454 reply.writeNoException();
455 if (intent != null) {
456 reply.writeInt(1);
457 intent.writeToParcel(reply, 0);
458 } else {
459 reply.writeInt(0);
460 }
461 return true;
462 }
463
464 case UNREGISTER_RECEIVER_TRANSACTION:
465 {
466 data.enforceInterface(IActivityManager.descriptor);
467 IBinder b = data.readStrongBinder();
468 if (b == null) {
469 return true;
470 }
471 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
472 unregisterReceiver(rec);
473 reply.writeNoException();
474 return true;
475 }
476
477 case BROADCAST_INTENT_TRANSACTION:
478 {
479 data.enforceInterface(IActivityManager.descriptor);
480 IBinder b = data.readStrongBinder();
481 IApplicationThread app =
482 b != null ? ApplicationThreadNative.asInterface(b) : null;
483 Intent intent = Intent.CREATOR.createFromParcel(data);
484 String resolvedType = data.readString();
485 b = data.readStrongBinder();
486 IIntentReceiver resultTo =
487 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
488 int resultCode = data.readInt();
489 String resultData = data.readString();
490 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700491 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800492 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700493 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 boolean serialized = data.readInt() != 0;
495 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700496 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700498 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700499 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 reply.writeNoException();
501 reply.writeInt(res);
502 return true;
503 }
504
505 case UNBROADCAST_INTENT_TRANSACTION:
506 {
507 data.enforceInterface(IActivityManager.descriptor);
508 IBinder b = data.readStrongBinder();
509 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
510 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700511 int userId = data.readInt();
512 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 reply.writeNoException();
514 return true;
515 }
516
517 case FINISH_RECEIVER_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 IBinder who = data.readStrongBinder();
520 int resultCode = data.readInt();
521 String resultData = data.readString();
522 Bundle resultExtras = data.readBundle();
523 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800524 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800526 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527 }
528 reply.writeNoException();
529 return true;
530 }
531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 case ATTACH_APPLICATION_TRANSACTION: {
533 data.enforceInterface(IActivityManager.descriptor);
534 IApplicationThread app = ApplicationThreadNative.asInterface(
535 data.readStrongBinder());
536 if (app != null) {
537 attachApplication(app);
538 }
539 reply.writeNoException();
540 return true;
541 }
542
543 case ACTIVITY_IDLE_TRANSACTION: {
544 data.enforceInterface(IActivityManager.descriptor);
545 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700546 Configuration config = null;
547 if (data.readInt() != 0) {
548 config = Configuration.CREATOR.createFromParcel(data);
549 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700550 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700552 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 }
554 reply.writeNoException();
555 return true;
556 }
557
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700558 case ACTIVITY_RESUMED_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activityResumed(token);
562 reply.writeNoException();
563 return true;
564 }
565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 case ACTIVITY_PAUSED_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700569 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800570 reply.writeNoException();
571 return true;
572 }
573
574 case ACTIVITY_STOPPED_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800577 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700578 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700580 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 reply.writeNoException();
582 return true;
583 }
584
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800585 case ACTIVITY_SLEPT_TRANSACTION: {
586 data.enforceInterface(IActivityManager.descriptor);
587 IBinder token = data.readStrongBinder();
588 activitySlept(token);
589 reply.writeNoException();
590 return true;
591 }
592
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800593 case ACTIVITY_DESTROYED_TRANSACTION: {
594 data.enforceInterface(IActivityManager.descriptor);
595 IBinder token = data.readStrongBinder();
596 activityDestroyed(token);
597 reply.writeNoException();
598 return true;
599 }
600
Jorim Jaggife89d122015-12-22 16:28:44 +0100601 case ACTIVITY_RELAUNCHED_TRANSACTION: {
602 data.enforceInterface(IActivityManager.descriptor);
603 IBinder token = data.readStrongBinder();
604 activityRelaunched(token);
605 reply.writeNoException();
606 return true;
607 }
608
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 case GET_CALLING_PACKAGE_TRANSACTION: {
610 data.enforceInterface(IActivityManager.descriptor);
611 IBinder token = data.readStrongBinder();
612 String res = token != null ? getCallingPackage(token) : null;
613 reply.writeNoException();
614 reply.writeString(res);
615 return true;
616 }
617
618 case GET_CALLING_ACTIVITY_TRANSACTION: {
619 data.enforceInterface(IActivityManager.descriptor);
620 IBinder token = data.readStrongBinder();
621 ComponentName cn = getCallingActivity(token);
622 reply.writeNoException();
623 ComponentName.writeToParcel(cn, reply);
624 return true;
625 }
626
Winson Chung1147c402014-05-14 11:05:00 -0700627 case GET_APP_TASKS_TRANSACTION: {
628 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700629 String callingPackage = data.readString();
630 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700631 reply.writeNoException();
632 int N = list != null ? list.size() : -1;
633 reply.writeInt(N);
634 int i;
635 for (i=0; i<N; i++) {
636 IAppTask task = list.get(i);
637 reply.writeStrongBinder(task.asBinder());
638 }
639 return true;
640 }
641
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700642 case ADD_APP_TASK_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 IBinder activityToken = data.readStrongBinder();
645 Intent intent = Intent.CREATOR.createFromParcel(data);
646 ActivityManager.TaskDescription descr
647 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
648 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
649 int res = addAppTask(activityToken, intent, descr, thumbnail);
650 reply.writeNoException();
651 reply.writeInt(res);
652 return true;
653 }
654
655 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
656 data.enforceInterface(IActivityManager.descriptor);
657 Point size = getAppTaskThumbnailSize();
658 reply.writeNoException();
659 size.writeToParcel(reply, 0);
660 return true;
661 }
662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800663 case GET_TASKS_TRANSACTION: {
664 data.enforceInterface(IActivityManager.descriptor);
665 int maxNum = data.readInt();
666 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700667 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 reply.writeNoException();
669 int N = list != null ? list.size() : -1;
670 reply.writeInt(N);
671 int i;
672 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700673 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800674 info.writeToParcel(reply, 0);
675 }
676 return true;
677 }
678
679 case GET_RECENT_TASKS_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 int maxNum = data.readInt();
682 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700683 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700685 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800686 reply.writeNoException();
687 reply.writeTypedList(list);
688 return true;
689 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700690
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700691 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800692 data.enforceInterface(IActivityManager.descriptor);
693 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700694 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800695 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700696 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800697 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700698 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700699 } else {
700 reply.writeInt(0);
701 }
702 return true;
703 }
704
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 case GET_SERVICES_TRANSACTION: {
706 data.enforceInterface(IActivityManager.descriptor);
707 int maxNum = data.readInt();
708 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700709 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 reply.writeNoException();
711 int N = list != null ? list.size() : -1;
712 reply.writeInt(N);
713 int i;
714 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700715 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716 info.writeToParcel(reply, 0);
717 }
718 return true;
719 }
720
721 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
724 reply.writeNoException();
725 reply.writeTypedList(list);
726 return true;
727 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700728
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
730 data.enforceInterface(IActivityManager.descriptor);
731 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
732 reply.writeNoException();
733 reply.writeTypedList(list);
734 return true;
735 }
736
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700737 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
738 data.enforceInterface(IActivityManager.descriptor);
739 List<ApplicationInfo> list = getRunningExternalApplications();
740 reply.writeNoException();
741 reply.writeTypedList(list);
742 return true;
743 }
744
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 case MOVE_TASK_TO_FRONT_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800748 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700749 Bundle options = data.readInt() != 0
750 ? Bundle.CREATOR.createFromParcel(data) : null;
751 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 reply.writeNoException();
753 return true;
754 }
755
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800756 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
758 IBinder token = data.readStrongBinder();
759 boolean nonRoot = data.readInt() != 0;
760 boolean res = moveActivityTaskToBack(token, nonRoot);
761 reply.writeNoException();
762 reply.writeInt(res ? 1 : 0);
763 return true;
764 }
765
766 case MOVE_TASK_BACKWARDS_TRANSACTION: {
767 data.enforceInterface(IActivityManager.descriptor);
768 int task = data.readInt();
769 moveTaskBackwards(task);
770 reply.writeNoException();
771 return true;
772 }
773
Craig Mautnerc00204b2013-03-05 15:02:14 -0800774 case MOVE_TASK_TO_STACK_TRANSACTION: {
775 data.enforceInterface(IActivityManager.descriptor);
776 int taskId = data.readInt();
777 int stackId = data.readInt();
778 boolean toTop = data.readInt() != 0;
779 moveTaskToStack(taskId, stackId, toTop);
780 reply.writeNoException();
781 return true;
782 }
783
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700784 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 int taskId = data.readInt();
787 int createMode = data.readInt();
788 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800789 boolean animate = data.readInt() != 0;
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -0800790 Rect bounds = null;
791 boolean hasBounds = data.readInt() != 0;
792 if (hasBounds) {
793 bounds = Rect.CREATOR.createFromParcel(data);
794 }
795 moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700796 reply.writeNoException();
797 return true;
798 }
799
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700800 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700801 data.enforceInterface(IActivityManager.descriptor);
802 final int stackId = data.readInt();
803 final Rect r = Rect.CREATOR.createFromParcel(data);
804 final boolean res = moveTopActivityToPinnedStack(stackId, r);
805 reply.writeNoException();
806 reply.writeInt(res ? 1 : 0);
807 return true;
808 }
809
Craig Mautnerc00204b2013-03-05 15:02:14 -0800810 case RESIZE_STACK_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700812 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100813 final boolean hasRect = data.readInt() != 0;
814 Rect r = null;
815 if (hasRect) {
816 r = Rect.CREATOR.createFromParcel(data);
817 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700818 final boolean allowResizeInDockedMode = data.readInt() == 1;
Filip Gruszczynski84fa3352016-01-25 16:28:49 -0800819 final boolean preserveWindows = data.readInt() == 1;
820 final boolean animate = data.readInt() == 1;
821 resizeStack(stackId, r, allowResizeInDockedMode, preserveWindows, animate);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800822 reply.writeNoException();
823 return true;
824 }
825
Jorim Jaggidc249c42015-12-15 14:57:31 -0800826 case RESIZE_DOCKED_STACK_TRANSACTION: {
827 data.enforceInterface(IActivityManager.descriptor);
828 final boolean hasBounds = data.readInt() != 0;
829 Rect bounds = null;
830 if (hasBounds) {
831 bounds = Rect.CREATOR.createFromParcel(data);
832 }
833 final boolean hasTempDockedTaskBounds = data.readInt() != 0;
834 Rect tempDockedTaskBounds = null;
835 if (hasTempDockedTaskBounds) {
836 tempDockedTaskBounds = Rect.CREATOR.createFromParcel(data);
837 }
838 final boolean hasTempDockedTaskInsetBounds = data.readInt() != 0;
839 Rect tempDockedTaskInsetBounds = null;
840 if (hasTempDockedTaskInsetBounds) {
841 tempDockedTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
842 }
843 final boolean hasTempOtherTaskBounds = data.readInt() != 0;
844 Rect tempOtherTaskBounds = null;
845 if (hasTempOtherTaskBounds) {
846 tempOtherTaskBounds = Rect.CREATOR.createFromParcel(data);
847 }
848 final boolean hasTempOtherTaskInsetBounds = data.readInt() != 0;
849 Rect tempOtherTaskInsetBounds = null;
850 if (hasTempOtherTaskInsetBounds) {
851 tempOtherTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
852 }
853 resizeDockedStack(bounds, tempDockedTaskBounds, tempDockedTaskInsetBounds,
854 tempOtherTaskBounds, tempOtherTaskInsetBounds);
855 reply.writeNoException();
856 return true;
857 }
858
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700859 case POSITION_TASK_IN_STACK_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 int taskId = data.readInt();
862 int stackId = data.readInt();
863 int position = data.readInt();
864 positionTaskInStack(taskId, stackId, position);
865 reply.writeNoException();
866 return true;
867 }
868
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800869 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700870 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800871 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700872 reply.writeNoException();
873 reply.writeTypedList(list);
874 return true;
875 }
876
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800877 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700878 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800879 int stackId = data.readInt();
880 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700881 reply.writeNoException();
882 if (info != null) {
883 reply.writeInt(1);
884 info.writeToParcel(reply, 0);
885 } else {
886 reply.writeInt(0);
887 }
888 return true;
889 }
890
Winson Chung303e1ff2014-03-07 15:06:19 -0800891 case IS_IN_HOME_STACK_TRANSACTION: {
892 data.enforceInterface(IActivityManager.descriptor);
893 int taskId = data.readInt();
894 boolean isInHomeStack = isInHomeStack(taskId);
895 reply.writeNoException();
896 reply.writeInt(isInHomeStack ? 1 : 0);
897 return true;
898 }
899
Craig Mautnercf910b02013-04-23 11:23:27 -0700900 case SET_FOCUSED_STACK_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 int stackId = data.readInt();
903 setFocusedStack(stackId);
904 reply.writeNoException();
905 return true;
906 }
907
Winson Chungd16c5652015-01-26 16:11:07 -0800908 case GET_FOCUSED_STACK_ID_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 int focusedStackId = getFocusedStackId();
911 reply.writeNoException();
912 reply.writeInt(focusedStackId);
913 return true;
914 }
915
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700916 case SET_FOCUSED_TASK_TRANSACTION: {
917 data.enforceInterface(IActivityManager.descriptor);
918 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700919 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700920 reply.writeNoException();
921 return true;
922 }
923
Winson Chung740c3ac2014-11-12 16:14:38 -0800924 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 IBinder token = data.readStrongBinder();
927 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
928 reply.writeNoException();
929 return true;
930 }
931
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800932 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 IBinder token = data.readStrongBinder();
935 boolean onlyRoot = data.readInt() != 0;
936 int res = token != null
937 ? getTaskForActivity(token, onlyRoot) : -1;
938 reply.writeNoException();
939 reply.writeInt(res);
940 return true;
941 }
942
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 case GET_CONTENT_PROVIDER_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 IBinder b = data.readStrongBinder();
946 IApplicationThread app = ApplicationThreadNative.asInterface(b);
947 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700948 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700949 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700950 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800951 reply.writeNoException();
952 if (cph != null) {
953 reply.writeInt(1);
954 cph.writeToParcel(reply, 0);
955 } else {
956 reply.writeInt(0);
957 }
958 return true;
959 }
960
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800961 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
962 data.enforceInterface(IActivityManager.descriptor);
963 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700964 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800965 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700966 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800967 reply.writeNoException();
968 if (cph != null) {
969 reply.writeInt(1);
970 cph.writeToParcel(reply, 0);
971 } else {
972 reply.writeInt(0);
973 }
974 return true;
975 }
976
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder b = data.readStrongBinder();
980 IApplicationThread app = ApplicationThreadNative.asInterface(b);
981 ArrayList<ContentProviderHolder> providers =
982 data.createTypedArrayList(ContentProviderHolder.CREATOR);
983 publishContentProviders(app, providers);
984 reply.writeNoException();
985 return true;
986 }
987
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700988 case REF_CONTENT_PROVIDER_TRANSACTION: {
989 data.enforceInterface(IActivityManager.descriptor);
990 IBinder b = data.readStrongBinder();
991 int stable = data.readInt();
992 int unstable = data.readInt();
993 boolean res = refContentProvider(b, stable, unstable);
994 reply.writeNoException();
995 reply.writeInt(res ? 1 : 0);
996 return true;
997 }
998
999 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
1000 data.enforceInterface(IActivityManager.descriptor);
1001 IBinder b = data.readStrongBinder();
1002 unstableProviderDied(b);
1003 reply.writeNoException();
1004 return true;
1005 }
1006
Jeff Sharkey7aa76012013-09-30 14:26:27 -07001007 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
1008 data.enforceInterface(IActivityManager.descriptor);
1009 IBinder b = data.readStrongBinder();
1010 appNotRespondingViaProvider(b);
1011 reply.writeNoException();
1012 return true;
1013 }
1014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
1016 data.enforceInterface(IActivityManager.descriptor);
1017 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001018 boolean stable = data.readInt() != 0;
1019 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001020 reply.writeNoException();
1021 return true;
1022 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08001023
1024 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
1025 data.enforceInterface(IActivityManager.descriptor);
1026 String name = data.readString();
1027 IBinder token = data.readStrongBinder();
1028 removeContentProviderExternal(name, token);
1029 reply.writeNoException();
1030 return true;
1031 }
1032
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001033 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
1036 PendingIntent pi = getRunningServiceControlPanel(comp);
1037 reply.writeNoException();
1038 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
1039 return true;
1040 }
1041
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001042 case START_SERVICE_TRANSACTION: {
1043 data.enforceInterface(IActivityManager.descriptor);
1044 IBinder b = data.readStrongBinder();
1045 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1046 Intent service = Intent.CREATOR.createFromParcel(data);
1047 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001048 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001049 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001050 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001051 reply.writeNoException();
1052 ComponentName.writeToParcel(cn, reply);
1053 return true;
1054 }
1055
1056 case STOP_SERVICE_TRANSACTION: {
1057 data.enforceInterface(IActivityManager.descriptor);
1058 IBinder b = data.readStrongBinder();
1059 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1060 Intent service = Intent.CREATOR.createFromParcel(data);
1061 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001062 int userId = data.readInt();
1063 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001064 reply.writeNoException();
1065 reply.writeInt(res);
1066 return true;
1067 }
1068
1069 case STOP_SERVICE_TOKEN_TRANSACTION: {
1070 data.enforceInterface(IActivityManager.descriptor);
1071 ComponentName className = ComponentName.readFromParcel(data);
1072 IBinder token = data.readStrongBinder();
1073 int startId = data.readInt();
1074 boolean res = stopServiceToken(className, token, startId);
1075 reply.writeNoException();
1076 reply.writeInt(res ? 1 : 0);
1077 return true;
1078 }
1079
1080 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 ComponentName className = ComponentName.readFromParcel(data);
1083 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001084 int id = data.readInt();
1085 Notification notification = null;
1086 if (data.readInt() != 0) {
1087 notification = Notification.CREATOR.createFromParcel(data);
1088 }
1089 boolean removeNotification = data.readInt() != 0;
1090 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 reply.writeNoException();
1092 return true;
1093 }
1094
1095 case BIND_SERVICE_TRANSACTION: {
1096 data.enforceInterface(IActivityManager.descriptor);
1097 IBinder b = data.readStrongBinder();
1098 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1099 IBinder token = data.readStrongBinder();
1100 Intent service = Intent.CREATOR.createFromParcel(data);
1101 String resolvedType = data.readString();
1102 b = data.readStrongBinder();
1103 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001104 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001105 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001106 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001107 int res = bindService(app, token, service, resolvedType, conn, fl,
1108 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001109 reply.writeNoException();
1110 reply.writeInt(res);
1111 return true;
1112 }
1113
1114 case UNBIND_SERVICE_TRANSACTION: {
1115 data.enforceInterface(IActivityManager.descriptor);
1116 IBinder b = data.readStrongBinder();
1117 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1118 boolean res = unbindService(conn);
1119 reply.writeNoException();
1120 reply.writeInt(res ? 1 : 0);
1121 return true;
1122 }
1123
1124 case PUBLISH_SERVICE_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 IBinder token = data.readStrongBinder();
1127 Intent intent = Intent.CREATOR.createFromParcel(data);
1128 IBinder service = data.readStrongBinder();
1129 publishService(token, intent, service);
1130 reply.writeNoException();
1131 return true;
1132 }
1133
1134 case UNBIND_FINISHED_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 IBinder token = data.readStrongBinder();
1137 Intent intent = Intent.CREATOR.createFromParcel(data);
1138 boolean doRebind = data.readInt() != 0;
1139 unbindFinished(token, intent, doRebind);
1140 reply.writeNoException();
1141 return true;
1142 }
1143
1144 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001147 int type = data.readInt();
1148 int startId = data.readInt();
1149 int res = data.readInt();
1150 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 reply.writeNoException();
1152 return true;
1153 }
1154
1155 case START_INSTRUMENTATION_TRANSACTION: {
1156 data.enforceInterface(IActivityManager.descriptor);
1157 ComponentName className = ComponentName.readFromParcel(data);
1158 String profileFile = data.readString();
1159 int fl = data.readInt();
1160 Bundle arguments = data.readBundle();
1161 IBinder b = data.readStrongBinder();
1162 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001163 b = data.readStrongBinder();
1164 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001165 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001166 String abiOverride = data.readString();
1167 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1168 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001169 reply.writeNoException();
1170 reply.writeInt(res ? 1 : 0);
1171 return true;
1172 }
1173
1174
1175 case FINISH_INSTRUMENTATION_TRANSACTION: {
1176 data.enforceInterface(IActivityManager.descriptor);
1177 IBinder b = data.readStrongBinder();
1178 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1179 int resultCode = data.readInt();
1180 Bundle results = data.readBundle();
1181 finishInstrumentation(app, resultCode, results);
1182 reply.writeNoException();
1183 return true;
1184 }
1185
1186 case GET_CONFIGURATION_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 Configuration config = getConfiguration();
1189 reply.writeNoException();
1190 config.writeToParcel(reply, 0);
1191 return true;
1192 }
1193
1194 case UPDATE_CONFIGURATION_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 Configuration config = Configuration.CREATOR.createFromParcel(data);
1197 updateConfiguration(config);
1198 reply.writeNoException();
1199 return true;
1200 }
1201
1202 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 IBinder token = data.readStrongBinder();
1205 int requestedOrientation = data.readInt();
1206 setRequestedOrientation(token, requestedOrientation);
1207 reply.writeNoException();
1208 return true;
1209 }
1210
1211 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1212 data.enforceInterface(IActivityManager.descriptor);
1213 IBinder token = data.readStrongBinder();
1214 int req = getRequestedOrientation(token);
1215 reply.writeNoException();
1216 reply.writeInt(req);
1217 return true;
1218 }
1219
1220 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1221 data.enforceInterface(IActivityManager.descriptor);
1222 IBinder token = data.readStrongBinder();
1223 ComponentName cn = getActivityClassForToken(token);
1224 reply.writeNoException();
1225 ComponentName.writeToParcel(cn, reply);
1226 return true;
1227 }
1228
1229 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1230 data.enforceInterface(IActivityManager.descriptor);
1231 IBinder token = data.readStrongBinder();
1232 reply.writeNoException();
1233 reply.writeString(getPackageForToken(token));
1234 return true;
1235 }
1236
1237 case GET_INTENT_SENDER_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 int type = data.readInt();
1240 String packageName = data.readString();
1241 IBinder token = data.readStrongBinder();
1242 String resultWho = data.readString();
1243 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001244 Intent[] requestIntents;
1245 String[] requestResolvedTypes;
1246 if (data.readInt() != 0) {
1247 requestIntents = data.createTypedArray(Intent.CREATOR);
1248 requestResolvedTypes = data.createStringArray();
1249 } else {
1250 requestIntents = null;
1251 requestResolvedTypes = null;
1252 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001254 Bundle options = data.readInt() != 0
1255 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001256 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001258 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001259 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001260 reply.writeNoException();
1261 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1262 return true;
1263 }
1264
1265 case CANCEL_INTENT_SENDER_TRANSACTION: {
1266 data.enforceInterface(IActivityManager.descriptor);
1267 IIntentSender r = IIntentSender.Stub.asInterface(
1268 data.readStrongBinder());
1269 cancelIntentSender(r);
1270 reply.writeNoException();
1271 return true;
1272 }
1273
1274 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1275 data.enforceInterface(IActivityManager.descriptor);
1276 IIntentSender r = IIntentSender.Stub.asInterface(
1277 data.readStrongBinder());
1278 String res = getPackageForIntentSender(r);
1279 reply.writeNoException();
1280 reply.writeString(res);
1281 return true;
1282 }
1283
Christopher Tatec4a07d12012-04-06 14:19:13 -07001284 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1285 data.enforceInterface(IActivityManager.descriptor);
1286 IIntentSender r = IIntentSender.Stub.asInterface(
1287 data.readStrongBinder());
1288 int res = getUidForIntentSender(r);
1289 reply.writeNoException();
1290 reply.writeInt(res);
1291 return true;
1292 }
1293
Dianne Hackborn41203752012-08-31 14:05:51 -07001294 case HANDLE_INCOMING_USER_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 int callingPid = data.readInt();
1297 int callingUid = data.readInt();
1298 int userId = data.readInt();
1299 boolean allowAll = data.readInt() != 0 ;
1300 boolean requireFull = data.readInt() != 0;
1301 String name = data.readString();
1302 String callerPackage = data.readString();
1303 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1304 requireFull, name, callerPackage);
1305 reply.writeNoException();
1306 reply.writeInt(res);
1307 return true;
1308 }
1309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 case SET_PROCESS_LIMIT_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 int max = data.readInt();
1313 setProcessLimit(max);
1314 reply.writeNoException();
1315 return true;
1316 }
1317
1318 case GET_PROCESS_LIMIT_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 int limit = getProcessLimit();
1321 reply.writeNoException();
1322 reply.writeInt(limit);
1323 return true;
1324 }
1325
1326 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 IBinder token = data.readStrongBinder();
1329 int pid = data.readInt();
1330 boolean isForeground = data.readInt() != 0;
1331 setProcessForeground(token, pid, isForeground);
1332 reply.writeNoException();
1333 return true;
1334 }
1335
1336 case CHECK_PERMISSION_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
1338 String perm = data.readString();
1339 int pid = data.readInt();
1340 int uid = data.readInt();
1341 int res = checkPermission(perm, pid, uid);
1342 reply.writeNoException();
1343 reply.writeInt(res);
1344 return true;
1345 }
1346
Dianne Hackbornff170242014-11-19 10:59:01 -08001347 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 String perm = data.readString();
1350 int pid = data.readInt();
1351 int uid = data.readInt();
1352 IBinder token = data.readStrongBinder();
1353 int res = checkPermissionWithToken(perm, pid, uid, token);
1354 reply.writeNoException();
1355 reply.writeInt(res);
1356 return true;
1357 }
1358
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 case CHECK_URI_PERMISSION_TRANSACTION: {
1360 data.enforceInterface(IActivityManager.descriptor);
1361 Uri uri = Uri.CREATOR.createFromParcel(data);
1362 int pid = data.readInt();
1363 int uid = data.readInt();
1364 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001365 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001366 IBinder callerToken = data.readStrongBinder();
1367 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 reply.writeNoException();
1369 reply.writeInt(res);
1370 return true;
1371 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001372
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001373 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001374 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001375 String packageName = data.readString();
1376 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1377 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001378 int userId = data.readInt();
1379 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 reply.writeNoException();
1381 reply.writeInt(res ? 1 : 0);
1382 return true;
1383 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 case GRANT_URI_PERMISSION_TRANSACTION: {
1386 data.enforceInterface(IActivityManager.descriptor);
1387 IBinder b = data.readStrongBinder();
1388 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1389 String targetPkg = data.readString();
1390 Uri uri = Uri.CREATOR.createFromParcel(data);
1391 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001392 int userId = data.readInt();
1393 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001394 reply.writeNoException();
1395 return true;
1396 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001397
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001398 case REVOKE_URI_PERMISSION_TRANSACTION: {
1399 data.enforceInterface(IActivityManager.descriptor);
1400 IBinder b = data.readStrongBinder();
1401 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1402 Uri uri = Uri.CREATOR.createFromParcel(data);
1403 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001404 int userId = data.readInt();
1405 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001406 reply.writeNoException();
1407 return true;
1408 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001409
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001410 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 Uri uri = Uri.CREATOR.createFromParcel(data);
1413 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001414 int userId = data.readInt();
1415 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001416 reply.writeNoException();
1417 return true;
1418 }
1419
1420 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1421 data.enforceInterface(IActivityManager.descriptor);
1422 Uri uri = Uri.CREATOR.createFromParcel(data);
1423 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001424 int userId = data.readInt();
1425 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001426 reply.writeNoException();
1427 return true;
1428 }
1429
1430 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1431 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001432 final String packageName = data.readString();
1433 final boolean incoming = data.readInt() != 0;
1434 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1435 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001436 reply.writeNoException();
1437 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1438 return true;
1439 }
1440
Felipe Lemef3fa0f82016-01-07 12:08:19 -08001441 case GET_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 final String packageName = data.readString();
1444 final int userId = data.readInt();
1445 final ParceledListSlice<UriPermission> perms = getGrantedUriPermissions(packageName,
1446 userId);
1447 reply.writeNoException();
1448 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1449 return true;
1450 }
1451
1452 case CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 final String packageName = data.readString();
1455 final int userId = data.readInt();
1456 clearGrantedUriPermissions(packageName, userId);
1457 reply.writeNoException();
1458 return true;
1459 }
1460
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001461 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 IBinder b = data.readStrongBinder();
1464 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1465 boolean waiting = data.readInt() != 0;
1466 showWaitingForDebugger(app, waiting);
1467 reply.writeNoException();
1468 return true;
1469 }
1470
1471 case GET_MEMORY_INFO_TRANSACTION: {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1474 getMemoryInfo(mi);
1475 reply.writeNoException();
1476 mi.writeToParcel(reply, 0);
1477 return true;
1478 }
1479
1480 case UNHANDLED_BACK_TRANSACTION: {
1481 data.enforceInterface(IActivityManager.descriptor);
1482 unhandledBack();
1483 reply.writeNoException();
1484 return true;
1485 }
1486
1487 case OPEN_CONTENT_URI_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
1489 Uri uri = Uri.parse(data.readString());
1490 ParcelFileDescriptor pfd = openContentUri(uri);
1491 reply.writeNoException();
1492 if (pfd != null) {
1493 reply.writeInt(1);
1494 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1495 } else {
1496 reply.writeInt(0);
1497 }
1498 return true;
1499 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001500
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001501 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
1503 setLockScreenShown(data.readInt() != 0);
1504 reply.writeNoException();
1505 return true;
1506 }
1507
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001508 case SET_DEBUG_APP_TRANSACTION: {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 String pn = data.readString();
1511 boolean wfd = data.readInt() != 0;
1512 boolean per = data.readInt() != 0;
1513 setDebugApp(pn, wfd, per);
1514 reply.writeNoException();
1515 return true;
1516 }
1517
1518 case SET_ALWAYS_FINISH_TRANSACTION: {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 boolean enabled = data.readInt() != 0;
1521 setAlwaysFinish(enabled);
1522 reply.writeNoException();
1523 return true;
1524 }
1525
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001526 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001527 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001528 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001529 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001530 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001531 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001532 return true;
1533 }
1534
Dianne Hackbornb2117d12016-02-16 18:26:35 -08001535 case SET_LENIENT_BACKGROUND_CHECK_TRANSACTION: {
1536 data.enforceInterface(IActivityManager.descriptor);
1537 boolean enabled = data.readInt() != 0;
1538 setLenientBackgroundCheck(enabled);
1539 reply.writeNoException();
1540 return true;
1541 }
1542
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001543 case ENTER_SAFE_MODE_TRANSACTION: {
1544 data.enforceInterface(IActivityManager.descriptor);
1545 enterSafeMode();
1546 reply.writeNoException();
1547 return true;
1548 }
1549
1550 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1551 data.enforceInterface(IActivityManager.descriptor);
1552 IIntentSender is = IIntentSender.Stub.asInterface(
1553 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001554 int sourceUid = data.readInt();
1555 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001556 String tag = data.readString();
1557 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1558 reply.writeNoException();
1559 return true;
1560 }
1561
1562 case NOTE_ALARM_START_TRANSACTION: {
1563 data.enforceInterface(IActivityManager.descriptor);
1564 IIntentSender is = IIntentSender.Stub.asInterface(
1565 data.readStrongBinder());
1566 int sourceUid = data.readInt();
1567 String tag = data.readString();
1568 noteAlarmStart(is, sourceUid, tag);
1569 reply.writeNoException();
1570 return true;
1571 }
1572
1573 case NOTE_ALARM_FINISH_TRANSACTION: {
1574 data.enforceInterface(IActivityManager.descriptor);
1575 IIntentSender is = IIntentSender.Stub.asInterface(
1576 data.readStrongBinder());
1577 int sourceUid = data.readInt();
1578 String tag = data.readString();
1579 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001580 reply.writeNoException();
1581 return true;
1582 }
1583
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001584 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001585 data.enforceInterface(IActivityManager.descriptor);
1586 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001587 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001588 boolean secure = data.readInt() != 0;
1589 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001590 reply.writeNoException();
1591 reply.writeInt(res ? 1 : 0);
1592 return true;
1593 }
1594
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001595 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1596 data.enforceInterface(IActivityManager.descriptor);
1597 String reason = data.readString();
1598 boolean res = killProcessesBelowForeground(reason);
1599 reply.writeNoException();
1600 reply.writeInt(res ? 1 : 0);
1601 return true;
1602 }
1603
Dan Egnor60d87622009-12-16 16:32:58 -08001604 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1605 data.enforceInterface(IActivityManager.descriptor);
1606 IBinder app = data.readStrongBinder();
1607 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1608 handleApplicationCrash(app, ci);
1609 reply.writeNoException();
1610 return true;
1611 }
1612
1613 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001614 data.enforceInterface(IActivityManager.descriptor);
1615 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001616 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001617 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001618 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001619 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001620 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001621 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001622 return true;
1623 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001624
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001625 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1626 data.enforceInterface(IActivityManager.descriptor);
1627 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001628 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001629 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1630 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001631 reply.writeNoException();
1632 return true;
1633 }
1634
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001635 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1636 data.enforceInterface(IActivityManager.descriptor);
1637 int sig = data.readInt();
1638 signalPersistentProcesses(sig);
1639 reply.writeNoException();
1640 return true;
1641 }
1642
Dianne Hackborn03abb812010-01-04 18:43:19 -08001643 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1644 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001645 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001646 int userId = data.readInt();
1647 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001648 reply.writeNoException();
1649 return true;
1650 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001651
1652 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1653 data.enforceInterface(IActivityManager.descriptor);
1654 killAllBackgroundProcesses();
1655 reply.writeNoException();
1656 return true;
1657 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001658
Gustav Sennton6258dcd2015-10-30 19:25:37 +00001659 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 String packageName = data.readString();
1662 int userId = data.readInt();
1663 killPackageDependents(packageName, userId);
1664 reply.writeNoException();
1665 return true;
1666 }
1667
Dianne Hackborn03abb812010-01-04 18:43:19 -08001668 case FORCE_STOP_PACKAGE_TRANSACTION: {
1669 data.enforceInterface(IActivityManager.descriptor);
1670 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001671 int userId = data.readInt();
1672 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001673 reply.writeNoException();
1674 return true;
1675 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001676
1677 case GET_MY_MEMORY_STATE_TRANSACTION: {
1678 data.enforceInterface(IActivityManager.descriptor);
1679 ActivityManager.RunningAppProcessInfo info =
1680 new ActivityManager.RunningAppProcessInfo();
1681 getMyMemoryState(info);
1682 reply.writeNoException();
1683 info.writeToParcel(reply, 0);
1684 return true;
1685 }
1686
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001687 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1688 data.enforceInterface(IActivityManager.descriptor);
1689 ConfigurationInfo config = getDeviceConfigurationInfo();
1690 reply.writeNoException();
1691 config.writeToParcel(reply, 0);
1692 return true;
1693 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001694
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001695 case PROFILE_CONTROL_TRANSACTION: {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001698 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001699 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001700 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001701 ProfilerInfo profilerInfo = data.readInt() != 0
1702 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1703 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001704 reply.writeNoException();
1705 reply.writeInt(res ? 1 : 0);
1706 return true;
1707 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001708
Dianne Hackborn55280a92009-05-07 15:53:46 -07001709 case SHUTDOWN_TRANSACTION: {
1710 data.enforceInterface(IActivityManager.descriptor);
1711 boolean res = shutdown(data.readInt());
1712 reply.writeNoException();
1713 reply.writeInt(res ? 1 : 0);
1714 return true;
1715 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001716
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001717 case STOP_APP_SWITCHES_TRANSACTION: {
1718 data.enforceInterface(IActivityManager.descriptor);
1719 stopAppSwitches();
1720 reply.writeNoException();
1721 return true;
1722 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001723
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001724 case RESUME_APP_SWITCHES_TRANSACTION: {
1725 data.enforceInterface(IActivityManager.descriptor);
1726 resumeAppSwitches();
1727 reply.writeNoException();
1728 return true;
1729 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001730
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001731 case PEEK_SERVICE_TRANSACTION: {
1732 data.enforceInterface(IActivityManager.descriptor);
1733 Intent service = Intent.CREATOR.createFromParcel(data);
1734 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001735 String callingPackage = data.readString();
1736 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001737 reply.writeNoException();
1738 reply.writeStrongBinder(binder);
1739 return true;
1740 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001741
Christopher Tate181fafa2009-05-14 11:12:14 -07001742 case START_BACKUP_AGENT_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1745 int backupRestoreMode = data.readInt();
1746 boolean success = bindBackupAgent(info, backupRestoreMode);
1747 reply.writeNoException();
1748 reply.writeInt(success ? 1 : 0);
1749 return true;
1750 }
1751
1752 case BACKUP_AGENT_CREATED_TRANSACTION: {
1753 data.enforceInterface(IActivityManager.descriptor);
1754 String packageName = data.readString();
1755 IBinder agent = data.readStrongBinder();
1756 backupAgentCreated(packageName, agent);
1757 reply.writeNoException();
1758 return true;
1759 }
1760
1761 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1764 unbindBackupAgent(info);
1765 reply.writeNoException();
1766 return true;
1767 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001768
1769 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1770 data.enforceInterface(IActivityManager.descriptor);
1771 String packageName = data.readString();
1772 addPackageDependency(packageName);
1773 reply.writeNoException();
1774 return true;
1775 }
1776
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001777 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001778 data.enforceInterface(IActivityManager.descriptor);
1779 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001780 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001781 String reason = data.readString();
1782 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001783 reply.writeNoException();
1784 return true;
1785 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001786
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001787 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1788 data.enforceInterface(IActivityManager.descriptor);
1789 String reason = data.readString();
1790 closeSystemDialogs(reason);
1791 reply.writeNoException();
1792 return true;
1793 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001794
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001795 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1796 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001797 int[] pids = data.createIntArray();
1798 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001799 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001800 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001801 return true;
1802 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001803
1804 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1805 data.enforceInterface(IActivityManager.descriptor);
1806 String processName = data.readString();
1807 int uid = data.readInt();
1808 killApplicationProcess(processName, uid);
1809 reply.writeNoException();
1810 return true;
1811 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001812
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001813 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1814 data.enforceInterface(IActivityManager.descriptor);
1815 IBinder token = data.readStrongBinder();
1816 String packageName = data.readString();
1817 int enterAnim = data.readInt();
1818 int exitAnim = data.readInt();
1819 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001820 reply.writeNoException();
1821 return true;
1822 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001823
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001824 case IS_USER_A_MONKEY_TRANSACTION: {
1825 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001826 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001827 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001828 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001829 return true;
1830 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001831
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001832 case SET_USER_IS_MONKEY_TRANSACTION: {
1833 data.enforceInterface(IActivityManager.descriptor);
1834 final boolean monkey = (data.readInt() == 1);
1835 setUserIsMonkey(monkey);
1836 reply.writeNoException();
1837 return true;
1838 }
1839
Dianne Hackborn860755f2010-06-03 18:47:52 -07001840 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1841 data.enforceInterface(IActivityManager.descriptor);
1842 finishHeavyWeightApp();
1843 reply.writeNoException();
1844 return true;
1845 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001846
1847 case IS_IMMERSIVE_TRANSACTION: {
1848 data.enforceInterface(IActivityManager.descriptor);
1849 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001850 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001851 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001852 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001853 return true;
1854 }
1855
Craig Mautnerd61dc202014-07-07 11:09:11 -07001856 case IS_TOP_OF_TASK_TRANSACTION: {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 IBinder token = data.readStrongBinder();
1859 final boolean isTopOfTask = isTopOfTask(token);
1860 reply.writeNoException();
1861 reply.writeInt(isTopOfTask ? 1 : 0);
1862 return true;
1863 }
1864
Craig Mautner5eda9b32013-07-02 11:58:16 -07001865 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001866 data.enforceInterface(IActivityManager.descriptor);
1867 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001868 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001869 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001870 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001871 return true;
1872 }
1873
1874 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1875 data.enforceInterface(IActivityManager.descriptor);
1876 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001877 final Bundle bundle;
1878 if (data.readInt() == 0) {
1879 bundle = null;
1880 } else {
1881 bundle = data.readBundle();
1882 }
Chong Zhang280d3322015-11-03 17:27:26 -08001883 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001884 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001885 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001886 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001887 return true;
1888 }
1889
Craig Mautner233ceee2014-05-09 17:05:11 -07001890 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 IBinder token = data.readStrongBinder();
1893 final ActivityOptions options = getActivityOptions(token);
1894 reply.writeNoException();
1895 reply.writeBundle(options == null ? null : options.toBundle());
1896 return true;
1897 }
1898
Daniel Sandler69a48172010-06-23 16:29:36 -04001899 case SET_IMMERSIVE_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 IBinder token = data.readStrongBinder();
1902 boolean imm = data.readInt() == 1;
1903 setImmersive(token, imm);
1904 reply.writeNoException();
1905 return true;
1906 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001907
Daniel Sandler69a48172010-06-23 16:29:36 -04001908 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001910 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001911 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001912 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001913 return true;
1914 }
1915
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001916 case CRASH_APPLICATION_TRANSACTION: {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 int uid = data.readInt();
1919 int initialPid = data.readInt();
1920 String packageName = data.readString();
1921 String message = data.readString();
1922 crashApplication(uid, initialPid, packageName, message);
1923 reply.writeNoException();
1924 return true;
1925 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001926
1927 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1928 data.enforceInterface(IActivityManager.descriptor);
1929 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001930 int userId = data.readInt();
1931 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001932 reply.writeNoException();
1933 reply.writeString(type);
1934 return true;
1935 }
1936
Dianne Hackborn7e269642010-08-25 19:50:20 -07001937 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1938 data.enforceInterface(IActivityManager.descriptor);
1939 String name = data.readString();
1940 IBinder perm = newUriPermissionOwner(name);
1941 reply.writeNoException();
1942 reply.writeStrongBinder(perm);
1943 return true;
1944 }
1945
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08001946 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: {
1947 data.enforceInterface(IActivityManager.descriptor);
1948 IBinder activityToken = data.readStrongBinder();
1949 IBinder perm = getUriPermissionOwnerForActivity(activityToken);
1950 reply.writeNoException();
1951 reply.writeStrongBinder(perm);
1952 return true;
1953 }
1954
Dianne Hackborn7e269642010-08-25 19:50:20 -07001955 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1956 data.enforceInterface(IActivityManager.descriptor);
1957 IBinder owner = data.readStrongBinder();
1958 int fromUid = data.readInt();
1959 String targetPkg = data.readString();
1960 Uri uri = Uri.CREATOR.createFromParcel(data);
1961 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001962 int sourceUserId = data.readInt();
1963 int targetUserId = data.readInt();
1964 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1965 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001966 reply.writeNoException();
1967 return true;
1968 }
1969
1970 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1971 data.enforceInterface(IActivityManager.descriptor);
1972 IBinder owner = data.readStrongBinder();
1973 Uri uri = null;
1974 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001975 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001976 }
1977 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001978 int userId = data.readInt();
1979 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001980 reply.writeNoException();
1981 return true;
1982 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001983
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001984 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 int callingUid = data.readInt();
1987 String targetPkg = data.readString();
1988 Uri uri = Uri.CREATOR.createFromParcel(data);
1989 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001990 int userId = data.readInt();
1991 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001992 reply.writeNoException();
1993 reply.writeInt(res);
1994 return true;
1995 }
1996
Andy McFadden824c5102010-07-09 16:26:57 -07001997 case DUMP_HEAP_TRANSACTION: {
1998 data.enforceInterface(IActivityManager.descriptor);
1999 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07002000 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07002001 boolean managed = data.readInt() != 0;
2002 String path = data.readString();
2003 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07002004 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07002005 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07002006 reply.writeNoException();
2007 reply.writeInt(res ? 1 : 0);
2008 return true;
2009 }
2010
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002011 case START_ACTIVITIES_TRANSACTION:
2012 {
2013 data.enforceInterface(IActivityManager.descriptor);
2014 IBinder b = data.readStrongBinder();
2015 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002016 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002017 Intent[] intents = data.createTypedArray(Intent.CREATOR);
2018 String[] resolvedTypes = data.createStringArray();
2019 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07002020 Bundle options = data.readInt() != 0
2021 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002022 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002023 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002024 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002025 reply.writeNoException();
2026 reply.writeInt(result);
2027 return true;
2028 }
2029
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002030 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2031 {
2032 data.enforceInterface(IActivityManager.descriptor);
2033 int mode = getFrontActivityScreenCompatMode();
2034 reply.writeNoException();
2035 reply.writeInt(mode);
2036 return true;
2037 }
2038
2039 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2040 {
2041 data.enforceInterface(IActivityManager.descriptor);
2042 int mode = data.readInt();
2043 setFrontActivityScreenCompatMode(mode);
2044 reply.writeNoException();
2045 reply.writeInt(mode);
2046 return true;
2047 }
2048
2049 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2050 {
2051 data.enforceInterface(IActivityManager.descriptor);
2052 String pkg = data.readString();
2053 int mode = getPackageScreenCompatMode(pkg);
2054 reply.writeNoException();
2055 reply.writeInt(mode);
2056 return true;
2057 }
2058
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002059 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2060 {
2061 data.enforceInterface(IActivityManager.descriptor);
2062 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002063 int mode = data.readInt();
2064 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002065 reply.writeNoException();
2066 return true;
2067 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002068
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002069 case SWITCH_USER_TRANSACTION: {
2070 data.enforceInterface(IActivityManager.descriptor);
2071 int userid = data.readInt();
2072 boolean result = switchUser(userid);
2073 reply.writeNoException();
2074 reply.writeInt(result ? 1 : 0);
2075 return true;
2076 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07002077
Kenny Guy08488bf2014-02-21 17:40:37 +00002078 case START_USER_IN_BACKGROUND_TRANSACTION: {
2079 data.enforceInterface(IActivityManager.descriptor);
2080 int userid = data.readInt();
2081 boolean result = startUserInBackground(userid);
2082 reply.writeNoException();
2083 reply.writeInt(result ? 1 : 0);
2084 return true;
2085 }
2086
Jeff Sharkeyba512352015-11-12 20:17:45 -08002087 case UNLOCK_USER_TRANSACTION: {
2088 data.enforceInterface(IActivityManager.descriptor);
2089 int userId = data.readInt();
2090 byte[] token = data.createByteArray();
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00002091 byte[] secret = data.createByteArray();
2092 boolean result = unlockUser(userId, token, secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08002093 reply.writeNoException();
2094 reply.writeInt(result ? 1 : 0);
2095 return true;
2096 }
2097
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002098 case STOP_USER_TRANSACTION: {
2099 data.enforceInterface(IActivityManager.descriptor);
2100 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002101 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002102 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2103 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002104 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002105 reply.writeNoException();
2106 reply.writeInt(result);
2107 return true;
2108 }
2109
Amith Yamasani52f1d752012-03-28 18:19:29 -07002110 case GET_CURRENT_USER_TRANSACTION: {
2111 data.enforceInterface(IActivityManager.descriptor);
2112 UserInfo userInfo = getCurrentUser();
2113 reply.writeNoException();
2114 userInfo.writeToParcel(reply, 0);
2115 return true;
2116 }
2117
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002118 case IS_USER_RUNNING_TRANSACTION: {
2119 data.enforceInterface(IActivityManager.descriptor);
2120 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002121 int _flags = data.readInt();
2122 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002123 reply.writeNoException();
2124 reply.writeInt(result ? 1 : 0);
2125 return true;
2126 }
2127
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002128 case GET_RUNNING_USER_IDS_TRANSACTION: {
2129 data.enforceInterface(IActivityManager.descriptor);
2130 int[] result = getRunningUserIds();
2131 reply.writeNoException();
2132 reply.writeIntArray(result);
2133 return true;
2134 }
2135
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002136 case REMOVE_TASK_TRANSACTION:
2137 {
2138 data.enforceInterface(IActivityManager.descriptor);
2139 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002140 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002141 reply.writeNoException();
2142 reply.writeInt(result ? 1 : 0);
2143 return true;
2144 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002145
Jeff Sharkeya4620792011-05-20 15:29:23 -07002146 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2149 data.readStrongBinder());
2150 registerProcessObserver(observer);
2151 return true;
2152 }
2153
2154 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2155 data.enforceInterface(IActivityManager.descriptor);
2156 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2157 data.readStrongBinder());
2158 unregisterProcessObserver(observer);
2159 return true;
2160 }
2161
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002162 case REGISTER_UID_OBSERVER_TRANSACTION: {
2163 data.enforceInterface(IActivityManager.descriptor);
2164 IUidObserver observer = IUidObserver.Stub.asInterface(
2165 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002166 int which = data.readInt();
2167 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002168 return true;
2169 }
2170
2171 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2172 data.enforceInterface(IActivityManager.descriptor);
2173 IUidObserver observer = IUidObserver.Stub.asInterface(
2174 data.readStrongBinder());
2175 unregisterUidObserver(observer);
2176 return true;
2177 }
2178
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002179 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2180 {
2181 data.enforceInterface(IActivityManager.descriptor);
2182 String pkg = data.readString();
2183 boolean ask = getPackageAskScreenCompat(pkg);
2184 reply.writeNoException();
2185 reply.writeInt(ask ? 1 : 0);
2186 return true;
2187 }
2188
2189 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2190 {
2191 data.enforceInterface(IActivityManager.descriptor);
2192 String pkg = data.readString();
2193 boolean ask = data.readInt() != 0;
2194 setPackageAskScreenCompat(pkg, ask);
2195 reply.writeNoException();
2196 return true;
2197 }
2198
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002199 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2200 data.enforceInterface(IActivityManager.descriptor);
2201 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002202 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002203 boolean res = isIntentSenderTargetedToPackage(r);
2204 reply.writeNoException();
2205 reply.writeInt(res ? 1 : 0);
2206 return true;
2207 }
2208
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002209 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2210 data.enforceInterface(IActivityManager.descriptor);
2211 IIntentSender r = IIntentSender.Stub.asInterface(
2212 data.readStrongBinder());
2213 boolean res = isIntentSenderAnActivity(r);
2214 reply.writeNoException();
2215 reply.writeInt(res ? 1 : 0);
2216 return true;
2217 }
2218
Dianne Hackborn81038902012-11-26 17:04:09 -08002219 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2220 data.enforceInterface(IActivityManager.descriptor);
2221 IIntentSender r = IIntentSender.Stub.asInterface(
2222 data.readStrongBinder());
2223 Intent intent = getIntentForIntentSender(r);
2224 reply.writeNoException();
2225 if (intent != null) {
2226 reply.writeInt(1);
2227 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2228 } else {
2229 reply.writeInt(0);
2230 }
2231 return true;
2232 }
2233
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002234 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2235 data.enforceInterface(IActivityManager.descriptor);
2236 IIntentSender r = IIntentSender.Stub.asInterface(
2237 data.readStrongBinder());
2238 String prefix = data.readString();
2239 String tag = getTagForIntentSender(r, prefix);
2240 reply.writeNoException();
2241 reply.writeString(tag);
2242 return true;
2243 }
2244
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002245 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2246 data.enforceInterface(IActivityManager.descriptor);
2247 Configuration config = Configuration.CREATOR.createFromParcel(data);
2248 updatePersistentConfiguration(config);
2249 reply.writeNoException();
2250 return true;
2251 }
2252
Dianne Hackbornb437e092011-08-05 17:50:29 -07002253 case GET_PROCESS_PSS_TRANSACTION: {
2254 data.enforceInterface(IActivityManager.descriptor);
2255 int[] pids = data.createIntArray();
2256 long[] pss = getProcessPss(pids);
2257 reply.writeNoException();
2258 reply.writeLongArray(pss);
2259 return true;
2260 }
2261
Dianne Hackborn661cd522011-08-22 00:26:20 -07002262 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2263 data.enforceInterface(IActivityManager.descriptor);
2264 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2265 boolean always = data.readInt() != 0;
2266 showBootMessage(msg, always);
2267 reply.writeNoException();
2268 return true;
2269 }
2270
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002271 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002272 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002273 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002274 reply.writeNoException();
2275 return true;
2276 }
2277
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002278 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2279 data.enforceInterface(IActivityManager.descriptor);
2280 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2281 reply.writeNoException();
2282 return true;
2283 }
2284
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002285 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002286 data.enforceInterface(IActivityManager.descriptor);
2287 IBinder token = data.readStrongBinder();
2288 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002289 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002290 reply.writeNoException();
2291 reply.writeInt(res ? 1 : 0);
2292 return true;
2293 }
2294
2295 case NAVIGATE_UP_TO_TRANSACTION: {
2296 data.enforceInterface(IActivityManager.descriptor);
2297 IBinder token = data.readStrongBinder();
2298 Intent target = Intent.CREATOR.createFromParcel(data);
2299 int resultCode = data.readInt();
2300 Intent resultData = null;
2301 if (data.readInt() != 0) {
2302 resultData = Intent.CREATOR.createFromParcel(data);
2303 }
2304 boolean res = navigateUpTo(token, target, resultCode, resultData);
2305 reply.writeNoException();
2306 reply.writeInt(res ? 1 : 0);
2307 return true;
2308 }
2309
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002310 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2311 data.enforceInterface(IActivityManager.descriptor);
2312 IBinder token = data.readStrongBinder();
2313 int res = getLaunchedFromUid(token);
2314 reply.writeNoException();
2315 reply.writeInt(res);
2316 return true;
2317 }
2318
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002319 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2320 data.enforceInterface(IActivityManager.descriptor);
2321 IBinder token = data.readStrongBinder();
2322 String res = getLaunchedFromPackage(token);
2323 reply.writeNoException();
2324 reply.writeString(res);
2325 return true;
2326 }
2327
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002328 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2329 data.enforceInterface(IActivityManager.descriptor);
2330 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2331 data.readStrongBinder());
2332 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002333 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002334 return true;
2335 }
2336
2337 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2338 data.enforceInterface(IActivityManager.descriptor);
2339 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2340 data.readStrongBinder());
2341 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002342 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002343 return true;
2344 }
2345
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002346 case REQUEST_BUG_REPORT_TRANSACTION: {
2347 data.enforceInterface(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00002348 int bugreportType = data.readInt();
2349 requestBugReport(bugreportType);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002350 reply.writeNoException();
2351 return true;
2352 }
2353
2354 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2355 data.enforceInterface(IActivityManager.descriptor);
2356 int pid = data.readInt();
2357 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002358 String reason = data.readString();
2359 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002360 reply.writeNoException();
2361 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002362 return true;
2363 }
2364
Adam Skorydfc7fd72013-08-05 19:23:41 -07002365 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002366 data.enforceInterface(IActivityManager.descriptor);
2367 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002368 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002369 reply.writeNoException();
2370 reply.writeBundle(res);
2371 return true;
2372 }
2373
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002374 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2375 data.enforceInterface(IActivityManager.descriptor);
2376 int requestType = data.readInt();
2377 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002378 IBinder activityToken = data.readStrongBinder();
2379 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002380 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002381 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002382 return true;
2383 }
2384
Adam Skorydfc7fd72013-08-05 19:23:41 -07002385 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002386 data.enforceInterface(IActivityManager.descriptor);
2387 IBinder token = data.readStrongBinder();
2388 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002389 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2390 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002391 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2392 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002393 reply.writeNoException();
2394 return true;
2395 }
2396
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002397 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2398 data.enforceInterface(IActivityManager.descriptor);
2399 Intent intent = Intent.CREATOR.createFromParcel(data);
2400 int requestType = data.readInt();
2401 String hint = data.readString();
2402 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002403 Bundle args = data.readBundle();
2404 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002405 reply.writeNoException();
2406 reply.writeInt(res ? 1 : 0);
2407 return true;
2408 }
2409
Benjamin Franzc200f442015-06-25 18:20:04 +01002410 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2411 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002412 boolean res = isAssistDataAllowedOnCurrentActivity();
2413 reply.writeNoException();
2414 reply.writeInt(res ? 1 : 0);
2415 return true;
2416 }
2417
2418 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2419 data.enforceInterface(IActivityManager.descriptor);
2420 IBinder token = data.readStrongBinder();
2421 Bundle args = data.readBundle();
2422 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002423 reply.writeNoException();
2424 reply.writeInt(res ? 1 : 0);
2425 return true;
2426 }
2427
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002428 case KILL_UID_TRANSACTION: {
2429 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002430 int appId = data.readInt();
2431 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002432 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002433 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002434 reply.writeNoException();
2435 return true;
2436 }
2437
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002438 case HANG_TRANSACTION: {
2439 data.enforceInterface(IActivityManager.descriptor);
2440 IBinder who = data.readStrongBinder();
2441 boolean allowRestart = data.readInt() != 0;
2442 hang(who, allowRestart);
2443 reply.writeNoException();
2444 return true;
2445 }
2446
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002447 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2448 data.enforceInterface(IActivityManager.descriptor);
2449 IBinder token = data.readStrongBinder();
2450 reportActivityFullyDrawn(token);
2451 reply.writeNoException();
2452 return true;
2453 }
2454
Craig Mautner5eda9b32013-07-02 11:58:16 -07002455 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2456 data.enforceInterface(IActivityManager.descriptor);
2457 IBinder token = data.readStrongBinder();
2458 notifyActivityDrawn(token);
2459 reply.writeNoException();
2460 return true;
2461 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002462
2463 case RESTART_TRANSACTION: {
2464 data.enforceInterface(IActivityManager.descriptor);
2465 restart();
2466 reply.writeNoException();
2467 return true;
2468 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002469
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002470 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2471 data.enforceInterface(IActivityManager.descriptor);
2472 performIdleMaintenance();
2473 reply.writeNoException();
2474 return true;
2475 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002476
Todd Kennedyca4d8422015-01-15 15:19:22 -08002477 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002478 data.enforceInterface(IActivityManager.descriptor);
2479 IBinder parentActivityToken = data.readStrongBinder();
2480 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002481 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002482 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002483 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002484 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002485 if (activityContainer != null) {
2486 reply.writeInt(1);
2487 reply.writeStrongBinder(activityContainer.asBinder());
2488 } else {
2489 reply.writeInt(0);
2490 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002491 return true;
2492 }
2493
Craig Mautner95da1082014-02-24 17:54:35 -08002494 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2495 data.enforceInterface(IActivityManager.descriptor);
2496 IActivityContainer activityContainer =
2497 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2498 deleteActivityContainer(activityContainer);
2499 reply.writeNoException();
2500 return true;
2501 }
2502
Todd Kennedy4900bf92015-01-16 16:05:14 -08002503 case CREATE_STACK_ON_DISPLAY: {
2504 data.enforceInterface(IActivityManager.descriptor);
2505 int displayId = data.readInt();
2506 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2507 reply.writeNoException();
2508 if (activityContainer != null) {
2509 reply.writeInt(1);
2510 reply.writeStrongBinder(activityContainer.asBinder());
2511 } else {
2512 reply.writeInt(0);
2513 }
2514 return true;
2515 }
2516
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002517 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002518 data.enforceInterface(IActivityManager.descriptor);
2519 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002520 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002521 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002522 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002523 return true;
2524 }
2525
Craig Mautneraea74a52014-03-08 14:23:10 -08002526 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2527 data.enforceInterface(IActivityManager.descriptor);
2528 final int taskId = data.readInt();
2529 startLockTaskMode(taskId);
2530 reply.writeNoException();
2531 return true;
2532 }
2533
2534 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2535 data.enforceInterface(IActivityManager.descriptor);
2536 IBinder token = data.readStrongBinder();
2537 startLockTaskMode(token);
2538 reply.writeNoException();
2539 return true;
2540 }
2541
Craig Mautnerd61dc202014-07-07 11:09:11 -07002542 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002543 data.enforceInterface(IActivityManager.descriptor);
2544 startLockTaskModeOnCurrent();
2545 reply.writeNoException();
2546 return true;
2547 }
2548
Craig Mautneraea74a52014-03-08 14:23:10 -08002549 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2550 data.enforceInterface(IActivityManager.descriptor);
2551 stopLockTaskMode();
2552 reply.writeNoException();
2553 return true;
2554 }
2555
Craig Mautnerd61dc202014-07-07 11:09:11 -07002556 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002557 data.enforceInterface(IActivityManager.descriptor);
2558 stopLockTaskModeOnCurrent();
2559 reply.writeNoException();
2560 return true;
2561 }
2562
Craig Mautneraea74a52014-03-08 14:23:10 -08002563 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2564 data.enforceInterface(IActivityManager.descriptor);
2565 final boolean isInLockTaskMode = isInLockTaskMode();
2566 reply.writeNoException();
2567 reply.writeInt(isInLockTaskMode ? 1 : 0);
2568 return true;
2569 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002570
Benjamin Franz43261142015-02-11 15:59:44 +00002571 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2572 data.enforceInterface(IActivityManager.descriptor);
2573 final int lockTaskModeState = getLockTaskModeState();
2574 reply.writeNoException();
2575 reply.writeInt(lockTaskModeState);
2576 return true;
2577 }
2578
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002579 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2580 data.enforceInterface(IActivityManager.descriptor);
2581 final IBinder token = data.readStrongBinder();
2582 showLockTaskEscapeMessage(token);
2583 reply.writeNoException();
2584 return true;
2585 }
2586
Winson Chunga449dc02014-05-16 11:15:04 -07002587 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002588 data.enforceInterface(IActivityManager.descriptor);
2589 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002590 ActivityManager.TaskDescription values =
2591 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2592 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002593 reply.writeNoException();
2594 return true;
2595 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002596
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002597 case SET_TASK_RESIZEABLE_TRANSACTION: {
2598 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08002599 final int taskId = data.readInt();
2600 final int resizeableMode = data.readInt();
2601 setTaskResizeable(taskId, resizeableMode);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002602 reply.writeNoException();
2603 return true;
2604 }
2605
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002606 case RESIZE_TASK_TRANSACTION: {
2607 data.enforceInterface(IActivityManager.descriptor);
2608 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002609 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002610 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002611 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002612 reply.writeNoException();
2613 return true;
2614 }
2615
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002616 case GET_TASK_BOUNDS_TRANSACTION: {
2617 data.enforceInterface(IActivityManager.descriptor);
2618 int taskId = data.readInt();
2619 Rect r = getTaskBounds(taskId);
2620 reply.writeNoException();
2621 r.writeToParcel(reply, 0);
2622 return true;
2623 }
2624
Craig Mautner648f69b2014-09-18 14:16:26 -07002625 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2626 data.enforceInterface(IActivityManager.descriptor);
2627 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002628 int userId = data.readInt();
2629 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002630 reply.writeNoException();
2631 if (icon == null) {
2632 reply.writeInt(0);
2633 } else {
2634 reply.writeInt(1);
2635 icon.writeToParcel(reply, 0);
2636 }
2637 return true;
2638 }
2639
Winson Chung044d5292014-11-06 11:05:19 -08002640 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2641 data.enforceInterface(IActivityManager.descriptor);
2642 final Bundle bundle;
2643 if (data.readInt() == 0) {
2644 bundle = null;
2645 } else {
2646 bundle = data.readBundle();
2647 }
Chong Zhang280d3322015-11-03 17:27:26 -08002648 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002649 startInPlaceAnimationOnFrontMostApplication(options);
2650 reply.writeNoException();
2651 return true;
2652 }
2653
Jose Lima4b6c6692014-08-12 17:41:12 -07002654 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002655 data.enforceInterface(IActivityManager.descriptor);
2656 IBinder token = data.readStrongBinder();
2657 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002658 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002659 reply.writeNoException();
2660 reply.writeInt(success ? 1 : 0);
2661 return true;
2662 }
2663
Jose Lima4b6c6692014-08-12 17:41:12 -07002664 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002665 data.enforceInterface(IActivityManager.descriptor);
2666 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002667 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002668 reply.writeNoException();
2669 reply.writeInt(enabled ? 1 : 0);
2670 return true;
2671 }
2672
Jose Lima4b6c6692014-08-12 17:41:12 -07002673 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002674 data.enforceInterface(IActivityManager.descriptor);
2675 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002676 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002677 reply.writeNoException();
2678 return true;
2679 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002680
2681 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2682 data.enforceInterface(IActivityManager.descriptor);
2683 IBinder token = data.readStrongBinder();
2684 notifyLaunchTaskBehindComplete(token);
2685 reply.writeNoException();
2686 return true;
2687 }
Craig Mautner8746a472014-07-24 15:12:54 -07002688
2689 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2690 data.enforceInterface(IActivityManager.descriptor);
2691 IBinder token = data.readStrongBinder();
2692 notifyEnterAnimationComplete(token);
2693 reply.writeNoException();
2694 return true;
2695 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002696
2697 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2698 data.enforceInterface(IActivityManager.descriptor);
2699 bootAnimationComplete();
2700 reply.writeNoException();
2701 return true;
2702 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002703
Jeff Sharkey605eb792014-11-04 13:34:06 -08002704 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2705 data.enforceInterface(IActivityManager.descriptor);
2706 final int uid = data.readInt();
2707 final byte[] firstPacket = data.createByteArray();
2708 notifyCleartextNetwork(uid, firstPacket);
2709 reply.writeNoException();
2710 return true;
2711 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002712
2713 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2714 data.enforceInterface(IActivityManager.descriptor);
2715 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002716 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002717 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002718 String reportPackage = data.readString();
2719 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002720 reply.writeNoException();
2721 return true;
2722 }
2723
2724 case DUMP_HEAP_FINISHED_TRANSACTION: {
2725 data.enforceInterface(IActivityManager.descriptor);
2726 String path = data.readString();
2727 dumpHeapFinished(path);
2728 reply.writeNoException();
2729 return true;
2730 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002731
2732 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2733 data.enforceInterface(IActivityManager.descriptor);
2734 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2735 data.readStrongBinder());
2736 boolean keepAwake = data.readInt() != 0;
2737 setVoiceKeepAwake(session, keepAwake);
2738 reply.writeNoException();
2739 return true;
2740 }
Craig Mautnere5600772015-04-03 21:36:37 -07002741
2742 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2743 data.enforceInterface(IActivityManager.descriptor);
2744 int userId = data.readInt();
2745 String[] packages = data.readStringArray();
2746 updateLockTaskPackages(userId, packages);
2747 reply.writeNoException();
2748 return true;
2749 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002750
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002751 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2752 data.enforceInterface(IActivityManager.descriptor);
2753 String packageName = data.readString();
2754 updateDeviceOwner(packageName);
2755 reply.writeNoException();
2756 return true;
2757 }
2758
Dianne Hackborn1e383822015-04-10 14:02:33 -07002759 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2760 data.enforceInterface(IActivityManager.descriptor);
2761 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002762 String callingPackage = data.readString();
2763 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002764 reply.writeNoException();
2765 reply.writeInt(res);
2766 return true;
2767 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002768
2769 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2770 data.enforceInterface(IActivityManager.descriptor);
2771 String process = data.readString();
2772 int userId = data.readInt();
2773 int level = data.readInt();
2774 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2775 reply.writeNoException();
2776 reply.writeInt(res ? 1 : 0);
2777 return true;
2778 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002779
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002780 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2781 data.enforceInterface(IActivityManager.descriptor);
2782 IBinder token = data.readStrongBinder();
2783 boolean res = isRootVoiceInteraction(token);
2784 reply.writeNoException();
2785 reply.writeInt(res ? 1 : 0);
2786 return true;
2787 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002788
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002789 case START_BINDER_TRACKING_TRANSACTION: {
2790 data.enforceInterface(IActivityManager.descriptor);
2791 boolean res = startBinderTracking();
2792 reply.writeNoException();
2793 reply.writeInt(res ? 1 : 0);
2794 return true;
2795 }
2796
2797 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2798 data.enforceInterface(IActivityManager.descriptor);
2799 ParcelFileDescriptor fd = data.readInt() != 0
2800 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2801 boolean res = stopBinderTrackingAndDump(fd);
2802 reply.writeNoException();
2803 reply.writeInt(res ? 1 : 0);
2804 return true;
2805 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002806 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2807 data.enforceInterface(IActivityManager.descriptor);
2808 IBinder token = data.readStrongBinder();
2809 int stackId = getActivityStackId(token);
2810 reply.writeNoException();
2811 reply.writeInt(stackId);
2812 return true;
2813 }
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002814 case EXIT_FREEFORM_MODE_TRANSACTION: {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002815 data.enforceInterface(IActivityManager.descriptor);
2816 IBinder token = data.readStrongBinder();
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002817 exitFreeformMode(token);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002818 reply.writeNoException();
2819 return true;
2820 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002821 case REPORT_SIZE_CONFIGURATIONS: {
2822 data.enforceInterface(IActivityManager.descriptor);
2823 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002824 int[] horizontal = readIntArray(data);
2825 int[] vertical = readIntArray(data);
2826 int[] smallest = readIntArray(data);
2827 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002828 return true;
2829 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002830 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2831 data.enforceInterface(IActivityManager.descriptor);
2832 final boolean suppress = data.readInt() == 1;
2833 suppressResizeConfigChanges(suppress);
2834 reply.writeNoException();
2835 return true;
2836 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002837 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002838 data.enforceInterface(IActivityManager.descriptor);
2839 final int stackId = data.readInt();
Wale Ogunwale9101d262016-01-15 08:56:11 -08002840 final boolean onTop = data.readInt() == 1;
2841 moveTasksToFullscreenStack(stackId, onTop);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002842 reply.writeNoException();
2843 return true;
2844 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002845 case GET_APP_START_MODE_TRANSACTION: {
2846 data.enforceInterface(IActivityManager.descriptor);
2847 final int uid = data.readInt();
2848 final String pkg = data.readString();
2849 int res = getAppStartMode(uid, pkg);
2850 reply.writeNoException();
2851 reply.writeInt(res);
2852 return true;
2853 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002854 case IN_MULTI_WINDOW_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002855 data.enforceInterface(IActivityManager.descriptor);
2856 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002857 final boolean inMultiWindow = inMultiWindow(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002858 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002859 reply.writeInt(inMultiWindow ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002860 return true;
2861 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002862 case IN_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002863 data.enforceInterface(IActivityManager.descriptor);
2864 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002865 final boolean inPip = inPictureInPicture(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002866 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002867 reply.writeInt(inPip ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002868 return true;
2869 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002870 case ENTER_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002871 data.enforceInterface(IActivityManager.descriptor);
2872 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002873 enterPictureInPicture(token);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002874 reply.writeNoException();
2875 return true;
2876 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002877 case SET_VR_MODE_TRANSACTION: {
2878 data.enforceInterface(IActivityManager.descriptor);
2879 final IBinder token = data.readStrongBinder();
2880 final boolean enable = data.readInt() == 1;
2881 setVrMode(token, enable);
2882 reply.writeNoException();
2883 return true;
2884 }
Christopher Tate63fec3e2015-12-11 18:35:28 -08002885 case IS_APP_FOREGROUND_TRANSACTION: {
2886 data.enforceInterface(IActivityManager.descriptor);
2887 final int userHandle = data.readInt();
2888 final boolean isForeground = isAppForeground(userHandle);
2889 reply.writeNoException();
2890 reply.writeInt(isForeground ? 1 : 0);
2891 return true;
2892 }
Wale Ogunwale480dca02016-02-06 13:58:29 -08002893 case NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION: {
2894 data.enforceInterface(IActivityManager.descriptor);
2895 reply.writeNoException();
2896 return true;
2897 }
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08002898 case REMOVE_STACK: {
2899 data.enforceInterface(IActivityManager.descriptor);
2900 final int stackId = data.readInt();
2901 removeStack(stackId);
2902 reply.writeNoException();
2903 return true;
2904 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002905 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002906
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002907 return super.onTransact(code, data, reply, flags);
2908 }
2909
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002910 private int[] readIntArray(Parcel data) {
2911 int[] smallest = null;
2912 int smallestSize = data.readInt();
2913 if (smallestSize > 0) {
2914 smallest = new int[smallestSize];
2915 data.readIntArray(smallest);
2916 }
2917 return smallest;
2918 }
2919
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002920 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002921 return this;
2922 }
2923
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002924 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2925 protected IActivityManager create() {
2926 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002927 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002928 Log.v("ActivityManager", "default service binder = " + b);
2929 }
2930 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002931 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002932 Log.v("ActivityManager", "default service = " + am);
2933 }
2934 return am;
2935 }
2936 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002937}
2938
2939class ActivityManagerProxy implements IActivityManager
2940{
2941 public ActivityManagerProxy(IBinder remote)
2942 {
2943 mRemote = remote;
2944 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002945
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002946 public IBinder asBinder()
2947 {
2948 return mRemote;
2949 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002950
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002951 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002952 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002953 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002958 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002959 intent.writeToParcel(data, 0);
2960 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 data.writeStrongBinder(resultTo);
2962 data.writeString(resultWho);
2963 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002964 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002965 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002966 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002967 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002968 } else {
2969 data.writeInt(0);
2970 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002971 if (options != null) {
2972 data.writeInt(1);
2973 options.writeToParcel(data, 0);
2974 } else {
2975 data.writeInt(0);
2976 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002977 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2978 reply.readException();
2979 int result = reply.readInt();
2980 reply.recycle();
2981 data.recycle();
2982 return result;
2983 }
Amith Yamasani82644082012-08-03 13:09:11 -07002984
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002985 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002986 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002987 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2988 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002989 Parcel data = Parcel.obtain();
2990 Parcel reply = Parcel.obtain();
2991 data.writeInterfaceToken(IActivityManager.descriptor);
2992 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002993 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002994 intent.writeToParcel(data, 0);
2995 data.writeString(resolvedType);
2996 data.writeStrongBinder(resultTo);
2997 data.writeString(resultWho);
2998 data.writeInt(requestCode);
2999 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003000 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07003001 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003002 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07003003 } else {
3004 data.writeInt(0);
3005 }
3006 if (options != null) {
3007 data.writeInt(1);
3008 options.writeToParcel(data, 0);
3009 } else {
3010 data.writeInt(0);
3011 }
3012 data.writeInt(userId);
3013 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
3014 reply.readException();
3015 int result = reply.readInt();
3016 reply.recycle();
3017 data.recycle();
3018 return result;
3019 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003020 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
3021 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003022 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
3023 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003024 Parcel data = Parcel.obtain();
3025 Parcel reply = Parcel.obtain();
3026 data.writeInterfaceToken(IActivityManager.descriptor);
3027 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3028 data.writeString(callingPackage);
3029 intent.writeToParcel(data, 0);
3030 data.writeString(resolvedType);
3031 data.writeStrongBinder(resultTo);
3032 data.writeString(resultWho);
3033 data.writeInt(requestCode);
3034 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003035 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003036 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003037 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003038 } else {
3039 data.writeInt(0);
3040 }
3041 if (options != null) {
3042 data.writeInt(1);
3043 options.writeToParcel(data, 0);
3044 } else {
3045 data.writeInt(0);
3046 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003047 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07003048 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003049 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
3050 reply.readException();
3051 int result = reply.readInt();
3052 reply.recycle();
3053 data.recycle();
3054 return result;
3055 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003056 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
3057 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07003058 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
3059 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003060 Parcel data = Parcel.obtain();
3061 Parcel reply = Parcel.obtain();
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003064 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003065 intent.writeToParcel(data, 0);
3066 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003067 data.writeStrongBinder(resultTo);
3068 data.writeString(resultWho);
3069 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003070 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003071 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003072 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003073 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003074 } else {
3075 data.writeInt(0);
3076 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003077 if (options != null) {
3078 data.writeInt(1);
3079 options.writeToParcel(data, 0);
3080 } else {
3081 data.writeInt(0);
3082 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003083 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003084 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3087 reply.recycle();
3088 data.recycle();
3089 return result;
3090 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003091 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3092 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003093 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003094 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003095 Parcel data = Parcel.obtain();
3096 Parcel reply = Parcel.obtain();
3097 data.writeInterfaceToken(IActivityManager.descriptor);
3098 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003099 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003100 intent.writeToParcel(data, 0);
3101 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003102 data.writeStrongBinder(resultTo);
3103 data.writeString(resultWho);
3104 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003105 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003106 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003107 if (options != null) {
3108 data.writeInt(1);
3109 options.writeToParcel(data, 0);
3110 } else {
3111 data.writeInt(0);
3112 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003113 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003114 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3115 reply.readException();
3116 int result = reply.readInt();
3117 reply.recycle();
3118 data.recycle();
3119 return result;
3120 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003121 public int startActivityIntentSender(IApplicationThread caller,
3122 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003123 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003124 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003125 Parcel data = Parcel.obtain();
3126 Parcel reply = Parcel.obtain();
3127 data.writeInterfaceToken(IActivityManager.descriptor);
3128 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3129 intent.writeToParcel(data, 0);
3130 if (fillInIntent != null) {
3131 data.writeInt(1);
3132 fillInIntent.writeToParcel(data, 0);
3133 } else {
3134 data.writeInt(0);
3135 }
3136 data.writeString(resolvedType);
3137 data.writeStrongBinder(resultTo);
3138 data.writeString(resultWho);
3139 data.writeInt(requestCode);
3140 data.writeInt(flagsMask);
3141 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003142 if (options != null) {
3143 data.writeInt(1);
3144 options.writeToParcel(data, 0);
3145 } else {
3146 data.writeInt(0);
3147 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003148 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003149 reply.readException();
3150 int result = reply.readInt();
3151 reply.recycle();
3152 data.recycle();
3153 return result;
3154 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003155 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3156 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003157 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3158 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003159 Parcel data = Parcel.obtain();
3160 Parcel reply = Parcel.obtain();
3161 data.writeInterfaceToken(IActivityManager.descriptor);
3162 data.writeString(callingPackage);
3163 data.writeInt(callingPid);
3164 data.writeInt(callingUid);
3165 intent.writeToParcel(data, 0);
3166 data.writeString(resolvedType);
3167 data.writeStrongBinder(session.asBinder());
3168 data.writeStrongBinder(interactor.asBinder());
3169 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003170 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003171 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003172 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003173 } else {
3174 data.writeInt(0);
3175 }
3176 if (options != null) {
3177 data.writeInt(1);
3178 options.writeToParcel(data, 0);
3179 } else {
3180 data.writeInt(0);
3181 }
3182 data.writeInt(userId);
3183 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3184 reply.readException();
3185 int result = reply.readInt();
3186 reply.recycle();
3187 data.recycle();
3188 return result;
3189 }
Amith Yamasani0af6fa72016-01-17 15:36:19 -08003190
3191 public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options)
3192 throws RemoteException {
3193 Parcel data = Parcel.obtain();
3194 Parcel reply = Parcel.obtain();
3195 data.writeInterfaceToken(IActivityManager.descriptor);
3196 data.writeStrongBinder(callingActivity);
3197 data.writeBundle(options);
3198 mRemote.transact(START_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 reply.recycle();
3201 data.recycle();
3202 }
3203
3204 public void stopLocalVoiceInteraction(IBinder callingActivity) throws RemoteException {
3205 Parcel data = Parcel.obtain();
3206 Parcel reply = Parcel.obtain();
3207 data.writeInterfaceToken(IActivityManager.descriptor);
3208 data.writeStrongBinder(callingActivity);
3209 mRemote.transact(STOP_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3210 reply.readException();
3211 reply.recycle();
3212 data.recycle();
3213 }
3214
3215 public boolean supportsLocalVoiceInteraction() throws RemoteException {
3216 Parcel data = Parcel.obtain();
3217 Parcel reply = Parcel.obtain();
3218 data.writeInterfaceToken(IActivityManager.descriptor);
3219 mRemote.transact(SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3220 reply.readException();
3221 int result = reply.readInt();
3222 reply.recycle();
3223 data.recycle();
3224 return result != 0;
3225 }
3226
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003227 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003228 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 data.writeStrongBinder(callingActivity);
3233 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003234 if (options != null) {
3235 data.writeInt(1);
3236 options.writeToParcel(data, 0);
3237 } else {
3238 data.writeInt(0);
3239 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3241 reply.readException();
3242 int result = reply.readInt();
3243 reply.recycle();
3244 data.recycle();
3245 return result != 0;
3246 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003247 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003248 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003249 Parcel data = Parcel.obtain();
3250 Parcel reply = Parcel.obtain();
3251 data.writeInterfaceToken(IActivityManager.descriptor);
3252 data.writeInt(taskId);
3253 if (options == null) {
3254 data.writeInt(0);
3255 } else {
3256 data.writeInt(1);
3257 options.writeToParcel(data, 0);
3258 }
3259 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 int result = reply.readInt();
3262 reply.recycle();
3263 data.recycle();
3264 return result;
3265 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003266 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003267 throws RemoteException {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 data.writeStrongBinder(token);
3272 data.writeInt(resultCode);
3273 if (resultData != null) {
3274 data.writeInt(1);
3275 resultData.writeToParcel(data, 0);
3276 } else {
3277 data.writeInt(0);
3278 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003279 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003280 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3281 reply.readException();
3282 boolean res = reply.readInt() != 0;
3283 data.recycle();
3284 reply.recycle();
3285 return res;
3286 }
3287 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3288 {
3289 Parcel data = Parcel.obtain();
3290 Parcel reply = Parcel.obtain();
3291 data.writeInterfaceToken(IActivityManager.descriptor);
3292 data.writeStrongBinder(token);
3293 data.writeString(resultWho);
3294 data.writeInt(requestCode);
3295 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3296 reply.readException();
3297 data.recycle();
3298 reply.recycle();
3299 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003300 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3301 Parcel data = Parcel.obtain();
3302 Parcel reply = Parcel.obtain();
3303 data.writeInterfaceToken(IActivityManager.descriptor);
3304 data.writeStrongBinder(token);
3305 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3306 reply.readException();
3307 boolean res = reply.readInt() != 0;
3308 data.recycle();
3309 reply.recycle();
3310 return res;
3311 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003312 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3313 Parcel data = Parcel.obtain();
3314 Parcel reply = Parcel.obtain();
3315 data.writeInterfaceToken(IActivityManager.descriptor);
3316 data.writeStrongBinder(session.asBinder());
3317 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3318 reply.readException();
3319 data.recycle();
3320 reply.recycle();
3321 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003322 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3323 Parcel data = Parcel.obtain();
3324 Parcel reply = Parcel.obtain();
3325 data.writeInterfaceToken(IActivityManager.descriptor);
3326 data.writeStrongBinder(token);
3327 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3328 reply.readException();
3329 boolean res = reply.readInt() != 0;
3330 data.recycle();
3331 reply.recycle();
3332 return res;
3333 }
3334 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3335 Parcel data = Parcel.obtain();
3336 Parcel reply = Parcel.obtain();
3337 data.writeInterfaceToken(IActivityManager.descriptor);
3338 data.writeStrongBinder(app.asBinder());
3339 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 data.recycle();
3342 reply.recycle();
3343 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003344 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3345 Parcel data = Parcel.obtain();
3346 Parcel reply = Parcel.obtain();
3347 data.writeInterfaceToken(IActivityManager.descriptor);
3348 data.writeStrongBinder(token);
3349 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3350 reply.readException();
3351 boolean res = reply.readInt() != 0;
3352 data.recycle();
3353 reply.recycle();
3354 return res;
3355 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003356 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003357 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003358 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003359 {
3360 Parcel data = Parcel.obtain();
3361 Parcel reply = Parcel.obtain();
3362 data.writeInterfaceToken(IActivityManager.descriptor);
3363 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003364 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003365 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3366 filter.writeToParcel(data, 0);
3367 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003368 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003369 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3370 reply.readException();
3371 Intent intent = null;
3372 int haveIntent = reply.readInt();
3373 if (haveIntent != 0) {
3374 intent = Intent.CREATOR.createFromParcel(reply);
3375 }
3376 reply.recycle();
3377 data.recycle();
3378 return intent;
3379 }
3380 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3381 {
3382 Parcel data = Parcel.obtain();
3383 Parcel reply = Parcel.obtain();
3384 data.writeInterfaceToken(IActivityManager.descriptor);
3385 data.writeStrongBinder(receiver.asBinder());
3386 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 data.recycle();
3389 reply.recycle();
3390 }
3391 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003392 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003393 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003394 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003395 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003396 {
3397 Parcel data = Parcel.obtain();
3398 Parcel reply = Parcel.obtain();
3399 data.writeInterfaceToken(IActivityManager.descriptor);
3400 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3401 intent.writeToParcel(data, 0);
3402 data.writeString(resolvedType);
3403 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3404 data.writeInt(resultCode);
3405 data.writeString(resultData);
3406 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003407 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003408 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003409 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003410 data.writeInt(serialized ? 1 : 0);
3411 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003412 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003413 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3414 reply.readException();
3415 int res = reply.readInt();
3416 reply.recycle();
3417 data.recycle();
3418 return res;
3419 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003420 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3421 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003422 {
3423 Parcel data = Parcel.obtain();
3424 Parcel reply = Parcel.obtain();
3425 data.writeInterfaceToken(IActivityManager.descriptor);
3426 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3427 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003428 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003429 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3430 reply.readException();
3431 data.recycle();
3432 reply.recycle();
3433 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003434 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3435 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 {
3437 Parcel data = Parcel.obtain();
3438 Parcel reply = Parcel.obtain();
3439 data.writeInterfaceToken(IActivityManager.descriptor);
3440 data.writeStrongBinder(who);
3441 data.writeInt(resultCode);
3442 data.writeString(resultData);
3443 data.writeBundle(map);
3444 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003445 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003446 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3447 reply.readException();
3448 data.recycle();
3449 reply.recycle();
3450 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003451 public void attachApplication(IApplicationThread app) throws RemoteException
3452 {
3453 Parcel data = Parcel.obtain();
3454 Parcel reply = Parcel.obtain();
3455 data.writeInterfaceToken(IActivityManager.descriptor);
3456 data.writeStrongBinder(app.asBinder());
3457 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3458 reply.readException();
3459 data.recycle();
3460 reply.recycle();
3461 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003462 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3463 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003464 {
3465 Parcel data = Parcel.obtain();
3466 Parcel reply = Parcel.obtain();
3467 data.writeInterfaceToken(IActivityManager.descriptor);
3468 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003469 if (config != null) {
3470 data.writeInt(1);
3471 config.writeToParcel(data, 0);
3472 } else {
3473 data.writeInt(0);
3474 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003475 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003476 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3477 reply.readException();
3478 data.recycle();
3479 reply.recycle();
3480 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003481 public void activityResumed(IBinder token) throws RemoteException
3482 {
3483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 data.writeStrongBinder(token);
3487 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3488 reply.readException();
3489 data.recycle();
3490 reply.recycle();
3491 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003492 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003493 {
3494 Parcel data = Parcel.obtain();
3495 Parcel reply = Parcel.obtain();
3496 data.writeInterfaceToken(IActivityManager.descriptor);
3497 data.writeStrongBinder(token);
3498 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3499 reply.readException();
3500 data.recycle();
3501 reply.recycle();
3502 }
3503 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003504 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003505 {
3506 Parcel data = Parcel.obtain();
3507 Parcel reply = Parcel.obtain();
3508 data.writeInterfaceToken(IActivityManager.descriptor);
3509 data.writeStrongBinder(token);
3510 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003511 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003512 TextUtils.writeToParcel(description, data, 0);
3513 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3514 reply.readException();
3515 data.recycle();
3516 reply.recycle();
3517 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003518 public void activitySlept(IBinder token) throws RemoteException
3519 {
3520 Parcel data = Parcel.obtain();
3521 Parcel reply = Parcel.obtain();
3522 data.writeInterfaceToken(IActivityManager.descriptor);
3523 data.writeStrongBinder(token);
3524 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3525 reply.readException();
3526 data.recycle();
3527 reply.recycle();
3528 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003529 public void activityDestroyed(IBinder token) throws RemoteException
3530 {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 data.writeStrongBinder(token);
3535 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3536 reply.readException();
3537 data.recycle();
3538 reply.recycle();
3539 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003540 public void activityRelaunched(IBinder token) throws RemoteException
3541 {
3542 Parcel data = Parcel.obtain();
3543 Parcel reply = Parcel.obtain();
3544 data.writeInterfaceToken(IActivityManager.descriptor);
3545 data.writeStrongBinder(token);
3546 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3547 reply.readException();
3548 data.recycle();
3549 reply.recycle();
3550 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003551 public String getCallingPackage(IBinder token) throws RemoteException
3552 {
3553 Parcel data = Parcel.obtain();
3554 Parcel reply = Parcel.obtain();
3555 data.writeInterfaceToken(IActivityManager.descriptor);
3556 data.writeStrongBinder(token);
3557 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 String res = reply.readString();
3560 data.recycle();
3561 reply.recycle();
3562 return res;
3563 }
3564 public ComponentName getCallingActivity(IBinder token)
3565 throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeStrongBinder(token);
3570 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3571 reply.readException();
3572 ComponentName res = ComponentName.readFromParcel(reply);
3573 data.recycle();
3574 reply.recycle();
3575 return res;
3576 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003577 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003578 Parcel data = Parcel.obtain();
3579 Parcel reply = Parcel.obtain();
3580 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003581 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003582 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3583 reply.readException();
3584 ArrayList<IAppTask> list = null;
3585 int N = reply.readInt();
3586 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003587 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003588 while (N > 0) {
3589 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3590 list.add(task);
3591 N--;
3592 }
3593 }
3594 data.recycle();
3595 reply.recycle();
3596 return list;
3597 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003598 public int addAppTask(IBinder activityToken, Intent intent,
3599 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3600 Parcel data = Parcel.obtain();
3601 Parcel reply = Parcel.obtain();
3602 data.writeInterfaceToken(IActivityManager.descriptor);
3603 data.writeStrongBinder(activityToken);
3604 intent.writeToParcel(data, 0);
3605 description.writeToParcel(data, 0);
3606 thumbnail.writeToParcel(data, 0);
3607 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3608 reply.readException();
3609 int res = reply.readInt();
3610 data.recycle();
3611 reply.recycle();
3612 return res;
3613 }
3614 public Point getAppTaskThumbnailSize() throws RemoteException {
3615 Parcel data = Parcel.obtain();
3616 Parcel reply = Parcel.obtain();
3617 data.writeInterfaceToken(IActivityManager.descriptor);
3618 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3619 reply.readException();
3620 Point size = Point.CREATOR.createFromParcel(reply);
3621 data.recycle();
3622 reply.recycle();
3623 return size;
3624 }
Todd Kennedye635f662015-01-20 10:36:49 -08003625 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3626 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003627 Parcel data = Parcel.obtain();
3628 Parcel reply = Parcel.obtain();
3629 data.writeInterfaceToken(IActivityManager.descriptor);
3630 data.writeInt(maxNum);
3631 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003632 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3633 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003634 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003635 int N = reply.readInt();
3636 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003637 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003638 while (N > 0) {
3639 ActivityManager.RunningTaskInfo info =
3640 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003641 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003642 list.add(info);
3643 N--;
3644 }
3645 }
3646 data.recycle();
3647 reply.recycle();
3648 return list;
3649 }
3650 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003651 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003652 Parcel data = Parcel.obtain();
3653 Parcel reply = Parcel.obtain();
3654 data.writeInterfaceToken(IActivityManager.descriptor);
3655 data.writeInt(maxNum);
3656 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003657 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003658 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3659 reply.readException();
3660 ArrayList<ActivityManager.RecentTaskInfo> list
3661 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3662 data.recycle();
3663 reply.recycle();
3664 return list;
3665 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003666 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003667 Parcel data = Parcel.obtain();
3668 Parcel reply = Parcel.obtain();
3669 data.writeInterfaceToken(IActivityManager.descriptor);
3670 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003671 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003672 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003673 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003674 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003675 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003676 }
3677 data.recycle();
3678 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003679 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003680 }
Todd Kennedye635f662015-01-20 10:36:49 -08003681 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3682 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003683 Parcel data = Parcel.obtain();
3684 Parcel reply = Parcel.obtain();
3685 data.writeInterfaceToken(IActivityManager.descriptor);
3686 data.writeInt(maxNum);
3687 data.writeInt(flags);
3688 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3689 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003690 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003691 int N = reply.readInt();
3692 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003693 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003694 while (N > 0) {
3695 ActivityManager.RunningServiceInfo info =
3696 ActivityManager.RunningServiceInfo.CREATOR
3697 .createFromParcel(reply);
3698 list.add(info);
3699 N--;
3700 }
3701 }
3702 data.recycle();
3703 reply.recycle();
3704 return list;
3705 }
3706 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3707 throws RemoteException {
3708 Parcel data = Parcel.obtain();
3709 Parcel reply = Parcel.obtain();
3710 data.writeInterfaceToken(IActivityManager.descriptor);
3711 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3712 reply.readException();
3713 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3714 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3715 data.recycle();
3716 reply.recycle();
3717 return list;
3718 }
3719 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3720 throws RemoteException {
3721 Parcel data = Parcel.obtain();
3722 Parcel reply = Parcel.obtain();
3723 data.writeInterfaceToken(IActivityManager.descriptor);
3724 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3725 reply.readException();
3726 ArrayList<ActivityManager.RunningAppProcessInfo> list
3727 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3728 data.recycle();
3729 reply.recycle();
3730 return list;
3731 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003732 public List<ApplicationInfo> getRunningExternalApplications()
3733 throws RemoteException {
3734 Parcel data = Parcel.obtain();
3735 Parcel reply = Parcel.obtain();
3736 data.writeInterfaceToken(IActivityManager.descriptor);
3737 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3738 reply.readException();
3739 ArrayList<ApplicationInfo> list
3740 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3741 data.recycle();
3742 reply.recycle();
3743 return list;
3744 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003745 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003746 {
3747 Parcel data = Parcel.obtain();
3748 Parcel reply = Parcel.obtain();
3749 data.writeInterfaceToken(IActivityManager.descriptor);
3750 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003751 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003752 if (options != null) {
3753 data.writeInt(1);
3754 options.writeToParcel(data, 0);
3755 } else {
3756 data.writeInt(0);
3757 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003758 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3759 reply.readException();
3760 data.recycle();
3761 reply.recycle();
3762 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003763 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3764 throws RemoteException {
3765 Parcel data = Parcel.obtain();
3766 Parcel reply = Parcel.obtain();
3767 data.writeInterfaceToken(IActivityManager.descriptor);
3768 data.writeStrongBinder(token);
3769 data.writeInt(nonRoot ? 1 : 0);
3770 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3771 reply.readException();
3772 boolean res = reply.readInt() != 0;
3773 data.recycle();
3774 reply.recycle();
3775 return res;
3776 }
3777 public void moveTaskBackwards(int task) throws RemoteException
3778 {
3779 Parcel data = Parcel.obtain();
3780 Parcel reply = Parcel.obtain();
3781 data.writeInterfaceToken(IActivityManager.descriptor);
3782 data.writeInt(task);
3783 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 data.recycle();
3786 reply.recycle();
3787 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003788 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003789 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3790 {
3791 Parcel data = Parcel.obtain();
3792 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003793 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003794 data.writeInt(taskId);
3795 data.writeInt(stackId);
3796 data.writeInt(toTop ? 1 : 0);
3797 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3798 reply.readException();
3799 data.recycle();
3800 reply.recycle();
3801 }
3802 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003803 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3804 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003805 {
3806 Parcel data = Parcel.obtain();
3807 Parcel reply = Parcel.obtain();
3808 data.writeInterfaceToken(IActivityManager.descriptor);
3809 data.writeInt(taskId);
3810 data.writeInt(createMode);
3811 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003812 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003813 if (initialBounds != null) {
3814 data.writeInt(1);
3815 initialBounds.writeToParcel(data, 0);
3816 } else {
3817 data.writeInt(0);
3818 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003819 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 data.recycle();
3822 reply.recycle();
3823 }
3824 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003825 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3826 throws RemoteException
3827 {
3828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
3831 data.writeInt(stackId);
3832 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003833 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003834 reply.readException();
3835 final boolean res = reply.readInt() != 0;
3836 data.recycle();
3837 reply.recycle();
3838 return res;
3839 }
3840 @Override
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003841 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode,
3842 boolean preserveWindows, boolean animate) throws RemoteException {
Craig Mautnerc00204b2013-03-05 15:02:14 -08003843 Parcel data = Parcel.obtain();
3844 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003845 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003846 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003847 if (r != null) {
3848 data.writeInt(1);
3849 r.writeToParcel(data, 0);
3850 } else {
3851 data.writeInt(0);
3852 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003853 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003854 data.writeInt(preserveWindows ? 1 : 0);
3855 data.writeInt(animate ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003856 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003857 reply.readException();
3858 data.recycle();
3859 reply.recycle();
3860 }
Craig Mautner967212c2013-04-13 21:10:58 -07003861 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003862 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3863 Rect tempDockedTaskInsetBounds,
3864 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3865 throws RemoteException
3866 {
3867 Parcel data = Parcel.obtain();
3868 Parcel reply = Parcel.obtain();
3869 data.writeInterfaceToken(IActivityManager.descriptor);
3870 if (dockedBounds != null) {
3871 data.writeInt(1);
3872 dockedBounds.writeToParcel(data, 0);
3873 } else {
3874 data.writeInt(0);
3875 }
3876 if (tempDockedTaskBounds != null) {
3877 data.writeInt(1);
3878 tempDockedTaskBounds.writeToParcel(data, 0);
3879 } else {
3880 data.writeInt(0);
3881 }
3882 if (tempDockedTaskInsetBounds != null) {
3883 data.writeInt(1);
3884 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3885 } else {
3886 data.writeInt(0);
3887 }
3888 if (tempOtherTaskBounds != null) {
3889 data.writeInt(1);
3890 tempOtherTaskBounds.writeToParcel(data, 0);
3891 } else {
3892 data.writeInt(0);
3893 }
3894 if (tempOtherTaskInsetBounds != null) {
3895 data.writeInt(1);
3896 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3897 } else {
3898 data.writeInt(0);
3899 }
3900 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3901 reply.readException();
3902 data.recycle();
3903 reply.recycle();
3904 }
3905 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003906 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3907 {
3908 Parcel data = Parcel.obtain();
3909 Parcel reply = Parcel.obtain();
3910 data.writeInterfaceToken(IActivityManager.descriptor);
3911 data.writeInt(taskId);
3912 data.writeInt(stackId);
3913 data.writeInt(position);
3914 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3915 reply.readException();
3916 data.recycle();
3917 reply.recycle();
3918 }
3919 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003920 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003921 {
3922 Parcel data = Parcel.obtain();
3923 Parcel reply = Parcel.obtain();
3924 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003925 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003926 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003927 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003928 data.recycle();
3929 reply.recycle();
3930 return list;
3931 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003932 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003933 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003934 {
3935 Parcel data = Parcel.obtain();
3936 Parcel reply = Parcel.obtain();
3937 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003938 data.writeInt(stackId);
3939 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003940 reply.readException();
3941 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003942 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003943 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003944 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003945 }
3946 data.recycle();
3947 reply.recycle();
3948 return info;
3949 }
3950 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003951 public boolean isInHomeStack(int taskId) throws RemoteException {
3952 Parcel data = Parcel.obtain();
3953 Parcel reply = Parcel.obtain();
3954 data.writeInterfaceToken(IActivityManager.descriptor);
3955 data.writeInt(taskId);
3956 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3957 reply.readException();
3958 boolean isInHomeStack = reply.readInt() > 0;
3959 data.recycle();
3960 reply.recycle();
3961 return isInHomeStack;
3962 }
3963 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003964 public void setFocusedStack(int stackId) throws RemoteException
3965 {
3966 Parcel data = Parcel.obtain();
3967 Parcel reply = Parcel.obtain();
3968 data.writeInterfaceToken(IActivityManager.descriptor);
3969 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003970 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003971 reply.readException();
3972 data.recycle();
3973 reply.recycle();
3974 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003975 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003976 public int getFocusedStackId() throws RemoteException {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3981 reply.readException();
3982 int focusedStackId = reply.readInt();
3983 data.recycle();
3984 reply.recycle();
3985 return focusedStackId;
3986 }
3987 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003988 public void setFocusedTask(int taskId) throws RemoteException
3989 {
3990 Parcel data = Parcel.obtain();
3991 Parcel reply = Parcel.obtain();
3992 data.writeInterfaceToken(IActivityManager.descriptor);
3993 data.writeInt(taskId);
3994 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3995 reply.readException();
3996 data.recycle();
3997 reply.recycle();
3998 }
3999 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08004000 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
4001 {
4002 Parcel data = Parcel.obtain();
4003 Parcel reply = Parcel.obtain();
4004 data.writeInterfaceToken(IActivityManager.descriptor);
4005 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07004006 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08004007 reply.readException();
4008 data.recycle();
4009 reply.recycle();
4010 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004011 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
4012 {
4013 Parcel data = Parcel.obtain();
4014 Parcel reply = Parcel.obtain();
4015 data.writeInterfaceToken(IActivityManager.descriptor);
4016 data.writeStrongBinder(token);
4017 data.writeInt(onlyRoot ? 1 : 0);
4018 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
4019 reply.readException();
4020 int res = reply.readInt();
4021 data.recycle();
4022 reply.recycle();
4023 return res;
4024 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004025 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07004026 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004027 Parcel data = Parcel.obtain();
4028 Parcel reply = Parcel.obtain();
4029 data.writeInterfaceToken(IActivityManager.descriptor);
4030 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4031 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004032 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004033 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004034 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4035 reply.readException();
4036 int res = reply.readInt();
4037 ContentProviderHolder cph = null;
4038 if (res != 0) {
4039 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4040 }
4041 data.recycle();
4042 reply.recycle();
4043 return cph;
4044 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07004045 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
4046 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004047 Parcel data = Parcel.obtain();
4048 Parcel reply = Parcel.obtain();
4049 data.writeInterfaceToken(IActivityManager.descriptor);
4050 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004051 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004052 data.writeStrongBinder(token);
4053 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4054 reply.readException();
4055 int res = reply.readInt();
4056 ContentProviderHolder cph = null;
4057 if (res != 0) {
4058 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4059 }
4060 data.recycle();
4061 reply.recycle();
4062 return cph;
4063 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004064 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004065 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004066 {
4067 Parcel data = Parcel.obtain();
4068 Parcel reply = Parcel.obtain();
4069 data.writeInterfaceToken(IActivityManager.descriptor);
4070 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4071 data.writeTypedList(providers);
4072 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
4073 reply.readException();
4074 data.recycle();
4075 reply.recycle();
4076 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004077 public boolean refContentProvider(IBinder connection, int stable, int unstable)
4078 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004082 data.writeStrongBinder(connection);
4083 data.writeInt(stable);
4084 data.writeInt(unstable);
4085 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4086 reply.readException();
4087 boolean res = reply.readInt() != 0;
4088 data.recycle();
4089 reply.recycle();
4090 return res;
4091 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004092
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004093 public void unstableProviderDied(IBinder connection) throws RemoteException {
4094 Parcel data = Parcel.obtain();
4095 Parcel reply = Parcel.obtain();
4096 data.writeInterfaceToken(IActivityManager.descriptor);
4097 data.writeStrongBinder(connection);
4098 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
4099 reply.readException();
4100 data.recycle();
4101 reply.recycle();
4102 }
4103
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004104 @Override
4105 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
4106 Parcel data = Parcel.obtain();
4107 Parcel reply = Parcel.obtain();
4108 data.writeInterfaceToken(IActivityManager.descriptor);
4109 data.writeStrongBinder(connection);
4110 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 data.recycle();
4113 reply.recycle();
4114 }
4115
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004116 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
4120 data.writeStrongBinder(connection);
4121 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004122 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4123 reply.readException();
4124 data.recycle();
4125 reply.recycle();
4126 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004127
4128 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 data.writeString(name);
4133 data.writeStrongBinder(token);
4134 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4135 reply.readException();
4136 data.recycle();
4137 reply.recycle();
4138 }
4139
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004140 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4141 throws RemoteException
4142 {
4143 Parcel data = Parcel.obtain();
4144 Parcel reply = Parcel.obtain();
4145 data.writeInterfaceToken(IActivityManager.descriptor);
4146 service.writeToParcel(data, 0);
4147 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4148 reply.readException();
4149 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4150 data.recycle();
4151 reply.recycle();
4152 return res;
4153 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004154
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004155 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004156 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004157 {
4158 Parcel data = Parcel.obtain();
4159 Parcel reply = Parcel.obtain();
4160 data.writeInterfaceToken(IActivityManager.descriptor);
4161 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4162 service.writeToParcel(data, 0);
4163 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004164 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004165 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004166 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4167 reply.readException();
4168 ComponentName res = ComponentName.readFromParcel(reply);
4169 data.recycle();
4170 reply.recycle();
4171 return res;
4172 }
4173 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004174 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004175 {
4176 Parcel data = Parcel.obtain();
4177 Parcel reply = Parcel.obtain();
4178 data.writeInterfaceToken(IActivityManager.descriptor);
4179 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4180 service.writeToParcel(data, 0);
4181 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004182 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004183 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4184 reply.readException();
4185 int res = reply.readInt();
4186 reply.recycle();
4187 data.recycle();
4188 return res;
4189 }
4190 public boolean stopServiceToken(ComponentName className, IBinder token,
4191 int startId) throws RemoteException {
4192 Parcel data = Parcel.obtain();
4193 Parcel reply = Parcel.obtain();
4194 data.writeInterfaceToken(IActivityManager.descriptor);
4195 ComponentName.writeToParcel(className, data);
4196 data.writeStrongBinder(token);
4197 data.writeInt(startId);
4198 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4199 reply.readException();
4200 boolean res = reply.readInt() != 0;
4201 data.recycle();
4202 reply.recycle();
4203 return res;
4204 }
4205 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004206 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004207 Parcel data = Parcel.obtain();
4208 Parcel reply = Parcel.obtain();
4209 data.writeInterfaceToken(IActivityManager.descriptor);
4210 ComponentName.writeToParcel(className, data);
4211 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004212 data.writeInt(id);
4213 if (notification != null) {
4214 data.writeInt(1);
4215 notification.writeToParcel(data, 0);
4216 } else {
4217 data.writeInt(0);
4218 }
4219 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004220 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4221 reply.readException();
4222 data.recycle();
4223 reply.recycle();
4224 }
4225 public int bindService(IApplicationThread caller, IBinder token,
4226 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004227 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004228 Parcel data = Parcel.obtain();
4229 Parcel reply = Parcel.obtain();
4230 data.writeInterfaceToken(IActivityManager.descriptor);
4231 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4232 data.writeStrongBinder(token);
4233 service.writeToParcel(data, 0);
4234 data.writeString(resolvedType);
4235 data.writeStrongBinder(connection.asBinder());
4236 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004237 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004238 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004239 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 int res = reply.readInt();
4242 data.recycle();
4243 reply.recycle();
4244 return res;
4245 }
4246 public boolean unbindService(IServiceConnection connection) throws RemoteException
4247 {
4248 Parcel data = Parcel.obtain();
4249 Parcel reply = Parcel.obtain();
4250 data.writeInterfaceToken(IActivityManager.descriptor);
4251 data.writeStrongBinder(connection.asBinder());
4252 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4253 reply.readException();
4254 boolean res = reply.readInt() != 0;
4255 data.recycle();
4256 reply.recycle();
4257 return res;
4258 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004259
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004260 public void publishService(IBinder token,
4261 Intent intent, IBinder service) throws RemoteException {
4262 Parcel data = Parcel.obtain();
4263 Parcel reply = Parcel.obtain();
4264 data.writeInterfaceToken(IActivityManager.descriptor);
4265 data.writeStrongBinder(token);
4266 intent.writeToParcel(data, 0);
4267 data.writeStrongBinder(service);
4268 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4269 reply.readException();
4270 data.recycle();
4271 reply.recycle();
4272 }
4273
4274 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4275 throws RemoteException {
4276 Parcel data = Parcel.obtain();
4277 Parcel reply = Parcel.obtain();
4278 data.writeInterfaceToken(IActivityManager.descriptor);
4279 data.writeStrongBinder(token);
4280 intent.writeToParcel(data, 0);
4281 data.writeInt(doRebind ? 1 : 0);
4282 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 data.recycle();
4285 reply.recycle();
4286 }
4287
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004288 public void serviceDoneExecuting(IBinder token, int type, int startId,
4289 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004290 Parcel data = Parcel.obtain();
4291 Parcel reply = Parcel.obtain();
4292 data.writeInterfaceToken(IActivityManager.descriptor);
4293 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004294 data.writeInt(type);
4295 data.writeInt(startId);
4296 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004297 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4298 reply.readException();
4299 data.recycle();
4300 reply.recycle();
4301 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004302
Svet Ganov99b60432015-06-27 13:15:22 -07004303 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4304 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004305 Parcel data = Parcel.obtain();
4306 Parcel reply = Parcel.obtain();
4307 data.writeInterfaceToken(IActivityManager.descriptor);
4308 service.writeToParcel(data, 0);
4309 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004310 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004311 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4312 reply.readException();
4313 IBinder binder = reply.readStrongBinder();
4314 reply.recycle();
4315 data.recycle();
4316 return binder;
4317 }
4318
Christopher Tate181fafa2009-05-14 11:12:14 -07004319 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4320 throws RemoteException {
4321 Parcel data = Parcel.obtain();
4322 Parcel reply = Parcel.obtain();
4323 data.writeInterfaceToken(IActivityManager.descriptor);
4324 app.writeToParcel(data, 0);
4325 data.writeInt(backupRestoreMode);
4326 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4327 reply.readException();
4328 boolean success = reply.readInt() != 0;
4329 reply.recycle();
4330 data.recycle();
4331 return success;
4332 }
4333
Christopher Tate346acb12012-10-15 19:20:25 -07004334 public void clearPendingBackup() throws RemoteException {
4335 Parcel data = Parcel.obtain();
4336 Parcel reply = Parcel.obtain();
4337 data.writeInterfaceToken(IActivityManager.descriptor);
4338 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4339 reply.recycle();
4340 data.recycle();
4341 }
4342
Christopher Tate181fafa2009-05-14 11:12:14 -07004343 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4344 Parcel data = Parcel.obtain();
4345 Parcel reply = Parcel.obtain();
4346 data.writeInterfaceToken(IActivityManager.descriptor);
4347 data.writeString(packageName);
4348 data.writeStrongBinder(agent);
4349 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4350 reply.recycle();
4351 data.recycle();
4352 }
4353
4354 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4355 Parcel data = Parcel.obtain();
4356 Parcel reply = Parcel.obtain();
4357 data.writeInterfaceToken(IActivityManager.descriptor);
4358 app.writeToParcel(data, 0);
4359 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4360 reply.readException();
4361 reply.recycle();
4362 data.recycle();
4363 }
4364
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004365 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004366 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004367 IUiAutomationConnection connection, int userId, String instructionSet)
4368 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004369 Parcel data = Parcel.obtain();
4370 Parcel reply = Parcel.obtain();
4371 data.writeInterfaceToken(IActivityManager.descriptor);
4372 ComponentName.writeToParcel(className, data);
4373 data.writeString(profileFile);
4374 data.writeInt(flags);
4375 data.writeBundle(arguments);
4376 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004377 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004378 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004379 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004380 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4381 reply.readException();
4382 boolean res = reply.readInt() != 0;
4383 reply.recycle();
4384 data.recycle();
4385 return res;
4386 }
4387
4388 public void finishInstrumentation(IApplicationThread target,
4389 int resultCode, Bundle results) throws RemoteException {
4390 Parcel data = Parcel.obtain();
4391 Parcel reply = Parcel.obtain();
4392 data.writeInterfaceToken(IActivityManager.descriptor);
4393 data.writeStrongBinder(target != null ? target.asBinder() : null);
4394 data.writeInt(resultCode);
4395 data.writeBundle(results);
4396 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4397 reply.readException();
4398 data.recycle();
4399 reply.recycle();
4400 }
4401 public Configuration getConfiguration() throws RemoteException
4402 {
4403 Parcel data = Parcel.obtain();
4404 Parcel reply = Parcel.obtain();
4405 data.writeInterfaceToken(IActivityManager.descriptor);
4406 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4407 reply.readException();
4408 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4409 reply.recycle();
4410 data.recycle();
4411 return res;
4412 }
4413 public void updateConfiguration(Configuration values) throws RemoteException
4414 {
4415 Parcel data = Parcel.obtain();
4416 Parcel reply = Parcel.obtain();
4417 data.writeInterfaceToken(IActivityManager.descriptor);
4418 values.writeToParcel(data, 0);
4419 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4420 reply.readException();
4421 data.recycle();
4422 reply.recycle();
4423 }
4424 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4425 throws RemoteException {
4426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 data.writeStrongBinder(token);
4430 data.writeInt(requestedOrientation);
4431 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4432 reply.readException();
4433 data.recycle();
4434 reply.recycle();
4435 }
4436 public int getRequestedOrientation(IBinder token) throws RemoteException {
4437 Parcel data = Parcel.obtain();
4438 Parcel reply = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 data.writeStrongBinder(token);
4441 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4442 reply.readException();
4443 int res = reply.readInt();
4444 data.recycle();
4445 reply.recycle();
4446 return res;
4447 }
4448 public ComponentName getActivityClassForToken(IBinder token)
4449 throws RemoteException {
4450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 data.writeStrongBinder(token);
4454 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4455 reply.readException();
4456 ComponentName res = ComponentName.readFromParcel(reply);
4457 data.recycle();
4458 reply.recycle();
4459 return res;
4460 }
4461 public String getPackageForToken(IBinder token) throws RemoteException
4462 {
4463 Parcel data = Parcel.obtain();
4464 Parcel reply = Parcel.obtain();
4465 data.writeInterfaceToken(IActivityManager.descriptor);
4466 data.writeStrongBinder(token);
4467 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4468 reply.readException();
4469 String res = reply.readString();
4470 data.recycle();
4471 reply.recycle();
4472 return res;
4473 }
4474 public IIntentSender getIntentSender(int type,
4475 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004476 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004477 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004478 Parcel data = Parcel.obtain();
4479 Parcel reply = Parcel.obtain();
4480 data.writeInterfaceToken(IActivityManager.descriptor);
4481 data.writeInt(type);
4482 data.writeString(packageName);
4483 data.writeStrongBinder(token);
4484 data.writeString(resultWho);
4485 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004486 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004487 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004488 data.writeTypedArray(intents, 0);
4489 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004490 } else {
4491 data.writeInt(0);
4492 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004493 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004494 if (options != null) {
4495 data.writeInt(1);
4496 options.writeToParcel(data, 0);
4497 } else {
4498 data.writeInt(0);
4499 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004500 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004501 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4502 reply.readException();
4503 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004504 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004505 data.recycle();
4506 reply.recycle();
4507 return res;
4508 }
4509 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4510 Parcel data = Parcel.obtain();
4511 Parcel reply = Parcel.obtain();
4512 data.writeInterfaceToken(IActivityManager.descriptor);
4513 data.writeStrongBinder(sender.asBinder());
4514 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4515 reply.readException();
4516 data.recycle();
4517 reply.recycle();
4518 }
4519 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4520 Parcel data = Parcel.obtain();
4521 Parcel reply = Parcel.obtain();
4522 data.writeInterfaceToken(IActivityManager.descriptor);
4523 data.writeStrongBinder(sender.asBinder());
4524 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4525 reply.readException();
4526 String res = reply.readString();
4527 data.recycle();
4528 reply.recycle();
4529 return res;
4530 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004531 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4532 Parcel data = Parcel.obtain();
4533 Parcel reply = Parcel.obtain();
4534 data.writeInterfaceToken(IActivityManager.descriptor);
4535 data.writeStrongBinder(sender.asBinder());
4536 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4537 reply.readException();
4538 int res = reply.readInt();
4539 data.recycle();
4540 reply.recycle();
4541 return res;
4542 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004543 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4544 boolean requireFull, String name, String callerPackage) throws RemoteException {
4545 Parcel data = Parcel.obtain();
4546 Parcel reply = Parcel.obtain();
4547 data.writeInterfaceToken(IActivityManager.descriptor);
4548 data.writeInt(callingPid);
4549 data.writeInt(callingUid);
4550 data.writeInt(userId);
4551 data.writeInt(allowAll ? 1 : 0);
4552 data.writeInt(requireFull ? 1 : 0);
4553 data.writeString(name);
4554 data.writeString(callerPackage);
4555 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4556 reply.readException();
4557 int res = reply.readInt();
4558 data.recycle();
4559 reply.recycle();
4560 return res;
4561 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004562 public void setProcessLimit(int max) throws RemoteException
4563 {
4564 Parcel data = Parcel.obtain();
4565 Parcel reply = Parcel.obtain();
4566 data.writeInterfaceToken(IActivityManager.descriptor);
4567 data.writeInt(max);
4568 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4569 reply.readException();
4570 data.recycle();
4571 reply.recycle();
4572 }
4573 public int getProcessLimit() throws RemoteException
4574 {
4575 Parcel data = Parcel.obtain();
4576 Parcel reply = Parcel.obtain();
4577 data.writeInterfaceToken(IActivityManager.descriptor);
4578 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4579 reply.readException();
4580 int res = reply.readInt();
4581 data.recycle();
4582 reply.recycle();
4583 return res;
4584 }
4585 public void setProcessForeground(IBinder token, int pid,
4586 boolean isForeground) throws RemoteException {
4587 Parcel data = Parcel.obtain();
4588 Parcel reply = Parcel.obtain();
4589 data.writeInterfaceToken(IActivityManager.descriptor);
4590 data.writeStrongBinder(token);
4591 data.writeInt(pid);
4592 data.writeInt(isForeground ? 1 : 0);
4593 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4594 reply.readException();
4595 data.recycle();
4596 reply.recycle();
4597 }
4598 public int checkPermission(String permission, int pid, int uid)
4599 throws RemoteException {
4600 Parcel data = Parcel.obtain();
4601 Parcel reply = Parcel.obtain();
4602 data.writeInterfaceToken(IActivityManager.descriptor);
4603 data.writeString(permission);
4604 data.writeInt(pid);
4605 data.writeInt(uid);
4606 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4607 reply.readException();
4608 int res = reply.readInt();
4609 data.recycle();
4610 reply.recycle();
4611 return res;
4612 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004613 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4614 throws RemoteException {
4615 Parcel data = Parcel.obtain();
4616 Parcel reply = Parcel.obtain();
4617 data.writeInterfaceToken(IActivityManager.descriptor);
4618 data.writeString(permission);
4619 data.writeInt(pid);
4620 data.writeInt(uid);
4621 data.writeStrongBinder(callerToken);
4622 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4623 reply.readException();
4624 int res = reply.readInt();
4625 data.recycle();
4626 reply.recycle();
4627 return res;
4628 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004629 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004630 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004631 Parcel data = Parcel.obtain();
4632 Parcel reply = Parcel.obtain();
4633 data.writeInterfaceToken(IActivityManager.descriptor);
4634 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004635 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004636 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004637 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4638 reply.readException();
4639 boolean res = reply.readInt() != 0;
4640 data.recycle();
4641 reply.recycle();
4642 return res;
4643 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004644 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4645 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004646 Parcel data = Parcel.obtain();
4647 Parcel reply = Parcel.obtain();
4648 data.writeInterfaceToken(IActivityManager.descriptor);
4649 uri.writeToParcel(data, 0);
4650 data.writeInt(pid);
4651 data.writeInt(uid);
4652 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004653 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004654 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004655 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4656 reply.readException();
4657 int res = reply.readInt();
4658 data.recycle();
4659 reply.recycle();
4660 return res;
4661 }
4662 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004663 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004664 Parcel data = Parcel.obtain();
4665 Parcel reply = Parcel.obtain();
4666 data.writeInterfaceToken(IActivityManager.descriptor);
4667 data.writeStrongBinder(caller.asBinder());
4668 data.writeString(targetPkg);
4669 uri.writeToParcel(data, 0);
4670 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004671 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004672 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4673 reply.readException();
4674 data.recycle();
4675 reply.recycle();
4676 }
4677 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004678 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004679 Parcel data = Parcel.obtain();
4680 Parcel reply = Parcel.obtain();
4681 data.writeInterfaceToken(IActivityManager.descriptor);
4682 data.writeStrongBinder(caller.asBinder());
4683 uri.writeToParcel(data, 0);
4684 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004685 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004686 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4687 reply.readException();
4688 data.recycle();
4689 reply.recycle();
4690 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004691
4692 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004693 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4694 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004695 Parcel data = Parcel.obtain();
4696 Parcel reply = Parcel.obtain();
4697 data.writeInterfaceToken(IActivityManager.descriptor);
4698 uri.writeToParcel(data, 0);
4699 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004700 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004701 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4702 reply.readException();
4703 data.recycle();
4704 reply.recycle();
4705 }
4706
4707 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004708 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4709 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004710 Parcel data = Parcel.obtain();
4711 Parcel reply = Parcel.obtain();
4712 data.writeInterfaceToken(IActivityManager.descriptor);
4713 uri.writeToParcel(data, 0);
4714 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004715 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004716 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4717 reply.readException();
4718 data.recycle();
4719 reply.recycle();
4720 }
4721
4722 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004723 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4724 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004725 Parcel data = Parcel.obtain();
4726 Parcel reply = Parcel.obtain();
4727 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004728 data.writeString(packageName);
4729 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004730 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4731 reply.readException();
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004732 @SuppressWarnings("unchecked")
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004733 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4734 reply);
4735 data.recycle();
4736 reply.recycle();
4737 return perms;
4738 }
4739
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004740 @Override
4741 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId)
4742 throws RemoteException {
4743 Parcel data = Parcel.obtain();
4744 Parcel reply = Parcel.obtain();
4745 data.writeInterfaceToken(IActivityManager.descriptor);
4746 data.writeString(packageName);
4747 data.writeInt(userId);
4748 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4749 reply.readException();
4750 @SuppressWarnings("unchecked")
4751 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4752 reply);
4753 data.recycle();
4754 reply.recycle();
4755 return perms;
4756 }
4757
4758 @Override
4759 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException {
4760 Parcel data = Parcel.obtain();
4761 Parcel reply = Parcel.obtain();
4762 data.writeInterfaceToken(IActivityManager.descriptor);
4763 data.writeString(packageName);
4764 data.writeInt(userId);
4765 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4766 reply.readException();
4767 data.recycle();
4768 reply.recycle();
4769 }
4770
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004771 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4772 throws RemoteException {
4773 Parcel data = Parcel.obtain();
4774 Parcel reply = Parcel.obtain();
4775 data.writeInterfaceToken(IActivityManager.descriptor);
4776 data.writeStrongBinder(who.asBinder());
4777 data.writeInt(waiting ? 1 : 0);
4778 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4779 reply.readException();
4780 data.recycle();
4781 reply.recycle();
4782 }
4783 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4784 Parcel data = Parcel.obtain();
4785 Parcel reply = Parcel.obtain();
4786 data.writeInterfaceToken(IActivityManager.descriptor);
4787 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4788 reply.readException();
4789 outInfo.readFromParcel(reply);
4790 data.recycle();
4791 reply.recycle();
4792 }
4793 public void unhandledBack() throws RemoteException
4794 {
4795 Parcel data = Parcel.obtain();
4796 Parcel reply = Parcel.obtain();
4797 data.writeInterfaceToken(IActivityManager.descriptor);
4798 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4799 reply.readException();
4800 data.recycle();
4801 reply.recycle();
4802 }
4803 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4804 {
4805 Parcel data = Parcel.obtain();
4806 Parcel reply = Parcel.obtain();
4807 data.writeInterfaceToken(IActivityManager.descriptor);
4808 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4809 reply.readException();
4810 ParcelFileDescriptor pfd = null;
4811 if (reply.readInt() != 0) {
4812 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4813 }
4814 data.recycle();
4815 reply.recycle();
4816 return pfd;
4817 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004818 public void setLockScreenShown(boolean shown) throws RemoteException
4819 {
4820 Parcel data = Parcel.obtain();
4821 Parcel reply = Parcel.obtain();
4822 data.writeInterfaceToken(IActivityManager.descriptor);
4823 data.writeInt(shown ? 1 : 0);
4824 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4825 reply.readException();
4826 data.recycle();
4827 reply.recycle();
4828 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004829 public void setDebugApp(
4830 String packageName, boolean waitForDebugger, boolean persistent)
4831 throws RemoteException
4832 {
4833 Parcel data = Parcel.obtain();
4834 Parcel reply = Parcel.obtain();
4835 data.writeInterfaceToken(IActivityManager.descriptor);
4836 data.writeString(packageName);
4837 data.writeInt(waitForDebugger ? 1 : 0);
4838 data.writeInt(persistent ? 1 : 0);
4839 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4840 reply.readException();
4841 data.recycle();
4842 reply.recycle();
4843 }
4844 public void setAlwaysFinish(boolean enabled) throws RemoteException
4845 {
4846 Parcel data = Parcel.obtain();
4847 Parcel reply = Parcel.obtain();
4848 data.writeInterfaceToken(IActivityManager.descriptor);
4849 data.writeInt(enabled ? 1 : 0);
4850 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4851 reply.readException();
4852 data.recycle();
4853 reply.recycle();
4854 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004855 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004856 {
4857 Parcel data = Parcel.obtain();
4858 Parcel reply = Parcel.obtain();
4859 data.writeInterfaceToken(IActivityManager.descriptor);
4860 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004861 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004862 reply.readException();
4863 data.recycle();
4864 reply.recycle();
4865 }
Dianne Hackbornb2117d12016-02-16 18:26:35 -08004866 public void setLenientBackgroundCheck(boolean enabled) throws RemoteException
4867 {
4868 Parcel data = Parcel.obtain();
4869 Parcel reply = Parcel.obtain();
4870 data.writeInterfaceToken(IActivityManager.descriptor);
4871 data.writeInt(enabled ? 1 : 0);
4872 mRemote.transact(SET_LENIENT_BACKGROUND_CHECK_TRANSACTION, data, reply, 0);
4873 reply.readException();
4874 data.recycle();
4875 reply.recycle();
4876 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004877 public void enterSafeMode() throws RemoteException {
4878 Parcel data = Parcel.obtain();
4879 data.writeInterfaceToken(IActivityManager.descriptor);
4880 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4881 data.recycle();
4882 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004883 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004884 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004885 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004886 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004887 data.writeStrongBinder(sender.asBinder());
4888 data.writeInt(sourceUid);
4889 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004890 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004891 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4892 data.recycle();
4893 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004894 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4895 throws RemoteException {
4896 Parcel data = Parcel.obtain();
4897 data.writeInterfaceToken(IActivityManager.descriptor);
4898 data.writeStrongBinder(sender.asBinder());
4899 data.writeInt(sourceUid);
4900 data.writeString(tag);
4901 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4902 data.recycle();
4903 }
4904 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4905 throws RemoteException {
4906 Parcel data = Parcel.obtain();
4907 data.writeInterfaceToken(IActivityManager.descriptor);
4908 data.writeStrongBinder(sender.asBinder());
4909 data.writeInt(sourceUid);
4910 data.writeString(tag);
4911 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4912 data.recycle();
4913 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004914 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004915 Parcel data = Parcel.obtain();
4916 Parcel reply = Parcel.obtain();
4917 data.writeInterfaceToken(IActivityManager.descriptor);
4918 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004919 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004920 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004921 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004922 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004923 boolean res = reply.readInt() != 0;
4924 data.recycle();
4925 reply.recycle();
4926 return res;
4927 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004928 @Override
4929 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4930 Parcel data = Parcel.obtain();
4931 Parcel reply = Parcel.obtain();
4932 data.writeInterfaceToken(IActivityManager.descriptor);
4933 data.writeString(reason);
4934 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4935 boolean res = reply.readInt() != 0;
4936 data.recycle();
4937 reply.recycle();
4938 return res;
4939 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004940 public boolean testIsSystemReady()
4941 {
4942 /* this base class version is never called */
4943 return true;
4944 }
Dan Egnor60d87622009-12-16 16:32:58 -08004945 public void handleApplicationCrash(IBinder app,
4946 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4947 {
4948 Parcel data = Parcel.obtain();
4949 Parcel reply = Parcel.obtain();
4950 data.writeInterfaceToken(IActivityManager.descriptor);
4951 data.writeStrongBinder(app);
4952 crashInfo.writeToParcel(data, 0);
4953 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4954 reply.readException();
4955 reply.recycle();
4956 data.recycle();
4957 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004958
Dianne Hackborn52322712014-08-26 22:47:26 -07004959 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004960 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004961 {
4962 Parcel data = Parcel.obtain();
4963 Parcel reply = Parcel.obtain();
4964 data.writeInterfaceToken(IActivityManager.descriptor);
4965 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004966 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004967 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004968 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004969 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004970 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004971 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004972 reply.recycle();
4973 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004974 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004975 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004976
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004977 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004978 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004979 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004980 {
4981 Parcel data = Parcel.obtain();
4982 Parcel reply = Parcel.obtain();
4983 data.writeInterfaceToken(IActivityManager.descriptor);
4984 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004985 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004986 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004987 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4988 reply.readException();
4989 reply.recycle();
4990 data.recycle();
4991 }
4992
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004993 public void signalPersistentProcesses(int sig) throws RemoteException {
4994 Parcel data = Parcel.obtain();
4995 Parcel reply = Parcel.obtain();
4996 data.writeInterfaceToken(IActivityManager.descriptor);
4997 data.writeInt(sig);
4998 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4999 reply.readException();
5000 data.recycle();
5001 reply.recycle();
5002 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005003
Dianne Hackborn1676c852012-09-10 14:52:30 -07005004 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005005 Parcel data = Parcel.obtain();
5006 Parcel reply = Parcel.obtain();
5007 data.writeInterfaceToken(IActivityManager.descriptor);
5008 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005009 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005010 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5011 reply.readException();
5012 data.recycle();
5013 reply.recycle();
5014 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005015
5016 public void killAllBackgroundProcesses() throws RemoteException {
5017 Parcel data = Parcel.obtain();
5018 Parcel reply = Parcel.obtain();
5019 data.writeInterfaceToken(IActivityManager.descriptor);
5020 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5021 reply.readException();
5022 data.recycle();
5023 reply.recycle();
5024 }
5025
Gustav Sennton6258dcd2015-10-30 19:25:37 +00005026 public void killPackageDependents(String packageName, int userId) throws RemoteException {
5027 Parcel data = Parcel.obtain();
5028 Parcel reply = Parcel.obtain();
5029 data.writeInterfaceToken(IActivityManager.descriptor);
5030 data.writeString(packageName);
5031 data.writeInt(userId);
5032 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
5033 reply.readException();
5034 data.recycle();
5035 reply.recycle();
5036 }
5037
Dianne Hackborn1676c852012-09-10 14:52:30 -07005038 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08005039 Parcel data = Parcel.obtain();
5040 Parcel reply = Parcel.obtain();
5041 data.writeInterfaceToken(IActivityManager.descriptor);
5042 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005043 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005044 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005045 reply.readException();
5046 data.recycle();
5047 reply.recycle();
5048 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005049
Dianne Hackborn27ff9132012-03-06 14:57:58 -08005050 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
5051 throws RemoteException
5052 {
5053 Parcel data = Parcel.obtain();
5054 Parcel reply = Parcel.obtain();
5055 data.writeInterfaceToken(IActivityManager.descriptor);
5056 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
5057 reply.readException();
5058 outInfo.readFromParcel(reply);
5059 reply.recycle();
5060 data.recycle();
5061 }
5062
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005063 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
5064 {
5065 Parcel data = Parcel.obtain();
5066 Parcel reply = Parcel.obtain();
5067 data.writeInterfaceToken(IActivityManager.descriptor);
5068 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
5069 reply.readException();
5070 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
5071 reply.recycle();
5072 data.recycle();
5073 return res;
5074 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005075
Dianne Hackborn1676c852012-09-10 14:52:30 -07005076 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07005077 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005078 {
5079 Parcel data = Parcel.obtain();
5080 Parcel reply = Parcel.obtain();
5081 data.writeInterfaceToken(IActivityManager.descriptor);
5082 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005083 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005084 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07005085 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07005086 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005087 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07005088 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005089 } else {
5090 data.writeInt(0);
5091 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005092 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
5093 reply.readException();
5094 boolean res = reply.readInt() != 0;
5095 reply.recycle();
5096 data.recycle();
5097 return res;
5098 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005099
Dianne Hackborn55280a92009-05-07 15:53:46 -07005100 public boolean shutdown(int timeout) throws RemoteException
5101 {
5102 Parcel data = Parcel.obtain();
5103 Parcel reply = Parcel.obtain();
5104 data.writeInterfaceToken(IActivityManager.descriptor);
5105 data.writeInt(timeout);
5106 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
5107 reply.readException();
5108 boolean res = reply.readInt() != 0;
5109 reply.recycle();
5110 data.recycle();
5111 return res;
5112 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005113
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005114 public void stopAppSwitches() throws RemoteException {
5115 Parcel data = Parcel.obtain();
5116 Parcel reply = Parcel.obtain();
5117 data.writeInterfaceToken(IActivityManager.descriptor);
5118 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
5119 reply.readException();
5120 reply.recycle();
5121 data.recycle();
5122 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005123
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005124 public void resumeAppSwitches() throws RemoteException {
5125 Parcel data = Parcel.obtain();
5126 Parcel reply = Parcel.obtain();
5127 data.writeInterfaceToken(IActivityManager.descriptor);
5128 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
5129 reply.readException();
5130 reply.recycle();
5131 data.recycle();
5132 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07005133
5134 public void addPackageDependency(String packageName) throws RemoteException {
5135 Parcel data = Parcel.obtain();
5136 Parcel reply = Parcel.obtain();
5137 data.writeInterfaceToken(IActivityManager.descriptor);
5138 data.writeString(packageName);
5139 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
5140 reply.readException();
5141 data.recycle();
5142 reply.recycle();
5143 }
5144
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005145 public void killApplicationWithAppId(String pkg, int appid, String reason)
5146 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005147 Parcel data = Parcel.obtain();
5148 Parcel reply = Parcel.obtain();
5149 data.writeInterfaceToken(IActivityManager.descriptor);
5150 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005151 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005152 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005153 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005154 reply.readException();
5155 data.recycle();
5156 reply.recycle();
5157 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005158
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07005159 public void closeSystemDialogs(String reason) throws RemoteException {
5160 Parcel data = Parcel.obtain();
5161 Parcel reply = Parcel.obtain();
5162 data.writeInterfaceToken(IActivityManager.descriptor);
5163 data.writeString(reason);
5164 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5165 reply.readException();
5166 data.recycle();
5167 reply.recycle();
5168 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005169
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005170 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005171 throws RemoteException {
5172 Parcel data = Parcel.obtain();
5173 Parcel reply = Parcel.obtain();
5174 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005175 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005176 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5177 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005178 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005179 data.recycle();
5180 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005181 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005182 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005183
5184 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5185 Parcel data = Parcel.obtain();
5186 Parcel reply = Parcel.obtain();
5187 data.writeInterfaceToken(IActivityManager.descriptor);
5188 data.writeString(processName);
5189 data.writeInt(uid);
5190 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5191 reply.readException();
5192 data.recycle();
5193 reply.recycle();
5194 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005195
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005196 public void overridePendingTransition(IBinder token, String packageName,
5197 int enterAnim, int exitAnim) throws RemoteException {
5198 Parcel data = Parcel.obtain();
5199 Parcel reply = Parcel.obtain();
5200 data.writeInterfaceToken(IActivityManager.descriptor);
5201 data.writeStrongBinder(token);
5202 data.writeString(packageName);
5203 data.writeInt(enterAnim);
5204 data.writeInt(exitAnim);
5205 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5206 reply.readException();
5207 data.recycle();
5208 reply.recycle();
5209 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005210
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005211 public boolean isUserAMonkey() throws RemoteException {
5212 Parcel data = Parcel.obtain();
5213 Parcel reply = Parcel.obtain();
5214 data.writeInterfaceToken(IActivityManager.descriptor);
5215 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5216 reply.readException();
5217 boolean res = reply.readInt() != 0;
5218 data.recycle();
5219 reply.recycle();
5220 return res;
5221 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005222
5223 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5224 Parcel data = Parcel.obtain();
5225 Parcel reply = Parcel.obtain();
5226 data.writeInterfaceToken(IActivityManager.descriptor);
5227 data.writeInt(monkey ? 1 : 0);
5228 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5229 reply.readException();
5230 data.recycle();
5231 reply.recycle();
5232 }
5233
Dianne Hackborn860755f2010-06-03 18:47:52 -07005234 public void finishHeavyWeightApp() throws RemoteException {
5235 Parcel data = Parcel.obtain();
5236 Parcel reply = Parcel.obtain();
5237 data.writeInterfaceToken(IActivityManager.descriptor);
5238 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5239 reply.readException();
5240 data.recycle();
5241 reply.recycle();
5242 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005243
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005244 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005245 throws RemoteException {
5246 Parcel data = Parcel.obtain();
5247 Parcel reply = Parcel.obtain();
5248 data.writeInterfaceToken(IActivityManager.descriptor);
5249 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005250 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5251 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005252 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005253 data.recycle();
5254 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005255 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005256 }
5257
Craig Mautner233ceee2014-05-09 17:05:11 -07005258 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005259 throws RemoteException {
5260 Parcel data = Parcel.obtain();
5261 Parcel reply = Parcel.obtain();
5262 data.writeInterfaceToken(IActivityManager.descriptor);
5263 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005264 if (options == null) {
5265 data.writeInt(0);
5266 } else {
5267 data.writeInt(1);
5268 data.writeBundle(options.toBundle());
5269 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005270 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005271 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005272 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005273 data.recycle();
5274 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005275 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005276 }
5277
Craig Mautner233ceee2014-05-09 17:05:11 -07005278 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5279 Parcel data = Parcel.obtain();
5280 Parcel reply = Parcel.obtain();
5281 data.writeInterfaceToken(IActivityManager.descriptor);
5282 data.writeStrongBinder(token);
5283 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5284 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005285 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005286 data.recycle();
5287 reply.recycle();
5288 return options;
5289 }
5290
Daniel Sandler69a48172010-06-23 16:29:36 -04005291 public void setImmersive(IBinder token, boolean immersive)
5292 throws RemoteException {
5293 Parcel data = Parcel.obtain();
5294 Parcel reply = Parcel.obtain();
5295 data.writeInterfaceToken(IActivityManager.descriptor);
5296 data.writeStrongBinder(token);
5297 data.writeInt(immersive ? 1 : 0);
5298 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5299 reply.readException();
5300 data.recycle();
5301 reply.recycle();
5302 }
5303
5304 public boolean isImmersive(IBinder token)
5305 throws RemoteException {
5306 Parcel data = Parcel.obtain();
5307 Parcel reply = Parcel.obtain();
5308 data.writeInterfaceToken(IActivityManager.descriptor);
5309 data.writeStrongBinder(token);
5310 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005311 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005312 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005313 data.recycle();
5314 reply.recycle();
5315 return res;
5316 }
5317
Craig Mautnerd61dc202014-07-07 11:09:11 -07005318 public boolean isTopOfTask(IBinder token) throws RemoteException {
5319 Parcel data = Parcel.obtain();
5320 Parcel reply = Parcel.obtain();
5321 data.writeInterfaceToken(IActivityManager.descriptor);
5322 data.writeStrongBinder(token);
5323 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5324 reply.readException();
5325 boolean res = reply.readInt() == 1;
5326 data.recycle();
5327 reply.recycle();
5328 return res;
5329 }
5330
Daniel Sandler69a48172010-06-23 16:29:36 -04005331 public boolean isTopActivityImmersive()
5332 throws RemoteException {
5333 Parcel data = Parcel.obtain();
5334 Parcel reply = Parcel.obtain();
5335 data.writeInterfaceToken(IActivityManager.descriptor);
5336 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005337 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005338 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005339 data.recycle();
5340 reply.recycle();
5341 return res;
5342 }
5343
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005344 public void crashApplication(int uid, int initialPid, String packageName,
5345 String message) throws RemoteException {
5346 Parcel data = Parcel.obtain();
5347 Parcel reply = Parcel.obtain();
5348 data.writeInterfaceToken(IActivityManager.descriptor);
5349 data.writeInt(uid);
5350 data.writeInt(initialPid);
5351 data.writeString(packageName);
5352 data.writeString(message);
5353 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5354 reply.readException();
5355 data.recycle();
5356 reply.recycle();
5357 }
Andy McFadden824c5102010-07-09 16:26:57 -07005358
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005359 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005360 Parcel data = Parcel.obtain();
5361 Parcel reply = Parcel.obtain();
5362 data.writeInterfaceToken(IActivityManager.descriptor);
5363 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005364 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005365 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5366 reply.readException();
5367 String res = reply.readString();
5368 data.recycle();
5369 reply.recycle();
5370 return res;
5371 }
5372
Dianne Hackborn7e269642010-08-25 19:50:20 -07005373 public IBinder newUriPermissionOwner(String name)
5374 throws RemoteException {
5375 Parcel data = Parcel.obtain();
5376 Parcel reply = Parcel.obtain();
5377 data.writeInterfaceToken(IActivityManager.descriptor);
5378 data.writeString(name);
5379 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5380 reply.readException();
5381 IBinder res = reply.readStrongBinder();
5382 data.recycle();
5383 reply.recycle();
5384 return res;
5385 }
5386
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005387 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5388 Parcel data = Parcel.obtain();
5389 Parcel reply = Parcel.obtain();
5390 data.writeInterfaceToken(IActivityManager.descriptor);
5391 data.writeStrongBinder(activityToken);
5392 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5393 reply.readException();
5394 IBinder res = reply.readStrongBinder();
5395 data.recycle();
5396 reply.recycle();
5397 return res;
5398 }
5399
Dianne Hackborn7e269642010-08-25 19:50:20 -07005400 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005401 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005402 Parcel data = Parcel.obtain();
5403 Parcel reply = Parcel.obtain();
5404 data.writeInterfaceToken(IActivityManager.descriptor);
5405 data.writeStrongBinder(owner);
5406 data.writeInt(fromUid);
5407 data.writeString(targetPkg);
5408 uri.writeToParcel(data, 0);
5409 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005410 data.writeInt(sourceUserId);
5411 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005412 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5413 reply.readException();
5414 data.recycle();
5415 reply.recycle();
5416 }
5417
5418 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005419 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005420 Parcel data = Parcel.obtain();
5421 Parcel reply = Parcel.obtain();
5422 data.writeInterfaceToken(IActivityManager.descriptor);
5423 data.writeStrongBinder(owner);
5424 if (uri != null) {
5425 data.writeInt(1);
5426 uri.writeToParcel(data, 0);
5427 } else {
5428 data.writeInt(0);
5429 }
5430 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005431 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005432 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5433 reply.readException();
5434 data.recycle();
5435 reply.recycle();
5436 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005437
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005438 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005439 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005440 Parcel data = Parcel.obtain();
5441 Parcel reply = Parcel.obtain();
5442 data.writeInterfaceToken(IActivityManager.descriptor);
5443 data.writeInt(callingUid);
5444 data.writeString(targetPkg);
5445 uri.writeToParcel(data, 0);
5446 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005447 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005448 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5449 reply.readException();
5450 int res = reply.readInt();
5451 data.recycle();
5452 reply.recycle();
5453 return res;
5454 }
5455
Dianne Hackborn1676c852012-09-10 14:52:30 -07005456 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005457 String path, ParcelFileDescriptor fd) throws RemoteException {
5458 Parcel data = Parcel.obtain();
5459 Parcel reply = Parcel.obtain();
5460 data.writeInterfaceToken(IActivityManager.descriptor);
5461 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005462 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005463 data.writeInt(managed ? 1 : 0);
5464 data.writeString(path);
5465 if (fd != null) {
5466 data.writeInt(1);
5467 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5468 } else {
5469 data.writeInt(0);
5470 }
5471 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5472 reply.readException();
5473 boolean res = reply.readInt() != 0;
5474 reply.recycle();
5475 data.recycle();
5476 return res;
5477 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005478
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005479 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005480 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005481 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005482 Parcel data = Parcel.obtain();
5483 Parcel reply = Parcel.obtain();
5484 data.writeInterfaceToken(IActivityManager.descriptor);
5485 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005486 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005487 data.writeTypedArray(intents, 0);
5488 data.writeStringArray(resolvedTypes);
5489 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005490 if (options != null) {
5491 data.writeInt(1);
5492 options.writeToParcel(data, 0);
5493 } else {
5494 data.writeInt(0);
5495 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005496 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005497 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5498 reply.readException();
5499 int result = reply.readInt();
5500 reply.recycle();
5501 data.recycle();
5502 return result;
5503 }
5504
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005505 public int getFrontActivityScreenCompatMode() throws RemoteException {
5506 Parcel data = Parcel.obtain();
5507 Parcel reply = Parcel.obtain();
5508 data.writeInterfaceToken(IActivityManager.descriptor);
5509 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5510 reply.readException();
5511 int mode = reply.readInt();
5512 reply.recycle();
5513 data.recycle();
5514 return mode;
5515 }
5516
5517 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5518 Parcel data = Parcel.obtain();
5519 Parcel reply = Parcel.obtain();
5520 data.writeInterfaceToken(IActivityManager.descriptor);
5521 data.writeInt(mode);
5522 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5523 reply.readException();
5524 reply.recycle();
5525 data.recycle();
5526 }
5527
5528 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5529 Parcel data = Parcel.obtain();
5530 Parcel reply = Parcel.obtain();
5531 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005532 data.writeString(packageName);
5533 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005534 reply.readException();
5535 int mode = reply.readInt();
5536 reply.recycle();
5537 data.recycle();
5538 return mode;
5539 }
5540
5541 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005542 throws RemoteException {
5543 Parcel data = Parcel.obtain();
5544 Parcel reply = Parcel.obtain();
5545 data.writeInterfaceToken(IActivityManager.descriptor);
5546 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005547 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005548 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5549 reply.readException();
5550 reply.recycle();
5551 data.recycle();
5552 }
5553
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005554 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5555 Parcel data = Parcel.obtain();
5556 Parcel reply = Parcel.obtain();
5557 data.writeInterfaceToken(IActivityManager.descriptor);
5558 data.writeString(packageName);
5559 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5560 reply.readException();
5561 boolean ask = reply.readInt() != 0;
5562 reply.recycle();
5563 data.recycle();
5564 return ask;
5565 }
5566
5567 public void setPackageAskScreenCompat(String packageName, boolean ask)
5568 throws RemoteException {
5569 Parcel data = Parcel.obtain();
5570 Parcel reply = Parcel.obtain();
5571 data.writeInterfaceToken(IActivityManager.descriptor);
5572 data.writeString(packageName);
5573 data.writeInt(ask ? 1 : 0);
5574 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5575 reply.readException();
5576 reply.recycle();
5577 data.recycle();
5578 }
5579
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005580 public boolean switchUser(int userid) throws RemoteException {
5581 Parcel data = Parcel.obtain();
5582 Parcel reply = Parcel.obtain();
5583 data.writeInterfaceToken(IActivityManager.descriptor);
5584 data.writeInt(userid);
5585 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5586 reply.readException();
5587 boolean result = reply.readInt() != 0;
5588 reply.recycle();
5589 data.recycle();
5590 return result;
5591 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005592
Kenny Guy08488bf2014-02-21 17:40:37 +00005593 public boolean startUserInBackground(int userid) throws RemoteException {
5594 Parcel data = Parcel.obtain();
5595 Parcel reply = Parcel.obtain();
5596 data.writeInterfaceToken(IActivityManager.descriptor);
5597 data.writeInt(userid);
5598 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5599 reply.readException();
5600 boolean result = reply.readInt() != 0;
5601 reply.recycle();
5602 data.recycle();
5603 return result;
5604 }
5605
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005606 public boolean unlockUser(int userId, byte[] token, byte[] secret) throws RemoteException {
Jeff Sharkeyba512352015-11-12 20:17:45 -08005607 Parcel data = Parcel.obtain();
5608 Parcel reply = Parcel.obtain();
5609 data.writeInterfaceToken(IActivityManager.descriptor);
5610 data.writeInt(userId);
5611 data.writeByteArray(token);
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005612 data.writeByteArray(secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08005613 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5614 reply.readException();
5615 boolean result = reply.readInt() != 0;
5616 reply.recycle();
5617 data.recycle();
5618 return result;
5619 }
5620
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005621 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5622 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005623 Parcel data = Parcel.obtain();
5624 Parcel reply = Parcel.obtain();
5625 data.writeInterfaceToken(IActivityManager.descriptor);
5626 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005627 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005628 data.writeStrongInterface(callback);
5629 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5630 reply.readException();
5631 int result = reply.readInt();
5632 reply.recycle();
5633 data.recycle();
5634 return result;
5635 }
5636
Amith Yamasani52f1d752012-03-28 18:19:29 -07005637 public UserInfo getCurrentUser() throws RemoteException {
5638 Parcel data = Parcel.obtain();
5639 Parcel reply = Parcel.obtain();
5640 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005641 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005642 reply.readException();
5643 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5644 reply.recycle();
5645 data.recycle();
5646 return userInfo;
5647 }
5648
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005649 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005650 Parcel data = Parcel.obtain();
5651 Parcel reply = Parcel.obtain();
5652 data.writeInterfaceToken(IActivityManager.descriptor);
5653 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005654 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005655 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5656 reply.readException();
5657 boolean result = reply.readInt() != 0;
5658 reply.recycle();
5659 data.recycle();
5660 return result;
5661 }
5662
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005663 public int[] getRunningUserIds() throws RemoteException {
5664 Parcel data = Parcel.obtain();
5665 Parcel reply = Parcel.obtain();
5666 data.writeInterfaceToken(IActivityManager.descriptor);
5667 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5668 reply.readException();
5669 int[] result = reply.createIntArray();
5670 reply.recycle();
5671 data.recycle();
5672 return result;
5673 }
5674
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005675 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005676 Parcel data = Parcel.obtain();
5677 Parcel reply = Parcel.obtain();
5678 data.writeInterfaceToken(IActivityManager.descriptor);
5679 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005680 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5681 reply.readException();
5682 boolean result = reply.readInt() != 0;
5683 reply.recycle();
5684 data.recycle();
5685 return result;
5686 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005687
Jeff Sharkeya4620792011-05-20 15:29:23 -07005688 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5689 Parcel data = Parcel.obtain();
5690 Parcel reply = Parcel.obtain();
5691 data.writeInterfaceToken(IActivityManager.descriptor);
5692 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5693 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5694 reply.readException();
5695 data.recycle();
5696 reply.recycle();
5697 }
5698
5699 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5700 Parcel data = Parcel.obtain();
5701 Parcel reply = Parcel.obtain();
5702 data.writeInterfaceToken(IActivityManager.descriptor);
5703 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5704 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5705 reply.readException();
5706 data.recycle();
5707 reply.recycle();
5708 }
5709
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005710 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005711 Parcel data = Parcel.obtain();
5712 Parcel reply = Parcel.obtain();
5713 data.writeInterfaceToken(IActivityManager.descriptor);
5714 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005715 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005716 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5717 reply.readException();
5718 data.recycle();
5719 reply.recycle();
5720 }
5721
5722 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5723 Parcel data = Parcel.obtain();
5724 Parcel reply = Parcel.obtain();
5725 data.writeInterfaceToken(IActivityManager.descriptor);
5726 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5727 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5728 reply.readException();
5729 data.recycle();
5730 reply.recycle();
5731 }
5732
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005733 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5734 Parcel data = Parcel.obtain();
5735 Parcel reply = Parcel.obtain();
5736 data.writeInterfaceToken(IActivityManager.descriptor);
5737 data.writeStrongBinder(sender.asBinder());
5738 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5739 reply.readException();
5740 boolean res = reply.readInt() != 0;
5741 data.recycle();
5742 reply.recycle();
5743 return res;
5744 }
5745
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005746 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5747 Parcel data = Parcel.obtain();
5748 Parcel reply = Parcel.obtain();
5749 data.writeInterfaceToken(IActivityManager.descriptor);
5750 data.writeStrongBinder(sender.asBinder());
5751 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5752 reply.readException();
5753 boolean res = reply.readInt() != 0;
5754 data.recycle();
5755 reply.recycle();
5756 return res;
5757 }
5758
Dianne Hackborn81038902012-11-26 17:04:09 -08005759 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5760 Parcel data = Parcel.obtain();
5761 Parcel reply = Parcel.obtain();
5762 data.writeInterfaceToken(IActivityManager.descriptor);
5763 data.writeStrongBinder(sender.asBinder());
5764 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5765 reply.readException();
5766 Intent res = reply.readInt() != 0
5767 ? Intent.CREATOR.createFromParcel(reply) : null;
5768 data.recycle();
5769 reply.recycle();
5770 return res;
5771 }
5772
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005773 public String getTagForIntentSender(IIntentSender sender, String prefix)
5774 throws RemoteException {
5775 Parcel data = Parcel.obtain();
5776 Parcel reply = Parcel.obtain();
5777 data.writeInterfaceToken(IActivityManager.descriptor);
5778 data.writeStrongBinder(sender.asBinder());
5779 data.writeString(prefix);
5780 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5781 reply.readException();
5782 String res = reply.readString();
5783 data.recycle();
5784 reply.recycle();
5785 return res;
5786 }
5787
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005788 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5789 {
5790 Parcel data = Parcel.obtain();
5791 Parcel reply = Parcel.obtain();
5792 data.writeInterfaceToken(IActivityManager.descriptor);
5793 values.writeToParcel(data, 0);
5794 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5795 reply.readException();
5796 data.recycle();
5797 reply.recycle();
5798 }
5799
Dianne Hackbornb437e092011-08-05 17:50:29 -07005800 public long[] getProcessPss(int[] pids) throws RemoteException {
5801 Parcel data = Parcel.obtain();
5802 Parcel reply = Parcel.obtain();
5803 data.writeInterfaceToken(IActivityManager.descriptor);
5804 data.writeIntArray(pids);
5805 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5806 reply.readException();
5807 long[] res = reply.createLongArray();
5808 data.recycle();
5809 reply.recycle();
5810 return res;
5811 }
5812
Dianne Hackborn661cd522011-08-22 00:26:20 -07005813 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5814 Parcel data = Parcel.obtain();
5815 Parcel reply = Parcel.obtain();
5816 data.writeInterfaceToken(IActivityManager.descriptor);
5817 TextUtils.writeToParcel(msg, data, 0);
5818 data.writeInt(always ? 1 : 0);
5819 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5820 reply.readException();
5821 data.recycle();
5822 reply.recycle();
5823 }
5824
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005825 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005826 Parcel data = Parcel.obtain();
5827 Parcel reply = Parcel.obtain();
5828 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005829 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005830 reply.readException();
5831 data.recycle();
5832 reply.recycle();
5833 }
5834
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005835 public void keyguardGoingAway(boolean disableWindowAnimations,
5836 boolean keyguardGoingToNotificationShade) throws RemoteException {
5837 Parcel data = Parcel.obtain();
5838 Parcel reply = Parcel.obtain();
5839 data.writeInterfaceToken(IActivityManager.descriptor);
5840 data.writeInt(disableWindowAnimations ? 1 : 0);
5841 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5842 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5843 reply.readException();
5844 data.recycle();
5845 reply.recycle();
5846 }
5847
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005848 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005849 throws RemoteException {
5850 Parcel data = Parcel.obtain();
5851 Parcel reply = Parcel.obtain();
5852 data.writeInterfaceToken(IActivityManager.descriptor);
5853 data.writeStrongBinder(token);
5854 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005855 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005856 reply.readException();
5857 boolean result = reply.readInt() != 0;
5858 data.recycle();
5859 reply.recycle();
5860 return result;
5861 }
5862
5863 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5864 throws RemoteException {
5865 Parcel data = Parcel.obtain();
5866 Parcel reply = Parcel.obtain();
5867 data.writeInterfaceToken(IActivityManager.descriptor);
5868 data.writeStrongBinder(token);
5869 target.writeToParcel(data, 0);
5870 data.writeInt(resultCode);
5871 if (resultData != null) {
5872 data.writeInt(1);
5873 resultData.writeToParcel(data, 0);
5874 } else {
5875 data.writeInt(0);
5876 }
5877 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5878 reply.readException();
5879 boolean result = reply.readInt() != 0;
5880 data.recycle();
5881 reply.recycle();
5882 return result;
5883 }
5884
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005885 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5886 Parcel data = Parcel.obtain();
5887 Parcel reply = Parcel.obtain();
5888 data.writeInterfaceToken(IActivityManager.descriptor);
5889 data.writeStrongBinder(activityToken);
5890 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5891 reply.readException();
5892 int result = reply.readInt();
5893 data.recycle();
5894 reply.recycle();
5895 return result;
5896 }
5897
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005898 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5899 Parcel data = Parcel.obtain();
5900 Parcel reply = Parcel.obtain();
5901 data.writeInterfaceToken(IActivityManager.descriptor);
5902 data.writeStrongBinder(activityToken);
5903 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5904 reply.readException();
5905 String result = reply.readString();
5906 data.recycle();
5907 reply.recycle();
5908 return result;
5909 }
5910
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005911 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5912 Parcel data = Parcel.obtain();
5913 Parcel reply = Parcel.obtain();
5914 data.writeInterfaceToken(IActivityManager.descriptor);
5915 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5916 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5917 reply.readException();
5918 data.recycle();
5919 reply.recycle();
5920 }
5921
5922 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5923 Parcel data = Parcel.obtain();
5924 Parcel reply = Parcel.obtain();
5925 data.writeInterfaceToken(IActivityManager.descriptor);
5926 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5927 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5928 reply.readException();
5929 data.recycle();
5930 reply.recycle();
5931 }
5932
Michal Karpinski3da5c972015-12-11 18:16:30 +00005933 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType)
5934 throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005935 Parcel data = Parcel.obtain();
5936 Parcel reply = Parcel.obtain();
5937 data.writeInterfaceToken(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00005938 data.writeInt(bugreportType);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005939 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5940 reply.readException();
5941 data.recycle();
5942 reply.recycle();
5943 }
5944
Jeff Brownbd181bb2013-09-10 16:44:24 -07005945 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5946 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005947 Parcel data = Parcel.obtain();
5948 Parcel reply = Parcel.obtain();
5949 data.writeInterfaceToken(IActivityManager.descriptor);
5950 data.writeInt(pid);
5951 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005952 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005953 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5954 reply.readException();
5955 long res = reply.readInt();
5956 data.recycle();
5957 reply.recycle();
5958 return res;
5959 }
5960
Adam Skorydfc7fd72013-08-05 19:23:41 -07005961 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005962 Parcel data = Parcel.obtain();
5963 Parcel reply = Parcel.obtain();
5964 data.writeInterfaceToken(IActivityManager.descriptor);
5965 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005966 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005967 reply.readException();
5968 Bundle res = reply.readBundle();
5969 data.recycle();
5970 reply.recycle();
5971 return res;
5972 }
5973
Dianne Hackborn17f69352015-07-17 18:04:14 -07005974 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5975 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005976 Parcel data = Parcel.obtain();
5977 Parcel reply = Parcel.obtain();
5978 data.writeInterfaceToken(IActivityManager.descriptor);
5979 data.writeInt(requestType);
5980 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005981 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005982 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5983 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005984 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005985 data.recycle();
5986 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005987 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005988 }
5989
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005990 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005991 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005992 Parcel data = Parcel.obtain();
5993 Parcel reply = Parcel.obtain();
5994 data.writeInterfaceToken(IActivityManager.descriptor);
5995 data.writeStrongBinder(token);
5996 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005997 structure.writeToParcel(data, 0);
5998 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005999 if (referrer != null) {
6000 data.writeInt(1);
6001 referrer.writeToParcel(data, 0);
6002 } else {
6003 data.writeInt(0);
6004 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07006005 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006006 reply.readException();
6007 data.recycle();
6008 reply.recycle();
6009 }
6010
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006011 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
6012 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006013 Parcel data = Parcel.obtain();
6014 Parcel reply = Parcel.obtain();
6015 data.writeInterfaceToken(IActivityManager.descriptor);
6016 intent.writeToParcel(data, 0);
6017 data.writeInt(requestType);
6018 data.writeString(hint);
6019 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006020 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006021 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
6022 reply.readException();
6023 boolean res = reply.readInt() != 0;
6024 data.recycle();
6025 reply.recycle();
6026 return res;
6027 }
6028
Dianne Hackborn17f69352015-07-17 18:04:14 -07006029 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01006030 Parcel data = Parcel.obtain();
6031 Parcel reply = Parcel.obtain();
6032 data.writeInterfaceToken(IActivityManager.descriptor);
6033 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
6034 reply.readException();
6035 boolean res = reply.readInt() != 0;
6036 data.recycle();
6037 reply.recycle();
6038 return res;
6039 }
6040
Dianne Hackborn17f69352015-07-17 18:04:14 -07006041 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
6042 Parcel data = Parcel.obtain();
6043 Parcel reply = Parcel.obtain();
6044 data.writeInterfaceToken(IActivityManager.descriptor);
6045 data.writeStrongBinder(token);
6046 data.writeBundle(args);
6047 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
6048 reply.readException();
6049 boolean res = reply.readInt() != 0;
6050 data.recycle();
6051 reply.recycle();
6052 return res;
6053 }
6054
Svetoslavaa41add2015-08-06 15:03:55 -07006055 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006056 Parcel data = Parcel.obtain();
6057 Parcel reply = Parcel.obtain();
6058 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07006059 data.writeInt(appId);
6060 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006061 data.writeString(reason);
6062 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
6063 reply.readException();
6064 data.recycle();
6065 reply.recycle();
6066 }
6067
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07006068 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
6069 Parcel data = Parcel.obtain();
6070 Parcel reply = Parcel.obtain();
6071 data.writeInterfaceToken(IActivityManager.descriptor);
6072 data.writeStrongBinder(who);
6073 data.writeInt(allowRestart ? 1 : 0);
6074 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
6075 reply.readException();
6076 data.recycle();
6077 reply.recycle();
6078 }
6079
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07006080 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
6081 Parcel data = Parcel.obtain();
6082 Parcel reply = Parcel.obtain();
6083 data.writeInterfaceToken(IActivityManager.descriptor);
6084 data.writeStrongBinder(token);
6085 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
6086 reply.readException();
6087 data.recycle();
6088 reply.recycle();
6089 }
6090
Craig Mautner5eda9b32013-07-02 11:58:16 -07006091 public void notifyActivityDrawn(IBinder token) throws RemoteException {
6092 Parcel data = Parcel.obtain();
6093 Parcel reply = Parcel.obtain();
6094 data.writeInterfaceToken(IActivityManager.descriptor);
6095 data.writeStrongBinder(token);
6096 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
6097 reply.readException();
6098 data.recycle();
6099 reply.recycle();
6100 }
6101
Dianne Hackborn57a7f592013-07-22 18:21:32 -07006102 public void restart() throws RemoteException {
6103 Parcel data = Parcel.obtain();
6104 Parcel reply = Parcel.obtain();
6105 data.writeInterfaceToken(IActivityManager.descriptor);
6106 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
6107 reply.readException();
6108 data.recycle();
6109 reply.recycle();
6110 }
6111
Dianne Hackborn35f72be2013-09-16 10:57:39 -07006112 public void performIdleMaintenance() throws RemoteException {
6113 Parcel data = Parcel.obtain();
6114 Parcel reply = Parcel.obtain();
6115 data.writeInterfaceToken(IActivityManager.descriptor);
6116 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
6117 reply.readException();
6118 data.recycle();
6119 reply.recycle();
6120 }
6121
Todd Kennedyca4d8422015-01-15 15:19:22 -08006122 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08006123 IActivityContainerCallback callback) throws RemoteException {
6124 Parcel data = Parcel.obtain();
6125 Parcel reply = Parcel.obtain();
6126 data.writeInterfaceToken(IActivityManager.descriptor);
6127 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07006128 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08006129 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08006130 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08006131 final int result = reply.readInt();
6132 final IActivityContainer res;
6133 if (result == 1) {
6134 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6135 } else {
6136 res = null;
6137 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08006138 data.recycle();
6139 reply.recycle();
6140 return res;
6141 }
6142
Craig Mautner95da1082014-02-24 17:54:35 -08006143 public void deleteActivityContainer(IActivityContainer activityContainer)
6144 throws RemoteException {
6145 Parcel data = Parcel.obtain();
6146 Parcel reply = Parcel.obtain();
6147 data.writeInterfaceToken(IActivityManager.descriptor);
6148 data.writeStrongBinder(activityContainer.asBinder());
6149 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
6150 reply.readException();
6151 data.recycle();
6152 reply.recycle();
6153 }
6154
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04006155 public boolean startBinderTracking() throws RemoteException {
6156 Parcel data = Parcel.obtain();
6157 Parcel reply = Parcel.obtain();
6158 data.writeInterfaceToken(IActivityManager.descriptor);
6159 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
6160 reply.readException();
6161 boolean res = reply.readInt() != 0;
6162 reply.recycle();
6163 data.recycle();
6164 return res;
6165 }
6166
6167 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6168 Parcel data = Parcel.obtain();
6169 Parcel reply = Parcel.obtain();
6170 data.writeInterfaceToken(IActivityManager.descriptor);
6171 if (fd != null) {
6172 data.writeInt(1);
6173 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6174 } else {
6175 data.writeInt(0);
6176 }
6177 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6178 reply.readException();
6179 boolean res = reply.readInt() != 0;
6180 reply.recycle();
6181 data.recycle();
6182 return res;
6183 }
6184
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006185 public void setVrMode(IBinder token, boolean enabled) throws RemoteException {
6186 Parcel data = Parcel.obtain();
6187 Parcel reply = Parcel.obtain();
6188 data.writeInterfaceToken(IActivityManager.descriptor);
6189 data.writeStrongBinder(token);
6190 data.writeInt(enabled ? 1 : 0);
6191 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6192 reply.readException();
6193 data.recycle();
6194 reply.recycle();
6195 }
6196
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006197 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006198 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6199 Parcel data = Parcel.obtain();
6200 Parcel reply = Parcel.obtain();
6201 data.writeInterfaceToken(IActivityManager.descriptor);
6202 data.writeInt(displayId);
6203 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6204 reply.readException();
6205 final int result = reply.readInt();
6206 final IActivityContainer res;
6207 if (result == 1) {
6208 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6209 } else {
6210 res = null;
6211 }
6212 data.recycle();
6213 reply.recycle();
6214 return res;
6215 }
6216
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006217 @Override
6218 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006219 throws RemoteException {
6220 Parcel data = Parcel.obtain();
6221 Parcel reply = Parcel.obtain();
6222 data.writeInterfaceToken(IActivityManager.descriptor);
6223 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006224 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006225 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006226 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006227 data.recycle();
6228 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006229 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006230 }
6231
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006232 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006233 public void startLockTaskMode(int taskId) throws RemoteException {
6234 Parcel data = Parcel.obtain();
6235 Parcel reply = Parcel.obtain();
6236 data.writeInterfaceToken(IActivityManager.descriptor);
6237 data.writeInt(taskId);
6238 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6239 reply.readException();
6240 data.recycle();
6241 reply.recycle();
6242 }
6243
6244 @Override
6245 public void startLockTaskMode(IBinder token) throws RemoteException {
6246 Parcel data = Parcel.obtain();
6247 Parcel reply = Parcel.obtain();
6248 data.writeInterfaceToken(IActivityManager.descriptor);
6249 data.writeStrongBinder(token);
6250 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6251 reply.readException();
6252 data.recycle();
6253 reply.recycle();
6254 }
6255
6256 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006257 public void startLockTaskModeOnCurrent() throws RemoteException {
6258 Parcel data = Parcel.obtain();
6259 Parcel reply = Parcel.obtain();
6260 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006261 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006262 reply.readException();
6263 data.recycle();
6264 reply.recycle();
6265 }
6266
6267 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006268 public void stopLockTaskMode() throws RemoteException {
6269 Parcel data = Parcel.obtain();
6270 Parcel reply = Parcel.obtain();
6271 data.writeInterfaceToken(IActivityManager.descriptor);
6272 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6273 reply.readException();
6274 data.recycle();
6275 reply.recycle();
6276 }
6277
6278 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006279 public void stopLockTaskModeOnCurrent() throws RemoteException {
6280 Parcel data = Parcel.obtain();
6281 Parcel reply = Parcel.obtain();
6282 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006283 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006284 reply.readException();
6285 data.recycle();
6286 reply.recycle();
6287 }
6288
6289 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006290 public boolean isInLockTaskMode() throws RemoteException {
6291 Parcel data = Parcel.obtain();
6292 Parcel reply = Parcel.obtain();
6293 data.writeInterfaceToken(IActivityManager.descriptor);
6294 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6295 reply.readException();
6296 boolean isInLockTaskMode = reply.readInt() == 1;
6297 data.recycle();
6298 reply.recycle();
6299 return isInLockTaskMode;
6300 }
6301
Craig Mautner688b5102014-03-27 16:55:03 -07006302 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006303 public int getLockTaskModeState() throws RemoteException {
6304 Parcel data = Parcel.obtain();
6305 Parcel reply = Parcel.obtain();
6306 data.writeInterfaceToken(IActivityManager.descriptor);
6307 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6308 reply.readException();
6309 int lockTaskModeState = reply.readInt();
6310 data.recycle();
6311 reply.recycle();
6312 return lockTaskModeState;
6313 }
6314
6315 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006316 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6317 Parcel data = Parcel.obtain();
6318 Parcel reply = Parcel.obtain();
6319 data.writeInterfaceToken(IActivityManager.descriptor);
6320 data.writeStrongBinder(token);
6321 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6322 IBinder.FLAG_ONEWAY);
6323 reply.readException();
6324 data.recycle();
6325 reply.recycle();
6326 }
6327
6328 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006329 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006330 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006331 Parcel data = Parcel.obtain();
6332 Parcel reply = Parcel.obtain();
6333 data.writeInterfaceToken(IActivityManager.descriptor);
6334 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006335 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006336 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006337 reply.readException();
6338 data.recycle();
6339 reply.recycle();
6340 }
6341
Craig Mautneree2e45a2014-06-27 12:10:03 -07006342 @Override
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006343 public void setTaskResizeable(int taskId, int resizeableMode) throws RemoteException {
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006344 Parcel data = Parcel.obtain();
6345 Parcel reply = Parcel.obtain();
6346 data.writeInterfaceToken(IActivityManager.descriptor);
6347 data.writeInt(taskId);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006348 data.writeInt(resizeableMode);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006349 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006350 reply.readException();
6351 data.recycle();
6352 reply.recycle();
6353 }
6354
6355 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006356 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006357 {
6358 Parcel data = Parcel.obtain();
6359 Parcel reply = Parcel.obtain();
6360 data.writeInterfaceToken(IActivityManager.descriptor);
6361 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006362 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006363 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006364 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006365 reply.readException();
6366 data.recycle();
6367 reply.recycle();
6368 }
6369
6370 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006371 public Rect getTaskBounds(int taskId) throws RemoteException
6372 {
6373 Parcel data = Parcel.obtain();
6374 Parcel reply = Parcel.obtain();
6375 data.writeInterfaceToken(IActivityManager.descriptor);
6376 data.writeInt(taskId);
6377 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6378 reply.readException();
6379 Rect rect = Rect.CREATOR.createFromParcel(reply);
6380 data.recycle();
6381 reply.recycle();
6382 return rect;
6383 }
6384
6385 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006386 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006387 Parcel data = Parcel.obtain();
6388 Parcel reply = Parcel.obtain();
6389 data.writeInterfaceToken(IActivityManager.descriptor);
6390 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006391 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006392 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6393 reply.readException();
6394 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6395 data.recycle();
6396 reply.recycle();
6397 return icon;
6398 }
6399
6400 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006401 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6402 throws RemoteException {
6403 Parcel data = Parcel.obtain();
6404 Parcel reply = Parcel.obtain();
6405 data.writeInterfaceToken(IActivityManager.descriptor);
6406 if (options == null) {
6407 data.writeInt(0);
6408 } else {
6409 data.writeInt(1);
6410 data.writeBundle(options.toBundle());
6411 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006412 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006413 reply.readException();
6414 data.recycle();
6415 reply.recycle();
6416 }
6417
6418 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006419 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006420 Parcel data = Parcel.obtain();
6421 Parcel reply = Parcel.obtain();
6422 data.writeInterfaceToken(IActivityManager.descriptor);
6423 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006424 data.writeInt(visible ? 1 : 0);
6425 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006426 reply.readException();
6427 boolean success = reply.readInt() > 0;
6428 data.recycle();
6429 reply.recycle();
6430 return success;
6431 }
6432
6433 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006434 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006435 Parcel data = Parcel.obtain();
6436 Parcel reply = Parcel.obtain();
6437 data.writeInterfaceToken(IActivityManager.descriptor);
6438 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006439 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006440 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006441 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006442 data.recycle();
6443 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006444 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006445 }
6446
6447 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006448 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006449 Parcel data = Parcel.obtain();
6450 Parcel reply = Parcel.obtain();
6451 data.writeInterfaceToken(IActivityManager.descriptor);
6452 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006453 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006454 reply.readException();
6455 data.recycle();
6456 reply.recycle();
6457 }
6458
6459 @Override
6460 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6461 Parcel data = Parcel.obtain();
6462 Parcel reply = Parcel.obtain();
6463 data.writeInterfaceToken(IActivityManager.descriptor);
6464 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006465 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006466 reply.readException();
6467 data.recycle();
6468 reply.recycle();
6469 }
6470
Craig Mautner8746a472014-07-24 15:12:54 -07006471 @Override
6472 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6473 Parcel data = Parcel.obtain();
6474 Parcel reply = Parcel.obtain();
6475 data.writeInterfaceToken(IActivityManager.descriptor);
6476 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006477 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006478 reply.readException();
6479 data.recycle();
6480 reply.recycle();
6481 }
6482
Craig Mautner6e2f3952014-09-09 14:26:41 -07006483 @Override
6484 public void bootAnimationComplete() throws RemoteException {
6485 Parcel data = Parcel.obtain();
6486 Parcel reply = Parcel.obtain();
6487 data.writeInterfaceToken(IActivityManager.descriptor);
6488 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6489 reply.readException();
6490 data.recycle();
6491 reply.recycle();
6492 }
6493
Wale Ogunwale18795a22014-12-03 11:38:33 -08006494 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006495 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6496 Parcel data = Parcel.obtain();
6497 Parcel reply = Parcel.obtain();
6498 data.writeInterfaceToken(IActivityManager.descriptor);
6499 data.writeInt(uid);
6500 data.writeByteArray(firstPacket);
6501 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6502 reply.readException();
6503 data.recycle();
6504 reply.recycle();
6505 }
6506
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006507 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006508 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6509 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006510 Parcel data = Parcel.obtain();
6511 Parcel reply = Parcel.obtain();
6512 data.writeInterfaceToken(IActivityManager.descriptor);
6513 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006514 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006515 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006516 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006517 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6518 reply.readException();
6519 data.recycle();
6520 reply.recycle();
6521 }
6522
6523 @Override
6524 public void dumpHeapFinished(String path) throws RemoteException {
6525 Parcel data = Parcel.obtain();
6526 Parcel reply = Parcel.obtain();
6527 data.writeInterfaceToken(IActivityManager.descriptor);
6528 data.writeString(path);
6529 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6530 reply.readException();
6531 data.recycle();
6532 reply.recycle();
6533 }
6534
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006535 @Override
6536 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6537 throws RemoteException {
6538 Parcel data = Parcel.obtain();
6539 Parcel reply = Parcel.obtain();
6540 data.writeInterfaceToken(IActivityManager.descriptor);
6541 data.writeStrongBinder(session.asBinder());
6542 data.writeInt(keepAwake ? 1 : 0);
6543 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6544 reply.readException();
6545 data.recycle();
6546 reply.recycle();
6547 }
6548
Craig Mautnere5600772015-04-03 21:36:37 -07006549 @Override
6550 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6551 Parcel data = Parcel.obtain();
6552 Parcel reply = Parcel.obtain();
6553 data.writeInterfaceToken(IActivityManager.descriptor);
6554 data.writeInt(userId);
6555 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006556 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006557 reply.readException();
6558 data.recycle();
6559 reply.recycle();
6560 }
6561
Dianne Hackborn1e383822015-04-10 14:02:33 -07006562 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006563 public void updateDeviceOwner(String packageName) throws RemoteException {
6564 Parcel data = Parcel.obtain();
6565 Parcel reply = Parcel.obtain();
6566 data.writeInterfaceToken(IActivityManager.descriptor);
6567 data.writeString(packageName);
6568 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6569 reply.readException();
6570 data.recycle();
6571 reply.recycle();
6572 }
6573
6574 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006575 public int getPackageProcessState(String packageName, String callingPackage)
6576 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006577 Parcel data = Parcel.obtain();
6578 Parcel reply = Parcel.obtain();
6579 data.writeInterfaceToken(IActivityManager.descriptor);
6580 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006581 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006582 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6583 reply.readException();
6584 int res = reply.readInt();
6585 data.recycle();
6586 reply.recycle();
6587 return res;
6588 }
6589
Stefan Kuhne16045c22015-06-05 07:18:06 -07006590 @Override
6591 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6592 throws RemoteException {
6593 Parcel data = Parcel.obtain();
6594 Parcel reply = Parcel.obtain();
6595 data.writeInterfaceToken(IActivityManager.descriptor);
6596 data.writeString(process);
6597 data.writeInt(userId);
6598 data.writeInt(level);
6599 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6600 reply.readException();
6601 int res = reply.readInt();
6602 data.recycle();
6603 reply.recycle();
6604 return res != 0;
6605 }
6606
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006607 @Override
6608 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6609 Parcel data = Parcel.obtain();
6610 Parcel reply = Parcel.obtain();
6611 data.writeInterfaceToken(IActivityManager.descriptor);
6612 data.writeStrongBinder(token);
6613 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6614 reply.readException();
6615 int res = reply.readInt();
6616 data.recycle();
6617 reply.recycle();
6618 return res != 0;
6619 }
6620
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006621 @Override
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006622 public void exitFreeformMode(IBinder token) throws RemoteException {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006623 Parcel data = Parcel.obtain();
6624 Parcel reply = Parcel.obtain();
6625 data.writeInterfaceToken(IActivityManager.descriptor);
6626 data.writeStrongBinder(token);
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006627 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006628 reply.readException();
6629 data.recycle();
6630 reply.recycle();
6631 }
6632
6633 @Override
6634 public int getActivityStackId(IBinder token) throws RemoteException {
6635 Parcel data = Parcel.obtain();
6636 Parcel reply = Parcel.obtain();
6637 data.writeInterfaceToken(IActivityManager.descriptor);
6638 data.writeStrongBinder(token);
6639 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6640 reply.readException();
6641 int stackId = reply.readInt();
6642 data.recycle();
6643 reply.recycle();
6644 return stackId;
6645 }
6646
Filip Gruszczynski23493322015-07-29 17:02:59 -07006647 @Override
6648 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006649 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6650 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006651 Parcel data = Parcel.obtain();
6652 Parcel reply = Parcel.obtain();
6653 data.writeInterfaceToken(IActivityManager.descriptor);
6654 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006655 writeIntArray(horizontalSizeConfiguration, data);
6656 writeIntArray(verticalSizeConfigurations, data);
6657 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006658 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6659 reply.readException();
6660 data.recycle();
6661 reply.recycle();
6662 }
6663
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006664 private static void writeIntArray(int[] array, Parcel data) {
6665 if (array == null) {
6666 data.writeInt(0);
6667 } else {
6668 data.writeInt(array.length);
6669 data.writeIntArray(array);
6670 }
6671 }
6672
Wale Ogunwale83301a92015-09-24 15:54:08 -07006673 @Override
6674 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6675 Parcel data = Parcel.obtain();
6676 Parcel reply = Parcel.obtain();
6677 data.writeInterfaceToken(IActivityManager.descriptor);
6678 data.writeInt(suppress ? 1 : 0);
6679 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6680 reply.readException();
6681 data.recycle();
6682 reply.recycle();
6683 }
6684
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006685 @Override
Wale Ogunwale9101d262016-01-15 08:56:11 -08006686 public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006687 Parcel data = Parcel.obtain();
6688 Parcel reply = Parcel.obtain();
6689 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006690 data.writeInt(fromStackId);
Wale Ogunwale9101d262016-01-15 08:56:11 -08006691 data.writeInt(onTop ? 1 : 0);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006692 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006693 reply.readException();
6694 data.recycle();
6695 reply.recycle();
6696 }
6697
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006698 @Override
6699 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6700 Parcel data = Parcel.obtain();
6701 Parcel reply = Parcel.obtain();
6702 data.writeInterfaceToken(IActivityManager.descriptor);
6703 data.writeInt(uid);
6704 data.writeString(packageName);
6705 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6706 reply.readException();
6707 int res = reply.readInt();
6708 data.recycle();
6709 reply.recycle();
6710 return res;
6711 }
6712
Wale Ogunwale5f986092015-12-04 15:35:38 -08006713 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006714 public boolean inMultiWindow(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006715 Parcel data = Parcel.obtain();
6716 Parcel reply = Parcel.obtain();
6717 data.writeInterfaceToken(IActivityManager.descriptor);
6718 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006719 mRemote.transact(IN_MULTI_WINDOW_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006720 reply.readException();
6721 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6722 data.recycle();
6723 reply.recycle();
6724 return multiWindowMode;
6725 }
6726
6727 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006728 public boolean inPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006729 Parcel data = Parcel.obtain();
6730 Parcel reply = Parcel.obtain();
6731 data.writeInterfaceToken(IActivityManager.descriptor);
6732 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006733 mRemote.transact(IN_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006734 reply.readException();
6735 final boolean pipMode = reply.readInt() == 1 ? true : false;
6736 data.recycle();
6737 reply.recycle();
6738 return pipMode;
6739 }
6740
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006741 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006742 public void enterPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006743 Parcel data = Parcel.obtain();
6744 Parcel reply = Parcel.obtain();
6745 data.writeInterfaceToken(IActivityManager.descriptor);
6746 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006747 mRemote.transact(ENTER_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006748 reply.readException();
6749 data.recycle();
6750 reply.recycle();
6751 }
6752
Christopher Tate63fec3e2015-12-11 18:35:28 -08006753 @Override
6754 public boolean isAppForeground(int uid) throws RemoteException {
6755 Parcel data = Parcel.obtain();
6756 Parcel reply = Parcel.obtain();
6757 data.writeInterfaceToken(IActivityManager.descriptor);
6758 data.writeInt(uid);
6759 mRemote.transact(IS_APP_FOREGROUND_TRANSACTION, data, reply, 0);
6760 final boolean isForeground = reply.readInt() == 1 ? true : false;
6761 data.recycle();
6762 reply.recycle();
6763 return isForeground;
6764 };
6765
Wale Ogunwale480dca02016-02-06 13:58:29 -08006766 @Override
6767 public void notifyPinnedStackAnimationEnded() throws RemoteException {
6768 Parcel data = Parcel.obtain();
6769 Parcel reply = Parcel.obtain();
6770 data.writeInterfaceToken(IActivityManager.descriptor);
6771 mRemote.transact(NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION, data, reply, 0);
6772 data.recycle();
6773 reply.recycle();
6774 };
6775
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08006776 @Override
6777 public void removeStack(int stackId) throws RemoteException {
6778 Parcel data = Parcel.obtain();
6779 Parcel reply = Parcel.obtain();
6780 data.writeInterfaceToken(IActivityManager.descriptor);
6781 data.writeInt(stackId);
6782 mRemote.transact(REMOVE_STACK, data, reply, 0);
6783 reply.readException();
6784 data.recycle();
6785 reply.recycle();
6786 }
6787
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006788 private IBinder mRemote;
6789}