blob: 1f1f356bc5f78aea96662b54dfc89c9f342eccc1 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700110 null, intent, null, null, Activity.RESULT_OK, null, null,
111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Dianne Hackborn1e383822015-04-10 14:02:33 -0700119 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg, tag);
120 } catch (RemoteException ex) {
121 }
122 }
123
124 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
125 try {
126 getDefault().noteAlarmStart(ps.getTarget(), sourceUid, tag);
127 } catch (RemoteException ex) {
128 }
129 }
130
131 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
132 try {
133 getDefault().noteAlarmFinish(ps.getTarget(), sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 } catch (RemoteException ex) {
135 }
136 }
137
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800138 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 attachInterface(this, descriptor);
140 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700141
142 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
144 throws RemoteException {
145 switch (code) {
146 case START_ACTIVITY_TRANSACTION:
147 {
148 data.enforceInterface(IActivityManager.descriptor);
149 IBinder b = data.readStrongBinder();
150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800151 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 Intent intent = Intent.CREATOR.createFromParcel(data);
153 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800155 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700157 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700158 ProfilerInfo profilerInfo = data.readInt() != 0
159 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700160 Bundle options = data.readInt() != 0
161 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800162 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700163 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 reply.writeNoException();
165 reply.writeInt(result);
166 return true;
167 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700168
Amith Yamasani82644082012-08-03 13:09:11 -0700169 case START_ACTIVITY_AS_USER_TRANSACTION:
170 {
171 data.enforceInterface(IActivityManager.descriptor);
172 IBinder b = data.readStrongBinder();
173 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800174 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700175 Intent intent = Intent.CREATOR.createFromParcel(data);
176 String resolvedType = data.readString();
177 IBinder resultTo = data.readStrongBinder();
178 String resultWho = data.readString();
179 int requestCode = data.readInt();
180 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700181 ProfilerInfo profilerInfo = data.readInt() != 0
182 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700183 Bundle options = data.readInt() != 0
184 ? Bundle.CREATOR.createFromParcel(data) : null;
185 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800186 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700187 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700188 reply.writeNoException();
189 reply.writeInt(result);
190 return true;
191 }
192
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700193 case START_ACTIVITY_AS_CALLER_TRANSACTION:
194 {
195 data.enforceInterface(IActivityManager.descriptor);
196 IBinder b = data.readStrongBinder();
197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
198 String callingPackage = data.readString();
199 Intent intent = Intent.CREATOR.createFromParcel(data);
200 String resolvedType = data.readString();
201 IBinder resultTo = data.readStrongBinder();
202 String resultWho = data.readString();
203 int requestCode = data.readInt();
204 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700205 ProfilerInfo profilerInfo = data.readInt() != 0
206 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700207 Bundle options = data.readInt() != 0
208 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700209 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700210 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700211 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
213 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700214 reply.writeNoException();
215 reply.writeInt(result);
216 return true;
217 }
218
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800219 case START_ACTIVITY_AND_WAIT_TRANSACTION:
220 {
221 data.enforceInterface(IActivityManager.descriptor);
222 IBinder b = data.readStrongBinder();
223 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800224 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800225 Intent intent = Intent.CREATOR.createFromParcel(data);
226 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800227 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800228 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800229 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700231 ProfilerInfo profilerInfo = data.readInt() != 0
232 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700233 Bundle options = data.readInt() != 0
234 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700235 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800236 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700237 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800238 reply.writeNoException();
239 result.writeToParcel(reply, 0);
240 return true;
241 }
242
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700243 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
244 {
245 data.enforceInterface(IActivityManager.descriptor);
246 IBinder b = data.readStrongBinder();
247 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800248 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700249 Intent intent = Intent.CREATOR.createFromParcel(data);
250 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700251 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700252 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700253 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700254 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700255 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700256 Bundle options = data.readInt() != 0
257 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700258 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800259 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700260 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700261 reply.writeNoException();
262 reply.writeInt(result);
263 return true;
264 }
265
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700266 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700267 {
268 data.enforceInterface(IActivityManager.descriptor);
269 IBinder b = data.readStrongBinder();
270 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700271 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700272 Intent fillInIntent = null;
273 if (data.readInt() != 0) {
274 fillInIntent = Intent.CREATOR.createFromParcel(data);
275 }
276 String resolvedType = data.readString();
277 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700278 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700279 int requestCode = data.readInt();
280 int flagsMask = data.readInt();
281 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700282 Bundle options = data.readInt() != 0
283 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700284 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700285 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700286 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700287 reply.writeNoException();
288 reply.writeInt(result);
289 return true;
290 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700291
Dianne Hackborn91097de2014-04-04 18:02:06 -0700292 case START_VOICE_ACTIVITY_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 String callingPackage = data.readString();
296 int callingPid = data.readInt();
297 int callingUid = data.readInt();
298 Intent intent = Intent.CREATOR.createFromParcel(data);
299 String resolvedType = data.readString();
300 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
301 data.readStrongBinder());
302 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
303 data.readStrongBinder());
304 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700305 ProfilerInfo profilerInfo = data.readInt() != 0
306 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700307 Bundle options = data.readInt() != 0
308 ? Bundle.CREATOR.createFromParcel(data) : null;
309 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700310 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
311 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700312 reply.writeNoException();
313 reply.writeInt(result);
314 return true;
315 }
316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
318 {
319 data.enforceInterface(IActivityManager.descriptor);
320 IBinder callingActivity = data.readStrongBinder();
321 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700322 Bundle options = data.readInt() != 0
323 ? Bundle.CREATOR.createFromParcel(data) : null;
324 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800325 reply.writeNoException();
326 reply.writeInt(result ? 1 : 0);
327 return true;
328 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700329
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700330 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
331 {
332 data.enforceInterface(IActivityManager.descriptor);
333 int taskId = data.readInt();
334 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
335 int result = startActivityFromRecents(taskId, options);
336 reply.writeNoException();
337 reply.writeInt(result);
338 return true;
339 }
340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800341 case FINISH_ACTIVITY_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 Intent resultData = null;
345 int resultCode = data.readInt();
346 if (data.readInt() != 0) {
347 resultData = Intent.CREATOR.createFromParcel(data);
348 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700349 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700350 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 reply.writeNoException();
352 reply.writeInt(res ? 1 : 0);
353 return true;
354 }
355
356 case FINISH_SUB_ACTIVITY_TRANSACTION: {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700359 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 int requestCode = data.readInt();
361 finishSubActivity(token, resultWho, requestCode);
362 reply.writeNoException();
363 return true;
364 }
365
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700366 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
367 data.enforceInterface(IActivityManager.descriptor);
368 IBinder token = data.readStrongBinder();
369 boolean res = finishActivityAffinity(token);
370 reply.writeNoException();
371 reply.writeInt(res ? 1 : 0);
372 return true;
373 }
374
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700375 case FINISH_VOICE_TASK_TRANSACTION: {
376 data.enforceInterface(IActivityManager.descriptor);
377 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
378 data.readStrongBinder());
379 finishVoiceTask(session);
380 reply.writeNoException();
381 return true;
382 }
383
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700384 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
385 data.enforceInterface(IActivityManager.descriptor);
386 IBinder token = data.readStrongBinder();
387 boolean res = releaseActivityInstance(token);
388 reply.writeNoException();
389 reply.writeInt(res ? 1 : 0);
390 return true;
391 }
392
393 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
394 data.enforceInterface(IActivityManager.descriptor);
395 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
396 releaseSomeActivities(app);
397 reply.writeNoException();
398 return true;
399 }
400
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800401 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
402 data.enforceInterface(IActivityManager.descriptor);
403 IBinder token = data.readStrongBinder();
404 boolean res = willActivityBeVisible(token);
405 reply.writeNoException();
406 reply.writeInt(res ? 1 : 0);
407 return true;
408 }
409
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800410 case REGISTER_RECEIVER_TRANSACTION:
411 {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder b = data.readStrongBinder();
414 IApplicationThread app =
415 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700416 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 b = data.readStrongBinder();
418 IIntentReceiver rec
419 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
420 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
421 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700422 int userId = data.readInt();
423 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 reply.writeNoException();
425 if (intent != null) {
426 reply.writeInt(1);
427 intent.writeToParcel(reply, 0);
428 } else {
429 reply.writeInt(0);
430 }
431 return true;
432 }
433
434 case UNREGISTER_RECEIVER_TRANSACTION:
435 {
436 data.enforceInterface(IActivityManager.descriptor);
437 IBinder b = data.readStrongBinder();
438 if (b == null) {
439 return true;
440 }
441 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
442 unregisterReceiver(rec);
443 reply.writeNoException();
444 return true;
445 }
446
447 case BROADCAST_INTENT_TRANSACTION:
448 {
449 data.enforceInterface(IActivityManager.descriptor);
450 IBinder b = data.readStrongBinder();
451 IApplicationThread app =
452 b != null ? ApplicationThreadNative.asInterface(b) : null;
453 Intent intent = Intent.CREATOR.createFromParcel(data);
454 String resolvedType = data.readString();
455 b = data.readStrongBinder();
456 IIntentReceiver resultTo =
457 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
458 int resultCode = data.readInt();
459 String resultData = data.readString();
460 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700461 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800462 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700463 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800464 boolean serialized = data.readInt() != 0;
465 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700466 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700468 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700469 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 reply.writeNoException();
471 reply.writeInt(res);
472 return true;
473 }
474
475 case UNBROADCAST_INTENT_TRANSACTION:
476 {
477 data.enforceInterface(IActivityManager.descriptor);
478 IBinder b = data.readStrongBinder();
479 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
480 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700481 int userId = data.readInt();
482 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 reply.writeNoException();
484 return true;
485 }
486
487 case FINISH_RECEIVER_TRANSACTION: {
488 data.enforceInterface(IActivityManager.descriptor);
489 IBinder who = data.readStrongBinder();
490 int resultCode = data.readInt();
491 String resultData = data.readString();
492 Bundle resultExtras = data.readBundle();
493 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800494 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800496 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 }
498 reply.writeNoException();
499 return true;
500 }
501
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 case ATTACH_APPLICATION_TRANSACTION: {
503 data.enforceInterface(IActivityManager.descriptor);
504 IApplicationThread app = ApplicationThreadNative.asInterface(
505 data.readStrongBinder());
506 if (app != null) {
507 attachApplication(app);
508 }
509 reply.writeNoException();
510 return true;
511 }
512
513 case ACTIVITY_IDLE_TRANSACTION: {
514 data.enforceInterface(IActivityManager.descriptor);
515 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700516 Configuration config = null;
517 if (data.readInt() != 0) {
518 config = Configuration.CREATOR.createFromParcel(data);
519 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700520 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800521 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700522 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 }
524 reply.writeNoException();
525 return true;
526 }
527
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700528 case ACTIVITY_RESUMED_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 IBinder token = data.readStrongBinder();
531 activityResumed(token);
532 reply.writeNoException();
533 return true;
534 }
535
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 case ACTIVITY_PAUSED_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700539 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 reply.writeNoException();
541 return true;
542 }
543
544 case ACTIVITY_STOPPED_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800547 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700548 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700550 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 reply.writeNoException();
552 return true;
553 }
554
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800555 case ACTIVITY_SLEPT_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 activitySlept(token);
559 reply.writeNoException();
560 return true;
561 }
562
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800563 case ACTIVITY_DESTROYED_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
565 IBinder token = data.readStrongBinder();
566 activityDestroyed(token);
567 reply.writeNoException();
568 return true;
569 }
570
571 case GET_CALLING_PACKAGE_TRANSACTION: {
572 data.enforceInterface(IActivityManager.descriptor);
573 IBinder token = data.readStrongBinder();
574 String res = token != null ? getCallingPackage(token) : null;
575 reply.writeNoException();
576 reply.writeString(res);
577 return true;
578 }
579
580 case GET_CALLING_ACTIVITY_TRANSACTION: {
581 data.enforceInterface(IActivityManager.descriptor);
582 IBinder token = data.readStrongBinder();
583 ComponentName cn = getCallingActivity(token);
584 reply.writeNoException();
585 ComponentName.writeToParcel(cn, reply);
586 return true;
587 }
588
Winson Chung1147c402014-05-14 11:05:00 -0700589 case GET_APP_TASKS_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700591 String callingPackage = data.readString();
592 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700593 reply.writeNoException();
594 int N = list != null ? list.size() : -1;
595 reply.writeInt(N);
596 int i;
597 for (i=0; i<N; i++) {
598 IAppTask task = list.get(i);
599 reply.writeStrongBinder(task.asBinder());
600 }
601 return true;
602 }
603
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700604 case ADD_APP_TASK_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 IBinder activityToken = data.readStrongBinder();
607 Intent intent = Intent.CREATOR.createFromParcel(data);
608 ActivityManager.TaskDescription descr
609 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
610 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
611 int res = addAppTask(activityToken, intent, descr, thumbnail);
612 reply.writeNoException();
613 reply.writeInt(res);
614 return true;
615 }
616
617 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
618 data.enforceInterface(IActivityManager.descriptor);
619 Point size = getAppTaskThumbnailSize();
620 reply.writeNoException();
621 size.writeToParcel(reply, 0);
622 return true;
623 }
624
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 case GET_TASKS_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 int maxNum = data.readInt();
628 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700629 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800630 reply.writeNoException();
631 int N = list != null ? list.size() : -1;
632 reply.writeInt(N);
633 int i;
634 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700635 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 info.writeToParcel(reply, 0);
637 }
638 return true;
639 }
640
641 case GET_RECENT_TASKS_TRANSACTION: {
642 data.enforceInterface(IActivityManager.descriptor);
643 int maxNum = data.readInt();
644 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700645 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700647 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 reply.writeNoException();
649 reply.writeTypedList(list);
650 return true;
651 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700652
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700653 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800654 data.enforceInterface(IActivityManager.descriptor);
655 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700658 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800659 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700660 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700661 } else {
662 reply.writeInt(0);
663 }
664 return true;
665 }
666
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667 case GET_SERVICES_TRANSACTION: {
668 data.enforceInterface(IActivityManager.descriptor);
669 int maxNum = data.readInt();
670 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700671 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 reply.writeNoException();
673 int N = list != null ? list.size() : -1;
674 reply.writeInt(N);
675 int i;
676 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700677 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 info.writeToParcel(reply, 0);
679 }
680 return true;
681 }
682
683 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
684 data.enforceInterface(IActivityManager.descriptor);
685 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
686 reply.writeNoException();
687 reply.writeTypedList(list);
688 return true;
689 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700690
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800691 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
694 reply.writeNoException();
695 reply.writeTypedList(list);
696 return true;
697 }
698
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700699 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
700 data.enforceInterface(IActivityManager.descriptor);
701 List<ApplicationInfo> list = getRunningExternalApplications();
702 reply.writeNoException();
703 reply.writeTypedList(list);
704 return true;
705 }
706
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 case MOVE_TASK_TO_FRONT_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800710 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700711 Bundle options = data.readInt() != 0
712 ? Bundle.CREATOR.createFromParcel(data) : null;
713 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 reply.writeNoException();
715 return true;
716 }
717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 IBinder token = data.readStrongBinder();
721 boolean nonRoot = data.readInt() != 0;
722 boolean res = moveActivityTaskToBack(token, nonRoot);
723 reply.writeNoException();
724 reply.writeInt(res ? 1 : 0);
725 return true;
726 }
727
728 case MOVE_TASK_BACKWARDS_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 int task = data.readInt();
731 moveTaskBackwards(task);
732 reply.writeNoException();
733 return true;
734 }
735
Craig Mautnerc00204b2013-03-05 15:02:14 -0800736 case MOVE_TASK_TO_STACK_TRANSACTION: {
737 data.enforceInterface(IActivityManager.descriptor);
738 int taskId = data.readInt();
739 int stackId = data.readInt();
740 boolean toTop = data.readInt() != 0;
741 moveTaskToStack(taskId, stackId, toTop);
742 reply.writeNoException();
743 return true;
744 }
745
746 case RESIZE_STACK_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800748 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800749 Rect r = Rect.CREATOR.createFromParcel(data);
750 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800751 reply.writeNoException();
752 return true;
753 }
754
Skuhnece2faa52015-08-11 10:36:38 -0700755 case GET_ACTIVITY_BOUNDS_TRANSACTION: {
756 data.enforceInterface(IActivityManager.descriptor);
757 IBinder token = data.readStrongBinder();
758 Rect r = getActivityBounds(token);
759 reply.writeNoException();
760 r.writeToParcel(reply, 0);
761 return true;
762 }
763
764 case SET_ACTIVITY_BOUNDS_TRANSACTION: {
765 data.enforceInterface(IActivityManager.descriptor);
766 IBinder token = data.readStrongBinder();
767 Rect r = Rect.CREATOR.createFromParcel(data);
768 setActivityBounds(token, r);
769 reply.writeNoException();
770 return true;
771 }
772
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700773 case POSITION_TASK_IN_STACK_TRANSACTION: {
774 data.enforceInterface(IActivityManager.descriptor);
775 int taskId = data.readInt();
776 int stackId = data.readInt();
777 int position = data.readInt();
778 positionTaskInStack(taskId, stackId, position);
779 reply.writeNoException();
780 return true;
781 }
782
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800783 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700784 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800785 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700786 reply.writeNoException();
787 reply.writeTypedList(list);
788 return true;
789 }
790
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800791 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700792 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800793 int stackId = data.readInt();
794 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700795 reply.writeNoException();
796 if (info != null) {
797 reply.writeInt(1);
798 info.writeToParcel(reply, 0);
799 } else {
800 reply.writeInt(0);
801 }
802 return true;
803 }
804
Winson Chung303e1ff2014-03-07 15:06:19 -0800805 case IS_IN_HOME_STACK_TRANSACTION: {
806 data.enforceInterface(IActivityManager.descriptor);
807 int taskId = data.readInt();
808 boolean isInHomeStack = isInHomeStack(taskId);
809 reply.writeNoException();
810 reply.writeInt(isInHomeStack ? 1 : 0);
811 return true;
812 }
813
Craig Mautnercf910b02013-04-23 11:23:27 -0700814 case SET_FOCUSED_STACK_TRANSACTION: {
815 data.enforceInterface(IActivityManager.descriptor);
816 int stackId = data.readInt();
817 setFocusedStack(stackId);
818 reply.writeNoException();
819 return true;
820 }
821
Winson Chungd16c5652015-01-26 16:11:07 -0800822 case GET_FOCUSED_STACK_ID_TRANSACTION: {
823 data.enforceInterface(IActivityManager.descriptor);
824 int focusedStackId = getFocusedStackId();
825 reply.writeNoException();
826 reply.writeInt(focusedStackId);
827 return true;
828 }
829
Skuhnef36bb0c2015-08-26 14:26:17 -0700830 case ACTIVATE_ACTIVITY_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 IBinder token = data.readStrongBinder();
833 activateActivity(token);
834 reply.writeNoException();
835 return true;
836 }
837
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700838 case SET_FOCUSED_TASK_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700841 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700842 reply.writeNoException();
843 return true;
844 }
845
Winson Chung740c3ac2014-11-12 16:14:38 -0800846 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
847 data.enforceInterface(IActivityManager.descriptor);
848 IBinder token = data.readStrongBinder();
849 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
850 reply.writeNoException();
851 return true;
852 }
853
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800854 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
855 data.enforceInterface(IActivityManager.descriptor);
856 IBinder token = data.readStrongBinder();
857 boolean onlyRoot = data.readInt() != 0;
858 int res = token != null
859 ? getTaskForActivity(token, onlyRoot) : -1;
860 reply.writeNoException();
861 reply.writeInt(res);
862 return true;
863 }
864
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800865 case GET_CONTENT_PROVIDER_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 IBinder b = data.readStrongBinder();
868 IApplicationThread app = ApplicationThreadNative.asInterface(b);
869 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700870 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700871 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700872 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 reply.writeNoException();
874 if (cph != null) {
875 reply.writeInt(1);
876 cph.writeToParcel(reply, 0);
877 } else {
878 reply.writeInt(0);
879 }
880 return true;
881 }
882
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800883 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700886 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800887 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700888 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800889 reply.writeNoException();
890 if (cph != null) {
891 reply.writeInt(1);
892 cph.writeToParcel(reply, 0);
893 } else {
894 reply.writeInt(0);
895 }
896 return true;
897 }
898
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800899 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder b = data.readStrongBinder();
902 IApplicationThread app = ApplicationThreadNative.asInterface(b);
903 ArrayList<ContentProviderHolder> providers =
904 data.createTypedArrayList(ContentProviderHolder.CREATOR);
905 publishContentProviders(app, providers);
906 reply.writeNoException();
907 return true;
908 }
909
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700910 case REF_CONTENT_PROVIDER_TRANSACTION: {
911 data.enforceInterface(IActivityManager.descriptor);
912 IBinder b = data.readStrongBinder();
913 int stable = data.readInt();
914 int unstable = data.readInt();
915 boolean res = refContentProvider(b, stable, unstable);
916 reply.writeNoException();
917 reply.writeInt(res ? 1 : 0);
918 return true;
919 }
920
921 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 IBinder b = data.readStrongBinder();
924 unstableProviderDied(b);
925 reply.writeNoException();
926 return true;
927 }
928
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700929 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 IBinder b = data.readStrongBinder();
932 appNotRespondingViaProvider(b);
933 reply.writeNoException();
934 return true;
935 }
936
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800937 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
938 data.enforceInterface(IActivityManager.descriptor);
939 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700940 boolean stable = data.readInt() != 0;
941 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 reply.writeNoException();
943 return true;
944 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800945
946 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
947 data.enforceInterface(IActivityManager.descriptor);
948 String name = data.readString();
949 IBinder token = data.readStrongBinder();
950 removeContentProviderExternal(name, token);
951 reply.writeNoException();
952 return true;
953 }
954
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700955 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
956 data.enforceInterface(IActivityManager.descriptor);
957 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
958 PendingIntent pi = getRunningServiceControlPanel(comp);
959 reply.writeNoException();
960 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
961 return true;
962 }
963
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800964 case START_SERVICE_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 IBinder b = data.readStrongBinder();
967 IApplicationThread app = ApplicationThreadNative.asInterface(b);
968 Intent service = Intent.CREATOR.createFromParcel(data);
969 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700970 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700971 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700972 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800973 reply.writeNoException();
974 ComponentName.writeToParcel(cn, reply);
975 return true;
976 }
977
978 case STOP_SERVICE_TRANSACTION: {
979 data.enforceInterface(IActivityManager.descriptor);
980 IBinder b = data.readStrongBinder();
981 IApplicationThread app = ApplicationThreadNative.asInterface(b);
982 Intent service = Intent.CREATOR.createFromParcel(data);
983 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700984 int userId = data.readInt();
985 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800986 reply.writeNoException();
987 reply.writeInt(res);
988 return true;
989 }
990
991 case STOP_SERVICE_TOKEN_TRANSACTION: {
992 data.enforceInterface(IActivityManager.descriptor);
993 ComponentName className = ComponentName.readFromParcel(data);
994 IBinder token = data.readStrongBinder();
995 int startId = data.readInt();
996 boolean res = stopServiceToken(className, token, startId);
997 reply.writeNoException();
998 reply.writeInt(res ? 1 : 0);
999 return true;
1000 }
1001
1002 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1003 data.enforceInterface(IActivityManager.descriptor);
1004 ComponentName className = ComponentName.readFromParcel(data);
1005 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001006 int id = data.readInt();
1007 Notification notification = null;
1008 if (data.readInt() != 0) {
1009 notification = Notification.CREATOR.createFromParcel(data);
1010 }
1011 boolean removeNotification = data.readInt() != 0;
1012 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001013 reply.writeNoException();
1014 return true;
1015 }
1016
1017 case BIND_SERVICE_TRANSACTION: {
1018 data.enforceInterface(IActivityManager.descriptor);
1019 IBinder b = data.readStrongBinder();
1020 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1021 IBinder token = data.readStrongBinder();
1022 Intent service = Intent.CREATOR.createFromParcel(data);
1023 String resolvedType = data.readString();
1024 b = data.readStrongBinder();
1025 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001026 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001027 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001028 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001029 int res = bindService(app, token, service, resolvedType, conn, fl,
1030 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001031 reply.writeNoException();
1032 reply.writeInt(res);
1033 return true;
1034 }
1035
1036 case UNBIND_SERVICE_TRANSACTION: {
1037 data.enforceInterface(IActivityManager.descriptor);
1038 IBinder b = data.readStrongBinder();
1039 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1040 boolean res = unbindService(conn);
1041 reply.writeNoException();
1042 reply.writeInt(res ? 1 : 0);
1043 return true;
1044 }
1045
1046 case PUBLISH_SERVICE_TRANSACTION: {
1047 data.enforceInterface(IActivityManager.descriptor);
1048 IBinder token = data.readStrongBinder();
1049 Intent intent = Intent.CREATOR.createFromParcel(data);
1050 IBinder service = data.readStrongBinder();
1051 publishService(token, intent, service);
1052 reply.writeNoException();
1053 return true;
1054 }
1055
1056 case UNBIND_FINISHED_TRANSACTION: {
1057 data.enforceInterface(IActivityManager.descriptor);
1058 IBinder token = data.readStrongBinder();
1059 Intent intent = Intent.CREATOR.createFromParcel(data);
1060 boolean doRebind = data.readInt() != 0;
1061 unbindFinished(token, intent, doRebind);
1062 reply.writeNoException();
1063 return true;
1064 }
1065
1066 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1067 data.enforceInterface(IActivityManager.descriptor);
1068 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001069 int type = data.readInt();
1070 int startId = data.readInt();
1071 int res = data.readInt();
1072 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001073 reply.writeNoException();
1074 return true;
1075 }
1076
1077 case START_INSTRUMENTATION_TRANSACTION: {
1078 data.enforceInterface(IActivityManager.descriptor);
1079 ComponentName className = ComponentName.readFromParcel(data);
1080 String profileFile = data.readString();
1081 int fl = data.readInt();
1082 Bundle arguments = data.readBundle();
1083 IBinder b = data.readStrongBinder();
1084 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001085 b = data.readStrongBinder();
1086 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001087 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001088 String abiOverride = data.readString();
1089 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1090 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 reply.writeNoException();
1092 reply.writeInt(res ? 1 : 0);
1093 return true;
1094 }
1095
1096
1097 case FINISH_INSTRUMENTATION_TRANSACTION: {
1098 data.enforceInterface(IActivityManager.descriptor);
1099 IBinder b = data.readStrongBinder();
1100 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1101 int resultCode = data.readInt();
1102 Bundle results = data.readBundle();
1103 finishInstrumentation(app, resultCode, results);
1104 reply.writeNoException();
1105 return true;
1106 }
1107
1108 case GET_CONFIGURATION_TRANSACTION: {
1109 data.enforceInterface(IActivityManager.descriptor);
1110 Configuration config = getConfiguration();
1111 reply.writeNoException();
1112 config.writeToParcel(reply, 0);
1113 return true;
1114 }
1115
1116 case UPDATE_CONFIGURATION_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 Configuration config = Configuration.CREATOR.createFromParcel(data);
1119 updateConfiguration(config);
1120 reply.writeNoException();
1121 return true;
1122 }
1123
1124 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 IBinder token = data.readStrongBinder();
1127 int requestedOrientation = data.readInt();
1128 setRequestedOrientation(token, requestedOrientation);
1129 reply.writeNoException();
1130 return true;
1131 }
1132
1133 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 IBinder token = data.readStrongBinder();
1136 int req = getRequestedOrientation(token);
1137 reply.writeNoException();
1138 reply.writeInt(req);
1139 return true;
1140 }
1141
1142 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 IBinder token = data.readStrongBinder();
1145 ComponentName cn = getActivityClassForToken(token);
1146 reply.writeNoException();
1147 ComponentName.writeToParcel(cn, reply);
1148 return true;
1149 }
1150
1151 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 IBinder token = data.readStrongBinder();
1154 reply.writeNoException();
1155 reply.writeString(getPackageForToken(token));
1156 return true;
1157 }
1158
1159 case GET_INTENT_SENDER_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 int type = data.readInt();
1162 String packageName = data.readString();
1163 IBinder token = data.readStrongBinder();
1164 String resultWho = data.readString();
1165 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001166 Intent[] requestIntents;
1167 String[] requestResolvedTypes;
1168 if (data.readInt() != 0) {
1169 requestIntents = data.createTypedArray(Intent.CREATOR);
1170 requestResolvedTypes = data.createStringArray();
1171 } else {
1172 requestIntents = null;
1173 requestResolvedTypes = null;
1174 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001176 Bundle options = data.readInt() != 0
1177 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001178 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001179 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001180 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001181 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 reply.writeNoException();
1183 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1184 return true;
1185 }
1186
1187 case CANCEL_INTENT_SENDER_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 IIntentSender r = IIntentSender.Stub.asInterface(
1190 data.readStrongBinder());
1191 cancelIntentSender(r);
1192 reply.writeNoException();
1193 return true;
1194 }
1195
1196 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 IIntentSender r = IIntentSender.Stub.asInterface(
1199 data.readStrongBinder());
1200 String res = getPackageForIntentSender(r);
1201 reply.writeNoException();
1202 reply.writeString(res);
1203 return true;
1204 }
1205
Christopher Tatec4a07d12012-04-06 14:19:13 -07001206 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 IIntentSender r = IIntentSender.Stub.asInterface(
1209 data.readStrongBinder());
1210 int res = getUidForIntentSender(r);
1211 reply.writeNoException();
1212 reply.writeInt(res);
1213 return true;
1214 }
1215
Dianne Hackborn41203752012-08-31 14:05:51 -07001216 case HANDLE_INCOMING_USER_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 int callingPid = data.readInt();
1219 int callingUid = data.readInt();
1220 int userId = data.readInt();
1221 boolean allowAll = data.readInt() != 0 ;
1222 boolean requireFull = data.readInt() != 0;
1223 String name = data.readString();
1224 String callerPackage = data.readString();
1225 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1226 requireFull, name, callerPackage);
1227 reply.writeNoException();
1228 reply.writeInt(res);
1229 return true;
1230 }
1231
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001232 case SET_PROCESS_LIMIT_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 int max = data.readInt();
1235 setProcessLimit(max);
1236 reply.writeNoException();
1237 return true;
1238 }
1239
1240 case GET_PROCESS_LIMIT_TRANSACTION: {
1241 data.enforceInterface(IActivityManager.descriptor);
1242 int limit = getProcessLimit();
1243 reply.writeNoException();
1244 reply.writeInt(limit);
1245 return true;
1246 }
1247
1248 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 IBinder token = data.readStrongBinder();
1251 int pid = data.readInt();
1252 boolean isForeground = data.readInt() != 0;
1253 setProcessForeground(token, pid, isForeground);
1254 reply.writeNoException();
1255 return true;
1256 }
1257
1258 case CHECK_PERMISSION_TRANSACTION: {
1259 data.enforceInterface(IActivityManager.descriptor);
1260 String perm = data.readString();
1261 int pid = data.readInt();
1262 int uid = data.readInt();
1263 int res = checkPermission(perm, pid, uid);
1264 reply.writeNoException();
1265 reply.writeInt(res);
1266 return true;
1267 }
1268
Dianne Hackbornff170242014-11-19 10:59:01 -08001269 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1270 data.enforceInterface(IActivityManager.descriptor);
1271 String perm = data.readString();
1272 int pid = data.readInt();
1273 int uid = data.readInt();
1274 IBinder token = data.readStrongBinder();
1275 int res = checkPermissionWithToken(perm, pid, uid, token);
1276 reply.writeNoException();
1277 reply.writeInt(res);
1278 return true;
1279 }
1280
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001281 case CHECK_URI_PERMISSION_TRANSACTION: {
1282 data.enforceInterface(IActivityManager.descriptor);
1283 Uri uri = Uri.CREATOR.createFromParcel(data);
1284 int pid = data.readInt();
1285 int uid = data.readInt();
1286 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001287 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001288 IBinder callerToken = data.readStrongBinder();
1289 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001290 reply.writeNoException();
1291 reply.writeInt(res);
1292 return true;
1293 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001295 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001296 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001297 String packageName = data.readString();
1298 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1299 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001300 int userId = data.readInt();
1301 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001302 reply.writeNoException();
1303 reply.writeInt(res ? 1 : 0);
1304 return true;
1305 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001307 case GRANT_URI_PERMISSION_TRANSACTION: {
1308 data.enforceInterface(IActivityManager.descriptor);
1309 IBinder b = data.readStrongBinder();
1310 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1311 String targetPkg = data.readString();
1312 Uri uri = Uri.CREATOR.createFromParcel(data);
1313 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001314 int userId = data.readInt();
1315 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 reply.writeNoException();
1317 return true;
1318 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001319
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001320 case REVOKE_URI_PERMISSION_TRANSACTION: {
1321 data.enforceInterface(IActivityManager.descriptor);
1322 IBinder b = data.readStrongBinder();
1323 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1324 Uri uri = Uri.CREATOR.createFromParcel(data);
1325 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001326 int userId = data.readInt();
1327 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001328 reply.writeNoException();
1329 return true;
1330 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001331
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001332 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1333 data.enforceInterface(IActivityManager.descriptor);
1334 Uri uri = Uri.CREATOR.createFromParcel(data);
1335 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001336 int userId = data.readInt();
1337 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001338 reply.writeNoException();
1339 return true;
1340 }
1341
1342 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1343 data.enforceInterface(IActivityManager.descriptor);
1344 Uri uri = Uri.CREATOR.createFromParcel(data);
1345 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001346 int userId = data.readInt();
1347 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001348 reply.writeNoException();
1349 return true;
1350 }
1351
1352 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1353 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001354 final String packageName = data.readString();
1355 final boolean incoming = data.readInt() != 0;
1356 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1357 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001358 reply.writeNoException();
1359 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1360 return true;
1361 }
1362
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001363 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1364 data.enforceInterface(IActivityManager.descriptor);
1365 IBinder b = data.readStrongBinder();
1366 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1367 boolean waiting = data.readInt() != 0;
1368 showWaitingForDebugger(app, waiting);
1369 reply.writeNoException();
1370 return true;
1371 }
1372
1373 case GET_MEMORY_INFO_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
1375 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1376 getMemoryInfo(mi);
1377 reply.writeNoException();
1378 mi.writeToParcel(reply, 0);
1379 return true;
1380 }
1381
1382 case UNHANDLED_BACK_TRANSACTION: {
1383 data.enforceInterface(IActivityManager.descriptor);
1384 unhandledBack();
1385 reply.writeNoException();
1386 return true;
1387 }
1388
1389 case OPEN_CONTENT_URI_TRANSACTION: {
1390 data.enforceInterface(IActivityManager.descriptor);
1391 Uri uri = Uri.parse(data.readString());
1392 ParcelFileDescriptor pfd = openContentUri(uri);
1393 reply.writeNoException();
1394 if (pfd != null) {
1395 reply.writeInt(1);
1396 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1397 } else {
1398 reply.writeInt(0);
1399 }
1400 return true;
1401 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001402
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001403 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 setLockScreenShown(data.readInt() != 0);
1406 reply.writeNoException();
1407 return true;
1408 }
1409
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001410 case SET_DEBUG_APP_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 String pn = data.readString();
1413 boolean wfd = data.readInt() != 0;
1414 boolean per = data.readInt() != 0;
1415 setDebugApp(pn, wfd, per);
1416 reply.writeNoException();
1417 return true;
1418 }
1419
1420 case SET_ALWAYS_FINISH_TRANSACTION: {
1421 data.enforceInterface(IActivityManager.descriptor);
1422 boolean enabled = data.readInt() != 0;
1423 setAlwaysFinish(enabled);
1424 reply.writeNoException();
1425 return true;
1426 }
1427
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001428 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001429 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001430 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001431 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001432 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001433 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001434 return true;
1435 }
1436
1437 case ENTER_SAFE_MODE_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 enterSafeMode();
1440 reply.writeNoException();
1441 return true;
1442 }
1443
1444 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1445 data.enforceInterface(IActivityManager.descriptor);
1446 IIntentSender is = IIntentSender.Stub.asInterface(
1447 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001448 int sourceUid = data.readInt();
1449 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001450 String tag = data.readString();
1451 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1452 reply.writeNoException();
1453 return true;
1454 }
1455
1456 case NOTE_ALARM_START_TRANSACTION: {
1457 data.enforceInterface(IActivityManager.descriptor);
1458 IIntentSender is = IIntentSender.Stub.asInterface(
1459 data.readStrongBinder());
1460 int sourceUid = data.readInt();
1461 String tag = data.readString();
1462 noteAlarmStart(is, sourceUid, tag);
1463 reply.writeNoException();
1464 return true;
1465 }
1466
1467 case NOTE_ALARM_FINISH_TRANSACTION: {
1468 data.enforceInterface(IActivityManager.descriptor);
1469 IIntentSender is = IIntentSender.Stub.asInterface(
1470 data.readStrongBinder());
1471 int sourceUid = data.readInt();
1472 String tag = data.readString();
1473 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001474 reply.writeNoException();
1475 return true;
1476 }
1477
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001478 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001479 data.enforceInterface(IActivityManager.descriptor);
1480 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001481 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001482 boolean secure = data.readInt() != 0;
1483 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001484 reply.writeNoException();
1485 reply.writeInt(res ? 1 : 0);
1486 return true;
1487 }
1488
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001489 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1490 data.enforceInterface(IActivityManager.descriptor);
1491 String reason = data.readString();
1492 boolean res = killProcessesBelowForeground(reason);
1493 reply.writeNoException();
1494 reply.writeInt(res ? 1 : 0);
1495 return true;
1496 }
1497
Dan Egnor60d87622009-12-16 16:32:58 -08001498 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1499 data.enforceInterface(IActivityManager.descriptor);
1500 IBinder app = data.readStrongBinder();
1501 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1502 handleApplicationCrash(app, ci);
1503 reply.writeNoException();
1504 return true;
1505 }
1506
1507 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001508 data.enforceInterface(IActivityManager.descriptor);
1509 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001510 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001511 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001512 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001513 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001514 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001515 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001516 return true;
1517 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001518
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001519 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1520 data.enforceInterface(IActivityManager.descriptor);
1521 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001522 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001523 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1524 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001525 reply.writeNoException();
1526 return true;
1527 }
1528
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001529 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 int sig = data.readInt();
1532 signalPersistentProcesses(sig);
1533 reply.writeNoException();
1534 return true;
1535 }
1536
Dianne Hackborn03abb812010-01-04 18:43:19 -08001537 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001539 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001540 int userId = data.readInt();
1541 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001542 reply.writeNoException();
1543 return true;
1544 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001545
1546 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 killAllBackgroundProcesses();
1549 reply.writeNoException();
1550 return true;
1551 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001552
Dianne Hackborn03abb812010-01-04 18:43:19 -08001553 case FORCE_STOP_PACKAGE_TRANSACTION: {
1554 data.enforceInterface(IActivityManager.descriptor);
1555 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001556 int userId = data.readInt();
1557 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001558 reply.writeNoException();
1559 return true;
1560 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001561
1562 case GET_MY_MEMORY_STATE_TRANSACTION: {
1563 data.enforceInterface(IActivityManager.descriptor);
1564 ActivityManager.RunningAppProcessInfo info =
1565 new ActivityManager.RunningAppProcessInfo();
1566 getMyMemoryState(info);
1567 reply.writeNoException();
1568 info.writeToParcel(reply, 0);
1569 return true;
1570 }
1571
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001572 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 ConfigurationInfo config = getDeviceConfigurationInfo();
1575 reply.writeNoException();
1576 config.writeToParcel(reply, 0);
1577 return true;
1578 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001579
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001580 case PROFILE_CONTROL_TRANSACTION: {
1581 data.enforceInterface(IActivityManager.descriptor);
1582 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001583 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001584 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001585 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001586 ProfilerInfo profilerInfo = data.readInt() != 0
1587 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1588 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001589 reply.writeNoException();
1590 reply.writeInt(res ? 1 : 0);
1591 return true;
1592 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001593
Dianne Hackborn55280a92009-05-07 15:53:46 -07001594 case SHUTDOWN_TRANSACTION: {
1595 data.enforceInterface(IActivityManager.descriptor);
1596 boolean res = shutdown(data.readInt());
1597 reply.writeNoException();
1598 reply.writeInt(res ? 1 : 0);
1599 return true;
1600 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001601
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001602 case STOP_APP_SWITCHES_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 stopAppSwitches();
1605 reply.writeNoException();
1606 return true;
1607 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001608
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001609 case RESUME_APP_SWITCHES_TRANSACTION: {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 resumeAppSwitches();
1612 reply.writeNoException();
1613 return true;
1614 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001615
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001616 case PEEK_SERVICE_TRANSACTION: {
1617 data.enforceInterface(IActivityManager.descriptor);
1618 Intent service = Intent.CREATOR.createFromParcel(data);
1619 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001620 String callingPackage = data.readString();
1621 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001622 reply.writeNoException();
1623 reply.writeStrongBinder(binder);
1624 return true;
1625 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001626
Christopher Tate181fafa2009-05-14 11:12:14 -07001627 case START_BACKUP_AGENT_TRANSACTION: {
1628 data.enforceInterface(IActivityManager.descriptor);
1629 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1630 int backupRestoreMode = data.readInt();
1631 boolean success = bindBackupAgent(info, backupRestoreMode);
1632 reply.writeNoException();
1633 reply.writeInt(success ? 1 : 0);
1634 return true;
1635 }
1636
1637 case BACKUP_AGENT_CREATED_TRANSACTION: {
1638 data.enforceInterface(IActivityManager.descriptor);
1639 String packageName = data.readString();
1640 IBinder agent = data.readStrongBinder();
1641 backupAgentCreated(packageName, agent);
1642 reply.writeNoException();
1643 return true;
1644 }
1645
1646 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1647 data.enforceInterface(IActivityManager.descriptor);
1648 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1649 unbindBackupAgent(info);
1650 reply.writeNoException();
1651 return true;
1652 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001653
1654 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 String packageName = data.readString();
1657 addPackageDependency(packageName);
1658 reply.writeNoException();
1659 return true;
1660 }
1661
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001662 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001663 data.enforceInterface(IActivityManager.descriptor);
1664 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001665 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001666 String reason = data.readString();
1667 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001668 reply.writeNoException();
1669 return true;
1670 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001671
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001672 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 String reason = data.readString();
1675 closeSystemDialogs(reason);
1676 reply.writeNoException();
1677 return true;
1678 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001679
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001680 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1681 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001682 int[] pids = data.createIntArray();
1683 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001684 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001685 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001686 return true;
1687 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001688
1689 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1690 data.enforceInterface(IActivityManager.descriptor);
1691 String processName = data.readString();
1692 int uid = data.readInt();
1693 killApplicationProcess(processName, uid);
1694 reply.writeNoException();
1695 return true;
1696 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001697
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001698 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1699 data.enforceInterface(IActivityManager.descriptor);
1700 IBinder token = data.readStrongBinder();
1701 String packageName = data.readString();
1702 int enterAnim = data.readInt();
1703 int exitAnim = data.readInt();
1704 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001705 reply.writeNoException();
1706 return true;
1707 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001708
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001709 case IS_USER_A_MONKEY_TRANSACTION: {
1710 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001711 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001712 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001713 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001714 return true;
1715 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001716
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001717 case SET_USER_IS_MONKEY_TRANSACTION: {
1718 data.enforceInterface(IActivityManager.descriptor);
1719 final boolean monkey = (data.readInt() == 1);
1720 setUserIsMonkey(monkey);
1721 reply.writeNoException();
1722 return true;
1723 }
1724
Dianne Hackborn860755f2010-06-03 18:47:52 -07001725 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 finishHeavyWeightApp();
1728 reply.writeNoException();
1729 return true;
1730 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001731
1732 case IS_IMMERSIVE_TRANSACTION: {
1733 data.enforceInterface(IActivityManager.descriptor);
1734 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001735 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001736 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001737 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001738 return true;
1739 }
1740
Craig Mautnerd61dc202014-07-07 11:09:11 -07001741 case IS_TOP_OF_TASK_TRANSACTION: {
1742 data.enforceInterface(IActivityManager.descriptor);
1743 IBinder token = data.readStrongBinder();
1744 final boolean isTopOfTask = isTopOfTask(token);
1745 reply.writeNoException();
1746 reply.writeInt(isTopOfTask ? 1 : 0);
1747 return true;
1748 }
1749
Craig Mautner5eda9b32013-07-02 11:58:16 -07001750 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001751 data.enforceInterface(IActivityManager.descriptor);
1752 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001753 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001754 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001755 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001756 return true;
1757 }
1758
1759 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1760 data.enforceInterface(IActivityManager.descriptor);
1761 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001762 final Bundle bundle;
1763 if (data.readInt() == 0) {
1764 bundle = null;
1765 } else {
1766 bundle = data.readBundle();
1767 }
1768 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1769 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001770 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001771 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001772 return true;
1773 }
1774
Craig Mautner233ceee2014-05-09 17:05:11 -07001775 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1776 data.enforceInterface(IActivityManager.descriptor);
1777 IBinder token = data.readStrongBinder();
1778 final ActivityOptions options = getActivityOptions(token);
1779 reply.writeNoException();
1780 reply.writeBundle(options == null ? null : options.toBundle());
1781 return true;
1782 }
1783
Daniel Sandler69a48172010-06-23 16:29:36 -04001784 case SET_IMMERSIVE_TRANSACTION: {
1785 data.enforceInterface(IActivityManager.descriptor);
1786 IBinder token = data.readStrongBinder();
1787 boolean imm = data.readInt() == 1;
1788 setImmersive(token, imm);
1789 reply.writeNoException();
1790 return true;
1791 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001792
Daniel Sandler69a48172010-06-23 16:29:36 -04001793 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1794 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001795 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001796 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001797 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001798 return true;
1799 }
1800
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001801 case CRASH_APPLICATION_TRANSACTION: {
1802 data.enforceInterface(IActivityManager.descriptor);
1803 int uid = data.readInt();
1804 int initialPid = data.readInt();
1805 String packageName = data.readString();
1806 String message = data.readString();
1807 crashApplication(uid, initialPid, packageName, message);
1808 reply.writeNoException();
1809 return true;
1810 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001811
1812 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1813 data.enforceInterface(IActivityManager.descriptor);
1814 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001815 int userId = data.readInt();
1816 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001817 reply.writeNoException();
1818 reply.writeString(type);
1819 return true;
1820 }
1821
Dianne Hackborn7e269642010-08-25 19:50:20 -07001822 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1823 data.enforceInterface(IActivityManager.descriptor);
1824 String name = data.readString();
1825 IBinder perm = newUriPermissionOwner(name);
1826 reply.writeNoException();
1827 reply.writeStrongBinder(perm);
1828 return true;
1829 }
1830
1831 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1832 data.enforceInterface(IActivityManager.descriptor);
1833 IBinder owner = data.readStrongBinder();
1834 int fromUid = data.readInt();
1835 String targetPkg = data.readString();
1836 Uri uri = Uri.CREATOR.createFromParcel(data);
1837 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001838 int sourceUserId = data.readInt();
1839 int targetUserId = data.readInt();
1840 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1841 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001842 reply.writeNoException();
1843 return true;
1844 }
1845
1846 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 IBinder owner = data.readStrongBinder();
1849 Uri uri = null;
1850 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001851 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001852 }
1853 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001854 int userId = data.readInt();
1855 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001856 reply.writeNoException();
1857 return true;
1858 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001859
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001860 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1861 data.enforceInterface(IActivityManager.descriptor);
1862 int callingUid = data.readInt();
1863 String targetPkg = data.readString();
1864 Uri uri = Uri.CREATOR.createFromParcel(data);
1865 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001866 int userId = data.readInt();
1867 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001868 reply.writeNoException();
1869 reply.writeInt(res);
1870 return true;
1871 }
1872
Andy McFadden824c5102010-07-09 16:26:57 -07001873 case DUMP_HEAP_TRANSACTION: {
1874 data.enforceInterface(IActivityManager.descriptor);
1875 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001876 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001877 boolean managed = data.readInt() != 0;
1878 String path = data.readString();
1879 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001880 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001881 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001882 reply.writeNoException();
1883 reply.writeInt(res ? 1 : 0);
1884 return true;
1885 }
1886
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001887 case START_ACTIVITIES_TRANSACTION:
1888 {
1889 data.enforceInterface(IActivityManager.descriptor);
1890 IBinder b = data.readStrongBinder();
1891 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001892 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001893 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1894 String[] resolvedTypes = data.createStringArray();
1895 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001896 Bundle options = data.readInt() != 0
1897 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001898 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001899 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001900 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001901 reply.writeNoException();
1902 reply.writeInt(result);
1903 return true;
1904 }
1905
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001906 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1907 {
1908 data.enforceInterface(IActivityManager.descriptor);
1909 int mode = getFrontActivityScreenCompatMode();
1910 reply.writeNoException();
1911 reply.writeInt(mode);
1912 return true;
1913 }
1914
1915 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1916 {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 int mode = data.readInt();
1919 setFrontActivityScreenCompatMode(mode);
1920 reply.writeNoException();
1921 reply.writeInt(mode);
1922 return true;
1923 }
1924
1925 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1926 {
1927 data.enforceInterface(IActivityManager.descriptor);
1928 String pkg = data.readString();
1929 int mode = getPackageScreenCompatMode(pkg);
1930 reply.writeNoException();
1931 reply.writeInt(mode);
1932 return true;
1933 }
1934
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001935 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1936 {
1937 data.enforceInterface(IActivityManager.descriptor);
1938 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001939 int mode = data.readInt();
1940 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001941 reply.writeNoException();
1942 return true;
1943 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001944
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001945 case SWITCH_USER_TRANSACTION: {
1946 data.enforceInterface(IActivityManager.descriptor);
1947 int userid = data.readInt();
1948 boolean result = switchUser(userid);
1949 reply.writeNoException();
1950 reply.writeInt(result ? 1 : 0);
1951 return true;
1952 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001953
Kenny Guy08488bf2014-02-21 17:40:37 +00001954 case START_USER_IN_BACKGROUND_TRANSACTION: {
1955 data.enforceInterface(IActivityManager.descriptor);
1956 int userid = data.readInt();
1957 boolean result = startUserInBackground(userid);
1958 reply.writeNoException();
1959 reply.writeInt(result ? 1 : 0);
1960 return true;
1961 }
1962
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001963 case STOP_USER_TRANSACTION: {
1964 data.enforceInterface(IActivityManager.descriptor);
1965 int userid = data.readInt();
1966 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1967 data.readStrongBinder());
1968 int result = stopUser(userid, callback);
1969 reply.writeNoException();
1970 reply.writeInt(result);
1971 return true;
1972 }
1973
Amith Yamasani52f1d752012-03-28 18:19:29 -07001974 case GET_CURRENT_USER_TRANSACTION: {
1975 data.enforceInterface(IActivityManager.descriptor);
1976 UserInfo userInfo = getCurrentUser();
1977 reply.writeNoException();
1978 userInfo.writeToParcel(reply, 0);
1979 return true;
1980 }
1981
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001982 case IS_USER_RUNNING_TRANSACTION: {
1983 data.enforceInterface(IActivityManager.descriptor);
1984 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001985 boolean orStopping = data.readInt() != 0;
1986 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001987 reply.writeNoException();
1988 reply.writeInt(result ? 1 : 0);
1989 return true;
1990 }
1991
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001992 case GET_RUNNING_USER_IDS_TRANSACTION: {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 int[] result = getRunningUserIds();
1995 reply.writeNoException();
1996 reply.writeIntArray(result);
1997 return true;
1998 }
1999
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002000 case REMOVE_TASK_TRANSACTION:
2001 {
2002 data.enforceInterface(IActivityManager.descriptor);
2003 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002004 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002005 reply.writeNoException();
2006 reply.writeInt(result ? 1 : 0);
2007 return true;
2008 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002009
Jeff Sharkeya4620792011-05-20 15:29:23 -07002010 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2011 data.enforceInterface(IActivityManager.descriptor);
2012 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2013 data.readStrongBinder());
2014 registerProcessObserver(observer);
2015 return true;
2016 }
2017
2018 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2021 data.readStrongBinder());
2022 unregisterProcessObserver(observer);
2023 return true;
2024 }
2025
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002026 case REGISTER_UID_OBSERVER_TRANSACTION: {
2027 data.enforceInterface(IActivityManager.descriptor);
2028 IUidObserver observer = IUidObserver.Stub.asInterface(
2029 data.readStrongBinder());
2030 registerUidObserver(observer);
2031 return true;
2032 }
2033
2034 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2035 data.enforceInterface(IActivityManager.descriptor);
2036 IUidObserver observer = IUidObserver.Stub.asInterface(
2037 data.readStrongBinder());
2038 unregisterUidObserver(observer);
2039 return true;
2040 }
2041
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002042 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2043 {
2044 data.enforceInterface(IActivityManager.descriptor);
2045 String pkg = data.readString();
2046 boolean ask = getPackageAskScreenCompat(pkg);
2047 reply.writeNoException();
2048 reply.writeInt(ask ? 1 : 0);
2049 return true;
2050 }
2051
2052 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2053 {
2054 data.enforceInterface(IActivityManager.descriptor);
2055 String pkg = data.readString();
2056 boolean ask = data.readInt() != 0;
2057 setPackageAskScreenCompat(pkg, ask);
2058 reply.writeNoException();
2059 return true;
2060 }
2061
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002062 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2063 data.enforceInterface(IActivityManager.descriptor);
2064 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002065 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002066 boolean res = isIntentSenderTargetedToPackage(r);
2067 reply.writeNoException();
2068 reply.writeInt(res ? 1 : 0);
2069 return true;
2070 }
2071
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002072 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2073 data.enforceInterface(IActivityManager.descriptor);
2074 IIntentSender r = IIntentSender.Stub.asInterface(
2075 data.readStrongBinder());
2076 boolean res = isIntentSenderAnActivity(r);
2077 reply.writeNoException();
2078 reply.writeInt(res ? 1 : 0);
2079 return true;
2080 }
2081
Dianne Hackborn81038902012-11-26 17:04:09 -08002082 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2083 data.enforceInterface(IActivityManager.descriptor);
2084 IIntentSender r = IIntentSender.Stub.asInterface(
2085 data.readStrongBinder());
2086 Intent intent = getIntentForIntentSender(r);
2087 reply.writeNoException();
2088 if (intent != null) {
2089 reply.writeInt(1);
2090 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2091 } else {
2092 reply.writeInt(0);
2093 }
2094 return true;
2095 }
2096
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002097 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2098 data.enforceInterface(IActivityManager.descriptor);
2099 IIntentSender r = IIntentSender.Stub.asInterface(
2100 data.readStrongBinder());
2101 String prefix = data.readString();
2102 String tag = getTagForIntentSender(r, prefix);
2103 reply.writeNoException();
2104 reply.writeString(tag);
2105 return true;
2106 }
2107
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002108 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2109 data.enforceInterface(IActivityManager.descriptor);
2110 Configuration config = Configuration.CREATOR.createFromParcel(data);
2111 updatePersistentConfiguration(config);
2112 reply.writeNoException();
2113 return true;
2114 }
2115
Dianne Hackbornb437e092011-08-05 17:50:29 -07002116 case GET_PROCESS_PSS_TRANSACTION: {
2117 data.enforceInterface(IActivityManager.descriptor);
2118 int[] pids = data.createIntArray();
2119 long[] pss = getProcessPss(pids);
2120 reply.writeNoException();
2121 reply.writeLongArray(pss);
2122 return true;
2123 }
2124
Dianne Hackborn661cd522011-08-22 00:26:20 -07002125 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2126 data.enforceInterface(IActivityManager.descriptor);
2127 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2128 boolean always = data.readInt() != 0;
2129 showBootMessage(msg, always);
2130 reply.writeNoException();
2131 return true;
2132 }
2133
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002134 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002135 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002136 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002137 reply.writeNoException();
2138 return true;
2139 }
2140
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002141 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2142 data.enforceInterface(IActivityManager.descriptor);
2143 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2144 reply.writeNoException();
2145 return true;
2146 }
2147
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002148 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002149 data.enforceInterface(IActivityManager.descriptor);
2150 IBinder token = data.readStrongBinder();
2151 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002152 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002153 reply.writeNoException();
2154 reply.writeInt(res ? 1 : 0);
2155 return true;
2156 }
2157
2158 case NAVIGATE_UP_TO_TRANSACTION: {
2159 data.enforceInterface(IActivityManager.descriptor);
2160 IBinder token = data.readStrongBinder();
2161 Intent target = Intent.CREATOR.createFromParcel(data);
2162 int resultCode = data.readInt();
2163 Intent resultData = null;
2164 if (data.readInt() != 0) {
2165 resultData = Intent.CREATOR.createFromParcel(data);
2166 }
2167 boolean res = navigateUpTo(token, target, resultCode, resultData);
2168 reply.writeNoException();
2169 reply.writeInt(res ? 1 : 0);
2170 return true;
2171 }
2172
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002173 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2174 data.enforceInterface(IActivityManager.descriptor);
2175 IBinder token = data.readStrongBinder();
2176 int res = getLaunchedFromUid(token);
2177 reply.writeNoException();
2178 reply.writeInt(res);
2179 return true;
2180 }
2181
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002182 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2183 data.enforceInterface(IActivityManager.descriptor);
2184 IBinder token = data.readStrongBinder();
2185 String res = getLaunchedFromPackage(token);
2186 reply.writeNoException();
2187 reply.writeString(res);
2188 return true;
2189 }
2190
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002191 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2192 data.enforceInterface(IActivityManager.descriptor);
2193 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2194 data.readStrongBinder());
2195 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002196 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002197 return true;
2198 }
2199
2200 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2201 data.enforceInterface(IActivityManager.descriptor);
2202 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2203 data.readStrongBinder());
2204 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002205 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002206 return true;
2207 }
2208
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002209 case REQUEST_BUG_REPORT_TRANSACTION: {
2210 data.enforceInterface(IActivityManager.descriptor);
2211 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002212 reply.writeNoException();
2213 return true;
2214 }
2215
2216 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2217 data.enforceInterface(IActivityManager.descriptor);
2218 int pid = data.readInt();
2219 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002220 String reason = data.readString();
2221 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002222 reply.writeNoException();
2223 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002224 return true;
2225 }
2226
Adam Skorydfc7fd72013-08-05 19:23:41 -07002227 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002228 data.enforceInterface(IActivityManager.descriptor);
2229 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002230 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002231 reply.writeNoException();
2232 reply.writeBundle(res);
2233 return true;
2234 }
2235
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002236 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 int requestType = data.readInt();
2239 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002240 IBinder activityToken = data.readStrongBinder();
2241 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002242 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002243 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002244 return true;
2245 }
2246
Adam Skorydfc7fd72013-08-05 19:23:41 -07002247 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002248 data.enforceInterface(IActivityManager.descriptor);
2249 IBinder token = data.readStrongBinder();
2250 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002251 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2252 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002253 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2254 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002255 reply.writeNoException();
2256 return true;
2257 }
2258
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002259 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2260 data.enforceInterface(IActivityManager.descriptor);
2261 Intent intent = Intent.CREATOR.createFromParcel(data);
2262 int requestType = data.readInt();
2263 String hint = data.readString();
2264 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002265 Bundle args = data.readBundle();
2266 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002267 reply.writeNoException();
2268 reply.writeInt(res ? 1 : 0);
2269 return true;
2270 }
2271
Benjamin Franzc200f442015-06-25 18:20:04 +01002272 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2273 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002274 boolean res = isAssistDataAllowedOnCurrentActivity();
2275 reply.writeNoException();
2276 reply.writeInt(res ? 1 : 0);
2277 return true;
2278 }
2279
2280 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2281 data.enforceInterface(IActivityManager.descriptor);
2282 IBinder token = data.readStrongBinder();
2283 Bundle args = data.readBundle();
2284 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002285 reply.writeNoException();
2286 reply.writeInt(res ? 1 : 0);
2287 return true;
2288 }
2289
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002290 case KILL_UID_TRANSACTION: {
2291 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002292 int appId = data.readInt();
2293 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002294 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002295 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002296 reply.writeNoException();
2297 return true;
2298 }
2299
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002300 case HANG_TRANSACTION: {
2301 data.enforceInterface(IActivityManager.descriptor);
2302 IBinder who = data.readStrongBinder();
2303 boolean allowRestart = data.readInt() != 0;
2304 hang(who, allowRestart);
2305 reply.writeNoException();
2306 return true;
2307 }
2308
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002309 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2310 data.enforceInterface(IActivityManager.descriptor);
2311 IBinder token = data.readStrongBinder();
2312 reportActivityFullyDrawn(token);
2313 reply.writeNoException();
2314 return true;
2315 }
2316
Craig Mautner5eda9b32013-07-02 11:58:16 -07002317 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2318 data.enforceInterface(IActivityManager.descriptor);
2319 IBinder token = data.readStrongBinder();
2320 notifyActivityDrawn(token);
2321 reply.writeNoException();
2322 return true;
2323 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002324
2325 case RESTART_TRANSACTION: {
2326 data.enforceInterface(IActivityManager.descriptor);
2327 restart();
2328 reply.writeNoException();
2329 return true;
2330 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002331
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002332 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2333 data.enforceInterface(IActivityManager.descriptor);
2334 performIdleMaintenance();
2335 reply.writeNoException();
2336 return true;
2337 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002338
Todd Kennedyca4d8422015-01-15 15:19:22 -08002339 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002340 data.enforceInterface(IActivityManager.descriptor);
2341 IBinder parentActivityToken = data.readStrongBinder();
2342 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002343 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002344 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002345 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002346 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002347 if (activityContainer != null) {
2348 reply.writeInt(1);
2349 reply.writeStrongBinder(activityContainer.asBinder());
2350 } else {
2351 reply.writeInt(0);
2352 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002353 return true;
2354 }
2355
Craig Mautner95da1082014-02-24 17:54:35 -08002356 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2357 data.enforceInterface(IActivityManager.descriptor);
2358 IActivityContainer activityContainer =
2359 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2360 deleteActivityContainer(activityContainer);
2361 reply.writeNoException();
2362 return true;
2363 }
2364
Todd Kennedy4900bf92015-01-16 16:05:14 -08002365 case CREATE_STACK_ON_DISPLAY: {
2366 data.enforceInterface(IActivityManager.descriptor);
2367 int displayId = data.readInt();
2368 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2369 reply.writeNoException();
2370 if (activityContainer != null) {
2371 reply.writeInt(1);
2372 reply.writeStrongBinder(activityContainer.asBinder());
2373 } else {
2374 reply.writeInt(0);
2375 }
2376 return true;
2377 }
2378
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002379 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002380 data.enforceInterface(IActivityManager.descriptor);
2381 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002382 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002383 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002384 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002385 return true;
2386 }
2387
Craig Mautneraea74a52014-03-08 14:23:10 -08002388 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2389 data.enforceInterface(IActivityManager.descriptor);
2390 final int taskId = data.readInt();
2391 startLockTaskMode(taskId);
2392 reply.writeNoException();
2393 return true;
2394 }
2395
2396 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2397 data.enforceInterface(IActivityManager.descriptor);
2398 IBinder token = data.readStrongBinder();
2399 startLockTaskMode(token);
2400 reply.writeNoException();
2401 return true;
2402 }
2403
Craig Mautnerd61dc202014-07-07 11:09:11 -07002404 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002405 data.enforceInterface(IActivityManager.descriptor);
2406 startLockTaskModeOnCurrent();
2407 reply.writeNoException();
2408 return true;
2409 }
2410
Craig Mautneraea74a52014-03-08 14:23:10 -08002411 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2412 data.enforceInterface(IActivityManager.descriptor);
2413 stopLockTaskMode();
2414 reply.writeNoException();
2415 return true;
2416 }
2417
Craig Mautnerd61dc202014-07-07 11:09:11 -07002418 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002419 data.enforceInterface(IActivityManager.descriptor);
2420 stopLockTaskModeOnCurrent();
2421 reply.writeNoException();
2422 return true;
2423 }
2424
Craig Mautneraea74a52014-03-08 14:23:10 -08002425 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2426 data.enforceInterface(IActivityManager.descriptor);
2427 final boolean isInLockTaskMode = isInLockTaskMode();
2428 reply.writeNoException();
2429 reply.writeInt(isInLockTaskMode ? 1 : 0);
2430 return true;
2431 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002432
Benjamin Franz43261142015-02-11 15:59:44 +00002433 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2434 data.enforceInterface(IActivityManager.descriptor);
2435 final int lockTaskModeState = getLockTaskModeState();
2436 reply.writeNoException();
2437 reply.writeInt(lockTaskModeState);
2438 return true;
2439 }
2440
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002441 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2442 data.enforceInterface(IActivityManager.descriptor);
2443 final IBinder token = data.readStrongBinder();
2444 showLockTaskEscapeMessage(token);
2445 reply.writeNoException();
2446 return true;
2447 }
2448
Winson Chunga449dc02014-05-16 11:15:04 -07002449 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002450 data.enforceInterface(IActivityManager.descriptor);
2451 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002452 ActivityManager.TaskDescription values =
2453 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2454 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002455 reply.writeNoException();
2456 return true;
2457 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002458
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002459 case SET_TASK_RESIZEABLE_TRANSACTION: {
2460 data.enforceInterface(IActivityManager.descriptor);
2461 int taskId = data.readInt();
2462 boolean resizeable = (data.readInt() == 1) ? true : false;
2463 setTaskResizeable(taskId, resizeable);
2464 reply.writeNoException();
2465 return true;
2466 }
2467
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002468 case RESIZE_TASK_TRANSACTION: {
2469 data.enforceInterface(IActivityManager.descriptor);
2470 int taskId = data.readInt();
2471 Rect r = Rect.CREATOR.createFromParcel(data);
2472 resizeTask(taskId, r);
2473 reply.writeNoException();
2474 return true;
2475 }
2476
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002477 case GET_TASK_BOUNDS_TRANSACTION: {
2478 data.enforceInterface(IActivityManager.descriptor);
2479 int taskId = data.readInt();
2480 Rect r = getTaskBounds(taskId);
2481 reply.writeNoException();
2482 r.writeToParcel(reply, 0);
2483 return true;
2484 }
2485
Craig Mautner648f69b2014-09-18 14:16:26 -07002486 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2487 data.enforceInterface(IActivityManager.descriptor);
2488 String filename = data.readString();
2489 Bitmap icon = getTaskDescriptionIcon(filename);
2490 reply.writeNoException();
2491 if (icon == null) {
2492 reply.writeInt(0);
2493 } else {
2494 reply.writeInt(1);
2495 icon.writeToParcel(reply, 0);
2496 }
2497 return true;
2498 }
2499
Winson Chung044d5292014-11-06 11:05:19 -08002500 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2501 data.enforceInterface(IActivityManager.descriptor);
2502 final Bundle bundle;
2503 if (data.readInt() == 0) {
2504 bundle = null;
2505 } else {
2506 bundle = data.readBundle();
2507 }
2508 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2509 startInPlaceAnimationOnFrontMostApplication(options);
2510 reply.writeNoException();
2511 return true;
2512 }
2513
Jose Lima4b6c6692014-08-12 17:41:12 -07002514 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002515 data.enforceInterface(IActivityManager.descriptor);
2516 IBinder token = data.readStrongBinder();
2517 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002518 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002519 reply.writeNoException();
2520 reply.writeInt(success ? 1 : 0);
2521 return true;
2522 }
2523
Jose Lima4b6c6692014-08-12 17:41:12 -07002524 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002525 data.enforceInterface(IActivityManager.descriptor);
2526 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002527 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002528 reply.writeNoException();
2529 reply.writeInt(enabled ? 1 : 0);
2530 return true;
2531 }
2532
Jose Lima4b6c6692014-08-12 17:41:12 -07002533 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002534 data.enforceInterface(IActivityManager.descriptor);
2535 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002536 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002537 reply.writeNoException();
2538 return true;
2539 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002540
2541 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2542 data.enforceInterface(IActivityManager.descriptor);
2543 IBinder token = data.readStrongBinder();
2544 notifyLaunchTaskBehindComplete(token);
2545 reply.writeNoException();
2546 return true;
2547 }
Craig Mautner8746a472014-07-24 15:12:54 -07002548
2549 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2550 data.enforceInterface(IActivityManager.descriptor);
2551 IBinder token = data.readStrongBinder();
2552 notifyEnterAnimationComplete(token);
2553 reply.writeNoException();
2554 return true;
2555 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002556
2557 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2558 data.enforceInterface(IActivityManager.descriptor);
2559 bootAnimationComplete();
2560 reply.writeNoException();
2561 return true;
2562 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002563
Jeff Sharkey605eb792014-11-04 13:34:06 -08002564 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2565 data.enforceInterface(IActivityManager.descriptor);
2566 final int uid = data.readInt();
2567 final byte[] firstPacket = data.createByteArray();
2568 notifyCleartextNetwork(uid, firstPacket);
2569 reply.writeNoException();
2570 return true;
2571 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002572
2573 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2574 data.enforceInterface(IActivityManager.descriptor);
2575 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002576 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002577 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002578 String reportPackage = data.readString();
2579 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002580 reply.writeNoException();
2581 return true;
2582 }
2583
2584 case DUMP_HEAP_FINISHED_TRANSACTION: {
2585 data.enforceInterface(IActivityManager.descriptor);
2586 String path = data.readString();
2587 dumpHeapFinished(path);
2588 reply.writeNoException();
2589 return true;
2590 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002591
2592 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2593 data.enforceInterface(IActivityManager.descriptor);
2594 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2595 data.readStrongBinder());
2596 boolean keepAwake = data.readInt() != 0;
2597 setVoiceKeepAwake(session, keepAwake);
2598 reply.writeNoException();
2599 return true;
2600 }
Craig Mautnere5600772015-04-03 21:36:37 -07002601
2602 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2603 data.enforceInterface(IActivityManager.descriptor);
2604 int userId = data.readInt();
2605 String[] packages = data.readStringArray();
2606 updateLockTaskPackages(userId, packages);
2607 reply.writeNoException();
2608 return true;
2609 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002610
Craig Mautner015c5e52015-04-23 10:39:39 -07002611 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2612 data.enforceInterface(IActivityManager.descriptor);
2613 String packageName = data.readString();
2614 updateDeviceOwner(packageName);
2615 reply.writeNoException();
2616 return true;
2617 }
2618
Dianne Hackborn1e383822015-04-10 14:02:33 -07002619 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2620 data.enforceInterface(IActivityManager.descriptor);
2621 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002622 String callingPackage = data.readString();
2623 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002624 reply.writeNoException();
2625 reply.writeInt(res);
2626 return true;
2627 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002628
2629 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2630 data.enforceInterface(IActivityManager.descriptor);
2631 String process = data.readString();
2632 int userId = data.readInt();
2633 int level = data.readInt();
2634 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2635 reply.writeNoException();
2636 reply.writeInt(res ? 1 : 0);
2637 return true;
2638 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002639
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002640 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2641 data.enforceInterface(IActivityManager.descriptor);
2642 IBinder token = data.readStrongBinder();
2643 boolean res = isRootVoiceInteraction(token);
2644 reply.writeNoException();
2645 reply.writeInt(res ? 1 : 0);
2646 return true;
2647 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002648
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002649 case START_BINDER_TRACKING_TRANSACTION: {
2650 data.enforceInterface(IActivityManager.descriptor);
2651 boolean res = startBinderTracking();
2652 reply.writeNoException();
2653 reply.writeInt(res ? 1 : 0);
2654 return true;
2655 }
2656
2657 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2658 data.enforceInterface(IActivityManager.descriptor);
2659 ParcelFileDescriptor fd = data.readInt() != 0
2660 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2661 boolean res = stopBinderTrackingAndDump(fd);
2662 reply.writeNoException();
2663 reply.writeInt(res ? 1 : 0);
2664 return true;
2665 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002666 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2667 data.enforceInterface(IActivityManager.descriptor);
2668 IBinder token = data.readStrongBinder();
2669 int stackId = getActivityStackId(token);
2670 reply.writeNoException();
2671 reply.writeInt(stackId);
2672 return true;
2673 }
2674 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2675 data.enforceInterface(IActivityManager.descriptor);
2676 IBinder token = data.readStrongBinder();
2677 int stackId = data.readInt();
2678 moveActivityToStack(token, stackId);
2679 reply.writeNoException();
2680 return true;
2681 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002682 case REPORT_SIZE_CONFIGURATIONS: {
2683 data.enforceInterface(IActivityManager.descriptor);
2684 IBinder token = data.readStrongBinder();
2685 int horizontalSize = data.readInt();
2686 int[] horizontal = null;
2687 if (horizontalSize > 0) {
2688 horizontal = new int[horizontalSize];
2689 data.readIntArray(horizontal);
2690 }
2691 int[] vertical = null;
2692 int verticalSize = data.readInt();
2693 if (verticalSize > 0) {
2694 vertical = new int[verticalSize];
2695 data.readIntArray(vertical);
2696 }
2697 reportSizeConfigurations(token, horizontal, vertical);
2698 return true;
2699 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002700 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002701
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002702 return super.onTransact(code, data, reply, flags);
2703 }
2704
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002705 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002706 return this;
2707 }
2708
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002709 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2710 protected IActivityManager create() {
2711 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002712 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002713 Log.v("ActivityManager", "default service binder = " + b);
2714 }
2715 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002716 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002717 Log.v("ActivityManager", "default service = " + am);
2718 }
2719 return am;
2720 }
2721 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002722}
2723
2724class ActivityManagerProxy implements IActivityManager
2725{
2726 public ActivityManagerProxy(IBinder remote)
2727 {
2728 mRemote = remote;
2729 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002730
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002731 public IBinder asBinder()
2732 {
2733 return mRemote;
2734 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002735
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002736 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002737 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002738 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002739 Parcel data = Parcel.obtain();
2740 Parcel reply = Parcel.obtain();
2741 data.writeInterfaceToken(IActivityManager.descriptor);
2742 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002743 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002744 intent.writeToParcel(data, 0);
2745 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 data.writeStrongBinder(resultTo);
2747 data.writeString(resultWho);
2748 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002749 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002750 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002751 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002752 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002753 } else {
2754 data.writeInt(0);
2755 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002756 if (options != null) {
2757 data.writeInt(1);
2758 options.writeToParcel(data, 0);
2759 } else {
2760 data.writeInt(0);
2761 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002762 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2763 reply.readException();
2764 int result = reply.readInt();
2765 reply.recycle();
2766 data.recycle();
2767 return result;
2768 }
Amith Yamasani82644082012-08-03 13:09:11 -07002769
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002770 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002771 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002772 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2773 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002774 Parcel data = Parcel.obtain();
2775 Parcel reply = Parcel.obtain();
2776 data.writeInterfaceToken(IActivityManager.descriptor);
2777 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002778 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002779 intent.writeToParcel(data, 0);
2780 data.writeString(resolvedType);
2781 data.writeStrongBinder(resultTo);
2782 data.writeString(resultWho);
2783 data.writeInt(requestCode);
2784 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002785 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002786 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002787 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002788 } else {
2789 data.writeInt(0);
2790 }
2791 if (options != null) {
2792 data.writeInt(1);
2793 options.writeToParcel(data, 0);
2794 } else {
2795 data.writeInt(0);
2796 }
2797 data.writeInt(userId);
2798 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2799 reply.readException();
2800 int result = reply.readInt();
2801 reply.recycle();
2802 data.recycle();
2803 return result;
2804 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002805 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2806 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002807 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2808 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002809 Parcel data = Parcel.obtain();
2810 Parcel reply = Parcel.obtain();
2811 data.writeInterfaceToken(IActivityManager.descriptor);
2812 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2813 data.writeString(callingPackage);
2814 intent.writeToParcel(data, 0);
2815 data.writeString(resolvedType);
2816 data.writeStrongBinder(resultTo);
2817 data.writeString(resultWho);
2818 data.writeInt(requestCode);
2819 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002820 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002821 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002822 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002823 } else {
2824 data.writeInt(0);
2825 }
2826 if (options != null) {
2827 data.writeInt(1);
2828 options.writeToParcel(data, 0);
2829 } else {
2830 data.writeInt(0);
2831 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002832 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002833 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002834 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2835 reply.readException();
2836 int result = reply.readInt();
2837 reply.recycle();
2838 data.recycle();
2839 return result;
2840 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002841 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2842 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002843 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2844 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002845 Parcel data = Parcel.obtain();
2846 Parcel reply = Parcel.obtain();
2847 data.writeInterfaceToken(IActivityManager.descriptor);
2848 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002849 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002850 intent.writeToParcel(data, 0);
2851 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002852 data.writeStrongBinder(resultTo);
2853 data.writeString(resultWho);
2854 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002855 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002856 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002857 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002858 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002859 } else {
2860 data.writeInt(0);
2861 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002862 if (options != null) {
2863 data.writeInt(1);
2864 options.writeToParcel(data, 0);
2865 } else {
2866 data.writeInt(0);
2867 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002868 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002869 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2870 reply.readException();
2871 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2872 reply.recycle();
2873 data.recycle();
2874 return result;
2875 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002876 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2877 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002878 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002879 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002884 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002885 intent.writeToParcel(data, 0);
2886 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002887 data.writeStrongBinder(resultTo);
2888 data.writeString(resultWho);
2889 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002890 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002891 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002892 if (options != null) {
2893 data.writeInt(1);
2894 options.writeToParcel(data, 0);
2895 } else {
2896 data.writeInt(0);
2897 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002898 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002899 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2900 reply.readException();
2901 int result = reply.readInt();
2902 reply.recycle();
2903 data.recycle();
2904 return result;
2905 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002906 public int startActivityIntentSender(IApplicationThread caller,
2907 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002908 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002909 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002910 Parcel data = Parcel.obtain();
2911 Parcel reply = Parcel.obtain();
2912 data.writeInterfaceToken(IActivityManager.descriptor);
2913 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2914 intent.writeToParcel(data, 0);
2915 if (fillInIntent != null) {
2916 data.writeInt(1);
2917 fillInIntent.writeToParcel(data, 0);
2918 } else {
2919 data.writeInt(0);
2920 }
2921 data.writeString(resolvedType);
2922 data.writeStrongBinder(resultTo);
2923 data.writeString(resultWho);
2924 data.writeInt(requestCode);
2925 data.writeInt(flagsMask);
2926 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002927 if (options != null) {
2928 data.writeInt(1);
2929 options.writeToParcel(data, 0);
2930 } else {
2931 data.writeInt(0);
2932 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002933 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002934 reply.readException();
2935 int result = reply.readInt();
2936 reply.recycle();
2937 data.recycle();
2938 return result;
2939 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002940 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2941 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002942 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2943 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
2947 data.writeString(callingPackage);
2948 data.writeInt(callingPid);
2949 data.writeInt(callingUid);
2950 intent.writeToParcel(data, 0);
2951 data.writeString(resolvedType);
2952 data.writeStrongBinder(session.asBinder());
2953 data.writeStrongBinder(interactor.asBinder());
2954 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002955 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002956 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002957 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002958 } else {
2959 data.writeInt(0);
2960 }
2961 if (options != null) {
2962 data.writeInt(1);
2963 options.writeToParcel(data, 0);
2964 } else {
2965 data.writeInt(0);
2966 }
2967 data.writeInt(userId);
2968 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2969 reply.readException();
2970 int result = reply.readInt();
2971 reply.recycle();
2972 data.recycle();
2973 return result;
2974 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002975 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002976 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002977 Parcel data = Parcel.obtain();
2978 Parcel reply = Parcel.obtain();
2979 data.writeInterfaceToken(IActivityManager.descriptor);
2980 data.writeStrongBinder(callingActivity);
2981 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002982 if (options != null) {
2983 data.writeInt(1);
2984 options.writeToParcel(data, 0);
2985 } else {
2986 data.writeInt(0);
2987 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002988 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2989 reply.readException();
2990 int result = reply.readInt();
2991 reply.recycle();
2992 data.recycle();
2993 return result != 0;
2994 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002995 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2996 Parcel data = Parcel.obtain();
2997 Parcel reply = Parcel.obtain();
2998 data.writeInterfaceToken(IActivityManager.descriptor);
2999 data.writeInt(taskId);
3000 if (options == null) {
3001 data.writeInt(0);
3002 } else {
3003 data.writeInt(1);
3004 options.writeToParcel(data, 0);
3005 }
3006 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 int result = reply.readInt();
3009 reply.recycle();
3010 data.recycle();
3011 return result;
3012 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003013 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003014 throws RemoteException {
3015 Parcel data = Parcel.obtain();
3016 Parcel reply = Parcel.obtain();
3017 data.writeInterfaceToken(IActivityManager.descriptor);
3018 data.writeStrongBinder(token);
3019 data.writeInt(resultCode);
3020 if (resultData != null) {
3021 data.writeInt(1);
3022 resultData.writeToParcel(data, 0);
3023 } else {
3024 data.writeInt(0);
3025 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003026 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003027 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 boolean res = reply.readInt() != 0;
3030 data.recycle();
3031 reply.recycle();
3032 return res;
3033 }
3034 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3035 {
3036 Parcel data = Parcel.obtain();
3037 Parcel reply = Parcel.obtain();
3038 data.writeInterfaceToken(IActivityManager.descriptor);
3039 data.writeStrongBinder(token);
3040 data.writeString(resultWho);
3041 data.writeInt(requestCode);
3042 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3043 reply.readException();
3044 data.recycle();
3045 reply.recycle();
3046 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003047 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3048 Parcel data = Parcel.obtain();
3049 Parcel reply = Parcel.obtain();
3050 data.writeInterfaceToken(IActivityManager.descriptor);
3051 data.writeStrongBinder(token);
3052 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3053 reply.readException();
3054 boolean res = reply.readInt() != 0;
3055 data.recycle();
3056 reply.recycle();
3057 return res;
3058 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003059 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3060 Parcel data = Parcel.obtain();
3061 Parcel reply = Parcel.obtain();
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 data.writeStrongBinder(session.asBinder());
3064 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3065 reply.readException();
3066 data.recycle();
3067 reply.recycle();
3068 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003069 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3070 Parcel data = Parcel.obtain();
3071 Parcel reply = Parcel.obtain();
3072 data.writeInterfaceToken(IActivityManager.descriptor);
3073 data.writeStrongBinder(token);
3074 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 boolean res = reply.readInt() != 0;
3077 data.recycle();
3078 reply.recycle();
3079 return res;
3080 }
3081 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3082 Parcel data = Parcel.obtain();
3083 Parcel reply = Parcel.obtain();
3084 data.writeInterfaceToken(IActivityManager.descriptor);
3085 data.writeStrongBinder(app.asBinder());
3086 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3087 reply.readException();
3088 data.recycle();
3089 reply.recycle();
3090 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003091 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeStrongBinder(token);
3096 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 boolean res = reply.readInt() != 0;
3099 data.recycle();
3100 reply.recycle();
3101 return res;
3102 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003103 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003104 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003105 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003106 {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003111 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003112 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3113 filter.writeToParcel(data, 0);
3114 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003115 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003116 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3117 reply.readException();
3118 Intent intent = null;
3119 int haveIntent = reply.readInt();
3120 if (haveIntent != 0) {
3121 intent = Intent.CREATOR.createFromParcel(reply);
3122 }
3123 reply.recycle();
3124 data.recycle();
3125 return intent;
3126 }
3127 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3128 {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 data.writeStrongBinder(receiver.asBinder());
3133 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3134 reply.readException();
3135 data.recycle();
3136 reply.recycle();
3137 }
3138 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003139 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003140 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003141 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003142 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003143 {
3144 Parcel data = Parcel.obtain();
3145 Parcel reply = Parcel.obtain();
3146 data.writeInterfaceToken(IActivityManager.descriptor);
3147 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3148 intent.writeToParcel(data, 0);
3149 data.writeString(resolvedType);
3150 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3151 data.writeInt(resultCode);
3152 data.writeString(resultData);
3153 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003154 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003155 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003156 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003157 data.writeInt(serialized ? 1 : 0);
3158 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003159 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003160 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3161 reply.readException();
3162 int res = reply.readInt();
3163 reply.recycle();
3164 data.recycle();
3165 return res;
3166 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003167 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3168 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003169 {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3174 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003175 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003176 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3177 reply.readException();
3178 data.recycle();
3179 reply.recycle();
3180 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003181 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3182 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003183 {
3184 Parcel data = Parcel.obtain();
3185 Parcel reply = Parcel.obtain();
3186 data.writeInterfaceToken(IActivityManager.descriptor);
3187 data.writeStrongBinder(who);
3188 data.writeInt(resultCode);
3189 data.writeString(resultData);
3190 data.writeBundle(map);
3191 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003192 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003193 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3194 reply.readException();
3195 data.recycle();
3196 reply.recycle();
3197 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003198 public void attachApplication(IApplicationThread app) throws RemoteException
3199 {
3200 Parcel data = Parcel.obtain();
3201 Parcel reply = Parcel.obtain();
3202 data.writeInterfaceToken(IActivityManager.descriptor);
3203 data.writeStrongBinder(app.asBinder());
3204 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3205 reply.readException();
3206 data.recycle();
3207 reply.recycle();
3208 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003209 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3210 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003211 {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003216 if (config != null) {
3217 data.writeInt(1);
3218 config.writeToParcel(data, 0);
3219 } else {
3220 data.writeInt(0);
3221 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003222 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003223 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3224 reply.readException();
3225 data.recycle();
3226 reply.recycle();
3227 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003228 public void activityResumed(IBinder token) throws RemoteException
3229 {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(token);
3234 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3235 reply.readException();
3236 data.recycle();
3237 reply.recycle();
3238 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003239 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003240 {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 data.writeStrongBinder(token);
3245 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 data.recycle();
3248 reply.recycle();
3249 }
3250 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003251 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003252 {
3253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
3256 data.writeStrongBinder(token);
3257 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003258 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003259 TextUtils.writeToParcel(description, data, 0);
3260 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3261 reply.readException();
3262 data.recycle();
3263 reply.recycle();
3264 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003265 public void activitySlept(IBinder token) throws RemoteException
3266 {
3267 Parcel data = Parcel.obtain();
3268 Parcel reply = Parcel.obtain();
3269 data.writeInterfaceToken(IActivityManager.descriptor);
3270 data.writeStrongBinder(token);
3271 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3272 reply.readException();
3273 data.recycle();
3274 reply.recycle();
3275 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 public void activityDestroyed(IBinder token) throws RemoteException
3277 {
3278 Parcel data = Parcel.obtain();
3279 Parcel reply = Parcel.obtain();
3280 data.writeInterfaceToken(IActivityManager.descriptor);
3281 data.writeStrongBinder(token);
3282 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3283 reply.readException();
3284 data.recycle();
3285 reply.recycle();
3286 }
3287 public String getCallingPackage(IBinder token) throws RemoteException
3288 {
3289 Parcel data = Parcel.obtain();
3290 Parcel reply = Parcel.obtain();
3291 data.writeInterfaceToken(IActivityManager.descriptor);
3292 data.writeStrongBinder(token);
3293 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3294 reply.readException();
3295 String res = reply.readString();
3296 data.recycle();
3297 reply.recycle();
3298 return res;
3299 }
3300 public ComponentName getCallingActivity(IBinder token)
3301 throws RemoteException {
3302 Parcel data = Parcel.obtain();
3303 Parcel reply = Parcel.obtain();
3304 data.writeInterfaceToken(IActivityManager.descriptor);
3305 data.writeStrongBinder(token);
3306 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3307 reply.readException();
3308 ComponentName res = ComponentName.readFromParcel(reply);
3309 data.recycle();
3310 reply.recycle();
3311 return res;
3312 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003313 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003317 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003318 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3319 reply.readException();
3320 ArrayList<IAppTask> list = null;
3321 int N = reply.readInt();
3322 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003323 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003324 while (N > 0) {
3325 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3326 list.add(task);
3327 N--;
3328 }
3329 }
3330 data.recycle();
3331 reply.recycle();
3332 return list;
3333 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003334 public int addAppTask(IBinder activityToken, Intent intent,
3335 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 data.writeStrongBinder(activityToken);
3340 intent.writeToParcel(data, 0);
3341 description.writeToParcel(data, 0);
3342 thumbnail.writeToParcel(data, 0);
3343 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3344 reply.readException();
3345 int res = reply.readInt();
3346 data.recycle();
3347 reply.recycle();
3348 return res;
3349 }
3350 public Point getAppTaskThumbnailSize() throws RemoteException {
3351 Parcel data = Parcel.obtain();
3352 Parcel reply = Parcel.obtain();
3353 data.writeInterfaceToken(IActivityManager.descriptor);
3354 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3355 reply.readException();
3356 Point size = Point.CREATOR.createFromParcel(reply);
3357 data.recycle();
3358 reply.recycle();
3359 return size;
3360 }
Todd Kennedye635f662015-01-20 10:36:49 -08003361 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3362 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 data.writeInt(maxNum);
3367 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003368 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3369 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003370 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003371 int N = reply.readInt();
3372 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003373 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003374 while (N > 0) {
3375 ActivityManager.RunningTaskInfo info =
3376 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003377 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003378 list.add(info);
3379 N--;
3380 }
3381 }
3382 data.recycle();
3383 reply.recycle();
3384 return list;
3385 }
3386 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003387 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 data.writeInt(maxNum);
3392 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003393 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003394 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3395 reply.readException();
3396 ArrayList<ActivityManager.RecentTaskInfo> list
3397 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3398 data.recycle();
3399 reply.recycle();
3400 return list;
3401 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003402 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003407 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003408 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003409 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003410 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003411 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003412 }
3413 data.recycle();
3414 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003415 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003416 }
Todd Kennedye635f662015-01-20 10:36:49 -08003417 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3418 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003419 Parcel data = Parcel.obtain();
3420 Parcel reply = Parcel.obtain();
3421 data.writeInterfaceToken(IActivityManager.descriptor);
3422 data.writeInt(maxNum);
3423 data.writeInt(flags);
3424 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3425 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003426 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003427 int N = reply.readInt();
3428 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003429 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003430 while (N > 0) {
3431 ActivityManager.RunningServiceInfo info =
3432 ActivityManager.RunningServiceInfo.CREATOR
3433 .createFromParcel(reply);
3434 list.add(info);
3435 N--;
3436 }
3437 }
3438 data.recycle();
3439 reply.recycle();
3440 return list;
3441 }
3442 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3443 throws RemoteException {
3444 Parcel data = Parcel.obtain();
3445 Parcel reply = Parcel.obtain();
3446 data.writeInterfaceToken(IActivityManager.descriptor);
3447 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3448 reply.readException();
3449 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3450 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3451 data.recycle();
3452 reply.recycle();
3453 return list;
3454 }
3455 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3456 throws RemoteException {
3457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3461 reply.readException();
3462 ArrayList<ActivityManager.RunningAppProcessInfo> list
3463 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3464 data.recycle();
3465 reply.recycle();
3466 return list;
3467 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003468 public List<ApplicationInfo> getRunningExternalApplications()
3469 throws RemoteException {
3470 Parcel data = Parcel.obtain();
3471 Parcel reply = Parcel.obtain();
3472 data.writeInterfaceToken(IActivityManager.descriptor);
3473 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3474 reply.readException();
3475 ArrayList<ApplicationInfo> list
3476 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3477 data.recycle();
3478 reply.recycle();
3479 return list;
3480 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003481 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003482 {
3483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003487 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003488 if (options != null) {
3489 data.writeInt(1);
3490 options.writeToParcel(data, 0);
3491 } else {
3492 data.writeInt(0);
3493 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003494 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 data.recycle();
3497 reply.recycle();
3498 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3500 throws RemoteException {
3501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 data.writeStrongBinder(token);
3505 data.writeInt(nonRoot ? 1 : 0);
3506 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 boolean res = reply.readInt() != 0;
3509 data.recycle();
3510 reply.recycle();
3511 return res;
3512 }
3513 public void moveTaskBackwards(int task) throws RemoteException
3514 {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeInt(task);
3519 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 data.recycle();
3522 reply.recycle();
3523 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003524 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003525 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3526 {
3527 Parcel data = Parcel.obtain();
3528 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003529 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003530 data.writeInt(taskId);
3531 data.writeInt(stackId);
3532 data.writeInt(toTop ? 1 : 0);
3533 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3534 reply.readException();
3535 data.recycle();
3536 reply.recycle();
3537 }
3538 @Override
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003539 public void resizeStack(int stackId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003540 {
3541 Parcel data = Parcel.obtain();
3542 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003543 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003544 data.writeInt(stackId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003545 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003546 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003547 reply.readException();
3548 data.recycle();
3549 reply.recycle();
3550 }
Craig Mautner967212c2013-04-13 21:10:58 -07003551 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003552 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3553 {
3554 Parcel data = Parcel.obtain();
3555 Parcel reply = Parcel.obtain();
3556 data.writeInterfaceToken(IActivityManager.descriptor);
3557 data.writeInt(taskId);
3558 data.writeInt(stackId);
3559 data.writeInt(position);
3560 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3561 reply.readException();
3562 data.recycle();
3563 reply.recycle();
3564 }
3565 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003566 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003567 {
3568 Parcel data = Parcel.obtain();
3569 Parcel reply = Parcel.obtain();
3570 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003571 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003572 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003573 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003574 data.recycle();
3575 reply.recycle();
3576 return list;
3577 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003578 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003579 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003580 {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003584 data.writeInt(stackId);
3585 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003586 reply.readException();
3587 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003588 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003589 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003590 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003591 }
3592 data.recycle();
3593 reply.recycle();
3594 return info;
3595 }
3596 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003597 public boolean isInHomeStack(int taskId) throws RemoteException {
3598 Parcel data = Parcel.obtain();
3599 Parcel reply = Parcel.obtain();
3600 data.writeInterfaceToken(IActivityManager.descriptor);
3601 data.writeInt(taskId);
3602 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3603 reply.readException();
3604 boolean isInHomeStack = reply.readInt() > 0;
3605 data.recycle();
3606 reply.recycle();
3607 return isInHomeStack;
3608 }
3609 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003610 public void setFocusedStack(int stackId) throws RemoteException
3611 {
3612 Parcel data = Parcel.obtain();
3613 Parcel reply = Parcel.obtain();
3614 data.writeInterfaceToken(IActivityManager.descriptor);
3615 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003616 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003617 reply.readException();
3618 data.recycle();
3619 reply.recycle();
3620 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003621 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003622 public int getFocusedStackId() throws RemoteException {
3623 Parcel data = Parcel.obtain();
3624 Parcel reply = Parcel.obtain();
3625 data.writeInterfaceToken(IActivityManager.descriptor);
3626 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3627 reply.readException();
3628 int focusedStackId = reply.readInt();
3629 data.recycle();
3630 reply.recycle();
3631 return focusedStackId;
3632 }
3633 @Override
Skuhnef36bb0c2015-08-26 14:26:17 -07003634 public void activateActivity(IBinder token) throws RemoteException
3635 {
3636 Parcel data = Parcel.obtain();
3637 Parcel reply = Parcel.obtain();
3638 data.writeInterfaceToken(IActivityManager.descriptor);
3639 data.writeStrongBinder(token);
3640 mRemote.transact(ACTIVATE_ACTIVITY_TRANSACTION, data, reply, 0);
3641 reply.readException();
3642 data.recycle();
3643 reply.recycle();
3644 }
3645 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003646 public void setFocusedTask(int taskId) throws RemoteException
3647 {
3648 Parcel data = Parcel.obtain();
3649 Parcel reply = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 data.writeInt(taskId);
3652 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3653 reply.readException();
3654 data.recycle();
3655 reply.recycle();
3656 }
3657 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003658 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3659 {
3660 Parcel data = Parcel.obtain();
3661 Parcel reply = Parcel.obtain();
3662 data.writeInterfaceToken(IActivityManager.descriptor);
3663 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003664 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003665 reply.readException();
3666 data.recycle();
3667 reply.recycle();
3668 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003669 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3670 {
3671 Parcel data = Parcel.obtain();
3672 Parcel reply = Parcel.obtain();
3673 data.writeInterfaceToken(IActivityManager.descriptor);
3674 data.writeStrongBinder(token);
3675 data.writeInt(onlyRoot ? 1 : 0);
3676 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3677 reply.readException();
3678 int res = reply.readInt();
3679 data.recycle();
3680 reply.recycle();
3681 return res;
3682 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003683 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003684 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003685 Parcel data = Parcel.obtain();
3686 Parcel reply = Parcel.obtain();
3687 data.writeInterfaceToken(IActivityManager.descriptor);
3688 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3689 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003690 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003691 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003692 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3693 reply.readException();
3694 int res = reply.readInt();
3695 ContentProviderHolder cph = null;
3696 if (res != 0) {
3697 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3698 }
3699 data.recycle();
3700 reply.recycle();
3701 return cph;
3702 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003703 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3704 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003705 Parcel data = Parcel.obtain();
3706 Parcel reply = Parcel.obtain();
3707 data.writeInterfaceToken(IActivityManager.descriptor);
3708 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003709 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003710 data.writeStrongBinder(token);
3711 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3712 reply.readException();
3713 int res = reply.readInt();
3714 ContentProviderHolder cph = null;
3715 if (res != 0) {
3716 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3717 }
3718 data.recycle();
3719 reply.recycle();
3720 return cph;
3721 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003722 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003723 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003724 {
3725 Parcel data = Parcel.obtain();
3726 Parcel reply = Parcel.obtain();
3727 data.writeInterfaceToken(IActivityManager.descriptor);
3728 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3729 data.writeTypedList(providers);
3730 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3731 reply.readException();
3732 data.recycle();
3733 reply.recycle();
3734 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003735 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3736 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003740 data.writeStrongBinder(connection);
3741 data.writeInt(stable);
3742 data.writeInt(unstable);
3743 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3744 reply.readException();
3745 boolean res = reply.readInt() != 0;
3746 data.recycle();
3747 reply.recycle();
3748 return res;
3749 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003750
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003751 public void unstableProviderDied(IBinder connection) throws RemoteException {
3752 Parcel data = Parcel.obtain();
3753 Parcel reply = Parcel.obtain();
3754 data.writeInterfaceToken(IActivityManager.descriptor);
3755 data.writeStrongBinder(connection);
3756 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3757 reply.readException();
3758 data.recycle();
3759 reply.recycle();
3760 }
3761
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003762 @Override
3763 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3764 Parcel data = Parcel.obtain();
3765 Parcel reply = Parcel.obtain();
3766 data.writeInterfaceToken(IActivityManager.descriptor);
3767 data.writeStrongBinder(connection);
3768 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 data.recycle();
3771 reply.recycle();
3772 }
3773
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003774 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3775 Parcel data = Parcel.obtain();
3776 Parcel reply = Parcel.obtain();
3777 data.writeInterfaceToken(IActivityManager.descriptor);
3778 data.writeStrongBinder(connection);
3779 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003780 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3781 reply.readException();
3782 data.recycle();
3783 reply.recycle();
3784 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003785
3786 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3787 Parcel data = Parcel.obtain();
3788 Parcel reply = Parcel.obtain();
3789 data.writeInterfaceToken(IActivityManager.descriptor);
3790 data.writeString(name);
3791 data.writeStrongBinder(token);
3792 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3793 reply.readException();
3794 data.recycle();
3795 reply.recycle();
3796 }
3797
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003798 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3799 throws RemoteException
3800 {
3801 Parcel data = Parcel.obtain();
3802 Parcel reply = Parcel.obtain();
3803 data.writeInterfaceToken(IActivityManager.descriptor);
3804 service.writeToParcel(data, 0);
3805 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3806 reply.readException();
3807 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3808 data.recycle();
3809 reply.recycle();
3810 return res;
3811 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003812
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003813 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003814 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003815 {
3816 Parcel data = Parcel.obtain();
3817 Parcel reply = Parcel.obtain();
3818 data.writeInterfaceToken(IActivityManager.descriptor);
3819 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3820 service.writeToParcel(data, 0);
3821 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003822 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003823 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003824 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3825 reply.readException();
3826 ComponentName res = ComponentName.readFromParcel(reply);
3827 data.recycle();
3828 reply.recycle();
3829 return res;
3830 }
3831 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003832 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003833 {
3834 Parcel data = Parcel.obtain();
3835 Parcel reply = Parcel.obtain();
3836 data.writeInterfaceToken(IActivityManager.descriptor);
3837 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3838 service.writeToParcel(data, 0);
3839 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003840 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003841 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 int res = reply.readInt();
3844 reply.recycle();
3845 data.recycle();
3846 return res;
3847 }
3848 public boolean stopServiceToken(ComponentName className, IBinder token,
3849 int startId) throws RemoteException {
3850 Parcel data = Parcel.obtain();
3851 Parcel reply = Parcel.obtain();
3852 data.writeInterfaceToken(IActivityManager.descriptor);
3853 ComponentName.writeToParcel(className, data);
3854 data.writeStrongBinder(token);
3855 data.writeInt(startId);
3856 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3857 reply.readException();
3858 boolean res = reply.readInt() != 0;
3859 data.recycle();
3860 reply.recycle();
3861 return res;
3862 }
3863 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003864 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003865 Parcel data = Parcel.obtain();
3866 Parcel reply = Parcel.obtain();
3867 data.writeInterfaceToken(IActivityManager.descriptor);
3868 ComponentName.writeToParcel(className, data);
3869 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003870 data.writeInt(id);
3871 if (notification != null) {
3872 data.writeInt(1);
3873 notification.writeToParcel(data, 0);
3874 } else {
3875 data.writeInt(0);
3876 }
3877 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003878 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 data.recycle();
3881 reply.recycle();
3882 }
3883 public int bindService(IApplicationThread caller, IBinder token,
3884 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003885 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003886 Parcel data = Parcel.obtain();
3887 Parcel reply = Parcel.obtain();
3888 data.writeInterfaceToken(IActivityManager.descriptor);
3889 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3890 data.writeStrongBinder(token);
3891 service.writeToParcel(data, 0);
3892 data.writeString(resolvedType);
3893 data.writeStrongBinder(connection.asBinder());
3894 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003895 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003896 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003897 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3898 reply.readException();
3899 int res = reply.readInt();
3900 data.recycle();
3901 reply.recycle();
3902 return res;
3903 }
3904 public boolean unbindService(IServiceConnection connection) throws RemoteException
3905 {
3906 Parcel data = Parcel.obtain();
3907 Parcel reply = Parcel.obtain();
3908 data.writeInterfaceToken(IActivityManager.descriptor);
3909 data.writeStrongBinder(connection.asBinder());
3910 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 boolean res = reply.readInt() != 0;
3913 data.recycle();
3914 reply.recycle();
3915 return res;
3916 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003917
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003918 public void publishService(IBinder token,
3919 Intent intent, IBinder service) throws RemoteException {
3920 Parcel data = Parcel.obtain();
3921 Parcel reply = Parcel.obtain();
3922 data.writeInterfaceToken(IActivityManager.descriptor);
3923 data.writeStrongBinder(token);
3924 intent.writeToParcel(data, 0);
3925 data.writeStrongBinder(service);
3926 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3927 reply.readException();
3928 data.recycle();
3929 reply.recycle();
3930 }
3931
3932 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3933 throws RemoteException {
3934 Parcel data = Parcel.obtain();
3935 Parcel reply = Parcel.obtain();
3936 data.writeInterfaceToken(IActivityManager.descriptor);
3937 data.writeStrongBinder(token);
3938 intent.writeToParcel(data, 0);
3939 data.writeInt(doRebind ? 1 : 0);
3940 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3941 reply.readException();
3942 data.recycle();
3943 reply.recycle();
3944 }
3945
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003946 public void serviceDoneExecuting(IBinder token, int type, int startId,
3947 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003948 Parcel data = Parcel.obtain();
3949 Parcel reply = Parcel.obtain();
3950 data.writeInterfaceToken(IActivityManager.descriptor);
3951 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003952 data.writeInt(type);
3953 data.writeInt(startId);
3954 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003955 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3956 reply.readException();
3957 data.recycle();
3958 reply.recycle();
3959 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003960
Svet Ganov99b60432015-06-27 13:15:22 -07003961 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
3962 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003963 Parcel data = Parcel.obtain();
3964 Parcel reply = Parcel.obtain();
3965 data.writeInterfaceToken(IActivityManager.descriptor);
3966 service.writeToParcel(data, 0);
3967 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003968 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003969 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3970 reply.readException();
3971 IBinder binder = reply.readStrongBinder();
3972 reply.recycle();
3973 data.recycle();
3974 return binder;
3975 }
3976
Christopher Tate181fafa2009-05-14 11:12:14 -07003977 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3978 throws RemoteException {
3979 Parcel data = Parcel.obtain();
3980 Parcel reply = Parcel.obtain();
3981 data.writeInterfaceToken(IActivityManager.descriptor);
3982 app.writeToParcel(data, 0);
3983 data.writeInt(backupRestoreMode);
3984 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3985 reply.readException();
3986 boolean success = reply.readInt() != 0;
3987 reply.recycle();
3988 data.recycle();
3989 return success;
3990 }
3991
Christopher Tate346acb12012-10-15 19:20:25 -07003992 public void clearPendingBackup() throws RemoteException {
3993 Parcel data = Parcel.obtain();
3994 Parcel reply = Parcel.obtain();
3995 data.writeInterfaceToken(IActivityManager.descriptor);
3996 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3997 reply.recycle();
3998 data.recycle();
3999 }
4000
Christopher Tate181fafa2009-05-14 11:12:14 -07004001 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4002 Parcel data = Parcel.obtain();
4003 Parcel reply = Parcel.obtain();
4004 data.writeInterfaceToken(IActivityManager.descriptor);
4005 data.writeString(packageName);
4006 data.writeStrongBinder(agent);
4007 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4008 reply.recycle();
4009 data.recycle();
4010 }
4011
4012 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4013 Parcel data = Parcel.obtain();
4014 Parcel reply = Parcel.obtain();
4015 data.writeInterfaceToken(IActivityManager.descriptor);
4016 app.writeToParcel(data, 0);
4017 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4018 reply.readException();
4019 reply.recycle();
4020 data.recycle();
4021 }
4022
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004023 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004024 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004025 IUiAutomationConnection connection, int userId, String instructionSet)
4026 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004027 Parcel data = Parcel.obtain();
4028 Parcel reply = Parcel.obtain();
4029 data.writeInterfaceToken(IActivityManager.descriptor);
4030 ComponentName.writeToParcel(className, data);
4031 data.writeString(profileFile);
4032 data.writeInt(flags);
4033 data.writeBundle(arguments);
4034 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004035 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004036 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004037 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004038 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4039 reply.readException();
4040 boolean res = reply.readInt() != 0;
4041 reply.recycle();
4042 data.recycle();
4043 return res;
4044 }
4045
4046 public void finishInstrumentation(IApplicationThread target,
4047 int resultCode, Bundle results) throws RemoteException {
4048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 data.writeStrongBinder(target != null ? target.asBinder() : null);
4052 data.writeInt(resultCode);
4053 data.writeBundle(results);
4054 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4055 reply.readException();
4056 data.recycle();
4057 reply.recycle();
4058 }
4059 public Configuration getConfiguration() throws RemoteException
4060 {
4061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4065 reply.readException();
4066 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4067 reply.recycle();
4068 data.recycle();
4069 return res;
4070 }
4071 public void updateConfiguration(Configuration values) throws RemoteException
4072 {
4073 Parcel data = Parcel.obtain();
4074 Parcel reply = Parcel.obtain();
4075 data.writeInterfaceToken(IActivityManager.descriptor);
4076 values.writeToParcel(data, 0);
4077 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4078 reply.readException();
4079 data.recycle();
4080 reply.recycle();
4081 }
4082 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4083 throws RemoteException {
4084 Parcel data = Parcel.obtain();
4085 Parcel reply = Parcel.obtain();
4086 data.writeInterfaceToken(IActivityManager.descriptor);
4087 data.writeStrongBinder(token);
4088 data.writeInt(requestedOrientation);
4089 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4090 reply.readException();
4091 data.recycle();
4092 reply.recycle();
4093 }
4094 public int getRequestedOrientation(IBinder token) throws RemoteException {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeStrongBinder(token);
4099 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4100 reply.readException();
4101 int res = reply.readInt();
4102 data.recycle();
4103 reply.recycle();
4104 return res;
4105 }
4106 public ComponentName getActivityClassForToken(IBinder token)
4107 throws RemoteException {
4108 Parcel data = Parcel.obtain();
4109 Parcel reply = Parcel.obtain();
4110 data.writeInterfaceToken(IActivityManager.descriptor);
4111 data.writeStrongBinder(token);
4112 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4113 reply.readException();
4114 ComponentName res = ComponentName.readFromParcel(reply);
4115 data.recycle();
4116 reply.recycle();
4117 return res;
4118 }
4119 public String getPackageForToken(IBinder token) throws RemoteException
4120 {
4121 Parcel data = Parcel.obtain();
4122 Parcel reply = Parcel.obtain();
4123 data.writeInterfaceToken(IActivityManager.descriptor);
4124 data.writeStrongBinder(token);
4125 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4126 reply.readException();
4127 String res = reply.readString();
4128 data.recycle();
4129 reply.recycle();
4130 return res;
4131 }
4132 public IIntentSender getIntentSender(int type,
4133 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004134 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004135 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004136 Parcel data = Parcel.obtain();
4137 Parcel reply = Parcel.obtain();
4138 data.writeInterfaceToken(IActivityManager.descriptor);
4139 data.writeInt(type);
4140 data.writeString(packageName);
4141 data.writeStrongBinder(token);
4142 data.writeString(resultWho);
4143 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004144 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004145 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004146 data.writeTypedArray(intents, 0);
4147 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004148 } else {
4149 data.writeInt(0);
4150 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004151 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004152 if (options != null) {
4153 data.writeInt(1);
4154 options.writeToParcel(data, 0);
4155 } else {
4156 data.writeInt(0);
4157 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004158 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004159 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4160 reply.readException();
4161 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004162 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004163 data.recycle();
4164 reply.recycle();
4165 return res;
4166 }
4167 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4168 Parcel data = Parcel.obtain();
4169 Parcel reply = Parcel.obtain();
4170 data.writeInterfaceToken(IActivityManager.descriptor);
4171 data.writeStrongBinder(sender.asBinder());
4172 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4173 reply.readException();
4174 data.recycle();
4175 reply.recycle();
4176 }
4177 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4178 Parcel data = Parcel.obtain();
4179 Parcel reply = Parcel.obtain();
4180 data.writeInterfaceToken(IActivityManager.descriptor);
4181 data.writeStrongBinder(sender.asBinder());
4182 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4183 reply.readException();
4184 String res = reply.readString();
4185 data.recycle();
4186 reply.recycle();
4187 return res;
4188 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004189 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4190 Parcel data = Parcel.obtain();
4191 Parcel reply = Parcel.obtain();
4192 data.writeInterfaceToken(IActivityManager.descriptor);
4193 data.writeStrongBinder(sender.asBinder());
4194 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4195 reply.readException();
4196 int res = reply.readInt();
4197 data.recycle();
4198 reply.recycle();
4199 return res;
4200 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004201 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4202 boolean requireFull, String name, String callerPackage) throws RemoteException {
4203 Parcel data = Parcel.obtain();
4204 Parcel reply = Parcel.obtain();
4205 data.writeInterfaceToken(IActivityManager.descriptor);
4206 data.writeInt(callingPid);
4207 data.writeInt(callingUid);
4208 data.writeInt(userId);
4209 data.writeInt(allowAll ? 1 : 0);
4210 data.writeInt(requireFull ? 1 : 0);
4211 data.writeString(name);
4212 data.writeString(callerPackage);
4213 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4214 reply.readException();
4215 int res = reply.readInt();
4216 data.recycle();
4217 reply.recycle();
4218 return res;
4219 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004220 public void setProcessLimit(int max) throws RemoteException
4221 {
4222 Parcel data = Parcel.obtain();
4223 Parcel reply = Parcel.obtain();
4224 data.writeInterfaceToken(IActivityManager.descriptor);
4225 data.writeInt(max);
4226 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4227 reply.readException();
4228 data.recycle();
4229 reply.recycle();
4230 }
4231 public int getProcessLimit() throws RemoteException
4232 {
4233 Parcel data = Parcel.obtain();
4234 Parcel reply = Parcel.obtain();
4235 data.writeInterfaceToken(IActivityManager.descriptor);
4236 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4237 reply.readException();
4238 int res = reply.readInt();
4239 data.recycle();
4240 reply.recycle();
4241 return res;
4242 }
4243 public void setProcessForeground(IBinder token, int pid,
4244 boolean isForeground) throws RemoteException {
4245 Parcel data = Parcel.obtain();
4246 Parcel reply = Parcel.obtain();
4247 data.writeInterfaceToken(IActivityManager.descriptor);
4248 data.writeStrongBinder(token);
4249 data.writeInt(pid);
4250 data.writeInt(isForeground ? 1 : 0);
4251 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4252 reply.readException();
4253 data.recycle();
4254 reply.recycle();
4255 }
4256 public int checkPermission(String permission, int pid, int uid)
4257 throws RemoteException {
4258 Parcel data = Parcel.obtain();
4259 Parcel reply = Parcel.obtain();
4260 data.writeInterfaceToken(IActivityManager.descriptor);
4261 data.writeString(permission);
4262 data.writeInt(pid);
4263 data.writeInt(uid);
4264 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4265 reply.readException();
4266 int res = reply.readInt();
4267 data.recycle();
4268 reply.recycle();
4269 return res;
4270 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004271 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4272 throws RemoteException {
4273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 data.writeString(permission);
4277 data.writeInt(pid);
4278 data.writeInt(uid);
4279 data.writeStrongBinder(callerToken);
4280 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4281 reply.readException();
4282 int res = reply.readInt();
4283 data.recycle();
4284 reply.recycle();
4285 return res;
4286 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004287 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004288 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004289 Parcel data = Parcel.obtain();
4290 Parcel reply = Parcel.obtain();
4291 data.writeInterfaceToken(IActivityManager.descriptor);
4292 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004293 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004294 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004295 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4296 reply.readException();
4297 boolean res = reply.readInt() != 0;
4298 data.recycle();
4299 reply.recycle();
4300 return res;
4301 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004302 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4303 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004304 Parcel data = Parcel.obtain();
4305 Parcel reply = Parcel.obtain();
4306 data.writeInterfaceToken(IActivityManager.descriptor);
4307 uri.writeToParcel(data, 0);
4308 data.writeInt(pid);
4309 data.writeInt(uid);
4310 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004311 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004312 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004313 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4314 reply.readException();
4315 int res = reply.readInt();
4316 data.recycle();
4317 reply.recycle();
4318 return res;
4319 }
4320 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004321 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004322 Parcel data = Parcel.obtain();
4323 Parcel reply = Parcel.obtain();
4324 data.writeInterfaceToken(IActivityManager.descriptor);
4325 data.writeStrongBinder(caller.asBinder());
4326 data.writeString(targetPkg);
4327 uri.writeToParcel(data, 0);
4328 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004329 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004330 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4331 reply.readException();
4332 data.recycle();
4333 reply.recycle();
4334 }
4335 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004336 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004337 Parcel data = Parcel.obtain();
4338 Parcel reply = Parcel.obtain();
4339 data.writeInterfaceToken(IActivityManager.descriptor);
4340 data.writeStrongBinder(caller.asBinder());
4341 uri.writeToParcel(data, 0);
4342 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004343 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004344 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4345 reply.readException();
4346 data.recycle();
4347 reply.recycle();
4348 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004349
4350 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004351 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4352 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004353 Parcel data = Parcel.obtain();
4354 Parcel reply = Parcel.obtain();
4355 data.writeInterfaceToken(IActivityManager.descriptor);
4356 uri.writeToParcel(data, 0);
4357 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004358 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004359 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4360 reply.readException();
4361 data.recycle();
4362 reply.recycle();
4363 }
4364
4365 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004366 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4367 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004368 Parcel data = Parcel.obtain();
4369 Parcel reply = Parcel.obtain();
4370 data.writeInterfaceToken(IActivityManager.descriptor);
4371 uri.writeToParcel(data, 0);
4372 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004373 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004374 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4375 reply.readException();
4376 data.recycle();
4377 reply.recycle();
4378 }
4379
4380 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004381 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4382 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004386 data.writeString(packageName);
4387 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004388 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4389 reply.readException();
4390 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4391 reply);
4392 data.recycle();
4393 reply.recycle();
4394 return perms;
4395 }
4396
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004397 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4398 throws RemoteException {
4399 Parcel data = Parcel.obtain();
4400 Parcel reply = Parcel.obtain();
4401 data.writeInterfaceToken(IActivityManager.descriptor);
4402 data.writeStrongBinder(who.asBinder());
4403 data.writeInt(waiting ? 1 : 0);
4404 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4405 reply.readException();
4406 data.recycle();
4407 reply.recycle();
4408 }
4409 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4410 Parcel data = Parcel.obtain();
4411 Parcel reply = Parcel.obtain();
4412 data.writeInterfaceToken(IActivityManager.descriptor);
4413 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4414 reply.readException();
4415 outInfo.readFromParcel(reply);
4416 data.recycle();
4417 reply.recycle();
4418 }
4419 public void unhandledBack() throws RemoteException
4420 {
4421 Parcel data = Parcel.obtain();
4422 Parcel reply = Parcel.obtain();
4423 data.writeInterfaceToken(IActivityManager.descriptor);
4424 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4425 reply.readException();
4426 data.recycle();
4427 reply.recycle();
4428 }
4429 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4430 {
4431 Parcel data = Parcel.obtain();
4432 Parcel reply = Parcel.obtain();
4433 data.writeInterfaceToken(IActivityManager.descriptor);
4434 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4435 reply.readException();
4436 ParcelFileDescriptor pfd = null;
4437 if (reply.readInt() != 0) {
4438 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4439 }
4440 data.recycle();
4441 reply.recycle();
4442 return pfd;
4443 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004444 public void setLockScreenShown(boolean shown) throws RemoteException
4445 {
4446 Parcel data = Parcel.obtain();
4447 Parcel reply = Parcel.obtain();
4448 data.writeInterfaceToken(IActivityManager.descriptor);
4449 data.writeInt(shown ? 1 : 0);
4450 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4451 reply.readException();
4452 data.recycle();
4453 reply.recycle();
4454 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004455 public void setDebugApp(
4456 String packageName, boolean waitForDebugger, boolean persistent)
4457 throws RemoteException
4458 {
4459 Parcel data = Parcel.obtain();
4460 Parcel reply = Parcel.obtain();
4461 data.writeInterfaceToken(IActivityManager.descriptor);
4462 data.writeString(packageName);
4463 data.writeInt(waitForDebugger ? 1 : 0);
4464 data.writeInt(persistent ? 1 : 0);
4465 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4466 reply.readException();
4467 data.recycle();
4468 reply.recycle();
4469 }
4470 public void setAlwaysFinish(boolean enabled) throws RemoteException
4471 {
4472 Parcel data = Parcel.obtain();
4473 Parcel reply = Parcel.obtain();
4474 data.writeInterfaceToken(IActivityManager.descriptor);
4475 data.writeInt(enabled ? 1 : 0);
4476 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4477 reply.readException();
4478 data.recycle();
4479 reply.recycle();
4480 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004481 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004482 {
4483 Parcel data = Parcel.obtain();
4484 Parcel reply = Parcel.obtain();
4485 data.writeInterfaceToken(IActivityManager.descriptor);
4486 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004487 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004488 reply.readException();
4489 data.recycle();
4490 reply.recycle();
4491 }
4492 public void enterSafeMode() throws RemoteException {
4493 Parcel data = Parcel.obtain();
4494 data.writeInterfaceToken(IActivityManager.descriptor);
4495 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4496 data.recycle();
4497 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004498 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004499 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004500 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004501 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004502 data.writeStrongBinder(sender.asBinder());
4503 data.writeInt(sourceUid);
4504 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004505 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004506 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4507 data.recycle();
4508 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004509 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4510 throws RemoteException {
4511 Parcel data = Parcel.obtain();
4512 data.writeInterfaceToken(IActivityManager.descriptor);
4513 data.writeStrongBinder(sender.asBinder());
4514 data.writeInt(sourceUid);
4515 data.writeString(tag);
4516 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4517 data.recycle();
4518 }
4519 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4520 throws RemoteException {
4521 Parcel data = Parcel.obtain();
4522 data.writeInterfaceToken(IActivityManager.descriptor);
4523 data.writeStrongBinder(sender.asBinder());
4524 data.writeInt(sourceUid);
4525 data.writeString(tag);
4526 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4527 data.recycle();
4528 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004529 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004530 Parcel data = Parcel.obtain();
4531 Parcel reply = Parcel.obtain();
4532 data.writeInterfaceToken(IActivityManager.descriptor);
4533 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004534 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004535 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004536 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004537 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004538 boolean res = reply.readInt() != 0;
4539 data.recycle();
4540 reply.recycle();
4541 return res;
4542 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004543 @Override
4544 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4545 Parcel data = Parcel.obtain();
4546 Parcel reply = Parcel.obtain();
4547 data.writeInterfaceToken(IActivityManager.descriptor);
4548 data.writeString(reason);
4549 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4550 boolean res = reply.readInt() != 0;
4551 data.recycle();
4552 reply.recycle();
4553 return res;
4554 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004555 public boolean testIsSystemReady()
4556 {
4557 /* this base class version is never called */
4558 return true;
4559 }
Dan Egnor60d87622009-12-16 16:32:58 -08004560 public void handleApplicationCrash(IBinder app,
4561 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4562 {
4563 Parcel data = Parcel.obtain();
4564 Parcel reply = Parcel.obtain();
4565 data.writeInterfaceToken(IActivityManager.descriptor);
4566 data.writeStrongBinder(app);
4567 crashInfo.writeToParcel(data, 0);
4568 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4569 reply.readException();
4570 reply.recycle();
4571 data.recycle();
4572 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004573
Dianne Hackborn52322712014-08-26 22:47:26 -07004574 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004575 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004576 {
4577 Parcel data = Parcel.obtain();
4578 Parcel reply = Parcel.obtain();
4579 data.writeInterfaceToken(IActivityManager.descriptor);
4580 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004581 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004582 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004583 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004584 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004585 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004586 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004587 reply.recycle();
4588 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004589 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004590 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004591
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004592 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004593 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004594 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004595 {
4596 Parcel data = Parcel.obtain();
4597 Parcel reply = Parcel.obtain();
4598 data.writeInterfaceToken(IActivityManager.descriptor);
4599 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004600 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004601 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004602 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4603 reply.readException();
4604 reply.recycle();
4605 data.recycle();
4606 }
4607
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004608 public void signalPersistentProcesses(int sig) throws RemoteException {
4609 Parcel data = Parcel.obtain();
4610 Parcel reply = Parcel.obtain();
4611 data.writeInterfaceToken(IActivityManager.descriptor);
4612 data.writeInt(sig);
4613 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4614 reply.readException();
4615 data.recycle();
4616 reply.recycle();
4617 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004618
Dianne Hackborn1676c852012-09-10 14:52:30 -07004619 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004620 Parcel data = Parcel.obtain();
4621 Parcel reply = Parcel.obtain();
4622 data.writeInterfaceToken(IActivityManager.descriptor);
4623 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004624 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004625 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4626 reply.readException();
4627 data.recycle();
4628 reply.recycle();
4629 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004630
4631 public void killAllBackgroundProcesses() throws RemoteException {
4632 Parcel data = Parcel.obtain();
4633 Parcel reply = Parcel.obtain();
4634 data.writeInterfaceToken(IActivityManager.descriptor);
4635 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4636 reply.readException();
4637 data.recycle();
4638 reply.recycle();
4639 }
4640
Dianne Hackborn1676c852012-09-10 14:52:30 -07004641 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004642 Parcel data = Parcel.obtain();
4643 Parcel reply = Parcel.obtain();
4644 data.writeInterfaceToken(IActivityManager.descriptor);
4645 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004646 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004647 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004648 reply.readException();
4649 data.recycle();
4650 reply.recycle();
4651 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004652
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004653 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4654 throws RemoteException
4655 {
4656 Parcel data = Parcel.obtain();
4657 Parcel reply = Parcel.obtain();
4658 data.writeInterfaceToken(IActivityManager.descriptor);
4659 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4660 reply.readException();
4661 outInfo.readFromParcel(reply);
4662 reply.recycle();
4663 data.recycle();
4664 }
4665
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004666 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4667 {
4668 Parcel data = Parcel.obtain();
4669 Parcel reply = Parcel.obtain();
4670 data.writeInterfaceToken(IActivityManager.descriptor);
4671 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4672 reply.readException();
4673 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4674 reply.recycle();
4675 data.recycle();
4676 return res;
4677 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004678
Dianne Hackborn1676c852012-09-10 14:52:30 -07004679 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004680 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004681 {
4682 Parcel data = Parcel.obtain();
4683 Parcel reply = Parcel.obtain();
4684 data.writeInterfaceToken(IActivityManager.descriptor);
4685 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004686 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004687 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004688 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004689 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004690 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004691 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004692 } else {
4693 data.writeInt(0);
4694 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004695 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4696 reply.readException();
4697 boolean res = reply.readInt() != 0;
4698 reply.recycle();
4699 data.recycle();
4700 return res;
4701 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004702
Dianne Hackborn55280a92009-05-07 15:53:46 -07004703 public boolean shutdown(int timeout) throws RemoteException
4704 {
4705 Parcel data = Parcel.obtain();
4706 Parcel reply = Parcel.obtain();
4707 data.writeInterfaceToken(IActivityManager.descriptor);
4708 data.writeInt(timeout);
4709 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4710 reply.readException();
4711 boolean res = reply.readInt() != 0;
4712 reply.recycle();
4713 data.recycle();
4714 return res;
4715 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004716
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004717 public void stopAppSwitches() throws RemoteException {
4718 Parcel data = Parcel.obtain();
4719 Parcel reply = Parcel.obtain();
4720 data.writeInterfaceToken(IActivityManager.descriptor);
4721 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4722 reply.readException();
4723 reply.recycle();
4724 data.recycle();
4725 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004726
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004727 public void resumeAppSwitches() throws RemoteException {
4728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
4731 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4732 reply.readException();
4733 reply.recycle();
4734 data.recycle();
4735 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004736
4737 public void addPackageDependency(String packageName) throws RemoteException {
4738 Parcel data = Parcel.obtain();
4739 Parcel reply = Parcel.obtain();
4740 data.writeInterfaceToken(IActivityManager.descriptor);
4741 data.writeString(packageName);
4742 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4743 reply.readException();
4744 data.recycle();
4745 reply.recycle();
4746 }
4747
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004748 public void killApplicationWithAppId(String pkg, int appid, String reason)
4749 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004750 Parcel data = Parcel.obtain();
4751 Parcel reply = Parcel.obtain();
4752 data.writeInterfaceToken(IActivityManager.descriptor);
4753 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004754 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004755 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004756 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004757 reply.readException();
4758 data.recycle();
4759 reply.recycle();
4760 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004761
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004762 public void closeSystemDialogs(String reason) throws RemoteException {
4763 Parcel data = Parcel.obtain();
4764 Parcel reply = Parcel.obtain();
4765 data.writeInterfaceToken(IActivityManager.descriptor);
4766 data.writeString(reason);
4767 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4768 reply.readException();
4769 data.recycle();
4770 reply.recycle();
4771 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004772
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004773 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004774 throws RemoteException {
4775 Parcel data = Parcel.obtain();
4776 Parcel reply = Parcel.obtain();
4777 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004778 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004779 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4780 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004781 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004782 data.recycle();
4783 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004784 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004785 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004786
4787 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4788 Parcel data = Parcel.obtain();
4789 Parcel reply = Parcel.obtain();
4790 data.writeInterfaceToken(IActivityManager.descriptor);
4791 data.writeString(processName);
4792 data.writeInt(uid);
4793 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4794 reply.readException();
4795 data.recycle();
4796 reply.recycle();
4797 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004798
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004799 public void overridePendingTransition(IBinder token, String packageName,
4800 int enterAnim, int exitAnim) throws RemoteException {
4801 Parcel data = Parcel.obtain();
4802 Parcel reply = Parcel.obtain();
4803 data.writeInterfaceToken(IActivityManager.descriptor);
4804 data.writeStrongBinder(token);
4805 data.writeString(packageName);
4806 data.writeInt(enterAnim);
4807 data.writeInt(exitAnim);
4808 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4809 reply.readException();
4810 data.recycle();
4811 reply.recycle();
4812 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004813
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004814 public boolean isUserAMonkey() throws RemoteException {
4815 Parcel data = Parcel.obtain();
4816 Parcel reply = Parcel.obtain();
4817 data.writeInterfaceToken(IActivityManager.descriptor);
4818 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4819 reply.readException();
4820 boolean res = reply.readInt() != 0;
4821 data.recycle();
4822 reply.recycle();
4823 return res;
4824 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004825
4826 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4827 Parcel data = Parcel.obtain();
4828 Parcel reply = Parcel.obtain();
4829 data.writeInterfaceToken(IActivityManager.descriptor);
4830 data.writeInt(monkey ? 1 : 0);
4831 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4832 reply.readException();
4833 data.recycle();
4834 reply.recycle();
4835 }
4836
Dianne Hackborn860755f2010-06-03 18:47:52 -07004837 public void finishHeavyWeightApp() throws RemoteException {
4838 Parcel data = Parcel.obtain();
4839 Parcel reply = Parcel.obtain();
4840 data.writeInterfaceToken(IActivityManager.descriptor);
4841 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4842 reply.readException();
4843 data.recycle();
4844 reply.recycle();
4845 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004846
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004847 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004848 throws RemoteException {
4849 Parcel data = Parcel.obtain();
4850 Parcel reply = Parcel.obtain();
4851 data.writeInterfaceToken(IActivityManager.descriptor);
4852 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004853 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4854 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004855 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004856 data.recycle();
4857 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004858 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004859 }
4860
Craig Mautner233ceee2014-05-09 17:05:11 -07004861 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004862 throws RemoteException {
4863 Parcel data = Parcel.obtain();
4864 Parcel reply = Parcel.obtain();
4865 data.writeInterfaceToken(IActivityManager.descriptor);
4866 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004867 if (options == null) {
4868 data.writeInt(0);
4869 } else {
4870 data.writeInt(1);
4871 data.writeBundle(options.toBundle());
4872 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004873 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004874 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004875 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004876 data.recycle();
4877 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004878 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004879 }
4880
Craig Mautner233ceee2014-05-09 17:05:11 -07004881 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4882 Parcel data = Parcel.obtain();
4883 Parcel reply = Parcel.obtain();
4884 data.writeInterfaceToken(IActivityManager.descriptor);
4885 data.writeStrongBinder(token);
4886 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4887 reply.readException();
4888 Bundle bundle = reply.readBundle();
4889 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4890 data.recycle();
4891 reply.recycle();
4892 return options;
4893 }
4894
Daniel Sandler69a48172010-06-23 16:29:36 -04004895 public void setImmersive(IBinder token, boolean immersive)
4896 throws RemoteException {
4897 Parcel data = Parcel.obtain();
4898 Parcel reply = Parcel.obtain();
4899 data.writeInterfaceToken(IActivityManager.descriptor);
4900 data.writeStrongBinder(token);
4901 data.writeInt(immersive ? 1 : 0);
4902 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4903 reply.readException();
4904 data.recycle();
4905 reply.recycle();
4906 }
4907
4908 public boolean isImmersive(IBinder token)
4909 throws RemoteException {
4910 Parcel data = Parcel.obtain();
4911 Parcel reply = Parcel.obtain();
4912 data.writeInterfaceToken(IActivityManager.descriptor);
4913 data.writeStrongBinder(token);
4914 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004915 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004916 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004917 data.recycle();
4918 reply.recycle();
4919 return res;
4920 }
4921
Craig Mautnerd61dc202014-07-07 11:09:11 -07004922 public boolean isTopOfTask(IBinder token) throws RemoteException {
4923 Parcel data = Parcel.obtain();
4924 Parcel reply = Parcel.obtain();
4925 data.writeInterfaceToken(IActivityManager.descriptor);
4926 data.writeStrongBinder(token);
4927 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4928 reply.readException();
4929 boolean res = reply.readInt() == 1;
4930 data.recycle();
4931 reply.recycle();
4932 return res;
4933 }
4934
Daniel Sandler69a48172010-06-23 16:29:36 -04004935 public boolean isTopActivityImmersive()
4936 throws RemoteException {
4937 Parcel data = Parcel.obtain();
4938 Parcel reply = Parcel.obtain();
4939 data.writeInterfaceToken(IActivityManager.descriptor);
4940 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004941 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004942 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004943 data.recycle();
4944 reply.recycle();
4945 return res;
4946 }
4947
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004948 public void crashApplication(int uid, int initialPid, String packageName,
4949 String message) throws RemoteException {
4950 Parcel data = Parcel.obtain();
4951 Parcel reply = Parcel.obtain();
4952 data.writeInterfaceToken(IActivityManager.descriptor);
4953 data.writeInt(uid);
4954 data.writeInt(initialPid);
4955 data.writeString(packageName);
4956 data.writeString(message);
4957 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4958 reply.readException();
4959 data.recycle();
4960 reply.recycle();
4961 }
Andy McFadden824c5102010-07-09 16:26:57 -07004962
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004963 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004964 Parcel data = Parcel.obtain();
4965 Parcel reply = Parcel.obtain();
4966 data.writeInterfaceToken(IActivityManager.descriptor);
4967 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004968 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004969 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4970 reply.readException();
4971 String res = reply.readString();
4972 data.recycle();
4973 reply.recycle();
4974 return res;
4975 }
4976
Dianne Hackborn7e269642010-08-25 19:50:20 -07004977 public IBinder newUriPermissionOwner(String name)
4978 throws RemoteException {
4979 Parcel data = Parcel.obtain();
4980 Parcel reply = Parcel.obtain();
4981 data.writeInterfaceToken(IActivityManager.descriptor);
4982 data.writeString(name);
4983 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4984 reply.readException();
4985 IBinder res = reply.readStrongBinder();
4986 data.recycle();
4987 reply.recycle();
4988 return res;
4989 }
4990
4991 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004992 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004993 Parcel data = Parcel.obtain();
4994 Parcel reply = Parcel.obtain();
4995 data.writeInterfaceToken(IActivityManager.descriptor);
4996 data.writeStrongBinder(owner);
4997 data.writeInt(fromUid);
4998 data.writeString(targetPkg);
4999 uri.writeToParcel(data, 0);
5000 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005001 data.writeInt(sourceUserId);
5002 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005003 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5004 reply.readException();
5005 data.recycle();
5006 reply.recycle();
5007 }
5008
5009 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005010 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005011 Parcel data = Parcel.obtain();
5012 Parcel reply = Parcel.obtain();
5013 data.writeInterfaceToken(IActivityManager.descriptor);
5014 data.writeStrongBinder(owner);
5015 if (uri != null) {
5016 data.writeInt(1);
5017 uri.writeToParcel(data, 0);
5018 } else {
5019 data.writeInt(0);
5020 }
5021 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005022 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005023 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5024 reply.readException();
5025 data.recycle();
5026 reply.recycle();
5027 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005028
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005029 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005030 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005031 Parcel data = Parcel.obtain();
5032 Parcel reply = Parcel.obtain();
5033 data.writeInterfaceToken(IActivityManager.descriptor);
5034 data.writeInt(callingUid);
5035 data.writeString(targetPkg);
5036 uri.writeToParcel(data, 0);
5037 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005038 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005039 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5040 reply.readException();
5041 int res = reply.readInt();
5042 data.recycle();
5043 reply.recycle();
5044 return res;
5045 }
5046
Dianne Hackborn1676c852012-09-10 14:52:30 -07005047 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005048 String path, ParcelFileDescriptor fd) throws RemoteException {
5049 Parcel data = Parcel.obtain();
5050 Parcel reply = Parcel.obtain();
5051 data.writeInterfaceToken(IActivityManager.descriptor);
5052 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005053 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005054 data.writeInt(managed ? 1 : 0);
5055 data.writeString(path);
5056 if (fd != null) {
5057 data.writeInt(1);
5058 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5059 } else {
5060 data.writeInt(0);
5061 }
5062 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5063 reply.readException();
5064 boolean res = reply.readInt() != 0;
5065 reply.recycle();
5066 data.recycle();
5067 return res;
5068 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005069
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005070 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005071 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005072 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005073 Parcel data = Parcel.obtain();
5074 Parcel reply = Parcel.obtain();
5075 data.writeInterfaceToken(IActivityManager.descriptor);
5076 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005077 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005078 data.writeTypedArray(intents, 0);
5079 data.writeStringArray(resolvedTypes);
5080 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005081 if (options != null) {
5082 data.writeInt(1);
5083 options.writeToParcel(data, 0);
5084 } else {
5085 data.writeInt(0);
5086 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005087 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005088 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5089 reply.readException();
5090 int result = reply.readInt();
5091 reply.recycle();
5092 data.recycle();
5093 return result;
5094 }
5095
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005096 public int getFrontActivityScreenCompatMode() throws RemoteException {
5097 Parcel data = Parcel.obtain();
5098 Parcel reply = Parcel.obtain();
5099 data.writeInterfaceToken(IActivityManager.descriptor);
5100 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5101 reply.readException();
5102 int mode = reply.readInt();
5103 reply.recycle();
5104 data.recycle();
5105 return mode;
5106 }
5107
5108 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5109 Parcel data = Parcel.obtain();
5110 Parcel reply = Parcel.obtain();
5111 data.writeInterfaceToken(IActivityManager.descriptor);
5112 data.writeInt(mode);
5113 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5114 reply.readException();
5115 reply.recycle();
5116 data.recycle();
5117 }
5118
5119 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5120 Parcel data = Parcel.obtain();
5121 Parcel reply = Parcel.obtain();
5122 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005123 data.writeString(packageName);
5124 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005125 reply.readException();
5126 int mode = reply.readInt();
5127 reply.recycle();
5128 data.recycle();
5129 return mode;
5130 }
5131
5132 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005133 throws RemoteException {
5134 Parcel data = Parcel.obtain();
5135 Parcel reply = Parcel.obtain();
5136 data.writeInterfaceToken(IActivityManager.descriptor);
5137 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005138 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005139 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5140 reply.readException();
5141 reply.recycle();
5142 data.recycle();
5143 }
5144
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005145 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5146 Parcel data = Parcel.obtain();
5147 Parcel reply = Parcel.obtain();
5148 data.writeInterfaceToken(IActivityManager.descriptor);
5149 data.writeString(packageName);
5150 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5151 reply.readException();
5152 boolean ask = reply.readInt() != 0;
5153 reply.recycle();
5154 data.recycle();
5155 return ask;
5156 }
5157
5158 public void setPackageAskScreenCompat(String packageName, boolean ask)
5159 throws RemoteException {
5160 Parcel data = Parcel.obtain();
5161 Parcel reply = Parcel.obtain();
5162 data.writeInterfaceToken(IActivityManager.descriptor);
5163 data.writeString(packageName);
5164 data.writeInt(ask ? 1 : 0);
5165 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5166 reply.readException();
5167 reply.recycle();
5168 data.recycle();
5169 }
5170
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005171 public boolean switchUser(int userid) throws RemoteException {
5172 Parcel data = Parcel.obtain();
5173 Parcel reply = Parcel.obtain();
5174 data.writeInterfaceToken(IActivityManager.descriptor);
5175 data.writeInt(userid);
5176 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5177 reply.readException();
5178 boolean result = reply.readInt() != 0;
5179 reply.recycle();
5180 data.recycle();
5181 return result;
5182 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005183
Kenny Guy08488bf2014-02-21 17:40:37 +00005184 public boolean startUserInBackground(int userid) throws RemoteException {
5185 Parcel data = Parcel.obtain();
5186 Parcel reply = Parcel.obtain();
5187 data.writeInterfaceToken(IActivityManager.descriptor);
5188 data.writeInt(userid);
5189 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5190 reply.readException();
5191 boolean result = reply.readInt() != 0;
5192 reply.recycle();
5193 data.recycle();
5194 return result;
5195 }
5196
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005197 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5198 Parcel data = Parcel.obtain();
5199 Parcel reply = Parcel.obtain();
5200 data.writeInterfaceToken(IActivityManager.descriptor);
5201 data.writeInt(userid);
5202 data.writeStrongInterface(callback);
5203 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5204 reply.readException();
5205 int result = reply.readInt();
5206 reply.recycle();
5207 data.recycle();
5208 return result;
5209 }
5210
Amith Yamasani52f1d752012-03-28 18:19:29 -07005211 public UserInfo getCurrentUser() throws RemoteException {
5212 Parcel data = Parcel.obtain();
5213 Parcel reply = Parcel.obtain();
5214 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005215 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005216 reply.readException();
5217 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5218 reply.recycle();
5219 data.recycle();
5220 return userInfo;
5221 }
5222
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005223 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005224 Parcel data = Parcel.obtain();
5225 Parcel reply = Parcel.obtain();
5226 data.writeInterfaceToken(IActivityManager.descriptor);
5227 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005228 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005229 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5230 reply.readException();
5231 boolean result = reply.readInt() != 0;
5232 reply.recycle();
5233 data.recycle();
5234 return result;
5235 }
5236
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005237 public int[] getRunningUserIds() throws RemoteException {
5238 Parcel data = Parcel.obtain();
5239 Parcel reply = Parcel.obtain();
5240 data.writeInterfaceToken(IActivityManager.descriptor);
5241 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5242 reply.readException();
5243 int[] result = reply.createIntArray();
5244 reply.recycle();
5245 data.recycle();
5246 return result;
5247 }
5248
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005249 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005250 Parcel data = Parcel.obtain();
5251 Parcel reply = Parcel.obtain();
5252 data.writeInterfaceToken(IActivityManager.descriptor);
5253 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005254 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5255 reply.readException();
5256 boolean result = reply.readInt() != 0;
5257 reply.recycle();
5258 data.recycle();
5259 return result;
5260 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005261
Jeff Sharkeya4620792011-05-20 15:29:23 -07005262 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5263 Parcel data = Parcel.obtain();
5264 Parcel reply = Parcel.obtain();
5265 data.writeInterfaceToken(IActivityManager.descriptor);
5266 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5267 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5268 reply.readException();
5269 data.recycle();
5270 reply.recycle();
5271 }
5272
5273 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5274 Parcel data = Parcel.obtain();
5275 Parcel reply = Parcel.obtain();
5276 data.writeInterfaceToken(IActivityManager.descriptor);
5277 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5278 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5279 reply.readException();
5280 data.recycle();
5281 reply.recycle();
5282 }
5283
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005284 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5285 Parcel data = Parcel.obtain();
5286 Parcel reply = Parcel.obtain();
5287 data.writeInterfaceToken(IActivityManager.descriptor);
5288 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5289 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5290 reply.readException();
5291 data.recycle();
5292 reply.recycle();
5293 }
5294
5295 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5296 Parcel data = Parcel.obtain();
5297 Parcel reply = Parcel.obtain();
5298 data.writeInterfaceToken(IActivityManager.descriptor);
5299 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5300 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5301 reply.readException();
5302 data.recycle();
5303 reply.recycle();
5304 }
5305
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005306 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5307 Parcel data = Parcel.obtain();
5308 Parcel reply = Parcel.obtain();
5309 data.writeInterfaceToken(IActivityManager.descriptor);
5310 data.writeStrongBinder(sender.asBinder());
5311 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5312 reply.readException();
5313 boolean res = reply.readInt() != 0;
5314 data.recycle();
5315 reply.recycle();
5316 return res;
5317 }
5318
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005319 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5320 Parcel data = Parcel.obtain();
5321 Parcel reply = Parcel.obtain();
5322 data.writeInterfaceToken(IActivityManager.descriptor);
5323 data.writeStrongBinder(sender.asBinder());
5324 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5325 reply.readException();
5326 boolean res = reply.readInt() != 0;
5327 data.recycle();
5328 reply.recycle();
5329 return res;
5330 }
5331
Dianne Hackborn81038902012-11-26 17:04:09 -08005332 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5333 Parcel data = Parcel.obtain();
5334 Parcel reply = Parcel.obtain();
5335 data.writeInterfaceToken(IActivityManager.descriptor);
5336 data.writeStrongBinder(sender.asBinder());
5337 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5338 reply.readException();
5339 Intent res = reply.readInt() != 0
5340 ? Intent.CREATOR.createFromParcel(reply) : null;
5341 data.recycle();
5342 reply.recycle();
5343 return res;
5344 }
5345
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005346 public String getTagForIntentSender(IIntentSender sender, String prefix)
5347 throws RemoteException {
5348 Parcel data = Parcel.obtain();
5349 Parcel reply = Parcel.obtain();
5350 data.writeInterfaceToken(IActivityManager.descriptor);
5351 data.writeStrongBinder(sender.asBinder());
5352 data.writeString(prefix);
5353 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5354 reply.readException();
5355 String res = reply.readString();
5356 data.recycle();
5357 reply.recycle();
5358 return res;
5359 }
5360
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005361 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5362 {
5363 Parcel data = Parcel.obtain();
5364 Parcel reply = Parcel.obtain();
5365 data.writeInterfaceToken(IActivityManager.descriptor);
5366 values.writeToParcel(data, 0);
5367 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5368 reply.readException();
5369 data.recycle();
5370 reply.recycle();
5371 }
5372
Dianne Hackbornb437e092011-08-05 17:50:29 -07005373 public long[] getProcessPss(int[] pids) throws RemoteException {
5374 Parcel data = Parcel.obtain();
5375 Parcel reply = Parcel.obtain();
5376 data.writeInterfaceToken(IActivityManager.descriptor);
5377 data.writeIntArray(pids);
5378 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5379 reply.readException();
5380 long[] res = reply.createLongArray();
5381 data.recycle();
5382 reply.recycle();
5383 return res;
5384 }
5385
Dianne Hackborn661cd522011-08-22 00:26:20 -07005386 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5387 Parcel data = Parcel.obtain();
5388 Parcel reply = Parcel.obtain();
5389 data.writeInterfaceToken(IActivityManager.descriptor);
5390 TextUtils.writeToParcel(msg, data, 0);
5391 data.writeInt(always ? 1 : 0);
5392 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5393 reply.readException();
5394 data.recycle();
5395 reply.recycle();
5396 }
5397
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005398 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005399 Parcel data = Parcel.obtain();
5400 Parcel reply = Parcel.obtain();
5401 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005402 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005403 reply.readException();
5404 data.recycle();
5405 reply.recycle();
5406 }
5407
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005408 public void keyguardGoingAway(boolean disableWindowAnimations,
5409 boolean keyguardGoingToNotificationShade) throws RemoteException {
5410 Parcel data = Parcel.obtain();
5411 Parcel reply = Parcel.obtain();
5412 data.writeInterfaceToken(IActivityManager.descriptor);
5413 data.writeInt(disableWindowAnimations ? 1 : 0);
5414 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5415 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5416 reply.readException();
5417 data.recycle();
5418 reply.recycle();
5419 }
5420
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005421 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005422 throws RemoteException {
5423 Parcel data = Parcel.obtain();
5424 Parcel reply = Parcel.obtain();
5425 data.writeInterfaceToken(IActivityManager.descriptor);
5426 data.writeStrongBinder(token);
5427 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005428 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005429 reply.readException();
5430 boolean result = reply.readInt() != 0;
5431 data.recycle();
5432 reply.recycle();
5433 return result;
5434 }
5435
5436 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5437 throws RemoteException {
5438 Parcel data = Parcel.obtain();
5439 Parcel reply = Parcel.obtain();
5440 data.writeInterfaceToken(IActivityManager.descriptor);
5441 data.writeStrongBinder(token);
5442 target.writeToParcel(data, 0);
5443 data.writeInt(resultCode);
5444 if (resultData != null) {
5445 data.writeInt(1);
5446 resultData.writeToParcel(data, 0);
5447 } else {
5448 data.writeInt(0);
5449 }
5450 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5451 reply.readException();
5452 boolean result = reply.readInt() != 0;
5453 data.recycle();
5454 reply.recycle();
5455 return result;
5456 }
5457
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005458 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5459 Parcel data = Parcel.obtain();
5460 Parcel reply = Parcel.obtain();
5461 data.writeInterfaceToken(IActivityManager.descriptor);
5462 data.writeStrongBinder(activityToken);
5463 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5464 reply.readException();
5465 int result = reply.readInt();
5466 data.recycle();
5467 reply.recycle();
5468 return result;
5469 }
5470
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005471 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5472 Parcel data = Parcel.obtain();
5473 Parcel reply = Parcel.obtain();
5474 data.writeInterfaceToken(IActivityManager.descriptor);
5475 data.writeStrongBinder(activityToken);
5476 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5477 reply.readException();
5478 String result = reply.readString();
5479 data.recycle();
5480 reply.recycle();
5481 return result;
5482 }
5483
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005484 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5485 Parcel data = Parcel.obtain();
5486 Parcel reply = Parcel.obtain();
5487 data.writeInterfaceToken(IActivityManager.descriptor);
5488 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5489 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5490 reply.readException();
5491 data.recycle();
5492 reply.recycle();
5493 }
5494
5495 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5496 Parcel data = Parcel.obtain();
5497 Parcel reply = Parcel.obtain();
5498 data.writeInterfaceToken(IActivityManager.descriptor);
5499 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5500 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5501 reply.readException();
5502 data.recycle();
5503 reply.recycle();
5504 }
5505
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005506 public void requestBugReport() throws RemoteException {
5507 Parcel data = Parcel.obtain();
5508 Parcel reply = Parcel.obtain();
5509 data.writeInterfaceToken(IActivityManager.descriptor);
5510 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5511 reply.readException();
5512 data.recycle();
5513 reply.recycle();
5514 }
5515
Jeff Brownbd181bb2013-09-10 16:44:24 -07005516 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5517 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005518 Parcel data = Parcel.obtain();
5519 Parcel reply = Parcel.obtain();
5520 data.writeInterfaceToken(IActivityManager.descriptor);
5521 data.writeInt(pid);
5522 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005523 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005524 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5525 reply.readException();
5526 long res = reply.readInt();
5527 data.recycle();
5528 reply.recycle();
5529 return res;
5530 }
5531
Adam Skorydfc7fd72013-08-05 19:23:41 -07005532 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005533 Parcel data = Parcel.obtain();
5534 Parcel reply = Parcel.obtain();
5535 data.writeInterfaceToken(IActivityManager.descriptor);
5536 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005537 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005538 reply.readException();
5539 Bundle res = reply.readBundle();
5540 data.recycle();
5541 reply.recycle();
5542 return res;
5543 }
5544
Dianne Hackborn17f69352015-07-17 18:04:14 -07005545 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5546 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005547 Parcel data = Parcel.obtain();
5548 Parcel reply = Parcel.obtain();
5549 data.writeInterfaceToken(IActivityManager.descriptor);
5550 data.writeInt(requestType);
5551 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005552 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005553 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5554 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005555 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005556 data.recycle();
5557 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005558 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005559 }
5560
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005561 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005562 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005563 Parcel data = Parcel.obtain();
5564 Parcel reply = Parcel.obtain();
5565 data.writeInterfaceToken(IActivityManager.descriptor);
5566 data.writeStrongBinder(token);
5567 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005568 structure.writeToParcel(data, 0);
5569 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005570 if (referrer != null) {
5571 data.writeInt(1);
5572 referrer.writeToParcel(data, 0);
5573 } else {
5574 data.writeInt(0);
5575 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005576 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005577 reply.readException();
5578 data.recycle();
5579 reply.recycle();
5580 }
5581
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005582 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5583 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005584 Parcel data = Parcel.obtain();
5585 Parcel reply = Parcel.obtain();
5586 data.writeInterfaceToken(IActivityManager.descriptor);
5587 intent.writeToParcel(data, 0);
5588 data.writeInt(requestType);
5589 data.writeString(hint);
5590 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005591 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005592 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5593 reply.readException();
5594 boolean res = reply.readInt() != 0;
5595 data.recycle();
5596 reply.recycle();
5597 return res;
5598 }
5599
Dianne Hackborn17f69352015-07-17 18:04:14 -07005600 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005601 Parcel data = Parcel.obtain();
5602 Parcel reply = Parcel.obtain();
5603 data.writeInterfaceToken(IActivityManager.descriptor);
5604 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5605 reply.readException();
5606 boolean res = reply.readInt() != 0;
5607 data.recycle();
5608 reply.recycle();
5609 return res;
5610 }
5611
Dianne Hackborn17f69352015-07-17 18:04:14 -07005612 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5613 Parcel data = Parcel.obtain();
5614 Parcel reply = Parcel.obtain();
5615 data.writeInterfaceToken(IActivityManager.descriptor);
5616 data.writeStrongBinder(token);
5617 data.writeBundle(args);
5618 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5619 reply.readException();
5620 boolean res = reply.readInt() != 0;
5621 data.recycle();
5622 reply.recycle();
5623 return res;
5624 }
5625
Svetoslavaa41add2015-08-06 15:03:55 -07005626 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005627 Parcel data = Parcel.obtain();
5628 Parcel reply = Parcel.obtain();
5629 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005630 data.writeInt(appId);
5631 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005632 data.writeString(reason);
5633 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5634 reply.readException();
5635 data.recycle();
5636 reply.recycle();
5637 }
5638
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005639 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5640 Parcel data = Parcel.obtain();
5641 Parcel reply = Parcel.obtain();
5642 data.writeInterfaceToken(IActivityManager.descriptor);
5643 data.writeStrongBinder(who);
5644 data.writeInt(allowRestart ? 1 : 0);
5645 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5646 reply.readException();
5647 data.recycle();
5648 reply.recycle();
5649 }
5650
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005651 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5652 Parcel data = Parcel.obtain();
5653 Parcel reply = Parcel.obtain();
5654 data.writeInterfaceToken(IActivityManager.descriptor);
5655 data.writeStrongBinder(token);
5656 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5657 reply.readException();
5658 data.recycle();
5659 reply.recycle();
5660 }
5661
Craig Mautner5eda9b32013-07-02 11:58:16 -07005662 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5663 Parcel data = Parcel.obtain();
5664 Parcel reply = Parcel.obtain();
5665 data.writeInterfaceToken(IActivityManager.descriptor);
5666 data.writeStrongBinder(token);
5667 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5668 reply.readException();
5669 data.recycle();
5670 reply.recycle();
5671 }
5672
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005673 public void restart() throws RemoteException {
5674 Parcel data = Parcel.obtain();
5675 Parcel reply = Parcel.obtain();
5676 data.writeInterfaceToken(IActivityManager.descriptor);
5677 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5678 reply.readException();
5679 data.recycle();
5680 reply.recycle();
5681 }
5682
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005683 public void performIdleMaintenance() throws RemoteException {
5684 Parcel data = Parcel.obtain();
5685 Parcel reply = Parcel.obtain();
5686 data.writeInterfaceToken(IActivityManager.descriptor);
5687 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5688 reply.readException();
5689 data.recycle();
5690 reply.recycle();
5691 }
5692
Todd Kennedyca4d8422015-01-15 15:19:22 -08005693 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005694 IActivityContainerCallback callback) throws RemoteException {
5695 Parcel data = Parcel.obtain();
5696 Parcel reply = Parcel.obtain();
5697 data.writeInterfaceToken(IActivityManager.descriptor);
5698 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005699 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005700 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005701 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005702 final int result = reply.readInt();
5703 final IActivityContainer res;
5704 if (result == 1) {
5705 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5706 } else {
5707 res = null;
5708 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005709 data.recycle();
5710 reply.recycle();
5711 return res;
5712 }
5713
Craig Mautner95da1082014-02-24 17:54:35 -08005714 public void deleteActivityContainer(IActivityContainer activityContainer)
5715 throws RemoteException {
5716 Parcel data = Parcel.obtain();
5717 Parcel reply = Parcel.obtain();
5718 data.writeInterfaceToken(IActivityManager.descriptor);
5719 data.writeStrongBinder(activityContainer.asBinder());
5720 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5721 reply.readException();
5722 data.recycle();
5723 reply.recycle();
5724 }
5725
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005726 public boolean startBinderTracking() throws RemoteException {
5727 Parcel data = Parcel.obtain();
5728 Parcel reply = Parcel.obtain();
5729 data.writeInterfaceToken(IActivityManager.descriptor);
5730 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5731 reply.readException();
5732 boolean res = reply.readInt() != 0;
5733 reply.recycle();
5734 data.recycle();
5735 return res;
5736 }
5737
5738 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5739 Parcel data = Parcel.obtain();
5740 Parcel reply = Parcel.obtain();
5741 data.writeInterfaceToken(IActivityManager.descriptor);
5742 if (fd != null) {
5743 data.writeInt(1);
5744 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5745 } else {
5746 data.writeInt(0);
5747 }
5748 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5749 reply.readException();
5750 boolean res = reply.readInt() != 0;
5751 reply.recycle();
5752 data.recycle();
5753 return res;
5754 }
5755
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005756 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005757 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5758 Parcel data = Parcel.obtain();
5759 Parcel reply = Parcel.obtain();
5760 data.writeInterfaceToken(IActivityManager.descriptor);
5761 data.writeInt(displayId);
5762 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5763 reply.readException();
5764 final int result = reply.readInt();
5765 final IActivityContainer res;
5766 if (result == 1) {
5767 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5768 } else {
5769 res = null;
5770 }
5771 data.recycle();
5772 reply.recycle();
5773 return res;
5774 }
5775
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005776 @Override
5777 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005778 throws RemoteException {
5779 Parcel data = Parcel.obtain();
5780 Parcel reply = Parcel.obtain();
5781 data.writeInterfaceToken(IActivityManager.descriptor);
5782 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005783 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005784 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005785 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005786 data.recycle();
5787 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005788 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005789 }
5790
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005791 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005792 public void startLockTaskMode(int taskId) throws RemoteException {
5793 Parcel data = Parcel.obtain();
5794 Parcel reply = Parcel.obtain();
5795 data.writeInterfaceToken(IActivityManager.descriptor);
5796 data.writeInt(taskId);
5797 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5798 reply.readException();
5799 data.recycle();
5800 reply.recycle();
5801 }
5802
5803 @Override
5804 public void startLockTaskMode(IBinder token) throws RemoteException {
5805 Parcel data = Parcel.obtain();
5806 Parcel reply = Parcel.obtain();
5807 data.writeInterfaceToken(IActivityManager.descriptor);
5808 data.writeStrongBinder(token);
5809 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5810 reply.readException();
5811 data.recycle();
5812 reply.recycle();
5813 }
5814
5815 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005816 public void startLockTaskModeOnCurrent() throws RemoteException {
5817 Parcel data = Parcel.obtain();
5818 Parcel reply = Parcel.obtain();
5819 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005820 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005821 reply.readException();
5822 data.recycle();
5823 reply.recycle();
5824 }
5825
5826 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005827 public void stopLockTaskMode() throws RemoteException {
5828 Parcel data = Parcel.obtain();
5829 Parcel reply = Parcel.obtain();
5830 data.writeInterfaceToken(IActivityManager.descriptor);
5831 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5832 reply.readException();
5833 data.recycle();
5834 reply.recycle();
5835 }
5836
5837 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005838 public void stopLockTaskModeOnCurrent() throws RemoteException {
5839 Parcel data = Parcel.obtain();
5840 Parcel reply = Parcel.obtain();
5841 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005842 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005843 reply.readException();
5844 data.recycle();
5845 reply.recycle();
5846 }
5847
5848 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005849 public boolean isInLockTaskMode() throws RemoteException {
5850 Parcel data = Parcel.obtain();
5851 Parcel reply = Parcel.obtain();
5852 data.writeInterfaceToken(IActivityManager.descriptor);
5853 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5854 reply.readException();
5855 boolean isInLockTaskMode = reply.readInt() == 1;
5856 data.recycle();
5857 reply.recycle();
5858 return isInLockTaskMode;
5859 }
5860
Craig Mautner688b5102014-03-27 16:55:03 -07005861 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005862 public int getLockTaskModeState() throws RemoteException {
5863 Parcel data = Parcel.obtain();
5864 Parcel reply = Parcel.obtain();
5865 data.writeInterfaceToken(IActivityManager.descriptor);
5866 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5867 reply.readException();
5868 int lockTaskModeState = reply.readInt();
5869 data.recycle();
5870 reply.recycle();
5871 return lockTaskModeState;
5872 }
5873
5874 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005875 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5876 Parcel data = Parcel.obtain();
5877 Parcel reply = Parcel.obtain();
5878 data.writeInterfaceToken(IActivityManager.descriptor);
5879 data.writeStrongBinder(token);
5880 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5881 IBinder.FLAG_ONEWAY);
5882 reply.readException();
5883 data.recycle();
5884 reply.recycle();
5885 }
5886
5887 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005888 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005889 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005890 Parcel data = Parcel.obtain();
5891 Parcel reply = Parcel.obtain();
5892 data.writeInterfaceToken(IActivityManager.descriptor);
5893 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005894 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005895 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005896 reply.readException();
5897 data.recycle();
5898 reply.recycle();
5899 }
5900
Craig Mautneree2e45a2014-06-27 12:10:03 -07005901 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005902 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5903 Parcel data = Parcel.obtain();
5904 Parcel reply = Parcel.obtain();
5905 data.writeInterfaceToken(IActivityManager.descriptor);
5906 data.writeInt(taskId);
5907 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005908 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005909 reply.readException();
5910 data.recycle();
5911 reply.recycle();
5912 }
5913
5914 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005915 public void resizeTask(int taskId, Rect r) throws RemoteException
5916 {
5917 Parcel data = Parcel.obtain();
5918 Parcel reply = Parcel.obtain();
5919 data.writeInterfaceToken(IActivityManager.descriptor);
5920 data.writeInt(taskId);
5921 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005922 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005923 reply.readException();
5924 data.recycle();
5925 reply.recycle();
5926 }
5927
5928 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07005929 public Rect getTaskBounds(int taskId) throws RemoteException
5930 {
5931 Parcel data = Parcel.obtain();
5932 Parcel reply = Parcel.obtain();
5933 data.writeInterfaceToken(IActivityManager.descriptor);
5934 data.writeInt(taskId);
5935 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
5936 reply.readException();
5937 Rect rect = Rect.CREATOR.createFromParcel(reply);
5938 data.recycle();
5939 reply.recycle();
5940 return rect;
5941 }
5942
5943 @Override
Skuhnece2faa52015-08-11 10:36:38 -07005944 public void setActivityBounds(IBinder token, Rect r) throws RemoteException
5945 {
5946 Parcel data = Parcel.obtain();
5947 Parcel reply = Parcel.obtain();
5948 data.writeInterfaceToken(IActivityManager.descriptor);
5949 data.writeStrongBinder(token);
5950 r.writeToParcel(data, 0);
5951 mRemote.transact(SET_ACTIVITY_BOUNDS_TRANSACTION, data, reply, 0);
5952 reply.readException();
5953 data.recycle();
5954 reply.recycle();
5955 }
5956
5957 @Override
5958 public Rect getActivityBounds(IBinder token) throws RemoteException
5959 {
5960 Parcel data = Parcel.obtain();
5961 Parcel reply = Parcel.obtain();
5962 data.writeInterfaceToken(IActivityManager.descriptor);
5963 data.writeStrongBinder(token);
5964 mRemote.transact(GET_ACTIVITY_BOUNDS_TRANSACTION, data, reply, 0);
5965 reply.readException();
5966 Rect rect = Rect.CREATOR.createFromParcel(reply);
5967 data.recycle();
5968 reply.recycle();
5969 return rect;
5970 }
5971
5972 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005973 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5974 Parcel data = Parcel.obtain();
5975 Parcel reply = Parcel.obtain();
5976 data.writeInterfaceToken(IActivityManager.descriptor);
5977 data.writeString(filename);
5978 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5979 reply.readException();
5980 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5981 data.recycle();
5982 reply.recycle();
5983 return icon;
5984 }
5985
5986 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005987 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5988 throws RemoteException {
5989 Parcel data = Parcel.obtain();
5990 Parcel reply = Parcel.obtain();
5991 data.writeInterfaceToken(IActivityManager.descriptor);
5992 if (options == null) {
5993 data.writeInt(0);
5994 } else {
5995 data.writeInt(1);
5996 data.writeBundle(options.toBundle());
5997 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005998 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005999 reply.readException();
6000 data.recycle();
6001 reply.recycle();
6002 }
6003
6004 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006005 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006006 Parcel data = Parcel.obtain();
6007 Parcel reply = Parcel.obtain();
6008 data.writeInterfaceToken(IActivityManager.descriptor);
6009 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006010 data.writeInt(visible ? 1 : 0);
6011 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006012 reply.readException();
6013 boolean success = reply.readInt() > 0;
6014 data.recycle();
6015 reply.recycle();
6016 return success;
6017 }
6018
6019 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006020 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006021 Parcel data = Parcel.obtain();
6022 Parcel reply = Parcel.obtain();
6023 data.writeInterfaceToken(IActivityManager.descriptor);
6024 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006025 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006026 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006027 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006028 data.recycle();
6029 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006030 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006031 }
6032
6033 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006034 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006035 Parcel data = Parcel.obtain();
6036 Parcel reply = Parcel.obtain();
6037 data.writeInterfaceToken(IActivityManager.descriptor);
6038 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006039 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006040 reply.readException();
6041 data.recycle();
6042 reply.recycle();
6043 }
6044
6045 @Override
6046 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6047 Parcel data = Parcel.obtain();
6048 Parcel reply = Parcel.obtain();
6049 data.writeInterfaceToken(IActivityManager.descriptor);
6050 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006051 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006052 reply.readException();
6053 data.recycle();
6054 reply.recycle();
6055 }
6056
Craig Mautner8746a472014-07-24 15:12:54 -07006057 @Override
6058 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6059 Parcel data = Parcel.obtain();
6060 Parcel reply = Parcel.obtain();
6061 data.writeInterfaceToken(IActivityManager.descriptor);
6062 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006063 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006064 reply.readException();
6065 data.recycle();
6066 reply.recycle();
6067 }
6068
Craig Mautner6e2f3952014-09-09 14:26:41 -07006069 @Override
6070 public void bootAnimationComplete() throws RemoteException {
6071 Parcel data = Parcel.obtain();
6072 Parcel reply = Parcel.obtain();
6073 data.writeInterfaceToken(IActivityManager.descriptor);
6074 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6075 reply.readException();
6076 data.recycle();
6077 reply.recycle();
6078 }
6079
Wale Ogunwale18795a22014-12-03 11:38:33 -08006080 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006081 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6082 Parcel data = Parcel.obtain();
6083 Parcel reply = Parcel.obtain();
6084 data.writeInterfaceToken(IActivityManager.descriptor);
6085 data.writeInt(uid);
6086 data.writeByteArray(firstPacket);
6087 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6088 reply.readException();
6089 data.recycle();
6090 reply.recycle();
6091 }
6092
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006093 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006094 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6095 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006096 Parcel data = Parcel.obtain();
6097 Parcel reply = Parcel.obtain();
6098 data.writeInterfaceToken(IActivityManager.descriptor);
6099 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006100 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006101 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006102 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006103 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6104 reply.readException();
6105 data.recycle();
6106 reply.recycle();
6107 }
6108
6109 @Override
6110 public void dumpHeapFinished(String path) throws RemoteException {
6111 Parcel data = Parcel.obtain();
6112 Parcel reply = Parcel.obtain();
6113 data.writeInterfaceToken(IActivityManager.descriptor);
6114 data.writeString(path);
6115 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6116 reply.readException();
6117 data.recycle();
6118 reply.recycle();
6119 }
6120
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006121 @Override
6122 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6123 throws RemoteException {
6124 Parcel data = Parcel.obtain();
6125 Parcel reply = Parcel.obtain();
6126 data.writeInterfaceToken(IActivityManager.descriptor);
6127 data.writeStrongBinder(session.asBinder());
6128 data.writeInt(keepAwake ? 1 : 0);
6129 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6130 reply.readException();
6131 data.recycle();
6132 reply.recycle();
6133 }
6134
Craig Mautnere5600772015-04-03 21:36:37 -07006135 @Override
6136 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6137 Parcel data = Parcel.obtain();
6138 Parcel reply = Parcel.obtain();
6139 data.writeInterfaceToken(IActivityManager.descriptor);
6140 data.writeInt(userId);
6141 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006142 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006143 reply.readException();
6144 data.recycle();
6145 reply.recycle();
6146 }
6147
Dianne Hackborn1e383822015-04-10 14:02:33 -07006148 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07006149 public void updateDeviceOwner(String packageName) throws RemoteException {
6150 Parcel data = Parcel.obtain();
6151 Parcel reply = Parcel.obtain();
6152 data.writeInterfaceToken(IActivityManager.descriptor);
6153 data.writeString(packageName);
6154 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6155 reply.readException();
6156 data.recycle();
6157 reply.recycle();
6158 }
6159
6160 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006161 public int getPackageProcessState(String packageName, String callingPackage)
6162 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006163 Parcel data = Parcel.obtain();
6164 Parcel reply = Parcel.obtain();
6165 data.writeInterfaceToken(IActivityManager.descriptor);
6166 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006167 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006168 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6169 reply.readException();
6170 int res = reply.readInt();
6171 data.recycle();
6172 reply.recycle();
6173 return res;
6174 }
6175
Stefan Kuhne16045c22015-06-05 07:18:06 -07006176 @Override
6177 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6178 throws RemoteException {
6179 Parcel data = Parcel.obtain();
6180 Parcel reply = Parcel.obtain();
6181 data.writeInterfaceToken(IActivityManager.descriptor);
6182 data.writeString(process);
6183 data.writeInt(userId);
6184 data.writeInt(level);
6185 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6186 reply.readException();
6187 int res = reply.readInt();
6188 data.recycle();
6189 reply.recycle();
6190 return res != 0;
6191 }
6192
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006193 @Override
6194 public boolean isRootVoiceInteraction(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(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6200 reply.readException();
6201 int res = reply.readInt();
6202 data.recycle();
6203 reply.recycle();
6204 return res != 0;
6205 }
6206
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006207 @Override
6208 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6209 Parcel data = Parcel.obtain();
6210 Parcel reply = Parcel.obtain();
6211 data.writeInterfaceToken(IActivityManager.descriptor);
6212 data.writeStrongBinder(token);
6213 data.writeInt(stackId);
6214 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6215 reply.readException();
6216 data.recycle();
6217 reply.recycle();
6218 }
6219
6220 @Override
6221 public int getActivityStackId(IBinder token) throws RemoteException {
6222 Parcel data = Parcel.obtain();
6223 Parcel reply = Parcel.obtain();
6224 data.writeInterfaceToken(IActivityManager.descriptor);
6225 data.writeStrongBinder(token);
6226 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6227 reply.readException();
6228 int stackId = reply.readInt();
6229 data.recycle();
6230 reply.recycle();
6231 return stackId;
6232 }
6233
Filip Gruszczynski23493322015-07-29 17:02:59 -07006234 @Override
6235 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
6236 int[] verticalSizeConfigurations) throws RemoteException {
6237 Parcel data = Parcel.obtain();
6238 Parcel reply = Parcel.obtain();
6239 data.writeInterfaceToken(IActivityManager.descriptor);
6240 data.writeStrongBinder(token);
6241 if (horizontalSizeConfiguration == null) {
6242 data.writeInt(0);
6243 } else {
6244 data.writeInt(horizontalSizeConfiguration.length);
6245 data.writeIntArray(horizontalSizeConfiguration);
6246 }
6247 if (verticalSizeConfigurations == null) {
6248 data.writeInt(0);
6249 } else {
6250 data.writeInt(verticalSizeConfigurations.length);
6251 data.writeIntArray(verticalSizeConfigurations);
6252 }
6253 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6254 reply.readException();
6255 data.recycle();
6256 reply.recycle();
6257 }
6258
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006259 private IBinder mRemote;
6260}