blob: f5d7e7e068cf8660779644d13118422b36a9bcdc [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Tony Mak9c6e8ce2016-03-21 12:07:16 +000019import android.annotation.UserIdInt;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080020import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070021import android.app.assist.AssistContent;
22import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070024import android.content.IIntentReceiver;
25import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.Intent;
27import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070028import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070029import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070030import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import android.content.pm.ConfigurationInfo;
32import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070033import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070034import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070036import android.graphics.Bitmap;
37import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080038import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.net.Uri;
40import android.os.Binder;
41import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070042import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.os.IBinder;
44import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070045import android.os.ParcelFileDescriptor;
46import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070047import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070048import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070050import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070051import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080054import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070055import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080056import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058import java.util.ArrayList;
59import java.util.List;
60
61/** {@hide} */
62public abstract class ActivityManagerNative extends Binder implements IActivityManager
63{
64 /**
65 * Cast a Binder object into an activity manager interface, generating
66 * a proxy if needed.
67 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 if (obj == null) {
70 return null;
71 }
72 IActivityManager in =
73 (IActivityManager)obj.queryLocalInterface(descriptor);
74 if (in != null) {
75 return in;
76 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 return new ActivityManagerProxy(obj);
79 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080080
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 /**
82 * Retrieve the system's default/global activity manager.
83 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080084 static public IActivityManager getDefault() {
85 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 }
87
88 /**
89 * Convenience for checking whether the system is ready. For internal use only.
90 */
91 static public boolean isSystemReady() {
92 if (!sSystemReady) {
93 sSystemReady = getDefault().testIsSystemReady();
94 }
95 return sSystemReady;
96 }
97 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080098
Svet Ganov16a16892015-04-16 10:32:04 -070099 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
100 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
101 }
102
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 /**
104 * Convenience for sending a sticky broadcast. For internal use only.
105 * If you don't care about permission, use null.
106 */
Svet Ganov16a16892015-04-16 10:32:04 -0700107 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
108 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 try {
110 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700111 null, intent, null, null, Activity.RESULT_OK, null, null,
112 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113 } catch (RemoteException ex) {
114 }
115 }
116
Dianne Hackborn1e383822015-04-10 14:02:33 -0700117 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
118 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700120 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
121 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700122 } catch (RemoteException ex) {
123 }
124 }
125
126 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
127 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700128 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700129 } catch (RemoteException ex) {
130 }
131 }
132
133 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
134 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700135 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 } catch (RemoteException ex) {
137 }
138 }
139
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800140 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800141 attachInterface(this, descriptor);
142 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700143
144 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800145 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
146 throws RemoteException {
147 switch (code) {
148 case START_ACTIVITY_TRANSACTION:
149 {
150 data.enforceInterface(IActivityManager.descriptor);
151 IBinder b = data.readStrongBinder();
152 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800153 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 Intent intent = Intent.CREATOR.createFromParcel(data);
155 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800157 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700159 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700160 ProfilerInfo profilerInfo = data.readInt() != 0
161 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700162 Bundle options = data.readInt() != 0
163 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700165 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800166 reply.writeNoException();
167 reply.writeInt(result);
168 return true;
169 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700170
Amith Yamasani82644082012-08-03 13:09:11 -0700171 case START_ACTIVITY_AS_USER_TRANSACTION:
172 {
173 data.enforceInterface(IActivityManager.descriptor);
174 IBinder b = data.readStrongBinder();
175 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800176 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700177 Intent intent = Intent.CREATOR.createFromParcel(data);
178 String resolvedType = data.readString();
179 IBinder resultTo = data.readStrongBinder();
180 String resultWho = data.readString();
181 int requestCode = data.readInt();
182 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700183 ProfilerInfo profilerInfo = data.readInt() != 0
184 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
187 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800188 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700189 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700190 reply.writeNoException();
191 reply.writeInt(result);
192 return true;
193 }
194
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700195 case START_ACTIVITY_AS_CALLER_TRANSACTION:
196 {
197 data.enforceInterface(IActivityManager.descriptor);
198 IBinder b = data.readStrongBinder();
199 IApplicationThread app = ApplicationThreadNative.asInterface(b);
200 String callingPackage = data.readString();
201 Intent intent = Intent.CREATOR.createFromParcel(data);
202 String resolvedType = data.readString();
203 IBinder resultTo = data.readStrongBinder();
204 String resultWho = data.readString();
205 int requestCode = data.readInt();
206 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700207 ProfilerInfo profilerInfo = data.readInt() != 0
208 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700209 Bundle options = data.readInt() != 0
210 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700211 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700212 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700213 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700214 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
215 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700216 reply.writeNoException();
217 reply.writeInt(result);
218 return true;
219 }
220
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800221 case START_ACTIVITY_AND_WAIT_TRANSACTION:
222 {
223 data.enforceInterface(IActivityManager.descriptor);
224 IBinder b = data.readStrongBinder();
225 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800226 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800227 Intent intent = Intent.CREATOR.createFromParcel(data);
228 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800229 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800230 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800231 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700232 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700233 ProfilerInfo profilerInfo = data.readInt() != 0
234 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700235 Bundle options = data.readInt() != 0
236 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700237 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800238 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700239 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800240 reply.writeNoException();
241 result.writeToParcel(reply, 0);
242 return true;
243 }
244
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700245 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
246 {
247 data.enforceInterface(IActivityManager.descriptor);
248 IBinder b = data.readStrongBinder();
249 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800250 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700251 Intent intent = Intent.CREATOR.createFromParcel(data);
252 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700253 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700254 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700255 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700256 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700257 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700258 Bundle options = data.readInt() != 0
259 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700260 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800261 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700262 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700263 reply.writeNoException();
264 reply.writeInt(result);
265 return true;
266 }
267
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700268 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700269 {
270 data.enforceInterface(IActivityManager.descriptor);
271 IBinder b = data.readStrongBinder();
272 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700273 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700274 Intent fillInIntent = null;
275 if (data.readInt() != 0) {
276 fillInIntent = Intent.CREATOR.createFromParcel(data);
277 }
278 String resolvedType = data.readString();
279 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700280 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700281 int requestCode = data.readInt();
282 int flagsMask = data.readInt();
283 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700284 Bundle options = data.readInt() != 0
285 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700286 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700287 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700288 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700289 reply.writeNoException();
290 reply.writeInt(result);
291 return true;
292 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700293
Dianne Hackborn91097de2014-04-04 18:02:06 -0700294 case START_VOICE_ACTIVITY_TRANSACTION:
295 {
296 data.enforceInterface(IActivityManager.descriptor);
297 String callingPackage = data.readString();
298 int callingPid = data.readInt();
299 int callingUid = data.readInt();
300 Intent intent = Intent.CREATOR.createFromParcel(data);
301 String resolvedType = data.readString();
302 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
303 data.readStrongBinder());
304 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
305 data.readStrongBinder());
306 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700307 ProfilerInfo profilerInfo = data.readInt() != 0
308 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700309 Bundle options = data.readInt() != 0
310 ? Bundle.CREATOR.createFromParcel(data) : null;
311 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700312 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
313 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700314 reply.writeNoException();
315 reply.writeInt(result);
316 return true;
317 }
318
Amith Yamasani0af6fa72016-01-17 15:36:19 -0800319 case START_LOCAL_VOICE_INTERACTION_TRANSACTION:
320 {
321 data.enforceInterface(IActivityManager.descriptor);
322 IBinder token = data.readStrongBinder();
323 Bundle options = data.readBundle();
324 startLocalVoiceInteraction(token, options);
325 reply.writeNoException();
326 return true;
327 }
328
329 case STOP_LOCAL_VOICE_INTERACTION_TRANSACTION:
330 {
331 data.enforceInterface(IActivityManager.descriptor);
332 IBinder token = data.readStrongBinder();
333 stopLocalVoiceInteraction(token);
334 reply.writeNoException();
335 return true;
336 }
337
338 case SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION:
339 {
340 data.enforceInterface(IActivityManager.descriptor);
341 boolean result = supportsLocalVoiceInteraction();
342 reply.writeNoException();
343 reply.writeInt(result? 1 : 0);
344 return true;
345 }
346
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
348 {
349 data.enforceInterface(IActivityManager.descriptor);
350 IBinder callingActivity = data.readStrongBinder();
351 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700352 Bundle options = data.readInt() != 0
353 ? Bundle.CREATOR.createFromParcel(data) : null;
354 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 reply.writeNoException();
356 reply.writeInt(result ? 1 : 0);
357 return true;
358 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700359
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700360 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
361 {
362 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700363 final int taskId = data.readInt();
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700364 final Bundle options =
365 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
Wale Ogunwale854809c2015-12-27 16:18:19 -0800366 final int result = startActivityFromRecents(taskId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700367 reply.writeNoException();
368 reply.writeInt(result);
369 return true;
370 }
371
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 case FINISH_ACTIVITY_TRANSACTION: {
373 data.enforceInterface(IActivityManager.descriptor);
374 IBinder token = data.readStrongBinder();
375 Intent resultData = null;
376 int resultCode = data.readInt();
377 if (data.readInt() != 0) {
378 resultData = Intent.CREATOR.createFromParcel(data);
379 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700380 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700381 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 reply.writeNoException();
383 reply.writeInt(res ? 1 : 0);
384 return true;
385 }
386
387 case FINISH_SUB_ACTIVITY_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700390 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 int requestCode = data.readInt();
392 finishSubActivity(token, resultWho, requestCode);
393 reply.writeNoException();
394 return true;
395 }
396
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700397 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
398 data.enforceInterface(IActivityManager.descriptor);
399 IBinder token = data.readStrongBinder();
400 boolean res = finishActivityAffinity(token);
401 reply.writeNoException();
402 reply.writeInt(res ? 1 : 0);
403 return true;
404 }
405
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700406 case FINISH_VOICE_TASK_TRANSACTION: {
407 data.enforceInterface(IActivityManager.descriptor);
408 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
409 data.readStrongBinder());
410 finishVoiceTask(session);
411 reply.writeNoException();
412 return true;
413 }
414
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700415 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder token = data.readStrongBinder();
418 boolean res = releaseActivityInstance(token);
419 reply.writeNoException();
420 reply.writeInt(res ? 1 : 0);
421 return true;
422 }
423
424 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
425 data.enforceInterface(IActivityManager.descriptor);
426 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
427 releaseSomeActivities(app);
428 reply.writeNoException();
429 return true;
430 }
431
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800432 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 IBinder token = data.readStrongBinder();
435 boolean res = willActivityBeVisible(token);
436 reply.writeNoException();
437 reply.writeInt(res ? 1 : 0);
438 return true;
439 }
440
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441 case REGISTER_RECEIVER_TRANSACTION:
442 {
443 data.enforceInterface(IActivityManager.descriptor);
444 IBinder b = data.readStrongBinder();
445 IApplicationThread app =
446 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700447 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800448 b = data.readStrongBinder();
449 IIntentReceiver rec
450 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
451 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
452 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700453 int userId = data.readInt();
454 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455 reply.writeNoException();
456 if (intent != null) {
457 reply.writeInt(1);
458 intent.writeToParcel(reply, 0);
459 } else {
460 reply.writeInt(0);
461 }
462 return true;
463 }
464
465 case UNREGISTER_RECEIVER_TRANSACTION:
466 {
467 data.enforceInterface(IActivityManager.descriptor);
468 IBinder b = data.readStrongBinder();
469 if (b == null) {
470 return true;
471 }
472 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
473 unregisterReceiver(rec);
474 reply.writeNoException();
475 return true;
476 }
477
478 case BROADCAST_INTENT_TRANSACTION:
479 {
480 data.enforceInterface(IActivityManager.descriptor);
481 IBinder b = data.readStrongBinder();
482 IApplicationThread app =
483 b != null ? ApplicationThreadNative.asInterface(b) : null;
484 Intent intent = Intent.CREATOR.createFromParcel(data);
485 String resolvedType = data.readString();
486 b = data.readStrongBinder();
487 IIntentReceiver resultTo =
488 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
489 int resultCode = data.readInt();
490 String resultData = data.readString();
491 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700492 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800493 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700494 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 boolean serialized = data.readInt() != 0;
496 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700497 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700499 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700500 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 reply.writeNoException();
502 reply.writeInt(res);
503 return true;
504 }
505
506 case UNBROADCAST_INTENT_TRANSACTION:
507 {
508 data.enforceInterface(IActivityManager.descriptor);
509 IBinder b = data.readStrongBinder();
510 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
511 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700512 int userId = data.readInt();
513 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 reply.writeNoException();
515 return true;
516 }
517
518 case FINISH_RECEIVER_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 IBinder who = data.readStrongBinder();
521 int resultCode = data.readInt();
522 String resultData = data.readString();
523 Bundle resultExtras = data.readBundle();
524 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800525 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800527 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800528 }
529 reply.writeNoException();
530 return true;
531 }
532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800533 case ATTACH_APPLICATION_TRANSACTION: {
534 data.enforceInterface(IActivityManager.descriptor);
535 IApplicationThread app = ApplicationThreadNative.asInterface(
536 data.readStrongBinder());
537 if (app != null) {
538 attachApplication(app);
539 }
540 reply.writeNoException();
541 return true;
542 }
543
544 case ACTIVITY_IDLE_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700547 Configuration config = null;
548 if (data.readInt() != 0) {
549 config = Configuration.CREATOR.createFromParcel(data);
550 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700551 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700553 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 }
555 reply.writeNoException();
556 return true;
557 }
558
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700559 case ACTIVITY_RESUMED_TRANSACTION: {
560 data.enforceInterface(IActivityManager.descriptor);
561 IBinder token = data.readStrongBinder();
562 activityResumed(token);
563 reply.writeNoException();
564 return true;
565 }
566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800567 case ACTIVITY_PAUSED_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700570 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800571 reply.writeNoException();
572 return true;
573 }
574
575 case ACTIVITY_STOPPED_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800578 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700579 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800580 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700581 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 reply.writeNoException();
583 return true;
584 }
585
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800586 case ACTIVITY_SLEPT_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 IBinder token = data.readStrongBinder();
589 activitySlept(token);
590 reply.writeNoException();
591 return true;
592 }
593
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800594 case ACTIVITY_DESTROYED_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder token = data.readStrongBinder();
597 activityDestroyed(token);
598 reply.writeNoException();
599 return true;
600 }
601
Jorim Jaggife89d122015-12-22 16:28:44 +0100602 case ACTIVITY_RELAUNCHED_TRANSACTION: {
603 data.enforceInterface(IActivityManager.descriptor);
604 IBinder token = data.readStrongBinder();
605 activityRelaunched(token);
606 reply.writeNoException();
607 return true;
608 }
609
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800610 case GET_CALLING_PACKAGE_TRANSACTION: {
611 data.enforceInterface(IActivityManager.descriptor);
612 IBinder token = data.readStrongBinder();
613 String res = token != null ? getCallingPackage(token) : null;
614 reply.writeNoException();
615 reply.writeString(res);
616 return true;
617 }
618
619 case GET_CALLING_ACTIVITY_TRANSACTION: {
620 data.enforceInterface(IActivityManager.descriptor);
621 IBinder token = data.readStrongBinder();
622 ComponentName cn = getCallingActivity(token);
623 reply.writeNoException();
624 ComponentName.writeToParcel(cn, reply);
625 return true;
626 }
627
Winson Chung1147c402014-05-14 11:05:00 -0700628 case GET_APP_TASKS_TRANSACTION: {
629 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700630 String callingPackage = data.readString();
631 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700632 reply.writeNoException();
633 int N = list != null ? list.size() : -1;
634 reply.writeInt(N);
635 int i;
636 for (i=0; i<N; i++) {
637 IAppTask task = list.get(i);
638 reply.writeStrongBinder(task.asBinder());
639 }
640 return true;
641 }
642
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700643 case ADD_APP_TASK_TRANSACTION: {
644 data.enforceInterface(IActivityManager.descriptor);
645 IBinder activityToken = data.readStrongBinder();
646 Intent intent = Intent.CREATOR.createFromParcel(data);
647 ActivityManager.TaskDescription descr
648 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
649 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
650 int res = addAppTask(activityToken, intent, descr, thumbnail);
651 reply.writeNoException();
652 reply.writeInt(res);
653 return true;
654 }
655
656 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
657 data.enforceInterface(IActivityManager.descriptor);
658 Point size = getAppTaskThumbnailSize();
659 reply.writeNoException();
660 size.writeToParcel(reply, 0);
661 return true;
662 }
663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 case GET_TASKS_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 int maxNum = data.readInt();
667 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700668 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800669 reply.writeNoException();
670 int N = list != null ? list.size() : -1;
671 reply.writeInt(N);
672 int i;
673 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700674 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 info.writeToParcel(reply, 0);
676 }
677 return true;
678 }
679
680 case GET_RECENT_TASKS_TRANSACTION: {
681 data.enforceInterface(IActivityManager.descriptor);
682 int maxNum = data.readInt();
683 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700684 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800685 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700686 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800687 reply.writeNoException();
688 reply.writeTypedList(list);
689 return true;
690 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700691
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700692 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800693 data.enforceInterface(IActivityManager.descriptor);
694 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700695 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800696 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700697 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800698 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700699 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700700 } else {
701 reply.writeInt(0);
702 }
703 return true;
704 }
705
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800706 case GET_SERVICES_TRANSACTION: {
707 data.enforceInterface(IActivityManager.descriptor);
708 int maxNum = data.readInt();
709 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700710 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 reply.writeNoException();
712 int N = list != null ? list.size() : -1;
713 reply.writeInt(N);
714 int i;
715 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700716 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 info.writeToParcel(reply, 0);
718 }
719 return true;
720 }
721
722 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
723 data.enforceInterface(IActivityManager.descriptor);
724 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
725 reply.writeNoException();
726 reply.writeTypedList(list);
727 return true;
728 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700729
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800730 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
731 data.enforceInterface(IActivityManager.descriptor);
732 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
733 reply.writeNoException();
734 reply.writeTypedList(list);
735 return true;
736 }
737
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700738 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
739 data.enforceInterface(IActivityManager.descriptor);
740 List<ApplicationInfo> list = getRunningExternalApplications();
741 reply.writeNoException();
742 reply.writeTypedList(list);
743 return true;
744 }
745
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 case MOVE_TASK_TO_FRONT_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800749 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700750 Bundle options = data.readInt() != 0
751 ? Bundle.CREATOR.createFromParcel(data) : null;
752 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800753 reply.writeNoException();
754 return true;
755 }
756
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800757 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
758 data.enforceInterface(IActivityManager.descriptor);
759 IBinder token = data.readStrongBinder();
760 boolean nonRoot = data.readInt() != 0;
761 boolean res = moveActivityTaskToBack(token, nonRoot);
762 reply.writeNoException();
763 reply.writeInt(res ? 1 : 0);
764 return true;
765 }
766
767 case MOVE_TASK_BACKWARDS_TRANSACTION: {
768 data.enforceInterface(IActivityManager.descriptor);
769 int task = data.readInt();
770 moveTaskBackwards(task);
771 reply.writeNoException();
772 return true;
773 }
774
Craig Mautnerc00204b2013-03-05 15:02:14 -0800775 case MOVE_TASK_TO_STACK_TRANSACTION: {
776 data.enforceInterface(IActivityManager.descriptor);
777 int taskId = data.readInt();
778 int stackId = data.readInt();
779 boolean toTop = data.readInt() != 0;
780 moveTaskToStack(taskId, stackId, toTop);
781 reply.writeNoException();
782 return true;
783 }
784
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700785 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
786 data.enforceInterface(IActivityManager.descriptor);
787 int taskId = data.readInt();
788 int createMode = data.readInt();
789 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800790 boolean animate = data.readInt() != 0;
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -0800791 Rect bounds = null;
792 boolean hasBounds = data.readInt() != 0;
793 if (hasBounds) {
794 bounds = Rect.CREATOR.createFromParcel(data);
795 }
Chong Zhange4fbd322016-03-01 14:44:03 -0800796 boolean res = moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700797 reply.writeNoException();
Chong Zhange4fbd322016-03-01 14:44:03 -0800798 reply.writeInt(res ? 1 : 0);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700799 return true;
800 }
801
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700802 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700803 data.enforceInterface(IActivityManager.descriptor);
804 final int stackId = data.readInt();
805 final Rect r = Rect.CREATOR.createFromParcel(data);
806 final boolean res = moveTopActivityToPinnedStack(stackId, r);
807 reply.writeNoException();
808 reply.writeInt(res ? 1 : 0);
809 return true;
810 }
811
Craig Mautnerc00204b2013-03-05 15:02:14 -0800812 case RESIZE_STACK_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700814 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100815 final boolean hasRect = data.readInt() != 0;
816 Rect r = null;
817 if (hasRect) {
818 r = Rect.CREATOR.createFromParcel(data);
819 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700820 final boolean allowResizeInDockedMode = data.readInt() == 1;
Filip Gruszczynski84fa3352016-01-25 16:28:49 -0800821 final boolean preserveWindows = data.readInt() == 1;
822 final boolean animate = data.readInt() == 1;
Wale Ogunwalee75a9ad2016-03-18 20:43:49 -0700823 final int animationDuration = data.readInt();
824 resizeStack(stackId,
825 r, allowResizeInDockedMode, preserveWindows, animate, animationDuration);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800826 reply.writeNoException();
827 return true;
828 }
Robert Carr0d00c2e2016-02-29 17:45:02 -0800829 case RESIZE_PINNED_STACK_TRANSACTION: {
830 data.enforceInterface(IActivityManager.descriptor);
831 final boolean hasBounds = data.readInt() != 0;
832 Rect bounds = null;
833 if (hasBounds) {
834 bounds = Rect.CREATOR.createFromParcel(data);
835 }
836 final boolean hasTempPinnedTaskBounds = data.readInt() != 0;
837 Rect tempPinnedTaskBounds = null;
838 if (hasTempPinnedTaskBounds) {
839 tempPinnedTaskBounds = Rect.CREATOR.createFromParcel(data);
840 }
841 resizePinnedStack(bounds, tempPinnedTaskBounds);
842 return true;
843 }
Jorim Jaggid47e7e12016-03-01 09:57:38 +0100844 case SWAP_DOCKED_AND_FULLSCREEN_STACK: {
845 data.enforceInterface(IActivityManager.descriptor);
846 swapDockedAndFullscreenStack();
847 reply.writeNoException();
848 return true;
849 }
Jorim Jaggidc249c42015-12-15 14:57:31 -0800850 case RESIZE_DOCKED_STACK_TRANSACTION: {
851 data.enforceInterface(IActivityManager.descriptor);
852 final boolean hasBounds = data.readInt() != 0;
853 Rect bounds = null;
854 if (hasBounds) {
855 bounds = Rect.CREATOR.createFromParcel(data);
856 }
857 final boolean hasTempDockedTaskBounds = data.readInt() != 0;
858 Rect tempDockedTaskBounds = null;
859 if (hasTempDockedTaskBounds) {
860 tempDockedTaskBounds = Rect.CREATOR.createFromParcel(data);
861 }
862 final boolean hasTempDockedTaskInsetBounds = data.readInt() != 0;
863 Rect tempDockedTaskInsetBounds = null;
864 if (hasTempDockedTaskInsetBounds) {
865 tempDockedTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
866 }
867 final boolean hasTempOtherTaskBounds = data.readInt() != 0;
868 Rect tempOtherTaskBounds = null;
869 if (hasTempOtherTaskBounds) {
870 tempOtherTaskBounds = Rect.CREATOR.createFromParcel(data);
871 }
872 final boolean hasTempOtherTaskInsetBounds = data.readInt() != 0;
873 Rect tempOtherTaskInsetBounds = null;
874 if (hasTempOtherTaskInsetBounds) {
875 tempOtherTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
876 }
877 resizeDockedStack(bounds, tempDockedTaskBounds, tempDockedTaskInsetBounds,
878 tempOtherTaskBounds, tempOtherTaskInsetBounds);
879 reply.writeNoException();
880 return true;
881 }
882
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700883 case POSITION_TASK_IN_STACK_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 int taskId = data.readInt();
886 int stackId = data.readInt();
887 int position = data.readInt();
888 positionTaskInStack(taskId, stackId, position);
889 reply.writeNoException();
890 return true;
891 }
892
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800893 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700894 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800895 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700896 reply.writeNoException();
897 reply.writeTypedList(list);
898 return true;
899 }
900
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800901 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700902 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800903 int stackId = data.readInt();
904 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700905 reply.writeNoException();
906 if (info != null) {
907 reply.writeInt(1);
908 info.writeToParcel(reply, 0);
909 } else {
910 reply.writeInt(0);
911 }
912 return true;
913 }
914
Winson Chung303e1ff2014-03-07 15:06:19 -0800915 case IS_IN_HOME_STACK_TRANSACTION: {
916 data.enforceInterface(IActivityManager.descriptor);
917 int taskId = data.readInt();
918 boolean isInHomeStack = isInHomeStack(taskId);
919 reply.writeNoException();
920 reply.writeInt(isInHomeStack ? 1 : 0);
921 return true;
922 }
923
Craig Mautnercf910b02013-04-23 11:23:27 -0700924 case SET_FOCUSED_STACK_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 int stackId = data.readInt();
927 setFocusedStack(stackId);
928 reply.writeNoException();
929 return true;
930 }
931
Winson Chungd16c5652015-01-26 16:11:07 -0800932 case GET_FOCUSED_STACK_ID_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 int focusedStackId = getFocusedStackId();
935 reply.writeNoException();
936 reply.writeInt(focusedStackId);
937 return true;
938 }
939
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700940 case SET_FOCUSED_TASK_TRANSACTION: {
941 data.enforceInterface(IActivityManager.descriptor);
942 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700943 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700944 reply.writeNoException();
945 return true;
946 }
947
Winson Chung740c3ac2014-11-12 16:14:38 -0800948 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
949 data.enforceInterface(IActivityManager.descriptor);
950 IBinder token = data.readStrongBinder();
951 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
952 reply.writeNoException();
953 return true;
954 }
955
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800956 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
957 data.enforceInterface(IActivityManager.descriptor);
958 IBinder token = data.readStrongBinder();
959 boolean onlyRoot = data.readInt() != 0;
960 int res = token != null
961 ? getTaskForActivity(token, onlyRoot) : -1;
962 reply.writeNoException();
963 reply.writeInt(res);
964 return true;
965 }
966
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800967 case GET_CONTENT_PROVIDER_TRANSACTION: {
968 data.enforceInterface(IActivityManager.descriptor);
969 IBinder b = data.readStrongBinder();
970 IApplicationThread app = ApplicationThreadNative.asInterface(b);
971 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700972 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700973 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700974 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800975 reply.writeNoException();
976 if (cph != null) {
977 reply.writeInt(1);
978 cph.writeToParcel(reply, 0);
979 } else {
980 reply.writeInt(0);
981 }
982 return true;
983 }
984
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800985 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700988 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800989 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700990 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800991 reply.writeNoException();
992 if (cph != null) {
993 reply.writeInt(1);
994 cph.writeToParcel(reply, 0);
995 } else {
996 reply.writeInt(0);
997 }
998 return true;
999 }
1000
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
1002 data.enforceInterface(IActivityManager.descriptor);
1003 IBinder b = data.readStrongBinder();
1004 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1005 ArrayList<ContentProviderHolder> providers =
1006 data.createTypedArrayList(ContentProviderHolder.CREATOR);
1007 publishContentProviders(app, providers);
1008 reply.writeNoException();
1009 return true;
1010 }
1011
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001012 case REF_CONTENT_PROVIDER_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 IBinder b = data.readStrongBinder();
1015 int stable = data.readInt();
1016 int unstable = data.readInt();
1017 boolean res = refContentProvider(b, stable, unstable);
1018 reply.writeNoException();
1019 reply.writeInt(res ? 1 : 0);
1020 return true;
1021 }
1022
1023 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
1024 data.enforceInterface(IActivityManager.descriptor);
1025 IBinder b = data.readStrongBinder();
1026 unstableProviderDied(b);
1027 reply.writeNoException();
1028 return true;
1029 }
1030
Jeff Sharkey7aa76012013-09-30 14:26:27 -07001031 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
1032 data.enforceInterface(IActivityManager.descriptor);
1033 IBinder b = data.readStrongBinder();
1034 appNotRespondingViaProvider(b);
1035 reply.writeNoException();
1036 return true;
1037 }
1038
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001039 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001042 boolean stable = data.readInt() != 0;
1043 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001044 reply.writeNoException();
1045 return true;
1046 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08001047
1048 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 String name = data.readString();
1051 IBinder token = data.readStrongBinder();
1052 removeContentProviderExternal(name, token);
1053 reply.writeNoException();
1054 return true;
1055 }
1056
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001057 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
1058 data.enforceInterface(IActivityManager.descriptor);
1059 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
1060 PendingIntent pi = getRunningServiceControlPanel(comp);
1061 reply.writeNoException();
1062 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
1063 return true;
1064 }
1065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001066 case START_SERVICE_TRANSACTION: {
1067 data.enforceInterface(IActivityManager.descriptor);
1068 IBinder b = data.readStrongBinder();
1069 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1070 Intent service = Intent.CREATOR.createFromParcel(data);
1071 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001072 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001073 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001074 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001075 reply.writeNoException();
1076 ComponentName.writeToParcel(cn, reply);
1077 return true;
1078 }
1079
1080 case STOP_SERVICE_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 IBinder b = data.readStrongBinder();
1083 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1084 Intent service = Intent.CREATOR.createFromParcel(data);
1085 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001086 int userId = data.readInt();
1087 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001088 reply.writeNoException();
1089 reply.writeInt(res);
1090 return true;
1091 }
1092
1093 case STOP_SERVICE_TOKEN_TRANSACTION: {
1094 data.enforceInterface(IActivityManager.descriptor);
1095 ComponentName className = ComponentName.readFromParcel(data);
1096 IBinder token = data.readStrongBinder();
1097 int startId = data.readInt();
1098 boolean res = stopServiceToken(className, token, startId);
1099 reply.writeNoException();
1100 reply.writeInt(res ? 1 : 0);
1101 return true;
1102 }
1103
1104 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1105 data.enforceInterface(IActivityManager.descriptor);
1106 ComponentName className = ComponentName.readFromParcel(data);
1107 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001108 int id = data.readInt();
1109 Notification notification = null;
1110 if (data.readInt() != 0) {
1111 notification = Notification.CREATOR.createFromParcel(data);
1112 }
1113 boolean removeNotification = data.readInt() != 0;
1114 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001115 reply.writeNoException();
1116 return true;
1117 }
1118
1119 case BIND_SERVICE_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
1121 IBinder b = data.readStrongBinder();
1122 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1123 IBinder token = data.readStrongBinder();
1124 Intent service = Intent.CREATOR.createFromParcel(data);
1125 String resolvedType = data.readString();
1126 b = data.readStrongBinder();
1127 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001128 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001129 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001131 int res = bindService(app, token, service, resolvedType, conn, fl,
1132 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 reply.writeNoException();
1134 reply.writeInt(res);
1135 return true;
1136 }
1137
1138 case UNBIND_SERVICE_TRANSACTION: {
1139 data.enforceInterface(IActivityManager.descriptor);
1140 IBinder b = data.readStrongBinder();
1141 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1142 boolean res = unbindService(conn);
1143 reply.writeNoException();
1144 reply.writeInt(res ? 1 : 0);
1145 return true;
1146 }
1147
1148 case PUBLISH_SERVICE_TRANSACTION: {
1149 data.enforceInterface(IActivityManager.descriptor);
1150 IBinder token = data.readStrongBinder();
1151 Intent intent = Intent.CREATOR.createFromParcel(data);
1152 IBinder service = data.readStrongBinder();
1153 publishService(token, intent, service);
1154 reply.writeNoException();
1155 return true;
1156 }
1157
1158 case UNBIND_FINISHED_TRANSACTION: {
1159 data.enforceInterface(IActivityManager.descriptor);
1160 IBinder token = data.readStrongBinder();
1161 Intent intent = Intent.CREATOR.createFromParcel(data);
1162 boolean doRebind = data.readInt() != 0;
1163 unbindFinished(token, intent, doRebind);
1164 reply.writeNoException();
1165 return true;
1166 }
1167
1168 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1169 data.enforceInterface(IActivityManager.descriptor);
1170 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001171 int type = data.readInt();
1172 int startId = data.readInt();
1173 int res = data.readInt();
1174 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175 reply.writeNoException();
1176 return true;
1177 }
1178
1179 case START_INSTRUMENTATION_TRANSACTION: {
1180 data.enforceInterface(IActivityManager.descriptor);
1181 ComponentName className = ComponentName.readFromParcel(data);
1182 String profileFile = data.readString();
1183 int fl = data.readInt();
1184 Bundle arguments = data.readBundle();
1185 IBinder b = data.readStrongBinder();
1186 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001187 b = data.readStrongBinder();
1188 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001189 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001190 String abiOverride = data.readString();
1191 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1192 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193 reply.writeNoException();
1194 reply.writeInt(res ? 1 : 0);
1195 return true;
1196 }
1197
1198
1199 case FINISH_INSTRUMENTATION_TRANSACTION: {
1200 data.enforceInterface(IActivityManager.descriptor);
1201 IBinder b = data.readStrongBinder();
1202 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1203 int resultCode = data.readInt();
1204 Bundle results = data.readBundle();
1205 finishInstrumentation(app, resultCode, results);
1206 reply.writeNoException();
1207 return true;
1208 }
1209
1210 case GET_CONFIGURATION_TRANSACTION: {
1211 data.enforceInterface(IActivityManager.descriptor);
1212 Configuration config = getConfiguration();
1213 reply.writeNoException();
1214 config.writeToParcel(reply, 0);
1215 return true;
1216 }
1217
1218 case UPDATE_CONFIGURATION_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 Configuration config = Configuration.CREATOR.createFromParcel(data);
1221 updateConfiguration(config);
1222 reply.writeNoException();
1223 return true;
1224 }
1225
1226 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1227 data.enforceInterface(IActivityManager.descriptor);
1228 IBinder token = data.readStrongBinder();
1229 int requestedOrientation = data.readInt();
1230 setRequestedOrientation(token, requestedOrientation);
1231 reply.writeNoException();
1232 return true;
1233 }
1234
1235 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 IBinder token = data.readStrongBinder();
1238 int req = getRequestedOrientation(token);
1239 reply.writeNoException();
1240 reply.writeInt(req);
1241 return true;
1242 }
1243
1244 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1245 data.enforceInterface(IActivityManager.descriptor);
1246 IBinder token = data.readStrongBinder();
1247 ComponentName cn = getActivityClassForToken(token);
1248 reply.writeNoException();
1249 ComponentName.writeToParcel(cn, reply);
1250 return true;
1251 }
1252
1253 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
1255 IBinder token = data.readStrongBinder();
1256 reply.writeNoException();
1257 reply.writeString(getPackageForToken(token));
1258 return true;
1259 }
1260
1261 case GET_INTENT_SENDER_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 int type = data.readInt();
1264 String packageName = data.readString();
1265 IBinder token = data.readStrongBinder();
1266 String resultWho = data.readString();
1267 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001268 Intent[] requestIntents;
1269 String[] requestResolvedTypes;
1270 if (data.readInt() != 0) {
1271 requestIntents = data.createTypedArray(Intent.CREATOR);
1272 requestResolvedTypes = data.createStringArray();
1273 } else {
1274 requestIntents = null;
1275 requestResolvedTypes = null;
1276 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001277 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001278 Bundle options = data.readInt() != 0
1279 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001280 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001281 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001282 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001283 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 reply.writeNoException();
1285 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1286 return true;
1287 }
1288
1289 case CANCEL_INTENT_SENDER_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 IIntentSender r = IIntentSender.Stub.asInterface(
1292 data.readStrongBinder());
1293 cancelIntentSender(r);
1294 reply.writeNoException();
1295 return true;
1296 }
1297
1298 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
1300 IIntentSender r = IIntentSender.Stub.asInterface(
1301 data.readStrongBinder());
1302 String res = getPackageForIntentSender(r);
1303 reply.writeNoException();
1304 reply.writeString(res);
1305 return true;
1306 }
1307
Christopher Tatec4a07d12012-04-06 14:19:13 -07001308 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1309 data.enforceInterface(IActivityManager.descriptor);
1310 IIntentSender r = IIntentSender.Stub.asInterface(
1311 data.readStrongBinder());
1312 int res = getUidForIntentSender(r);
1313 reply.writeNoException();
1314 reply.writeInt(res);
1315 return true;
1316 }
1317
Dianne Hackborn41203752012-08-31 14:05:51 -07001318 case HANDLE_INCOMING_USER_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 int callingPid = data.readInt();
1321 int callingUid = data.readInt();
1322 int userId = data.readInt();
1323 boolean allowAll = data.readInt() != 0 ;
1324 boolean requireFull = data.readInt() != 0;
1325 String name = data.readString();
1326 String callerPackage = data.readString();
1327 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1328 requireFull, name, callerPackage);
1329 reply.writeNoException();
1330 reply.writeInt(res);
1331 return true;
1332 }
1333
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001334 case SET_PROCESS_LIMIT_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
1336 int max = data.readInt();
1337 setProcessLimit(max);
1338 reply.writeNoException();
1339 return true;
1340 }
1341
1342 case GET_PROCESS_LIMIT_TRANSACTION: {
1343 data.enforceInterface(IActivityManager.descriptor);
1344 int limit = getProcessLimit();
1345 reply.writeNoException();
1346 reply.writeInt(limit);
1347 return true;
1348 }
1349
1350 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 IBinder token = data.readStrongBinder();
1353 int pid = data.readInt();
1354 boolean isForeground = data.readInt() != 0;
1355 setProcessForeground(token, pid, isForeground);
1356 reply.writeNoException();
1357 return true;
1358 }
1359
1360 case CHECK_PERMISSION_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
1362 String perm = data.readString();
1363 int pid = data.readInt();
1364 int uid = data.readInt();
1365 int res = checkPermission(perm, pid, uid);
1366 reply.writeNoException();
1367 reply.writeInt(res);
1368 return true;
1369 }
1370
Dianne Hackbornff170242014-11-19 10:59:01 -08001371 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
1373 String perm = data.readString();
1374 int pid = data.readInt();
1375 int uid = data.readInt();
1376 IBinder token = data.readStrongBinder();
1377 int res = checkPermissionWithToken(perm, pid, uid, token);
1378 reply.writeNoException();
1379 reply.writeInt(res);
1380 return true;
1381 }
1382
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001383 case CHECK_URI_PERMISSION_TRANSACTION: {
1384 data.enforceInterface(IActivityManager.descriptor);
1385 Uri uri = Uri.CREATOR.createFromParcel(data);
1386 int pid = data.readInt();
1387 int uid = data.readInt();
1388 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001389 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001390 IBinder callerToken = data.readStrongBinder();
1391 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001392 reply.writeNoException();
1393 reply.writeInt(res);
1394 return true;
1395 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001396
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001397 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001398 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001399 String packageName = data.readString();
1400 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1401 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001402 int userId = data.readInt();
1403 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001404 reply.writeNoException();
1405 reply.writeInt(res ? 1 : 0);
1406 return true;
1407 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001408
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001409 case GRANT_URI_PERMISSION_TRANSACTION: {
1410 data.enforceInterface(IActivityManager.descriptor);
1411 IBinder b = data.readStrongBinder();
1412 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1413 String targetPkg = data.readString();
1414 Uri uri = Uri.CREATOR.createFromParcel(data);
1415 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001416 int userId = data.readInt();
1417 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001418 reply.writeNoException();
1419 return true;
1420 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001421
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 case REVOKE_URI_PERMISSION_TRANSACTION: {
1423 data.enforceInterface(IActivityManager.descriptor);
1424 IBinder b = data.readStrongBinder();
1425 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1426 Uri uri = Uri.CREATOR.createFromParcel(data);
1427 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001428 int userId = data.readInt();
1429 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001430 reply.writeNoException();
1431 return true;
1432 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001433
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001434 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1435 data.enforceInterface(IActivityManager.descriptor);
1436 Uri uri = Uri.CREATOR.createFromParcel(data);
1437 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001438 int userId = data.readInt();
1439 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001440 reply.writeNoException();
1441 return true;
1442 }
1443
1444 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1445 data.enforceInterface(IActivityManager.descriptor);
1446 Uri uri = Uri.CREATOR.createFromParcel(data);
1447 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001448 int userId = data.readInt();
1449 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001450 reply.writeNoException();
1451 return true;
1452 }
1453
1454 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1455 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001456 final String packageName = data.readString();
1457 final boolean incoming = data.readInt() != 0;
1458 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1459 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001460 reply.writeNoException();
1461 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1462 return true;
1463 }
1464
Felipe Lemef3fa0f82016-01-07 12:08:19 -08001465 case GET_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1466 data.enforceInterface(IActivityManager.descriptor);
1467 final String packageName = data.readString();
1468 final int userId = data.readInt();
1469 final ParceledListSlice<UriPermission> perms = getGrantedUriPermissions(packageName,
1470 userId);
1471 reply.writeNoException();
1472 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1473 return true;
1474 }
1475
1476 case CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1477 data.enforceInterface(IActivityManager.descriptor);
1478 final String packageName = data.readString();
1479 final int userId = data.readInt();
1480 clearGrantedUriPermissions(packageName, userId);
1481 reply.writeNoException();
1482 return true;
1483 }
1484
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001485 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 IBinder b = data.readStrongBinder();
1488 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1489 boolean waiting = data.readInt() != 0;
1490 showWaitingForDebugger(app, waiting);
1491 reply.writeNoException();
1492 return true;
1493 }
1494
1495 case GET_MEMORY_INFO_TRANSACTION: {
1496 data.enforceInterface(IActivityManager.descriptor);
1497 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1498 getMemoryInfo(mi);
1499 reply.writeNoException();
1500 mi.writeToParcel(reply, 0);
1501 return true;
1502 }
1503
1504 case UNHANDLED_BACK_TRANSACTION: {
1505 data.enforceInterface(IActivityManager.descriptor);
1506 unhandledBack();
1507 reply.writeNoException();
1508 return true;
1509 }
1510
1511 case OPEN_CONTENT_URI_TRANSACTION: {
1512 data.enforceInterface(IActivityManager.descriptor);
1513 Uri uri = Uri.parse(data.readString());
1514 ParcelFileDescriptor pfd = openContentUri(uri);
1515 reply.writeNoException();
1516 if (pfd != null) {
1517 reply.writeInt(1);
1518 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1519 } else {
1520 reply.writeInt(0);
1521 }
1522 return true;
1523 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001524
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001525 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1526 data.enforceInterface(IActivityManager.descriptor);
1527 setLockScreenShown(data.readInt() != 0);
1528 reply.writeNoException();
1529 return true;
1530 }
1531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001532 case SET_DEBUG_APP_TRANSACTION: {
1533 data.enforceInterface(IActivityManager.descriptor);
1534 String pn = data.readString();
1535 boolean wfd = data.readInt() != 0;
1536 boolean per = data.readInt() != 0;
1537 setDebugApp(pn, wfd, per);
1538 reply.writeNoException();
1539 return true;
1540 }
1541
1542 case SET_ALWAYS_FINISH_TRANSACTION: {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 boolean enabled = data.readInt() != 0;
1545 setAlwaysFinish(enabled);
1546 reply.writeNoException();
1547 return true;
1548 }
1549
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001550 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001551 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001552 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001553 data.readStrongBinder());
Dianne Hackborn4a18c262016-02-26 17:23:48 -08001554 boolean imAMonkey = data.readInt() != 0;
1555 setActivityController(watcher, imAMonkey);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001556 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001557 return true;
1558 }
1559
Dianne Hackbornb2117d12016-02-16 18:26:35 -08001560 case SET_LENIENT_BACKGROUND_CHECK_TRANSACTION: {
1561 data.enforceInterface(IActivityManager.descriptor);
1562 boolean enabled = data.readInt() != 0;
1563 setLenientBackgroundCheck(enabled);
1564 reply.writeNoException();
1565 return true;
1566 }
1567
Dianne Hackborn970510b2016-02-24 16:56:42 -08001568 case GET_MEMORY_TRIM_LEVEL_TRANSACTION: {
1569 data.enforceInterface(IActivityManager.descriptor);
1570 int level = getMemoryTrimLevel();
1571 reply.writeNoException();
1572 reply.writeInt(level);
1573 return true;
1574 }
1575
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001576 case ENTER_SAFE_MODE_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 enterSafeMode();
1579 reply.writeNoException();
1580 return true;
1581 }
1582
1583 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 IIntentSender is = IIntentSender.Stub.asInterface(
1586 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001587 int sourceUid = data.readInt();
1588 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001589 String tag = data.readString();
1590 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1591 reply.writeNoException();
1592 return true;
1593 }
1594
1595 case NOTE_ALARM_START_TRANSACTION: {
1596 data.enforceInterface(IActivityManager.descriptor);
1597 IIntentSender is = IIntentSender.Stub.asInterface(
1598 data.readStrongBinder());
1599 int sourceUid = data.readInt();
1600 String tag = data.readString();
1601 noteAlarmStart(is, sourceUid, tag);
1602 reply.writeNoException();
1603 return true;
1604 }
1605
1606 case NOTE_ALARM_FINISH_TRANSACTION: {
1607 data.enforceInterface(IActivityManager.descriptor);
1608 IIntentSender is = IIntentSender.Stub.asInterface(
1609 data.readStrongBinder());
1610 int sourceUid = data.readInt();
1611 String tag = data.readString();
1612 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001613 reply.writeNoException();
1614 return true;
1615 }
1616
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001617 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001618 data.enforceInterface(IActivityManager.descriptor);
1619 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001620 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001621 boolean secure = data.readInt() != 0;
1622 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001623 reply.writeNoException();
1624 reply.writeInt(res ? 1 : 0);
1625 return true;
1626 }
1627
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001628 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 String reason = data.readString();
1631 boolean res = killProcessesBelowForeground(reason);
1632 reply.writeNoException();
1633 reply.writeInt(res ? 1 : 0);
1634 return true;
1635 }
1636
Dan Egnor60d87622009-12-16 16:32:58 -08001637 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1638 data.enforceInterface(IActivityManager.descriptor);
1639 IBinder app = data.readStrongBinder();
1640 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1641 handleApplicationCrash(app, ci);
1642 reply.writeNoException();
1643 return true;
1644 }
1645
1646 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001647 data.enforceInterface(IActivityManager.descriptor);
1648 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001649 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001650 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001651 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001652 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001653 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001654 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001655 return true;
1656 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001657
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001658 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1659 data.enforceInterface(IActivityManager.descriptor);
1660 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001661 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001662 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1663 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001664 reply.writeNoException();
1665 return true;
1666 }
1667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001668 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1669 data.enforceInterface(IActivityManager.descriptor);
1670 int sig = data.readInt();
1671 signalPersistentProcesses(sig);
1672 reply.writeNoException();
1673 return true;
1674 }
1675
Dianne Hackborn03abb812010-01-04 18:43:19 -08001676 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1677 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001678 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001679 int userId = data.readInt();
1680 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001681 reply.writeNoException();
1682 return true;
1683 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001684
1685 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1686 data.enforceInterface(IActivityManager.descriptor);
1687 killAllBackgroundProcesses();
1688 reply.writeNoException();
1689 return true;
1690 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001691
Gustav Sennton6258dcd2015-10-30 19:25:37 +00001692 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: {
1693 data.enforceInterface(IActivityManager.descriptor);
1694 String packageName = data.readString();
1695 int userId = data.readInt();
1696 killPackageDependents(packageName, userId);
1697 reply.writeNoException();
1698 return true;
1699 }
1700
Dianne Hackborn03abb812010-01-04 18:43:19 -08001701 case FORCE_STOP_PACKAGE_TRANSACTION: {
1702 data.enforceInterface(IActivityManager.descriptor);
1703 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001704 int userId = data.readInt();
1705 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001706 reply.writeNoException();
1707 return true;
1708 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001709
1710 case GET_MY_MEMORY_STATE_TRANSACTION: {
1711 data.enforceInterface(IActivityManager.descriptor);
1712 ActivityManager.RunningAppProcessInfo info =
1713 new ActivityManager.RunningAppProcessInfo();
1714 getMyMemoryState(info);
1715 reply.writeNoException();
1716 info.writeToParcel(reply, 0);
1717 return true;
1718 }
1719
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001720 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1721 data.enforceInterface(IActivityManager.descriptor);
1722 ConfigurationInfo config = getDeviceConfigurationInfo();
1723 reply.writeNoException();
1724 config.writeToParcel(reply, 0);
1725 return true;
1726 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001727
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001728 case PROFILE_CONTROL_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001731 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001732 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001733 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001734 ProfilerInfo profilerInfo = data.readInt() != 0
1735 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1736 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001737 reply.writeNoException();
1738 reply.writeInt(res ? 1 : 0);
1739 return true;
1740 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001741
Dianne Hackborn55280a92009-05-07 15:53:46 -07001742 case SHUTDOWN_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 boolean res = shutdown(data.readInt());
1745 reply.writeNoException();
1746 reply.writeInt(res ? 1 : 0);
1747 return true;
1748 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001749
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001750 case STOP_APP_SWITCHES_TRANSACTION: {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 stopAppSwitches();
1753 reply.writeNoException();
1754 return true;
1755 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001756
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001757 case RESUME_APP_SWITCHES_TRANSACTION: {
1758 data.enforceInterface(IActivityManager.descriptor);
1759 resumeAppSwitches();
1760 reply.writeNoException();
1761 return true;
1762 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001763
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001764 case PEEK_SERVICE_TRANSACTION: {
1765 data.enforceInterface(IActivityManager.descriptor);
1766 Intent service = Intent.CREATOR.createFromParcel(data);
1767 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001768 String callingPackage = data.readString();
1769 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001770 reply.writeNoException();
1771 reply.writeStrongBinder(binder);
1772 return true;
1773 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001774
Christopher Tate181fafa2009-05-14 11:12:14 -07001775 case START_BACKUP_AGENT_TRANSACTION: {
1776 data.enforceInterface(IActivityManager.descriptor);
1777 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1778 int backupRestoreMode = data.readInt();
1779 boolean success = bindBackupAgent(info, backupRestoreMode);
1780 reply.writeNoException();
1781 reply.writeInt(success ? 1 : 0);
1782 return true;
1783 }
1784
1785 case BACKUP_AGENT_CREATED_TRANSACTION: {
1786 data.enforceInterface(IActivityManager.descriptor);
1787 String packageName = data.readString();
1788 IBinder agent = data.readStrongBinder();
1789 backupAgentCreated(packageName, agent);
1790 reply.writeNoException();
1791 return true;
1792 }
1793
1794 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1795 data.enforceInterface(IActivityManager.descriptor);
1796 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1797 unbindBackupAgent(info);
1798 reply.writeNoException();
1799 return true;
1800 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001801
1802 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1803 data.enforceInterface(IActivityManager.descriptor);
1804 String packageName = data.readString();
1805 addPackageDependency(packageName);
1806 reply.writeNoException();
1807 return true;
1808 }
1809
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001810 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001811 data.enforceInterface(IActivityManager.descriptor);
1812 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001813 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001814 String reason = data.readString();
1815 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001816 reply.writeNoException();
1817 return true;
1818 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001819
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001820 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 String reason = data.readString();
1823 closeSystemDialogs(reason);
1824 reply.writeNoException();
1825 return true;
1826 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001827
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001828 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1829 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001830 int[] pids = data.createIntArray();
1831 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001832 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001833 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001834 return true;
1835 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001836
1837 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1838 data.enforceInterface(IActivityManager.descriptor);
1839 String processName = data.readString();
1840 int uid = data.readInt();
1841 killApplicationProcess(processName, uid);
1842 reply.writeNoException();
1843 return true;
1844 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001845
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001846 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 IBinder token = data.readStrongBinder();
1849 String packageName = data.readString();
1850 int enterAnim = data.readInt();
1851 int exitAnim = data.readInt();
1852 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001853 reply.writeNoException();
1854 return true;
1855 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001856
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001857 case IS_USER_A_MONKEY_TRANSACTION: {
1858 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001859 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001860 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001861 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001862 return true;
1863 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001864
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001865 case SET_USER_IS_MONKEY_TRANSACTION: {
1866 data.enforceInterface(IActivityManager.descriptor);
1867 final boolean monkey = (data.readInt() == 1);
1868 setUserIsMonkey(monkey);
1869 reply.writeNoException();
1870 return true;
1871 }
1872
Dianne Hackborn860755f2010-06-03 18:47:52 -07001873 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1874 data.enforceInterface(IActivityManager.descriptor);
1875 finishHeavyWeightApp();
1876 reply.writeNoException();
1877 return true;
1878 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001879
1880 case IS_IMMERSIVE_TRANSACTION: {
1881 data.enforceInterface(IActivityManager.descriptor);
1882 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001883 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001884 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001885 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001886 return true;
1887 }
1888
Craig Mautnerd61dc202014-07-07 11:09:11 -07001889 case IS_TOP_OF_TASK_TRANSACTION: {
1890 data.enforceInterface(IActivityManager.descriptor);
1891 IBinder token = data.readStrongBinder();
1892 final boolean isTopOfTask = isTopOfTask(token);
1893 reply.writeNoException();
1894 reply.writeInt(isTopOfTask ? 1 : 0);
1895 return true;
1896 }
1897
Craig Mautner5eda9b32013-07-02 11:58:16 -07001898 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001899 data.enforceInterface(IActivityManager.descriptor);
1900 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001901 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001902 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001903 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001904 return true;
1905 }
1906
1907 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1908 data.enforceInterface(IActivityManager.descriptor);
1909 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001910 final Bundle bundle;
1911 if (data.readInt() == 0) {
1912 bundle = null;
1913 } else {
1914 bundle = data.readBundle();
1915 }
Chong Zhang280d3322015-11-03 17:27:26 -08001916 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001917 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001918 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001919 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001920 return true;
1921 }
1922
Craig Mautner233ceee2014-05-09 17:05:11 -07001923 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1924 data.enforceInterface(IActivityManager.descriptor);
1925 IBinder token = data.readStrongBinder();
1926 final ActivityOptions options = getActivityOptions(token);
1927 reply.writeNoException();
1928 reply.writeBundle(options == null ? null : options.toBundle());
1929 return true;
1930 }
1931
Daniel Sandler69a48172010-06-23 16:29:36 -04001932 case SET_IMMERSIVE_TRANSACTION: {
1933 data.enforceInterface(IActivityManager.descriptor);
1934 IBinder token = data.readStrongBinder();
1935 boolean imm = data.readInt() == 1;
1936 setImmersive(token, imm);
1937 reply.writeNoException();
1938 return true;
1939 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001940
Daniel Sandler69a48172010-06-23 16:29:36 -04001941 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1942 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001943 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001944 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001945 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001946 return true;
1947 }
1948
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001949 case CRASH_APPLICATION_TRANSACTION: {
1950 data.enforceInterface(IActivityManager.descriptor);
1951 int uid = data.readInt();
1952 int initialPid = data.readInt();
1953 String packageName = data.readString();
1954 String message = data.readString();
1955 crashApplication(uid, initialPid, packageName, message);
1956 reply.writeNoException();
1957 return true;
1958 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001959
1960 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001963 int userId = data.readInt();
1964 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001965 reply.writeNoException();
1966 reply.writeString(type);
1967 return true;
1968 }
1969
Dianne Hackborn7e269642010-08-25 19:50:20 -07001970 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1971 data.enforceInterface(IActivityManager.descriptor);
1972 String name = data.readString();
1973 IBinder perm = newUriPermissionOwner(name);
1974 reply.writeNoException();
1975 reply.writeStrongBinder(perm);
1976 return true;
1977 }
1978
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08001979 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: {
1980 data.enforceInterface(IActivityManager.descriptor);
1981 IBinder activityToken = data.readStrongBinder();
1982 IBinder perm = getUriPermissionOwnerForActivity(activityToken);
1983 reply.writeNoException();
1984 reply.writeStrongBinder(perm);
1985 return true;
1986 }
1987
Dianne Hackborn7e269642010-08-25 19:50:20 -07001988 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1989 data.enforceInterface(IActivityManager.descriptor);
1990 IBinder owner = data.readStrongBinder();
1991 int fromUid = data.readInt();
1992 String targetPkg = data.readString();
1993 Uri uri = Uri.CREATOR.createFromParcel(data);
1994 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001995 int sourceUserId = data.readInt();
1996 int targetUserId = data.readInt();
1997 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1998 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001999 reply.writeNoException();
2000 return true;
2001 }
2002
2003 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
2004 data.enforceInterface(IActivityManager.descriptor);
2005 IBinder owner = data.readStrongBinder();
2006 Uri uri = null;
2007 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01002008 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07002009 }
2010 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01002011 int userId = data.readInt();
2012 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07002013 reply.writeNoException();
2014 return true;
2015 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07002016
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07002017 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
2018 data.enforceInterface(IActivityManager.descriptor);
2019 int callingUid = data.readInt();
2020 String targetPkg = data.readString();
2021 Uri uri = Uri.CREATOR.createFromParcel(data);
2022 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01002023 int userId = data.readInt();
2024 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07002025 reply.writeNoException();
2026 reply.writeInt(res);
2027 return true;
2028 }
2029
Andy McFadden824c5102010-07-09 16:26:57 -07002030 case DUMP_HEAP_TRANSACTION: {
2031 data.enforceInterface(IActivityManager.descriptor);
2032 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07002033 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07002034 boolean managed = data.readInt() != 0;
2035 String path = data.readString();
2036 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07002037 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07002038 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07002039 reply.writeNoException();
2040 reply.writeInt(res ? 1 : 0);
2041 return true;
2042 }
2043
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002044 case START_ACTIVITIES_TRANSACTION:
2045 {
2046 data.enforceInterface(IActivityManager.descriptor);
2047 IBinder b = data.readStrongBinder();
2048 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002049 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002050 Intent[] intents = data.createTypedArray(Intent.CREATOR);
2051 String[] resolvedTypes = data.createStringArray();
2052 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07002053 Bundle options = data.readInt() != 0
2054 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002055 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002056 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002057 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002058 reply.writeNoException();
2059 reply.writeInt(result);
2060 return true;
2061 }
2062
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002063 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2064 {
2065 data.enforceInterface(IActivityManager.descriptor);
2066 int mode = getFrontActivityScreenCompatMode();
2067 reply.writeNoException();
2068 reply.writeInt(mode);
2069 return true;
2070 }
2071
2072 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2073 {
2074 data.enforceInterface(IActivityManager.descriptor);
2075 int mode = data.readInt();
2076 setFrontActivityScreenCompatMode(mode);
2077 reply.writeNoException();
2078 reply.writeInt(mode);
2079 return true;
2080 }
2081
2082 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2083 {
2084 data.enforceInterface(IActivityManager.descriptor);
2085 String pkg = data.readString();
2086 int mode = getPackageScreenCompatMode(pkg);
2087 reply.writeNoException();
2088 reply.writeInt(mode);
2089 return true;
2090 }
2091
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002092 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2093 {
2094 data.enforceInterface(IActivityManager.descriptor);
2095 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002096 int mode = data.readInt();
2097 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002098 reply.writeNoException();
2099 return true;
2100 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002101
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002102 case SWITCH_USER_TRANSACTION: {
2103 data.enforceInterface(IActivityManager.descriptor);
2104 int userid = data.readInt();
2105 boolean result = switchUser(userid);
2106 reply.writeNoException();
2107 reply.writeInt(result ? 1 : 0);
2108 return true;
2109 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07002110
Kenny Guy08488bf2014-02-21 17:40:37 +00002111 case START_USER_IN_BACKGROUND_TRANSACTION: {
2112 data.enforceInterface(IActivityManager.descriptor);
2113 int userid = data.readInt();
2114 boolean result = startUserInBackground(userid);
2115 reply.writeNoException();
2116 reply.writeInt(result ? 1 : 0);
2117 return true;
2118 }
2119
Jeff Sharkeyba512352015-11-12 20:17:45 -08002120 case UNLOCK_USER_TRANSACTION: {
2121 data.enforceInterface(IActivityManager.descriptor);
2122 int userId = data.readInt();
2123 byte[] token = data.createByteArray();
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00002124 byte[] secret = data.createByteArray();
2125 boolean result = unlockUser(userId, token, secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08002126 reply.writeNoException();
2127 reply.writeInt(result ? 1 : 0);
2128 return true;
2129 }
2130
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002131 case STOP_USER_TRANSACTION: {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002134 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002135 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2136 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002137 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002138 reply.writeNoException();
2139 reply.writeInt(result);
2140 return true;
2141 }
2142
Amith Yamasani52f1d752012-03-28 18:19:29 -07002143 case GET_CURRENT_USER_TRANSACTION: {
2144 data.enforceInterface(IActivityManager.descriptor);
2145 UserInfo userInfo = getCurrentUser();
2146 reply.writeNoException();
2147 userInfo.writeToParcel(reply, 0);
2148 return true;
2149 }
2150
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002151 case IS_USER_RUNNING_TRANSACTION: {
2152 data.enforceInterface(IActivityManager.descriptor);
2153 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002154 int _flags = data.readInt();
2155 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002156 reply.writeNoException();
2157 reply.writeInt(result ? 1 : 0);
2158 return true;
2159 }
2160
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002161 case GET_RUNNING_USER_IDS_TRANSACTION: {
2162 data.enforceInterface(IActivityManager.descriptor);
2163 int[] result = getRunningUserIds();
2164 reply.writeNoException();
2165 reply.writeIntArray(result);
2166 return true;
2167 }
2168
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002169 case REMOVE_TASK_TRANSACTION:
2170 {
2171 data.enforceInterface(IActivityManager.descriptor);
2172 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002173 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002174 reply.writeNoException();
2175 reply.writeInt(result ? 1 : 0);
2176 return true;
2177 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002178
Jeff Sharkeya4620792011-05-20 15:29:23 -07002179 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2180 data.enforceInterface(IActivityManager.descriptor);
2181 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2182 data.readStrongBinder());
2183 registerProcessObserver(observer);
2184 return true;
2185 }
2186
2187 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2188 data.enforceInterface(IActivityManager.descriptor);
2189 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2190 data.readStrongBinder());
2191 unregisterProcessObserver(observer);
2192 return true;
2193 }
2194
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002195 case REGISTER_UID_OBSERVER_TRANSACTION: {
2196 data.enforceInterface(IActivityManager.descriptor);
2197 IUidObserver observer = IUidObserver.Stub.asInterface(
2198 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002199 int which = data.readInt();
2200 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002201 return true;
2202 }
2203
2204 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2205 data.enforceInterface(IActivityManager.descriptor);
2206 IUidObserver observer = IUidObserver.Stub.asInterface(
2207 data.readStrongBinder());
2208 unregisterUidObserver(observer);
2209 return true;
2210 }
2211
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002212 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2213 {
2214 data.enforceInterface(IActivityManager.descriptor);
2215 String pkg = data.readString();
2216 boolean ask = getPackageAskScreenCompat(pkg);
2217 reply.writeNoException();
2218 reply.writeInt(ask ? 1 : 0);
2219 return true;
2220 }
2221
2222 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2223 {
2224 data.enforceInterface(IActivityManager.descriptor);
2225 String pkg = data.readString();
2226 boolean ask = data.readInt() != 0;
2227 setPackageAskScreenCompat(pkg, ask);
2228 reply.writeNoException();
2229 return true;
2230 }
2231
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002232 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2233 data.enforceInterface(IActivityManager.descriptor);
2234 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002235 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002236 boolean res = isIntentSenderTargetedToPackage(r);
2237 reply.writeNoException();
2238 reply.writeInt(res ? 1 : 0);
2239 return true;
2240 }
2241
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002242 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2243 data.enforceInterface(IActivityManager.descriptor);
2244 IIntentSender r = IIntentSender.Stub.asInterface(
2245 data.readStrongBinder());
2246 boolean res = isIntentSenderAnActivity(r);
2247 reply.writeNoException();
2248 reply.writeInt(res ? 1 : 0);
2249 return true;
2250 }
2251
Dianne Hackborn81038902012-11-26 17:04:09 -08002252 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2253 data.enforceInterface(IActivityManager.descriptor);
2254 IIntentSender r = IIntentSender.Stub.asInterface(
2255 data.readStrongBinder());
2256 Intent intent = getIntentForIntentSender(r);
2257 reply.writeNoException();
2258 if (intent != null) {
2259 reply.writeInt(1);
2260 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2261 } else {
2262 reply.writeInt(0);
2263 }
2264 return true;
2265 }
2266
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002267 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2268 data.enforceInterface(IActivityManager.descriptor);
2269 IIntentSender r = IIntentSender.Stub.asInterface(
2270 data.readStrongBinder());
2271 String prefix = data.readString();
2272 String tag = getTagForIntentSender(r, prefix);
2273 reply.writeNoException();
2274 reply.writeString(tag);
2275 return true;
2276 }
2277
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002278 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2279 data.enforceInterface(IActivityManager.descriptor);
2280 Configuration config = Configuration.CREATOR.createFromParcel(data);
2281 updatePersistentConfiguration(config);
2282 reply.writeNoException();
2283 return true;
2284 }
2285
Dianne Hackbornb437e092011-08-05 17:50:29 -07002286 case GET_PROCESS_PSS_TRANSACTION: {
2287 data.enforceInterface(IActivityManager.descriptor);
2288 int[] pids = data.createIntArray();
2289 long[] pss = getProcessPss(pids);
2290 reply.writeNoException();
2291 reply.writeLongArray(pss);
2292 return true;
2293 }
2294
Dianne Hackborn661cd522011-08-22 00:26:20 -07002295 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2296 data.enforceInterface(IActivityManager.descriptor);
2297 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2298 boolean always = data.readInt() != 0;
2299 showBootMessage(msg, always);
2300 reply.writeNoException();
2301 return true;
2302 }
2303
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002304 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002305 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002306 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002307 reply.writeNoException();
2308 return true;
2309 }
2310
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002311 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2312 data.enforceInterface(IActivityManager.descriptor);
Adrian Roosd5c2db62016-03-08 16:11:31 -08002313 keyguardGoingAway(data.readInt());
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002314 reply.writeNoException();
2315 return true;
2316 }
2317
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002318 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002319 data.enforceInterface(IActivityManager.descriptor);
2320 IBinder token = data.readStrongBinder();
2321 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002322 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002323 reply.writeNoException();
2324 reply.writeInt(res ? 1 : 0);
2325 return true;
2326 }
2327
2328 case NAVIGATE_UP_TO_TRANSACTION: {
2329 data.enforceInterface(IActivityManager.descriptor);
2330 IBinder token = data.readStrongBinder();
2331 Intent target = Intent.CREATOR.createFromParcel(data);
2332 int resultCode = data.readInt();
2333 Intent resultData = null;
2334 if (data.readInt() != 0) {
2335 resultData = Intent.CREATOR.createFromParcel(data);
2336 }
2337 boolean res = navigateUpTo(token, target, resultCode, resultData);
2338 reply.writeNoException();
2339 reply.writeInt(res ? 1 : 0);
2340 return true;
2341 }
2342
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002343 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2344 data.enforceInterface(IActivityManager.descriptor);
2345 IBinder token = data.readStrongBinder();
2346 int res = getLaunchedFromUid(token);
2347 reply.writeNoException();
2348 reply.writeInt(res);
2349 return true;
2350 }
2351
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002352 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2353 data.enforceInterface(IActivityManager.descriptor);
2354 IBinder token = data.readStrongBinder();
2355 String res = getLaunchedFromPackage(token);
2356 reply.writeNoException();
2357 reply.writeString(res);
2358 return true;
2359 }
2360
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002361 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2362 data.enforceInterface(IActivityManager.descriptor);
2363 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2364 data.readStrongBinder());
2365 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002366 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002367 return true;
2368 }
2369
2370 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2371 data.enforceInterface(IActivityManager.descriptor);
2372 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2373 data.readStrongBinder());
2374 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002375 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002376 return true;
2377 }
2378
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002379 case REQUEST_BUG_REPORT_TRANSACTION: {
2380 data.enforceInterface(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00002381 int bugreportType = data.readInt();
2382 requestBugReport(bugreportType);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002383 reply.writeNoException();
2384 return true;
2385 }
2386
2387 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2388 data.enforceInterface(IActivityManager.descriptor);
2389 int pid = data.readInt();
2390 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002391 String reason = data.readString();
2392 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002393 reply.writeNoException();
2394 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002395 return true;
2396 }
2397
Adam Skorydfc7fd72013-08-05 19:23:41 -07002398 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002399 data.enforceInterface(IActivityManager.descriptor);
2400 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002401 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002402 reply.writeNoException();
2403 reply.writeBundle(res);
2404 return true;
2405 }
2406
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002407 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2408 data.enforceInterface(IActivityManager.descriptor);
2409 int requestType = data.readInt();
2410 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002411 IBinder activityToken = data.readStrongBinder();
2412 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002413 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002414 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002415 return true;
2416 }
2417
Adam Skorydfc7fd72013-08-05 19:23:41 -07002418 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002419 data.enforceInterface(IActivityManager.descriptor);
2420 IBinder token = data.readStrongBinder();
2421 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002422 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2423 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002424 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2425 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002426 reply.writeNoException();
2427 return true;
2428 }
2429
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002430 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2431 data.enforceInterface(IActivityManager.descriptor);
2432 Intent intent = Intent.CREATOR.createFromParcel(data);
2433 int requestType = data.readInt();
2434 String hint = data.readString();
2435 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002436 Bundle args = data.readBundle();
2437 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002438 reply.writeNoException();
2439 reply.writeInt(res ? 1 : 0);
2440 return true;
2441 }
2442
Benjamin Franzc200f442015-06-25 18:20:04 +01002443 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2444 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002445 boolean res = isAssistDataAllowedOnCurrentActivity();
2446 reply.writeNoException();
2447 reply.writeInt(res ? 1 : 0);
2448 return true;
2449 }
2450
2451 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2452 data.enforceInterface(IActivityManager.descriptor);
2453 IBinder token = data.readStrongBinder();
2454 Bundle args = data.readBundle();
2455 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002456 reply.writeNoException();
2457 reply.writeInt(res ? 1 : 0);
2458 return true;
2459 }
2460
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002461 case KILL_UID_TRANSACTION: {
2462 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002463 int appId = data.readInt();
2464 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002465 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002466 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002467 reply.writeNoException();
2468 return true;
2469 }
2470
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002471 case HANG_TRANSACTION: {
2472 data.enforceInterface(IActivityManager.descriptor);
2473 IBinder who = data.readStrongBinder();
2474 boolean allowRestart = data.readInt() != 0;
2475 hang(who, allowRestart);
2476 reply.writeNoException();
2477 return true;
2478 }
2479
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002480 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2481 data.enforceInterface(IActivityManager.descriptor);
2482 IBinder token = data.readStrongBinder();
2483 reportActivityFullyDrawn(token);
2484 reply.writeNoException();
2485 return true;
2486 }
2487
Craig Mautner5eda9b32013-07-02 11:58:16 -07002488 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2489 data.enforceInterface(IActivityManager.descriptor);
2490 IBinder token = data.readStrongBinder();
2491 notifyActivityDrawn(token);
2492 reply.writeNoException();
2493 return true;
2494 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002495
2496 case RESTART_TRANSACTION: {
2497 data.enforceInterface(IActivityManager.descriptor);
2498 restart();
2499 reply.writeNoException();
2500 return true;
2501 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002502
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002503 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2504 data.enforceInterface(IActivityManager.descriptor);
2505 performIdleMaintenance();
2506 reply.writeNoException();
2507 return true;
2508 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002509
Todd Kennedyca4d8422015-01-15 15:19:22 -08002510 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002511 data.enforceInterface(IActivityManager.descriptor);
2512 IBinder parentActivityToken = data.readStrongBinder();
2513 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002514 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002515 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002516 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002517 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002518 if (activityContainer != null) {
2519 reply.writeInt(1);
2520 reply.writeStrongBinder(activityContainer.asBinder());
2521 } else {
2522 reply.writeInt(0);
2523 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002524 return true;
2525 }
2526
Craig Mautner95da1082014-02-24 17:54:35 -08002527 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2528 data.enforceInterface(IActivityManager.descriptor);
2529 IActivityContainer activityContainer =
2530 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2531 deleteActivityContainer(activityContainer);
2532 reply.writeNoException();
2533 return true;
2534 }
2535
Todd Kennedy4900bf92015-01-16 16:05:14 -08002536 case CREATE_STACK_ON_DISPLAY: {
2537 data.enforceInterface(IActivityManager.descriptor);
2538 int displayId = data.readInt();
2539 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2540 reply.writeNoException();
2541 if (activityContainer != null) {
2542 reply.writeInt(1);
2543 reply.writeStrongBinder(activityContainer.asBinder());
2544 } else {
2545 reply.writeInt(0);
2546 }
2547 return true;
2548 }
2549
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002550 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002551 data.enforceInterface(IActivityManager.descriptor);
2552 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002553 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002554 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002555 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002556 return true;
2557 }
2558
Craig Mautneraea74a52014-03-08 14:23:10 -08002559 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2560 data.enforceInterface(IActivityManager.descriptor);
2561 final int taskId = data.readInt();
2562 startLockTaskMode(taskId);
2563 reply.writeNoException();
2564 return true;
2565 }
2566
2567 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2568 data.enforceInterface(IActivityManager.descriptor);
2569 IBinder token = data.readStrongBinder();
2570 startLockTaskMode(token);
2571 reply.writeNoException();
2572 return true;
2573 }
2574
Craig Mautnerd61dc202014-07-07 11:09:11 -07002575 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002576 data.enforceInterface(IActivityManager.descriptor);
2577 startLockTaskModeOnCurrent();
2578 reply.writeNoException();
2579 return true;
2580 }
2581
Craig Mautneraea74a52014-03-08 14:23:10 -08002582 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2583 data.enforceInterface(IActivityManager.descriptor);
2584 stopLockTaskMode();
2585 reply.writeNoException();
2586 return true;
2587 }
2588
Craig Mautnerd61dc202014-07-07 11:09:11 -07002589 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002590 data.enforceInterface(IActivityManager.descriptor);
2591 stopLockTaskModeOnCurrent();
2592 reply.writeNoException();
2593 return true;
2594 }
2595
Craig Mautneraea74a52014-03-08 14:23:10 -08002596 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2597 data.enforceInterface(IActivityManager.descriptor);
2598 final boolean isInLockTaskMode = isInLockTaskMode();
2599 reply.writeNoException();
2600 reply.writeInt(isInLockTaskMode ? 1 : 0);
2601 return true;
2602 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002603
Benjamin Franz43261142015-02-11 15:59:44 +00002604 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2605 data.enforceInterface(IActivityManager.descriptor);
2606 final int lockTaskModeState = getLockTaskModeState();
2607 reply.writeNoException();
2608 reply.writeInt(lockTaskModeState);
2609 return true;
2610 }
2611
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002612 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2613 data.enforceInterface(IActivityManager.descriptor);
2614 final IBinder token = data.readStrongBinder();
2615 showLockTaskEscapeMessage(token);
2616 reply.writeNoException();
2617 return true;
2618 }
2619
Winson Chunga449dc02014-05-16 11:15:04 -07002620 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002621 data.enforceInterface(IActivityManager.descriptor);
2622 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002623 ActivityManager.TaskDescription values =
2624 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2625 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002626 reply.writeNoException();
2627 return true;
2628 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002629
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002630 case SET_TASK_RESIZEABLE_TRANSACTION: {
2631 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08002632 final int taskId = data.readInt();
2633 final int resizeableMode = data.readInt();
2634 setTaskResizeable(taskId, resizeableMode);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002635 reply.writeNoException();
2636 return true;
2637 }
2638
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002639 case RESIZE_TASK_TRANSACTION: {
2640 data.enforceInterface(IActivityManager.descriptor);
2641 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002642 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002643 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002644 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002645 reply.writeNoException();
2646 return true;
2647 }
2648
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002649 case GET_TASK_BOUNDS_TRANSACTION: {
2650 data.enforceInterface(IActivityManager.descriptor);
2651 int taskId = data.readInt();
2652 Rect r = getTaskBounds(taskId);
2653 reply.writeNoException();
2654 r.writeToParcel(reply, 0);
2655 return true;
2656 }
2657
Craig Mautner648f69b2014-09-18 14:16:26 -07002658 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2659 data.enforceInterface(IActivityManager.descriptor);
2660 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002661 int userId = data.readInt();
2662 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002663 reply.writeNoException();
2664 if (icon == null) {
2665 reply.writeInt(0);
2666 } else {
2667 reply.writeInt(1);
2668 icon.writeToParcel(reply, 0);
2669 }
2670 return true;
2671 }
2672
Winson Chung044d5292014-11-06 11:05:19 -08002673 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2674 data.enforceInterface(IActivityManager.descriptor);
2675 final Bundle bundle;
2676 if (data.readInt() == 0) {
2677 bundle = null;
2678 } else {
2679 bundle = data.readBundle();
2680 }
Chong Zhang280d3322015-11-03 17:27:26 -08002681 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002682 startInPlaceAnimationOnFrontMostApplication(options);
2683 reply.writeNoException();
2684 return true;
2685 }
2686
Jose Lima4b6c6692014-08-12 17:41:12 -07002687 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002688 data.enforceInterface(IActivityManager.descriptor);
2689 IBinder token = data.readStrongBinder();
2690 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002691 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002692 reply.writeNoException();
2693 reply.writeInt(success ? 1 : 0);
2694 return true;
2695 }
2696
Jose Lima4b6c6692014-08-12 17:41:12 -07002697 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002698 data.enforceInterface(IActivityManager.descriptor);
2699 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002700 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002701 reply.writeNoException();
2702 reply.writeInt(enabled ? 1 : 0);
2703 return true;
2704 }
2705
Jose Lima4b6c6692014-08-12 17:41:12 -07002706 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002707 data.enforceInterface(IActivityManager.descriptor);
2708 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002709 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002710 reply.writeNoException();
2711 return true;
2712 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002713
2714 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2715 data.enforceInterface(IActivityManager.descriptor);
2716 IBinder token = data.readStrongBinder();
2717 notifyLaunchTaskBehindComplete(token);
2718 reply.writeNoException();
2719 return true;
2720 }
Craig Mautner8746a472014-07-24 15:12:54 -07002721
2722 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2723 data.enforceInterface(IActivityManager.descriptor);
2724 IBinder token = data.readStrongBinder();
2725 notifyEnterAnimationComplete(token);
2726 reply.writeNoException();
2727 return true;
2728 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002729
2730 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2731 data.enforceInterface(IActivityManager.descriptor);
2732 bootAnimationComplete();
2733 reply.writeNoException();
2734 return true;
2735 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002736
Jeff Sharkey605eb792014-11-04 13:34:06 -08002737 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2738 data.enforceInterface(IActivityManager.descriptor);
2739 final int uid = data.readInt();
2740 final byte[] firstPacket = data.createByteArray();
2741 notifyCleartextNetwork(uid, firstPacket);
2742 reply.writeNoException();
2743 return true;
2744 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002745
2746 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2747 data.enforceInterface(IActivityManager.descriptor);
2748 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002749 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002750 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002751 String reportPackage = data.readString();
2752 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002753 reply.writeNoException();
2754 return true;
2755 }
2756
2757 case DUMP_HEAP_FINISHED_TRANSACTION: {
2758 data.enforceInterface(IActivityManager.descriptor);
2759 String path = data.readString();
2760 dumpHeapFinished(path);
2761 reply.writeNoException();
2762 return true;
2763 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002764
2765 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2766 data.enforceInterface(IActivityManager.descriptor);
2767 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2768 data.readStrongBinder());
2769 boolean keepAwake = data.readInt() != 0;
2770 setVoiceKeepAwake(session, keepAwake);
2771 reply.writeNoException();
2772 return true;
2773 }
Craig Mautnere5600772015-04-03 21:36:37 -07002774
2775 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2776 data.enforceInterface(IActivityManager.descriptor);
2777 int userId = data.readInt();
2778 String[] packages = data.readStringArray();
2779 updateLockTaskPackages(userId, packages);
2780 reply.writeNoException();
2781 return true;
2782 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002783
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002784 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2785 data.enforceInterface(IActivityManager.descriptor);
2786 String packageName = data.readString();
2787 updateDeviceOwner(packageName);
2788 reply.writeNoException();
2789 return true;
2790 }
2791
Dianne Hackborn1e383822015-04-10 14:02:33 -07002792 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2793 data.enforceInterface(IActivityManager.descriptor);
2794 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002795 String callingPackage = data.readString();
2796 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002797 reply.writeNoException();
2798 reply.writeInt(res);
2799 return true;
2800 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002801
2802 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2803 data.enforceInterface(IActivityManager.descriptor);
2804 String process = data.readString();
2805 int userId = data.readInt();
2806 int level = data.readInt();
2807 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2808 reply.writeNoException();
2809 reply.writeInt(res ? 1 : 0);
2810 return true;
2811 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002812
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002813 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2814 data.enforceInterface(IActivityManager.descriptor);
2815 IBinder token = data.readStrongBinder();
2816 boolean res = isRootVoiceInteraction(token);
2817 reply.writeNoException();
2818 reply.writeInt(res ? 1 : 0);
2819 return true;
2820 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002821
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002822 case START_BINDER_TRACKING_TRANSACTION: {
2823 data.enforceInterface(IActivityManager.descriptor);
2824 boolean res = startBinderTracking();
2825 reply.writeNoException();
2826 reply.writeInt(res ? 1 : 0);
2827 return true;
2828 }
2829
2830 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2831 data.enforceInterface(IActivityManager.descriptor);
2832 ParcelFileDescriptor fd = data.readInt() != 0
2833 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2834 boolean res = stopBinderTrackingAndDump(fd);
2835 reply.writeNoException();
2836 reply.writeInt(res ? 1 : 0);
2837 return true;
2838 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002839 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2840 data.enforceInterface(IActivityManager.descriptor);
2841 IBinder token = data.readStrongBinder();
2842 int stackId = getActivityStackId(token);
2843 reply.writeNoException();
2844 reply.writeInt(stackId);
2845 return true;
2846 }
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002847 case EXIT_FREEFORM_MODE_TRANSACTION: {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002848 data.enforceInterface(IActivityManager.descriptor);
2849 IBinder token = data.readStrongBinder();
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002850 exitFreeformMode(token);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002851 reply.writeNoException();
2852 return true;
2853 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002854 case REPORT_SIZE_CONFIGURATIONS: {
2855 data.enforceInterface(IActivityManager.descriptor);
2856 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002857 int[] horizontal = readIntArray(data);
2858 int[] vertical = readIntArray(data);
2859 int[] smallest = readIntArray(data);
2860 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002861 return true;
2862 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002863 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2864 data.enforceInterface(IActivityManager.descriptor);
2865 final boolean suppress = data.readInt() == 1;
2866 suppressResizeConfigChanges(suppress);
2867 reply.writeNoException();
2868 return true;
2869 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002870 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002871 data.enforceInterface(IActivityManager.descriptor);
2872 final int stackId = data.readInt();
Wale Ogunwale9101d262016-01-15 08:56:11 -08002873 final boolean onTop = data.readInt() == 1;
2874 moveTasksToFullscreenStack(stackId, onTop);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002875 reply.writeNoException();
2876 return true;
2877 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002878 case GET_APP_START_MODE_TRANSACTION: {
2879 data.enforceInterface(IActivityManager.descriptor);
2880 final int uid = data.readInt();
2881 final String pkg = data.readString();
2882 int res = getAppStartMode(uid, pkg);
2883 reply.writeNoException();
2884 reply.writeInt(res);
2885 return true;
2886 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002887 case IN_MULTI_WINDOW_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002888 data.enforceInterface(IActivityManager.descriptor);
2889 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002890 final boolean inMultiWindow = inMultiWindow(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002891 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002892 reply.writeInt(inMultiWindow ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002893 return true;
2894 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002895 case IN_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002896 data.enforceInterface(IActivityManager.descriptor);
2897 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002898 final boolean inPip = inPictureInPicture(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002899 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002900 reply.writeInt(inPip ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002901 return true;
2902 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002903 case ENTER_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002904 data.enforceInterface(IActivityManager.descriptor);
2905 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002906 enterPictureInPicture(token);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002907 reply.writeNoException();
2908 return true;
2909 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002910 case SET_VR_MODE_TRANSACTION: {
2911 data.enforceInterface(IActivityManager.descriptor);
2912 final IBinder token = data.readStrongBinder();
2913 final boolean enable = data.readInt() == 1;
Ruben Brunke24b9a62016-02-16 21:38:24 -08002914 final ComponentName packageName = ComponentName.CREATOR.createFromParcel(data);
2915 int res = setVrMode(token, enable, packageName);
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002916 reply.writeNoException();
Ruben Brunke24b9a62016-02-16 21:38:24 -08002917 reply.writeInt(res);
2918 return true;
2919 }
2920 case IS_VR_PACKAGE_ENABLED_TRANSACTION: {
2921 data.enforceInterface(IActivityManager.descriptor);
2922 final ComponentName packageName = ComponentName.CREATOR.createFromParcel(data);
2923 boolean res = isVrModePackageEnabled(packageName);
2924 reply.writeNoException();
2925 reply.writeInt(res ? 1 : 0);
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002926 return true;
2927 }
Christopher Tate63fec3e2015-12-11 18:35:28 -08002928 case IS_APP_FOREGROUND_TRANSACTION: {
2929 data.enforceInterface(IActivityManager.descriptor);
2930 final int userHandle = data.readInt();
2931 final boolean isForeground = isAppForeground(userHandle);
2932 reply.writeNoException();
2933 reply.writeInt(isForeground ? 1 : 0);
2934 return true;
2935 }
Wale Ogunwale480dca02016-02-06 13:58:29 -08002936 case NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION: {
2937 data.enforceInterface(IActivityManager.descriptor);
2938 reply.writeNoException();
2939 return true;
2940 }
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08002941 case REMOVE_STACK: {
2942 data.enforceInterface(IActivityManager.descriptor);
2943 final int stackId = data.readInt();
2944 removeStack(stackId);
2945 reply.writeNoException();
2946 return true;
2947 }
Tony Mak9c6e8ce2016-03-21 12:07:16 +00002948 case NOTIFY_LOCKED_PROFILE: {
2949 data.enforceInterface(IActivityManager.descriptor);
2950 final int userId = data.readInt();
2951 notifyLockedProfile(userId);
2952 reply.writeNoException();
2953 return true;
2954 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002955 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002956
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002957 return super.onTransact(code, data, reply, flags);
2958 }
2959
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002960 private int[] readIntArray(Parcel data) {
2961 int[] smallest = null;
2962 int smallestSize = data.readInt();
2963 if (smallestSize > 0) {
2964 smallest = new int[smallestSize];
2965 data.readIntArray(smallest);
2966 }
2967 return smallest;
2968 }
2969
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002970 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 return this;
2972 }
2973
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002974 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2975 protected IActivityManager create() {
2976 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002977 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002978 Log.v("ActivityManager", "default service binder = " + b);
2979 }
2980 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002981 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002982 Log.v("ActivityManager", "default service = " + am);
2983 }
2984 return am;
2985 }
2986 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002987}
2988
2989class ActivityManagerProxy implements IActivityManager
2990{
2991 public ActivityManagerProxy(IBinder remote)
2992 {
2993 mRemote = remote;
2994 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002995
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002996 public IBinder asBinder()
2997 {
2998 return mRemote;
2999 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08003000
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003001 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003002 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07003003 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003004 Parcel data = Parcel.obtain();
3005 Parcel reply = Parcel.obtain();
3006 data.writeInterfaceToken(IActivityManager.descriptor);
3007 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003008 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003009 intent.writeToParcel(data, 0);
3010 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003011 data.writeStrongBinder(resultTo);
3012 data.writeString(resultWho);
3013 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003014 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003015 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003016 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003017 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003018 } else {
3019 data.writeInt(0);
3020 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003021 if (options != null) {
3022 data.writeInt(1);
3023 options.writeToParcel(data, 0);
3024 } else {
3025 data.writeInt(0);
3026 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003027 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 int result = reply.readInt();
3030 reply.recycle();
3031 data.recycle();
3032 return result;
3033 }
Amith Yamasani82644082012-08-03 13:09:11 -07003034
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003035 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07003036 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07003037 int startFlags, ProfilerInfo profilerInfo, Bundle options,
3038 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07003039 Parcel data = Parcel.obtain();
3040 Parcel reply = Parcel.obtain();
3041 data.writeInterfaceToken(IActivityManager.descriptor);
3042 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003043 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07003044 intent.writeToParcel(data, 0);
3045 data.writeString(resolvedType);
3046 data.writeStrongBinder(resultTo);
3047 data.writeString(resultWho);
3048 data.writeInt(requestCode);
3049 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003050 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07003051 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003052 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07003053 } else {
3054 data.writeInt(0);
3055 }
3056 if (options != null) {
3057 data.writeInt(1);
3058 options.writeToParcel(data, 0);
3059 } else {
3060 data.writeInt(0);
3061 }
3062 data.writeInt(userId);
3063 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
3064 reply.readException();
3065 int result = reply.readInt();
3066 reply.recycle();
3067 data.recycle();
3068 return result;
3069 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003070 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
3071 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003072 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
3073 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003074 Parcel data = Parcel.obtain();
3075 Parcel reply = Parcel.obtain();
3076 data.writeInterfaceToken(IActivityManager.descriptor);
3077 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3078 data.writeString(callingPackage);
3079 intent.writeToParcel(data, 0);
3080 data.writeString(resolvedType);
3081 data.writeStrongBinder(resultTo);
3082 data.writeString(resultWho);
3083 data.writeInt(requestCode);
3084 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003085 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003086 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003087 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003088 } else {
3089 data.writeInt(0);
3090 }
3091 if (options != null) {
3092 data.writeInt(1);
3093 options.writeToParcel(data, 0);
3094 } else {
3095 data.writeInt(0);
3096 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003097 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07003098 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003099 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
3100 reply.readException();
3101 int result = reply.readInt();
3102 reply.recycle();
3103 data.recycle();
3104 return result;
3105 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003106 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
3107 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07003108 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
3109 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003110 Parcel data = Parcel.obtain();
3111 Parcel reply = Parcel.obtain();
3112 data.writeInterfaceToken(IActivityManager.descriptor);
3113 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003114 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003115 intent.writeToParcel(data, 0);
3116 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003117 data.writeStrongBinder(resultTo);
3118 data.writeString(resultWho);
3119 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003120 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003121 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003122 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003123 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003124 } else {
3125 data.writeInt(0);
3126 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003127 if (options != null) {
3128 data.writeInt(1);
3129 options.writeToParcel(data, 0);
3130 } else {
3131 data.writeInt(0);
3132 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003133 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003134 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3135 reply.readException();
3136 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3137 reply.recycle();
3138 data.recycle();
3139 return result;
3140 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003141 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3142 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003143 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003144 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003145 Parcel data = Parcel.obtain();
3146 Parcel reply = Parcel.obtain();
3147 data.writeInterfaceToken(IActivityManager.descriptor);
3148 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003149 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003150 intent.writeToParcel(data, 0);
3151 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003152 data.writeStrongBinder(resultTo);
3153 data.writeString(resultWho);
3154 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003155 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003156 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003157 if (options != null) {
3158 data.writeInt(1);
3159 options.writeToParcel(data, 0);
3160 } else {
3161 data.writeInt(0);
3162 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003163 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003164 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3165 reply.readException();
3166 int result = reply.readInt();
3167 reply.recycle();
3168 data.recycle();
3169 return result;
3170 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003171 public int startActivityIntentSender(IApplicationThread caller,
3172 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003173 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003174 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003175 Parcel data = Parcel.obtain();
3176 Parcel reply = Parcel.obtain();
3177 data.writeInterfaceToken(IActivityManager.descriptor);
3178 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3179 intent.writeToParcel(data, 0);
3180 if (fillInIntent != null) {
3181 data.writeInt(1);
3182 fillInIntent.writeToParcel(data, 0);
3183 } else {
3184 data.writeInt(0);
3185 }
3186 data.writeString(resolvedType);
3187 data.writeStrongBinder(resultTo);
3188 data.writeString(resultWho);
3189 data.writeInt(requestCode);
3190 data.writeInt(flagsMask);
3191 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003192 if (options != null) {
3193 data.writeInt(1);
3194 options.writeToParcel(data, 0);
3195 } else {
3196 data.writeInt(0);
3197 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003198 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003199 reply.readException();
3200 int result = reply.readInt();
3201 reply.recycle();
3202 data.recycle();
3203 return result;
3204 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003205 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3206 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003207 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3208 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003209 Parcel data = Parcel.obtain();
3210 Parcel reply = Parcel.obtain();
3211 data.writeInterfaceToken(IActivityManager.descriptor);
3212 data.writeString(callingPackage);
3213 data.writeInt(callingPid);
3214 data.writeInt(callingUid);
3215 intent.writeToParcel(data, 0);
3216 data.writeString(resolvedType);
3217 data.writeStrongBinder(session.asBinder());
3218 data.writeStrongBinder(interactor.asBinder());
3219 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003220 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003221 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003222 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003223 } else {
3224 data.writeInt(0);
3225 }
3226 if (options != null) {
3227 data.writeInt(1);
3228 options.writeToParcel(data, 0);
3229 } else {
3230 data.writeInt(0);
3231 }
3232 data.writeInt(userId);
3233 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3234 reply.readException();
3235 int result = reply.readInt();
3236 reply.recycle();
3237 data.recycle();
3238 return result;
3239 }
Amith Yamasani0af6fa72016-01-17 15:36:19 -08003240
3241 public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options)
3242 throws RemoteException {
3243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 data.writeStrongBinder(callingActivity);
3247 data.writeBundle(options);
3248 mRemote.transact(START_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3249 reply.readException();
3250 reply.recycle();
3251 data.recycle();
3252 }
3253
3254 public void stopLocalVoiceInteraction(IBinder callingActivity) throws RemoteException {
3255 Parcel data = Parcel.obtain();
3256 Parcel reply = Parcel.obtain();
3257 data.writeInterfaceToken(IActivityManager.descriptor);
3258 data.writeStrongBinder(callingActivity);
3259 mRemote.transact(STOP_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 reply.recycle();
3262 data.recycle();
3263 }
3264
3265 public boolean supportsLocalVoiceInteraction() throws RemoteException {
3266 Parcel data = Parcel.obtain();
3267 Parcel reply = Parcel.obtain();
3268 data.writeInterfaceToken(IActivityManager.descriptor);
3269 mRemote.transact(SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3270 reply.readException();
3271 int result = reply.readInt();
3272 reply.recycle();
3273 data.recycle();
3274 return result != 0;
3275 }
3276
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003277 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003278 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003279 Parcel data = Parcel.obtain();
3280 Parcel reply = Parcel.obtain();
3281 data.writeInterfaceToken(IActivityManager.descriptor);
3282 data.writeStrongBinder(callingActivity);
3283 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003284 if (options != null) {
3285 data.writeInt(1);
3286 options.writeToParcel(data, 0);
3287 } else {
3288 data.writeInt(0);
3289 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003290 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3291 reply.readException();
3292 int result = reply.readInt();
3293 reply.recycle();
3294 data.recycle();
3295 return result != 0;
3296 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003297 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003298 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003299 Parcel data = Parcel.obtain();
3300 Parcel reply = Parcel.obtain();
3301 data.writeInterfaceToken(IActivityManager.descriptor);
3302 data.writeInt(taskId);
3303 if (options == null) {
3304 data.writeInt(0);
3305 } else {
3306 data.writeInt(1);
3307 options.writeToParcel(data, 0);
3308 }
3309 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3310 reply.readException();
3311 int result = reply.readInt();
3312 reply.recycle();
3313 data.recycle();
3314 return result;
3315 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003316 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003317 throws RemoteException {
3318 Parcel data = Parcel.obtain();
3319 Parcel reply = Parcel.obtain();
3320 data.writeInterfaceToken(IActivityManager.descriptor);
3321 data.writeStrongBinder(token);
3322 data.writeInt(resultCode);
3323 if (resultData != null) {
3324 data.writeInt(1);
3325 resultData.writeToParcel(data, 0);
3326 } else {
3327 data.writeInt(0);
3328 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003329 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003330 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3331 reply.readException();
3332 boolean res = reply.readInt() != 0;
3333 data.recycle();
3334 reply.recycle();
3335 return res;
3336 }
3337 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3338 {
3339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 data.writeStrongBinder(token);
3343 data.writeString(resultWho);
3344 data.writeInt(requestCode);
3345 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 data.recycle();
3348 reply.recycle();
3349 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003350 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3351 Parcel data = Parcel.obtain();
3352 Parcel reply = Parcel.obtain();
3353 data.writeInterfaceToken(IActivityManager.descriptor);
3354 data.writeStrongBinder(token);
3355 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3356 reply.readException();
3357 boolean res = reply.readInt() != 0;
3358 data.recycle();
3359 reply.recycle();
3360 return res;
3361 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003362 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 data.writeStrongBinder(session.asBinder());
3367 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3368 reply.readException();
3369 data.recycle();
3370 reply.recycle();
3371 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003372 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3373 Parcel data = Parcel.obtain();
3374 Parcel reply = Parcel.obtain();
3375 data.writeInterfaceToken(IActivityManager.descriptor);
3376 data.writeStrongBinder(token);
3377 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3378 reply.readException();
3379 boolean res = reply.readInt() != 0;
3380 data.recycle();
3381 reply.recycle();
3382 return res;
3383 }
3384 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3385 Parcel data = Parcel.obtain();
3386 Parcel reply = Parcel.obtain();
3387 data.writeInterfaceToken(IActivityManager.descriptor);
3388 data.writeStrongBinder(app.asBinder());
3389 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3390 reply.readException();
3391 data.recycle();
3392 reply.recycle();
3393 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003394 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3395 Parcel data = Parcel.obtain();
3396 Parcel reply = Parcel.obtain();
3397 data.writeInterfaceToken(IActivityManager.descriptor);
3398 data.writeStrongBinder(token);
3399 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3400 reply.readException();
3401 boolean res = reply.readInt() != 0;
3402 data.recycle();
3403 reply.recycle();
3404 return res;
3405 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003406 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003407 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003408 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003409 {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003414 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003415 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3416 filter.writeToParcel(data, 0);
3417 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003418 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003419 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3420 reply.readException();
3421 Intent intent = null;
3422 int haveIntent = reply.readInt();
3423 if (haveIntent != 0) {
3424 intent = Intent.CREATOR.createFromParcel(reply);
3425 }
3426 reply.recycle();
3427 data.recycle();
3428 return intent;
3429 }
3430 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3431 {
3432 Parcel data = Parcel.obtain();
3433 Parcel reply = Parcel.obtain();
3434 data.writeInterfaceToken(IActivityManager.descriptor);
3435 data.writeStrongBinder(receiver.asBinder());
3436 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3437 reply.readException();
3438 data.recycle();
3439 reply.recycle();
3440 }
3441 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003442 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003443 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003444 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003445 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003446 {
3447 Parcel data = Parcel.obtain();
3448 Parcel reply = Parcel.obtain();
3449 data.writeInterfaceToken(IActivityManager.descriptor);
3450 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3451 intent.writeToParcel(data, 0);
3452 data.writeString(resolvedType);
3453 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3454 data.writeInt(resultCode);
3455 data.writeString(resultData);
3456 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003457 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003458 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003459 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 data.writeInt(serialized ? 1 : 0);
3461 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003462 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003463 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3464 reply.readException();
3465 int res = reply.readInt();
3466 reply.recycle();
3467 data.recycle();
3468 return res;
3469 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003470 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3471 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003472 {
3473 Parcel data = Parcel.obtain();
3474 Parcel reply = Parcel.obtain();
3475 data.writeInterfaceToken(IActivityManager.descriptor);
3476 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3477 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003478 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003479 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3480 reply.readException();
3481 data.recycle();
3482 reply.recycle();
3483 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003484 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3485 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003486 {
3487 Parcel data = Parcel.obtain();
3488 Parcel reply = Parcel.obtain();
3489 data.writeInterfaceToken(IActivityManager.descriptor);
3490 data.writeStrongBinder(who);
3491 data.writeInt(resultCode);
3492 data.writeString(resultData);
3493 data.writeBundle(map);
3494 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003495 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003496 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3497 reply.readException();
3498 data.recycle();
3499 reply.recycle();
3500 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003501 public void attachApplication(IApplicationThread app) throws RemoteException
3502 {
3503 Parcel data = Parcel.obtain();
3504 Parcel reply = Parcel.obtain();
3505 data.writeInterfaceToken(IActivityManager.descriptor);
3506 data.writeStrongBinder(app.asBinder());
3507 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3508 reply.readException();
3509 data.recycle();
3510 reply.recycle();
3511 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003512 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3513 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003514 {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003519 if (config != null) {
3520 data.writeInt(1);
3521 config.writeToParcel(data, 0);
3522 } else {
3523 data.writeInt(0);
3524 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003525 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003526 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3527 reply.readException();
3528 data.recycle();
3529 reply.recycle();
3530 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003531 public void activityResumed(IBinder token) throws RemoteException
3532 {
3533 Parcel data = Parcel.obtain();
3534 Parcel reply = Parcel.obtain();
3535 data.writeInterfaceToken(IActivityManager.descriptor);
3536 data.writeStrongBinder(token);
3537 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 data.recycle();
3540 reply.recycle();
3541 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003542 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003543 {
3544 Parcel data = Parcel.obtain();
3545 Parcel reply = Parcel.obtain();
3546 data.writeInterfaceToken(IActivityManager.descriptor);
3547 data.writeStrongBinder(token);
3548 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3549 reply.readException();
3550 data.recycle();
3551 reply.recycle();
3552 }
3553 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003554 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003555 {
3556 Parcel data = Parcel.obtain();
3557 Parcel reply = Parcel.obtain();
3558 data.writeInterfaceToken(IActivityManager.descriptor);
3559 data.writeStrongBinder(token);
3560 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003561 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003562 TextUtils.writeToParcel(description, data, 0);
3563 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3564 reply.readException();
3565 data.recycle();
3566 reply.recycle();
3567 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003568 public void activitySlept(IBinder token) throws RemoteException
3569 {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeStrongBinder(token);
3574 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3575 reply.readException();
3576 data.recycle();
3577 reply.recycle();
3578 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003579 public void activityDestroyed(IBinder token) throws RemoteException
3580 {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 data.writeStrongBinder(token);
3585 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3586 reply.readException();
3587 data.recycle();
3588 reply.recycle();
3589 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003590 public void activityRelaunched(IBinder token) throws RemoteException
3591 {
3592 Parcel data = Parcel.obtain();
3593 Parcel reply = Parcel.obtain();
3594 data.writeInterfaceToken(IActivityManager.descriptor);
3595 data.writeStrongBinder(token);
3596 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3597 reply.readException();
3598 data.recycle();
3599 reply.recycle();
3600 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003601 public String getCallingPackage(IBinder token) throws RemoteException
3602 {
3603 Parcel data = Parcel.obtain();
3604 Parcel reply = Parcel.obtain();
3605 data.writeInterfaceToken(IActivityManager.descriptor);
3606 data.writeStrongBinder(token);
3607 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3608 reply.readException();
3609 String res = reply.readString();
3610 data.recycle();
3611 reply.recycle();
3612 return res;
3613 }
3614 public ComponentName getCallingActivity(IBinder token)
3615 throws RemoteException {
3616 Parcel data = Parcel.obtain();
3617 Parcel reply = Parcel.obtain();
3618 data.writeInterfaceToken(IActivityManager.descriptor);
3619 data.writeStrongBinder(token);
3620 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3621 reply.readException();
3622 ComponentName res = ComponentName.readFromParcel(reply);
3623 data.recycle();
3624 reply.recycle();
3625 return res;
3626 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003627 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003628 Parcel data = Parcel.obtain();
3629 Parcel reply = Parcel.obtain();
3630 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003631 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003632 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3633 reply.readException();
3634 ArrayList<IAppTask> list = null;
3635 int N = reply.readInt();
3636 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003637 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003638 while (N > 0) {
3639 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3640 list.add(task);
3641 N--;
3642 }
3643 }
3644 data.recycle();
3645 reply.recycle();
3646 return list;
3647 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003648 public int addAppTask(IBinder activityToken, Intent intent,
3649 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3650 Parcel data = Parcel.obtain();
3651 Parcel reply = Parcel.obtain();
3652 data.writeInterfaceToken(IActivityManager.descriptor);
3653 data.writeStrongBinder(activityToken);
3654 intent.writeToParcel(data, 0);
3655 description.writeToParcel(data, 0);
3656 thumbnail.writeToParcel(data, 0);
3657 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 int res = reply.readInt();
3660 data.recycle();
3661 reply.recycle();
3662 return res;
3663 }
3664 public Point getAppTaskThumbnailSize() throws RemoteException {
3665 Parcel data = Parcel.obtain();
3666 Parcel reply = Parcel.obtain();
3667 data.writeInterfaceToken(IActivityManager.descriptor);
3668 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3669 reply.readException();
3670 Point size = Point.CREATOR.createFromParcel(reply);
3671 data.recycle();
3672 reply.recycle();
3673 return size;
3674 }
Todd Kennedye635f662015-01-20 10:36:49 -08003675 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3676 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 data.writeInt(maxNum);
3681 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003682 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3683 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003684 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003685 int N = reply.readInt();
3686 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003687 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003688 while (N > 0) {
3689 ActivityManager.RunningTaskInfo info =
3690 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003691 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003692 list.add(info);
3693 N--;
3694 }
3695 }
3696 data.recycle();
3697 reply.recycle();
3698 return list;
3699 }
3700 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003701 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003702 Parcel data = Parcel.obtain();
3703 Parcel reply = Parcel.obtain();
3704 data.writeInterfaceToken(IActivityManager.descriptor);
3705 data.writeInt(maxNum);
3706 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003707 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003708 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 ArrayList<ActivityManager.RecentTaskInfo> list
3711 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3712 data.recycle();
3713 reply.recycle();
3714 return list;
3715 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003716 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003721 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003722 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003723 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003724 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003725 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003726 }
3727 data.recycle();
3728 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003729 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003730 }
Todd Kennedye635f662015-01-20 10:36:49 -08003731 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3732 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003733 Parcel data = Parcel.obtain();
3734 Parcel reply = Parcel.obtain();
3735 data.writeInterfaceToken(IActivityManager.descriptor);
3736 data.writeInt(maxNum);
3737 data.writeInt(flags);
3738 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3739 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003740 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003741 int N = reply.readInt();
3742 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003743 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003744 while (N > 0) {
3745 ActivityManager.RunningServiceInfo info =
3746 ActivityManager.RunningServiceInfo.CREATOR
3747 .createFromParcel(reply);
3748 list.add(info);
3749 N--;
3750 }
3751 }
3752 data.recycle();
3753 reply.recycle();
3754 return list;
3755 }
3756 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3757 throws RemoteException {
3758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
3761 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3762 reply.readException();
3763 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3764 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3765 data.recycle();
3766 reply.recycle();
3767 return list;
3768 }
3769 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3770 throws RemoteException {
3771 Parcel data = Parcel.obtain();
3772 Parcel reply = Parcel.obtain();
3773 data.writeInterfaceToken(IActivityManager.descriptor);
3774 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3775 reply.readException();
3776 ArrayList<ActivityManager.RunningAppProcessInfo> list
3777 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3778 data.recycle();
3779 reply.recycle();
3780 return list;
3781 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003782 public List<ApplicationInfo> getRunningExternalApplications()
3783 throws RemoteException {
3784 Parcel data = Parcel.obtain();
3785 Parcel reply = Parcel.obtain();
3786 data.writeInterfaceToken(IActivityManager.descriptor);
3787 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3788 reply.readException();
3789 ArrayList<ApplicationInfo> list
3790 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3791 data.recycle();
3792 reply.recycle();
3793 return list;
3794 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003795 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003796 {
3797 Parcel data = Parcel.obtain();
3798 Parcel reply = Parcel.obtain();
3799 data.writeInterfaceToken(IActivityManager.descriptor);
3800 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003801 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003802 if (options != null) {
3803 data.writeInt(1);
3804 options.writeToParcel(data, 0);
3805 } else {
3806 data.writeInt(0);
3807 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003808 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3809 reply.readException();
3810 data.recycle();
3811 reply.recycle();
3812 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003813 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3814 throws RemoteException {
3815 Parcel data = Parcel.obtain();
3816 Parcel reply = Parcel.obtain();
3817 data.writeInterfaceToken(IActivityManager.descriptor);
3818 data.writeStrongBinder(token);
3819 data.writeInt(nonRoot ? 1 : 0);
3820 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3821 reply.readException();
3822 boolean res = reply.readInt() != 0;
3823 data.recycle();
3824 reply.recycle();
3825 return res;
3826 }
3827 public void moveTaskBackwards(int task) throws RemoteException
3828 {
3829 Parcel data = Parcel.obtain();
3830 Parcel reply = Parcel.obtain();
3831 data.writeInterfaceToken(IActivityManager.descriptor);
3832 data.writeInt(task);
3833 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3834 reply.readException();
3835 data.recycle();
3836 reply.recycle();
3837 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003838 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003839 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3840 {
3841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003843 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003844 data.writeInt(taskId);
3845 data.writeInt(stackId);
3846 data.writeInt(toTop ? 1 : 0);
3847 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3848 reply.readException();
3849 data.recycle();
3850 reply.recycle();
3851 }
3852 @Override
Chong Zhange4fbd322016-03-01 14:44:03 -08003853 public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003854 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003855 {
3856 Parcel data = Parcel.obtain();
3857 Parcel reply = Parcel.obtain();
3858 data.writeInterfaceToken(IActivityManager.descriptor);
3859 data.writeInt(taskId);
3860 data.writeInt(createMode);
3861 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003862 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003863 if (initialBounds != null) {
3864 data.writeInt(1);
3865 initialBounds.writeToParcel(data, 0);
3866 } else {
3867 data.writeInt(0);
3868 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003869 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3870 reply.readException();
Chong Zhange4fbd322016-03-01 14:44:03 -08003871 boolean res = reply.readInt() > 0;
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003872 data.recycle();
3873 reply.recycle();
Chong Zhange4fbd322016-03-01 14:44:03 -08003874 return res;
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003875 }
3876 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003877 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3878 throws RemoteException
3879 {
3880 Parcel data = Parcel.obtain();
3881 Parcel reply = Parcel.obtain();
3882 data.writeInterfaceToken(IActivityManager.descriptor);
3883 data.writeInt(stackId);
3884 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003885 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003886 reply.readException();
3887 final boolean res = reply.readInt() != 0;
3888 data.recycle();
3889 reply.recycle();
3890 return res;
3891 }
3892 @Override
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003893 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode,
Wale Ogunwalee75a9ad2016-03-18 20:43:49 -07003894 boolean preserveWindows, boolean animate, int animationDuration)
3895 throws RemoteException {
Craig Mautnerc00204b2013-03-05 15:02:14 -08003896 Parcel data = Parcel.obtain();
3897 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003898 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003899 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003900 if (r != null) {
3901 data.writeInt(1);
3902 r.writeToParcel(data, 0);
3903 } else {
3904 data.writeInt(0);
3905 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003906 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003907 data.writeInt(preserveWindows ? 1 : 0);
3908 data.writeInt(animate ? 1 : 0);
Wale Ogunwalee75a9ad2016-03-18 20:43:49 -07003909 data.writeInt(animationDuration);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003910 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003911 reply.readException();
3912 data.recycle();
3913 reply.recycle();
3914 }
Craig Mautner967212c2013-04-13 21:10:58 -07003915 @Override
Jorim Jaggid47e7e12016-03-01 09:57:38 +01003916 public void swapDockedAndFullscreenStack() throws RemoteException
3917 {
3918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 mRemote.transact(SWAP_DOCKED_AND_FULLSCREEN_STACK, data, reply, 0);
3922 reply.readException();
3923 data.recycle();
3924 reply.recycle();
3925 }
3926 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003927 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3928 Rect tempDockedTaskInsetBounds,
3929 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3930 throws RemoteException
3931 {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 if (dockedBounds != null) {
3936 data.writeInt(1);
3937 dockedBounds.writeToParcel(data, 0);
3938 } else {
3939 data.writeInt(0);
3940 }
3941 if (tempDockedTaskBounds != null) {
3942 data.writeInt(1);
3943 tempDockedTaskBounds.writeToParcel(data, 0);
3944 } else {
3945 data.writeInt(0);
3946 }
3947 if (tempDockedTaskInsetBounds != null) {
3948 data.writeInt(1);
3949 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3950 } else {
3951 data.writeInt(0);
3952 }
3953 if (tempOtherTaskBounds != null) {
3954 data.writeInt(1);
3955 tempOtherTaskBounds.writeToParcel(data, 0);
3956 } else {
3957 data.writeInt(0);
3958 }
3959 if (tempOtherTaskInsetBounds != null) {
3960 data.writeInt(1);
3961 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3962 } else {
3963 data.writeInt(0);
3964 }
3965 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 data.recycle();
3968 reply.recycle();
3969 }
Robert Carr0d00c2e2016-02-29 17:45:02 -08003970
3971 @Override
3972 public void resizePinnedStack(Rect pinnedBounds, Rect tempPinnedTaskBounds) throws RemoteException
3973 {
3974 Parcel data = Parcel.obtain();
3975 Parcel reply = Parcel.obtain();
3976 data.writeInterfaceToken(IActivityManager.descriptor);
3977 if (pinnedBounds != null) {
3978 data.writeInt(1);
3979 pinnedBounds.writeToParcel(data, 0);
3980 } else {
3981 data.writeInt(0);
3982 }
3983 if (tempPinnedTaskBounds != null) {
3984 data.writeInt(1);
3985 tempPinnedTaskBounds.writeToParcel(data, 0);
3986 } else {
3987 data.writeInt(0);
3988 }
3989 mRemote.transact(RESIZE_PINNED_STACK_TRANSACTION, data, reply, 0);
3990 reply.readException();
3991 data.recycle();
3992 reply.recycle();
3993 }
3994
Jorim Jaggidc249c42015-12-15 14:57:31 -08003995 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003996 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3997 {
3998 Parcel data = Parcel.obtain();
3999 Parcel reply = Parcel.obtain();
4000 data.writeInterfaceToken(IActivityManager.descriptor);
4001 data.writeInt(taskId);
4002 data.writeInt(stackId);
4003 data.writeInt(position);
4004 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
4005 reply.readException();
4006 data.recycle();
4007 reply.recycle();
4008 }
4009 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004010 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07004011 {
4012 Parcel data = Parcel.obtain();
4013 Parcel reply = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004015 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07004016 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004017 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07004018 data.recycle();
4019 reply.recycle();
4020 return list;
4021 }
Craig Mautnercf910b02013-04-23 11:23:27 -07004022 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004023 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004024 {
4025 Parcel data = Parcel.obtain();
4026 Parcel reply = Parcel.obtain();
4027 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004028 data.writeInt(stackId);
4029 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004030 reply.readException();
4031 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004032 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004033 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004034 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004035 }
4036 data.recycle();
4037 reply.recycle();
4038 return info;
4039 }
4040 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08004041 public boolean isInHomeStack(int taskId) throws RemoteException {
4042 Parcel data = Parcel.obtain();
4043 Parcel reply = Parcel.obtain();
4044 data.writeInterfaceToken(IActivityManager.descriptor);
4045 data.writeInt(taskId);
4046 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
4047 reply.readException();
4048 boolean isInHomeStack = reply.readInt() > 0;
4049 data.recycle();
4050 reply.recycle();
4051 return isInHomeStack;
4052 }
4053 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07004054 public void setFocusedStack(int stackId) throws RemoteException
4055 {
4056 Parcel data = Parcel.obtain();
4057 Parcel reply = Parcel.obtain();
4058 data.writeInterfaceToken(IActivityManager.descriptor);
4059 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004060 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07004061 reply.readException();
4062 data.recycle();
4063 reply.recycle();
4064 }
Winson Chung740c3ac2014-11-12 16:14:38 -08004065 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08004066 public int getFocusedStackId() throws RemoteException {
4067 Parcel data = Parcel.obtain();
4068 Parcel reply = Parcel.obtain();
4069 data.writeInterfaceToken(IActivityManager.descriptor);
4070 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
4071 reply.readException();
4072 int focusedStackId = reply.readInt();
4073 data.recycle();
4074 reply.recycle();
4075 return focusedStackId;
4076 }
4077 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07004078 public void setFocusedTask(int taskId) throws RemoteException
4079 {
4080 Parcel data = Parcel.obtain();
4081 Parcel reply = Parcel.obtain();
4082 data.writeInterfaceToken(IActivityManager.descriptor);
4083 data.writeInt(taskId);
4084 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
4085 reply.readException();
4086 data.recycle();
4087 reply.recycle();
4088 }
4089 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08004090 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
4091 {
4092 Parcel data = Parcel.obtain();
4093 Parcel reply = Parcel.obtain();
4094 data.writeInterfaceToken(IActivityManager.descriptor);
4095 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07004096 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08004097 reply.readException();
4098 data.recycle();
4099 reply.recycle();
4100 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004101 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
4102 {
4103 Parcel data = Parcel.obtain();
4104 Parcel reply = Parcel.obtain();
4105 data.writeInterfaceToken(IActivityManager.descriptor);
4106 data.writeStrongBinder(token);
4107 data.writeInt(onlyRoot ? 1 : 0);
4108 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
4109 reply.readException();
4110 int res = reply.readInt();
4111 data.recycle();
4112 reply.recycle();
4113 return res;
4114 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004115 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07004116 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
4120 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4121 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004122 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004123 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004124 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4125 reply.readException();
4126 int res = reply.readInt();
4127 ContentProviderHolder cph = null;
4128 if (res != 0) {
4129 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4130 }
4131 data.recycle();
4132 reply.recycle();
4133 return cph;
4134 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07004135 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
4136 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004137 Parcel data = Parcel.obtain();
4138 Parcel reply = Parcel.obtain();
4139 data.writeInterfaceToken(IActivityManager.descriptor);
4140 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004141 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004142 data.writeStrongBinder(token);
4143 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 int res = reply.readInt();
4146 ContentProviderHolder cph = null;
4147 if (res != 0) {
4148 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4149 }
4150 data.recycle();
4151 reply.recycle();
4152 return cph;
4153 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004154 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004155 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004156 {
4157 Parcel data = Parcel.obtain();
4158 Parcel reply = Parcel.obtain();
4159 data.writeInterfaceToken(IActivityManager.descriptor);
4160 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4161 data.writeTypedList(providers);
4162 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
4163 reply.readException();
4164 data.recycle();
4165 reply.recycle();
4166 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004167 public boolean refContentProvider(IBinder connection, int stable, int unstable)
4168 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004169 Parcel data = Parcel.obtain();
4170 Parcel reply = Parcel.obtain();
4171 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004172 data.writeStrongBinder(connection);
4173 data.writeInt(stable);
4174 data.writeInt(unstable);
4175 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4176 reply.readException();
4177 boolean res = reply.readInt() != 0;
4178 data.recycle();
4179 reply.recycle();
4180 return res;
4181 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004182
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004183 public void unstableProviderDied(IBinder connection) throws RemoteException {
4184 Parcel data = Parcel.obtain();
4185 Parcel reply = Parcel.obtain();
4186 data.writeInterfaceToken(IActivityManager.descriptor);
4187 data.writeStrongBinder(connection);
4188 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
4189 reply.readException();
4190 data.recycle();
4191 reply.recycle();
4192 }
4193
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004194 @Override
4195 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
4196 Parcel data = Parcel.obtain();
4197 Parcel reply = Parcel.obtain();
4198 data.writeInterfaceToken(IActivityManager.descriptor);
4199 data.writeStrongBinder(connection);
4200 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
4201 reply.readException();
4202 data.recycle();
4203 reply.recycle();
4204 }
4205
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004206 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4207 Parcel data = Parcel.obtain();
4208 Parcel reply = Parcel.obtain();
4209 data.writeInterfaceToken(IActivityManager.descriptor);
4210 data.writeStrongBinder(connection);
4211 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004212 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4213 reply.readException();
4214 data.recycle();
4215 reply.recycle();
4216 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004217
4218 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4219 Parcel data = Parcel.obtain();
4220 Parcel reply = Parcel.obtain();
4221 data.writeInterfaceToken(IActivityManager.descriptor);
4222 data.writeString(name);
4223 data.writeStrongBinder(token);
4224 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4225 reply.readException();
4226 data.recycle();
4227 reply.recycle();
4228 }
4229
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004230 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4231 throws RemoteException
4232 {
4233 Parcel data = Parcel.obtain();
4234 Parcel reply = Parcel.obtain();
4235 data.writeInterfaceToken(IActivityManager.descriptor);
4236 service.writeToParcel(data, 0);
4237 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4238 reply.readException();
4239 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4240 data.recycle();
4241 reply.recycle();
4242 return res;
4243 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004245 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004246 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004247 {
4248 Parcel data = Parcel.obtain();
4249 Parcel reply = Parcel.obtain();
4250 data.writeInterfaceToken(IActivityManager.descriptor);
4251 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4252 service.writeToParcel(data, 0);
4253 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004254 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004255 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004256 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4257 reply.readException();
4258 ComponentName res = ComponentName.readFromParcel(reply);
4259 data.recycle();
4260 reply.recycle();
4261 return res;
4262 }
4263 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004264 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004265 {
4266 Parcel data = Parcel.obtain();
4267 Parcel reply = Parcel.obtain();
4268 data.writeInterfaceToken(IActivityManager.descriptor);
4269 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4270 service.writeToParcel(data, 0);
4271 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004272 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004273 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4274 reply.readException();
4275 int res = reply.readInt();
4276 reply.recycle();
4277 data.recycle();
4278 return res;
4279 }
4280 public boolean stopServiceToken(ComponentName className, IBinder token,
4281 int startId) throws RemoteException {
4282 Parcel data = Parcel.obtain();
4283 Parcel reply = Parcel.obtain();
4284 data.writeInterfaceToken(IActivityManager.descriptor);
4285 ComponentName.writeToParcel(className, data);
4286 data.writeStrongBinder(token);
4287 data.writeInt(startId);
4288 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4289 reply.readException();
4290 boolean res = reply.readInt() != 0;
4291 data.recycle();
4292 reply.recycle();
4293 return res;
4294 }
4295 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004296 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004297 Parcel data = Parcel.obtain();
4298 Parcel reply = Parcel.obtain();
4299 data.writeInterfaceToken(IActivityManager.descriptor);
4300 ComponentName.writeToParcel(className, data);
4301 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004302 data.writeInt(id);
4303 if (notification != null) {
4304 data.writeInt(1);
4305 notification.writeToParcel(data, 0);
4306 } else {
4307 data.writeInt(0);
4308 }
4309 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004310 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4311 reply.readException();
4312 data.recycle();
4313 reply.recycle();
4314 }
4315 public int bindService(IApplicationThread caller, IBinder token,
4316 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004317 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004318 Parcel data = Parcel.obtain();
4319 Parcel reply = Parcel.obtain();
4320 data.writeInterfaceToken(IActivityManager.descriptor);
4321 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4322 data.writeStrongBinder(token);
4323 service.writeToParcel(data, 0);
4324 data.writeString(resolvedType);
4325 data.writeStrongBinder(connection.asBinder());
4326 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004327 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004328 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004329 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4330 reply.readException();
4331 int res = reply.readInt();
4332 data.recycle();
4333 reply.recycle();
4334 return res;
4335 }
4336 public boolean unbindService(IServiceConnection connection) throws RemoteException
4337 {
4338 Parcel data = Parcel.obtain();
4339 Parcel reply = Parcel.obtain();
4340 data.writeInterfaceToken(IActivityManager.descriptor);
4341 data.writeStrongBinder(connection.asBinder());
4342 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4343 reply.readException();
4344 boolean res = reply.readInt() != 0;
4345 data.recycle();
4346 reply.recycle();
4347 return res;
4348 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004349
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004350 public void publishService(IBinder token,
4351 Intent intent, IBinder service) throws RemoteException {
4352 Parcel data = Parcel.obtain();
4353 Parcel reply = Parcel.obtain();
4354 data.writeInterfaceToken(IActivityManager.descriptor);
4355 data.writeStrongBinder(token);
4356 intent.writeToParcel(data, 0);
4357 data.writeStrongBinder(service);
4358 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4359 reply.readException();
4360 data.recycle();
4361 reply.recycle();
4362 }
4363
4364 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4365 throws RemoteException {
4366 Parcel data = Parcel.obtain();
4367 Parcel reply = Parcel.obtain();
4368 data.writeInterfaceToken(IActivityManager.descriptor);
4369 data.writeStrongBinder(token);
4370 intent.writeToParcel(data, 0);
4371 data.writeInt(doRebind ? 1 : 0);
4372 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4373 reply.readException();
4374 data.recycle();
4375 reply.recycle();
4376 }
4377
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004378 public void serviceDoneExecuting(IBinder token, int type, int startId,
4379 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004380 Parcel data = Parcel.obtain();
4381 Parcel reply = Parcel.obtain();
4382 data.writeInterfaceToken(IActivityManager.descriptor);
4383 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004384 data.writeInt(type);
4385 data.writeInt(startId);
4386 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004387 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4388 reply.readException();
4389 data.recycle();
4390 reply.recycle();
4391 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004392
Svet Ganov99b60432015-06-27 13:15:22 -07004393 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4394 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004395 Parcel data = Parcel.obtain();
4396 Parcel reply = Parcel.obtain();
4397 data.writeInterfaceToken(IActivityManager.descriptor);
4398 service.writeToParcel(data, 0);
4399 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004400 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004401 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4402 reply.readException();
4403 IBinder binder = reply.readStrongBinder();
4404 reply.recycle();
4405 data.recycle();
4406 return binder;
4407 }
4408
Christopher Tate181fafa2009-05-14 11:12:14 -07004409 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4410 throws RemoteException {
4411 Parcel data = Parcel.obtain();
4412 Parcel reply = Parcel.obtain();
4413 data.writeInterfaceToken(IActivityManager.descriptor);
4414 app.writeToParcel(data, 0);
4415 data.writeInt(backupRestoreMode);
4416 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4417 reply.readException();
4418 boolean success = reply.readInt() != 0;
4419 reply.recycle();
4420 data.recycle();
4421 return success;
4422 }
4423
Christopher Tate346acb12012-10-15 19:20:25 -07004424 public void clearPendingBackup() throws RemoteException {
4425 Parcel data = Parcel.obtain();
4426 Parcel reply = Parcel.obtain();
4427 data.writeInterfaceToken(IActivityManager.descriptor);
4428 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4429 reply.recycle();
4430 data.recycle();
4431 }
4432
Christopher Tate181fafa2009-05-14 11:12:14 -07004433 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 data.writeString(packageName);
4438 data.writeStrongBinder(agent);
4439 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4440 reply.recycle();
4441 data.recycle();
4442 }
4443
4444 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4445 Parcel data = Parcel.obtain();
4446 Parcel reply = Parcel.obtain();
4447 data.writeInterfaceToken(IActivityManager.descriptor);
4448 app.writeToParcel(data, 0);
4449 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4450 reply.readException();
4451 reply.recycle();
4452 data.recycle();
4453 }
4454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004455 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004456 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004457 IUiAutomationConnection connection, int userId, String instructionSet)
4458 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004459 Parcel data = Parcel.obtain();
4460 Parcel reply = Parcel.obtain();
4461 data.writeInterfaceToken(IActivityManager.descriptor);
4462 ComponentName.writeToParcel(className, data);
4463 data.writeString(profileFile);
4464 data.writeInt(flags);
4465 data.writeBundle(arguments);
4466 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004467 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004468 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004469 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004470 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4471 reply.readException();
4472 boolean res = reply.readInt() != 0;
4473 reply.recycle();
4474 data.recycle();
4475 return res;
4476 }
4477
4478 public void finishInstrumentation(IApplicationThread target,
4479 int resultCode, Bundle results) throws RemoteException {
4480 Parcel data = Parcel.obtain();
4481 Parcel reply = Parcel.obtain();
4482 data.writeInterfaceToken(IActivityManager.descriptor);
4483 data.writeStrongBinder(target != null ? target.asBinder() : null);
4484 data.writeInt(resultCode);
4485 data.writeBundle(results);
4486 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4487 reply.readException();
4488 data.recycle();
4489 reply.recycle();
4490 }
4491 public Configuration getConfiguration() throws RemoteException
4492 {
4493 Parcel data = Parcel.obtain();
4494 Parcel reply = Parcel.obtain();
4495 data.writeInterfaceToken(IActivityManager.descriptor);
4496 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4497 reply.readException();
4498 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4499 reply.recycle();
4500 data.recycle();
4501 return res;
4502 }
4503 public void updateConfiguration(Configuration values) throws RemoteException
4504 {
4505 Parcel data = Parcel.obtain();
4506 Parcel reply = Parcel.obtain();
4507 data.writeInterfaceToken(IActivityManager.descriptor);
4508 values.writeToParcel(data, 0);
4509 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4510 reply.readException();
4511 data.recycle();
4512 reply.recycle();
4513 }
4514 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4515 throws RemoteException {
4516 Parcel data = Parcel.obtain();
4517 Parcel reply = Parcel.obtain();
4518 data.writeInterfaceToken(IActivityManager.descriptor);
4519 data.writeStrongBinder(token);
4520 data.writeInt(requestedOrientation);
4521 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4522 reply.readException();
4523 data.recycle();
4524 reply.recycle();
4525 }
4526 public int getRequestedOrientation(IBinder token) throws RemoteException {
4527 Parcel data = Parcel.obtain();
4528 Parcel reply = Parcel.obtain();
4529 data.writeInterfaceToken(IActivityManager.descriptor);
4530 data.writeStrongBinder(token);
4531 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4532 reply.readException();
4533 int res = reply.readInt();
4534 data.recycle();
4535 reply.recycle();
4536 return res;
4537 }
4538 public ComponentName getActivityClassForToken(IBinder token)
4539 throws RemoteException {
4540 Parcel data = Parcel.obtain();
4541 Parcel reply = Parcel.obtain();
4542 data.writeInterfaceToken(IActivityManager.descriptor);
4543 data.writeStrongBinder(token);
4544 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4545 reply.readException();
4546 ComponentName res = ComponentName.readFromParcel(reply);
4547 data.recycle();
4548 reply.recycle();
4549 return res;
4550 }
4551 public String getPackageForToken(IBinder token) throws RemoteException
4552 {
4553 Parcel data = Parcel.obtain();
4554 Parcel reply = Parcel.obtain();
4555 data.writeInterfaceToken(IActivityManager.descriptor);
4556 data.writeStrongBinder(token);
4557 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4558 reply.readException();
4559 String res = reply.readString();
4560 data.recycle();
4561 reply.recycle();
4562 return res;
4563 }
4564 public IIntentSender getIntentSender(int type,
4565 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004566 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004567 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004568 Parcel data = Parcel.obtain();
4569 Parcel reply = Parcel.obtain();
4570 data.writeInterfaceToken(IActivityManager.descriptor);
4571 data.writeInt(type);
4572 data.writeString(packageName);
4573 data.writeStrongBinder(token);
4574 data.writeString(resultWho);
4575 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004576 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004577 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004578 data.writeTypedArray(intents, 0);
4579 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004580 } else {
4581 data.writeInt(0);
4582 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004583 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004584 if (options != null) {
4585 data.writeInt(1);
4586 options.writeToParcel(data, 0);
4587 } else {
4588 data.writeInt(0);
4589 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004590 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004591 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4592 reply.readException();
4593 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004594 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004595 data.recycle();
4596 reply.recycle();
4597 return res;
4598 }
4599 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4600 Parcel data = Parcel.obtain();
4601 Parcel reply = Parcel.obtain();
4602 data.writeInterfaceToken(IActivityManager.descriptor);
4603 data.writeStrongBinder(sender.asBinder());
4604 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4605 reply.readException();
4606 data.recycle();
4607 reply.recycle();
4608 }
4609 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4610 Parcel data = Parcel.obtain();
4611 Parcel reply = Parcel.obtain();
4612 data.writeInterfaceToken(IActivityManager.descriptor);
4613 data.writeStrongBinder(sender.asBinder());
4614 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4615 reply.readException();
4616 String res = reply.readString();
4617 data.recycle();
4618 reply.recycle();
4619 return res;
4620 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004621 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4622 Parcel data = Parcel.obtain();
4623 Parcel reply = Parcel.obtain();
4624 data.writeInterfaceToken(IActivityManager.descriptor);
4625 data.writeStrongBinder(sender.asBinder());
4626 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4627 reply.readException();
4628 int res = reply.readInt();
4629 data.recycle();
4630 reply.recycle();
4631 return res;
4632 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004633 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4634 boolean requireFull, String name, String callerPackage) throws RemoteException {
4635 Parcel data = Parcel.obtain();
4636 Parcel reply = Parcel.obtain();
4637 data.writeInterfaceToken(IActivityManager.descriptor);
4638 data.writeInt(callingPid);
4639 data.writeInt(callingUid);
4640 data.writeInt(userId);
4641 data.writeInt(allowAll ? 1 : 0);
4642 data.writeInt(requireFull ? 1 : 0);
4643 data.writeString(name);
4644 data.writeString(callerPackage);
4645 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4646 reply.readException();
4647 int res = reply.readInt();
4648 data.recycle();
4649 reply.recycle();
4650 return res;
4651 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004652 public void setProcessLimit(int max) throws RemoteException
4653 {
4654 Parcel data = Parcel.obtain();
4655 Parcel reply = Parcel.obtain();
4656 data.writeInterfaceToken(IActivityManager.descriptor);
4657 data.writeInt(max);
4658 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4659 reply.readException();
4660 data.recycle();
4661 reply.recycle();
4662 }
4663 public int getProcessLimit() throws RemoteException
4664 {
4665 Parcel data = Parcel.obtain();
4666 Parcel reply = Parcel.obtain();
4667 data.writeInterfaceToken(IActivityManager.descriptor);
4668 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4669 reply.readException();
4670 int res = reply.readInt();
4671 data.recycle();
4672 reply.recycle();
4673 return res;
4674 }
4675 public void setProcessForeground(IBinder token, int pid,
4676 boolean isForeground) throws RemoteException {
4677 Parcel data = Parcel.obtain();
4678 Parcel reply = Parcel.obtain();
4679 data.writeInterfaceToken(IActivityManager.descriptor);
4680 data.writeStrongBinder(token);
4681 data.writeInt(pid);
4682 data.writeInt(isForeground ? 1 : 0);
4683 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4684 reply.readException();
4685 data.recycle();
4686 reply.recycle();
4687 }
4688 public int checkPermission(String permission, int pid, int uid)
4689 throws RemoteException {
4690 Parcel data = Parcel.obtain();
4691 Parcel reply = Parcel.obtain();
4692 data.writeInterfaceToken(IActivityManager.descriptor);
4693 data.writeString(permission);
4694 data.writeInt(pid);
4695 data.writeInt(uid);
4696 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4697 reply.readException();
4698 int res = reply.readInt();
4699 data.recycle();
4700 reply.recycle();
4701 return res;
4702 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004703 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4704 throws RemoteException {
4705 Parcel data = Parcel.obtain();
4706 Parcel reply = Parcel.obtain();
4707 data.writeInterfaceToken(IActivityManager.descriptor);
4708 data.writeString(permission);
4709 data.writeInt(pid);
4710 data.writeInt(uid);
4711 data.writeStrongBinder(callerToken);
4712 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4713 reply.readException();
4714 int res = reply.readInt();
4715 data.recycle();
4716 reply.recycle();
4717 return res;
4718 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004719 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004720 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004721 Parcel data = Parcel.obtain();
4722 Parcel reply = Parcel.obtain();
4723 data.writeInterfaceToken(IActivityManager.descriptor);
4724 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004725 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004726 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004727 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4728 reply.readException();
4729 boolean res = reply.readInt() != 0;
4730 data.recycle();
4731 reply.recycle();
4732 return res;
4733 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004734 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4735 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004736 Parcel data = Parcel.obtain();
4737 Parcel reply = Parcel.obtain();
4738 data.writeInterfaceToken(IActivityManager.descriptor);
4739 uri.writeToParcel(data, 0);
4740 data.writeInt(pid);
4741 data.writeInt(uid);
4742 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004743 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004744 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004745 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4746 reply.readException();
4747 int res = reply.readInt();
4748 data.recycle();
4749 reply.recycle();
4750 return res;
4751 }
4752 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004753 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004754 Parcel data = Parcel.obtain();
4755 Parcel reply = Parcel.obtain();
4756 data.writeInterfaceToken(IActivityManager.descriptor);
4757 data.writeStrongBinder(caller.asBinder());
4758 data.writeString(targetPkg);
4759 uri.writeToParcel(data, 0);
4760 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004761 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004762 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4763 reply.readException();
4764 data.recycle();
4765 reply.recycle();
4766 }
4767 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004768 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004769 Parcel data = Parcel.obtain();
4770 Parcel reply = Parcel.obtain();
4771 data.writeInterfaceToken(IActivityManager.descriptor);
4772 data.writeStrongBinder(caller.asBinder());
4773 uri.writeToParcel(data, 0);
4774 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004775 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004776 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4777 reply.readException();
4778 data.recycle();
4779 reply.recycle();
4780 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004781
4782 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004783 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4784 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004785 Parcel data = Parcel.obtain();
4786 Parcel reply = Parcel.obtain();
4787 data.writeInterfaceToken(IActivityManager.descriptor);
4788 uri.writeToParcel(data, 0);
4789 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004790 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004791 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4792 reply.readException();
4793 data.recycle();
4794 reply.recycle();
4795 }
4796
4797 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004798 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4799 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004800 Parcel data = Parcel.obtain();
4801 Parcel reply = Parcel.obtain();
4802 data.writeInterfaceToken(IActivityManager.descriptor);
4803 uri.writeToParcel(data, 0);
4804 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004805 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004806 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4807 reply.readException();
4808 data.recycle();
4809 reply.recycle();
4810 }
4811
4812 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004813 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4814 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004815 Parcel data = Parcel.obtain();
4816 Parcel reply = Parcel.obtain();
4817 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004818 data.writeString(packageName);
4819 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004820 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4821 reply.readException();
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004822 @SuppressWarnings("unchecked")
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004823 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4824 reply);
4825 data.recycle();
4826 reply.recycle();
4827 return perms;
4828 }
4829
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004830 @Override
4831 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId)
4832 throws RemoteException {
4833 Parcel data = Parcel.obtain();
4834 Parcel reply = Parcel.obtain();
4835 data.writeInterfaceToken(IActivityManager.descriptor);
4836 data.writeString(packageName);
4837 data.writeInt(userId);
4838 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4839 reply.readException();
4840 @SuppressWarnings("unchecked")
4841 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4842 reply);
4843 data.recycle();
4844 reply.recycle();
4845 return perms;
4846 }
4847
4848 @Override
4849 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException {
4850 Parcel data = Parcel.obtain();
4851 Parcel reply = Parcel.obtain();
4852 data.writeInterfaceToken(IActivityManager.descriptor);
4853 data.writeString(packageName);
4854 data.writeInt(userId);
4855 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4856 reply.readException();
4857 data.recycle();
4858 reply.recycle();
4859 }
4860
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004861 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4862 throws RemoteException {
4863 Parcel data = Parcel.obtain();
4864 Parcel reply = Parcel.obtain();
4865 data.writeInterfaceToken(IActivityManager.descriptor);
4866 data.writeStrongBinder(who.asBinder());
4867 data.writeInt(waiting ? 1 : 0);
4868 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4869 reply.readException();
4870 data.recycle();
4871 reply.recycle();
4872 }
4873 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4874 Parcel data = Parcel.obtain();
4875 Parcel reply = Parcel.obtain();
4876 data.writeInterfaceToken(IActivityManager.descriptor);
4877 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4878 reply.readException();
4879 outInfo.readFromParcel(reply);
4880 data.recycle();
4881 reply.recycle();
4882 }
4883 public void unhandledBack() throws RemoteException
4884 {
4885 Parcel data = Parcel.obtain();
4886 Parcel reply = Parcel.obtain();
4887 data.writeInterfaceToken(IActivityManager.descriptor);
4888 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4889 reply.readException();
4890 data.recycle();
4891 reply.recycle();
4892 }
4893 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4894 {
4895 Parcel data = Parcel.obtain();
4896 Parcel reply = Parcel.obtain();
4897 data.writeInterfaceToken(IActivityManager.descriptor);
4898 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4899 reply.readException();
4900 ParcelFileDescriptor pfd = null;
4901 if (reply.readInt() != 0) {
4902 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4903 }
4904 data.recycle();
4905 reply.recycle();
4906 return pfd;
4907 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004908 public void setLockScreenShown(boolean shown) throws RemoteException
4909 {
4910 Parcel data = Parcel.obtain();
4911 Parcel reply = Parcel.obtain();
4912 data.writeInterfaceToken(IActivityManager.descriptor);
4913 data.writeInt(shown ? 1 : 0);
4914 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4915 reply.readException();
4916 data.recycle();
4917 reply.recycle();
4918 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004919 public void setDebugApp(
4920 String packageName, boolean waitForDebugger, boolean persistent)
4921 throws RemoteException
4922 {
4923 Parcel data = Parcel.obtain();
4924 Parcel reply = Parcel.obtain();
4925 data.writeInterfaceToken(IActivityManager.descriptor);
4926 data.writeString(packageName);
4927 data.writeInt(waitForDebugger ? 1 : 0);
4928 data.writeInt(persistent ? 1 : 0);
4929 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4930 reply.readException();
4931 data.recycle();
4932 reply.recycle();
4933 }
4934 public void setAlwaysFinish(boolean enabled) throws RemoteException
4935 {
4936 Parcel data = Parcel.obtain();
4937 Parcel reply = Parcel.obtain();
4938 data.writeInterfaceToken(IActivityManager.descriptor);
4939 data.writeInt(enabled ? 1 : 0);
4940 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4941 reply.readException();
4942 data.recycle();
4943 reply.recycle();
4944 }
Dianne Hackborn4a18c262016-02-26 17:23:48 -08004945 public void setActivityController(IActivityController watcher, boolean imAMonkey)
4946 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004947 {
4948 Parcel data = Parcel.obtain();
4949 Parcel reply = Parcel.obtain();
4950 data.writeInterfaceToken(IActivityManager.descriptor);
4951 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn4a18c262016-02-26 17:23:48 -08004952 data.writeInt(imAMonkey ? 1 : 0);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004953 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004954 reply.readException();
4955 data.recycle();
4956 reply.recycle();
4957 }
Dianne Hackbornb2117d12016-02-16 18:26:35 -08004958 public void setLenientBackgroundCheck(boolean enabled) throws RemoteException
4959 {
4960 Parcel data = Parcel.obtain();
4961 Parcel reply = Parcel.obtain();
4962 data.writeInterfaceToken(IActivityManager.descriptor);
4963 data.writeInt(enabled ? 1 : 0);
4964 mRemote.transact(SET_LENIENT_BACKGROUND_CHECK_TRANSACTION, data, reply, 0);
4965 reply.readException();
4966 data.recycle();
4967 reply.recycle();
4968 }
Dianne Hackborn970510b2016-02-24 16:56:42 -08004969 public int getMemoryTrimLevel() throws RemoteException
4970 {
4971 Parcel data = Parcel.obtain();
4972 Parcel reply = Parcel.obtain();
4973 data.writeInterfaceToken(IActivityManager.descriptor);
4974 mRemote.transact(GET_MEMORY_TRIM_LEVEL_TRANSACTION, data, reply, 0);
4975 reply.readException();
4976 int level = reply.readInt();
4977 data.recycle();
4978 reply.recycle();
4979 return level;
4980 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004981 public void enterSafeMode() throws RemoteException {
4982 Parcel data = Parcel.obtain();
4983 data.writeInterfaceToken(IActivityManager.descriptor);
4984 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4985 data.recycle();
4986 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004987 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004988 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004989 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004990 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004991 data.writeStrongBinder(sender.asBinder());
4992 data.writeInt(sourceUid);
4993 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004994 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004995 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4996 data.recycle();
4997 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004998 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4999 throws RemoteException {
5000 Parcel data = Parcel.obtain();
5001 data.writeInterfaceToken(IActivityManager.descriptor);
5002 data.writeStrongBinder(sender.asBinder());
5003 data.writeInt(sourceUid);
5004 data.writeString(tag);
5005 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
5006 data.recycle();
5007 }
5008 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
5009 throws RemoteException {
5010 Parcel data = Parcel.obtain();
5011 data.writeInterfaceToken(IActivityManager.descriptor);
5012 data.writeStrongBinder(sender.asBinder());
5013 data.writeInt(sourceUid);
5014 data.writeString(tag);
5015 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
5016 data.recycle();
5017 }
Dianne Hackborn64825172011-03-02 21:32:58 -08005018 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005019 Parcel data = Parcel.obtain();
5020 Parcel reply = Parcel.obtain();
5021 data.writeInterfaceToken(IActivityManager.descriptor);
5022 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07005023 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08005024 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07005025 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005026 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005027 boolean res = reply.readInt() != 0;
5028 data.recycle();
5029 reply.recycle();
5030 return res;
5031 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07005032 @Override
5033 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
5034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
5037 data.writeString(reason);
5038 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
5039 boolean res = reply.readInt() != 0;
5040 data.recycle();
5041 reply.recycle();
5042 return res;
5043 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005044 public boolean testIsSystemReady()
5045 {
5046 /* this base class version is never called */
5047 return true;
5048 }
Dan Egnor60d87622009-12-16 16:32:58 -08005049 public void handleApplicationCrash(IBinder app,
5050 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
5051 {
5052 Parcel data = Parcel.obtain();
5053 Parcel reply = Parcel.obtain();
5054 data.writeInterfaceToken(IActivityManager.descriptor);
5055 data.writeStrongBinder(app);
5056 crashInfo.writeToParcel(data, 0);
5057 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
5058 reply.readException();
5059 reply.recycle();
5060 data.recycle();
5061 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005062
Dianne Hackborn52322712014-08-26 22:47:26 -07005063 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08005064 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005065 {
5066 Parcel data = Parcel.obtain();
5067 Parcel reply = Parcel.obtain();
5068 data.writeInterfaceToken(IActivityManager.descriptor);
5069 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005070 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07005071 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08005072 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08005073 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005074 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08005075 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005076 reply.recycle();
5077 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08005078 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005079 }
Dan Egnorb7f03672009-12-09 16:22:32 -08005080
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005081 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07005082 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07005083 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005084 {
5085 Parcel data = Parcel.obtain();
5086 Parcel reply = Parcel.obtain();
5087 data.writeInterfaceToken(IActivityManager.descriptor);
5088 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07005089 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07005090 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005091 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
5092 reply.readException();
5093 reply.recycle();
5094 data.recycle();
5095 }
5096
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005097 public void signalPersistentProcesses(int sig) throws RemoteException {
5098 Parcel data = Parcel.obtain();
5099 Parcel reply = Parcel.obtain();
5100 data.writeInterfaceToken(IActivityManager.descriptor);
5101 data.writeInt(sig);
5102 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
5103 reply.readException();
5104 data.recycle();
5105 reply.recycle();
5106 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005107
Dianne Hackborn1676c852012-09-10 14:52:30 -07005108 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005109 Parcel data = Parcel.obtain();
5110 Parcel reply = Parcel.obtain();
5111 data.writeInterfaceToken(IActivityManager.descriptor);
5112 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005113 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005114 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5115 reply.readException();
5116 data.recycle();
5117 reply.recycle();
5118 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005119
5120 public void killAllBackgroundProcesses() throws RemoteException {
5121 Parcel data = Parcel.obtain();
5122 Parcel reply = Parcel.obtain();
5123 data.writeInterfaceToken(IActivityManager.descriptor);
5124 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5125 reply.readException();
5126 data.recycle();
5127 reply.recycle();
5128 }
5129
Gustav Sennton6258dcd2015-10-30 19:25:37 +00005130 public void killPackageDependents(String packageName, int userId) throws RemoteException {
5131 Parcel data = Parcel.obtain();
5132 Parcel reply = Parcel.obtain();
5133 data.writeInterfaceToken(IActivityManager.descriptor);
5134 data.writeString(packageName);
5135 data.writeInt(userId);
5136 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
5137 reply.readException();
5138 data.recycle();
5139 reply.recycle();
5140 }
5141
Dianne Hackborn1676c852012-09-10 14:52:30 -07005142 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08005143 Parcel data = Parcel.obtain();
5144 Parcel reply = Parcel.obtain();
5145 data.writeInterfaceToken(IActivityManager.descriptor);
5146 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005147 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005148 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005149 reply.readException();
5150 data.recycle();
5151 reply.recycle();
5152 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005153
Dianne Hackborn27ff9132012-03-06 14:57:58 -08005154 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
5155 throws RemoteException
5156 {
5157 Parcel data = Parcel.obtain();
5158 Parcel reply = Parcel.obtain();
5159 data.writeInterfaceToken(IActivityManager.descriptor);
5160 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
5161 reply.readException();
5162 outInfo.readFromParcel(reply);
5163 reply.recycle();
5164 data.recycle();
5165 }
5166
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005167 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
5168 {
5169 Parcel data = Parcel.obtain();
5170 Parcel reply = Parcel.obtain();
5171 data.writeInterfaceToken(IActivityManager.descriptor);
5172 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
5173 reply.readException();
5174 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
5175 reply.recycle();
5176 data.recycle();
5177 return res;
5178 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005179
Dianne Hackborn1676c852012-09-10 14:52:30 -07005180 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07005181 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005182 {
5183 Parcel data = Parcel.obtain();
5184 Parcel reply = Parcel.obtain();
5185 data.writeInterfaceToken(IActivityManager.descriptor);
5186 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005187 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005188 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07005189 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07005190 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005191 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07005192 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005193 } else {
5194 data.writeInt(0);
5195 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005196 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
5197 reply.readException();
5198 boolean res = reply.readInt() != 0;
5199 reply.recycle();
5200 data.recycle();
5201 return res;
5202 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005203
Dianne Hackborn55280a92009-05-07 15:53:46 -07005204 public boolean shutdown(int timeout) throws RemoteException
5205 {
5206 Parcel data = Parcel.obtain();
5207 Parcel reply = Parcel.obtain();
5208 data.writeInterfaceToken(IActivityManager.descriptor);
5209 data.writeInt(timeout);
5210 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
5211 reply.readException();
5212 boolean res = reply.readInt() != 0;
5213 reply.recycle();
5214 data.recycle();
5215 return res;
5216 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005217
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005218 public void stopAppSwitches() throws RemoteException {
5219 Parcel data = Parcel.obtain();
5220 Parcel reply = Parcel.obtain();
5221 data.writeInterfaceToken(IActivityManager.descriptor);
5222 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
5223 reply.readException();
5224 reply.recycle();
5225 data.recycle();
5226 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005227
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005228 public void resumeAppSwitches() throws RemoteException {
5229 Parcel data = Parcel.obtain();
5230 Parcel reply = Parcel.obtain();
5231 data.writeInterfaceToken(IActivityManager.descriptor);
5232 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
5233 reply.readException();
5234 reply.recycle();
5235 data.recycle();
5236 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07005237
5238 public void addPackageDependency(String packageName) throws RemoteException {
5239 Parcel data = Parcel.obtain();
5240 Parcel reply = Parcel.obtain();
5241 data.writeInterfaceToken(IActivityManager.descriptor);
5242 data.writeString(packageName);
5243 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
5244 reply.readException();
5245 data.recycle();
5246 reply.recycle();
5247 }
5248
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005249 public void killApplicationWithAppId(String pkg, int appid, String reason)
5250 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005251 Parcel data = Parcel.obtain();
5252 Parcel reply = Parcel.obtain();
5253 data.writeInterfaceToken(IActivityManager.descriptor);
5254 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005255 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005256 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005257 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005258 reply.readException();
5259 data.recycle();
5260 reply.recycle();
5261 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005262
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07005263 public void closeSystemDialogs(String reason) throws RemoteException {
5264 Parcel data = Parcel.obtain();
5265 Parcel reply = Parcel.obtain();
5266 data.writeInterfaceToken(IActivityManager.descriptor);
5267 data.writeString(reason);
5268 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5269 reply.readException();
5270 data.recycle();
5271 reply.recycle();
5272 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005273
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005274 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005275 throws RemoteException {
5276 Parcel data = Parcel.obtain();
5277 Parcel reply = Parcel.obtain();
5278 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005279 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005280 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5281 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005282 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005283 data.recycle();
5284 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005285 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005286 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005287
5288 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5289 Parcel data = Parcel.obtain();
5290 Parcel reply = Parcel.obtain();
5291 data.writeInterfaceToken(IActivityManager.descriptor);
5292 data.writeString(processName);
5293 data.writeInt(uid);
5294 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5295 reply.readException();
5296 data.recycle();
5297 reply.recycle();
5298 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005299
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005300 public void overridePendingTransition(IBinder token, String packageName,
5301 int enterAnim, int exitAnim) throws RemoteException {
5302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 data.writeStrongBinder(token);
5306 data.writeString(packageName);
5307 data.writeInt(enterAnim);
5308 data.writeInt(exitAnim);
5309 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5310 reply.readException();
5311 data.recycle();
5312 reply.recycle();
5313 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005314
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005315 public boolean isUserAMonkey() throws RemoteException {
5316 Parcel data = Parcel.obtain();
5317 Parcel reply = Parcel.obtain();
5318 data.writeInterfaceToken(IActivityManager.descriptor);
5319 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5320 reply.readException();
5321 boolean res = reply.readInt() != 0;
5322 data.recycle();
5323 reply.recycle();
5324 return res;
5325 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005326
5327 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5328 Parcel data = Parcel.obtain();
5329 Parcel reply = Parcel.obtain();
5330 data.writeInterfaceToken(IActivityManager.descriptor);
5331 data.writeInt(monkey ? 1 : 0);
5332 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5333 reply.readException();
5334 data.recycle();
5335 reply.recycle();
5336 }
5337
Dianne Hackborn860755f2010-06-03 18:47:52 -07005338 public void finishHeavyWeightApp() throws RemoteException {
5339 Parcel data = Parcel.obtain();
5340 Parcel reply = Parcel.obtain();
5341 data.writeInterfaceToken(IActivityManager.descriptor);
5342 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5343 reply.readException();
5344 data.recycle();
5345 reply.recycle();
5346 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005347
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005348 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005349 throws RemoteException {
5350 Parcel data = Parcel.obtain();
5351 Parcel reply = Parcel.obtain();
5352 data.writeInterfaceToken(IActivityManager.descriptor);
5353 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005354 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5355 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005356 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005357 data.recycle();
5358 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005359 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005360 }
5361
Craig Mautner233ceee2014-05-09 17:05:11 -07005362 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005363 throws RemoteException {
5364 Parcel data = Parcel.obtain();
5365 Parcel reply = Parcel.obtain();
5366 data.writeInterfaceToken(IActivityManager.descriptor);
5367 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005368 if (options == null) {
5369 data.writeInt(0);
5370 } else {
5371 data.writeInt(1);
5372 data.writeBundle(options.toBundle());
5373 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005374 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005375 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005376 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005377 data.recycle();
5378 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005379 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005380 }
5381
Craig Mautner233ceee2014-05-09 17:05:11 -07005382 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5383 Parcel data = Parcel.obtain();
5384 Parcel reply = Parcel.obtain();
5385 data.writeInterfaceToken(IActivityManager.descriptor);
5386 data.writeStrongBinder(token);
5387 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5388 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005389 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005390 data.recycle();
5391 reply.recycle();
5392 return options;
5393 }
5394
Daniel Sandler69a48172010-06-23 16:29:36 -04005395 public void setImmersive(IBinder token, boolean immersive)
5396 throws RemoteException {
5397 Parcel data = Parcel.obtain();
5398 Parcel reply = Parcel.obtain();
5399 data.writeInterfaceToken(IActivityManager.descriptor);
5400 data.writeStrongBinder(token);
5401 data.writeInt(immersive ? 1 : 0);
5402 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5403 reply.readException();
5404 data.recycle();
5405 reply.recycle();
5406 }
5407
5408 public boolean isImmersive(IBinder token)
5409 throws RemoteException {
5410 Parcel data = Parcel.obtain();
5411 Parcel reply = Parcel.obtain();
5412 data.writeInterfaceToken(IActivityManager.descriptor);
5413 data.writeStrongBinder(token);
5414 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005415 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005416 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005417 data.recycle();
5418 reply.recycle();
5419 return res;
5420 }
5421
Craig Mautnerd61dc202014-07-07 11:09:11 -07005422 public boolean isTopOfTask(IBinder token) throws RemoteException {
5423 Parcel data = Parcel.obtain();
5424 Parcel reply = Parcel.obtain();
5425 data.writeInterfaceToken(IActivityManager.descriptor);
5426 data.writeStrongBinder(token);
5427 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5428 reply.readException();
5429 boolean res = reply.readInt() == 1;
5430 data.recycle();
5431 reply.recycle();
5432 return res;
5433 }
5434
Daniel Sandler69a48172010-06-23 16:29:36 -04005435 public boolean isTopActivityImmersive()
5436 throws RemoteException {
5437 Parcel data = Parcel.obtain();
5438 Parcel reply = Parcel.obtain();
5439 data.writeInterfaceToken(IActivityManager.descriptor);
5440 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005441 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005442 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005443 data.recycle();
5444 reply.recycle();
5445 return res;
5446 }
5447
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005448 public void crashApplication(int uid, int initialPid, String packageName,
5449 String message) throws RemoteException {
5450 Parcel data = Parcel.obtain();
5451 Parcel reply = Parcel.obtain();
5452 data.writeInterfaceToken(IActivityManager.descriptor);
5453 data.writeInt(uid);
5454 data.writeInt(initialPid);
5455 data.writeString(packageName);
5456 data.writeString(message);
5457 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5458 reply.readException();
5459 data.recycle();
5460 reply.recycle();
5461 }
Andy McFadden824c5102010-07-09 16:26:57 -07005462
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005463 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005464 Parcel data = Parcel.obtain();
5465 Parcel reply = Parcel.obtain();
5466 data.writeInterfaceToken(IActivityManager.descriptor);
5467 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005468 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005469 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5470 reply.readException();
5471 String res = reply.readString();
5472 data.recycle();
5473 reply.recycle();
5474 return res;
5475 }
5476
Dianne Hackborn7e269642010-08-25 19:50:20 -07005477 public IBinder newUriPermissionOwner(String name)
5478 throws RemoteException {
5479 Parcel data = Parcel.obtain();
5480 Parcel reply = Parcel.obtain();
5481 data.writeInterfaceToken(IActivityManager.descriptor);
5482 data.writeString(name);
5483 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5484 reply.readException();
5485 IBinder res = reply.readStrongBinder();
5486 data.recycle();
5487 reply.recycle();
5488 return res;
5489 }
5490
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005491 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5492 Parcel data = Parcel.obtain();
5493 Parcel reply = Parcel.obtain();
5494 data.writeInterfaceToken(IActivityManager.descriptor);
5495 data.writeStrongBinder(activityToken);
5496 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5497 reply.readException();
5498 IBinder res = reply.readStrongBinder();
5499 data.recycle();
5500 reply.recycle();
5501 return res;
5502 }
5503
Dianne Hackborn7e269642010-08-25 19:50:20 -07005504 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005505 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005506 Parcel data = Parcel.obtain();
5507 Parcel reply = Parcel.obtain();
5508 data.writeInterfaceToken(IActivityManager.descriptor);
5509 data.writeStrongBinder(owner);
5510 data.writeInt(fromUid);
5511 data.writeString(targetPkg);
5512 uri.writeToParcel(data, 0);
5513 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005514 data.writeInt(sourceUserId);
5515 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005516 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5517 reply.readException();
5518 data.recycle();
5519 reply.recycle();
5520 }
5521
5522 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005523 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005524 Parcel data = Parcel.obtain();
5525 Parcel reply = Parcel.obtain();
5526 data.writeInterfaceToken(IActivityManager.descriptor);
5527 data.writeStrongBinder(owner);
5528 if (uri != null) {
5529 data.writeInt(1);
5530 uri.writeToParcel(data, 0);
5531 } else {
5532 data.writeInt(0);
5533 }
5534 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005535 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005536 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5537 reply.readException();
5538 data.recycle();
5539 reply.recycle();
5540 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005541
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005542 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005543 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005544 Parcel data = Parcel.obtain();
5545 Parcel reply = Parcel.obtain();
5546 data.writeInterfaceToken(IActivityManager.descriptor);
5547 data.writeInt(callingUid);
5548 data.writeString(targetPkg);
5549 uri.writeToParcel(data, 0);
5550 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005551 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005552 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5553 reply.readException();
5554 int res = reply.readInt();
5555 data.recycle();
5556 reply.recycle();
5557 return res;
5558 }
5559
Dianne Hackborn1676c852012-09-10 14:52:30 -07005560 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005561 String path, ParcelFileDescriptor fd) throws RemoteException {
5562 Parcel data = Parcel.obtain();
5563 Parcel reply = Parcel.obtain();
5564 data.writeInterfaceToken(IActivityManager.descriptor);
5565 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005566 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005567 data.writeInt(managed ? 1 : 0);
5568 data.writeString(path);
5569 if (fd != null) {
5570 data.writeInt(1);
5571 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5572 } else {
5573 data.writeInt(0);
5574 }
5575 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5576 reply.readException();
5577 boolean res = reply.readInt() != 0;
5578 reply.recycle();
5579 data.recycle();
5580 return res;
5581 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005582
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005583 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005584 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005585 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005586 Parcel data = Parcel.obtain();
5587 Parcel reply = Parcel.obtain();
5588 data.writeInterfaceToken(IActivityManager.descriptor);
5589 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005590 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005591 data.writeTypedArray(intents, 0);
5592 data.writeStringArray(resolvedTypes);
5593 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005594 if (options != null) {
5595 data.writeInt(1);
5596 options.writeToParcel(data, 0);
5597 } else {
5598 data.writeInt(0);
5599 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005600 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005601 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5602 reply.readException();
5603 int result = reply.readInt();
5604 reply.recycle();
5605 data.recycle();
5606 return result;
5607 }
5608
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005609 public int getFrontActivityScreenCompatMode() throws RemoteException {
5610 Parcel data = Parcel.obtain();
5611 Parcel reply = Parcel.obtain();
5612 data.writeInterfaceToken(IActivityManager.descriptor);
5613 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5614 reply.readException();
5615 int mode = reply.readInt();
5616 reply.recycle();
5617 data.recycle();
5618 return mode;
5619 }
5620
5621 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5622 Parcel data = Parcel.obtain();
5623 Parcel reply = Parcel.obtain();
5624 data.writeInterfaceToken(IActivityManager.descriptor);
5625 data.writeInt(mode);
5626 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5627 reply.readException();
5628 reply.recycle();
5629 data.recycle();
5630 }
5631
5632 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5633 Parcel data = Parcel.obtain();
5634 Parcel reply = Parcel.obtain();
5635 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005636 data.writeString(packageName);
5637 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005638 reply.readException();
5639 int mode = reply.readInt();
5640 reply.recycle();
5641 data.recycle();
5642 return mode;
5643 }
5644
5645 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005646 throws RemoteException {
5647 Parcel data = Parcel.obtain();
5648 Parcel reply = Parcel.obtain();
5649 data.writeInterfaceToken(IActivityManager.descriptor);
5650 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005651 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005652 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5653 reply.readException();
5654 reply.recycle();
5655 data.recycle();
5656 }
5657
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005658 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5659 Parcel data = Parcel.obtain();
5660 Parcel reply = Parcel.obtain();
5661 data.writeInterfaceToken(IActivityManager.descriptor);
5662 data.writeString(packageName);
5663 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5664 reply.readException();
5665 boolean ask = reply.readInt() != 0;
5666 reply.recycle();
5667 data.recycle();
5668 return ask;
5669 }
5670
5671 public void setPackageAskScreenCompat(String packageName, boolean ask)
5672 throws RemoteException {
5673 Parcel data = Parcel.obtain();
5674 Parcel reply = Parcel.obtain();
5675 data.writeInterfaceToken(IActivityManager.descriptor);
5676 data.writeString(packageName);
5677 data.writeInt(ask ? 1 : 0);
5678 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5679 reply.readException();
5680 reply.recycle();
5681 data.recycle();
5682 }
5683
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005684 public boolean switchUser(int userid) throws RemoteException {
5685 Parcel data = Parcel.obtain();
5686 Parcel reply = Parcel.obtain();
5687 data.writeInterfaceToken(IActivityManager.descriptor);
5688 data.writeInt(userid);
5689 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5690 reply.readException();
5691 boolean result = reply.readInt() != 0;
5692 reply.recycle();
5693 data.recycle();
5694 return result;
5695 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005696
Kenny Guy08488bf2014-02-21 17:40:37 +00005697 public boolean startUserInBackground(int userid) throws RemoteException {
5698 Parcel data = Parcel.obtain();
5699 Parcel reply = Parcel.obtain();
5700 data.writeInterfaceToken(IActivityManager.descriptor);
5701 data.writeInt(userid);
5702 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5703 reply.readException();
5704 boolean result = reply.readInt() != 0;
5705 reply.recycle();
5706 data.recycle();
5707 return result;
5708 }
5709
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005710 public boolean unlockUser(int userId, byte[] token, byte[] secret) throws RemoteException {
Jeff Sharkeyba512352015-11-12 20:17:45 -08005711 Parcel data = Parcel.obtain();
5712 Parcel reply = Parcel.obtain();
5713 data.writeInterfaceToken(IActivityManager.descriptor);
5714 data.writeInt(userId);
5715 data.writeByteArray(token);
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005716 data.writeByteArray(secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08005717 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5718 reply.readException();
5719 boolean result = reply.readInt() != 0;
5720 reply.recycle();
5721 data.recycle();
5722 return result;
5723 }
5724
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005725 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5726 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005727 Parcel data = Parcel.obtain();
5728 Parcel reply = Parcel.obtain();
5729 data.writeInterfaceToken(IActivityManager.descriptor);
5730 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005731 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005732 data.writeStrongInterface(callback);
5733 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5734 reply.readException();
5735 int result = reply.readInt();
5736 reply.recycle();
5737 data.recycle();
5738 return result;
5739 }
5740
Amith Yamasani52f1d752012-03-28 18:19:29 -07005741 public UserInfo getCurrentUser() throws RemoteException {
5742 Parcel data = Parcel.obtain();
5743 Parcel reply = Parcel.obtain();
5744 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005745 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005746 reply.readException();
5747 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5748 reply.recycle();
5749 data.recycle();
5750 return userInfo;
5751 }
5752
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005753 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005754 Parcel data = Parcel.obtain();
5755 Parcel reply = Parcel.obtain();
5756 data.writeInterfaceToken(IActivityManager.descriptor);
5757 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005758 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005759 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5760 reply.readException();
5761 boolean result = reply.readInt() != 0;
5762 reply.recycle();
5763 data.recycle();
5764 return result;
5765 }
5766
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005767 public int[] getRunningUserIds() throws RemoteException {
5768 Parcel data = Parcel.obtain();
5769 Parcel reply = Parcel.obtain();
5770 data.writeInterfaceToken(IActivityManager.descriptor);
5771 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5772 reply.readException();
5773 int[] result = reply.createIntArray();
5774 reply.recycle();
5775 data.recycle();
5776 return result;
5777 }
5778
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005779 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005780 Parcel data = Parcel.obtain();
5781 Parcel reply = Parcel.obtain();
5782 data.writeInterfaceToken(IActivityManager.descriptor);
5783 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005784 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5785 reply.readException();
5786 boolean result = reply.readInt() != 0;
5787 reply.recycle();
5788 data.recycle();
5789 return result;
5790 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005791
Jeff Sharkeya4620792011-05-20 15:29:23 -07005792 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5793 Parcel data = Parcel.obtain();
5794 Parcel reply = Parcel.obtain();
5795 data.writeInterfaceToken(IActivityManager.descriptor);
5796 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5797 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5798 reply.readException();
5799 data.recycle();
5800 reply.recycle();
5801 }
5802
5803 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5804 Parcel data = Parcel.obtain();
5805 Parcel reply = Parcel.obtain();
5806 data.writeInterfaceToken(IActivityManager.descriptor);
5807 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5808 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5809 reply.readException();
5810 data.recycle();
5811 reply.recycle();
5812 }
5813
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005814 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005815 Parcel data = Parcel.obtain();
5816 Parcel reply = Parcel.obtain();
5817 data.writeInterfaceToken(IActivityManager.descriptor);
5818 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005819 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005820 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5821 reply.readException();
5822 data.recycle();
5823 reply.recycle();
5824 }
5825
5826 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5827 Parcel data = Parcel.obtain();
5828 Parcel reply = Parcel.obtain();
5829 data.writeInterfaceToken(IActivityManager.descriptor);
5830 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5831 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5832 reply.readException();
5833 data.recycle();
5834 reply.recycle();
5835 }
5836
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005837 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5838 Parcel data = Parcel.obtain();
5839 Parcel reply = Parcel.obtain();
5840 data.writeInterfaceToken(IActivityManager.descriptor);
5841 data.writeStrongBinder(sender.asBinder());
5842 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5843 reply.readException();
5844 boolean res = reply.readInt() != 0;
5845 data.recycle();
5846 reply.recycle();
5847 return res;
5848 }
5849
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005850 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5851 Parcel data = Parcel.obtain();
5852 Parcel reply = Parcel.obtain();
5853 data.writeInterfaceToken(IActivityManager.descriptor);
5854 data.writeStrongBinder(sender.asBinder());
5855 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5856 reply.readException();
5857 boolean res = reply.readInt() != 0;
5858 data.recycle();
5859 reply.recycle();
5860 return res;
5861 }
5862
Dianne Hackborn81038902012-11-26 17:04:09 -08005863 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5864 Parcel data = Parcel.obtain();
5865 Parcel reply = Parcel.obtain();
5866 data.writeInterfaceToken(IActivityManager.descriptor);
5867 data.writeStrongBinder(sender.asBinder());
5868 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5869 reply.readException();
5870 Intent res = reply.readInt() != 0
5871 ? Intent.CREATOR.createFromParcel(reply) : null;
5872 data.recycle();
5873 reply.recycle();
5874 return res;
5875 }
5876
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005877 public String getTagForIntentSender(IIntentSender sender, String prefix)
5878 throws RemoteException {
5879 Parcel data = Parcel.obtain();
5880 Parcel reply = Parcel.obtain();
5881 data.writeInterfaceToken(IActivityManager.descriptor);
5882 data.writeStrongBinder(sender.asBinder());
5883 data.writeString(prefix);
5884 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5885 reply.readException();
5886 String res = reply.readString();
5887 data.recycle();
5888 reply.recycle();
5889 return res;
5890 }
5891
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005892 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5893 {
5894 Parcel data = Parcel.obtain();
5895 Parcel reply = Parcel.obtain();
5896 data.writeInterfaceToken(IActivityManager.descriptor);
5897 values.writeToParcel(data, 0);
5898 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5899 reply.readException();
5900 data.recycle();
5901 reply.recycle();
5902 }
5903
Dianne Hackbornb437e092011-08-05 17:50:29 -07005904 public long[] getProcessPss(int[] pids) throws RemoteException {
5905 Parcel data = Parcel.obtain();
5906 Parcel reply = Parcel.obtain();
5907 data.writeInterfaceToken(IActivityManager.descriptor);
5908 data.writeIntArray(pids);
5909 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5910 reply.readException();
5911 long[] res = reply.createLongArray();
5912 data.recycle();
5913 reply.recycle();
5914 return res;
5915 }
5916
Dianne Hackborn661cd522011-08-22 00:26:20 -07005917 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5918 Parcel data = Parcel.obtain();
5919 Parcel reply = Parcel.obtain();
5920 data.writeInterfaceToken(IActivityManager.descriptor);
5921 TextUtils.writeToParcel(msg, data, 0);
5922 data.writeInt(always ? 1 : 0);
5923 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5924 reply.readException();
5925 data.recycle();
5926 reply.recycle();
5927 }
5928
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005929 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005930 Parcel data = Parcel.obtain();
5931 Parcel reply = Parcel.obtain();
5932 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005933 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005934 reply.readException();
5935 data.recycle();
5936 reply.recycle();
5937 }
5938
Adrian Roosd5c2db62016-03-08 16:11:31 -08005939 public void keyguardGoingAway(int flags)
5940 throws RemoteException {
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005941 Parcel data = Parcel.obtain();
5942 Parcel reply = Parcel.obtain();
5943 data.writeInterfaceToken(IActivityManager.descriptor);
Adrian Roosd5c2db62016-03-08 16:11:31 -08005944 data.writeInt(flags);
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005945 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5946 reply.readException();
5947 data.recycle();
5948 reply.recycle();
5949 }
5950
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005951 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005952 throws RemoteException {
5953 Parcel data = Parcel.obtain();
5954 Parcel reply = Parcel.obtain();
5955 data.writeInterfaceToken(IActivityManager.descriptor);
5956 data.writeStrongBinder(token);
5957 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005958 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005959 reply.readException();
5960 boolean result = reply.readInt() != 0;
5961 data.recycle();
5962 reply.recycle();
5963 return result;
5964 }
5965
5966 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5967 throws RemoteException {
5968 Parcel data = Parcel.obtain();
5969 Parcel reply = Parcel.obtain();
5970 data.writeInterfaceToken(IActivityManager.descriptor);
5971 data.writeStrongBinder(token);
5972 target.writeToParcel(data, 0);
5973 data.writeInt(resultCode);
5974 if (resultData != null) {
5975 data.writeInt(1);
5976 resultData.writeToParcel(data, 0);
5977 } else {
5978 data.writeInt(0);
5979 }
5980 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5981 reply.readException();
5982 boolean result = reply.readInt() != 0;
5983 data.recycle();
5984 reply.recycle();
5985 return result;
5986 }
5987
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005988 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5989 Parcel data = Parcel.obtain();
5990 Parcel reply = Parcel.obtain();
5991 data.writeInterfaceToken(IActivityManager.descriptor);
5992 data.writeStrongBinder(activityToken);
5993 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5994 reply.readException();
5995 int result = reply.readInt();
5996 data.recycle();
5997 reply.recycle();
5998 return result;
5999 }
6000
Dianne Hackbornf265ea92013-01-31 15:00:51 -08006001 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
6002 Parcel data = Parcel.obtain();
6003 Parcel reply = Parcel.obtain();
6004 data.writeInterfaceToken(IActivityManager.descriptor);
6005 data.writeStrongBinder(activityToken);
6006 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
6007 reply.readException();
6008 String result = reply.readString();
6009 data.recycle();
6010 reply.recycle();
6011 return result;
6012 }
6013
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07006014 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
6015 Parcel data = Parcel.obtain();
6016 Parcel reply = Parcel.obtain();
6017 data.writeInterfaceToken(IActivityManager.descriptor);
6018 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
6019 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
6020 reply.readException();
6021 data.recycle();
6022 reply.recycle();
6023 }
6024
6025 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
6026 Parcel data = Parcel.obtain();
6027 Parcel reply = Parcel.obtain();
6028 data.writeInterfaceToken(IActivityManager.descriptor);
6029 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
6030 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
6031 reply.readException();
6032 data.recycle();
6033 reply.recycle();
6034 }
6035
Michal Karpinski3da5c972015-12-11 18:16:30 +00006036 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType)
6037 throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07006038 Parcel data = Parcel.obtain();
6039 Parcel reply = Parcel.obtain();
6040 data.writeInterfaceToken(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00006041 data.writeInt(bugreportType);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07006042 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
6043 reply.readException();
6044 data.recycle();
6045 reply.recycle();
6046 }
6047
Jeff Brownbd181bb2013-09-10 16:44:24 -07006048 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
6049 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07006050 Parcel data = Parcel.obtain();
6051 Parcel reply = Parcel.obtain();
6052 data.writeInterfaceToken(IActivityManager.descriptor);
6053 data.writeInt(pid);
6054 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07006055 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07006056 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
6057 reply.readException();
6058 long res = reply.readInt();
6059 data.recycle();
6060 reply.recycle();
6061 return res;
6062 }
6063
Adam Skorydfc7fd72013-08-05 19:23:41 -07006064 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006065 Parcel data = Parcel.obtain();
6066 Parcel reply = Parcel.obtain();
6067 data.writeInterfaceToken(IActivityManager.descriptor);
6068 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07006069 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006070 reply.readException();
6071 Bundle res = reply.readBundle();
6072 data.recycle();
6073 reply.recycle();
6074 return res;
6075 }
6076
Dianne Hackborn17f69352015-07-17 18:04:14 -07006077 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
6078 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006079 Parcel data = Parcel.obtain();
6080 Parcel reply = Parcel.obtain();
6081 data.writeInterfaceToken(IActivityManager.descriptor);
6082 data.writeInt(requestType);
6083 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07006084 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006085 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
6086 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07006087 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006088 data.recycle();
6089 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07006090 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006091 }
6092
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07006093 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07006094 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006095 Parcel data = Parcel.obtain();
6096 Parcel reply = Parcel.obtain();
6097 data.writeInterfaceToken(IActivityManager.descriptor);
6098 data.writeStrongBinder(token);
6099 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07006100 structure.writeToParcel(data, 0);
6101 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07006102 if (referrer != null) {
6103 data.writeInt(1);
6104 referrer.writeToParcel(data, 0);
6105 } else {
6106 data.writeInt(0);
6107 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07006108 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006109 reply.readException();
6110 data.recycle();
6111 reply.recycle();
6112 }
6113
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006114 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
6115 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006116 Parcel data = Parcel.obtain();
6117 Parcel reply = Parcel.obtain();
6118 data.writeInterfaceToken(IActivityManager.descriptor);
6119 intent.writeToParcel(data, 0);
6120 data.writeInt(requestType);
6121 data.writeString(hint);
6122 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006123 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006124 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
6125 reply.readException();
6126 boolean res = reply.readInt() != 0;
6127 data.recycle();
6128 reply.recycle();
6129 return res;
6130 }
6131
Dianne Hackborn17f69352015-07-17 18:04:14 -07006132 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01006133 Parcel data = Parcel.obtain();
6134 Parcel reply = Parcel.obtain();
6135 data.writeInterfaceToken(IActivityManager.descriptor);
6136 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
6137 reply.readException();
6138 boolean res = reply.readInt() != 0;
6139 data.recycle();
6140 reply.recycle();
6141 return res;
6142 }
6143
Dianne Hackborn17f69352015-07-17 18:04:14 -07006144 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
6145 Parcel data = Parcel.obtain();
6146 Parcel reply = Parcel.obtain();
6147 data.writeInterfaceToken(IActivityManager.descriptor);
6148 data.writeStrongBinder(token);
6149 data.writeBundle(args);
6150 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
6151 reply.readException();
6152 boolean res = reply.readInt() != 0;
6153 data.recycle();
6154 reply.recycle();
6155 return res;
6156 }
6157
Svetoslavaa41add2015-08-06 15:03:55 -07006158 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006159 Parcel data = Parcel.obtain();
6160 Parcel reply = Parcel.obtain();
6161 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07006162 data.writeInt(appId);
6163 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006164 data.writeString(reason);
6165 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
6166 reply.readException();
6167 data.recycle();
6168 reply.recycle();
6169 }
6170
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07006171 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
6172 Parcel data = Parcel.obtain();
6173 Parcel reply = Parcel.obtain();
6174 data.writeInterfaceToken(IActivityManager.descriptor);
6175 data.writeStrongBinder(who);
6176 data.writeInt(allowRestart ? 1 : 0);
6177 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
6178 reply.readException();
6179 data.recycle();
6180 reply.recycle();
6181 }
6182
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07006183 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
6184 Parcel data = Parcel.obtain();
6185 Parcel reply = Parcel.obtain();
6186 data.writeInterfaceToken(IActivityManager.descriptor);
6187 data.writeStrongBinder(token);
6188 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
6189 reply.readException();
6190 data.recycle();
6191 reply.recycle();
6192 }
6193
Craig Mautner5eda9b32013-07-02 11:58:16 -07006194 public void notifyActivityDrawn(IBinder token) throws RemoteException {
6195 Parcel data = Parcel.obtain();
6196 Parcel reply = Parcel.obtain();
6197 data.writeInterfaceToken(IActivityManager.descriptor);
6198 data.writeStrongBinder(token);
6199 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
6200 reply.readException();
6201 data.recycle();
6202 reply.recycle();
6203 }
6204
Dianne Hackborn57a7f592013-07-22 18:21:32 -07006205 public void restart() throws RemoteException {
6206 Parcel data = Parcel.obtain();
6207 Parcel reply = Parcel.obtain();
6208 data.writeInterfaceToken(IActivityManager.descriptor);
6209 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
6210 reply.readException();
6211 data.recycle();
6212 reply.recycle();
6213 }
6214
Dianne Hackborn35f72be2013-09-16 10:57:39 -07006215 public void performIdleMaintenance() throws RemoteException {
6216 Parcel data = Parcel.obtain();
6217 Parcel reply = Parcel.obtain();
6218 data.writeInterfaceToken(IActivityManager.descriptor);
6219 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
6220 reply.readException();
6221 data.recycle();
6222 reply.recycle();
6223 }
6224
Todd Kennedyca4d8422015-01-15 15:19:22 -08006225 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08006226 IActivityContainerCallback callback) throws RemoteException {
6227 Parcel data = Parcel.obtain();
6228 Parcel reply = Parcel.obtain();
6229 data.writeInterfaceToken(IActivityManager.descriptor);
6230 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07006231 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08006232 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08006233 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08006234 final int result = reply.readInt();
6235 final IActivityContainer res;
6236 if (result == 1) {
6237 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6238 } else {
6239 res = null;
6240 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08006241 data.recycle();
6242 reply.recycle();
6243 return res;
6244 }
6245
Craig Mautner95da1082014-02-24 17:54:35 -08006246 public void deleteActivityContainer(IActivityContainer activityContainer)
6247 throws RemoteException {
6248 Parcel data = Parcel.obtain();
6249 Parcel reply = Parcel.obtain();
6250 data.writeInterfaceToken(IActivityManager.descriptor);
6251 data.writeStrongBinder(activityContainer.asBinder());
6252 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
6253 reply.readException();
6254 data.recycle();
6255 reply.recycle();
6256 }
6257
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04006258 public boolean startBinderTracking() throws RemoteException {
6259 Parcel data = Parcel.obtain();
6260 Parcel reply = Parcel.obtain();
6261 data.writeInterfaceToken(IActivityManager.descriptor);
6262 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
6263 reply.readException();
6264 boolean res = reply.readInt() != 0;
6265 reply.recycle();
6266 data.recycle();
6267 return res;
6268 }
6269
6270 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6271 Parcel data = Parcel.obtain();
6272 Parcel reply = Parcel.obtain();
6273 data.writeInterfaceToken(IActivityManager.descriptor);
6274 if (fd != null) {
6275 data.writeInt(1);
6276 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6277 } else {
6278 data.writeInt(0);
6279 }
6280 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6281 reply.readException();
6282 boolean res = reply.readInt() != 0;
6283 reply.recycle();
6284 data.recycle();
6285 return res;
6286 }
6287
Ruben Brunke24b9a62016-02-16 21:38:24 -08006288 public int setVrMode(IBinder token, boolean enabled, ComponentName packageName)
6289 throws RemoteException {
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006290 Parcel data = Parcel.obtain();
6291 Parcel reply = Parcel.obtain();
6292 data.writeInterfaceToken(IActivityManager.descriptor);
6293 data.writeStrongBinder(token);
6294 data.writeInt(enabled ? 1 : 0);
Ruben Brunke24b9a62016-02-16 21:38:24 -08006295 packageName.writeToParcel(data, 0);
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006296 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6297 reply.readException();
Ruben Brunke24b9a62016-02-16 21:38:24 -08006298 int res = reply.readInt();
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006299 data.recycle();
6300 reply.recycle();
Ruben Brunke24b9a62016-02-16 21:38:24 -08006301 return res;
6302 }
6303
6304 public boolean isVrModePackageEnabled(ComponentName packageName)
6305 throws RemoteException {
6306 Parcel data = Parcel.obtain();
6307 Parcel reply = Parcel.obtain();
6308 data.writeInterfaceToken(IActivityManager.descriptor);
6309 packageName.writeToParcel(data, 0);
6310 mRemote.transact(IS_VR_PACKAGE_ENABLED_TRANSACTION, data, reply, 0);
6311 reply.readException();
6312 int res = reply.readInt();
6313 data.recycle();
6314 reply.recycle();
6315 return res == 1;
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006316 }
6317
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006318 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006319 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6320 Parcel data = Parcel.obtain();
6321 Parcel reply = Parcel.obtain();
6322 data.writeInterfaceToken(IActivityManager.descriptor);
6323 data.writeInt(displayId);
6324 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6325 reply.readException();
6326 final int result = reply.readInt();
6327 final IActivityContainer res;
6328 if (result == 1) {
6329 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6330 } else {
6331 res = null;
6332 }
6333 data.recycle();
6334 reply.recycle();
6335 return res;
6336 }
6337
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006338 @Override
6339 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006340 throws RemoteException {
6341 Parcel data = Parcel.obtain();
6342 Parcel reply = Parcel.obtain();
6343 data.writeInterfaceToken(IActivityManager.descriptor);
6344 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006345 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006346 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006347 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006348 data.recycle();
6349 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006350 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006351 }
6352
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006353 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006354 public void startLockTaskMode(int taskId) throws RemoteException {
6355 Parcel data = Parcel.obtain();
6356 Parcel reply = Parcel.obtain();
6357 data.writeInterfaceToken(IActivityManager.descriptor);
6358 data.writeInt(taskId);
6359 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6360 reply.readException();
6361 data.recycle();
6362 reply.recycle();
6363 }
6364
6365 @Override
6366 public void startLockTaskMode(IBinder token) throws RemoteException {
6367 Parcel data = Parcel.obtain();
6368 Parcel reply = Parcel.obtain();
6369 data.writeInterfaceToken(IActivityManager.descriptor);
6370 data.writeStrongBinder(token);
6371 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6372 reply.readException();
6373 data.recycle();
6374 reply.recycle();
6375 }
6376
6377 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006378 public void startLockTaskModeOnCurrent() throws RemoteException {
6379 Parcel data = Parcel.obtain();
6380 Parcel reply = Parcel.obtain();
6381 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006382 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006383 reply.readException();
6384 data.recycle();
6385 reply.recycle();
6386 }
6387
6388 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006389 public void stopLockTaskMode() throws RemoteException {
6390 Parcel data = Parcel.obtain();
6391 Parcel reply = Parcel.obtain();
6392 data.writeInterfaceToken(IActivityManager.descriptor);
6393 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6394 reply.readException();
6395 data.recycle();
6396 reply.recycle();
6397 }
6398
6399 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006400 public void stopLockTaskModeOnCurrent() throws RemoteException {
6401 Parcel data = Parcel.obtain();
6402 Parcel reply = Parcel.obtain();
6403 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006404 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006405 reply.readException();
6406 data.recycle();
6407 reply.recycle();
6408 }
6409
6410 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006411 public boolean isInLockTaskMode() throws RemoteException {
6412 Parcel data = Parcel.obtain();
6413 Parcel reply = Parcel.obtain();
6414 data.writeInterfaceToken(IActivityManager.descriptor);
6415 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6416 reply.readException();
6417 boolean isInLockTaskMode = reply.readInt() == 1;
6418 data.recycle();
6419 reply.recycle();
6420 return isInLockTaskMode;
6421 }
6422
Craig Mautner688b5102014-03-27 16:55:03 -07006423 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006424 public int getLockTaskModeState() throws RemoteException {
6425 Parcel data = Parcel.obtain();
6426 Parcel reply = Parcel.obtain();
6427 data.writeInterfaceToken(IActivityManager.descriptor);
6428 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6429 reply.readException();
6430 int lockTaskModeState = reply.readInt();
6431 data.recycle();
6432 reply.recycle();
6433 return lockTaskModeState;
6434 }
6435
6436 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006437 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6438 Parcel data = Parcel.obtain();
6439 Parcel reply = Parcel.obtain();
6440 data.writeInterfaceToken(IActivityManager.descriptor);
6441 data.writeStrongBinder(token);
6442 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6443 IBinder.FLAG_ONEWAY);
6444 reply.readException();
6445 data.recycle();
6446 reply.recycle();
6447 }
6448
6449 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006450 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006451 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006452 Parcel data = Parcel.obtain();
6453 Parcel reply = Parcel.obtain();
6454 data.writeInterfaceToken(IActivityManager.descriptor);
6455 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006456 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006457 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006458 reply.readException();
6459 data.recycle();
6460 reply.recycle();
6461 }
6462
Craig Mautneree2e45a2014-06-27 12:10:03 -07006463 @Override
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006464 public void setTaskResizeable(int taskId, int resizeableMode) throws RemoteException {
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006465 Parcel data = Parcel.obtain();
6466 Parcel reply = Parcel.obtain();
6467 data.writeInterfaceToken(IActivityManager.descriptor);
6468 data.writeInt(taskId);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006469 data.writeInt(resizeableMode);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006470 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006471 reply.readException();
6472 data.recycle();
6473 reply.recycle();
6474 }
6475
6476 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006477 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006478 {
6479 Parcel data = Parcel.obtain();
6480 Parcel reply = Parcel.obtain();
6481 data.writeInterfaceToken(IActivityManager.descriptor);
6482 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006483 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006484 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006485 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006486 reply.readException();
6487 data.recycle();
6488 reply.recycle();
6489 }
6490
6491 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006492 public Rect getTaskBounds(int taskId) throws RemoteException
6493 {
6494 Parcel data = Parcel.obtain();
6495 Parcel reply = Parcel.obtain();
6496 data.writeInterfaceToken(IActivityManager.descriptor);
6497 data.writeInt(taskId);
6498 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6499 reply.readException();
6500 Rect rect = Rect.CREATOR.createFromParcel(reply);
6501 data.recycle();
6502 reply.recycle();
6503 return rect;
6504 }
6505
6506 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006507 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006508 Parcel data = Parcel.obtain();
6509 Parcel reply = Parcel.obtain();
6510 data.writeInterfaceToken(IActivityManager.descriptor);
6511 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006512 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006513 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6514 reply.readException();
6515 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6516 data.recycle();
6517 reply.recycle();
6518 return icon;
6519 }
6520
6521 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006522 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6523 throws RemoteException {
6524 Parcel data = Parcel.obtain();
6525 Parcel reply = Parcel.obtain();
6526 data.writeInterfaceToken(IActivityManager.descriptor);
6527 if (options == null) {
6528 data.writeInt(0);
6529 } else {
6530 data.writeInt(1);
6531 data.writeBundle(options.toBundle());
6532 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006533 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006534 reply.readException();
6535 data.recycle();
6536 reply.recycle();
6537 }
6538
6539 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006540 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006541 Parcel data = Parcel.obtain();
6542 Parcel reply = Parcel.obtain();
6543 data.writeInterfaceToken(IActivityManager.descriptor);
6544 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006545 data.writeInt(visible ? 1 : 0);
6546 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006547 reply.readException();
6548 boolean success = reply.readInt() > 0;
6549 data.recycle();
6550 reply.recycle();
6551 return success;
6552 }
6553
6554 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006555 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006556 Parcel data = Parcel.obtain();
6557 Parcel reply = Parcel.obtain();
6558 data.writeInterfaceToken(IActivityManager.descriptor);
6559 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006560 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006561 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006562 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006563 data.recycle();
6564 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006565 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006566 }
6567
6568 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006569 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006570 Parcel data = Parcel.obtain();
6571 Parcel reply = Parcel.obtain();
6572 data.writeInterfaceToken(IActivityManager.descriptor);
6573 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006574 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006575 reply.readException();
6576 data.recycle();
6577 reply.recycle();
6578 }
6579
6580 @Override
6581 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6582 Parcel data = Parcel.obtain();
6583 Parcel reply = Parcel.obtain();
6584 data.writeInterfaceToken(IActivityManager.descriptor);
6585 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006586 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006587 reply.readException();
6588 data.recycle();
6589 reply.recycle();
6590 }
6591
Craig Mautner8746a472014-07-24 15:12:54 -07006592 @Override
6593 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6594 Parcel data = Parcel.obtain();
6595 Parcel reply = Parcel.obtain();
6596 data.writeInterfaceToken(IActivityManager.descriptor);
6597 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006598 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006599 reply.readException();
6600 data.recycle();
6601 reply.recycle();
6602 }
6603
Craig Mautner6e2f3952014-09-09 14:26:41 -07006604 @Override
6605 public void bootAnimationComplete() throws RemoteException {
6606 Parcel data = Parcel.obtain();
6607 Parcel reply = Parcel.obtain();
6608 data.writeInterfaceToken(IActivityManager.descriptor);
6609 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6610 reply.readException();
6611 data.recycle();
6612 reply.recycle();
6613 }
6614
Wale Ogunwale18795a22014-12-03 11:38:33 -08006615 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006616 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6617 Parcel data = Parcel.obtain();
6618 Parcel reply = Parcel.obtain();
6619 data.writeInterfaceToken(IActivityManager.descriptor);
6620 data.writeInt(uid);
6621 data.writeByteArray(firstPacket);
6622 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6623 reply.readException();
6624 data.recycle();
6625 reply.recycle();
6626 }
6627
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006628 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006629 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6630 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006631 Parcel data = Parcel.obtain();
6632 Parcel reply = Parcel.obtain();
6633 data.writeInterfaceToken(IActivityManager.descriptor);
6634 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006635 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006636 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006637 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006638 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6639 reply.readException();
6640 data.recycle();
6641 reply.recycle();
6642 }
6643
6644 @Override
6645 public void dumpHeapFinished(String path) throws RemoteException {
6646 Parcel data = Parcel.obtain();
6647 Parcel reply = Parcel.obtain();
6648 data.writeInterfaceToken(IActivityManager.descriptor);
6649 data.writeString(path);
6650 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6651 reply.readException();
6652 data.recycle();
6653 reply.recycle();
6654 }
6655
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006656 @Override
6657 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6658 throws RemoteException {
6659 Parcel data = Parcel.obtain();
6660 Parcel reply = Parcel.obtain();
6661 data.writeInterfaceToken(IActivityManager.descriptor);
6662 data.writeStrongBinder(session.asBinder());
6663 data.writeInt(keepAwake ? 1 : 0);
6664 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6665 reply.readException();
6666 data.recycle();
6667 reply.recycle();
6668 }
6669
Craig Mautnere5600772015-04-03 21:36:37 -07006670 @Override
6671 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6672 Parcel data = Parcel.obtain();
6673 Parcel reply = Parcel.obtain();
6674 data.writeInterfaceToken(IActivityManager.descriptor);
6675 data.writeInt(userId);
6676 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006677 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006678 reply.readException();
6679 data.recycle();
6680 reply.recycle();
6681 }
6682
Dianne Hackborn1e383822015-04-10 14:02:33 -07006683 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006684 public void updateDeviceOwner(String packageName) throws RemoteException {
6685 Parcel data = Parcel.obtain();
6686 Parcel reply = Parcel.obtain();
6687 data.writeInterfaceToken(IActivityManager.descriptor);
6688 data.writeString(packageName);
6689 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6690 reply.readException();
6691 data.recycle();
6692 reply.recycle();
6693 }
6694
6695 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006696 public int getPackageProcessState(String packageName, String callingPackage)
6697 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006698 Parcel data = Parcel.obtain();
6699 Parcel reply = Parcel.obtain();
6700 data.writeInterfaceToken(IActivityManager.descriptor);
6701 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006702 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006703 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6704 reply.readException();
6705 int res = reply.readInt();
6706 data.recycle();
6707 reply.recycle();
6708 return res;
6709 }
6710
Stefan Kuhne16045c22015-06-05 07:18:06 -07006711 @Override
6712 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6713 throws RemoteException {
6714 Parcel data = Parcel.obtain();
6715 Parcel reply = Parcel.obtain();
6716 data.writeInterfaceToken(IActivityManager.descriptor);
6717 data.writeString(process);
6718 data.writeInt(userId);
6719 data.writeInt(level);
6720 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6721 reply.readException();
6722 int res = reply.readInt();
6723 data.recycle();
6724 reply.recycle();
6725 return res != 0;
6726 }
6727
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006728 @Override
6729 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6730 Parcel data = Parcel.obtain();
6731 Parcel reply = Parcel.obtain();
6732 data.writeInterfaceToken(IActivityManager.descriptor);
6733 data.writeStrongBinder(token);
6734 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6735 reply.readException();
6736 int res = reply.readInt();
6737 data.recycle();
6738 reply.recycle();
6739 return res != 0;
6740 }
6741
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006742 @Override
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006743 public void exitFreeformMode(IBinder token) throws RemoteException {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006744 Parcel data = Parcel.obtain();
6745 Parcel reply = Parcel.obtain();
6746 data.writeInterfaceToken(IActivityManager.descriptor);
6747 data.writeStrongBinder(token);
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006748 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006749 reply.readException();
6750 data.recycle();
6751 reply.recycle();
6752 }
6753
6754 @Override
6755 public int getActivityStackId(IBinder token) throws RemoteException {
6756 Parcel data = Parcel.obtain();
6757 Parcel reply = Parcel.obtain();
6758 data.writeInterfaceToken(IActivityManager.descriptor);
6759 data.writeStrongBinder(token);
6760 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6761 reply.readException();
6762 int stackId = reply.readInt();
6763 data.recycle();
6764 reply.recycle();
6765 return stackId;
6766 }
6767
Filip Gruszczynski23493322015-07-29 17:02:59 -07006768 @Override
6769 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006770 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6771 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006772 Parcel data = Parcel.obtain();
6773 Parcel reply = Parcel.obtain();
6774 data.writeInterfaceToken(IActivityManager.descriptor);
6775 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006776 writeIntArray(horizontalSizeConfiguration, data);
6777 writeIntArray(verticalSizeConfigurations, data);
6778 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006779 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6780 reply.readException();
6781 data.recycle();
6782 reply.recycle();
6783 }
6784
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006785 private static void writeIntArray(int[] array, Parcel data) {
6786 if (array == null) {
6787 data.writeInt(0);
6788 } else {
6789 data.writeInt(array.length);
6790 data.writeIntArray(array);
6791 }
6792 }
6793
Wale Ogunwale83301a92015-09-24 15:54:08 -07006794 @Override
6795 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6796 Parcel data = Parcel.obtain();
6797 Parcel reply = Parcel.obtain();
6798 data.writeInterfaceToken(IActivityManager.descriptor);
6799 data.writeInt(suppress ? 1 : 0);
6800 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6801 reply.readException();
6802 data.recycle();
6803 reply.recycle();
6804 }
6805
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006806 @Override
Wale Ogunwale9101d262016-01-15 08:56:11 -08006807 public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006808 Parcel data = Parcel.obtain();
6809 Parcel reply = Parcel.obtain();
6810 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006811 data.writeInt(fromStackId);
Wale Ogunwale9101d262016-01-15 08:56:11 -08006812 data.writeInt(onTop ? 1 : 0);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006813 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006814 reply.readException();
6815 data.recycle();
6816 reply.recycle();
6817 }
6818
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006819 @Override
6820 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6821 Parcel data = Parcel.obtain();
6822 Parcel reply = Parcel.obtain();
6823 data.writeInterfaceToken(IActivityManager.descriptor);
6824 data.writeInt(uid);
6825 data.writeString(packageName);
6826 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6827 reply.readException();
6828 int res = reply.readInt();
6829 data.recycle();
6830 reply.recycle();
6831 return res;
6832 }
6833
Wale Ogunwale5f986092015-12-04 15:35:38 -08006834 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006835 public boolean inMultiWindow(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006836 Parcel data = Parcel.obtain();
6837 Parcel reply = Parcel.obtain();
6838 data.writeInterfaceToken(IActivityManager.descriptor);
6839 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006840 mRemote.transact(IN_MULTI_WINDOW_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006841 reply.readException();
6842 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6843 data.recycle();
6844 reply.recycle();
6845 return multiWindowMode;
6846 }
6847
6848 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006849 public boolean inPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006850 Parcel data = Parcel.obtain();
6851 Parcel reply = Parcel.obtain();
6852 data.writeInterfaceToken(IActivityManager.descriptor);
6853 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006854 mRemote.transact(IN_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006855 reply.readException();
6856 final boolean pipMode = reply.readInt() == 1 ? true : false;
6857 data.recycle();
6858 reply.recycle();
6859 return pipMode;
6860 }
6861
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006862 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006863 public void enterPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006864 Parcel data = Parcel.obtain();
6865 Parcel reply = Parcel.obtain();
6866 data.writeInterfaceToken(IActivityManager.descriptor);
6867 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006868 mRemote.transact(ENTER_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006869 reply.readException();
6870 data.recycle();
6871 reply.recycle();
6872 }
6873
Christopher Tate63fec3e2015-12-11 18:35:28 -08006874 @Override
6875 public boolean isAppForeground(int uid) throws RemoteException {
6876 Parcel data = Parcel.obtain();
6877 Parcel reply = Parcel.obtain();
6878 data.writeInterfaceToken(IActivityManager.descriptor);
6879 data.writeInt(uid);
6880 mRemote.transact(IS_APP_FOREGROUND_TRANSACTION, data, reply, 0);
6881 final boolean isForeground = reply.readInt() == 1 ? true : false;
6882 data.recycle();
6883 reply.recycle();
6884 return isForeground;
6885 };
6886
Wale Ogunwale480dca02016-02-06 13:58:29 -08006887 @Override
6888 public void notifyPinnedStackAnimationEnded() throws RemoteException {
6889 Parcel data = Parcel.obtain();
6890 Parcel reply = Parcel.obtain();
6891 data.writeInterfaceToken(IActivityManager.descriptor);
6892 mRemote.transact(NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION, data, reply, 0);
6893 data.recycle();
6894 reply.recycle();
6895 };
6896
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08006897 @Override
6898 public void removeStack(int stackId) throws RemoteException {
6899 Parcel data = Parcel.obtain();
6900 Parcel reply = Parcel.obtain();
6901 data.writeInterfaceToken(IActivityManager.descriptor);
6902 data.writeInt(stackId);
6903 mRemote.transact(REMOVE_STACK, data, reply, 0);
6904 reply.readException();
6905 data.recycle();
6906 reply.recycle();
6907 }
6908
Tony Mak9c6e8ce2016-03-21 12:07:16 +00006909 public void notifyLockedProfile(@UserIdInt int userId) throws RemoteException
6910 {
6911 Parcel data = Parcel.obtain();
6912 Parcel reply = Parcel.obtain();
6913 data.writeInterfaceToken(IActivityManager.descriptor);
6914 data.writeInt(userId);
6915 mRemote.transact(NOTIFY_LOCKED_PROFILE, data, reply, 0);
6916 reply.readException();
6917 data.recycle();
6918 reply.recycle();
6919 }
6920
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006921 private IBinder mRemote;
6922}