blob: 59ecc03d129574215432bb56b28457b1dbc9ab45 [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
19import android.content.ComponentName;
20import android.content.Intent;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070021import android.content.IIntentReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.pm.ActivityInfo;
23import android.content.pm.ApplicationInfo;
24import android.content.pm.ProviderInfo;
25import android.content.pm.ServiceInfo;
Dianne Hackborne2515ee2011-04-27 18:52:56 -040026import android.content.res.CompatibilityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.content.res.Configuration;
Jason Monk83520b92014-05-09 15:16:06 -040028import android.net.Uri;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.os.Binder;
30import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070031import android.os.Debug;
Dianne Hackborn9c8dd552009-06-23 19:22:52 -070032import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070033import android.os.PersistableBundle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.os.RemoteException;
35import android.os.IBinder;
36import android.os.Parcel;
37import android.os.ParcelFileDescriptor;
Christopher Tate8a2ce3c2015-06-19 10:28:20 -070038import android.os.TransactionTooLargeException;
39import android.util.Log;
40
Dianne Hackborn91097de2014-04-04 18:02:06 -070041import com.android.internal.app.IVoiceInteractor;
Dianne Hackborn85d558c2014-11-04 10:31:54 -080042import com.android.internal.content.ReferrerIntent;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043
44import java.io.FileDescriptor;
45import java.io.IOException;
46import java.util.HashMap;
47import java.util.List;
48import java.util.Map;
49
50/** {@hide} */
51public abstract class ApplicationThreadNative extends Binder
52 implements IApplicationThread {
53 /**
54 * Cast a Binder object into an application thread interface, generating
55 * a proxy if needed.
56 */
57 static public IApplicationThread asInterface(IBinder obj) {
58 if (obj == null) {
59 return null;
60 }
61 IApplicationThread in =
62 (IApplicationThread)obj.queryLocalInterface(descriptor);
63 if (in != null) {
64 return in;
65 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -070066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 return new ApplicationThreadProxy(obj);
68 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -070069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 public ApplicationThreadNative() {
71 attachInterface(this, descriptor);
72 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -070073
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 @Override
75 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
76 throws RemoteException {
77 switch (code) {
78 case SCHEDULE_PAUSE_ACTIVITY_TRANSACTION:
79 {
80 data.enforceInterface(IApplicationThread.descriptor);
81 IBinder b = data.readStrongBinder();
82 boolean finished = data.readInt() != 0;
83 boolean userLeaving = data.readInt() != 0;
84 int configChanges = data.readInt();
Dianne Hackborna4e102e2014-09-04 22:52:27 -070085 boolean dontReport = data.readInt() != 0;
86 schedulePauseActivity(b, finished, userLeaving, configChanges, dontReport);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 return true;
88 }
89
90 case SCHEDULE_STOP_ACTIVITY_TRANSACTION:
91 {
92 data.enforceInterface(IApplicationThread.descriptor);
93 IBinder b = data.readStrongBinder();
94 boolean show = data.readInt() != 0;
95 int configChanges = data.readInt();
96 scheduleStopActivity(b, show, configChanges);
97 return true;
98 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -070099
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 case SCHEDULE_WINDOW_VISIBILITY_TRANSACTION:
101 {
102 data.enforceInterface(IApplicationThread.descriptor);
103 IBinder b = data.readStrongBinder();
104 boolean show = data.readInt() != 0;
105 scheduleWindowVisibility(b, show);
106 return true;
107 }
108
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800109 case SCHEDULE_SLEEPING_TRANSACTION:
110 {
111 data.enforceInterface(IApplicationThread.descriptor);
112 IBinder b = data.readStrongBinder();
113 boolean sleeping = data.readInt() != 0;
114 scheduleSleeping(b, sleeping);
115 return true;
116 }
117
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 case SCHEDULE_RESUME_ACTIVITY_TRANSACTION:
119 {
120 data.enforceInterface(IApplicationThread.descriptor);
121 IBinder b = data.readStrongBinder();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700122 int procState = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123 boolean isForward = data.readInt() != 0;
Adam Powellcfbe9be2013-11-06 14:58:58 -0800124 Bundle resumeArgs = data.readBundle();
125 scheduleResumeActivity(b, procState, isForward, resumeArgs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 return true;
127 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700128
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 case SCHEDULE_SEND_RESULT_TRANSACTION:
130 {
131 data.enforceInterface(IApplicationThread.descriptor);
132 IBinder b = data.readStrongBinder();
133 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
134 scheduleSendResult(b, ri);
135 return true;
136 }
Jeff Hao1b012d32014-08-20 10:35:34 -0700137
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800138 case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION:
139 {
140 data.enforceInterface(IApplicationThread.descriptor);
141 Intent intent = Intent.CREATOR.createFromParcel(data);
142 IBinder b = data.readStrongBinder();
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700143 int ident = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700145 Configuration curConfig = Configuration.CREATOR.createFromParcel(data);
Wale Ogunwale60454db2015-01-23 16:05:07 -0800146 Configuration overrideConfig = null;
147 if (data.readInt() != 0) {
148 overrideConfig = Configuration.CREATOR.createFromParcel(data);
149 }
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400150 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Dianne Hackborn85d558c2014-11-04 10:31:54 -0800151 String referrer = data.readString();
Dianne Hackborn91097de2014-04-04 18:02:06 -0700152 IVoiceInteractor voiceInteractor = IVoiceInteractor.Stub.asInterface(
153 data.readStrongBinder());
Dianne Hackborna413dc02013-07-12 12:02:55 -0700154 int procState = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 Bundle state = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700156 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
Dianne Hackborn85d558c2014-11-04 10:31:54 -0800158 List<ReferrerIntent> pi = data.createTypedArrayList(ReferrerIntent.CREATOR);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159 boolean notResumed = data.readInt() != 0;
160 boolean isForward = data.readInt() != 0;
Jeff Hao1b012d32014-08-20 10:35:34 -0700161 ProfilerInfo profilerInfo = data.readInt() != 0
162 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Wale Ogunwale60454db2015-01-23 16:05:07 -0800163 scheduleLaunchActivity(intent, b, ident, info, curConfig, overrideConfig, compatInfo,
164 referrer, voiceInteractor, procState, state, persistentState, ri, pi,
Dianne Hackborn85d558c2014-11-04 10:31:54 -0800165 notResumed, isForward, profilerInfo);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800166 return true;
167 }
Jeff Hao1b012d32014-08-20 10:35:34 -0700168
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800169 case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION:
170 {
171 data.enforceInterface(IApplicationThread.descriptor);
172 IBinder b = data.readStrongBinder();
173 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
Dianne Hackborn85d558c2014-11-04 10:31:54 -0800174 List<ReferrerIntent> pi = data.createTypedArrayList(ReferrerIntent.CREATOR);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 int configChanges = data.readInt();
176 boolean notResumed = data.readInt() != 0;
Wale Ogunwale60454db2015-01-23 16:05:07 -0800177 Configuration config = Configuration.CREATOR.createFromParcel(data);
178 Configuration overrideConfig = null;
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800179 if (data.readInt() != 0) {
Wale Ogunwale60454db2015-01-23 16:05:07 -0800180 overrideConfig = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800181 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700182 boolean preserveWindows = data.readInt() == 1;
183 scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config, overrideConfig,
184 preserveWindows);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800185 return true;
186 }
Wale Ogunwale60454db2015-01-23 16:05:07 -0800187
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800188 case SCHEDULE_NEW_INTENT_TRANSACTION:
189 {
190 data.enforceInterface(IApplicationThread.descriptor);
Dianne Hackborn85d558c2014-11-04 10:31:54 -0800191 List<ReferrerIntent> pi = data.createTypedArrayList(ReferrerIntent.CREATOR);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800192 IBinder b = data.readStrongBinder();
193 scheduleNewIntent(pi, b);
194 return true;
195 }
196
197 case SCHEDULE_FINISH_ACTIVITY_TRANSACTION:
198 {
199 data.enforceInterface(IApplicationThread.descriptor);
200 IBinder b = data.readStrongBinder();
201 boolean finishing = data.readInt() != 0;
202 int configChanges = data.readInt();
203 scheduleDestroyActivity(b, finishing, configChanges);
204 return true;
205 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700206
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800207 case SCHEDULE_RECEIVER_TRANSACTION:
208 {
209 data.enforceInterface(IApplicationThread.descriptor);
210 Intent intent = Intent.CREATOR.createFromParcel(data);
211 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400212 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800213 int resultCode = data.readInt();
214 String resultData = data.readString();
215 Bundle resultExtras = data.readBundle();
216 boolean sync = data.readInt() != 0;
Dianne Hackborn20e80982012-08-31 19:00:44 -0700217 int sendingUser = data.readInt();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700218 int processState = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400219 scheduleReceiver(intent, info, compatInfo, resultCode, resultData,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700220 resultExtras, sync, sendingUser, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800221 return true;
222 }
223
224 case SCHEDULE_CREATE_SERVICE_TRANSACTION: {
225 data.enforceInterface(IApplicationThread.descriptor);
226 IBinder token = data.readStrongBinder();
227 ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400228 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700229 int processState = data.readInt();
230 scheduleCreateService(token, info, compatInfo, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800231 return true;
232 }
233
234 case SCHEDULE_BIND_SERVICE_TRANSACTION: {
235 data.enforceInterface(IApplicationThread.descriptor);
236 IBinder token = data.readStrongBinder();
237 Intent intent = Intent.CREATOR.createFromParcel(data);
238 boolean rebind = data.readInt() != 0;
Dianne Hackborna413dc02013-07-12 12:02:55 -0700239 int processState = data.readInt();
240 scheduleBindService(token, intent, rebind, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800241 return true;
242 }
243
244 case SCHEDULE_UNBIND_SERVICE_TRANSACTION: {
245 data.enforceInterface(IApplicationThread.descriptor);
246 IBinder token = data.readStrongBinder();
247 Intent intent = Intent.CREATOR.createFromParcel(data);
248 scheduleUnbindService(token, intent);
249 return true;
250 }
251
252 case SCHEDULE_SERVICE_ARGS_TRANSACTION:
253 {
254 data.enforceInterface(IApplicationThread.descriptor);
255 IBinder token = data.readStrongBinder();
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700256 boolean taskRemoved = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800257 int startId = data.readInt();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700258 int fl = data.readInt();
259 Intent args;
260 if (data.readInt() != 0) {
261 args = Intent.CREATOR.createFromParcel(data);
262 } else {
263 args = null;
264 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700265 scheduleServiceArgs(token, taskRemoved, startId, fl, args);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800266 return true;
267 }
268
269 case SCHEDULE_STOP_SERVICE_TRANSACTION:
270 {
271 data.enforceInterface(IApplicationThread.descriptor);
272 IBinder token = data.readStrongBinder();
273 scheduleStopService(token);
274 return true;
275 }
276
277 case BIND_APPLICATION_TRANSACTION:
278 {
279 data.enforceInterface(IApplicationThread.descriptor);
280 String packageName = data.readString();
281 ApplicationInfo info =
282 ApplicationInfo.CREATOR.createFromParcel(data);
283 List<ProviderInfo> providers =
284 data.createTypedArrayList(ProviderInfo.CREATOR);
285 ComponentName testName = (data.readInt() != 0)
286 ? new ComponentName(data) : null;
Jeff Hao1b012d32014-08-20 10:35:34 -0700287 ProfilerInfo profilerInfo = data.readInt() != 0
288 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289 Bundle testArgs = data.readBundle();
290 IBinder binder = data.readStrongBinder();
291 IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800292 binder = data.readStrongBinder();
293 IUiAutomationConnection uiAutomationConnection =
294 IUiAutomationConnection.Stub.asInterface(binder);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 int testMode = data.readInt();
Rahul Chaturvedi52613f92015-06-17 23:54:08 -0400296 boolean enableBinderTracking = data.readInt() != 0;
Man Caocfa78b22015-06-11 20:14:34 -0700297 boolean trackAllocation = data.readInt() != 0;
Christopher Tate181fafa2009-05-14 11:12:14 -0700298 boolean restrictedBackupMode = (data.readInt() != 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700299 boolean persistent = (data.readInt() != 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400301 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800302 HashMap<String, IBinder> services = data.readHashMap(null);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800303 Bundle coreSettings = data.readBundle();
Jeff Hao1b012d32014-08-20 10:35:34 -0700304 bindApplication(packageName, info, providers, testName, profilerInfo, testArgs,
Rahul Chaturvedi52613f92015-06-17 23:54:08 -0400305 testWatcher, uiAutomationConnection, testMode, enableBinderTracking,
Pablo Ceballosa4d4e822015-10-05 10:27:52 -0700306 trackAllocation, restrictedBackupMode, persistent, config, compatInfo, services,
307 coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308 return true;
309 }
Siva Velusamy92a8b222012-03-09 16:24:04 -0800310
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311 case SCHEDULE_EXIT_TRANSACTION:
312 {
313 data.enforceInterface(IApplicationThread.descriptor);
314 scheduleExit();
315 return true;
316 }
317
Christopher Tate5e1ab332009-09-01 20:32:49 -0700318 case SCHEDULE_SUICIDE_TRANSACTION:
319 {
320 data.enforceInterface(IApplicationThread.descriptor);
321 scheduleSuicide();
322 return true;
323 }
324
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800325 case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
326 {
327 data.enforceInterface(IApplicationThread.descriptor);
328 Configuration config = Configuration.CREATOR.createFromParcel(data);
329 scheduleConfigurationChanged(config);
330 return true;
331 }
332
333 case UPDATE_TIME_ZONE_TRANSACTION: {
334 data.enforceInterface(IApplicationThread.descriptor);
335 updateTimeZone();
336 return true;
337 }
338
Robert Greenwalt03595d02010-11-02 14:08:23 -0700339 case CLEAR_DNS_CACHE_TRANSACTION: {
340 data.enforceInterface(IApplicationThread.descriptor);
341 clearDnsCache();
342 return true;
343 }
344
Robert Greenwalt434203a2010-10-11 16:00:27 -0700345 case SET_HTTP_PROXY_TRANSACTION: {
346 data.enforceInterface(IApplicationThread.descriptor);
347 final String proxy = data.readString();
348 final String port = data.readString();
349 final String exclList = data.readString();
Jason Monk83520b92014-05-09 15:16:06 -0400350 final Uri pacFileUrl = Uri.CREATOR.createFromParcel(data);
Jason Monk602b2322013-07-03 17:04:33 -0400351 setHttpProxy(proxy, port, exclList, pacFileUrl);
Robert Greenwalt434203a2010-10-11 16:00:27 -0700352 return true;
353 }
354
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 case PROCESS_IN_BACKGROUND_TRANSACTION: {
356 data.enforceInterface(IApplicationThread.descriptor);
357 processInBackground();
358 return true;
359 }
Robert Greenwalt434203a2010-10-11 16:00:27 -0700360
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800361 case DUMP_SERVICE_TRANSACTION: {
362 data.enforceInterface(IApplicationThread.descriptor);
363 ParcelFileDescriptor fd = data.readFileDescriptor();
364 final IBinder service = data.readStrongBinder();
365 final String[] args = data.readStringArray();
366 if (fd != null) {
367 dumpService(fd.getFileDescriptor(), service, args);
368 try {
369 fd.close();
370 } catch (IOException e) {
371 }
372 }
373 return true;
374 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700375
Marco Nelissen18cb2872011-11-15 11:19:53 -0800376 case DUMP_PROVIDER_TRANSACTION: {
377 data.enforceInterface(IApplicationThread.descriptor);
378 ParcelFileDescriptor fd = data.readFileDescriptor();
379 final IBinder service = data.readStrongBinder();
380 final String[] args = data.readStringArray();
381 if (fd != null) {
382 dumpProvider(fd.getFileDescriptor(), service, args);
383 try {
384 fd.close();
385 } catch (IOException e) {
386 }
387 }
388 return true;
389 }
390
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
392 data.enforceInterface(IApplicationThread.descriptor);
393 IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
394 data.readStrongBinder());
395 Intent intent = Intent.CREATOR.createFromParcel(data);
396 int resultCode = data.readInt();
397 String dataStr = data.readString();
398 Bundle extras = data.readBundle();
399 boolean ordered = data.readInt() != 0;
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700400 boolean sticky = data.readInt() != 0;
Dianne Hackborn20e80982012-08-31 19:00:44 -0700401 int sendingUser = data.readInt();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700402 int processState = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403 scheduleRegisteredReceiver(receiver, intent,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700404 resultCode, dataStr, extras, ordered, sticky, sendingUser, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800405 return true;
406 }
407
408 case SCHEDULE_LOW_MEMORY_TRANSACTION:
409 {
Vairavan Srinivasane94a3e72012-02-01 23:17:14 -0800410 data.enforceInterface(IApplicationThread.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 scheduleLowMemory();
412 return true;
413 }
Jeff Hao1b012d32014-08-20 10:35:34 -0700414
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
416 {
417 data.enforceInterface(IApplicationThread.descriptor);
418 IBinder b = data.readStrongBinder();
Wale Ogunwalec2607b42015-02-07 16:16:59 -0800419 Configuration overrideConfig = null;
420 if (data.readInt() != 0) {
421 overrideConfig = Configuration.CREATOR.createFromParcel(data);
422 }
Filip Gruszczynskica664812015-12-04 12:43:36 -0800423 final boolean reportToActivity = data.readInt() == 1;
424 scheduleActivityConfigurationChanged(b, overrideConfig, reportToActivity);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800425 return true;
426 }
Jeff Hao1b012d32014-08-20 10:35:34 -0700427
Amith Yamasani0af6fa72016-01-17 15:36:19 -0800428 case SCHEDULE_LOCAL_VOICE_INTERACTION_STARTED_TRANSACTION:
429 {
430 data.enforceInterface(IApplicationThread.descriptor);
431 IBinder token = data.readStrongBinder();
432 IVoiceInteractor voiceInteractor = IVoiceInteractor.Stub.asInterface(
433 data.readStrongBinder());
434 scheduleLocalVoiceInteractionStarted(token, voiceInteractor);
435 return true;
436 }
437
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800438 case PROFILER_CONTROL_TRANSACTION:
439 {
440 data.enforceInterface(IApplicationThread.descriptor);
441 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -0700442 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700443 ProfilerInfo profilerInfo = data.readInt() != 0
444 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
445 profilerControl(start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800446 return true;
447 }
Jeff Hao1b012d32014-08-20 10:35:34 -0700448
Dianne Hackborn06de2ea2009-05-21 12:56:43 -0700449 case SET_SCHEDULING_GROUP_TRANSACTION:
450 {
451 data.enforceInterface(IApplicationThread.descriptor);
452 int group = data.readInt();
453 setSchedulingGroup(group);
454 return true;
455 }
Christopher Tate181fafa2009-05-14 11:12:14 -0700456
457 case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
458 {
459 data.enforceInterface(IApplicationThread.descriptor);
460 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400461 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Christopher Tate181fafa2009-05-14 11:12:14 -0700462 int backupMode = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400463 scheduleCreateBackupAgent(appInfo, compatInfo, backupMode);
Christopher Tate181fafa2009-05-14 11:12:14 -0700464 return true;
465 }
Christopher Tate1885b372009-06-04 15:00:33 -0700466
467 case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
468 {
469 data.enforceInterface(IApplicationThread.descriptor);
470 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400471 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
472 scheduleDestroyBackupAgent(appInfo, compatInfo);
Christopher Tate1885b372009-06-04 15:00:33 -0700473 return true;
474 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -0700475
Dianne Hackborn4416c3d2010-05-04 17:22:49 -0700476 case DISPATCH_PACKAGE_BROADCAST_TRANSACTION:
477 {
478 data.enforceInterface(IApplicationThread.descriptor);
479 int cmd = data.readInt();
480 String[] packages = data.readStringArray();
481 dispatchPackageBroadcast(cmd, packages);
482 return true;
483 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -0700484
485 case SCHEDULE_CRASH_TRANSACTION:
486 {
487 data.enforceInterface(IApplicationThread.descriptor);
488 String msg = data.readString();
489 scheduleCrash(msg);
490 return true;
491 }
Andy McFadden824c5102010-07-09 16:26:57 -0700492
493 case DUMP_HEAP_TRANSACTION:
494 {
495 data.enforceInterface(IApplicationThread.descriptor);
496 boolean managed = data.readInt() != 0;
497 String path = data.readString();
498 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700499 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Andy McFadden824c5102010-07-09 16:26:57 -0700500 dumpHeap(managed, path, fd);
501 return true;
502 }
Dianne Hackborn625ac272010-09-17 18:29:22 -0700503
504 case DUMP_ACTIVITY_TRANSACTION: {
505 data.enforceInterface(IApplicationThread.descriptor);
506 ParcelFileDescriptor fd = data.readFileDescriptor();
507 final IBinder activity = data.readStrongBinder();
Dianne Hackborn30d71892010-12-11 10:37:55 -0800508 final String prefix = data.readString();
Dianne Hackborn625ac272010-09-17 18:29:22 -0700509 final String[] args = data.readStringArray();
510 if (fd != null) {
Dianne Hackborn30d71892010-12-11 10:37:55 -0800511 dumpActivity(fd.getFileDescriptor(), activity, prefix, args);
Dianne Hackborn625ac272010-09-17 18:29:22 -0700512 try {
513 fd.close();
514 } catch (IOException e) {
515 }
516 }
517 return true;
518 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800519
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400520 case SET_CORE_SETTINGS_TRANSACTION: {
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800521 data.enforceInterface(IApplicationThread.descriptor);
522 Bundle settings = data.readBundle();
523 setCoreSettings(settings);
524 return true;
525 }
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400526
527 case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: {
528 data.enforceInterface(IApplicationThread.descriptor);
529 String pkg = data.readString();
530 CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data);
531 updatePackageCompatibilityInfo(pkg, compat);
532 return true;
533 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -0700534
535 case SCHEDULE_TRIM_MEMORY_TRANSACTION: {
536 data.enforceInterface(IApplicationThread.descriptor);
537 int level = data.readInt();
538 scheduleTrimMemory(level);
539 return true;
540 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700541
542 case DUMP_MEM_INFO_TRANSACTION:
543 {
544 data.enforceInterface(IApplicationThread.descriptor);
545 ParcelFileDescriptor fd = data.readFileDescriptor();
Dianne Hackborn3bc8f78d2013-09-19 13:34:35 -0700546 Debug.MemoryInfo mi = Debug.MemoryInfo.CREATOR.createFromParcel(data);
Dianne Hackbornb437e092011-08-05 17:50:29 -0700547 boolean checkin = data.readInt() != 0;
Dianne Hackborn64770d12013-05-23 17:51:19 -0700548 boolean dumpInfo = data.readInt() != 0;
549 boolean dumpDalvik = data.readInt() != 0;
Richard Uhlerc14b9cf2015-03-13 12:38:38 -0700550 boolean dumpSummaryOnly = data.readInt() != 0;
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700551 String[] args = data.readStringArray();
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700552 if (fd != null) {
553 try {
Richard Uhlerc14b9cf2015-03-13 12:38:38 -0700554 dumpMemInfo(fd.getFileDescriptor(), mi, checkin, dumpInfo,
555 dumpDalvik, dumpSummaryOnly, args);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700556 } finally {
557 try {
558 fd.close();
559 } catch (IOException e) {
560 // swallowed, not propagated back to the caller
561 }
562 }
563 }
564 reply.writeNoException();
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700565 return true;
566 }
567
568 case DUMP_GFX_INFO_TRANSACTION:
569 {
570 data.enforceInterface(IApplicationThread.descriptor);
571 ParcelFileDescriptor fd = data.readFileDescriptor();
572 String[] args = data.readStringArray();
573 if (fd != null) {
574 try {
575 dumpGfxInfo(fd.getFileDescriptor(), args);
576 } finally {
577 try {
578 fd.close();
579 } catch (IOException e) {
580 // swallowed, not propagated back to the caller
581 }
582 }
583 }
584 reply.writeNoException();
585 return true;
586 }
Jeff Brown6754ba22011-12-14 20:20:01 -0800587
588 case DUMP_DB_INFO_TRANSACTION:
589 {
590 data.enforceInterface(IApplicationThread.descriptor);
591 ParcelFileDescriptor fd = data.readFileDescriptor();
592 String[] args = data.readStringArray();
593 if (fd != null) {
594 try {
595 dumpDbInfo(fd.getFileDescriptor(), args);
596 } finally {
597 try {
598 fd.close();
599 } catch (IOException e) {
600 // swallowed, not propagated back to the caller
601 }
602 }
603 }
604 reply.writeNoException();
605 return true;
606 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700607
608 case UNSTABLE_PROVIDER_DIED_TRANSACTION:
609 {
610 data.enforceInterface(IApplicationThread.descriptor);
611 IBinder provider = data.readStrongBinder();
612 unstableProviderDied(provider);
613 reply.writeNoException();
614 return true;
615 }
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -0800616
Adam Skorydfc7fd72013-08-05 19:23:41 -0700617 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION:
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -0800618 {
619 data.enforceInterface(IApplicationThread.descriptor);
620 IBinder activityToken = data.readStrongBinder();
621 IBinder requestToken = data.readStrongBinder();
622 int requestType = data.readInt();
Adam Skory7140a252013-09-11 12:04:58 +0100623 requestAssistContextExtras(activityToken, requestToken, requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -0800624 reply.writeNoException();
625 return true;
626 }
Craig Mautner5eda9b32013-07-02 11:58:16 -0700627
628 case SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION:
629 {
630 data.enforceInterface(IApplicationThread.descriptor);
631 IBinder token = data.readStrongBinder();
632 boolean timeout = data.readInt() == 1;
633 scheduleTranslucentConversionComplete(token, timeout);
634 reply.writeNoException();
635 return true;
636 }
Dianne Hackborna413dc02013-07-12 12:02:55 -0700637
Craig Mautnereb8abf72014-07-02 15:04:09 -0700638 case SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION:
639 {
640 data.enforceInterface(IApplicationThread.descriptor);
641 IBinder token = data.readStrongBinder();
642 ActivityOptions options = new ActivityOptions(data.readBundle());
643 scheduleOnNewActivityOptions(token, options);
644 reply.writeNoException();
645 return true;
646 }
647
Dianne Hackborna413dc02013-07-12 12:02:55 -0700648 case SET_PROCESS_STATE_TRANSACTION:
649 {
650 data.enforceInterface(IApplicationThread.descriptor);
651 int state = data.readInt();
652 setProcessState(state);
653 reply.writeNoException();
654 return true;
655 }
Jeff Sharkeydd97f422013-10-08 17:01:30 -0700656
657 case SCHEDULE_INSTALL_PROVIDER_TRANSACTION:
658 {
659 data.enforceInterface(IApplicationThread.descriptor);
660 ProviderInfo provider = ProviderInfo.CREATOR.createFromParcel(data);
661 scheduleInstallProvider(provider);
662 reply.writeNoException();
663 return true;
664 }
Narayan Kamathccb2a0862013-12-19 14:49:36 +0000665
666 case UPDATE_TIME_PREFS_TRANSACTION:
667 {
668 data.enforceInterface(IApplicationThread.descriptor);
669 byte is24Hour = data.readByte();
670 updateTimePrefs(is24Hour == (byte) 1);
671 reply.writeNoException();
672 return true;
673 }
Craig Mautneree2e45a2014-06-27 12:10:03 -0700674
Jose Lima4b6c6692014-08-12 17:41:12 -0700675 case CANCEL_VISIBLE_BEHIND_TRANSACTION:
Craig Mautneree2e45a2014-06-27 12:10:03 -0700676 {
677 data.enforceInterface(IApplicationThread.descriptor);
678 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -0700679 scheduleCancelVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -0700680 reply.writeNoException();
681 return true;
682 }
683
Jose Lima4b6c6692014-08-12 17:41:12 -0700684 case BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION:
Craig Mautneree2e45a2014-06-27 12:10:03 -0700685 {
686 data.enforceInterface(IApplicationThread.descriptor);
687 IBinder token = data.readStrongBinder();
688 boolean enabled = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -0700689 scheduleBackgroundVisibleBehindChanged(token, enabled);
Craig Mautneree2e45a2014-06-27 12:10:03 -0700690 reply.writeNoException();
691 return true;
692 }
Craig Mautner8746a472014-07-24 15:12:54 -0700693
694 case ENTER_ANIMATION_COMPLETE_TRANSACTION:
695 {
696 data.enforceInterface(IApplicationThread.descriptor);
697 IBinder token = data.readStrongBinder();
698 scheduleEnterAnimationComplete(token);
699 reply.writeNoException();
700 return true;
701 }
Jeff Sharkey605eb792014-11-04 13:34:06 -0800702
703 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION:
704 {
705 data.enforceInterface(IApplicationThread.descriptor);
706 final byte[] firstPacket = data.createByteArray();
707 notifyCleartextNetwork(firstPacket);
708 reply.writeNoException();
709 return true;
710 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -0400711
712 case START_BINDER_TRACKING_TRANSACTION:
713 {
714 data.enforceInterface(IApplicationThread.descriptor);
715 startBinderTracking();
716 return true;
717 }
718
719 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION:
720 {
721 data.enforceInterface(IApplicationThread.descriptor);
722 ParcelFileDescriptor fd = data.readFileDescriptor();
723 if (fd != null) {
724 stopBinderTrackingAndDump(fd.getFileDescriptor());
725 try {
726 fd.close();
727 } catch (IOException e) {
728 }
729 }
730 return true;
731 }
732
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -0800733 case SCHEDULE_MULTI_WINDOW_CHANGED_TRANSACTION:
Wale Ogunwale5f986092015-12-04 15:35:38 -0800734 {
735 data.enforceInterface(IApplicationThread.descriptor);
736 final IBinder b = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -0800737 final boolean inMultiWindow = data.readInt() != 0;
738 scheduleMultiWindowChanged(b, inMultiWindow);
Wale Ogunwale5f986092015-12-04 15:35:38 -0800739 return true;
740 }
741
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -0800742 case SCHEDULE_PICTURE_IN_PICTURE_CHANGED_TRANSACTION:
Wale Ogunwale5f986092015-12-04 15:35:38 -0800743 {
744 data.enforceInterface(IApplicationThread.descriptor);
745 final IBinder b = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -0800746 final boolean inPip = data.readInt() != 0;
747 schedulePictureInPictureChanged(b, inPip);
Wale Ogunwale5f986092015-12-04 15:35:38 -0800748 return true;
749 }
750
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800751 }
752
753 return super.onTransact(code, data, reply, flags);
754 }
755
756 public IBinder asBinder()
757 {
758 return this;
759 }
760}
761
762class ApplicationThreadProxy implements IApplicationThread {
763 private final IBinder mRemote;
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700764
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800765 public ApplicationThreadProxy(IBinder remote) {
766 mRemote = remote;
767 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700768
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800769 public final IBinder asBinder() {
770 return mRemote;
771 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700772
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 public final void schedulePauseActivity(IBinder token, boolean finished,
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700774 boolean userLeaving, int configChanges, boolean dontReport) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800775 Parcel data = Parcel.obtain();
776 data.writeInterfaceToken(IApplicationThread.descriptor);
777 data.writeStrongBinder(token);
778 data.writeInt(finished ? 1 : 0);
779 data.writeInt(userLeaving ? 1 :0);
780 data.writeInt(configChanges);
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700781 data.writeInt(dontReport ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800782 mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
783 IBinder.FLAG_ONEWAY);
784 data.recycle();
785 }
786
787 public final void scheduleStopActivity(IBinder token, boolean showWindow,
788 int configChanges) throws RemoteException {
789 Parcel data = Parcel.obtain();
790 data.writeInterfaceToken(IApplicationThread.descriptor);
791 data.writeStrongBinder(token);
792 data.writeInt(showWindow ? 1 : 0);
793 data.writeInt(configChanges);
794 mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
795 IBinder.FLAG_ONEWAY);
796 data.recycle();
797 }
798
799 public final void scheduleWindowVisibility(IBinder token,
800 boolean showWindow) throws RemoteException {
801 Parcel data = Parcel.obtain();
802 data.writeInterfaceToken(IApplicationThread.descriptor);
803 data.writeStrongBinder(token);
804 data.writeInt(showWindow ? 1 : 0);
805 mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
806 IBinder.FLAG_ONEWAY);
807 data.recycle();
808 }
809
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800810 public final void scheduleSleeping(IBinder token,
811 boolean sleeping) throws RemoteException {
812 Parcel data = Parcel.obtain();
813 data.writeInterfaceToken(IApplicationThread.descriptor);
814 data.writeStrongBinder(token);
815 data.writeInt(sleeping ? 1 : 0);
816 mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
817 IBinder.FLAG_ONEWAY);
818 data.recycle();
819 }
820
Adam Powellcfbe9be2013-11-06 14:58:58 -0800821 public final void scheduleResumeActivity(IBinder token, int procState, boolean isForward,
822 Bundle resumeArgs)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800823 throws RemoteException {
824 Parcel data = Parcel.obtain();
825 data.writeInterfaceToken(IApplicationThread.descriptor);
826 data.writeStrongBinder(token);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700827 data.writeInt(procState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800828 data.writeInt(isForward ? 1 : 0);
Adam Powellcfbe9be2013-11-06 14:58:58 -0800829 data.writeBundle(resumeArgs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800830 mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
831 IBinder.FLAG_ONEWAY);
832 data.recycle();
833 }
834
835 public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
John Spurlock8a985d22014-02-25 09:40:05 -0500836 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800837 Parcel data = Parcel.obtain();
838 data.writeInterfaceToken(IApplicationThread.descriptor);
839 data.writeStrongBinder(token);
840 data.writeTypedList(results);
841 mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
842 IBinder.FLAG_ONEWAY);
843 data.recycle();
844 }
845
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700846 public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
Wale Ogunwale60454db2015-01-23 16:05:07 -0800847 ActivityInfo info, Configuration curConfig, Configuration overrideConfig,
848 CompatibilityInfo compatInfo, String referrer, IVoiceInteractor voiceInteractor,
849 int procState, Bundle state, PersistableBundle persistentState,
850 List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents,
851 boolean notResumed, boolean isForward, ProfilerInfo profilerInfo) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800852 Parcel data = Parcel.obtain();
853 data.writeInterfaceToken(IApplicationThread.descriptor);
854 intent.writeToParcel(data, 0);
855 data.writeStrongBinder(token);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700856 data.writeInt(ident);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 info.writeToParcel(data, 0);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700858 curConfig.writeToParcel(data, 0);
Wale Ogunwale60454db2015-01-23 16:05:07 -0800859 if (overrideConfig != null) {
860 data.writeInt(1);
861 overrideConfig.writeToParcel(data, 0);
862 } else {
863 data.writeInt(0);
864 }
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400865 compatInfo.writeToParcel(data, 0);
Dianne Hackborn85d558c2014-11-04 10:31:54 -0800866 data.writeString(referrer);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700867 data.writeStrongBinder(voiceInteractor != null ? voiceInteractor.asBinder() : null);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700868 data.writeInt(procState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800869 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -0700870 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800871 data.writeTypedList(pendingResults);
872 data.writeTypedList(pendingNewIntents);
873 data.writeInt(notResumed ? 1 : 0);
874 data.writeInt(isForward ? 1 : 0);
Jeff Hao1b012d32014-08-20 10:35:34 -0700875 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700876 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -0700877 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700878 } else {
879 data.writeInt(0);
880 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800881 mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
882 IBinder.FLAG_ONEWAY);
883 data.recycle();
884 }
885
886 public final void scheduleRelaunchActivity(IBinder token,
Dianne Hackborn85d558c2014-11-04 10:31:54 -0800887 List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents,
Wale Ogunwale60454db2015-01-23 16:05:07 -0800888 int configChanges, boolean notResumed, Configuration config,
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700889 Configuration overrideConfig, boolean preserveWindow) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800890 Parcel data = Parcel.obtain();
891 data.writeInterfaceToken(IApplicationThread.descriptor);
892 data.writeStrongBinder(token);
893 data.writeTypedList(pendingResults);
894 data.writeTypedList(pendingNewIntents);
895 data.writeInt(configChanges);
896 data.writeInt(notResumed ? 1 : 0);
Wale Ogunwale60454db2015-01-23 16:05:07 -0800897 config.writeToParcel(data, 0);
898 if (overrideConfig != null) {
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800899 data.writeInt(1);
Wale Ogunwale60454db2015-01-23 16:05:07 -0800900 overrideConfig.writeToParcel(data, 0);
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800901 } else {
902 data.writeInt(0);
903 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700904 data.writeInt(preserveWindow ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
906 IBinder.FLAG_ONEWAY);
907 data.recycle();
908 }
909
Dianne Hackborn85d558c2014-11-04 10:31:54 -0800910 public void scheduleNewIntent(List<ReferrerIntent> intents, IBinder token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800911 throws RemoteException {
912 Parcel data = Parcel.obtain();
913 data.writeInterfaceToken(IApplicationThread.descriptor);
914 data.writeTypedList(intents);
915 data.writeStrongBinder(token);
916 mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
917 IBinder.FLAG_ONEWAY);
918 data.recycle();
919 }
920
921 public final void scheduleDestroyActivity(IBinder token, boolean finishing,
922 int configChanges) throws RemoteException {
923 Parcel data = Parcel.obtain();
924 data.writeInterfaceToken(IApplicationThread.descriptor);
925 data.writeStrongBinder(token);
926 data.writeInt(finishing ? 1 : 0);
927 data.writeInt(configChanges);
928 mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
929 IBinder.FLAG_ONEWAY);
930 data.recycle();
931 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700932
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800933 public final void scheduleReceiver(Intent intent, ActivityInfo info,
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400934 CompatibilityInfo compatInfo, int resultCode, String resultData,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700935 Bundle map, boolean sync, int sendingUser, int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 Parcel data = Parcel.obtain();
937 data.writeInterfaceToken(IApplicationThread.descriptor);
938 intent.writeToParcel(data, 0);
939 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400940 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800941 data.writeInt(resultCode);
942 data.writeString(resultData);
943 data.writeBundle(map);
944 data.writeInt(sync ? 1 : 0);
Dianne Hackborn20e80982012-08-31 19:00:44 -0700945 data.writeInt(sendingUser);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700946 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
948 IBinder.FLAG_ONEWAY);
949 data.recycle();
950 }
951
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400952 public final void scheduleCreateBackupAgent(ApplicationInfo app,
953 CompatibilityInfo compatInfo, int backupMode) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700954 Parcel data = Parcel.obtain();
955 data.writeInterfaceToken(IApplicationThread.descriptor);
956 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400957 compatInfo.writeToParcel(data, 0);
Christopher Tate181fafa2009-05-14 11:12:14 -0700958 data.writeInt(backupMode);
Christopher Tated884f432009-07-23 14:40:13 -0700959 mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
960 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700961 data.recycle();
962 }
963
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400964 public final void scheduleDestroyBackupAgent(ApplicationInfo app,
965 CompatibilityInfo compatInfo) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700966 Parcel data = Parcel.obtain();
967 data.writeInterfaceToken(IApplicationThread.descriptor);
968 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400969 compatInfo.writeToParcel(data, 0);
Christopher Tated884f432009-07-23 14:40:13 -0700970 mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
971 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700972 data.recycle();
973 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -0700974
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400975 public final void scheduleCreateService(IBinder token, ServiceInfo info,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700976 CompatibilityInfo compatInfo, int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 Parcel data = Parcel.obtain();
978 data.writeInterfaceToken(IApplicationThread.descriptor);
979 data.writeStrongBinder(token);
980 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400981 compatInfo.writeToParcel(data, 0);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700982 data.writeInt(processState);
Christopher Tate8a2ce3c2015-06-19 10:28:20 -0700983 try {
984 mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
985 IBinder.FLAG_ONEWAY);
986 } catch (TransactionTooLargeException e) {
987 Log.e("CREATE_SERVICE", "Binder failure starting service; service=" + info);
988 throw e;
989 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800990 data.recycle();
991 }
992
Dianne Hackborna413dc02013-07-12 12:02:55 -0700993 public final void scheduleBindService(IBinder token, Intent intent, boolean rebind,
994 int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800995 Parcel data = Parcel.obtain();
996 data.writeInterfaceToken(IApplicationThread.descriptor);
997 data.writeStrongBinder(token);
998 intent.writeToParcel(data, 0);
999 data.writeInt(rebind ? 1 : 0);
Dianne Hackborna413dc02013-07-12 12:02:55 -07001000 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
1002 IBinder.FLAG_ONEWAY);
1003 data.recycle();
1004 }
1005
1006 public final void scheduleUnbindService(IBinder token, Intent intent)
1007 throws RemoteException {
1008 Parcel data = Parcel.obtain();
1009 data.writeInterfaceToken(IApplicationThread.descriptor);
1010 data.writeStrongBinder(token);
1011 intent.writeToParcel(data, 0);
1012 mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
1013 IBinder.FLAG_ONEWAY);
1014 data.recycle();
1015 }
1016
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001017 public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
John Spurlock8a985d22014-02-25 09:40:05 -05001018 int flags, Intent args) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001019 Parcel data = Parcel.obtain();
1020 data.writeInterfaceToken(IApplicationThread.descriptor);
1021 data.writeStrongBinder(token);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001022 data.writeInt(taskRemoved ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001023 data.writeInt(startId);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001024 data.writeInt(flags);
1025 if (args != null) {
1026 data.writeInt(1);
1027 args.writeToParcel(data, 0);
1028 } else {
1029 data.writeInt(0);
1030 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001031 mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
1032 IBinder.FLAG_ONEWAY);
1033 data.recycle();
1034 }
1035
1036 public final void scheduleStopService(IBinder token)
1037 throws RemoteException {
1038 Parcel data = Parcel.obtain();
1039 data.writeInterfaceToken(IApplicationThread.descriptor);
1040 data.writeStrongBinder(token);
1041 mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
1042 IBinder.FLAG_ONEWAY);
1043 data.recycle();
1044 }
1045
Man Caocfa78b22015-06-11 20:14:34 -07001046 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001047 public final void bindApplication(String packageName, ApplicationInfo info,
Jeff Hao1b012d32014-08-20 10:35:34 -07001048 List<ProviderInfo> providers, ComponentName testName, ProfilerInfo profilerInfo,
1049 Bundle testArgs, IInstrumentationWatcher testWatcher,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001050 IUiAutomationConnection uiAutomationConnection, int debugMode,
Pablo Ceballosa4d4e822015-10-05 10:27:52 -07001051 boolean enableBinderTracking, boolean trackAllocation, boolean restrictedBackupMode,
1052 boolean persistent, Configuration config, CompatibilityInfo compatInfo,
1053 Map<String, IBinder> services, Bundle coreSettings) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001054 Parcel data = Parcel.obtain();
1055 data.writeInterfaceToken(IApplicationThread.descriptor);
1056 data.writeString(packageName);
1057 info.writeToParcel(data, 0);
1058 data.writeTypedList(providers);
1059 if (testName == null) {
1060 data.writeInt(0);
1061 } else {
1062 data.writeInt(1);
1063 testName.writeToParcel(data, 0);
1064 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001065 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001066 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07001067 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001068 } else {
1069 data.writeInt(0);
1070 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001071 data.writeBundle(testArgs);
1072 data.writeStrongInterface(testWatcher);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001073 data.writeStrongInterface(uiAutomationConnection);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001074 data.writeInt(debugMode);
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04001075 data.writeInt(enableBinderTracking ? 1 : 0);
Man Caocfa78b22015-06-11 20:14:34 -07001076 data.writeInt(trackAllocation ? 1 : 0);
Christopher Tate181fafa2009-05-14 11:12:14 -07001077 data.writeInt(restrictedBackupMode ? 1 : 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001078 data.writeInt(persistent ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001079 config.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001080 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 data.writeMap(services);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001082 data.writeBundle(coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001083 mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
1084 IBinder.FLAG_ONEWAY);
1085 data.recycle();
1086 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -07001087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001088 public final void scheduleExit() throws RemoteException {
1089 Parcel data = Parcel.obtain();
1090 data.writeInterfaceToken(IApplicationThread.descriptor);
1091 mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
1092 IBinder.FLAG_ONEWAY);
1093 data.recycle();
1094 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001095
1096 public final void scheduleSuicide() throws RemoteException {
1097 Parcel data = Parcel.obtain();
1098 data.writeInterfaceToken(IApplicationThread.descriptor);
1099 mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
1100 IBinder.FLAG_ONEWAY);
1101 data.recycle();
1102 }
1103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001104 public final void scheduleConfigurationChanged(Configuration config)
1105 throws RemoteException {
1106 Parcel data = Parcel.obtain();
1107 data.writeInterfaceToken(IApplicationThread.descriptor);
1108 config.writeToParcel(data, 0);
1109 mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1110 IBinder.FLAG_ONEWAY);
1111 data.recycle();
1112 }
1113
Amith Yamasani0af6fa72016-01-17 15:36:19 -08001114 public final void scheduleLocalVoiceInteractionStarted(IBinder token,
1115 IVoiceInteractor voiceInteractor) throws RemoteException {
1116 Parcel data = Parcel.obtain();
1117 data.writeInterfaceToken(IApplicationThread.descriptor);
1118 data.writeStrongBinder(token);
1119 data.writeStrongBinder(voiceInteractor != null ? voiceInteractor.asBinder() : null);
1120 mRemote.transact(SCHEDULE_LOCAL_VOICE_INTERACTION_STARTED_TRANSACTION, data, null,
1121 IBinder.FLAG_ONEWAY);
1122 data.recycle();
1123 }
1124
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125 public void updateTimeZone() throws RemoteException {
1126 Parcel data = Parcel.obtain();
1127 data.writeInterfaceToken(IApplicationThread.descriptor);
1128 mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
1129 IBinder.FLAG_ONEWAY);
1130 data.recycle();
1131 }
1132
Robert Greenwalt03595d02010-11-02 14:08:23 -07001133 public void clearDnsCache() throws RemoteException {
1134 Parcel data = Parcel.obtain();
1135 data.writeInterfaceToken(IApplicationThread.descriptor);
1136 mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
1137 IBinder.FLAG_ONEWAY);
1138 data.recycle();
1139 }
1140
Jason Monk602b2322013-07-03 17:04:33 -04001141 public void setHttpProxy(String proxy, String port, String exclList,
Jason Monk83520b92014-05-09 15:16:06 -04001142 Uri pacFileUrl) throws RemoteException {
Robert Greenwalt434203a2010-10-11 16:00:27 -07001143 Parcel data = Parcel.obtain();
1144 data.writeInterfaceToken(IApplicationThread.descriptor);
1145 data.writeString(proxy);
1146 data.writeString(port);
1147 data.writeString(exclList);
Jason Monk83520b92014-05-09 15:16:06 -04001148 pacFileUrl.writeToParcel(data, 0);
Robert Greenwalt434203a2010-10-11 16:00:27 -07001149 mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1150 data.recycle();
1151 }
1152
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001153 public void processInBackground() throws RemoteException {
1154 Parcel data = Parcel.obtain();
1155 data.writeInterfaceToken(IApplicationThread.descriptor);
1156 mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
1157 IBinder.FLAG_ONEWAY);
1158 data.recycle();
1159 }
1160
1161 public void dumpService(FileDescriptor fd, IBinder token, String[] args)
1162 throws RemoteException {
1163 Parcel data = Parcel.obtain();
1164 data.writeInterfaceToken(IApplicationThread.descriptor);
1165 data.writeFileDescriptor(fd);
1166 data.writeStrongBinder(token);
1167 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -07001168 mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001169 data.recycle();
1170 }
Filip Gruszczynskia59ac9c2015-09-10 18:28:48 -07001171
Marco Nelissen18cb2872011-11-15 11:19:53 -08001172 public void dumpProvider(FileDescriptor fd, IBinder token, String[] args)
1173 throws RemoteException {
1174 Parcel data = Parcel.obtain();
1175 data.writeInterfaceToken(IApplicationThread.descriptor);
1176 data.writeFileDescriptor(fd);
1177 data.writeStrongBinder(token);
1178 data.writeStringArray(args);
1179 mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1180 data.recycle();
1181 }
1182
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001183 public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
Dianne Hackborn20e80982012-08-31 19:00:44 -07001184 int resultCode, String dataStr, Bundle extras, boolean ordered,
Dianne Hackborna413dc02013-07-12 12:02:55 -07001185 boolean sticky, int sendingUser, int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 Parcel data = Parcel.obtain();
1187 data.writeInterfaceToken(IApplicationThread.descriptor);
1188 data.writeStrongBinder(receiver.asBinder());
1189 intent.writeToParcel(data, 0);
1190 data.writeInt(resultCode);
1191 data.writeString(dataStr);
1192 data.writeBundle(extras);
1193 data.writeInt(ordered ? 1 : 0);
Dianne Hackborn68d881c2009-10-05 13:58:17 -07001194 data.writeInt(sticky ? 1 : 0);
Dianne Hackborn20e80982012-08-31 19:00:44 -07001195 data.writeInt(sendingUser);
Dianne Hackborna413dc02013-07-12 12:02:55 -07001196 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
1198 IBinder.FLAG_ONEWAY);
1199 data.recycle();
1200 }
1201
Wale Ogunwalec2607b42015-02-07 16:16:59 -08001202 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 public final void scheduleLowMemory() throws RemoteException {
1204 Parcel data = Parcel.obtain();
1205 data.writeInterfaceToken(IApplicationThread.descriptor);
1206 mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
1207 IBinder.FLAG_ONEWAY);
1208 data.recycle();
1209 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001210
Wale Ogunwalec2607b42015-02-07 16:16:59 -08001211 @Override
Filip Gruszczynskica664812015-12-04 12:43:36 -08001212 public final void scheduleActivityConfigurationChanged(IBinder token,
1213 Configuration overrideConfig, boolean reportToActivity) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 Parcel data = Parcel.obtain();
1215 data.writeInterfaceToken(IApplicationThread.descriptor);
1216 data.writeStrongBinder(token);
Wale Ogunwalec2607b42015-02-07 16:16:59 -08001217 if (overrideConfig != null) {
1218 data.writeInt(1);
1219 overrideConfig.writeToParcel(data, 0);
1220 } else {
1221 data.writeInt(0);
1222 }
Filip Gruszczynskica664812015-12-04 12:43:36 -08001223 data.writeInt(reportToActivity ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1225 IBinder.FLAG_ONEWAY);
1226 data.recycle();
1227 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001228
Wale Ogunwalec2607b42015-02-07 16:16:59 -08001229 @Override
Jeff Hao1b012d32014-08-20 10:35:34 -07001230 public void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType)
1231 throws RemoteException {
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001232 Parcel data = Parcel.obtain();
1233 data.writeInterfaceToken(IApplicationThread.descriptor);
1234 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001235 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07001236 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001237 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07001238 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001239 } else {
1240 data.writeInt(0);
1241 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001242 mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
1243 IBinder.FLAG_ONEWAY);
1244 data.recycle();
1245 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001246
Dianne Hackborn06de2ea2009-05-21 12:56:43 -07001247 public void setSchedulingGroup(int group) throws RemoteException {
1248 Parcel data = Parcel.obtain();
1249 data.writeInterfaceToken(IApplicationThread.descriptor);
1250 data.writeInt(group);
1251 mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
1252 IBinder.FLAG_ONEWAY);
1253 data.recycle();
1254 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001255
Dianne Hackborn4416c3d2010-05-04 17:22:49 -07001256 public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
1257 Parcel data = Parcel.obtain();
1258 data.writeInterfaceToken(IApplicationThread.descriptor);
1259 data.writeInt(cmd);
1260 data.writeStringArray(packages);
1261 mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
1262 IBinder.FLAG_ONEWAY);
1263 data.recycle();
Dianne Hackborn4416c3d2010-05-04 17:22:49 -07001264 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001265
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001266 public void scheduleCrash(String msg) throws RemoteException {
1267 Parcel data = Parcel.obtain();
1268 data.writeInterfaceToken(IApplicationThread.descriptor);
1269 data.writeString(msg);
1270 mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
1271 IBinder.FLAG_ONEWAY);
1272 data.recycle();
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001273 }
Andy McFadden824c5102010-07-09 16:26:57 -07001274
1275 public void dumpHeap(boolean managed, String path,
1276 ParcelFileDescriptor fd) throws RemoteException {
1277 Parcel data = Parcel.obtain();
1278 data.writeInterfaceToken(IApplicationThread.descriptor);
1279 data.writeInt(managed ? 1 : 0);
1280 data.writeString(path);
1281 if (fd != null) {
1282 data.writeInt(1);
1283 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1284 } else {
1285 data.writeInt(0);
1286 }
1287 mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
1288 IBinder.FLAG_ONEWAY);
1289 data.recycle();
1290 }
Dianne Hackborn625ac272010-09-17 18:29:22 -07001291
Dianne Hackborn30d71892010-12-11 10:37:55 -08001292 public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
Dianne Hackborn625ac272010-09-17 18:29:22 -07001293 throws RemoteException {
1294 Parcel data = Parcel.obtain();
1295 data.writeInterfaceToken(IApplicationThread.descriptor);
1296 data.writeFileDescriptor(fd);
1297 data.writeStrongBinder(token);
Dianne Hackborn30d71892010-12-11 10:37:55 -08001298 data.writeString(prefix);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001299 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -07001300 mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001301 data.recycle();
1302 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001303
1304 public void setCoreSettings(Bundle coreSettings) throws RemoteException {
1305 Parcel data = Parcel.obtain();
1306 data.writeInterfaceToken(IApplicationThread.descriptor);
1307 data.writeBundle(coreSettings);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001308 mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1309 }
1310
1311 public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
1312 throws RemoteException {
1313 Parcel data = Parcel.obtain();
1314 data.writeInterfaceToken(IApplicationThread.descriptor);
1315 data.writeString(pkg);
1316 info.writeToParcel(data, 0);
1317 mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null,
1318 IBinder.FLAG_ONEWAY);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001319 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -07001320
1321 public void scheduleTrimMemory(int level) throws RemoteException {
1322 Parcel data = Parcel.obtain();
1323 data.writeInterfaceToken(IApplicationThread.descriptor);
1324 data.writeInt(level);
1325 mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
1326 IBinder.FLAG_ONEWAY);
Maunik Shahdb1a9a32014-06-19 14:18:39 +05301327 data.recycle();
Dianne Hackbornce86ba82011-07-13 19:33:41 -07001328 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001329
Dianne Hackborn3bc8f78d2013-09-19 13:34:35 -07001330 public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin,
Richard Uhlerc14b9cf2015-03-13 12:38:38 -07001331 boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, String[] args) throws RemoteException {
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001332 Parcel data = Parcel.obtain();
1333 Parcel reply = Parcel.obtain();
1334 data.writeInterfaceToken(IApplicationThread.descriptor);
1335 data.writeFileDescriptor(fd);
Dianne Hackborn3bc8f78d2013-09-19 13:34:35 -07001336 mem.writeToParcel(data, 0);
Dianne Hackbornb437e092011-08-05 17:50:29 -07001337 data.writeInt(checkin ? 1 : 0);
Dianne Hackborn64770d12013-05-23 17:51:19 -07001338 data.writeInt(dumpInfo ? 1 : 0);
1339 data.writeInt(dumpDalvik ? 1 : 0);
Richard Uhlerc14b9cf2015-03-13 12:38:38 -07001340 data.writeInt(dumpSummaryOnly ? 1 : 0);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001341 data.writeStringArray(args);
1342 mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
1343 reply.readException();
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001344 data.recycle();
1345 reply.recycle();
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001346 }
1347
1348 public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException {
1349 Parcel data = Parcel.obtain();
1350 data.writeInterfaceToken(IApplicationThread.descriptor);
1351 data.writeFileDescriptor(fd);
1352 data.writeStringArray(args);
1353 mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1354 data.recycle();
1355 }
Jeff Brown6754ba22011-12-14 20:20:01 -08001356
1357 public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException {
1358 Parcel data = Parcel.obtain();
1359 data.writeInterfaceToken(IApplicationThread.descriptor);
1360 data.writeFileDescriptor(fd);
1361 data.writeStringArray(args);
1362 mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1363 data.recycle();
1364 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001365
Craig Mautner5eda9b32013-07-02 11:58:16 -07001366 @Override
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001367 public void unstableProviderDied(IBinder provider) throws RemoteException {
1368 Parcel data = Parcel.obtain();
1369 data.writeInterfaceToken(IApplicationThread.descriptor);
1370 data.writeStrongBinder(provider);
1371 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1372 data.recycle();
1373 }
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001374
Craig Mautner5eda9b32013-07-02 11:58:16 -07001375 @Override
Adam Skorydfc7fd72013-08-05 19:23:41 -07001376 public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken,
Adam Skory7140a252013-09-11 12:04:58 +01001377 int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001378 Parcel data = Parcel.obtain();
1379 data.writeInterfaceToken(IApplicationThread.descriptor);
1380 data.writeStrongBinder(activityToken);
1381 data.writeStrongBinder(requestToken);
1382 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07001383 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, null,
1384 IBinder.FLAG_ONEWAY);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001385 data.recycle();
1386 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07001387
1388 @Override
1389 public void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
1390 throws RemoteException {
1391 Parcel data = Parcel.obtain();
1392 data.writeInterfaceToken(IApplicationThread.descriptor);
1393 data.writeStrongBinder(token);
1394 data.writeInt(timeout ? 1 : 0);
Craig Mautnereb8abf72014-07-02 15:04:09 -07001395 mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null,
1396 IBinder.FLAG_ONEWAY);
1397 data.recycle();
1398 }
1399
1400 @Override
1401 public void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options)
1402 throws RemoteException {
1403 Parcel data = Parcel.obtain();
1404 data.writeInterfaceToken(IApplicationThread.descriptor);
1405 data.writeStrongBinder(token);
1406 data.writeBundle(options == null ? null : options.toBundle());
1407 mRemote.transact(SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION, data, null,
1408 IBinder.FLAG_ONEWAY);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001409 data.recycle();
1410 }
Dianne Hackborna413dc02013-07-12 12:02:55 -07001411
1412 @Override
1413 public void setProcessState(int state) throws RemoteException {
1414 Parcel data = Parcel.obtain();
1415 data.writeInterfaceToken(IApplicationThread.descriptor);
1416 data.writeInt(state);
1417 mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1418 data.recycle();
1419 }
Jeff Sharkeydd97f422013-10-08 17:01:30 -07001420
1421 @Override
1422 public void scheduleInstallProvider(ProviderInfo provider) throws RemoteException {
1423 Parcel data = Parcel.obtain();
1424 data.writeInterfaceToken(IApplicationThread.descriptor);
1425 provider.writeToParcel(data, 0);
1426 mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1427 data.recycle();
1428 }
Narayan Kamathccb2a0862013-12-19 14:49:36 +00001429
1430 @Override
1431 public void updateTimePrefs(boolean is24Hour) throws RemoteException {
1432 Parcel data = Parcel.obtain();
1433 data.writeInterfaceToken(IApplicationThread.descriptor);
1434 data.writeByte(is24Hour ? (byte) 1 : (byte) 0);
1435 mRemote.transact(UPDATE_TIME_PREFS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1436 data.recycle();
1437 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07001438
1439 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07001440 public void scheduleCancelVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07001441 Parcel data = Parcel.obtain();
1442 data.writeInterfaceToken(IApplicationThread.descriptor);
1443 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07001444 mRemote.transact(CANCEL_VISIBLE_BEHIND_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07001445 data.recycle();
1446 }
1447
1448 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07001449 public void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled)
1450 throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07001451 Parcel data = Parcel.obtain();
1452 data.writeInterfaceToken(IApplicationThread.descriptor);
1453 data.writeStrongBinder(token);
1454 data.writeInt(enabled ? 1 : 0);
Jose Lima4b6c6692014-08-12 17:41:12 -07001455 mRemote.transact(BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION, data, null,
1456 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07001457 data.recycle();
1458 }
Craig Mautner8746a472014-07-24 15:12:54 -07001459
1460 @Override
1461 public void scheduleEnterAnimationComplete(IBinder token) throws RemoteException {
1462 Parcel data = Parcel.obtain();
1463 data.writeInterfaceToken(IApplicationThread.descriptor);
1464 data.writeStrongBinder(token);
1465 mRemote.transact(ENTER_ANIMATION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1466 data.recycle();
1467 }
Jeff Sharkey605eb792014-11-04 13:34:06 -08001468
1469 @Override
1470 public void notifyCleartextNetwork(byte[] firstPacket) throws RemoteException {
1471 Parcel data = Parcel.obtain();
1472 data.writeInterfaceToken(IApplicationThread.descriptor);
1473 data.writeByteArray(firstPacket);
1474 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1475 data.recycle();
1476 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04001477
1478 @Override
1479 public void startBinderTracking() throws RemoteException {
1480 Parcel data = Parcel.obtain();
1481 data.writeInterfaceToken(IApplicationThread.descriptor);
1482 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, null,
1483 IBinder.FLAG_ONEWAY);
1484 data.recycle();
1485 }
1486
1487 @Override
1488 public void stopBinderTrackingAndDump(FileDescriptor fd) throws RemoteException {
1489 Parcel data = Parcel.obtain();
1490 data.writeInterfaceToken(IApplicationThread.descriptor);
1491 data.writeFileDescriptor(fd);
1492 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, null,
1493 IBinder.FLAG_ONEWAY);
1494 data.recycle();
1495 }
Wale Ogunwale5f986092015-12-04 15:35:38 -08001496
1497 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08001498 public final void scheduleMultiWindowChanged(
1499 IBinder token, boolean inMultiWindow) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08001500 Parcel data = Parcel.obtain();
1501 data.writeInterfaceToken(IApplicationThread.descriptor);
1502 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08001503 data.writeInt(inMultiWindow ? 1 : 0);
1504 mRemote.transact(SCHEDULE_MULTI_WINDOW_CHANGED_TRANSACTION, data, null,
Wale Ogunwale5f986092015-12-04 15:35:38 -08001505 IBinder.FLAG_ONEWAY);
1506 data.recycle();
1507 }
1508
1509 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08001510 public final void schedulePictureInPictureChanged(IBinder token, boolean inPip)
Wale Ogunwale5f986092015-12-04 15:35:38 -08001511 throws RemoteException {
1512 Parcel data = Parcel.obtain();
1513 data.writeInterfaceToken(IApplicationThread.descriptor);
1514 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08001515 data.writeInt(inPip ? 1 : 0);
1516 mRemote.transact(SCHEDULE_PICTURE_IN_PICTURE_CHANGED_TRANSACTION, data, null,
Wale Ogunwale5f986092015-12-04 15:35:38 -08001517 IBinder.FLAG_ONEWAY);
1518 data.recycle();
1519 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001520}