blob: 303078b74f0db7f1c6c5415695c33b107184ddfc [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700110 null, intent, null, null, Activity.RESULT_OK, null, null,
111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700119 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
120 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700121 } catch (RemoteException ex) {
122 }
123 }
124
125 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
126 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700127 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700128 } catch (RemoteException ex) {
129 }
130 }
131
132 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
133 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700134 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 } catch (RemoteException ex) {
136 }
137 }
138
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800139 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 attachInterface(this, descriptor);
141 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700142
143 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
145 throws RemoteException {
146 switch (code) {
147 case START_ACTIVITY_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800156 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800163 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700169
Amith Yamasani82644082012-08-03 13:09:11 -0700170 case START_ACTIVITY_AS_USER_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 IBinder resultTo = data.readStrongBinder();
179 String resultWho = data.readString();
180 int requestCode = data.readInt();
181 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700182 ProfilerInfo profilerInfo = data.readInt() != 0
183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
186 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800187 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700194 case START_ACTIVITY_AS_CALLER_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
199 String callingPackage = data.readString();
200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
202 IBinder resultTo = data.readStrongBinder();
203 String resultWho = data.readString();
204 int requestCode = data.readInt();
205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700210 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
214 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700215 reply.writeNoException();
216 reply.writeInt(result);
217 return true;
218 }
219
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 case START_ACTIVITY_AND_WAIT_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800225 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800228 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800229 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800230 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700232 ProfilerInfo profilerInfo = data.readInt() != 0
233 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 Bundle options = data.readInt() != 0
235 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700236 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800237 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700238 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800239 reply.writeNoException();
240 result.writeToParcel(reply, 0);
241 return true;
242 }
243
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700244 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
245 {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder b = data.readStrongBinder();
248 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800249 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700250 Intent intent = Intent.CREATOR.createFromParcel(data);
251 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700254 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700255 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700256 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700259 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800260 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700261 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
266
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700267 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 IBinder b = data.readStrongBinder();
271 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700272 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700273 Intent fillInIntent = null;
274 if (data.readInt() != 0) {
275 fillInIntent = Intent.CREATOR.createFromParcel(data);
276 }
277 String resolvedType = data.readString();
278 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700279 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700280 int requestCode = data.readInt();
281 int flagsMask = data.readInt();
282 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700285 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700286 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700287 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700292
Dianne Hackborn91097de2014-04-04 18:02:06 -0700293 case START_VOICE_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 String callingPackage = data.readString();
297 int callingPid = data.readInt();
298 int callingUid = data.readInt();
299 Intent intent = Intent.CREATOR.createFromParcel(data);
300 String resolvedType = data.readString();
301 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
302 data.readStrongBinder());
303 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
304 data.readStrongBinder());
305 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700306 ProfilerInfo profilerInfo = data.readInt() != 0
307 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700308 Bundle options = data.readInt() != 0
309 ? Bundle.CREATOR.createFromParcel(data) : null;
310 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700311 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
312 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700313 reply.writeNoException();
314 reply.writeInt(result);
315 return true;
316 }
317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder callingActivity = data.readStrongBinder();
322 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700323 Bundle options = data.readInt() != 0
324 ? Bundle.CREATOR.createFromParcel(data) : null;
325 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(result ? 1 : 0);
328 return true;
329 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700330
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700331 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700334 final int taskId = data.readInt();
335 final int launchStackId = data.readInt();
336 final Bundle options =
337 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
338 final int result = startActivityFromRecents(taskId, launchStackId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700339 reply.writeNoException();
340 reply.writeInt(result);
341 return true;
342 }
343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 case FINISH_ACTIVITY_TRANSACTION: {
345 data.enforceInterface(IActivityManager.descriptor);
346 IBinder token = data.readStrongBinder();
347 Intent resultData = null;
348 int resultCode = data.readInt();
349 if (data.readInt() != 0) {
350 resultData = Intent.CREATOR.createFromParcel(data);
351 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700352 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700353 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res ? 1 : 0);
356 return true;
357 }
358
359 case FINISH_SUB_ACTIVITY_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700362 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 int requestCode = data.readInt();
364 finishSubActivity(token, resultWho, requestCode);
365 reply.writeNoException();
366 return true;
367 }
368
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700369 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder token = data.readStrongBinder();
372 boolean res = finishActivityAffinity(token);
373 reply.writeNoException();
374 reply.writeInt(res ? 1 : 0);
375 return true;
376 }
377
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700378 case FINISH_VOICE_TASK_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
381 data.readStrongBinder());
382 finishVoiceTask(session);
383 reply.writeNoException();
384 return true;
385 }
386
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700387 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder token = data.readStrongBinder();
390 boolean res = releaseActivityInstance(token);
391 reply.writeNoException();
392 reply.writeInt(res ? 1 : 0);
393 return true;
394 }
395
396 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
399 releaseSomeActivities(app);
400 reply.writeNoException();
401 return true;
402 }
403
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800404 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder token = data.readStrongBinder();
407 boolean res = willActivityBeVisible(token);
408 reply.writeNoException();
409 reply.writeInt(res ? 1 : 0);
410 return true;
411 }
412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800413 case REGISTER_RECEIVER_TRANSACTION:
414 {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder b = data.readStrongBinder();
417 IApplicationThread app =
418 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700419 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 b = data.readStrongBinder();
421 IIntentReceiver rec
422 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
423 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
424 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700425 int userId = data.readInt();
426 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 reply.writeNoException();
428 if (intent != null) {
429 reply.writeInt(1);
430 intent.writeToParcel(reply, 0);
431 } else {
432 reply.writeInt(0);
433 }
434 return true;
435 }
436
437 case UNREGISTER_RECEIVER_TRANSACTION:
438 {
439 data.enforceInterface(IActivityManager.descriptor);
440 IBinder b = data.readStrongBinder();
441 if (b == null) {
442 return true;
443 }
444 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
445 unregisterReceiver(rec);
446 reply.writeNoException();
447 return true;
448 }
449
450 case BROADCAST_INTENT_TRANSACTION:
451 {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder b = data.readStrongBinder();
454 IApplicationThread app =
455 b != null ? ApplicationThreadNative.asInterface(b) : null;
456 Intent intent = Intent.CREATOR.createFromParcel(data);
457 String resolvedType = data.readString();
458 b = data.readStrongBinder();
459 IIntentReceiver resultTo =
460 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
461 int resultCode = data.readInt();
462 String resultData = data.readString();
463 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700464 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800465 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700466 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 boolean serialized = data.readInt() != 0;
468 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700469 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700471 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700472 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 reply.writeNoException();
474 reply.writeInt(res);
475 return true;
476 }
477
478 case UNBROADCAST_INTENT_TRANSACTION:
479 {
480 data.enforceInterface(IActivityManager.descriptor);
481 IBinder b = data.readStrongBinder();
482 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
483 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700484 int userId = data.readInt();
485 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 reply.writeNoException();
487 return true;
488 }
489
490 case FINISH_RECEIVER_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 IBinder who = data.readStrongBinder();
493 int resultCode = data.readInt();
494 String resultData = data.readString();
495 Bundle resultExtras = data.readBundle();
496 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800497 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800499 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 }
501 reply.writeNoException();
502 return true;
503 }
504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 case ATTACH_APPLICATION_TRANSACTION: {
506 data.enforceInterface(IActivityManager.descriptor);
507 IApplicationThread app = ApplicationThreadNative.asInterface(
508 data.readStrongBinder());
509 if (app != null) {
510 attachApplication(app);
511 }
512 reply.writeNoException();
513 return true;
514 }
515
516 case ACTIVITY_IDLE_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700519 Configuration config = null;
520 if (data.readInt() != 0) {
521 config = Configuration.CREATOR.createFromParcel(data);
522 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700523 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700525 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 }
527 reply.writeNoException();
528 return true;
529 }
530
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700531 case ACTIVITY_RESUMED_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 IBinder token = data.readStrongBinder();
534 activityResumed(token);
535 reply.writeNoException();
536 return true;
537 }
538
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 case ACTIVITY_PAUSED_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700542 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 reply.writeNoException();
544 return true;
545 }
546
547 case ACTIVITY_STOPPED_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800550 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700551 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700553 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 reply.writeNoException();
555 return true;
556 }
557
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800558 case ACTIVITY_SLEPT_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activitySlept(token);
562 reply.writeNoException();
563 return true;
564 }
565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 case ACTIVITY_DESTROYED_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
569 activityDestroyed(token);
570 reply.writeNoException();
571 return true;
572 }
573
574 case GET_CALLING_PACKAGE_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 IBinder token = data.readStrongBinder();
577 String res = token != null ? getCallingPackage(token) : null;
578 reply.writeNoException();
579 reply.writeString(res);
580 return true;
581 }
582
583 case GET_CALLING_ACTIVITY_TRANSACTION: {
584 data.enforceInterface(IActivityManager.descriptor);
585 IBinder token = data.readStrongBinder();
586 ComponentName cn = getCallingActivity(token);
587 reply.writeNoException();
588 ComponentName.writeToParcel(cn, reply);
589 return true;
590 }
591
Winson Chung1147c402014-05-14 11:05:00 -0700592 case GET_APP_TASKS_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700594 String callingPackage = data.readString();
595 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700596 reply.writeNoException();
597 int N = list != null ? list.size() : -1;
598 reply.writeInt(N);
599 int i;
600 for (i=0; i<N; i++) {
601 IAppTask task = list.get(i);
602 reply.writeStrongBinder(task.asBinder());
603 }
604 return true;
605 }
606
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700607 case ADD_APP_TASK_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 IBinder activityToken = data.readStrongBinder();
610 Intent intent = Intent.CREATOR.createFromParcel(data);
611 ActivityManager.TaskDescription descr
612 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
613 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
614 int res = addAppTask(activityToken, intent, descr, thumbnail);
615 reply.writeNoException();
616 reply.writeInt(res);
617 return true;
618 }
619
620 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 Point size = getAppTaskThumbnailSize();
623 reply.writeNoException();
624 size.writeToParcel(reply, 0);
625 return true;
626 }
627
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628 case GET_TASKS_TRANSACTION: {
629 data.enforceInterface(IActivityManager.descriptor);
630 int maxNum = data.readInt();
631 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700632 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 reply.writeNoException();
634 int N = list != null ? list.size() : -1;
635 reply.writeInt(N);
636 int i;
637 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700638 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 info.writeToParcel(reply, 0);
640 }
641 return true;
642 }
643
644 case GET_RECENT_TASKS_TRANSACTION: {
645 data.enforceInterface(IActivityManager.descriptor);
646 int maxNum = data.readInt();
647 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700648 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800649 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700650 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 reply.writeNoException();
652 reply.writeTypedList(list);
653 return true;
654 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700655
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 data.enforceInterface(IActivityManager.descriptor);
658 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700659 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800660 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700661 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800662 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700663 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700664 } else {
665 reply.writeInt(0);
666 }
667 return true;
668 }
669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 case GET_SERVICES_TRANSACTION: {
671 data.enforceInterface(IActivityManager.descriptor);
672 int maxNum = data.readInt();
673 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700674 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 reply.writeNoException();
676 int N = list != null ? list.size() : -1;
677 reply.writeInt(N);
678 int i;
679 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700680 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 info.writeToParcel(reply, 0);
682 }
683 return true;
684 }
685
686 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
689 reply.writeNoException();
690 reply.writeTypedList(list);
691 return true;
692 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
697 reply.writeNoException();
698 reply.writeTypedList(list);
699 return true;
700 }
701
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700702 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 List<ApplicationInfo> list = getRunningExternalApplications();
705 reply.writeNoException();
706 reply.writeTypedList(list);
707 return true;
708 }
709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 case MOVE_TASK_TO_FRONT_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800713 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700714 Bundle options = data.readInt() != 0
715 ? Bundle.CREATOR.createFromParcel(data) : null;
716 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 reply.writeNoException();
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder token = data.readStrongBinder();
724 boolean nonRoot = data.readInt() != 0;
725 boolean res = moveActivityTaskToBack(token, nonRoot);
726 reply.writeNoException();
727 reply.writeInt(res ? 1 : 0);
728 return true;
729 }
730
731 case MOVE_TASK_BACKWARDS_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 int task = data.readInt();
734 moveTaskBackwards(task);
735 reply.writeNoException();
736 return true;
737 }
738
Craig Mautnerc00204b2013-03-05 15:02:14 -0800739 case MOVE_TASK_TO_STACK_TRANSACTION: {
740 data.enforceInterface(IActivityManager.descriptor);
741 int taskId = data.readInt();
742 int stackId = data.readInt();
743 boolean toTop = data.readInt() != 0;
744 moveTaskToStack(taskId, stackId, toTop);
745 reply.writeNoException();
746 return true;
747 }
748
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700749 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
750 data.enforceInterface(IActivityManager.descriptor);
751 int taskId = data.readInt();
752 int createMode = data.readInt();
753 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800754 boolean animate = data.readInt() != 0;
755 moveTaskToDockedStack(taskId, createMode, toTop, animate);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700756 reply.writeNoException();
757 return true;
758 }
759
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700760 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700761 data.enforceInterface(IActivityManager.descriptor);
762 final int stackId = data.readInt();
763 final Rect r = Rect.CREATOR.createFromParcel(data);
764 final boolean res = moveTopActivityToPinnedStack(stackId, r);
765 reply.writeNoException();
766 reply.writeInt(res ? 1 : 0);
767 return true;
768 }
769
Craig Mautnerc00204b2013-03-05 15:02:14 -0800770 case RESIZE_STACK_TRANSACTION: {
771 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700772 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100773 final boolean hasRect = data.readInt() != 0;
774 Rect r = null;
775 if (hasRect) {
776 r = Rect.CREATOR.createFromParcel(data);
777 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700778 final boolean allowResizeInDockedMode = data.readInt() == 1;
779 resizeStack(stackId, r, allowResizeInDockedMode);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800780 reply.writeNoException();
781 return true;
782 }
783
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700784 case POSITION_TASK_IN_STACK_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 int taskId = data.readInt();
787 int stackId = data.readInt();
788 int position = data.readInt();
789 positionTaskInStack(taskId, stackId, position);
790 reply.writeNoException();
791 return true;
792 }
793
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800794 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700795 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800796 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700797 reply.writeNoException();
798 reply.writeTypedList(list);
799 return true;
800 }
801
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800802 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700803 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800804 int stackId = data.readInt();
805 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700806 reply.writeNoException();
807 if (info != null) {
808 reply.writeInt(1);
809 info.writeToParcel(reply, 0);
810 } else {
811 reply.writeInt(0);
812 }
813 return true;
814 }
815
Winson Chung303e1ff2014-03-07 15:06:19 -0800816 case IS_IN_HOME_STACK_TRANSACTION: {
817 data.enforceInterface(IActivityManager.descriptor);
818 int taskId = data.readInt();
819 boolean isInHomeStack = isInHomeStack(taskId);
820 reply.writeNoException();
821 reply.writeInt(isInHomeStack ? 1 : 0);
822 return true;
823 }
824
Craig Mautnercf910b02013-04-23 11:23:27 -0700825 case SET_FOCUSED_STACK_TRANSACTION: {
826 data.enforceInterface(IActivityManager.descriptor);
827 int stackId = data.readInt();
828 setFocusedStack(stackId);
829 reply.writeNoException();
830 return true;
831 }
832
Winson Chungd16c5652015-01-26 16:11:07 -0800833 case GET_FOCUSED_STACK_ID_TRANSACTION: {
834 data.enforceInterface(IActivityManager.descriptor);
835 int focusedStackId = getFocusedStackId();
836 reply.writeNoException();
837 reply.writeInt(focusedStackId);
838 return true;
839 }
840
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700841 case SET_FOCUSED_TASK_TRANSACTION: {
842 data.enforceInterface(IActivityManager.descriptor);
843 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700844 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700845 reply.writeNoException();
846 return true;
847 }
848
Winson Chung740c3ac2014-11-12 16:14:38 -0800849 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
850 data.enforceInterface(IActivityManager.descriptor);
851 IBinder token = data.readStrongBinder();
852 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
853 reply.writeNoException();
854 return true;
855 }
856
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
858 data.enforceInterface(IActivityManager.descriptor);
859 IBinder token = data.readStrongBinder();
860 boolean onlyRoot = data.readInt() != 0;
861 int res = token != null
862 ? getTaskForActivity(token, onlyRoot) : -1;
863 reply.writeNoException();
864 reply.writeInt(res);
865 return true;
866 }
867
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 case GET_CONTENT_PROVIDER_TRANSACTION: {
869 data.enforceInterface(IActivityManager.descriptor);
870 IBinder b = data.readStrongBinder();
871 IApplicationThread app = ApplicationThreadNative.asInterface(b);
872 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700873 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700874 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700875 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800876 reply.writeNoException();
877 if (cph != null) {
878 reply.writeInt(1);
879 cph.writeToParcel(reply, 0);
880 } else {
881 reply.writeInt(0);
882 }
883 return true;
884 }
885
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800886 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700889 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800890 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700891 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800892 reply.writeNoException();
893 if (cph != null) {
894 reply.writeInt(1);
895 cph.writeToParcel(reply, 0);
896 } else {
897 reply.writeInt(0);
898 }
899 return true;
900 }
901
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800902 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
903 data.enforceInterface(IActivityManager.descriptor);
904 IBinder b = data.readStrongBinder();
905 IApplicationThread app = ApplicationThreadNative.asInterface(b);
906 ArrayList<ContentProviderHolder> providers =
907 data.createTypedArrayList(ContentProviderHolder.CREATOR);
908 publishContentProviders(app, providers);
909 reply.writeNoException();
910 return true;
911 }
912
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700913 case REF_CONTENT_PROVIDER_TRANSACTION: {
914 data.enforceInterface(IActivityManager.descriptor);
915 IBinder b = data.readStrongBinder();
916 int stable = data.readInt();
917 int unstable = data.readInt();
918 boolean res = refContentProvider(b, stable, unstable);
919 reply.writeNoException();
920 reply.writeInt(res ? 1 : 0);
921 return true;
922 }
923
924 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 IBinder b = data.readStrongBinder();
927 unstableProviderDied(b);
928 reply.writeNoException();
929 return true;
930 }
931
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700932 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 IBinder b = data.readStrongBinder();
935 appNotRespondingViaProvider(b);
936 reply.writeNoException();
937 return true;
938 }
939
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800940 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
941 data.enforceInterface(IActivityManager.descriptor);
942 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700943 boolean stable = data.readInt() != 0;
944 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 reply.writeNoException();
946 return true;
947 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800948
949 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
950 data.enforceInterface(IActivityManager.descriptor);
951 String name = data.readString();
952 IBinder token = data.readStrongBinder();
953 removeContentProviderExternal(name, token);
954 reply.writeNoException();
955 return true;
956 }
957
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700958 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
961 PendingIntent pi = getRunningServiceControlPanel(comp);
962 reply.writeNoException();
963 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
964 return true;
965 }
966
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800967 case START_SERVICE_TRANSACTION: {
968 data.enforceInterface(IActivityManager.descriptor);
969 IBinder b = data.readStrongBinder();
970 IApplicationThread app = ApplicationThreadNative.asInterface(b);
971 Intent service = Intent.CREATOR.createFromParcel(data);
972 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700973 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700974 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700975 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800976 reply.writeNoException();
977 ComponentName.writeToParcel(cn, reply);
978 return true;
979 }
980
981 case STOP_SERVICE_TRANSACTION: {
982 data.enforceInterface(IActivityManager.descriptor);
983 IBinder b = data.readStrongBinder();
984 IApplicationThread app = ApplicationThreadNative.asInterface(b);
985 Intent service = Intent.CREATOR.createFromParcel(data);
986 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700987 int userId = data.readInt();
988 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800989 reply.writeNoException();
990 reply.writeInt(res);
991 return true;
992 }
993
994 case STOP_SERVICE_TOKEN_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 ComponentName className = ComponentName.readFromParcel(data);
997 IBinder token = data.readStrongBinder();
998 int startId = data.readInt();
999 boolean res = stopServiceToken(className, token, startId);
1000 reply.writeNoException();
1001 reply.writeInt(res ? 1 : 0);
1002 return true;
1003 }
1004
1005 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1006 data.enforceInterface(IActivityManager.descriptor);
1007 ComponentName className = ComponentName.readFromParcel(data);
1008 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001009 int id = data.readInt();
1010 Notification notification = null;
1011 if (data.readInt() != 0) {
1012 notification = Notification.CREATOR.createFromParcel(data);
1013 }
1014 boolean removeNotification = data.readInt() != 0;
1015 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001016 reply.writeNoException();
1017 return true;
1018 }
1019
1020 case BIND_SERVICE_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 IBinder b = data.readStrongBinder();
1023 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1024 IBinder token = data.readStrongBinder();
1025 Intent service = Intent.CREATOR.createFromParcel(data);
1026 String resolvedType = data.readString();
1027 b = data.readStrongBinder();
1028 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001029 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001030 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001031 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001032 int res = bindService(app, token, service, resolvedType, conn, fl,
1033 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 reply.writeNoException();
1035 reply.writeInt(res);
1036 return true;
1037 }
1038
1039 case UNBIND_SERVICE_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 IBinder b = data.readStrongBinder();
1042 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1043 boolean res = unbindService(conn);
1044 reply.writeNoException();
1045 reply.writeInt(res ? 1 : 0);
1046 return true;
1047 }
1048
1049 case PUBLISH_SERVICE_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 IBinder token = data.readStrongBinder();
1052 Intent intent = Intent.CREATOR.createFromParcel(data);
1053 IBinder service = data.readStrongBinder();
1054 publishService(token, intent, service);
1055 reply.writeNoException();
1056 return true;
1057 }
1058
1059 case UNBIND_FINISHED_TRANSACTION: {
1060 data.enforceInterface(IActivityManager.descriptor);
1061 IBinder token = data.readStrongBinder();
1062 Intent intent = Intent.CREATOR.createFromParcel(data);
1063 boolean doRebind = data.readInt() != 0;
1064 unbindFinished(token, intent, doRebind);
1065 reply.writeNoException();
1066 return true;
1067 }
1068
1069 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1070 data.enforceInterface(IActivityManager.descriptor);
1071 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001072 int type = data.readInt();
1073 int startId = data.readInt();
1074 int res = data.readInt();
1075 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001076 reply.writeNoException();
1077 return true;
1078 }
1079
1080 case START_INSTRUMENTATION_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 ComponentName className = ComponentName.readFromParcel(data);
1083 String profileFile = data.readString();
1084 int fl = data.readInt();
1085 Bundle arguments = data.readBundle();
1086 IBinder b = data.readStrongBinder();
1087 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001088 b = data.readStrongBinder();
1089 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001090 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001091 String abiOverride = data.readString();
1092 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1093 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001094 reply.writeNoException();
1095 reply.writeInt(res ? 1 : 0);
1096 return true;
1097 }
1098
1099
1100 case FINISH_INSTRUMENTATION_TRANSACTION: {
1101 data.enforceInterface(IActivityManager.descriptor);
1102 IBinder b = data.readStrongBinder();
1103 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1104 int resultCode = data.readInt();
1105 Bundle results = data.readBundle();
1106 finishInstrumentation(app, resultCode, results);
1107 reply.writeNoException();
1108 return true;
1109 }
1110
1111 case GET_CONFIGURATION_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 Configuration config = getConfiguration();
1114 reply.writeNoException();
1115 config.writeToParcel(reply, 0);
1116 return true;
1117 }
1118
1119 case UPDATE_CONFIGURATION_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
1121 Configuration config = Configuration.CREATOR.createFromParcel(data);
1122 updateConfiguration(config);
1123 reply.writeNoException();
1124 return true;
1125 }
1126
1127 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 IBinder token = data.readStrongBinder();
1130 int requestedOrientation = data.readInt();
1131 setRequestedOrientation(token, requestedOrientation);
1132 reply.writeNoException();
1133 return true;
1134 }
1135
1136 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1137 data.enforceInterface(IActivityManager.descriptor);
1138 IBinder token = data.readStrongBinder();
1139 int req = getRequestedOrientation(token);
1140 reply.writeNoException();
1141 reply.writeInt(req);
1142 return true;
1143 }
1144
1145 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1146 data.enforceInterface(IActivityManager.descriptor);
1147 IBinder token = data.readStrongBinder();
1148 ComponentName cn = getActivityClassForToken(token);
1149 reply.writeNoException();
1150 ComponentName.writeToParcel(cn, reply);
1151 return true;
1152 }
1153
1154 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1155 data.enforceInterface(IActivityManager.descriptor);
1156 IBinder token = data.readStrongBinder();
1157 reply.writeNoException();
1158 reply.writeString(getPackageForToken(token));
1159 return true;
1160 }
1161
1162 case GET_INTENT_SENDER_TRANSACTION: {
1163 data.enforceInterface(IActivityManager.descriptor);
1164 int type = data.readInt();
1165 String packageName = data.readString();
1166 IBinder token = data.readStrongBinder();
1167 String resultWho = data.readString();
1168 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001169 Intent[] requestIntents;
1170 String[] requestResolvedTypes;
1171 if (data.readInt() != 0) {
1172 requestIntents = data.createTypedArray(Intent.CREATOR);
1173 requestResolvedTypes = data.createStringArray();
1174 } else {
1175 requestIntents = null;
1176 requestResolvedTypes = null;
1177 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001178 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001179 Bundle options = data.readInt() != 0
1180 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001181 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001183 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001184 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001185 reply.writeNoException();
1186 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1187 return true;
1188 }
1189
1190 case CANCEL_INTENT_SENDER_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 IIntentSender r = IIntentSender.Stub.asInterface(
1193 data.readStrongBinder());
1194 cancelIntentSender(r);
1195 reply.writeNoException();
1196 return true;
1197 }
1198
1199 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1200 data.enforceInterface(IActivityManager.descriptor);
1201 IIntentSender r = IIntentSender.Stub.asInterface(
1202 data.readStrongBinder());
1203 String res = getPackageForIntentSender(r);
1204 reply.writeNoException();
1205 reply.writeString(res);
1206 return true;
1207 }
1208
Christopher Tatec4a07d12012-04-06 14:19:13 -07001209 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1210 data.enforceInterface(IActivityManager.descriptor);
1211 IIntentSender r = IIntentSender.Stub.asInterface(
1212 data.readStrongBinder());
1213 int res = getUidForIntentSender(r);
1214 reply.writeNoException();
1215 reply.writeInt(res);
1216 return true;
1217 }
1218
Dianne Hackborn41203752012-08-31 14:05:51 -07001219 case HANDLE_INCOMING_USER_TRANSACTION: {
1220 data.enforceInterface(IActivityManager.descriptor);
1221 int callingPid = data.readInt();
1222 int callingUid = data.readInt();
1223 int userId = data.readInt();
1224 boolean allowAll = data.readInt() != 0 ;
1225 boolean requireFull = data.readInt() != 0;
1226 String name = data.readString();
1227 String callerPackage = data.readString();
1228 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1229 requireFull, name, callerPackage);
1230 reply.writeNoException();
1231 reply.writeInt(res);
1232 return true;
1233 }
1234
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 case SET_PROCESS_LIMIT_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 int max = data.readInt();
1238 setProcessLimit(max);
1239 reply.writeNoException();
1240 return true;
1241 }
1242
1243 case GET_PROCESS_LIMIT_TRANSACTION: {
1244 data.enforceInterface(IActivityManager.descriptor);
1245 int limit = getProcessLimit();
1246 reply.writeNoException();
1247 reply.writeInt(limit);
1248 return true;
1249 }
1250
1251 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1252 data.enforceInterface(IActivityManager.descriptor);
1253 IBinder token = data.readStrongBinder();
1254 int pid = data.readInt();
1255 boolean isForeground = data.readInt() != 0;
1256 setProcessForeground(token, pid, isForeground);
1257 reply.writeNoException();
1258 return true;
1259 }
1260
1261 case CHECK_PERMISSION_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 String perm = data.readString();
1264 int pid = data.readInt();
1265 int uid = data.readInt();
1266 int res = checkPermission(perm, pid, uid);
1267 reply.writeNoException();
1268 reply.writeInt(res);
1269 return true;
1270 }
1271
Dianne Hackbornff170242014-11-19 10:59:01 -08001272 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1273 data.enforceInterface(IActivityManager.descriptor);
1274 String perm = data.readString();
1275 int pid = data.readInt();
1276 int uid = data.readInt();
1277 IBinder token = data.readStrongBinder();
1278 int res = checkPermissionWithToken(perm, pid, uid, token);
1279 reply.writeNoException();
1280 reply.writeInt(res);
1281 return true;
1282 }
1283
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 case CHECK_URI_PERMISSION_TRANSACTION: {
1285 data.enforceInterface(IActivityManager.descriptor);
1286 Uri uri = Uri.CREATOR.createFromParcel(data);
1287 int pid = data.readInt();
1288 int uid = data.readInt();
1289 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001290 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001291 IBinder callerToken = data.readStrongBinder();
1292 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001293 reply.writeNoException();
1294 reply.writeInt(res);
1295 return true;
1296 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001297
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001298 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001299 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001300 String packageName = data.readString();
1301 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1302 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001303 int userId = data.readInt();
1304 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001305 reply.writeNoException();
1306 reply.writeInt(res ? 1 : 0);
1307 return true;
1308 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 case GRANT_URI_PERMISSION_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 IBinder b = data.readStrongBinder();
1313 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1314 String targetPkg = data.readString();
1315 Uri uri = Uri.CREATOR.createFromParcel(data);
1316 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001317 int userId = data.readInt();
1318 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001319 reply.writeNoException();
1320 return true;
1321 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001322
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001323 case REVOKE_URI_PERMISSION_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 IBinder b = data.readStrongBinder();
1326 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1327 Uri uri = Uri.CREATOR.createFromParcel(data);
1328 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001329 int userId = data.readInt();
1330 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001331 reply.writeNoException();
1332 return true;
1333 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001334
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001335 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 Uri uri = Uri.CREATOR.createFromParcel(data);
1338 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001339 int userId = data.readInt();
1340 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001341 reply.writeNoException();
1342 return true;
1343 }
1344
1345 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 Uri uri = Uri.CREATOR.createFromParcel(data);
1348 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001349 int userId = data.readInt();
1350 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001351 reply.writeNoException();
1352 return true;
1353 }
1354
1355 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1356 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001357 final String packageName = data.readString();
1358 final boolean incoming = data.readInt() != 0;
1359 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1360 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001361 reply.writeNoException();
1362 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1363 return true;
1364 }
1365
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001366 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1367 data.enforceInterface(IActivityManager.descriptor);
1368 IBinder b = data.readStrongBinder();
1369 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1370 boolean waiting = data.readInt() != 0;
1371 showWaitingForDebugger(app, waiting);
1372 reply.writeNoException();
1373 return true;
1374 }
1375
1376 case GET_MEMORY_INFO_TRANSACTION: {
1377 data.enforceInterface(IActivityManager.descriptor);
1378 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1379 getMemoryInfo(mi);
1380 reply.writeNoException();
1381 mi.writeToParcel(reply, 0);
1382 return true;
1383 }
1384
1385 case UNHANDLED_BACK_TRANSACTION: {
1386 data.enforceInterface(IActivityManager.descriptor);
1387 unhandledBack();
1388 reply.writeNoException();
1389 return true;
1390 }
1391
1392 case OPEN_CONTENT_URI_TRANSACTION: {
1393 data.enforceInterface(IActivityManager.descriptor);
1394 Uri uri = Uri.parse(data.readString());
1395 ParcelFileDescriptor pfd = openContentUri(uri);
1396 reply.writeNoException();
1397 if (pfd != null) {
1398 reply.writeInt(1);
1399 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1400 } else {
1401 reply.writeInt(0);
1402 }
1403 return true;
1404 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001405
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001406 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
1408 setLockScreenShown(data.readInt() != 0);
1409 reply.writeNoException();
1410 return true;
1411 }
1412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001413 case SET_DEBUG_APP_TRANSACTION: {
1414 data.enforceInterface(IActivityManager.descriptor);
1415 String pn = data.readString();
1416 boolean wfd = data.readInt() != 0;
1417 boolean per = data.readInt() != 0;
1418 setDebugApp(pn, wfd, per);
1419 reply.writeNoException();
1420 return true;
1421 }
1422
1423 case SET_ALWAYS_FINISH_TRANSACTION: {
1424 data.enforceInterface(IActivityManager.descriptor);
1425 boolean enabled = data.readInt() != 0;
1426 setAlwaysFinish(enabled);
1427 reply.writeNoException();
1428 return true;
1429 }
1430
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001431 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001432 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001433 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001434 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001435 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001436 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001437 return true;
1438 }
1439
1440 case ENTER_SAFE_MODE_TRANSACTION: {
1441 data.enforceInterface(IActivityManager.descriptor);
1442 enterSafeMode();
1443 reply.writeNoException();
1444 return true;
1445 }
1446
1447 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1448 data.enforceInterface(IActivityManager.descriptor);
1449 IIntentSender is = IIntentSender.Stub.asInterface(
1450 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001451 int sourceUid = data.readInt();
1452 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001453 String tag = data.readString();
1454 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1455 reply.writeNoException();
1456 return true;
1457 }
1458
1459 case NOTE_ALARM_START_TRANSACTION: {
1460 data.enforceInterface(IActivityManager.descriptor);
1461 IIntentSender is = IIntentSender.Stub.asInterface(
1462 data.readStrongBinder());
1463 int sourceUid = data.readInt();
1464 String tag = data.readString();
1465 noteAlarmStart(is, sourceUid, tag);
1466 reply.writeNoException();
1467 return true;
1468 }
1469
1470 case NOTE_ALARM_FINISH_TRANSACTION: {
1471 data.enforceInterface(IActivityManager.descriptor);
1472 IIntentSender is = IIntentSender.Stub.asInterface(
1473 data.readStrongBinder());
1474 int sourceUid = data.readInt();
1475 String tag = data.readString();
1476 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001477 reply.writeNoException();
1478 return true;
1479 }
1480
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001481 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001482 data.enforceInterface(IActivityManager.descriptor);
1483 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001484 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001485 boolean secure = data.readInt() != 0;
1486 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001487 reply.writeNoException();
1488 reply.writeInt(res ? 1 : 0);
1489 return true;
1490 }
1491
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001492 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1493 data.enforceInterface(IActivityManager.descriptor);
1494 String reason = data.readString();
1495 boolean res = killProcessesBelowForeground(reason);
1496 reply.writeNoException();
1497 reply.writeInt(res ? 1 : 0);
1498 return true;
1499 }
1500
Dan Egnor60d87622009-12-16 16:32:58 -08001501 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
1503 IBinder app = data.readStrongBinder();
1504 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1505 handleApplicationCrash(app, ci);
1506 reply.writeNoException();
1507 return true;
1508 }
1509
1510 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001511 data.enforceInterface(IActivityManager.descriptor);
1512 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001513 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001514 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001515 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001516 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001517 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001518 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001519 return true;
1520 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001521
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001522 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1523 data.enforceInterface(IActivityManager.descriptor);
1524 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001525 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001526 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1527 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001528 reply.writeNoException();
1529 return true;
1530 }
1531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001532 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1533 data.enforceInterface(IActivityManager.descriptor);
1534 int sig = data.readInt();
1535 signalPersistentProcesses(sig);
1536 reply.writeNoException();
1537 return true;
1538 }
1539
Dianne Hackborn03abb812010-01-04 18:43:19 -08001540 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1541 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001542 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001543 int userId = data.readInt();
1544 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001545 reply.writeNoException();
1546 return true;
1547 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001548
1549 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1550 data.enforceInterface(IActivityManager.descriptor);
1551 killAllBackgroundProcesses();
1552 reply.writeNoException();
1553 return true;
1554 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001555
Dianne Hackborn03abb812010-01-04 18:43:19 -08001556 case FORCE_STOP_PACKAGE_TRANSACTION: {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001559 int userId = data.readInt();
1560 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001561 reply.writeNoException();
1562 return true;
1563 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001564
1565 case GET_MY_MEMORY_STATE_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 ActivityManager.RunningAppProcessInfo info =
1568 new ActivityManager.RunningAppProcessInfo();
1569 getMyMemoryState(info);
1570 reply.writeNoException();
1571 info.writeToParcel(reply, 0);
1572 return true;
1573 }
1574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001575 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1576 data.enforceInterface(IActivityManager.descriptor);
1577 ConfigurationInfo config = getDeviceConfigurationInfo();
1578 reply.writeNoException();
1579 config.writeToParcel(reply, 0);
1580 return true;
1581 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001582
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001583 case PROFILE_CONTROL_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001586 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001587 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001588 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001589 ProfilerInfo profilerInfo = data.readInt() != 0
1590 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1591 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001592 reply.writeNoException();
1593 reply.writeInt(res ? 1 : 0);
1594 return true;
1595 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001596
Dianne Hackborn55280a92009-05-07 15:53:46 -07001597 case SHUTDOWN_TRANSACTION: {
1598 data.enforceInterface(IActivityManager.descriptor);
1599 boolean res = shutdown(data.readInt());
1600 reply.writeNoException();
1601 reply.writeInt(res ? 1 : 0);
1602 return true;
1603 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001604
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001605 case STOP_APP_SWITCHES_TRANSACTION: {
1606 data.enforceInterface(IActivityManager.descriptor);
1607 stopAppSwitches();
1608 reply.writeNoException();
1609 return true;
1610 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001611
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001612 case RESUME_APP_SWITCHES_TRANSACTION: {
1613 data.enforceInterface(IActivityManager.descriptor);
1614 resumeAppSwitches();
1615 reply.writeNoException();
1616 return true;
1617 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001618
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001619 case PEEK_SERVICE_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 Intent service = Intent.CREATOR.createFromParcel(data);
1622 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001623 String callingPackage = data.readString();
1624 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001625 reply.writeNoException();
1626 reply.writeStrongBinder(binder);
1627 return true;
1628 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001629
Christopher Tate181fafa2009-05-14 11:12:14 -07001630 case START_BACKUP_AGENT_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
1632 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1633 int backupRestoreMode = data.readInt();
1634 boolean success = bindBackupAgent(info, backupRestoreMode);
1635 reply.writeNoException();
1636 reply.writeInt(success ? 1 : 0);
1637 return true;
1638 }
1639
1640 case BACKUP_AGENT_CREATED_TRANSACTION: {
1641 data.enforceInterface(IActivityManager.descriptor);
1642 String packageName = data.readString();
1643 IBinder agent = data.readStrongBinder();
1644 backupAgentCreated(packageName, agent);
1645 reply.writeNoException();
1646 return true;
1647 }
1648
1649 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1650 data.enforceInterface(IActivityManager.descriptor);
1651 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1652 unbindBackupAgent(info);
1653 reply.writeNoException();
1654 return true;
1655 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001656
1657 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 String packageName = data.readString();
1660 addPackageDependency(packageName);
1661 reply.writeNoException();
1662 return true;
1663 }
1664
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001665 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001666 data.enforceInterface(IActivityManager.descriptor);
1667 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001668 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001669 String reason = data.readString();
1670 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001671 reply.writeNoException();
1672 return true;
1673 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001674
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001675 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1676 data.enforceInterface(IActivityManager.descriptor);
1677 String reason = data.readString();
1678 closeSystemDialogs(reason);
1679 reply.writeNoException();
1680 return true;
1681 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001682
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001683 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001685 int[] pids = data.createIntArray();
1686 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001687 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001688 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001689 return true;
1690 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001691
1692 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1693 data.enforceInterface(IActivityManager.descriptor);
1694 String processName = data.readString();
1695 int uid = data.readInt();
1696 killApplicationProcess(processName, uid);
1697 reply.writeNoException();
1698 return true;
1699 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001700
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001701 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1702 data.enforceInterface(IActivityManager.descriptor);
1703 IBinder token = data.readStrongBinder();
1704 String packageName = data.readString();
1705 int enterAnim = data.readInt();
1706 int exitAnim = data.readInt();
1707 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001708 reply.writeNoException();
1709 return true;
1710 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001711
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001712 case IS_USER_A_MONKEY_TRANSACTION: {
1713 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001714 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001715 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001716 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001717 return true;
1718 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001719
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001720 case SET_USER_IS_MONKEY_TRANSACTION: {
1721 data.enforceInterface(IActivityManager.descriptor);
1722 final boolean monkey = (data.readInt() == 1);
1723 setUserIsMonkey(monkey);
1724 reply.writeNoException();
1725 return true;
1726 }
1727
Dianne Hackborn860755f2010-06-03 18:47:52 -07001728 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 finishHeavyWeightApp();
1731 reply.writeNoException();
1732 return true;
1733 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001734
1735 case IS_IMMERSIVE_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
1737 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001738 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001739 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001740 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001741 return true;
1742 }
1743
Craig Mautnerd61dc202014-07-07 11:09:11 -07001744 case IS_TOP_OF_TASK_TRANSACTION: {
1745 data.enforceInterface(IActivityManager.descriptor);
1746 IBinder token = data.readStrongBinder();
1747 final boolean isTopOfTask = isTopOfTask(token);
1748 reply.writeNoException();
1749 reply.writeInt(isTopOfTask ? 1 : 0);
1750 return true;
1751 }
1752
Craig Mautner5eda9b32013-07-02 11:58:16 -07001753 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001754 data.enforceInterface(IActivityManager.descriptor);
1755 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001756 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001757 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001758 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001759 return true;
1760 }
1761
1762 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1763 data.enforceInterface(IActivityManager.descriptor);
1764 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001765 final Bundle bundle;
1766 if (data.readInt() == 0) {
1767 bundle = null;
1768 } else {
1769 bundle = data.readBundle();
1770 }
Chong Zhang280d3322015-11-03 17:27:26 -08001771 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001772 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001773 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001774 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001775 return true;
1776 }
1777
Craig Mautner233ceee2014-05-09 17:05:11 -07001778 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 IBinder token = data.readStrongBinder();
1781 final ActivityOptions options = getActivityOptions(token);
1782 reply.writeNoException();
1783 reply.writeBundle(options == null ? null : options.toBundle());
1784 return true;
1785 }
1786
Daniel Sandler69a48172010-06-23 16:29:36 -04001787 case SET_IMMERSIVE_TRANSACTION: {
1788 data.enforceInterface(IActivityManager.descriptor);
1789 IBinder token = data.readStrongBinder();
1790 boolean imm = data.readInt() == 1;
1791 setImmersive(token, imm);
1792 reply.writeNoException();
1793 return true;
1794 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001795
Daniel Sandler69a48172010-06-23 16:29:36 -04001796 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001798 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001799 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001800 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001801 return true;
1802 }
1803
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001804 case CRASH_APPLICATION_TRANSACTION: {
1805 data.enforceInterface(IActivityManager.descriptor);
1806 int uid = data.readInt();
1807 int initialPid = data.readInt();
1808 String packageName = data.readString();
1809 String message = data.readString();
1810 crashApplication(uid, initialPid, packageName, message);
1811 reply.writeNoException();
1812 return true;
1813 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001814
1815 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1816 data.enforceInterface(IActivityManager.descriptor);
1817 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001818 int userId = data.readInt();
1819 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001820 reply.writeNoException();
1821 reply.writeString(type);
1822 return true;
1823 }
1824
Dianne Hackborn7e269642010-08-25 19:50:20 -07001825 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1826 data.enforceInterface(IActivityManager.descriptor);
1827 String name = data.readString();
1828 IBinder perm = newUriPermissionOwner(name);
1829 reply.writeNoException();
1830 reply.writeStrongBinder(perm);
1831 return true;
1832 }
1833
1834 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1835 data.enforceInterface(IActivityManager.descriptor);
1836 IBinder owner = data.readStrongBinder();
1837 int fromUid = data.readInt();
1838 String targetPkg = data.readString();
1839 Uri uri = Uri.CREATOR.createFromParcel(data);
1840 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001841 int sourceUserId = data.readInt();
1842 int targetUserId = data.readInt();
1843 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1844 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001845 reply.writeNoException();
1846 return true;
1847 }
1848
1849 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 IBinder owner = data.readStrongBinder();
1852 Uri uri = null;
1853 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001854 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001855 }
1856 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001857 int userId = data.readInt();
1858 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001859 reply.writeNoException();
1860 return true;
1861 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001862
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001863 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1864 data.enforceInterface(IActivityManager.descriptor);
1865 int callingUid = data.readInt();
1866 String targetPkg = data.readString();
1867 Uri uri = Uri.CREATOR.createFromParcel(data);
1868 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001869 int userId = data.readInt();
1870 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001871 reply.writeNoException();
1872 reply.writeInt(res);
1873 return true;
1874 }
1875
Andy McFadden824c5102010-07-09 16:26:57 -07001876 case DUMP_HEAP_TRANSACTION: {
1877 data.enforceInterface(IActivityManager.descriptor);
1878 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001879 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001880 boolean managed = data.readInt() != 0;
1881 String path = data.readString();
1882 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001883 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001884 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001885 reply.writeNoException();
1886 reply.writeInt(res ? 1 : 0);
1887 return true;
1888 }
1889
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001890 case START_ACTIVITIES_TRANSACTION:
1891 {
1892 data.enforceInterface(IActivityManager.descriptor);
1893 IBinder b = data.readStrongBinder();
1894 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001895 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001896 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1897 String[] resolvedTypes = data.createStringArray();
1898 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001899 Bundle options = data.readInt() != 0
1900 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001901 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001902 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001903 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001904 reply.writeNoException();
1905 reply.writeInt(result);
1906 return true;
1907 }
1908
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001909 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1910 {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 int mode = getFrontActivityScreenCompatMode();
1913 reply.writeNoException();
1914 reply.writeInt(mode);
1915 return true;
1916 }
1917
1918 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1919 {
1920 data.enforceInterface(IActivityManager.descriptor);
1921 int mode = data.readInt();
1922 setFrontActivityScreenCompatMode(mode);
1923 reply.writeNoException();
1924 reply.writeInt(mode);
1925 return true;
1926 }
1927
1928 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1929 {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 String pkg = data.readString();
1932 int mode = getPackageScreenCompatMode(pkg);
1933 reply.writeNoException();
1934 reply.writeInt(mode);
1935 return true;
1936 }
1937
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001938 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1939 {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001942 int mode = data.readInt();
1943 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001944 reply.writeNoException();
1945 return true;
1946 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001947
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001948 case SWITCH_USER_TRANSACTION: {
1949 data.enforceInterface(IActivityManager.descriptor);
1950 int userid = data.readInt();
1951 boolean result = switchUser(userid);
1952 reply.writeNoException();
1953 reply.writeInt(result ? 1 : 0);
1954 return true;
1955 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001956
Kenny Guy08488bf2014-02-21 17:40:37 +00001957 case START_USER_IN_BACKGROUND_TRANSACTION: {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 int userid = data.readInt();
1960 boolean result = startUserInBackground(userid);
1961 reply.writeNoException();
1962 reply.writeInt(result ? 1 : 0);
1963 return true;
1964 }
1965
Jeff Sharkeyba512352015-11-12 20:17:45 -08001966 case UNLOCK_USER_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 int userId = data.readInt();
1969 byte[] token = data.createByteArray();
1970 boolean result = unlockUser(userId, token);
1971 reply.writeNoException();
1972 reply.writeInt(result ? 1 : 0);
1973 return true;
1974 }
1975
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001976 case STOP_USER_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 int userid = data.readInt();
1979 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1980 data.readStrongBinder());
1981 int result = stopUser(userid, callback);
1982 reply.writeNoException();
1983 reply.writeInt(result);
1984 return true;
1985 }
1986
Amith Yamasani52f1d752012-03-28 18:19:29 -07001987 case GET_CURRENT_USER_TRANSACTION: {
1988 data.enforceInterface(IActivityManager.descriptor);
1989 UserInfo userInfo = getCurrentUser();
1990 reply.writeNoException();
1991 userInfo.writeToParcel(reply, 0);
1992 return true;
1993 }
1994
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001995 case IS_USER_RUNNING_TRANSACTION: {
1996 data.enforceInterface(IActivityManager.descriptor);
1997 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08001998 int _flags = data.readInt();
1999 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002000 reply.writeNoException();
2001 reply.writeInt(result ? 1 : 0);
2002 return true;
2003 }
2004
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002005 case GET_RUNNING_USER_IDS_TRANSACTION: {
2006 data.enforceInterface(IActivityManager.descriptor);
2007 int[] result = getRunningUserIds();
2008 reply.writeNoException();
2009 reply.writeIntArray(result);
2010 return true;
2011 }
2012
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002013 case REMOVE_TASK_TRANSACTION:
2014 {
2015 data.enforceInterface(IActivityManager.descriptor);
2016 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002017 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002018 reply.writeNoException();
2019 reply.writeInt(result ? 1 : 0);
2020 return true;
2021 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002022
Jeff Sharkeya4620792011-05-20 15:29:23 -07002023 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2024 data.enforceInterface(IActivityManager.descriptor);
2025 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2026 data.readStrongBinder());
2027 registerProcessObserver(observer);
2028 return true;
2029 }
2030
2031 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2032 data.enforceInterface(IActivityManager.descriptor);
2033 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2034 data.readStrongBinder());
2035 unregisterProcessObserver(observer);
2036 return true;
2037 }
2038
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002039 case REGISTER_UID_OBSERVER_TRANSACTION: {
2040 data.enforceInterface(IActivityManager.descriptor);
2041 IUidObserver observer = IUidObserver.Stub.asInterface(
2042 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002043 int which = data.readInt();
2044 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002045 return true;
2046 }
2047
2048 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2049 data.enforceInterface(IActivityManager.descriptor);
2050 IUidObserver observer = IUidObserver.Stub.asInterface(
2051 data.readStrongBinder());
2052 unregisterUidObserver(observer);
2053 return true;
2054 }
2055
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002056 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2057 {
2058 data.enforceInterface(IActivityManager.descriptor);
2059 String pkg = data.readString();
2060 boolean ask = getPackageAskScreenCompat(pkg);
2061 reply.writeNoException();
2062 reply.writeInt(ask ? 1 : 0);
2063 return true;
2064 }
2065
2066 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2067 {
2068 data.enforceInterface(IActivityManager.descriptor);
2069 String pkg = data.readString();
2070 boolean ask = data.readInt() != 0;
2071 setPackageAskScreenCompat(pkg, ask);
2072 reply.writeNoException();
2073 return true;
2074 }
2075
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002076 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2077 data.enforceInterface(IActivityManager.descriptor);
2078 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002079 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002080 boolean res = isIntentSenderTargetedToPackage(r);
2081 reply.writeNoException();
2082 reply.writeInt(res ? 1 : 0);
2083 return true;
2084 }
2085
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002086 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2087 data.enforceInterface(IActivityManager.descriptor);
2088 IIntentSender r = IIntentSender.Stub.asInterface(
2089 data.readStrongBinder());
2090 boolean res = isIntentSenderAnActivity(r);
2091 reply.writeNoException();
2092 reply.writeInt(res ? 1 : 0);
2093 return true;
2094 }
2095
Dianne Hackborn81038902012-11-26 17:04:09 -08002096 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2097 data.enforceInterface(IActivityManager.descriptor);
2098 IIntentSender r = IIntentSender.Stub.asInterface(
2099 data.readStrongBinder());
2100 Intent intent = getIntentForIntentSender(r);
2101 reply.writeNoException();
2102 if (intent != null) {
2103 reply.writeInt(1);
2104 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2105 } else {
2106 reply.writeInt(0);
2107 }
2108 return true;
2109 }
2110
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002111 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2112 data.enforceInterface(IActivityManager.descriptor);
2113 IIntentSender r = IIntentSender.Stub.asInterface(
2114 data.readStrongBinder());
2115 String prefix = data.readString();
2116 String tag = getTagForIntentSender(r, prefix);
2117 reply.writeNoException();
2118 reply.writeString(tag);
2119 return true;
2120 }
2121
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002122 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2123 data.enforceInterface(IActivityManager.descriptor);
2124 Configuration config = Configuration.CREATOR.createFromParcel(data);
2125 updatePersistentConfiguration(config);
2126 reply.writeNoException();
2127 return true;
2128 }
2129
Dianne Hackbornb437e092011-08-05 17:50:29 -07002130 case GET_PROCESS_PSS_TRANSACTION: {
2131 data.enforceInterface(IActivityManager.descriptor);
2132 int[] pids = data.createIntArray();
2133 long[] pss = getProcessPss(pids);
2134 reply.writeNoException();
2135 reply.writeLongArray(pss);
2136 return true;
2137 }
2138
Dianne Hackborn661cd522011-08-22 00:26:20 -07002139 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2140 data.enforceInterface(IActivityManager.descriptor);
2141 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2142 boolean always = data.readInt() != 0;
2143 showBootMessage(msg, always);
2144 reply.writeNoException();
2145 return true;
2146 }
2147
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002148 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002149 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002150 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002151 reply.writeNoException();
2152 return true;
2153 }
2154
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002155 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2156 data.enforceInterface(IActivityManager.descriptor);
2157 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2158 reply.writeNoException();
2159 return true;
2160 }
2161
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002162 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002163 data.enforceInterface(IActivityManager.descriptor);
2164 IBinder token = data.readStrongBinder();
2165 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002166 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002167 reply.writeNoException();
2168 reply.writeInt(res ? 1 : 0);
2169 return true;
2170 }
2171
2172 case NAVIGATE_UP_TO_TRANSACTION: {
2173 data.enforceInterface(IActivityManager.descriptor);
2174 IBinder token = data.readStrongBinder();
2175 Intent target = Intent.CREATOR.createFromParcel(data);
2176 int resultCode = data.readInt();
2177 Intent resultData = null;
2178 if (data.readInt() != 0) {
2179 resultData = Intent.CREATOR.createFromParcel(data);
2180 }
2181 boolean res = navigateUpTo(token, target, resultCode, resultData);
2182 reply.writeNoException();
2183 reply.writeInt(res ? 1 : 0);
2184 return true;
2185 }
2186
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002187 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2188 data.enforceInterface(IActivityManager.descriptor);
2189 IBinder token = data.readStrongBinder();
2190 int res = getLaunchedFromUid(token);
2191 reply.writeNoException();
2192 reply.writeInt(res);
2193 return true;
2194 }
2195
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002196 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2197 data.enforceInterface(IActivityManager.descriptor);
2198 IBinder token = data.readStrongBinder();
2199 String res = getLaunchedFromPackage(token);
2200 reply.writeNoException();
2201 reply.writeString(res);
2202 return true;
2203 }
2204
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002205 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2206 data.enforceInterface(IActivityManager.descriptor);
2207 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2208 data.readStrongBinder());
2209 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002210 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002211 return true;
2212 }
2213
2214 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2215 data.enforceInterface(IActivityManager.descriptor);
2216 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2217 data.readStrongBinder());
2218 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002219 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002220 return true;
2221 }
2222
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002223 case REQUEST_BUG_REPORT_TRANSACTION: {
2224 data.enforceInterface(IActivityManager.descriptor);
2225 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002226 reply.writeNoException();
2227 return true;
2228 }
2229
2230 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2231 data.enforceInterface(IActivityManager.descriptor);
2232 int pid = data.readInt();
2233 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002234 String reason = data.readString();
2235 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002236 reply.writeNoException();
2237 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002238 return true;
2239 }
2240
Adam Skorydfc7fd72013-08-05 19:23:41 -07002241 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002242 data.enforceInterface(IActivityManager.descriptor);
2243 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002244 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002245 reply.writeNoException();
2246 reply.writeBundle(res);
2247 return true;
2248 }
2249
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002250 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2251 data.enforceInterface(IActivityManager.descriptor);
2252 int requestType = data.readInt();
2253 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002254 IBinder activityToken = data.readStrongBinder();
2255 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002256 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002257 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002258 return true;
2259 }
2260
Adam Skorydfc7fd72013-08-05 19:23:41 -07002261 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002262 data.enforceInterface(IActivityManager.descriptor);
2263 IBinder token = data.readStrongBinder();
2264 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002265 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2266 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002267 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2268 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002269 reply.writeNoException();
2270 return true;
2271 }
2272
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002273 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2274 data.enforceInterface(IActivityManager.descriptor);
2275 Intent intent = Intent.CREATOR.createFromParcel(data);
2276 int requestType = data.readInt();
2277 String hint = data.readString();
2278 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002279 Bundle args = data.readBundle();
2280 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002281 reply.writeNoException();
2282 reply.writeInt(res ? 1 : 0);
2283 return true;
2284 }
2285
Benjamin Franzc200f442015-06-25 18:20:04 +01002286 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2287 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002288 boolean res = isAssistDataAllowedOnCurrentActivity();
2289 reply.writeNoException();
2290 reply.writeInt(res ? 1 : 0);
2291 return true;
2292 }
2293
2294 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2295 data.enforceInterface(IActivityManager.descriptor);
2296 IBinder token = data.readStrongBinder();
2297 Bundle args = data.readBundle();
2298 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002299 reply.writeNoException();
2300 reply.writeInt(res ? 1 : 0);
2301 return true;
2302 }
2303
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002304 case KILL_UID_TRANSACTION: {
2305 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002306 int appId = data.readInt();
2307 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002308 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002309 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002310 reply.writeNoException();
2311 return true;
2312 }
2313
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002314 case HANG_TRANSACTION: {
2315 data.enforceInterface(IActivityManager.descriptor);
2316 IBinder who = data.readStrongBinder();
2317 boolean allowRestart = data.readInt() != 0;
2318 hang(who, allowRestart);
2319 reply.writeNoException();
2320 return true;
2321 }
2322
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002323 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2324 data.enforceInterface(IActivityManager.descriptor);
2325 IBinder token = data.readStrongBinder();
2326 reportActivityFullyDrawn(token);
2327 reply.writeNoException();
2328 return true;
2329 }
2330
Craig Mautner5eda9b32013-07-02 11:58:16 -07002331 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2332 data.enforceInterface(IActivityManager.descriptor);
2333 IBinder token = data.readStrongBinder();
2334 notifyActivityDrawn(token);
2335 reply.writeNoException();
2336 return true;
2337 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002338
2339 case RESTART_TRANSACTION: {
2340 data.enforceInterface(IActivityManager.descriptor);
2341 restart();
2342 reply.writeNoException();
2343 return true;
2344 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002345
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002346 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2347 data.enforceInterface(IActivityManager.descriptor);
2348 performIdleMaintenance();
2349 reply.writeNoException();
2350 return true;
2351 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002352
Todd Kennedyca4d8422015-01-15 15:19:22 -08002353 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002354 data.enforceInterface(IActivityManager.descriptor);
2355 IBinder parentActivityToken = data.readStrongBinder();
2356 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002357 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002358 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002359 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002360 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002361 if (activityContainer != null) {
2362 reply.writeInt(1);
2363 reply.writeStrongBinder(activityContainer.asBinder());
2364 } else {
2365 reply.writeInt(0);
2366 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002367 return true;
2368 }
2369
Craig Mautner95da1082014-02-24 17:54:35 -08002370 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2371 data.enforceInterface(IActivityManager.descriptor);
2372 IActivityContainer activityContainer =
2373 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2374 deleteActivityContainer(activityContainer);
2375 reply.writeNoException();
2376 return true;
2377 }
2378
Todd Kennedy4900bf92015-01-16 16:05:14 -08002379 case CREATE_STACK_ON_DISPLAY: {
2380 data.enforceInterface(IActivityManager.descriptor);
2381 int displayId = data.readInt();
2382 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2383 reply.writeNoException();
2384 if (activityContainer != null) {
2385 reply.writeInt(1);
2386 reply.writeStrongBinder(activityContainer.asBinder());
2387 } else {
2388 reply.writeInt(0);
2389 }
2390 return true;
2391 }
2392
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002393 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002394 data.enforceInterface(IActivityManager.descriptor);
2395 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002396 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002397 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002398 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002399 return true;
2400 }
2401
Craig Mautneraea74a52014-03-08 14:23:10 -08002402 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2403 data.enforceInterface(IActivityManager.descriptor);
2404 final int taskId = data.readInt();
2405 startLockTaskMode(taskId);
2406 reply.writeNoException();
2407 return true;
2408 }
2409
2410 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2411 data.enforceInterface(IActivityManager.descriptor);
2412 IBinder token = data.readStrongBinder();
2413 startLockTaskMode(token);
2414 reply.writeNoException();
2415 return true;
2416 }
2417
Craig Mautnerd61dc202014-07-07 11:09:11 -07002418 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002419 data.enforceInterface(IActivityManager.descriptor);
2420 startLockTaskModeOnCurrent();
2421 reply.writeNoException();
2422 return true;
2423 }
2424
Craig Mautneraea74a52014-03-08 14:23:10 -08002425 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2426 data.enforceInterface(IActivityManager.descriptor);
2427 stopLockTaskMode();
2428 reply.writeNoException();
2429 return true;
2430 }
2431
Craig Mautnerd61dc202014-07-07 11:09:11 -07002432 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002433 data.enforceInterface(IActivityManager.descriptor);
2434 stopLockTaskModeOnCurrent();
2435 reply.writeNoException();
2436 return true;
2437 }
2438
Craig Mautneraea74a52014-03-08 14:23:10 -08002439 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2440 data.enforceInterface(IActivityManager.descriptor);
2441 final boolean isInLockTaskMode = isInLockTaskMode();
2442 reply.writeNoException();
2443 reply.writeInt(isInLockTaskMode ? 1 : 0);
2444 return true;
2445 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002446
Benjamin Franz43261142015-02-11 15:59:44 +00002447 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2448 data.enforceInterface(IActivityManager.descriptor);
2449 final int lockTaskModeState = getLockTaskModeState();
2450 reply.writeNoException();
2451 reply.writeInt(lockTaskModeState);
2452 return true;
2453 }
2454
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002455 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2456 data.enforceInterface(IActivityManager.descriptor);
2457 final IBinder token = data.readStrongBinder();
2458 showLockTaskEscapeMessage(token);
2459 reply.writeNoException();
2460 return true;
2461 }
2462
Winson Chunga449dc02014-05-16 11:15:04 -07002463 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002464 data.enforceInterface(IActivityManager.descriptor);
2465 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002466 ActivityManager.TaskDescription values =
2467 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2468 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002469 reply.writeNoException();
2470 return true;
2471 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002472
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002473 case SET_TASK_RESIZEABLE_TRANSACTION: {
2474 data.enforceInterface(IActivityManager.descriptor);
2475 int taskId = data.readInt();
2476 boolean resizeable = (data.readInt() == 1) ? true : false;
2477 setTaskResizeable(taskId, resizeable);
2478 reply.writeNoException();
2479 return true;
2480 }
2481
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002482 case RESIZE_TASK_TRANSACTION: {
2483 data.enforceInterface(IActivityManager.descriptor);
2484 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002485 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002486 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002487 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002488 reply.writeNoException();
2489 return true;
2490 }
2491
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002492 case GET_TASK_BOUNDS_TRANSACTION: {
2493 data.enforceInterface(IActivityManager.descriptor);
2494 int taskId = data.readInt();
2495 Rect r = getTaskBounds(taskId);
2496 reply.writeNoException();
2497 r.writeToParcel(reply, 0);
2498 return true;
2499 }
2500
Craig Mautner648f69b2014-09-18 14:16:26 -07002501 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2502 data.enforceInterface(IActivityManager.descriptor);
2503 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002504 int userId = data.readInt();
2505 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002506 reply.writeNoException();
2507 if (icon == null) {
2508 reply.writeInt(0);
2509 } else {
2510 reply.writeInt(1);
2511 icon.writeToParcel(reply, 0);
2512 }
2513 return true;
2514 }
2515
Winson Chung044d5292014-11-06 11:05:19 -08002516 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2517 data.enforceInterface(IActivityManager.descriptor);
2518 final Bundle bundle;
2519 if (data.readInt() == 0) {
2520 bundle = null;
2521 } else {
2522 bundle = data.readBundle();
2523 }
Chong Zhang280d3322015-11-03 17:27:26 -08002524 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002525 startInPlaceAnimationOnFrontMostApplication(options);
2526 reply.writeNoException();
2527 return true;
2528 }
2529
Jose Lima4b6c6692014-08-12 17:41:12 -07002530 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002531 data.enforceInterface(IActivityManager.descriptor);
2532 IBinder token = data.readStrongBinder();
2533 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002534 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002535 reply.writeNoException();
2536 reply.writeInt(success ? 1 : 0);
2537 return true;
2538 }
2539
Jose Lima4b6c6692014-08-12 17:41:12 -07002540 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002541 data.enforceInterface(IActivityManager.descriptor);
2542 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002543 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002544 reply.writeNoException();
2545 reply.writeInt(enabled ? 1 : 0);
2546 return true;
2547 }
2548
Jose Lima4b6c6692014-08-12 17:41:12 -07002549 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002550 data.enforceInterface(IActivityManager.descriptor);
2551 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002552 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002553 reply.writeNoException();
2554 return true;
2555 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002556
2557 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2558 data.enforceInterface(IActivityManager.descriptor);
2559 IBinder token = data.readStrongBinder();
2560 notifyLaunchTaskBehindComplete(token);
2561 reply.writeNoException();
2562 return true;
2563 }
Craig Mautner8746a472014-07-24 15:12:54 -07002564
2565 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2566 data.enforceInterface(IActivityManager.descriptor);
2567 IBinder token = data.readStrongBinder();
2568 notifyEnterAnimationComplete(token);
2569 reply.writeNoException();
2570 return true;
2571 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002572
2573 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2574 data.enforceInterface(IActivityManager.descriptor);
2575 bootAnimationComplete();
2576 reply.writeNoException();
2577 return true;
2578 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002579
Jeff Sharkey605eb792014-11-04 13:34:06 -08002580 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2581 data.enforceInterface(IActivityManager.descriptor);
2582 final int uid = data.readInt();
2583 final byte[] firstPacket = data.createByteArray();
2584 notifyCleartextNetwork(uid, firstPacket);
2585 reply.writeNoException();
2586 return true;
2587 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002588
2589 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2590 data.enforceInterface(IActivityManager.descriptor);
2591 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002592 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002593 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002594 String reportPackage = data.readString();
2595 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002596 reply.writeNoException();
2597 return true;
2598 }
2599
2600 case DUMP_HEAP_FINISHED_TRANSACTION: {
2601 data.enforceInterface(IActivityManager.descriptor);
2602 String path = data.readString();
2603 dumpHeapFinished(path);
2604 reply.writeNoException();
2605 return true;
2606 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002607
2608 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2609 data.enforceInterface(IActivityManager.descriptor);
2610 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2611 data.readStrongBinder());
2612 boolean keepAwake = data.readInt() != 0;
2613 setVoiceKeepAwake(session, keepAwake);
2614 reply.writeNoException();
2615 return true;
2616 }
Craig Mautnere5600772015-04-03 21:36:37 -07002617
2618 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2619 data.enforceInterface(IActivityManager.descriptor);
2620 int userId = data.readInt();
2621 String[] packages = data.readStringArray();
2622 updateLockTaskPackages(userId, packages);
2623 reply.writeNoException();
2624 return true;
2625 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002626
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002627 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2628 data.enforceInterface(IActivityManager.descriptor);
2629 String packageName = data.readString();
2630 updateDeviceOwner(packageName);
2631 reply.writeNoException();
2632 return true;
2633 }
2634
Dianne Hackborn1e383822015-04-10 14:02:33 -07002635 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2636 data.enforceInterface(IActivityManager.descriptor);
2637 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002638 String callingPackage = data.readString();
2639 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002640 reply.writeNoException();
2641 reply.writeInt(res);
2642 return true;
2643 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002644
2645 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2646 data.enforceInterface(IActivityManager.descriptor);
2647 String process = data.readString();
2648 int userId = data.readInt();
2649 int level = data.readInt();
2650 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2651 reply.writeNoException();
2652 reply.writeInt(res ? 1 : 0);
2653 return true;
2654 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002655
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002656 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2657 data.enforceInterface(IActivityManager.descriptor);
2658 IBinder token = data.readStrongBinder();
2659 boolean res = isRootVoiceInteraction(token);
2660 reply.writeNoException();
2661 reply.writeInt(res ? 1 : 0);
2662 return true;
2663 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002664
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002665 case START_BINDER_TRACKING_TRANSACTION: {
2666 data.enforceInterface(IActivityManager.descriptor);
2667 boolean res = startBinderTracking();
2668 reply.writeNoException();
2669 reply.writeInt(res ? 1 : 0);
2670 return true;
2671 }
2672
2673 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2674 data.enforceInterface(IActivityManager.descriptor);
2675 ParcelFileDescriptor fd = data.readInt() != 0
2676 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2677 boolean res = stopBinderTrackingAndDump(fd);
2678 reply.writeNoException();
2679 reply.writeInt(res ? 1 : 0);
2680 return true;
2681 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002682 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2683 data.enforceInterface(IActivityManager.descriptor);
2684 IBinder token = data.readStrongBinder();
2685 int stackId = getActivityStackId(token);
2686 reply.writeNoException();
2687 reply.writeInt(stackId);
2688 return true;
2689 }
2690 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2691 data.enforceInterface(IActivityManager.descriptor);
2692 IBinder token = data.readStrongBinder();
2693 int stackId = data.readInt();
2694 moveActivityToStack(token, stackId);
2695 reply.writeNoException();
2696 return true;
2697 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002698 case REPORT_SIZE_CONFIGURATIONS: {
2699 data.enforceInterface(IActivityManager.descriptor);
2700 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002701 int[] horizontal = readIntArray(data);
2702 int[] vertical = readIntArray(data);
2703 int[] smallest = readIntArray(data);
2704 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002705 return true;
2706 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002707 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2708 data.enforceInterface(IActivityManager.descriptor);
2709 final boolean suppress = data.readInt() == 1;
2710 suppressResizeConfigChanges(suppress);
2711 reply.writeNoException();
2712 return true;
2713 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002714 case REMOVE_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002715 data.enforceInterface(IActivityManager.descriptor);
2716 final int stackId = data.readInt();
2717 removeStack(stackId);
2718 reply.writeNoException();
2719 return true;
2720 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002721 case GET_APP_START_MODE_TRANSACTION: {
2722 data.enforceInterface(IActivityManager.descriptor);
2723 final int uid = data.readInt();
2724 final String pkg = data.readString();
2725 int res = getAppStartMode(uid, pkg);
2726 reply.writeNoException();
2727 reply.writeInt(res);
2728 return true;
2729 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002730 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002731
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002732 return super.onTransact(code, data, reply, flags);
2733 }
2734
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002735 private int[] readIntArray(Parcel data) {
2736 int[] smallest = null;
2737 int smallestSize = data.readInt();
2738 if (smallestSize > 0) {
2739 smallest = new int[smallestSize];
2740 data.readIntArray(smallest);
2741 }
2742 return smallest;
2743 }
2744
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002745 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 return this;
2747 }
2748
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002749 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2750 protected IActivityManager create() {
2751 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002752 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002753 Log.v("ActivityManager", "default service binder = " + b);
2754 }
2755 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002756 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002757 Log.v("ActivityManager", "default service = " + am);
2758 }
2759 return am;
2760 }
2761 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002762}
2763
2764class ActivityManagerProxy implements IActivityManager
2765{
2766 public ActivityManagerProxy(IBinder remote)
2767 {
2768 mRemote = remote;
2769 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002770
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 public IBinder asBinder()
2772 {
2773 return mRemote;
2774 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002775
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002776 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002777 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002778 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002779 Parcel data = Parcel.obtain();
2780 Parcel reply = Parcel.obtain();
2781 data.writeInterfaceToken(IActivityManager.descriptor);
2782 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002783 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784 intent.writeToParcel(data, 0);
2785 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002786 data.writeStrongBinder(resultTo);
2787 data.writeString(resultWho);
2788 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002789 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002790 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002791 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002792 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002793 } else {
2794 data.writeInt(0);
2795 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002796 if (options != null) {
2797 data.writeInt(1);
2798 options.writeToParcel(data, 0);
2799 } else {
2800 data.writeInt(0);
2801 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002802 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2803 reply.readException();
2804 int result = reply.readInt();
2805 reply.recycle();
2806 data.recycle();
2807 return result;
2808 }
Amith Yamasani82644082012-08-03 13:09:11 -07002809
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002810 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002811 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002812 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2813 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002814 Parcel data = Parcel.obtain();
2815 Parcel reply = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002818 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002819 intent.writeToParcel(data, 0);
2820 data.writeString(resolvedType);
2821 data.writeStrongBinder(resultTo);
2822 data.writeString(resultWho);
2823 data.writeInt(requestCode);
2824 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002825 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002826 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002827 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002828 } else {
2829 data.writeInt(0);
2830 }
2831 if (options != null) {
2832 data.writeInt(1);
2833 options.writeToParcel(data, 0);
2834 } else {
2835 data.writeInt(0);
2836 }
2837 data.writeInt(userId);
2838 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2839 reply.readException();
2840 int result = reply.readInt();
2841 reply.recycle();
2842 data.recycle();
2843 return result;
2844 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002845 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2846 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002847 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2848 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2853 data.writeString(callingPackage);
2854 intent.writeToParcel(data, 0);
2855 data.writeString(resolvedType);
2856 data.writeStrongBinder(resultTo);
2857 data.writeString(resultWho);
2858 data.writeInt(requestCode);
2859 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002860 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002861 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002862 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002863 } else {
2864 data.writeInt(0);
2865 }
2866 if (options != null) {
2867 data.writeInt(1);
2868 options.writeToParcel(data, 0);
2869 } else {
2870 data.writeInt(0);
2871 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002872 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002873 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002874 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2875 reply.readException();
2876 int result = reply.readInt();
2877 reply.recycle();
2878 data.recycle();
2879 return result;
2880 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002881 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2882 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002883 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2884 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002885 Parcel data = Parcel.obtain();
2886 Parcel reply = Parcel.obtain();
2887 data.writeInterfaceToken(IActivityManager.descriptor);
2888 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002889 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002890 intent.writeToParcel(data, 0);
2891 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002892 data.writeStrongBinder(resultTo);
2893 data.writeString(resultWho);
2894 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002895 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002896 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002897 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002898 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002899 } else {
2900 data.writeInt(0);
2901 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002902 if (options != null) {
2903 data.writeInt(1);
2904 options.writeToParcel(data, 0);
2905 } else {
2906 data.writeInt(0);
2907 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002908 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002909 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2910 reply.readException();
2911 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2912 reply.recycle();
2913 data.recycle();
2914 return result;
2915 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002916 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2917 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002918 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002919 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002920 Parcel data = Parcel.obtain();
2921 Parcel reply = Parcel.obtain();
2922 data.writeInterfaceToken(IActivityManager.descriptor);
2923 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002924 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002925 intent.writeToParcel(data, 0);
2926 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002927 data.writeStrongBinder(resultTo);
2928 data.writeString(resultWho);
2929 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002930 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002931 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002932 if (options != null) {
2933 data.writeInt(1);
2934 options.writeToParcel(data, 0);
2935 } else {
2936 data.writeInt(0);
2937 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002938 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002939 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2940 reply.readException();
2941 int result = reply.readInt();
2942 reply.recycle();
2943 data.recycle();
2944 return result;
2945 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002946 public int startActivityIntentSender(IApplicationThread caller,
2947 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002948 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002949 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2954 intent.writeToParcel(data, 0);
2955 if (fillInIntent != null) {
2956 data.writeInt(1);
2957 fillInIntent.writeToParcel(data, 0);
2958 } else {
2959 data.writeInt(0);
2960 }
2961 data.writeString(resolvedType);
2962 data.writeStrongBinder(resultTo);
2963 data.writeString(resultWho);
2964 data.writeInt(requestCode);
2965 data.writeInt(flagsMask);
2966 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002967 if (options != null) {
2968 data.writeInt(1);
2969 options.writeToParcel(data, 0);
2970 } else {
2971 data.writeInt(0);
2972 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002973 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002974 reply.readException();
2975 int result = reply.readInt();
2976 reply.recycle();
2977 data.recycle();
2978 return result;
2979 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002980 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2981 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002982 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2983 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002984 Parcel data = Parcel.obtain();
2985 Parcel reply = Parcel.obtain();
2986 data.writeInterfaceToken(IActivityManager.descriptor);
2987 data.writeString(callingPackage);
2988 data.writeInt(callingPid);
2989 data.writeInt(callingUid);
2990 intent.writeToParcel(data, 0);
2991 data.writeString(resolvedType);
2992 data.writeStrongBinder(session.asBinder());
2993 data.writeStrongBinder(interactor.asBinder());
2994 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002995 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002996 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002997 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002998 } else {
2999 data.writeInt(0);
3000 }
3001 if (options != null) {
3002 data.writeInt(1);
3003 options.writeToParcel(data, 0);
3004 } else {
3005 data.writeInt(0);
3006 }
3007 data.writeInt(userId);
3008 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3009 reply.readException();
3010 int result = reply.readInt();
3011 reply.recycle();
3012 data.recycle();
3013 return result;
3014 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003015 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003016 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 Parcel data = Parcel.obtain();
3018 Parcel reply = Parcel.obtain();
3019 data.writeInterfaceToken(IActivityManager.descriptor);
3020 data.writeStrongBinder(callingActivity);
3021 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003022 if (options != null) {
3023 data.writeInt(1);
3024 options.writeToParcel(data, 0);
3025 } else {
3026 data.writeInt(0);
3027 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003028 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 int result = reply.readInt();
3031 reply.recycle();
3032 data.recycle();
3033 return result != 0;
3034 }
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003035 public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
3036 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 data.writeInt(taskId);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003041 data.writeInt(launchStackId);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003042 if (options == null) {
3043 data.writeInt(0);
3044 } else {
3045 data.writeInt(1);
3046 options.writeToParcel(data, 0);
3047 }
3048 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3049 reply.readException();
3050 int result = reply.readInt();
3051 reply.recycle();
3052 data.recycle();
3053 return result;
3054 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003055 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003056 throws RemoteException {
3057 Parcel data = Parcel.obtain();
3058 Parcel reply = Parcel.obtain();
3059 data.writeInterfaceToken(IActivityManager.descriptor);
3060 data.writeStrongBinder(token);
3061 data.writeInt(resultCode);
3062 if (resultData != null) {
3063 data.writeInt(1);
3064 resultData.writeToParcel(data, 0);
3065 } else {
3066 data.writeInt(0);
3067 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003068 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003069 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3070 reply.readException();
3071 boolean res = reply.readInt() != 0;
3072 data.recycle();
3073 reply.recycle();
3074 return res;
3075 }
3076 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3077 {
3078 Parcel data = Parcel.obtain();
3079 Parcel reply = Parcel.obtain();
3080 data.writeInterfaceToken(IActivityManager.descriptor);
3081 data.writeStrongBinder(token);
3082 data.writeString(resultWho);
3083 data.writeInt(requestCode);
3084 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 data.recycle();
3087 reply.recycle();
3088 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003089 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3090 Parcel data = Parcel.obtain();
3091 Parcel reply = Parcel.obtain();
3092 data.writeInterfaceToken(IActivityManager.descriptor);
3093 data.writeStrongBinder(token);
3094 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3095 reply.readException();
3096 boolean res = reply.readInt() != 0;
3097 data.recycle();
3098 reply.recycle();
3099 return res;
3100 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003101 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3102 Parcel data = Parcel.obtain();
3103 Parcel reply = Parcel.obtain();
3104 data.writeInterfaceToken(IActivityManager.descriptor);
3105 data.writeStrongBinder(session.asBinder());
3106 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3107 reply.readException();
3108 data.recycle();
3109 reply.recycle();
3110 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003111 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeStrongBinder(token);
3116 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3117 reply.readException();
3118 boolean res = reply.readInt() != 0;
3119 data.recycle();
3120 reply.recycle();
3121 return res;
3122 }
3123 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3124 Parcel data = Parcel.obtain();
3125 Parcel reply = Parcel.obtain();
3126 data.writeInterfaceToken(IActivityManager.descriptor);
3127 data.writeStrongBinder(app.asBinder());
3128 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3129 reply.readException();
3130 data.recycle();
3131 reply.recycle();
3132 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003133 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
3137 data.writeStrongBinder(token);
3138 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3139 reply.readException();
3140 boolean res = reply.readInt() != 0;
3141 data.recycle();
3142 reply.recycle();
3143 return res;
3144 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003145 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003146 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003147 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003148 {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
3151 data.writeInterfaceToken(IActivityManager.descriptor);
3152 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003153 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003154 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3155 filter.writeToParcel(data, 0);
3156 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003157 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003158 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3159 reply.readException();
3160 Intent intent = null;
3161 int haveIntent = reply.readInt();
3162 if (haveIntent != 0) {
3163 intent = Intent.CREATOR.createFromParcel(reply);
3164 }
3165 reply.recycle();
3166 data.recycle();
3167 return intent;
3168 }
3169 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3170 {
3171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
3174 data.writeStrongBinder(receiver.asBinder());
3175 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3176 reply.readException();
3177 data.recycle();
3178 reply.recycle();
3179 }
3180 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003181 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003182 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003183 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003184 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003185 {
3186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
3189 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3190 intent.writeToParcel(data, 0);
3191 data.writeString(resolvedType);
3192 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3193 data.writeInt(resultCode);
3194 data.writeString(resultData);
3195 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003196 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003197 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003198 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003199 data.writeInt(serialized ? 1 : 0);
3200 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003201 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003202 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3203 reply.readException();
3204 int res = reply.readInt();
3205 reply.recycle();
3206 data.recycle();
3207 return res;
3208 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003209 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3210 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003211 {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3216 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003217 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003218 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3219 reply.readException();
3220 data.recycle();
3221 reply.recycle();
3222 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003223 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3224 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 {
3226 Parcel data = Parcel.obtain();
3227 Parcel reply = Parcel.obtain();
3228 data.writeInterfaceToken(IActivityManager.descriptor);
3229 data.writeStrongBinder(who);
3230 data.writeInt(resultCode);
3231 data.writeString(resultData);
3232 data.writeBundle(map);
3233 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003234 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003235 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3236 reply.readException();
3237 data.recycle();
3238 reply.recycle();
3239 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 public void attachApplication(IApplicationThread app) throws RemoteException
3241 {
3242 Parcel data = Parcel.obtain();
3243 Parcel reply = Parcel.obtain();
3244 data.writeInterfaceToken(IActivityManager.descriptor);
3245 data.writeStrongBinder(app.asBinder());
3246 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 data.recycle();
3249 reply.recycle();
3250 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003251 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3252 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003253 {
3254 Parcel data = Parcel.obtain();
3255 Parcel reply = Parcel.obtain();
3256 data.writeInterfaceToken(IActivityManager.descriptor);
3257 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003258 if (config != null) {
3259 data.writeInt(1);
3260 config.writeToParcel(data, 0);
3261 } else {
3262 data.writeInt(0);
3263 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003264 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003265 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3266 reply.readException();
3267 data.recycle();
3268 reply.recycle();
3269 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003270 public void activityResumed(IBinder token) throws RemoteException
3271 {
3272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 data.writeStrongBinder(token);
3276 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3277 reply.readException();
3278 data.recycle();
3279 reply.recycle();
3280 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003281 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003282 {
3283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 data.writeStrongBinder(token);
3287 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3288 reply.readException();
3289 data.recycle();
3290 reply.recycle();
3291 }
3292 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003293 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003294 {
3295 Parcel data = Parcel.obtain();
3296 Parcel reply = Parcel.obtain();
3297 data.writeInterfaceToken(IActivityManager.descriptor);
3298 data.writeStrongBinder(token);
3299 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003300 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003301 TextUtils.writeToParcel(description, data, 0);
3302 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3303 reply.readException();
3304 data.recycle();
3305 reply.recycle();
3306 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003307 public void activitySlept(IBinder token) throws RemoteException
3308 {
3309 Parcel data = Parcel.obtain();
3310 Parcel reply = Parcel.obtain();
3311 data.writeInterfaceToken(IActivityManager.descriptor);
3312 data.writeStrongBinder(token);
3313 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3314 reply.readException();
3315 data.recycle();
3316 reply.recycle();
3317 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 public void activityDestroyed(IBinder token) throws RemoteException
3319 {
3320 Parcel data = Parcel.obtain();
3321 Parcel reply = Parcel.obtain();
3322 data.writeInterfaceToken(IActivityManager.descriptor);
3323 data.writeStrongBinder(token);
3324 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3325 reply.readException();
3326 data.recycle();
3327 reply.recycle();
3328 }
3329 public String getCallingPackage(IBinder token) throws RemoteException
3330 {
3331 Parcel data = Parcel.obtain();
3332 Parcel reply = Parcel.obtain();
3333 data.writeInterfaceToken(IActivityManager.descriptor);
3334 data.writeStrongBinder(token);
3335 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3336 reply.readException();
3337 String res = reply.readString();
3338 data.recycle();
3339 reply.recycle();
3340 return res;
3341 }
3342 public ComponentName getCallingActivity(IBinder token)
3343 throws RemoteException {
3344 Parcel data = Parcel.obtain();
3345 Parcel reply = Parcel.obtain();
3346 data.writeInterfaceToken(IActivityManager.descriptor);
3347 data.writeStrongBinder(token);
3348 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3349 reply.readException();
3350 ComponentName res = ComponentName.readFromParcel(reply);
3351 data.recycle();
3352 reply.recycle();
3353 return res;
3354 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003355 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003356 Parcel data = Parcel.obtain();
3357 Parcel reply = Parcel.obtain();
3358 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003359 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003360 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3361 reply.readException();
3362 ArrayList<IAppTask> list = null;
3363 int N = reply.readInt();
3364 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003365 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003366 while (N > 0) {
3367 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3368 list.add(task);
3369 N--;
3370 }
3371 }
3372 data.recycle();
3373 reply.recycle();
3374 return list;
3375 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003376 public int addAppTask(IBinder activityToken, Intent intent,
3377 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3378 Parcel data = Parcel.obtain();
3379 Parcel reply = Parcel.obtain();
3380 data.writeInterfaceToken(IActivityManager.descriptor);
3381 data.writeStrongBinder(activityToken);
3382 intent.writeToParcel(data, 0);
3383 description.writeToParcel(data, 0);
3384 thumbnail.writeToParcel(data, 0);
3385 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3386 reply.readException();
3387 int res = reply.readInt();
3388 data.recycle();
3389 reply.recycle();
3390 return res;
3391 }
3392 public Point getAppTaskThumbnailSize() throws RemoteException {
3393 Parcel data = Parcel.obtain();
3394 Parcel reply = Parcel.obtain();
3395 data.writeInterfaceToken(IActivityManager.descriptor);
3396 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3397 reply.readException();
3398 Point size = Point.CREATOR.createFromParcel(reply);
3399 data.recycle();
3400 reply.recycle();
3401 return size;
3402 }
Todd Kennedye635f662015-01-20 10:36:49 -08003403 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3404 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003405 Parcel data = Parcel.obtain();
3406 Parcel reply = Parcel.obtain();
3407 data.writeInterfaceToken(IActivityManager.descriptor);
3408 data.writeInt(maxNum);
3409 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003410 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3411 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003412 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003413 int N = reply.readInt();
3414 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003415 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003416 while (N > 0) {
3417 ActivityManager.RunningTaskInfo info =
3418 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003419 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003420 list.add(info);
3421 N--;
3422 }
3423 }
3424 data.recycle();
3425 reply.recycle();
3426 return list;
3427 }
3428 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003429 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003430 Parcel data = Parcel.obtain();
3431 Parcel reply = Parcel.obtain();
3432 data.writeInterfaceToken(IActivityManager.descriptor);
3433 data.writeInt(maxNum);
3434 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003435 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3437 reply.readException();
3438 ArrayList<ActivityManager.RecentTaskInfo> list
3439 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3440 data.recycle();
3441 reply.recycle();
3442 return list;
3443 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003444 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003445 Parcel data = Parcel.obtain();
3446 Parcel reply = Parcel.obtain();
3447 data.writeInterfaceToken(IActivityManager.descriptor);
3448 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003449 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003450 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003451 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003452 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003453 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003454 }
3455 data.recycle();
3456 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003457 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003458 }
Todd Kennedye635f662015-01-20 10:36:49 -08003459 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3460 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003461 Parcel data = Parcel.obtain();
3462 Parcel reply = Parcel.obtain();
3463 data.writeInterfaceToken(IActivityManager.descriptor);
3464 data.writeInt(maxNum);
3465 data.writeInt(flags);
3466 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3467 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003468 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003469 int N = reply.readInt();
3470 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003471 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003472 while (N > 0) {
3473 ActivityManager.RunningServiceInfo info =
3474 ActivityManager.RunningServiceInfo.CREATOR
3475 .createFromParcel(reply);
3476 list.add(info);
3477 N--;
3478 }
3479 }
3480 data.recycle();
3481 reply.recycle();
3482 return list;
3483 }
3484 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3485 throws RemoteException {
3486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3490 reply.readException();
3491 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3492 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3493 data.recycle();
3494 reply.recycle();
3495 return list;
3496 }
3497 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3498 throws RemoteException {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3503 reply.readException();
3504 ArrayList<ActivityManager.RunningAppProcessInfo> list
3505 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3506 data.recycle();
3507 reply.recycle();
3508 return list;
3509 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003510 public List<ApplicationInfo> getRunningExternalApplications()
3511 throws RemoteException {
3512 Parcel data = Parcel.obtain();
3513 Parcel reply = Parcel.obtain();
3514 data.writeInterfaceToken(IActivityManager.descriptor);
3515 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3516 reply.readException();
3517 ArrayList<ApplicationInfo> list
3518 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3519 data.recycle();
3520 reply.recycle();
3521 return list;
3522 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003523 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003524 {
3525 Parcel data = Parcel.obtain();
3526 Parcel reply = Parcel.obtain();
3527 data.writeInterfaceToken(IActivityManager.descriptor);
3528 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003529 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003530 if (options != null) {
3531 data.writeInt(1);
3532 options.writeToParcel(data, 0);
3533 } else {
3534 data.writeInt(0);
3535 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003536 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3537 reply.readException();
3538 data.recycle();
3539 reply.recycle();
3540 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003541 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3542 throws RemoteException {
3543 Parcel data = Parcel.obtain();
3544 Parcel reply = Parcel.obtain();
3545 data.writeInterfaceToken(IActivityManager.descriptor);
3546 data.writeStrongBinder(token);
3547 data.writeInt(nonRoot ? 1 : 0);
3548 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3549 reply.readException();
3550 boolean res = reply.readInt() != 0;
3551 data.recycle();
3552 reply.recycle();
3553 return res;
3554 }
3555 public void moveTaskBackwards(int task) throws RemoteException
3556 {
3557 Parcel data = Parcel.obtain();
3558 Parcel reply = Parcel.obtain();
3559 data.writeInterfaceToken(IActivityManager.descriptor);
3560 data.writeInt(task);
3561 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 data.recycle();
3564 reply.recycle();
3565 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003566 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003567 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3568 {
3569 Parcel data = Parcel.obtain();
3570 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003571 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003572 data.writeInt(taskId);
3573 data.writeInt(stackId);
3574 data.writeInt(toTop ? 1 : 0);
3575 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3576 reply.readException();
3577 data.recycle();
3578 reply.recycle();
3579 }
3580 @Override
Jorim Jaggi030979c2015-11-20 15:14:43 -08003581 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate)
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003582 throws RemoteException
3583 {
3584 Parcel data = Parcel.obtain();
3585 Parcel reply = Parcel.obtain();
3586 data.writeInterfaceToken(IActivityManager.descriptor);
3587 data.writeInt(taskId);
3588 data.writeInt(createMode);
3589 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003590 data.writeInt(animate ? 1 : 0);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003591 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3592 reply.readException();
3593 data.recycle();
3594 reply.recycle();
3595 }
3596 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003597 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3598 throws RemoteException
3599 {
3600 Parcel data = Parcel.obtain();
3601 Parcel reply = Parcel.obtain();
3602 data.writeInterfaceToken(IActivityManager.descriptor);
3603 data.writeInt(stackId);
3604 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003605 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003606 reply.readException();
3607 final boolean res = reply.readInt() != 0;
3608 data.recycle();
3609 reply.recycle();
3610 return res;
3611 }
3612 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003613 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3614 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003615 {
3616 Parcel data = Parcel.obtain();
3617 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003618 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003619 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003620 if (r != null) {
3621 data.writeInt(1);
3622 r.writeToParcel(data, 0);
3623 } else {
3624 data.writeInt(0);
3625 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003626 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003627 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003628 reply.readException();
3629 data.recycle();
3630 reply.recycle();
3631 }
Craig Mautner967212c2013-04-13 21:10:58 -07003632 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003633 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3634 {
3635 Parcel data = Parcel.obtain();
3636 Parcel reply = Parcel.obtain();
3637 data.writeInterfaceToken(IActivityManager.descriptor);
3638 data.writeInt(taskId);
3639 data.writeInt(stackId);
3640 data.writeInt(position);
3641 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3642 reply.readException();
3643 data.recycle();
3644 reply.recycle();
3645 }
3646 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003647 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003648 {
3649 Parcel data = Parcel.obtain();
3650 Parcel reply = Parcel.obtain();
3651 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003652 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003653 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003654 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003655 data.recycle();
3656 reply.recycle();
3657 return list;
3658 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003659 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003660 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003661 {
3662 Parcel data = Parcel.obtain();
3663 Parcel reply = Parcel.obtain();
3664 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003665 data.writeInt(stackId);
3666 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003667 reply.readException();
3668 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003669 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003670 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003671 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003672 }
3673 data.recycle();
3674 reply.recycle();
3675 return info;
3676 }
3677 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003678 public boolean isInHomeStack(int taskId) throws RemoteException {
3679 Parcel data = Parcel.obtain();
3680 Parcel reply = Parcel.obtain();
3681 data.writeInterfaceToken(IActivityManager.descriptor);
3682 data.writeInt(taskId);
3683 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 boolean isInHomeStack = reply.readInt() > 0;
3686 data.recycle();
3687 reply.recycle();
3688 return isInHomeStack;
3689 }
3690 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003691 public void setFocusedStack(int stackId) throws RemoteException
3692 {
3693 Parcel data = Parcel.obtain();
3694 Parcel reply = Parcel.obtain();
3695 data.writeInterfaceToken(IActivityManager.descriptor);
3696 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003697 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003698 reply.readException();
3699 data.recycle();
3700 reply.recycle();
3701 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003702 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003703 public int getFocusedStackId() throws RemoteException {
3704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3708 reply.readException();
3709 int focusedStackId = reply.readInt();
3710 data.recycle();
3711 reply.recycle();
3712 return focusedStackId;
3713 }
3714 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003715 public void setFocusedTask(int taskId) throws RemoteException
3716 {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 data.writeInt(taskId);
3721 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3722 reply.readException();
3723 data.recycle();
3724 reply.recycle();
3725 }
3726 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003727 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3728 {
3729 Parcel data = Parcel.obtain();
3730 Parcel reply = Parcel.obtain();
3731 data.writeInterfaceToken(IActivityManager.descriptor);
3732 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003733 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003734 reply.readException();
3735 data.recycle();
3736 reply.recycle();
3737 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003738 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3739 {
3740 Parcel data = Parcel.obtain();
3741 Parcel reply = Parcel.obtain();
3742 data.writeInterfaceToken(IActivityManager.descriptor);
3743 data.writeStrongBinder(token);
3744 data.writeInt(onlyRoot ? 1 : 0);
3745 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3746 reply.readException();
3747 int res = reply.readInt();
3748 data.recycle();
3749 reply.recycle();
3750 return res;
3751 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003752 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003753 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003754 Parcel data = Parcel.obtain();
3755 Parcel reply = Parcel.obtain();
3756 data.writeInterfaceToken(IActivityManager.descriptor);
3757 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3758 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003759 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003760 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003761 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3762 reply.readException();
3763 int res = reply.readInt();
3764 ContentProviderHolder cph = null;
3765 if (res != 0) {
3766 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3767 }
3768 data.recycle();
3769 reply.recycle();
3770 return cph;
3771 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003772 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3773 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003774 Parcel data = Parcel.obtain();
3775 Parcel reply = Parcel.obtain();
3776 data.writeInterfaceToken(IActivityManager.descriptor);
3777 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003778 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003779 data.writeStrongBinder(token);
3780 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3781 reply.readException();
3782 int res = reply.readInt();
3783 ContentProviderHolder cph = null;
3784 if (res != 0) {
3785 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3786 }
3787 data.recycle();
3788 reply.recycle();
3789 return cph;
3790 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003791 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003792 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 {
3794 Parcel data = Parcel.obtain();
3795 Parcel reply = Parcel.obtain();
3796 data.writeInterfaceToken(IActivityManager.descriptor);
3797 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3798 data.writeTypedList(providers);
3799 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 data.recycle();
3802 reply.recycle();
3803 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003804 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3805 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003806 Parcel data = Parcel.obtain();
3807 Parcel reply = Parcel.obtain();
3808 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003809 data.writeStrongBinder(connection);
3810 data.writeInt(stable);
3811 data.writeInt(unstable);
3812 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3813 reply.readException();
3814 boolean res = reply.readInt() != 0;
3815 data.recycle();
3816 reply.recycle();
3817 return res;
3818 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003819
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003820 public void unstableProviderDied(IBinder connection) throws RemoteException {
3821 Parcel data = Parcel.obtain();
3822 Parcel reply = Parcel.obtain();
3823 data.writeInterfaceToken(IActivityManager.descriptor);
3824 data.writeStrongBinder(connection);
3825 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3826 reply.readException();
3827 data.recycle();
3828 reply.recycle();
3829 }
3830
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003831 @Override
3832 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3833 Parcel data = Parcel.obtain();
3834 Parcel reply = Parcel.obtain();
3835 data.writeInterfaceToken(IActivityManager.descriptor);
3836 data.writeStrongBinder(connection);
3837 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3838 reply.readException();
3839 data.recycle();
3840 reply.recycle();
3841 }
3842
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003843 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
3847 data.writeStrongBinder(connection);
3848 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003849 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3850 reply.readException();
3851 data.recycle();
3852 reply.recycle();
3853 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003854
3855 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3856 Parcel data = Parcel.obtain();
3857 Parcel reply = Parcel.obtain();
3858 data.writeInterfaceToken(IActivityManager.descriptor);
3859 data.writeString(name);
3860 data.writeStrongBinder(token);
3861 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3862 reply.readException();
3863 data.recycle();
3864 reply.recycle();
3865 }
3866
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003867 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3868 throws RemoteException
3869 {
3870 Parcel data = Parcel.obtain();
3871 Parcel reply = Parcel.obtain();
3872 data.writeInterfaceToken(IActivityManager.descriptor);
3873 service.writeToParcel(data, 0);
3874 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3875 reply.readException();
3876 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3877 data.recycle();
3878 reply.recycle();
3879 return res;
3880 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003881
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003882 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003883 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003884 {
3885 Parcel data = Parcel.obtain();
3886 Parcel reply = Parcel.obtain();
3887 data.writeInterfaceToken(IActivityManager.descriptor);
3888 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3889 service.writeToParcel(data, 0);
3890 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003891 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003892 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003893 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3894 reply.readException();
3895 ComponentName res = ComponentName.readFromParcel(reply);
3896 data.recycle();
3897 reply.recycle();
3898 return res;
3899 }
3900 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003901 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003902 {
3903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
3906 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3907 service.writeToParcel(data, 0);
3908 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003909 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003910 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 int res = reply.readInt();
3913 reply.recycle();
3914 data.recycle();
3915 return res;
3916 }
3917 public boolean stopServiceToken(ComponentName className, IBinder token,
3918 int startId) throws RemoteException {
3919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 ComponentName.writeToParcel(className, data);
3923 data.writeStrongBinder(token);
3924 data.writeInt(startId);
3925 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3926 reply.readException();
3927 boolean res = reply.readInt() != 0;
3928 data.recycle();
3929 reply.recycle();
3930 return res;
3931 }
3932 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003933 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003934 Parcel data = Parcel.obtain();
3935 Parcel reply = Parcel.obtain();
3936 data.writeInterfaceToken(IActivityManager.descriptor);
3937 ComponentName.writeToParcel(className, data);
3938 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003939 data.writeInt(id);
3940 if (notification != null) {
3941 data.writeInt(1);
3942 notification.writeToParcel(data, 0);
3943 } else {
3944 data.writeInt(0);
3945 }
3946 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003947 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3948 reply.readException();
3949 data.recycle();
3950 reply.recycle();
3951 }
3952 public int bindService(IApplicationThread caller, IBinder token,
3953 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003954 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003955 Parcel data = Parcel.obtain();
3956 Parcel reply = Parcel.obtain();
3957 data.writeInterfaceToken(IActivityManager.descriptor);
3958 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3959 data.writeStrongBinder(token);
3960 service.writeToParcel(data, 0);
3961 data.writeString(resolvedType);
3962 data.writeStrongBinder(connection.asBinder());
3963 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003964 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003965 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003966 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3967 reply.readException();
3968 int res = reply.readInt();
3969 data.recycle();
3970 reply.recycle();
3971 return res;
3972 }
3973 public boolean unbindService(IServiceConnection connection) throws RemoteException
3974 {
3975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 data.writeStrongBinder(connection.asBinder());
3979 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3980 reply.readException();
3981 boolean res = reply.readInt() != 0;
3982 data.recycle();
3983 reply.recycle();
3984 return res;
3985 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003986
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003987 public void publishService(IBinder token,
3988 Intent intent, IBinder service) throws RemoteException {
3989 Parcel data = Parcel.obtain();
3990 Parcel reply = Parcel.obtain();
3991 data.writeInterfaceToken(IActivityManager.descriptor);
3992 data.writeStrongBinder(token);
3993 intent.writeToParcel(data, 0);
3994 data.writeStrongBinder(service);
3995 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3996 reply.readException();
3997 data.recycle();
3998 reply.recycle();
3999 }
4000
4001 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4002 throws RemoteException {
4003 Parcel data = Parcel.obtain();
4004 Parcel reply = Parcel.obtain();
4005 data.writeInterfaceToken(IActivityManager.descriptor);
4006 data.writeStrongBinder(token);
4007 intent.writeToParcel(data, 0);
4008 data.writeInt(doRebind ? 1 : 0);
4009 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4010 reply.readException();
4011 data.recycle();
4012 reply.recycle();
4013 }
4014
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004015 public void serviceDoneExecuting(IBinder token, int type, int startId,
4016 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004017 Parcel data = Parcel.obtain();
4018 Parcel reply = Parcel.obtain();
4019 data.writeInterfaceToken(IActivityManager.descriptor);
4020 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004021 data.writeInt(type);
4022 data.writeInt(startId);
4023 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004024 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4025 reply.readException();
4026 data.recycle();
4027 reply.recycle();
4028 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004029
Svet Ganov99b60432015-06-27 13:15:22 -07004030 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4031 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 service.writeToParcel(data, 0);
4036 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004037 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004038 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4039 reply.readException();
4040 IBinder binder = reply.readStrongBinder();
4041 reply.recycle();
4042 data.recycle();
4043 return binder;
4044 }
4045
Christopher Tate181fafa2009-05-14 11:12:14 -07004046 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4047 throws RemoteException {
4048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 app.writeToParcel(data, 0);
4052 data.writeInt(backupRestoreMode);
4053 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4054 reply.readException();
4055 boolean success = reply.readInt() != 0;
4056 reply.recycle();
4057 data.recycle();
4058 return success;
4059 }
4060
Christopher Tate346acb12012-10-15 19:20:25 -07004061 public void clearPendingBackup() throws RemoteException {
4062 Parcel data = Parcel.obtain();
4063 Parcel reply = Parcel.obtain();
4064 data.writeInterfaceToken(IActivityManager.descriptor);
4065 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4066 reply.recycle();
4067 data.recycle();
4068 }
4069
Christopher Tate181fafa2009-05-14 11:12:14 -07004070 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4071 Parcel data = Parcel.obtain();
4072 Parcel reply = Parcel.obtain();
4073 data.writeInterfaceToken(IActivityManager.descriptor);
4074 data.writeString(packageName);
4075 data.writeStrongBinder(agent);
4076 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4077 reply.recycle();
4078 data.recycle();
4079 }
4080
4081 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4082 Parcel data = Parcel.obtain();
4083 Parcel reply = Parcel.obtain();
4084 data.writeInterfaceToken(IActivityManager.descriptor);
4085 app.writeToParcel(data, 0);
4086 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4087 reply.readException();
4088 reply.recycle();
4089 data.recycle();
4090 }
4091
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004092 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004093 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004094 IUiAutomationConnection connection, int userId, String instructionSet)
4095 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004096 Parcel data = Parcel.obtain();
4097 Parcel reply = Parcel.obtain();
4098 data.writeInterfaceToken(IActivityManager.descriptor);
4099 ComponentName.writeToParcel(className, data);
4100 data.writeString(profileFile);
4101 data.writeInt(flags);
4102 data.writeBundle(arguments);
4103 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004104 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004105 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004106 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004107 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4108 reply.readException();
4109 boolean res = reply.readInt() != 0;
4110 reply.recycle();
4111 data.recycle();
4112 return res;
4113 }
4114
4115 public void finishInstrumentation(IApplicationThread target,
4116 int resultCode, Bundle results) throws RemoteException {
4117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
4120 data.writeStrongBinder(target != null ? target.asBinder() : null);
4121 data.writeInt(resultCode);
4122 data.writeBundle(results);
4123 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4124 reply.readException();
4125 data.recycle();
4126 reply.recycle();
4127 }
4128 public Configuration getConfiguration() throws RemoteException
4129 {
4130 Parcel data = Parcel.obtain();
4131 Parcel reply = Parcel.obtain();
4132 data.writeInterfaceToken(IActivityManager.descriptor);
4133 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4134 reply.readException();
4135 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4136 reply.recycle();
4137 data.recycle();
4138 return res;
4139 }
4140 public void updateConfiguration(Configuration values) throws RemoteException
4141 {
4142 Parcel data = Parcel.obtain();
4143 Parcel reply = Parcel.obtain();
4144 data.writeInterfaceToken(IActivityManager.descriptor);
4145 values.writeToParcel(data, 0);
4146 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 data.recycle();
4149 reply.recycle();
4150 }
4151 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4152 throws RemoteException {
4153 Parcel data = Parcel.obtain();
4154 Parcel reply = Parcel.obtain();
4155 data.writeInterfaceToken(IActivityManager.descriptor);
4156 data.writeStrongBinder(token);
4157 data.writeInt(requestedOrientation);
4158 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4159 reply.readException();
4160 data.recycle();
4161 reply.recycle();
4162 }
4163 public int getRequestedOrientation(IBinder token) throws RemoteException {
4164 Parcel data = Parcel.obtain();
4165 Parcel reply = Parcel.obtain();
4166 data.writeInterfaceToken(IActivityManager.descriptor);
4167 data.writeStrongBinder(token);
4168 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4169 reply.readException();
4170 int res = reply.readInt();
4171 data.recycle();
4172 reply.recycle();
4173 return res;
4174 }
4175 public ComponentName getActivityClassForToken(IBinder token)
4176 throws RemoteException {
4177 Parcel data = Parcel.obtain();
4178 Parcel reply = Parcel.obtain();
4179 data.writeInterfaceToken(IActivityManager.descriptor);
4180 data.writeStrongBinder(token);
4181 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4182 reply.readException();
4183 ComponentName res = ComponentName.readFromParcel(reply);
4184 data.recycle();
4185 reply.recycle();
4186 return res;
4187 }
4188 public String getPackageForToken(IBinder token) throws RemoteException
4189 {
4190 Parcel data = Parcel.obtain();
4191 Parcel reply = Parcel.obtain();
4192 data.writeInterfaceToken(IActivityManager.descriptor);
4193 data.writeStrongBinder(token);
4194 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4195 reply.readException();
4196 String res = reply.readString();
4197 data.recycle();
4198 reply.recycle();
4199 return res;
4200 }
4201 public IIntentSender getIntentSender(int type,
4202 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004203 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004204 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004205 Parcel data = Parcel.obtain();
4206 Parcel reply = Parcel.obtain();
4207 data.writeInterfaceToken(IActivityManager.descriptor);
4208 data.writeInt(type);
4209 data.writeString(packageName);
4210 data.writeStrongBinder(token);
4211 data.writeString(resultWho);
4212 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004213 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004214 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004215 data.writeTypedArray(intents, 0);
4216 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004217 } else {
4218 data.writeInt(0);
4219 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004220 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004221 if (options != null) {
4222 data.writeInt(1);
4223 options.writeToParcel(data, 0);
4224 } else {
4225 data.writeInt(0);
4226 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004227 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004228 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4229 reply.readException();
4230 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004231 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004232 data.recycle();
4233 reply.recycle();
4234 return res;
4235 }
4236 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4237 Parcel data = Parcel.obtain();
4238 Parcel reply = Parcel.obtain();
4239 data.writeInterfaceToken(IActivityManager.descriptor);
4240 data.writeStrongBinder(sender.asBinder());
4241 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4242 reply.readException();
4243 data.recycle();
4244 reply.recycle();
4245 }
4246 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4247 Parcel data = Parcel.obtain();
4248 Parcel reply = Parcel.obtain();
4249 data.writeInterfaceToken(IActivityManager.descriptor);
4250 data.writeStrongBinder(sender.asBinder());
4251 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4252 reply.readException();
4253 String res = reply.readString();
4254 data.recycle();
4255 reply.recycle();
4256 return res;
4257 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004258 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4259 Parcel data = Parcel.obtain();
4260 Parcel reply = Parcel.obtain();
4261 data.writeInterfaceToken(IActivityManager.descriptor);
4262 data.writeStrongBinder(sender.asBinder());
4263 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4264 reply.readException();
4265 int res = reply.readInt();
4266 data.recycle();
4267 reply.recycle();
4268 return res;
4269 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004270 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4271 boolean requireFull, String name, String callerPackage) throws RemoteException {
4272 Parcel data = Parcel.obtain();
4273 Parcel reply = Parcel.obtain();
4274 data.writeInterfaceToken(IActivityManager.descriptor);
4275 data.writeInt(callingPid);
4276 data.writeInt(callingUid);
4277 data.writeInt(userId);
4278 data.writeInt(allowAll ? 1 : 0);
4279 data.writeInt(requireFull ? 1 : 0);
4280 data.writeString(name);
4281 data.writeString(callerPackage);
4282 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 int res = reply.readInt();
4285 data.recycle();
4286 reply.recycle();
4287 return res;
4288 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004289 public void setProcessLimit(int max) throws RemoteException
4290 {
4291 Parcel data = Parcel.obtain();
4292 Parcel reply = Parcel.obtain();
4293 data.writeInterfaceToken(IActivityManager.descriptor);
4294 data.writeInt(max);
4295 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4296 reply.readException();
4297 data.recycle();
4298 reply.recycle();
4299 }
4300 public int getProcessLimit() throws RemoteException
4301 {
4302 Parcel data = Parcel.obtain();
4303 Parcel reply = Parcel.obtain();
4304 data.writeInterfaceToken(IActivityManager.descriptor);
4305 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4306 reply.readException();
4307 int res = reply.readInt();
4308 data.recycle();
4309 reply.recycle();
4310 return res;
4311 }
4312 public void setProcessForeground(IBinder token, int pid,
4313 boolean isForeground) throws RemoteException {
4314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 data.writeStrongBinder(token);
4318 data.writeInt(pid);
4319 data.writeInt(isForeground ? 1 : 0);
4320 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4321 reply.readException();
4322 data.recycle();
4323 reply.recycle();
4324 }
4325 public int checkPermission(String permission, int pid, int uid)
4326 throws RemoteException {
4327 Parcel data = Parcel.obtain();
4328 Parcel reply = Parcel.obtain();
4329 data.writeInterfaceToken(IActivityManager.descriptor);
4330 data.writeString(permission);
4331 data.writeInt(pid);
4332 data.writeInt(uid);
4333 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4334 reply.readException();
4335 int res = reply.readInt();
4336 data.recycle();
4337 reply.recycle();
4338 return res;
4339 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004340 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4341 throws RemoteException {
4342 Parcel data = Parcel.obtain();
4343 Parcel reply = Parcel.obtain();
4344 data.writeInterfaceToken(IActivityManager.descriptor);
4345 data.writeString(permission);
4346 data.writeInt(pid);
4347 data.writeInt(uid);
4348 data.writeStrongBinder(callerToken);
4349 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4350 reply.readException();
4351 int res = reply.readInt();
4352 data.recycle();
4353 reply.recycle();
4354 return res;
4355 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004356 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004357 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004358 Parcel data = Parcel.obtain();
4359 Parcel reply = Parcel.obtain();
4360 data.writeInterfaceToken(IActivityManager.descriptor);
4361 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004362 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004363 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004364 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4365 reply.readException();
4366 boolean res = reply.readInt() != 0;
4367 data.recycle();
4368 reply.recycle();
4369 return res;
4370 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004371 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4372 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004373 Parcel data = Parcel.obtain();
4374 Parcel reply = Parcel.obtain();
4375 data.writeInterfaceToken(IActivityManager.descriptor);
4376 uri.writeToParcel(data, 0);
4377 data.writeInt(pid);
4378 data.writeInt(uid);
4379 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004380 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004381 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004382 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4383 reply.readException();
4384 int res = reply.readInt();
4385 data.recycle();
4386 reply.recycle();
4387 return res;
4388 }
4389 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004390 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004391 Parcel data = Parcel.obtain();
4392 Parcel reply = Parcel.obtain();
4393 data.writeInterfaceToken(IActivityManager.descriptor);
4394 data.writeStrongBinder(caller.asBinder());
4395 data.writeString(targetPkg);
4396 uri.writeToParcel(data, 0);
4397 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004398 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004399 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4400 reply.readException();
4401 data.recycle();
4402 reply.recycle();
4403 }
4404 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004405 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004406 Parcel data = Parcel.obtain();
4407 Parcel reply = Parcel.obtain();
4408 data.writeInterfaceToken(IActivityManager.descriptor);
4409 data.writeStrongBinder(caller.asBinder());
4410 uri.writeToParcel(data, 0);
4411 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004412 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004413 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4414 reply.readException();
4415 data.recycle();
4416 reply.recycle();
4417 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004418
4419 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004420 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4421 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004422 Parcel data = Parcel.obtain();
4423 Parcel reply = Parcel.obtain();
4424 data.writeInterfaceToken(IActivityManager.descriptor);
4425 uri.writeToParcel(data, 0);
4426 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004427 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004428 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4429 reply.readException();
4430 data.recycle();
4431 reply.recycle();
4432 }
4433
4434 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004435 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4436 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004437 Parcel data = Parcel.obtain();
4438 Parcel reply = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 uri.writeToParcel(data, 0);
4441 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004442 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004443 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4444 reply.readException();
4445 data.recycle();
4446 reply.recycle();
4447 }
4448
4449 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004450 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4451 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004452 Parcel data = Parcel.obtain();
4453 Parcel reply = Parcel.obtain();
4454 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004455 data.writeString(packageName);
4456 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004457 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4458 reply.readException();
4459 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4460 reply);
4461 data.recycle();
4462 reply.recycle();
4463 return perms;
4464 }
4465
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004466 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4467 throws RemoteException {
4468 Parcel data = Parcel.obtain();
4469 Parcel reply = Parcel.obtain();
4470 data.writeInterfaceToken(IActivityManager.descriptor);
4471 data.writeStrongBinder(who.asBinder());
4472 data.writeInt(waiting ? 1 : 0);
4473 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4474 reply.readException();
4475 data.recycle();
4476 reply.recycle();
4477 }
4478 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4479 Parcel data = Parcel.obtain();
4480 Parcel reply = Parcel.obtain();
4481 data.writeInterfaceToken(IActivityManager.descriptor);
4482 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4483 reply.readException();
4484 outInfo.readFromParcel(reply);
4485 data.recycle();
4486 reply.recycle();
4487 }
4488 public void unhandledBack() throws RemoteException
4489 {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4494 reply.readException();
4495 data.recycle();
4496 reply.recycle();
4497 }
4498 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4499 {
4500 Parcel data = Parcel.obtain();
4501 Parcel reply = Parcel.obtain();
4502 data.writeInterfaceToken(IActivityManager.descriptor);
4503 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4504 reply.readException();
4505 ParcelFileDescriptor pfd = null;
4506 if (reply.readInt() != 0) {
4507 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4508 }
4509 data.recycle();
4510 reply.recycle();
4511 return pfd;
4512 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004513 public void setLockScreenShown(boolean shown) throws RemoteException
4514 {
4515 Parcel data = Parcel.obtain();
4516 Parcel reply = Parcel.obtain();
4517 data.writeInterfaceToken(IActivityManager.descriptor);
4518 data.writeInt(shown ? 1 : 0);
4519 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4520 reply.readException();
4521 data.recycle();
4522 reply.recycle();
4523 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004524 public void setDebugApp(
4525 String packageName, boolean waitForDebugger, boolean persistent)
4526 throws RemoteException
4527 {
4528 Parcel data = Parcel.obtain();
4529 Parcel reply = Parcel.obtain();
4530 data.writeInterfaceToken(IActivityManager.descriptor);
4531 data.writeString(packageName);
4532 data.writeInt(waitForDebugger ? 1 : 0);
4533 data.writeInt(persistent ? 1 : 0);
4534 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4535 reply.readException();
4536 data.recycle();
4537 reply.recycle();
4538 }
4539 public void setAlwaysFinish(boolean enabled) throws RemoteException
4540 {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 data.writeInt(enabled ? 1 : 0);
4545 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4546 reply.readException();
4547 data.recycle();
4548 reply.recycle();
4549 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004550 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004551 {
4552 Parcel data = Parcel.obtain();
4553 Parcel reply = Parcel.obtain();
4554 data.writeInterfaceToken(IActivityManager.descriptor);
4555 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004556 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004557 reply.readException();
4558 data.recycle();
4559 reply.recycle();
4560 }
4561 public void enterSafeMode() throws RemoteException {
4562 Parcel data = Parcel.obtain();
4563 data.writeInterfaceToken(IActivityManager.descriptor);
4564 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4565 data.recycle();
4566 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004567 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004568 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004569 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004570 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004571 data.writeStrongBinder(sender.asBinder());
4572 data.writeInt(sourceUid);
4573 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004574 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004575 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4576 data.recycle();
4577 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004578 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4579 throws RemoteException {
4580 Parcel data = Parcel.obtain();
4581 data.writeInterfaceToken(IActivityManager.descriptor);
4582 data.writeStrongBinder(sender.asBinder());
4583 data.writeInt(sourceUid);
4584 data.writeString(tag);
4585 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4586 data.recycle();
4587 }
4588 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4589 throws RemoteException {
4590 Parcel data = Parcel.obtain();
4591 data.writeInterfaceToken(IActivityManager.descriptor);
4592 data.writeStrongBinder(sender.asBinder());
4593 data.writeInt(sourceUid);
4594 data.writeString(tag);
4595 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4596 data.recycle();
4597 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004598 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004599 Parcel data = Parcel.obtain();
4600 Parcel reply = Parcel.obtain();
4601 data.writeInterfaceToken(IActivityManager.descriptor);
4602 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004603 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004604 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004605 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004606 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004607 boolean res = reply.readInt() != 0;
4608 data.recycle();
4609 reply.recycle();
4610 return res;
4611 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004612 @Override
4613 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4614 Parcel data = Parcel.obtain();
4615 Parcel reply = Parcel.obtain();
4616 data.writeInterfaceToken(IActivityManager.descriptor);
4617 data.writeString(reason);
4618 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4619 boolean res = reply.readInt() != 0;
4620 data.recycle();
4621 reply.recycle();
4622 return res;
4623 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004624 public boolean testIsSystemReady()
4625 {
4626 /* this base class version is never called */
4627 return true;
4628 }
Dan Egnor60d87622009-12-16 16:32:58 -08004629 public void handleApplicationCrash(IBinder app,
4630 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4631 {
4632 Parcel data = Parcel.obtain();
4633 Parcel reply = Parcel.obtain();
4634 data.writeInterfaceToken(IActivityManager.descriptor);
4635 data.writeStrongBinder(app);
4636 crashInfo.writeToParcel(data, 0);
4637 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4638 reply.readException();
4639 reply.recycle();
4640 data.recycle();
4641 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004642
Dianne Hackborn52322712014-08-26 22:47:26 -07004643 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004644 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004645 {
4646 Parcel data = Parcel.obtain();
4647 Parcel reply = Parcel.obtain();
4648 data.writeInterfaceToken(IActivityManager.descriptor);
4649 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004650 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004651 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004652 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004653 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004654 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004655 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004656 reply.recycle();
4657 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004658 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004659 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004660
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004661 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004662 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004663 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004664 {
4665 Parcel data = Parcel.obtain();
4666 Parcel reply = Parcel.obtain();
4667 data.writeInterfaceToken(IActivityManager.descriptor);
4668 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004669 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004670 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004671 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4672 reply.readException();
4673 reply.recycle();
4674 data.recycle();
4675 }
4676
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004677 public void signalPersistentProcesses(int sig) throws RemoteException {
4678 Parcel data = Parcel.obtain();
4679 Parcel reply = Parcel.obtain();
4680 data.writeInterfaceToken(IActivityManager.descriptor);
4681 data.writeInt(sig);
4682 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4683 reply.readException();
4684 data.recycle();
4685 reply.recycle();
4686 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004687
Dianne Hackborn1676c852012-09-10 14:52:30 -07004688 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004689 Parcel data = Parcel.obtain();
4690 Parcel reply = Parcel.obtain();
4691 data.writeInterfaceToken(IActivityManager.descriptor);
4692 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004693 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004694 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4695 reply.readException();
4696 data.recycle();
4697 reply.recycle();
4698 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004699
4700 public void killAllBackgroundProcesses() throws RemoteException {
4701 Parcel data = Parcel.obtain();
4702 Parcel reply = Parcel.obtain();
4703 data.writeInterfaceToken(IActivityManager.descriptor);
4704 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4705 reply.readException();
4706 data.recycle();
4707 reply.recycle();
4708 }
4709
Dianne Hackborn1676c852012-09-10 14:52:30 -07004710 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004711 Parcel data = Parcel.obtain();
4712 Parcel reply = Parcel.obtain();
4713 data.writeInterfaceToken(IActivityManager.descriptor);
4714 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004715 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004716 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004717 reply.readException();
4718 data.recycle();
4719 reply.recycle();
4720 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004721
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004722 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4723 throws RemoteException
4724 {
4725 Parcel data = Parcel.obtain();
4726 Parcel reply = Parcel.obtain();
4727 data.writeInterfaceToken(IActivityManager.descriptor);
4728 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4729 reply.readException();
4730 outInfo.readFromParcel(reply);
4731 reply.recycle();
4732 data.recycle();
4733 }
4734
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004735 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4736 {
4737 Parcel data = Parcel.obtain();
4738 Parcel reply = Parcel.obtain();
4739 data.writeInterfaceToken(IActivityManager.descriptor);
4740 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4741 reply.readException();
4742 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4743 reply.recycle();
4744 data.recycle();
4745 return res;
4746 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004747
Dianne Hackborn1676c852012-09-10 14:52:30 -07004748 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004749 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004750 {
4751 Parcel data = Parcel.obtain();
4752 Parcel reply = Parcel.obtain();
4753 data.writeInterfaceToken(IActivityManager.descriptor);
4754 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004755 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004756 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004757 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004758 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004759 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004760 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004761 } else {
4762 data.writeInt(0);
4763 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004764 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4765 reply.readException();
4766 boolean res = reply.readInt() != 0;
4767 reply.recycle();
4768 data.recycle();
4769 return res;
4770 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004771
Dianne Hackborn55280a92009-05-07 15:53:46 -07004772 public boolean shutdown(int timeout) throws RemoteException
4773 {
4774 Parcel data = Parcel.obtain();
4775 Parcel reply = Parcel.obtain();
4776 data.writeInterfaceToken(IActivityManager.descriptor);
4777 data.writeInt(timeout);
4778 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4779 reply.readException();
4780 boolean res = reply.readInt() != 0;
4781 reply.recycle();
4782 data.recycle();
4783 return res;
4784 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004785
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004786 public void stopAppSwitches() throws RemoteException {
4787 Parcel data = Parcel.obtain();
4788 Parcel reply = Parcel.obtain();
4789 data.writeInterfaceToken(IActivityManager.descriptor);
4790 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4791 reply.readException();
4792 reply.recycle();
4793 data.recycle();
4794 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004795
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004796 public void resumeAppSwitches() throws RemoteException {
4797 Parcel data = Parcel.obtain();
4798 Parcel reply = Parcel.obtain();
4799 data.writeInterfaceToken(IActivityManager.descriptor);
4800 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4801 reply.readException();
4802 reply.recycle();
4803 data.recycle();
4804 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004805
4806 public void addPackageDependency(String packageName) throws RemoteException {
4807 Parcel data = Parcel.obtain();
4808 Parcel reply = Parcel.obtain();
4809 data.writeInterfaceToken(IActivityManager.descriptor);
4810 data.writeString(packageName);
4811 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4812 reply.readException();
4813 data.recycle();
4814 reply.recycle();
4815 }
4816
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004817 public void killApplicationWithAppId(String pkg, int appid, String reason)
4818 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004819 Parcel data = Parcel.obtain();
4820 Parcel reply = Parcel.obtain();
4821 data.writeInterfaceToken(IActivityManager.descriptor);
4822 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004823 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004824 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004825 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004826 reply.readException();
4827 data.recycle();
4828 reply.recycle();
4829 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004830
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004831 public void closeSystemDialogs(String reason) throws RemoteException {
4832 Parcel data = Parcel.obtain();
4833 Parcel reply = Parcel.obtain();
4834 data.writeInterfaceToken(IActivityManager.descriptor);
4835 data.writeString(reason);
4836 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4837 reply.readException();
4838 data.recycle();
4839 reply.recycle();
4840 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004841
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004842 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004843 throws RemoteException {
4844 Parcel data = Parcel.obtain();
4845 Parcel reply = Parcel.obtain();
4846 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004847 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004848 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4849 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004850 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004851 data.recycle();
4852 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004853 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004854 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004855
4856 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4857 Parcel data = Parcel.obtain();
4858 Parcel reply = Parcel.obtain();
4859 data.writeInterfaceToken(IActivityManager.descriptor);
4860 data.writeString(processName);
4861 data.writeInt(uid);
4862 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4863 reply.readException();
4864 data.recycle();
4865 reply.recycle();
4866 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004867
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004868 public void overridePendingTransition(IBinder token, String packageName,
4869 int enterAnim, int exitAnim) throws RemoteException {
4870 Parcel data = Parcel.obtain();
4871 Parcel reply = Parcel.obtain();
4872 data.writeInterfaceToken(IActivityManager.descriptor);
4873 data.writeStrongBinder(token);
4874 data.writeString(packageName);
4875 data.writeInt(enterAnim);
4876 data.writeInt(exitAnim);
4877 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4878 reply.readException();
4879 data.recycle();
4880 reply.recycle();
4881 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004882
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004883 public boolean isUserAMonkey() throws RemoteException {
4884 Parcel data = Parcel.obtain();
4885 Parcel reply = Parcel.obtain();
4886 data.writeInterfaceToken(IActivityManager.descriptor);
4887 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4888 reply.readException();
4889 boolean res = reply.readInt() != 0;
4890 data.recycle();
4891 reply.recycle();
4892 return res;
4893 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004894
4895 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4896 Parcel data = Parcel.obtain();
4897 Parcel reply = Parcel.obtain();
4898 data.writeInterfaceToken(IActivityManager.descriptor);
4899 data.writeInt(monkey ? 1 : 0);
4900 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4901 reply.readException();
4902 data.recycle();
4903 reply.recycle();
4904 }
4905
Dianne Hackborn860755f2010-06-03 18:47:52 -07004906 public void finishHeavyWeightApp() throws RemoteException {
4907 Parcel data = Parcel.obtain();
4908 Parcel reply = Parcel.obtain();
4909 data.writeInterfaceToken(IActivityManager.descriptor);
4910 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4911 reply.readException();
4912 data.recycle();
4913 reply.recycle();
4914 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004915
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004916 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004917 throws RemoteException {
4918 Parcel data = Parcel.obtain();
4919 Parcel reply = Parcel.obtain();
4920 data.writeInterfaceToken(IActivityManager.descriptor);
4921 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004922 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4923 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004924 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004925 data.recycle();
4926 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004927 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004928 }
4929
Craig Mautner233ceee2014-05-09 17:05:11 -07004930 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004931 throws RemoteException {
4932 Parcel data = Parcel.obtain();
4933 Parcel reply = Parcel.obtain();
4934 data.writeInterfaceToken(IActivityManager.descriptor);
4935 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004936 if (options == null) {
4937 data.writeInt(0);
4938 } else {
4939 data.writeInt(1);
4940 data.writeBundle(options.toBundle());
4941 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004942 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004943 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004944 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004945 data.recycle();
4946 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004947 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004948 }
4949
Craig Mautner233ceee2014-05-09 17:05:11 -07004950 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4951 Parcel data = Parcel.obtain();
4952 Parcel reply = Parcel.obtain();
4953 data.writeInterfaceToken(IActivityManager.descriptor);
4954 data.writeStrongBinder(token);
4955 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4956 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08004957 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07004958 data.recycle();
4959 reply.recycle();
4960 return options;
4961 }
4962
Daniel Sandler69a48172010-06-23 16:29:36 -04004963 public void setImmersive(IBinder token, boolean immersive)
4964 throws RemoteException {
4965 Parcel data = Parcel.obtain();
4966 Parcel reply = Parcel.obtain();
4967 data.writeInterfaceToken(IActivityManager.descriptor);
4968 data.writeStrongBinder(token);
4969 data.writeInt(immersive ? 1 : 0);
4970 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4971 reply.readException();
4972 data.recycle();
4973 reply.recycle();
4974 }
4975
4976 public boolean isImmersive(IBinder token)
4977 throws RemoteException {
4978 Parcel data = Parcel.obtain();
4979 Parcel reply = Parcel.obtain();
4980 data.writeInterfaceToken(IActivityManager.descriptor);
4981 data.writeStrongBinder(token);
4982 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004983 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004984 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004985 data.recycle();
4986 reply.recycle();
4987 return res;
4988 }
4989
Craig Mautnerd61dc202014-07-07 11:09:11 -07004990 public boolean isTopOfTask(IBinder token) throws RemoteException {
4991 Parcel data = Parcel.obtain();
4992 Parcel reply = Parcel.obtain();
4993 data.writeInterfaceToken(IActivityManager.descriptor);
4994 data.writeStrongBinder(token);
4995 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4996 reply.readException();
4997 boolean res = reply.readInt() == 1;
4998 data.recycle();
4999 reply.recycle();
5000 return res;
5001 }
5002
Daniel Sandler69a48172010-06-23 16:29:36 -04005003 public boolean isTopActivityImmersive()
5004 throws RemoteException {
5005 Parcel data = Parcel.obtain();
5006 Parcel reply = Parcel.obtain();
5007 data.writeInterfaceToken(IActivityManager.descriptor);
5008 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005009 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005010 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005011 data.recycle();
5012 reply.recycle();
5013 return res;
5014 }
5015
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005016 public void crashApplication(int uid, int initialPid, String packageName,
5017 String message) throws RemoteException {
5018 Parcel data = Parcel.obtain();
5019 Parcel reply = Parcel.obtain();
5020 data.writeInterfaceToken(IActivityManager.descriptor);
5021 data.writeInt(uid);
5022 data.writeInt(initialPid);
5023 data.writeString(packageName);
5024 data.writeString(message);
5025 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5026 reply.readException();
5027 data.recycle();
5028 reply.recycle();
5029 }
Andy McFadden824c5102010-07-09 16:26:57 -07005030
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005031 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005032 Parcel data = Parcel.obtain();
5033 Parcel reply = Parcel.obtain();
5034 data.writeInterfaceToken(IActivityManager.descriptor);
5035 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005036 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005037 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5038 reply.readException();
5039 String res = reply.readString();
5040 data.recycle();
5041 reply.recycle();
5042 return res;
5043 }
5044
Dianne Hackborn7e269642010-08-25 19:50:20 -07005045 public IBinder newUriPermissionOwner(String name)
5046 throws RemoteException {
5047 Parcel data = Parcel.obtain();
5048 Parcel reply = Parcel.obtain();
5049 data.writeInterfaceToken(IActivityManager.descriptor);
5050 data.writeString(name);
5051 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5052 reply.readException();
5053 IBinder res = reply.readStrongBinder();
5054 data.recycle();
5055 reply.recycle();
5056 return res;
5057 }
5058
5059 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005060 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005061 Parcel data = Parcel.obtain();
5062 Parcel reply = Parcel.obtain();
5063 data.writeInterfaceToken(IActivityManager.descriptor);
5064 data.writeStrongBinder(owner);
5065 data.writeInt(fromUid);
5066 data.writeString(targetPkg);
5067 uri.writeToParcel(data, 0);
5068 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005069 data.writeInt(sourceUserId);
5070 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005071 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5072 reply.readException();
5073 data.recycle();
5074 reply.recycle();
5075 }
5076
5077 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005078 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005079 Parcel data = Parcel.obtain();
5080 Parcel reply = Parcel.obtain();
5081 data.writeInterfaceToken(IActivityManager.descriptor);
5082 data.writeStrongBinder(owner);
5083 if (uri != null) {
5084 data.writeInt(1);
5085 uri.writeToParcel(data, 0);
5086 } else {
5087 data.writeInt(0);
5088 }
5089 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005090 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005091 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5092 reply.readException();
5093 data.recycle();
5094 reply.recycle();
5095 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005096
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005097 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005098 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005099 Parcel data = Parcel.obtain();
5100 Parcel reply = Parcel.obtain();
5101 data.writeInterfaceToken(IActivityManager.descriptor);
5102 data.writeInt(callingUid);
5103 data.writeString(targetPkg);
5104 uri.writeToParcel(data, 0);
5105 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005106 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005107 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5108 reply.readException();
5109 int res = reply.readInt();
5110 data.recycle();
5111 reply.recycle();
5112 return res;
5113 }
5114
Dianne Hackborn1676c852012-09-10 14:52:30 -07005115 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005116 String path, ParcelFileDescriptor fd) throws RemoteException {
5117 Parcel data = Parcel.obtain();
5118 Parcel reply = Parcel.obtain();
5119 data.writeInterfaceToken(IActivityManager.descriptor);
5120 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005121 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005122 data.writeInt(managed ? 1 : 0);
5123 data.writeString(path);
5124 if (fd != null) {
5125 data.writeInt(1);
5126 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5127 } else {
5128 data.writeInt(0);
5129 }
5130 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5131 reply.readException();
5132 boolean res = reply.readInt() != 0;
5133 reply.recycle();
5134 data.recycle();
5135 return res;
5136 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005137
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005138 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005139 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005140 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005141 Parcel data = Parcel.obtain();
5142 Parcel reply = Parcel.obtain();
5143 data.writeInterfaceToken(IActivityManager.descriptor);
5144 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005145 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005146 data.writeTypedArray(intents, 0);
5147 data.writeStringArray(resolvedTypes);
5148 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005149 if (options != null) {
5150 data.writeInt(1);
5151 options.writeToParcel(data, 0);
5152 } else {
5153 data.writeInt(0);
5154 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005155 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005156 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5157 reply.readException();
5158 int result = reply.readInt();
5159 reply.recycle();
5160 data.recycle();
5161 return result;
5162 }
5163
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005164 public int getFrontActivityScreenCompatMode() throws RemoteException {
5165 Parcel data = Parcel.obtain();
5166 Parcel reply = Parcel.obtain();
5167 data.writeInterfaceToken(IActivityManager.descriptor);
5168 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5169 reply.readException();
5170 int mode = reply.readInt();
5171 reply.recycle();
5172 data.recycle();
5173 return mode;
5174 }
5175
5176 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5177 Parcel data = Parcel.obtain();
5178 Parcel reply = Parcel.obtain();
5179 data.writeInterfaceToken(IActivityManager.descriptor);
5180 data.writeInt(mode);
5181 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5182 reply.readException();
5183 reply.recycle();
5184 data.recycle();
5185 }
5186
5187 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5188 Parcel data = Parcel.obtain();
5189 Parcel reply = Parcel.obtain();
5190 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005191 data.writeString(packageName);
5192 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005193 reply.readException();
5194 int mode = reply.readInt();
5195 reply.recycle();
5196 data.recycle();
5197 return mode;
5198 }
5199
5200 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005201 throws RemoteException {
5202 Parcel data = Parcel.obtain();
5203 Parcel reply = Parcel.obtain();
5204 data.writeInterfaceToken(IActivityManager.descriptor);
5205 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005206 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005207 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5208 reply.readException();
5209 reply.recycle();
5210 data.recycle();
5211 }
5212
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005213 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5214 Parcel data = Parcel.obtain();
5215 Parcel reply = Parcel.obtain();
5216 data.writeInterfaceToken(IActivityManager.descriptor);
5217 data.writeString(packageName);
5218 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5219 reply.readException();
5220 boolean ask = reply.readInt() != 0;
5221 reply.recycle();
5222 data.recycle();
5223 return ask;
5224 }
5225
5226 public void setPackageAskScreenCompat(String packageName, boolean ask)
5227 throws RemoteException {
5228 Parcel data = Parcel.obtain();
5229 Parcel reply = Parcel.obtain();
5230 data.writeInterfaceToken(IActivityManager.descriptor);
5231 data.writeString(packageName);
5232 data.writeInt(ask ? 1 : 0);
5233 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5234 reply.readException();
5235 reply.recycle();
5236 data.recycle();
5237 }
5238
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005239 public boolean switchUser(int userid) throws RemoteException {
5240 Parcel data = Parcel.obtain();
5241 Parcel reply = Parcel.obtain();
5242 data.writeInterfaceToken(IActivityManager.descriptor);
5243 data.writeInt(userid);
5244 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5245 reply.readException();
5246 boolean result = reply.readInt() != 0;
5247 reply.recycle();
5248 data.recycle();
5249 return result;
5250 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005251
Kenny Guy08488bf2014-02-21 17:40:37 +00005252 public boolean startUserInBackground(int userid) throws RemoteException {
5253 Parcel data = Parcel.obtain();
5254 Parcel reply = Parcel.obtain();
5255 data.writeInterfaceToken(IActivityManager.descriptor);
5256 data.writeInt(userid);
5257 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5258 reply.readException();
5259 boolean result = reply.readInt() != 0;
5260 reply.recycle();
5261 data.recycle();
5262 return result;
5263 }
5264
Jeff Sharkeyba512352015-11-12 20:17:45 -08005265 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5266 Parcel data = Parcel.obtain();
5267 Parcel reply = Parcel.obtain();
5268 data.writeInterfaceToken(IActivityManager.descriptor);
5269 data.writeInt(userId);
5270 data.writeByteArray(token);
5271 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5272 reply.readException();
5273 boolean result = reply.readInt() != 0;
5274 reply.recycle();
5275 data.recycle();
5276 return result;
5277 }
5278
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005279 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5280 Parcel data = Parcel.obtain();
5281 Parcel reply = Parcel.obtain();
5282 data.writeInterfaceToken(IActivityManager.descriptor);
5283 data.writeInt(userid);
5284 data.writeStrongInterface(callback);
5285 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5286 reply.readException();
5287 int result = reply.readInt();
5288 reply.recycle();
5289 data.recycle();
5290 return result;
5291 }
5292
Amith Yamasani52f1d752012-03-28 18:19:29 -07005293 public UserInfo getCurrentUser() throws RemoteException {
5294 Parcel data = Parcel.obtain();
5295 Parcel reply = Parcel.obtain();
5296 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005297 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005298 reply.readException();
5299 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5300 reply.recycle();
5301 data.recycle();
5302 return userInfo;
5303 }
5304
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005305 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005306 Parcel data = Parcel.obtain();
5307 Parcel reply = Parcel.obtain();
5308 data.writeInterfaceToken(IActivityManager.descriptor);
5309 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005310 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005311 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5312 reply.readException();
5313 boolean result = reply.readInt() != 0;
5314 reply.recycle();
5315 data.recycle();
5316 return result;
5317 }
5318
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005319 public int[] getRunningUserIds() throws RemoteException {
5320 Parcel data = Parcel.obtain();
5321 Parcel reply = Parcel.obtain();
5322 data.writeInterfaceToken(IActivityManager.descriptor);
5323 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5324 reply.readException();
5325 int[] result = reply.createIntArray();
5326 reply.recycle();
5327 data.recycle();
5328 return result;
5329 }
5330
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005331 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005332 Parcel data = Parcel.obtain();
5333 Parcel reply = Parcel.obtain();
5334 data.writeInterfaceToken(IActivityManager.descriptor);
5335 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005336 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5337 reply.readException();
5338 boolean result = reply.readInt() != 0;
5339 reply.recycle();
5340 data.recycle();
5341 return result;
5342 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005343
Jeff Sharkeya4620792011-05-20 15:29:23 -07005344 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5345 Parcel data = Parcel.obtain();
5346 Parcel reply = Parcel.obtain();
5347 data.writeInterfaceToken(IActivityManager.descriptor);
5348 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5349 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5350 reply.readException();
5351 data.recycle();
5352 reply.recycle();
5353 }
5354
5355 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5356 Parcel data = Parcel.obtain();
5357 Parcel reply = Parcel.obtain();
5358 data.writeInterfaceToken(IActivityManager.descriptor);
5359 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5360 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5361 reply.readException();
5362 data.recycle();
5363 reply.recycle();
5364 }
5365
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005366 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005367 Parcel data = Parcel.obtain();
5368 Parcel reply = Parcel.obtain();
5369 data.writeInterfaceToken(IActivityManager.descriptor);
5370 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005371 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005372 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5373 reply.readException();
5374 data.recycle();
5375 reply.recycle();
5376 }
5377
5378 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5379 Parcel data = Parcel.obtain();
5380 Parcel reply = Parcel.obtain();
5381 data.writeInterfaceToken(IActivityManager.descriptor);
5382 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5383 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5384 reply.readException();
5385 data.recycle();
5386 reply.recycle();
5387 }
5388
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005389 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5390 Parcel data = Parcel.obtain();
5391 Parcel reply = Parcel.obtain();
5392 data.writeInterfaceToken(IActivityManager.descriptor);
5393 data.writeStrongBinder(sender.asBinder());
5394 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5395 reply.readException();
5396 boolean res = reply.readInt() != 0;
5397 data.recycle();
5398 reply.recycle();
5399 return res;
5400 }
5401
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005402 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5403 Parcel data = Parcel.obtain();
5404 Parcel reply = Parcel.obtain();
5405 data.writeInterfaceToken(IActivityManager.descriptor);
5406 data.writeStrongBinder(sender.asBinder());
5407 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5408 reply.readException();
5409 boolean res = reply.readInt() != 0;
5410 data.recycle();
5411 reply.recycle();
5412 return res;
5413 }
5414
Dianne Hackborn81038902012-11-26 17:04:09 -08005415 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5416 Parcel data = Parcel.obtain();
5417 Parcel reply = Parcel.obtain();
5418 data.writeInterfaceToken(IActivityManager.descriptor);
5419 data.writeStrongBinder(sender.asBinder());
5420 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5421 reply.readException();
5422 Intent res = reply.readInt() != 0
5423 ? Intent.CREATOR.createFromParcel(reply) : null;
5424 data.recycle();
5425 reply.recycle();
5426 return res;
5427 }
5428
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005429 public String getTagForIntentSender(IIntentSender sender, String prefix)
5430 throws RemoteException {
5431 Parcel data = Parcel.obtain();
5432 Parcel reply = Parcel.obtain();
5433 data.writeInterfaceToken(IActivityManager.descriptor);
5434 data.writeStrongBinder(sender.asBinder());
5435 data.writeString(prefix);
5436 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5437 reply.readException();
5438 String res = reply.readString();
5439 data.recycle();
5440 reply.recycle();
5441 return res;
5442 }
5443
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005444 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5445 {
5446 Parcel data = Parcel.obtain();
5447 Parcel reply = Parcel.obtain();
5448 data.writeInterfaceToken(IActivityManager.descriptor);
5449 values.writeToParcel(data, 0);
5450 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5451 reply.readException();
5452 data.recycle();
5453 reply.recycle();
5454 }
5455
Dianne Hackbornb437e092011-08-05 17:50:29 -07005456 public long[] getProcessPss(int[] pids) throws RemoteException {
5457 Parcel data = Parcel.obtain();
5458 Parcel reply = Parcel.obtain();
5459 data.writeInterfaceToken(IActivityManager.descriptor);
5460 data.writeIntArray(pids);
5461 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5462 reply.readException();
5463 long[] res = reply.createLongArray();
5464 data.recycle();
5465 reply.recycle();
5466 return res;
5467 }
5468
Dianne Hackborn661cd522011-08-22 00:26:20 -07005469 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5470 Parcel data = Parcel.obtain();
5471 Parcel reply = Parcel.obtain();
5472 data.writeInterfaceToken(IActivityManager.descriptor);
5473 TextUtils.writeToParcel(msg, data, 0);
5474 data.writeInt(always ? 1 : 0);
5475 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5476 reply.readException();
5477 data.recycle();
5478 reply.recycle();
5479 }
5480
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005481 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005482 Parcel data = Parcel.obtain();
5483 Parcel reply = Parcel.obtain();
5484 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005485 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005486 reply.readException();
5487 data.recycle();
5488 reply.recycle();
5489 }
5490
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005491 public void keyguardGoingAway(boolean disableWindowAnimations,
5492 boolean keyguardGoingToNotificationShade) throws RemoteException {
5493 Parcel data = Parcel.obtain();
5494 Parcel reply = Parcel.obtain();
5495 data.writeInterfaceToken(IActivityManager.descriptor);
5496 data.writeInt(disableWindowAnimations ? 1 : 0);
5497 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5498 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5499 reply.readException();
5500 data.recycle();
5501 reply.recycle();
5502 }
5503
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005504 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005505 throws RemoteException {
5506 Parcel data = Parcel.obtain();
5507 Parcel reply = Parcel.obtain();
5508 data.writeInterfaceToken(IActivityManager.descriptor);
5509 data.writeStrongBinder(token);
5510 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005511 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005512 reply.readException();
5513 boolean result = reply.readInt() != 0;
5514 data.recycle();
5515 reply.recycle();
5516 return result;
5517 }
5518
5519 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5520 throws RemoteException {
5521 Parcel data = Parcel.obtain();
5522 Parcel reply = Parcel.obtain();
5523 data.writeInterfaceToken(IActivityManager.descriptor);
5524 data.writeStrongBinder(token);
5525 target.writeToParcel(data, 0);
5526 data.writeInt(resultCode);
5527 if (resultData != null) {
5528 data.writeInt(1);
5529 resultData.writeToParcel(data, 0);
5530 } else {
5531 data.writeInt(0);
5532 }
5533 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5534 reply.readException();
5535 boolean result = reply.readInt() != 0;
5536 data.recycle();
5537 reply.recycle();
5538 return result;
5539 }
5540
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005541 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5542 Parcel data = Parcel.obtain();
5543 Parcel reply = Parcel.obtain();
5544 data.writeInterfaceToken(IActivityManager.descriptor);
5545 data.writeStrongBinder(activityToken);
5546 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5547 reply.readException();
5548 int result = reply.readInt();
5549 data.recycle();
5550 reply.recycle();
5551 return result;
5552 }
5553
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005554 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5555 Parcel data = Parcel.obtain();
5556 Parcel reply = Parcel.obtain();
5557 data.writeInterfaceToken(IActivityManager.descriptor);
5558 data.writeStrongBinder(activityToken);
5559 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5560 reply.readException();
5561 String result = reply.readString();
5562 data.recycle();
5563 reply.recycle();
5564 return result;
5565 }
5566
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005567 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5568 Parcel data = Parcel.obtain();
5569 Parcel reply = Parcel.obtain();
5570 data.writeInterfaceToken(IActivityManager.descriptor);
5571 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5572 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5573 reply.readException();
5574 data.recycle();
5575 reply.recycle();
5576 }
5577
5578 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5579 Parcel data = Parcel.obtain();
5580 Parcel reply = Parcel.obtain();
5581 data.writeInterfaceToken(IActivityManager.descriptor);
5582 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5583 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5584 reply.readException();
5585 data.recycle();
5586 reply.recycle();
5587 }
5588
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005589 public void requestBugReport() throws RemoteException {
5590 Parcel data = Parcel.obtain();
5591 Parcel reply = Parcel.obtain();
5592 data.writeInterfaceToken(IActivityManager.descriptor);
5593 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5594 reply.readException();
5595 data.recycle();
5596 reply.recycle();
5597 }
5598
Jeff Brownbd181bb2013-09-10 16:44:24 -07005599 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5600 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005601 Parcel data = Parcel.obtain();
5602 Parcel reply = Parcel.obtain();
5603 data.writeInterfaceToken(IActivityManager.descriptor);
5604 data.writeInt(pid);
5605 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005606 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005607 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5608 reply.readException();
5609 long res = reply.readInt();
5610 data.recycle();
5611 reply.recycle();
5612 return res;
5613 }
5614
Adam Skorydfc7fd72013-08-05 19:23:41 -07005615 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005616 Parcel data = Parcel.obtain();
5617 Parcel reply = Parcel.obtain();
5618 data.writeInterfaceToken(IActivityManager.descriptor);
5619 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005620 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005621 reply.readException();
5622 Bundle res = reply.readBundle();
5623 data.recycle();
5624 reply.recycle();
5625 return res;
5626 }
5627
Dianne Hackborn17f69352015-07-17 18:04:14 -07005628 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5629 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005630 Parcel data = Parcel.obtain();
5631 Parcel reply = Parcel.obtain();
5632 data.writeInterfaceToken(IActivityManager.descriptor);
5633 data.writeInt(requestType);
5634 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005635 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005636 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5637 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005638 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005639 data.recycle();
5640 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005641 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005642 }
5643
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005644 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005645 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005646 Parcel data = Parcel.obtain();
5647 Parcel reply = Parcel.obtain();
5648 data.writeInterfaceToken(IActivityManager.descriptor);
5649 data.writeStrongBinder(token);
5650 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005651 structure.writeToParcel(data, 0);
5652 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005653 if (referrer != null) {
5654 data.writeInt(1);
5655 referrer.writeToParcel(data, 0);
5656 } else {
5657 data.writeInt(0);
5658 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005659 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005660 reply.readException();
5661 data.recycle();
5662 reply.recycle();
5663 }
5664
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005665 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5666 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005667 Parcel data = Parcel.obtain();
5668 Parcel reply = Parcel.obtain();
5669 data.writeInterfaceToken(IActivityManager.descriptor);
5670 intent.writeToParcel(data, 0);
5671 data.writeInt(requestType);
5672 data.writeString(hint);
5673 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005674 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005675 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5676 reply.readException();
5677 boolean res = reply.readInt() != 0;
5678 data.recycle();
5679 reply.recycle();
5680 return res;
5681 }
5682
Dianne Hackborn17f69352015-07-17 18:04:14 -07005683 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005684 Parcel data = Parcel.obtain();
5685 Parcel reply = Parcel.obtain();
5686 data.writeInterfaceToken(IActivityManager.descriptor);
5687 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5688 reply.readException();
5689 boolean res = reply.readInt() != 0;
5690 data.recycle();
5691 reply.recycle();
5692 return res;
5693 }
5694
Dianne Hackborn17f69352015-07-17 18:04:14 -07005695 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5696 Parcel data = Parcel.obtain();
5697 Parcel reply = Parcel.obtain();
5698 data.writeInterfaceToken(IActivityManager.descriptor);
5699 data.writeStrongBinder(token);
5700 data.writeBundle(args);
5701 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5702 reply.readException();
5703 boolean res = reply.readInt() != 0;
5704 data.recycle();
5705 reply.recycle();
5706 return res;
5707 }
5708
Svetoslavaa41add2015-08-06 15:03:55 -07005709 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005710 Parcel data = Parcel.obtain();
5711 Parcel reply = Parcel.obtain();
5712 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005713 data.writeInt(appId);
5714 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005715 data.writeString(reason);
5716 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5717 reply.readException();
5718 data.recycle();
5719 reply.recycle();
5720 }
5721
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005722 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5723 Parcel data = Parcel.obtain();
5724 Parcel reply = Parcel.obtain();
5725 data.writeInterfaceToken(IActivityManager.descriptor);
5726 data.writeStrongBinder(who);
5727 data.writeInt(allowRestart ? 1 : 0);
5728 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5729 reply.readException();
5730 data.recycle();
5731 reply.recycle();
5732 }
5733
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005734 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5735 Parcel data = Parcel.obtain();
5736 Parcel reply = Parcel.obtain();
5737 data.writeInterfaceToken(IActivityManager.descriptor);
5738 data.writeStrongBinder(token);
5739 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5740 reply.readException();
5741 data.recycle();
5742 reply.recycle();
5743 }
5744
Craig Mautner5eda9b32013-07-02 11:58:16 -07005745 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5746 Parcel data = Parcel.obtain();
5747 Parcel reply = Parcel.obtain();
5748 data.writeInterfaceToken(IActivityManager.descriptor);
5749 data.writeStrongBinder(token);
5750 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5751 reply.readException();
5752 data.recycle();
5753 reply.recycle();
5754 }
5755
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005756 public void restart() throws RemoteException {
5757 Parcel data = Parcel.obtain();
5758 Parcel reply = Parcel.obtain();
5759 data.writeInterfaceToken(IActivityManager.descriptor);
5760 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5761 reply.readException();
5762 data.recycle();
5763 reply.recycle();
5764 }
5765
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005766 public void performIdleMaintenance() throws RemoteException {
5767 Parcel data = Parcel.obtain();
5768 Parcel reply = Parcel.obtain();
5769 data.writeInterfaceToken(IActivityManager.descriptor);
5770 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5771 reply.readException();
5772 data.recycle();
5773 reply.recycle();
5774 }
5775
Todd Kennedyca4d8422015-01-15 15:19:22 -08005776 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005777 IActivityContainerCallback callback) throws RemoteException {
5778 Parcel data = Parcel.obtain();
5779 Parcel reply = Parcel.obtain();
5780 data.writeInterfaceToken(IActivityManager.descriptor);
5781 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005782 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005783 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005784 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005785 final int result = reply.readInt();
5786 final IActivityContainer res;
5787 if (result == 1) {
5788 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5789 } else {
5790 res = null;
5791 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005792 data.recycle();
5793 reply.recycle();
5794 return res;
5795 }
5796
Craig Mautner95da1082014-02-24 17:54:35 -08005797 public void deleteActivityContainer(IActivityContainer activityContainer)
5798 throws RemoteException {
5799 Parcel data = Parcel.obtain();
5800 Parcel reply = Parcel.obtain();
5801 data.writeInterfaceToken(IActivityManager.descriptor);
5802 data.writeStrongBinder(activityContainer.asBinder());
5803 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5804 reply.readException();
5805 data.recycle();
5806 reply.recycle();
5807 }
5808
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005809 public boolean startBinderTracking() throws RemoteException {
5810 Parcel data = Parcel.obtain();
5811 Parcel reply = Parcel.obtain();
5812 data.writeInterfaceToken(IActivityManager.descriptor);
5813 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5814 reply.readException();
5815 boolean res = reply.readInt() != 0;
5816 reply.recycle();
5817 data.recycle();
5818 return res;
5819 }
5820
5821 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5822 Parcel data = Parcel.obtain();
5823 Parcel reply = Parcel.obtain();
5824 data.writeInterfaceToken(IActivityManager.descriptor);
5825 if (fd != null) {
5826 data.writeInt(1);
5827 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5828 } else {
5829 data.writeInt(0);
5830 }
5831 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5832 reply.readException();
5833 boolean res = reply.readInt() != 0;
5834 reply.recycle();
5835 data.recycle();
5836 return res;
5837 }
5838
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005839 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005840 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5841 Parcel data = Parcel.obtain();
5842 Parcel reply = Parcel.obtain();
5843 data.writeInterfaceToken(IActivityManager.descriptor);
5844 data.writeInt(displayId);
5845 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5846 reply.readException();
5847 final int result = reply.readInt();
5848 final IActivityContainer res;
5849 if (result == 1) {
5850 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5851 } else {
5852 res = null;
5853 }
5854 data.recycle();
5855 reply.recycle();
5856 return res;
5857 }
5858
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005859 @Override
5860 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005861 throws RemoteException {
5862 Parcel data = Parcel.obtain();
5863 Parcel reply = Parcel.obtain();
5864 data.writeInterfaceToken(IActivityManager.descriptor);
5865 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005866 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005867 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005868 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005869 data.recycle();
5870 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005871 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005872 }
5873
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005874 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005875 public void startLockTaskMode(int taskId) throws RemoteException {
5876 Parcel data = Parcel.obtain();
5877 Parcel reply = Parcel.obtain();
5878 data.writeInterfaceToken(IActivityManager.descriptor);
5879 data.writeInt(taskId);
5880 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5881 reply.readException();
5882 data.recycle();
5883 reply.recycle();
5884 }
5885
5886 @Override
5887 public void startLockTaskMode(IBinder token) throws RemoteException {
5888 Parcel data = Parcel.obtain();
5889 Parcel reply = Parcel.obtain();
5890 data.writeInterfaceToken(IActivityManager.descriptor);
5891 data.writeStrongBinder(token);
5892 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5893 reply.readException();
5894 data.recycle();
5895 reply.recycle();
5896 }
5897
5898 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005899 public void startLockTaskModeOnCurrent() throws RemoteException {
5900 Parcel data = Parcel.obtain();
5901 Parcel reply = Parcel.obtain();
5902 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005903 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005904 reply.readException();
5905 data.recycle();
5906 reply.recycle();
5907 }
5908
5909 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005910 public void stopLockTaskMode() throws RemoteException {
5911 Parcel data = Parcel.obtain();
5912 Parcel reply = Parcel.obtain();
5913 data.writeInterfaceToken(IActivityManager.descriptor);
5914 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5915 reply.readException();
5916 data.recycle();
5917 reply.recycle();
5918 }
5919
5920 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005921 public void stopLockTaskModeOnCurrent() throws RemoteException {
5922 Parcel data = Parcel.obtain();
5923 Parcel reply = Parcel.obtain();
5924 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005925 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005926 reply.readException();
5927 data.recycle();
5928 reply.recycle();
5929 }
5930
5931 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005932 public boolean isInLockTaskMode() throws RemoteException {
5933 Parcel data = Parcel.obtain();
5934 Parcel reply = Parcel.obtain();
5935 data.writeInterfaceToken(IActivityManager.descriptor);
5936 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5937 reply.readException();
5938 boolean isInLockTaskMode = reply.readInt() == 1;
5939 data.recycle();
5940 reply.recycle();
5941 return isInLockTaskMode;
5942 }
5943
Craig Mautner688b5102014-03-27 16:55:03 -07005944 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005945 public int getLockTaskModeState() throws RemoteException {
5946 Parcel data = Parcel.obtain();
5947 Parcel reply = Parcel.obtain();
5948 data.writeInterfaceToken(IActivityManager.descriptor);
5949 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5950 reply.readException();
5951 int lockTaskModeState = reply.readInt();
5952 data.recycle();
5953 reply.recycle();
5954 return lockTaskModeState;
5955 }
5956
5957 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005958 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5959 Parcel data = Parcel.obtain();
5960 Parcel reply = Parcel.obtain();
5961 data.writeInterfaceToken(IActivityManager.descriptor);
5962 data.writeStrongBinder(token);
5963 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5964 IBinder.FLAG_ONEWAY);
5965 reply.readException();
5966 data.recycle();
5967 reply.recycle();
5968 }
5969
5970 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005971 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005972 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005973 Parcel data = Parcel.obtain();
5974 Parcel reply = Parcel.obtain();
5975 data.writeInterfaceToken(IActivityManager.descriptor);
5976 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005977 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005978 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005979 reply.readException();
5980 data.recycle();
5981 reply.recycle();
5982 }
5983
Craig Mautneree2e45a2014-06-27 12:10:03 -07005984 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005985 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5986 Parcel data = Parcel.obtain();
5987 Parcel reply = Parcel.obtain();
5988 data.writeInterfaceToken(IActivityManager.descriptor);
5989 data.writeInt(taskId);
5990 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005991 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005992 reply.readException();
5993 data.recycle();
5994 reply.recycle();
5995 }
5996
5997 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07005998 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005999 {
6000 Parcel data = Parcel.obtain();
6001 Parcel reply = Parcel.obtain();
6002 data.writeInterfaceToken(IActivityManager.descriptor);
6003 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006004 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006005 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006006 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006007 reply.readException();
6008 data.recycle();
6009 reply.recycle();
6010 }
6011
6012 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006013 public Rect getTaskBounds(int taskId) throws RemoteException
6014 {
6015 Parcel data = Parcel.obtain();
6016 Parcel reply = Parcel.obtain();
6017 data.writeInterfaceToken(IActivityManager.descriptor);
6018 data.writeInt(taskId);
6019 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6020 reply.readException();
6021 Rect rect = Rect.CREATOR.createFromParcel(reply);
6022 data.recycle();
6023 reply.recycle();
6024 return rect;
6025 }
6026
6027 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006028 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006029 Parcel data = Parcel.obtain();
6030 Parcel reply = Parcel.obtain();
6031 data.writeInterfaceToken(IActivityManager.descriptor);
6032 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006033 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006034 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6035 reply.readException();
6036 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6037 data.recycle();
6038 reply.recycle();
6039 return icon;
6040 }
6041
6042 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006043 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6044 throws RemoteException {
6045 Parcel data = Parcel.obtain();
6046 Parcel reply = Parcel.obtain();
6047 data.writeInterfaceToken(IActivityManager.descriptor);
6048 if (options == null) {
6049 data.writeInt(0);
6050 } else {
6051 data.writeInt(1);
6052 data.writeBundle(options.toBundle());
6053 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006054 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006055 reply.readException();
6056 data.recycle();
6057 reply.recycle();
6058 }
6059
6060 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006061 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006062 Parcel data = Parcel.obtain();
6063 Parcel reply = Parcel.obtain();
6064 data.writeInterfaceToken(IActivityManager.descriptor);
6065 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006066 data.writeInt(visible ? 1 : 0);
6067 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006068 reply.readException();
6069 boolean success = reply.readInt() > 0;
6070 data.recycle();
6071 reply.recycle();
6072 return success;
6073 }
6074
6075 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006076 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006077 Parcel data = Parcel.obtain();
6078 Parcel reply = Parcel.obtain();
6079 data.writeInterfaceToken(IActivityManager.descriptor);
6080 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006081 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006082 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006083 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006084 data.recycle();
6085 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006086 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006087 }
6088
6089 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006090 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006091 Parcel data = Parcel.obtain();
6092 Parcel reply = Parcel.obtain();
6093 data.writeInterfaceToken(IActivityManager.descriptor);
6094 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006095 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006096 reply.readException();
6097 data.recycle();
6098 reply.recycle();
6099 }
6100
6101 @Override
6102 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6103 Parcel data = Parcel.obtain();
6104 Parcel reply = Parcel.obtain();
6105 data.writeInterfaceToken(IActivityManager.descriptor);
6106 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006107 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006108 reply.readException();
6109 data.recycle();
6110 reply.recycle();
6111 }
6112
Craig Mautner8746a472014-07-24 15:12:54 -07006113 @Override
6114 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6115 Parcel data = Parcel.obtain();
6116 Parcel reply = Parcel.obtain();
6117 data.writeInterfaceToken(IActivityManager.descriptor);
6118 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006119 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006120 reply.readException();
6121 data.recycle();
6122 reply.recycle();
6123 }
6124
Craig Mautner6e2f3952014-09-09 14:26:41 -07006125 @Override
6126 public void bootAnimationComplete() throws RemoteException {
6127 Parcel data = Parcel.obtain();
6128 Parcel reply = Parcel.obtain();
6129 data.writeInterfaceToken(IActivityManager.descriptor);
6130 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6131 reply.readException();
6132 data.recycle();
6133 reply.recycle();
6134 }
6135
Wale Ogunwale18795a22014-12-03 11:38:33 -08006136 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006137 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6138 Parcel data = Parcel.obtain();
6139 Parcel reply = Parcel.obtain();
6140 data.writeInterfaceToken(IActivityManager.descriptor);
6141 data.writeInt(uid);
6142 data.writeByteArray(firstPacket);
6143 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6144 reply.readException();
6145 data.recycle();
6146 reply.recycle();
6147 }
6148
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006149 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006150 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6151 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006152 Parcel data = Parcel.obtain();
6153 Parcel reply = Parcel.obtain();
6154 data.writeInterfaceToken(IActivityManager.descriptor);
6155 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006156 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006157 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006158 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006159 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6160 reply.readException();
6161 data.recycle();
6162 reply.recycle();
6163 }
6164
6165 @Override
6166 public void dumpHeapFinished(String path) throws RemoteException {
6167 Parcel data = Parcel.obtain();
6168 Parcel reply = Parcel.obtain();
6169 data.writeInterfaceToken(IActivityManager.descriptor);
6170 data.writeString(path);
6171 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6172 reply.readException();
6173 data.recycle();
6174 reply.recycle();
6175 }
6176
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006177 @Override
6178 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6179 throws RemoteException {
6180 Parcel data = Parcel.obtain();
6181 Parcel reply = Parcel.obtain();
6182 data.writeInterfaceToken(IActivityManager.descriptor);
6183 data.writeStrongBinder(session.asBinder());
6184 data.writeInt(keepAwake ? 1 : 0);
6185 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6186 reply.readException();
6187 data.recycle();
6188 reply.recycle();
6189 }
6190
Craig Mautnere5600772015-04-03 21:36:37 -07006191 @Override
6192 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6193 Parcel data = Parcel.obtain();
6194 Parcel reply = Parcel.obtain();
6195 data.writeInterfaceToken(IActivityManager.descriptor);
6196 data.writeInt(userId);
6197 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006198 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006199 reply.readException();
6200 data.recycle();
6201 reply.recycle();
6202 }
6203
Dianne Hackborn1e383822015-04-10 14:02:33 -07006204 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006205 public void updateDeviceOwner(String packageName) throws RemoteException {
6206 Parcel data = Parcel.obtain();
6207 Parcel reply = Parcel.obtain();
6208 data.writeInterfaceToken(IActivityManager.descriptor);
6209 data.writeString(packageName);
6210 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6211 reply.readException();
6212 data.recycle();
6213 reply.recycle();
6214 }
6215
6216 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006217 public int getPackageProcessState(String packageName, String callingPackage)
6218 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006219 Parcel data = Parcel.obtain();
6220 Parcel reply = Parcel.obtain();
6221 data.writeInterfaceToken(IActivityManager.descriptor);
6222 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006223 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006224 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6225 reply.readException();
6226 int res = reply.readInt();
6227 data.recycle();
6228 reply.recycle();
6229 return res;
6230 }
6231
Stefan Kuhne16045c22015-06-05 07:18:06 -07006232 @Override
6233 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6234 throws RemoteException {
6235 Parcel data = Parcel.obtain();
6236 Parcel reply = Parcel.obtain();
6237 data.writeInterfaceToken(IActivityManager.descriptor);
6238 data.writeString(process);
6239 data.writeInt(userId);
6240 data.writeInt(level);
6241 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6242 reply.readException();
6243 int res = reply.readInt();
6244 data.recycle();
6245 reply.recycle();
6246 return res != 0;
6247 }
6248
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006249 @Override
6250 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6251 Parcel data = Parcel.obtain();
6252 Parcel reply = Parcel.obtain();
6253 data.writeInterfaceToken(IActivityManager.descriptor);
6254 data.writeStrongBinder(token);
6255 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6256 reply.readException();
6257 int res = reply.readInt();
6258 data.recycle();
6259 reply.recycle();
6260 return res != 0;
6261 }
6262
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006263 @Override
6264 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6265 Parcel data = Parcel.obtain();
6266 Parcel reply = Parcel.obtain();
6267 data.writeInterfaceToken(IActivityManager.descriptor);
6268 data.writeStrongBinder(token);
6269 data.writeInt(stackId);
6270 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6271 reply.readException();
6272 data.recycle();
6273 reply.recycle();
6274 }
6275
6276 @Override
6277 public int getActivityStackId(IBinder token) throws RemoteException {
6278 Parcel data = Parcel.obtain();
6279 Parcel reply = Parcel.obtain();
6280 data.writeInterfaceToken(IActivityManager.descriptor);
6281 data.writeStrongBinder(token);
6282 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6283 reply.readException();
6284 int stackId = reply.readInt();
6285 data.recycle();
6286 reply.recycle();
6287 return stackId;
6288 }
6289
Filip Gruszczynski23493322015-07-29 17:02:59 -07006290 @Override
6291 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006292 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6293 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006294 Parcel data = Parcel.obtain();
6295 Parcel reply = Parcel.obtain();
6296 data.writeInterfaceToken(IActivityManager.descriptor);
6297 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006298 writeIntArray(horizontalSizeConfiguration, data);
6299 writeIntArray(verticalSizeConfigurations, data);
6300 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006301 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6302 reply.readException();
6303 data.recycle();
6304 reply.recycle();
6305 }
6306
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006307 private static void writeIntArray(int[] array, Parcel data) {
6308 if (array == null) {
6309 data.writeInt(0);
6310 } else {
6311 data.writeInt(array.length);
6312 data.writeIntArray(array);
6313 }
6314 }
6315
Wale Ogunwale83301a92015-09-24 15:54:08 -07006316 @Override
6317 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6318 Parcel data = Parcel.obtain();
6319 Parcel reply = Parcel.obtain();
6320 data.writeInterfaceToken(IActivityManager.descriptor);
6321 data.writeInt(suppress ? 1 : 0);
6322 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6323 reply.readException();
6324 data.recycle();
6325 reply.recycle();
6326 }
6327
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006328 @Override
6329 public void removeStack(int stackId) throws RemoteException {
6330 Parcel data = Parcel.obtain();
6331 Parcel reply = Parcel.obtain();
6332 data.writeInterfaceToken(IActivityManager.descriptor);
6333 data.writeInt(stackId);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006334 mRemote.transact(REMOVE_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006335 reply.readException();
6336 data.recycle();
6337 reply.recycle();
6338 }
6339
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006340 @Override
6341 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6342 Parcel data = Parcel.obtain();
6343 Parcel reply = Parcel.obtain();
6344 data.writeInterfaceToken(IActivityManager.descriptor);
6345 data.writeInt(uid);
6346 data.writeString(packageName);
6347 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6348 reply.readException();
6349 int res = reply.readInt();
6350 data.recycle();
6351 reply.recycle();
6352 return res;
6353 }
6354
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006355 private IBinder mRemote;
6356}