blob: c8f1280ad36c69680db7de9016d914165389a16c [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;
28import android.os.Binder;
29import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070030import android.os.Debug;
Dianne Hackborn9c8dd552009-06-23 19:22:52 -070031import android.os.Parcelable;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.os.RemoteException;
33import android.os.IBinder;
34import android.os.Parcel;
35import android.os.ParcelFileDescriptor;
36
37import java.io.FileDescriptor;
38import java.io.IOException;
39import java.util.HashMap;
40import java.util.List;
41import java.util.Map;
42
43/** {@hide} */
44public abstract class ApplicationThreadNative extends Binder
45 implements IApplicationThread {
46 /**
47 * Cast a Binder object into an application thread interface, generating
48 * a proxy if needed.
49 */
50 static public IApplicationThread asInterface(IBinder obj) {
51 if (obj == null) {
52 return null;
53 }
54 IApplicationThread in =
55 (IApplicationThread)obj.queryLocalInterface(descriptor);
56 if (in != null) {
57 return in;
58 }
59
60 return new ApplicationThreadProxy(obj);
61 }
62
63 public ApplicationThreadNative() {
64 attachInterface(this, descriptor);
65 }
66
67 @Override
68 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
69 throws RemoteException {
70 switch (code) {
71 case SCHEDULE_PAUSE_ACTIVITY_TRANSACTION:
72 {
73 data.enforceInterface(IApplicationThread.descriptor);
74 IBinder b = data.readStrongBinder();
75 boolean finished = data.readInt() != 0;
76 boolean userLeaving = data.readInt() != 0;
77 int configChanges = data.readInt();
78 schedulePauseActivity(b, finished, userLeaving, configChanges);
79 return true;
80 }
81
82 case SCHEDULE_STOP_ACTIVITY_TRANSACTION:
83 {
84 data.enforceInterface(IApplicationThread.descriptor);
85 IBinder b = data.readStrongBinder();
86 boolean show = data.readInt() != 0;
87 int configChanges = data.readInt();
88 scheduleStopActivity(b, show, configChanges);
89 return true;
90 }
91
92 case SCHEDULE_WINDOW_VISIBILITY_TRANSACTION:
93 {
94 data.enforceInterface(IApplicationThread.descriptor);
95 IBinder b = data.readStrongBinder();
96 boolean show = data.readInt() != 0;
97 scheduleWindowVisibility(b, show);
98 return true;
99 }
100
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800101 case SCHEDULE_SLEEPING_TRANSACTION:
102 {
103 data.enforceInterface(IApplicationThread.descriptor);
104 IBinder b = data.readStrongBinder();
105 boolean sleeping = data.readInt() != 0;
106 scheduleSleeping(b, sleeping);
107 return true;
108 }
109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 case SCHEDULE_RESUME_ACTIVITY_TRANSACTION:
111 {
112 data.enforceInterface(IApplicationThread.descriptor);
113 IBinder b = data.readStrongBinder();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700114 int procState = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 boolean isForward = data.readInt() != 0;
Adam Powellcfbe9be2013-11-06 14:58:58 -0800116 Bundle resumeArgs = data.readBundle();
117 scheduleResumeActivity(b, procState, isForward, resumeArgs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 return true;
119 }
120
121 case SCHEDULE_SEND_RESULT_TRANSACTION:
122 {
123 data.enforceInterface(IApplicationThread.descriptor);
124 IBinder b = data.readStrongBinder();
125 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
126 scheduleSendResult(b, ri);
127 return true;
128 }
129
130 case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION:
131 {
132 data.enforceInterface(IApplicationThread.descriptor);
133 Intent intent = Intent.CREATOR.createFromParcel(data);
134 IBinder b = data.readStrongBinder();
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700135 int ident = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700137 Configuration curConfig = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400138 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700139 int procState = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 Bundle state = data.readBundle();
141 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
142 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
143 boolean notResumed = data.readInt() != 0;
144 boolean isForward = data.readInt() != 0;
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700145 String profileName = data.readString();
146 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700147 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700148 boolean autoStopProfiler = data.readInt() != 0;
Adam Powellcfbe9be2013-11-06 14:58:58 -0800149 Bundle resumeArgs = data.readBundle();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700150 scheduleLaunchActivity(intent, b, ident, info, curConfig, compatInfo, procState, state,
Adam Powellcfbe9be2013-11-06 14:58:58 -0800151 ri, pi, notResumed, isForward, profileName, profileFd, autoStopProfiler,
152 resumeArgs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 return true;
154 }
155
156 case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION:
157 {
158 data.enforceInterface(IApplicationThread.descriptor);
159 IBinder b = data.readStrongBinder();
160 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
161 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
162 int configChanges = data.readInt();
163 boolean notResumed = data.readInt() != 0;
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800164 Configuration config = null;
165 if (data.readInt() != 0) {
166 config = Configuration.CREATOR.createFromParcel(data);
167 }
168 scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800169 return true;
170 }
171
172 case SCHEDULE_NEW_INTENT_TRANSACTION:
173 {
174 data.enforceInterface(IApplicationThread.descriptor);
175 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
176 IBinder b = data.readStrongBinder();
177 scheduleNewIntent(pi, b);
178 return true;
179 }
180
181 case SCHEDULE_FINISH_ACTIVITY_TRANSACTION:
182 {
183 data.enforceInterface(IApplicationThread.descriptor);
184 IBinder b = data.readStrongBinder();
185 boolean finishing = data.readInt() != 0;
186 int configChanges = data.readInt();
187 scheduleDestroyActivity(b, finishing, configChanges);
188 return true;
189 }
190
191 case SCHEDULE_RECEIVER_TRANSACTION:
192 {
193 data.enforceInterface(IApplicationThread.descriptor);
194 Intent intent = Intent.CREATOR.createFromParcel(data);
195 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400196 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800197 int resultCode = data.readInt();
198 String resultData = data.readString();
199 Bundle resultExtras = data.readBundle();
200 boolean sync = data.readInt() != 0;
Dianne Hackborn20e80982012-08-31 19:00:44 -0700201 int sendingUser = data.readInt();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700202 int processState = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400203 scheduleReceiver(intent, info, compatInfo, resultCode, resultData,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700204 resultExtras, sync, sendingUser, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800205 return true;
206 }
207
208 case SCHEDULE_CREATE_SERVICE_TRANSACTION: {
209 data.enforceInterface(IApplicationThread.descriptor);
210 IBinder token = data.readStrongBinder();
211 ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400212 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700213 int processState = data.readInt();
214 scheduleCreateService(token, info, compatInfo, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800215 return true;
216 }
217
218 case SCHEDULE_BIND_SERVICE_TRANSACTION: {
219 data.enforceInterface(IApplicationThread.descriptor);
220 IBinder token = data.readStrongBinder();
221 Intent intent = Intent.CREATOR.createFromParcel(data);
222 boolean rebind = data.readInt() != 0;
Dianne Hackborna413dc02013-07-12 12:02:55 -0700223 int processState = data.readInt();
224 scheduleBindService(token, intent, rebind, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800225 return true;
226 }
227
228 case SCHEDULE_UNBIND_SERVICE_TRANSACTION: {
229 data.enforceInterface(IApplicationThread.descriptor);
230 IBinder token = data.readStrongBinder();
231 Intent intent = Intent.CREATOR.createFromParcel(data);
232 scheduleUnbindService(token, intent);
233 return true;
234 }
235
236 case SCHEDULE_SERVICE_ARGS_TRANSACTION:
237 {
238 data.enforceInterface(IApplicationThread.descriptor);
239 IBinder token = data.readStrongBinder();
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700240 boolean taskRemoved = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800241 int startId = data.readInt();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700242 int fl = data.readInt();
243 Intent args;
244 if (data.readInt() != 0) {
245 args = Intent.CREATOR.createFromParcel(data);
246 } else {
247 args = null;
248 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700249 scheduleServiceArgs(token, taskRemoved, startId, fl, args);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 return true;
251 }
252
253 case SCHEDULE_STOP_SERVICE_TRANSACTION:
254 {
255 data.enforceInterface(IApplicationThread.descriptor);
256 IBinder token = data.readStrongBinder();
257 scheduleStopService(token);
258 return true;
259 }
260
261 case BIND_APPLICATION_TRANSACTION:
262 {
263 data.enforceInterface(IApplicationThread.descriptor);
264 String packageName = data.readString();
265 ApplicationInfo info =
266 ApplicationInfo.CREATOR.createFromParcel(data);
267 List<ProviderInfo> providers =
268 data.createTypedArrayList(ProviderInfo.CREATOR);
269 ComponentName testName = (data.readInt() != 0)
270 ? new ComponentName(data) : null;
271 String profileName = data.readString();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700272 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700273 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700274 boolean autoStopProfiler = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 Bundle testArgs = data.readBundle();
276 IBinder binder = data.readStrongBinder();
277 IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800278 binder = data.readStrongBinder();
279 IUiAutomationConnection uiAutomationConnection =
280 IUiAutomationConnection.Stub.asInterface(binder);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800281 int testMode = data.readInt();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800282 boolean openGlTrace = data.readInt() != 0;
Christopher Tate181fafa2009-05-14 11:12:14 -0700283 boolean restrictedBackupMode = (data.readInt() != 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700284 boolean persistent = (data.readInt() != 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800285 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400286 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800287 HashMap<String, IBinder> services = data.readHashMap(null);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800288 Bundle coreSettings = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289 bindApplication(packageName, info,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700290 providers, testName, profileName, profileFd, autoStopProfiler,
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800291 testArgs, testWatcher, uiAutomationConnection, testMode,
292 openGlTrace, restrictedBackupMode, persistent, config, compatInfo,
293 services, coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800294 return true;
295 }
Siva Velusamy92a8b222012-03-09 16:24:04 -0800296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 case SCHEDULE_EXIT_TRANSACTION:
298 {
299 data.enforceInterface(IApplicationThread.descriptor);
300 scheduleExit();
301 return true;
302 }
303
Christopher Tate5e1ab332009-09-01 20:32:49 -0700304 case SCHEDULE_SUICIDE_TRANSACTION:
305 {
306 data.enforceInterface(IApplicationThread.descriptor);
307 scheduleSuicide();
308 return true;
309 }
310
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311 case REQUEST_THUMBNAIL_TRANSACTION:
312 {
313 data.enforceInterface(IApplicationThread.descriptor);
314 IBinder b = data.readStrongBinder();
315 requestThumbnail(b);
316 return true;
317 }
Robert Greenwalt434203a2010-10-11 16:00:27 -0700318
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800319 case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
320 {
321 data.enforceInterface(IApplicationThread.descriptor);
322 Configuration config = Configuration.CREATOR.createFromParcel(data);
323 scheduleConfigurationChanged(config);
324 return true;
325 }
326
327 case UPDATE_TIME_ZONE_TRANSACTION: {
328 data.enforceInterface(IApplicationThread.descriptor);
329 updateTimeZone();
330 return true;
331 }
332
Robert Greenwalt03595d02010-11-02 14:08:23 -0700333 case CLEAR_DNS_CACHE_TRANSACTION: {
334 data.enforceInterface(IApplicationThread.descriptor);
335 clearDnsCache();
336 return true;
337 }
338
Robert Greenwalt434203a2010-10-11 16:00:27 -0700339 case SET_HTTP_PROXY_TRANSACTION: {
340 data.enforceInterface(IApplicationThread.descriptor);
341 final String proxy = data.readString();
342 final String port = data.readString();
343 final String exclList = data.readString();
Jason Monk602b2322013-07-03 17:04:33 -0400344 final String pacFileUrl = data.readString();
345 setHttpProxy(proxy, port, exclList, pacFileUrl);
Robert Greenwalt434203a2010-10-11 16:00:27 -0700346 return true;
347 }
348
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800349 case PROCESS_IN_BACKGROUND_TRANSACTION: {
350 data.enforceInterface(IApplicationThread.descriptor);
351 processInBackground();
352 return true;
353 }
Robert Greenwalt434203a2010-10-11 16:00:27 -0700354
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 case DUMP_SERVICE_TRANSACTION: {
356 data.enforceInterface(IApplicationThread.descriptor);
357 ParcelFileDescriptor fd = data.readFileDescriptor();
358 final IBinder service = data.readStrongBinder();
359 final String[] args = data.readStringArray();
360 if (fd != null) {
361 dumpService(fd.getFileDescriptor(), service, args);
362 try {
363 fd.close();
364 } catch (IOException e) {
365 }
366 }
367 return true;
368 }
369
Marco Nelissen18cb2872011-11-15 11:19:53 -0800370 case DUMP_PROVIDER_TRANSACTION: {
371 data.enforceInterface(IApplicationThread.descriptor);
372 ParcelFileDescriptor fd = data.readFileDescriptor();
373 final IBinder service = data.readStrongBinder();
374 final String[] args = data.readStringArray();
375 if (fd != null) {
376 dumpProvider(fd.getFileDescriptor(), service, args);
377 try {
378 fd.close();
379 } catch (IOException e) {
380 }
381 }
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
386 data.enforceInterface(IApplicationThread.descriptor);
387 IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
388 data.readStrongBinder());
389 Intent intent = Intent.CREATOR.createFromParcel(data);
390 int resultCode = data.readInt();
391 String dataStr = data.readString();
392 Bundle extras = data.readBundle();
393 boolean ordered = data.readInt() != 0;
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700394 boolean sticky = data.readInt() != 0;
Dianne Hackborn20e80982012-08-31 19:00:44 -0700395 int sendingUser = data.readInt();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700396 int processState = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397 scheduleRegisteredReceiver(receiver, intent,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700398 resultCode, dataStr, extras, ordered, sticky, sendingUser, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 return true;
400 }
401
402 case SCHEDULE_LOW_MEMORY_TRANSACTION:
403 {
Vairavan Srinivasane94a3e72012-02-01 23:17:14 -0800404 data.enforceInterface(IApplicationThread.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800405 scheduleLowMemory();
406 return true;
407 }
408
409 case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
410 {
411 data.enforceInterface(IApplicationThread.descriptor);
412 IBinder b = data.readStrongBinder();
413 scheduleActivityConfigurationChanged(b);
414 return true;
415 }
416
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800417 case PROFILER_CONTROL_TRANSACTION:
418 {
419 data.enforceInterface(IApplicationThread.descriptor);
420 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -0700421 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800422 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -0700423 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700424 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Romain Guy7eabe552011-07-21 14:56:34 -0700425 profilerControl(start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800426 return true;
427 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -0700428
429 case SET_SCHEDULING_GROUP_TRANSACTION:
430 {
431 data.enforceInterface(IApplicationThread.descriptor);
432 int group = data.readInt();
433 setSchedulingGroup(group);
434 return true;
435 }
Christopher Tate181fafa2009-05-14 11:12:14 -0700436
437 case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
438 {
439 data.enforceInterface(IApplicationThread.descriptor);
440 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400441 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Christopher Tate181fafa2009-05-14 11:12:14 -0700442 int backupMode = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400443 scheduleCreateBackupAgent(appInfo, compatInfo, backupMode);
Christopher Tate181fafa2009-05-14 11:12:14 -0700444 return true;
445 }
Christopher Tate1885b372009-06-04 15:00:33 -0700446
447 case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
448 {
449 data.enforceInterface(IApplicationThread.descriptor);
450 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400451 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
452 scheduleDestroyBackupAgent(appInfo, compatInfo);
Christopher Tate1885b372009-06-04 15:00:33 -0700453 return true;
454 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -0700455
Dianne Hackborn4416c3d2010-05-04 17:22:49 -0700456 case DISPATCH_PACKAGE_BROADCAST_TRANSACTION:
457 {
458 data.enforceInterface(IApplicationThread.descriptor);
459 int cmd = data.readInt();
460 String[] packages = data.readStringArray();
461 dispatchPackageBroadcast(cmd, packages);
462 return true;
463 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -0700464
465 case SCHEDULE_CRASH_TRANSACTION:
466 {
467 data.enforceInterface(IApplicationThread.descriptor);
468 String msg = data.readString();
469 scheduleCrash(msg);
470 return true;
471 }
Andy McFadden824c5102010-07-09 16:26:57 -0700472
473 case DUMP_HEAP_TRANSACTION:
474 {
475 data.enforceInterface(IApplicationThread.descriptor);
476 boolean managed = data.readInt() != 0;
477 String path = data.readString();
478 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700479 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Andy McFadden824c5102010-07-09 16:26:57 -0700480 dumpHeap(managed, path, fd);
481 return true;
482 }
Dianne Hackborn625ac272010-09-17 18:29:22 -0700483
484 case DUMP_ACTIVITY_TRANSACTION: {
485 data.enforceInterface(IApplicationThread.descriptor);
486 ParcelFileDescriptor fd = data.readFileDescriptor();
487 final IBinder activity = data.readStrongBinder();
Dianne Hackborn30d71892010-12-11 10:37:55 -0800488 final String prefix = data.readString();
Dianne Hackborn625ac272010-09-17 18:29:22 -0700489 final String[] args = data.readStringArray();
490 if (fd != null) {
Dianne Hackborn30d71892010-12-11 10:37:55 -0800491 dumpActivity(fd.getFileDescriptor(), activity, prefix, args);
Dianne Hackborn625ac272010-09-17 18:29:22 -0700492 try {
493 fd.close();
494 } catch (IOException e) {
495 }
496 }
497 return true;
498 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800499
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400500 case SET_CORE_SETTINGS_TRANSACTION: {
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800501 data.enforceInterface(IApplicationThread.descriptor);
502 Bundle settings = data.readBundle();
503 setCoreSettings(settings);
504 return true;
505 }
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400506
507 case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: {
508 data.enforceInterface(IApplicationThread.descriptor);
509 String pkg = data.readString();
510 CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data);
511 updatePackageCompatibilityInfo(pkg, compat);
512 return true;
513 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -0700514
515 case SCHEDULE_TRIM_MEMORY_TRANSACTION: {
516 data.enforceInterface(IApplicationThread.descriptor);
517 int level = data.readInt();
518 scheduleTrimMemory(level);
519 return true;
520 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700521
522 case DUMP_MEM_INFO_TRANSACTION:
523 {
524 data.enforceInterface(IApplicationThread.descriptor);
525 ParcelFileDescriptor fd = data.readFileDescriptor();
Dianne Hackborn3bc8f78d2013-09-19 13:34:35 -0700526 Debug.MemoryInfo mi = Debug.MemoryInfo.CREATOR.createFromParcel(data);
Dianne Hackbornb437e092011-08-05 17:50:29 -0700527 boolean checkin = data.readInt() != 0;
Dianne Hackborn64770d12013-05-23 17:51:19 -0700528 boolean dumpInfo = data.readInt() != 0;
529 boolean dumpDalvik = data.readInt() != 0;
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700530 String[] args = data.readStringArray();
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700531 if (fd != null) {
532 try {
Dianne Hackborn3bc8f78d2013-09-19 13:34:35 -0700533 dumpMemInfo(fd.getFileDescriptor(), mi, checkin, dumpInfo, dumpDalvik, args);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700534 } finally {
535 try {
536 fd.close();
537 } catch (IOException e) {
538 // swallowed, not propagated back to the caller
539 }
540 }
541 }
542 reply.writeNoException();
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700543 return true;
544 }
545
546 case DUMP_GFX_INFO_TRANSACTION:
547 {
548 data.enforceInterface(IApplicationThread.descriptor);
549 ParcelFileDescriptor fd = data.readFileDescriptor();
550 String[] args = data.readStringArray();
551 if (fd != null) {
552 try {
553 dumpGfxInfo(fd.getFileDescriptor(), args);
554 } finally {
555 try {
556 fd.close();
557 } catch (IOException e) {
558 // swallowed, not propagated back to the caller
559 }
560 }
561 }
562 reply.writeNoException();
563 return true;
564 }
Jeff Brown6754ba22011-12-14 20:20:01 -0800565
566 case DUMP_DB_INFO_TRANSACTION:
567 {
568 data.enforceInterface(IApplicationThread.descriptor);
569 ParcelFileDescriptor fd = data.readFileDescriptor();
570 String[] args = data.readStringArray();
571 if (fd != null) {
572 try {
573 dumpDbInfo(fd.getFileDescriptor(), args);
574 } finally {
575 try {
576 fd.close();
577 } catch (IOException e) {
578 // swallowed, not propagated back to the caller
579 }
580 }
581 }
582 reply.writeNoException();
583 return true;
584 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700585
586 case UNSTABLE_PROVIDER_DIED_TRANSACTION:
587 {
588 data.enforceInterface(IApplicationThread.descriptor);
589 IBinder provider = data.readStrongBinder();
590 unstableProviderDied(provider);
591 reply.writeNoException();
592 return true;
593 }
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -0800594
Adam Skorydfc7fd72013-08-05 19:23:41 -0700595 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION:
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -0800596 {
597 data.enforceInterface(IApplicationThread.descriptor);
598 IBinder activityToken = data.readStrongBinder();
599 IBinder requestToken = data.readStrongBinder();
600 int requestType = data.readInt();
Adam Skory7140a252013-09-11 12:04:58 +0100601 requestAssistContextExtras(activityToken, requestToken, requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -0800602 reply.writeNoException();
603 return true;
604 }
Craig Mautner5eda9b32013-07-02 11:58:16 -0700605
606 case SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION:
607 {
608 data.enforceInterface(IApplicationThread.descriptor);
609 IBinder token = data.readStrongBinder();
610 boolean timeout = data.readInt() == 1;
611 scheduleTranslucentConversionComplete(token, timeout);
612 reply.writeNoException();
613 return true;
614 }
Dianne Hackborna413dc02013-07-12 12:02:55 -0700615
616 case SET_PROCESS_STATE_TRANSACTION:
617 {
618 data.enforceInterface(IApplicationThread.descriptor);
619 int state = data.readInt();
620 setProcessState(state);
621 reply.writeNoException();
622 return true;
623 }
Jeff Sharkeydd97f422013-10-08 17:01:30 -0700624
625 case SCHEDULE_INSTALL_PROVIDER_TRANSACTION:
626 {
627 data.enforceInterface(IApplicationThread.descriptor);
628 ProviderInfo provider = ProviderInfo.CREATOR.createFromParcel(data);
629 scheduleInstallProvider(provider);
630 reply.writeNoException();
631 return true;
632 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 }
634
635 return super.onTransact(code, data, reply, flags);
636 }
637
638 public IBinder asBinder()
639 {
640 return this;
641 }
642}
643
644class ApplicationThreadProxy implements IApplicationThread {
645 private final IBinder mRemote;
646
647 public ApplicationThreadProxy(IBinder remote) {
648 mRemote = remote;
649 }
650
651 public final IBinder asBinder() {
652 return mRemote;
653 }
654
655 public final void schedulePauseActivity(IBinder token, boolean finished,
656 boolean userLeaving, int configChanges) throws RemoteException {
657 Parcel data = Parcel.obtain();
658 data.writeInterfaceToken(IApplicationThread.descriptor);
659 data.writeStrongBinder(token);
660 data.writeInt(finished ? 1 : 0);
661 data.writeInt(userLeaving ? 1 :0);
662 data.writeInt(configChanges);
663 mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
664 IBinder.FLAG_ONEWAY);
665 data.recycle();
666 }
667
668 public final void scheduleStopActivity(IBinder token, boolean showWindow,
669 int configChanges) throws RemoteException {
670 Parcel data = Parcel.obtain();
671 data.writeInterfaceToken(IApplicationThread.descriptor);
672 data.writeStrongBinder(token);
673 data.writeInt(showWindow ? 1 : 0);
674 data.writeInt(configChanges);
675 mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
676 IBinder.FLAG_ONEWAY);
677 data.recycle();
678 }
679
680 public final void scheduleWindowVisibility(IBinder token,
681 boolean showWindow) throws RemoteException {
682 Parcel data = Parcel.obtain();
683 data.writeInterfaceToken(IApplicationThread.descriptor);
684 data.writeStrongBinder(token);
685 data.writeInt(showWindow ? 1 : 0);
686 mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
687 IBinder.FLAG_ONEWAY);
688 data.recycle();
689 }
690
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800691 public final void scheduleSleeping(IBinder token,
692 boolean sleeping) throws RemoteException {
693 Parcel data = Parcel.obtain();
694 data.writeInterfaceToken(IApplicationThread.descriptor);
695 data.writeStrongBinder(token);
696 data.writeInt(sleeping ? 1 : 0);
697 mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
698 IBinder.FLAG_ONEWAY);
699 data.recycle();
700 }
701
Adam Powellcfbe9be2013-11-06 14:58:58 -0800702 public final void scheduleResumeActivity(IBinder token, int procState, boolean isForward,
703 Bundle resumeArgs)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 throws RemoteException {
705 Parcel data = Parcel.obtain();
706 data.writeInterfaceToken(IApplicationThread.descriptor);
707 data.writeStrongBinder(token);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700708 data.writeInt(procState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 data.writeInt(isForward ? 1 : 0);
Adam Powellcfbe9be2013-11-06 14:58:58 -0800710 data.writeBundle(resumeArgs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
712 IBinder.FLAG_ONEWAY);
713 data.recycle();
714 }
715
716 public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
717 throws RemoteException {
718 Parcel data = Parcel.obtain();
719 data.writeInterfaceToken(IApplicationThread.descriptor);
720 data.writeStrongBinder(token);
721 data.writeTypedList(results);
722 mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
723 IBinder.FLAG_ONEWAY);
724 data.recycle();
725 }
726
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700727 public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700728 ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700729 int procState, Bundle state, List<ResultInfo> pendingResults,
Adam Powellcfbe9be2013-11-06 14:58:58 -0800730 List<Intent> pendingNewIntents, boolean notResumed, boolean isForward,
731 String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler,
732 Bundle resumeArgs)
733 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800734 Parcel data = Parcel.obtain();
735 data.writeInterfaceToken(IApplicationThread.descriptor);
736 intent.writeToParcel(data, 0);
737 data.writeStrongBinder(token);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700738 data.writeInt(ident);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800739 info.writeToParcel(data, 0);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700740 curConfig.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400741 compatInfo.writeToParcel(data, 0);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700742 data.writeInt(procState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800743 data.writeBundle(state);
744 data.writeTypedList(pendingResults);
745 data.writeTypedList(pendingNewIntents);
746 data.writeInt(notResumed ? 1 : 0);
747 data.writeInt(isForward ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700748 data.writeString(profileName);
749 if (profileFd != null) {
750 data.writeInt(1);
751 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
752 } else {
753 data.writeInt(0);
754 }
755 data.writeInt(autoStopProfiler ? 1 : 0);
Adam Powellcfbe9be2013-11-06 14:58:58 -0800756 data.writeBundle(resumeArgs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800757 mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
758 IBinder.FLAG_ONEWAY);
759 data.recycle();
760 }
761
762 public final void scheduleRelaunchActivity(IBinder token,
763 List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800764 int configChanges, boolean notResumed, Configuration config)
765 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800766 Parcel data = Parcel.obtain();
767 data.writeInterfaceToken(IApplicationThread.descriptor);
768 data.writeStrongBinder(token);
769 data.writeTypedList(pendingResults);
770 data.writeTypedList(pendingNewIntents);
771 data.writeInt(configChanges);
772 data.writeInt(notResumed ? 1 : 0);
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800773 if (config != null) {
774 data.writeInt(1);
775 config.writeToParcel(data, 0);
776 } else {
777 data.writeInt(0);
778 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800779 mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
780 IBinder.FLAG_ONEWAY);
781 data.recycle();
782 }
783
784 public void scheduleNewIntent(List<Intent> intents, IBinder token)
785 throws RemoteException {
786 Parcel data = Parcel.obtain();
787 data.writeInterfaceToken(IApplicationThread.descriptor);
788 data.writeTypedList(intents);
789 data.writeStrongBinder(token);
790 mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
791 IBinder.FLAG_ONEWAY);
792 data.recycle();
793 }
794
795 public final void scheduleDestroyActivity(IBinder token, boolean finishing,
796 int configChanges) throws RemoteException {
797 Parcel data = Parcel.obtain();
798 data.writeInterfaceToken(IApplicationThread.descriptor);
799 data.writeStrongBinder(token);
800 data.writeInt(finishing ? 1 : 0);
801 data.writeInt(configChanges);
802 mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
803 IBinder.FLAG_ONEWAY);
804 data.recycle();
805 }
806
807 public final void scheduleReceiver(Intent intent, ActivityInfo info,
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400808 CompatibilityInfo compatInfo, int resultCode, String resultData,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700809 Bundle map, boolean sync, int sendingUser, int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800810 Parcel data = Parcel.obtain();
811 data.writeInterfaceToken(IApplicationThread.descriptor);
812 intent.writeToParcel(data, 0);
813 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400814 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800815 data.writeInt(resultCode);
816 data.writeString(resultData);
817 data.writeBundle(map);
818 data.writeInt(sync ? 1 : 0);
Dianne Hackborn20e80982012-08-31 19:00:44 -0700819 data.writeInt(sendingUser);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700820 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800821 mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
822 IBinder.FLAG_ONEWAY);
823 data.recycle();
824 }
825
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400826 public final void scheduleCreateBackupAgent(ApplicationInfo app,
827 CompatibilityInfo compatInfo, int backupMode) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700828 Parcel data = Parcel.obtain();
829 data.writeInterfaceToken(IApplicationThread.descriptor);
830 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400831 compatInfo.writeToParcel(data, 0);
Christopher Tate181fafa2009-05-14 11:12:14 -0700832 data.writeInt(backupMode);
Christopher Tated884f432009-07-23 14:40:13 -0700833 mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
834 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700835 data.recycle();
836 }
837
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400838 public final void scheduleDestroyBackupAgent(ApplicationInfo app,
839 CompatibilityInfo compatInfo) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700840 Parcel data = Parcel.obtain();
841 data.writeInterfaceToken(IApplicationThread.descriptor);
842 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400843 compatInfo.writeToParcel(data, 0);
Christopher Tated884f432009-07-23 14:40:13 -0700844 mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
845 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700846 data.recycle();
847 }
848
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400849 public final void scheduleCreateService(IBinder token, ServiceInfo info,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700850 CompatibilityInfo compatInfo, int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800851 Parcel data = Parcel.obtain();
852 data.writeInterfaceToken(IApplicationThread.descriptor);
853 data.writeStrongBinder(token);
854 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400855 compatInfo.writeToParcel(data, 0);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700856 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
858 IBinder.FLAG_ONEWAY);
859 data.recycle();
860 }
861
Dianne Hackborna413dc02013-07-12 12:02:55 -0700862 public final void scheduleBindService(IBinder token, Intent intent, boolean rebind,
863 int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800864 Parcel data = Parcel.obtain();
865 data.writeInterfaceToken(IApplicationThread.descriptor);
866 data.writeStrongBinder(token);
867 intent.writeToParcel(data, 0);
868 data.writeInt(rebind ? 1 : 0);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700869 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800870 mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
871 IBinder.FLAG_ONEWAY);
872 data.recycle();
873 }
874
875 public final void scheduleUnbindService(IBinder token, Intent intent)
876 throws RemoteException {
877 Parcel data = Parcel.obtain();
878 data.writeInterfaceToken(IApplicationThread.descriptor);
879 data.writeStrongBinder(token);
880 intent.writeToParcel(data, 0);
881 mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
882 IBinder.FLAG_ONEWAY);
883 data.recycle();
884 }
885
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700886 public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700887 int flags, Intent args) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800888 Parcel data = Parcel.obtain();
889 data.writeInterfaceToken(IApplicationThread.descriptor);
890 data.writeStrongBinder(token);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700891 data.writeInt(taskRemoved ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 data.writeInt(startId);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700893 data.writeInt(flags);
894 if (args != null) {
895 data.writeInt(1);
896 args.writeToParcel(data, 0);
897 } else {
898 data.writeInt(0);
899 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800900 mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
901 IBinder.FLAG_ONEWAY);
902 data.recycle();
903 }
904
905 public final void scheduleStopService(IBinder token)
906 throws RemoteException {
907 Parcel data = Parcel.obtain();
908 data.writeInterfaceToken(IApplicationThread.descriptor);
909 data.writeStrongBinder(token);
910 mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
911 IBinder.FLAG_ONEWAY);
912 data.recycle();
913 }
914
915 public final void bindApplication(String packageName, ApplicationInfo info,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700916 List<ProviderInfo> providers, ComponentName testName, String profileName,
917 ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs,
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800918 IInstrumentationWatcher testWatcher,
919 IUiAutomationConnection uiAutomationConnection, int debugMode,
920 boolean openGlTrace, boolean restrictedBackupMode, boolean persistent,
921 Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services,
922 Bundle coreSettings) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800923 Parcel data = Parcel.obtain();
924 data.writeInterfaceToken(IApplicationThread.descriptor);
925 data.writeString(packageName);
926 info.writeToParcel(data, 0);
927 data.writeTypedList(providers);
928 if (testName == null) {
929 data.writeInt(0);
930 } else {
931 data.writeInt(1);
932 testName.writeToParcel(data, 0);
933 }
934 data.writeString(profileName);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700935 if (profileFd != null) {
936 data.writeInt(1);
937 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
938 } else {
939 data.writeInt(0);
940 }
941 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 data.writeBundle(testArgs);
943 data.writeStrongInterface(testWatcher);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800944 data.writeStrongInterface(uiAutomationConnection);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 data.writeInt(debugMode);
Siva Velusamy92a8b222012-03-09 16:24:04 -0800946 data.writeInt(openGlTrace ? 1 : 0);
Christopher Tate181fafa2009-05-14 11:12:14 -0700947 data.writeInt(restrictedBackupMode ? 1 : 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700948 data.writeInt(persistent ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800949 config.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400950 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800951 data.writeMap(services);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800952 data.writeBundle(coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800953 mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
954 IBinder.FLAG_ONEWAY);
955 data.recycle();
956 }
957
958 public final void scheduleExit() throws RemoteException {
959 Parcel data = Parcel.obtain();
960 data.writeInterfaceToken(IApplicationThread.descriptor);
961 mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
962 IBinder.FLAG_ONEWAY);
963 data.recycle();
964 }
Christopher Tate5e1ab332009-09-01 20:32:49 -0700965
966 public final void scheduleSuicide() throws RemoteException {
967 Parcel data = Parcel.obtain();
968 data.writeInterfaceToken(IApplicationThread.descriptor);
969 mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
970 IBinder.FLAG_ONEWAY);
971 data.recycle();
972 }
973
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800974 public final void requestThumbnail(IBinder token)
975 throws RemoteException {
976 Parcel data = Parcel.obtain();
977 data.writeInterfaceToken(IApplicationThread.descriptor);
978 data.writeStrongBinder(token);
979 mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null,
980 IBinder.FLAG_ONEWAY);
981 data.recycle();
982 }
983
984 public final void scheduleConfigurationChanged(Configuration config)
985 throws RemoteException {
986 Parcel data = Parcel.obtain();
987 data.writeInterfaceToken(IApplicationThread.descriptor);
988 config.writeToParcel(data, 0);
989 mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
990 IBinder.FLAG_ONEWAY);
991 data.recycle();
992 }
993
994 public void updateTimeZone() throws RemoteException {
995 Parcel data = Parcel.obtain();
996 data.writeInterfaceToken(IApplicationThread.descriptor);
997 mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
998 IBinder.FLAG_ONEWAY);
999 data.recycle();
1000 }
1001
Robert Greenwalt03595d02010-11-02 14:08:23 -07001002 public void clearDnsCache() throws RemoteException {
1003 Parcel data = Parcel.obtain();
1004 data.writeInterfaceToken(IApplicationThread.descriptor);
1005 mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
1006 IBinder.FLAG_ONEWAY);
1007 data.recycle();
1008 }
1009
Jason Monk602b2322013-07-03 17:04:33 -04001010 public void setHttpProxy(String proxy, String port, String exclList,
1011 String pacFileUrl) throws RemoteException {
Robert Greenwalt434203a2010-10-11 16:00:27 -07001012 Parcel data = Parcel.obtain();
1013 data.writeInterfaceToken(IApplicationThread.descriptor);
1014 data.writeString(proxy);
1015 data.writeString(port);
1016 data.writeString(exclList);
Jason Monk602b2322013-07-03 17:04:33 -04001017 data.writeString(pacFileUrl);
Robert Greenwalt434203a2010-10-11 16:00:27 -07001018 mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1019 data.recycle();
1020 }
1021
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001022 public void processInBackground() throws RemoteException {
1023 Parcel data = Parcel.obtain();
1024 data.writeInterfaceToken(IApplicationThread.descriptor);
1025 mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
1026 IBinder.FLAG_ONEWAY);
1027 data.recycle();
1028 }
1029
1030 public void dumpService(FileDescriptor fd, IBinder token, String[] args)
1031 throws RemoteException {
1032 Parcel data = Parcel.obtain();
1033 data.writeInterfaceToken(IApplicationThread.descriptor);
1034 data.writeFileDescriptor(fd);
1035 data.writeStrongBinder(token);
1036 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -07001037 mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001038 data.recycle();
1039 }
1040
Marco Nelissen18cb2872011-11-15 11:19:53 -08001041 public void dumpProvider(FileDescriptor fd, IBinder token, String[] args)
1042 throws RemoteException {
1043 Parcel data = Parcel.obtain();
1044 data.writeInterfaceToken(IApplicationThread.descriptor);
1045 data.writeFileDescriptor(fd);
1046 data.writeStrongBinder(token);
1047 data.writeStringArray(args);
1048 mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1049 data.recycle();
1050 }
1051
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001052 public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
Dianne Hackborn20e80982012-08-31 19:00:44 -07001053 int resultCode, String dataStr, Bundle extras, boolean ordered,
Dianne Hackborna413dc02013-07-12 12:02:55 -07001054 boolean sticky, int sendingUser, int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001055 Parcel data = Parcel.obtain();
1056 data.writeInterfaceToken(IApplicationThread.descriptor);
1057 data.writeStrongBinder(receiver.asBinder());
1058 intent.writeToParcel(data, 0);
1059 data.writeInt(resultCode);
1060 data.writeString(dataStr);
1061 data.writeBundle(extras);
1062 data.writeInt(ordered ? 1 : 0);
Dianne Hackborn68d881c2009-10-05 13:58:17 -07001063 data.writeInt(sticky ? 1 : 0);
Dianne Hackborn20e80982012-08-31 19:00:44 -07001064 data.writeInt(sendingUser);
Dianne Hackborna413dc02013-07-12 12:02:55 -07001065 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001066 mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
1067 IBinder.FLAG_ONEWAY);
1068 data.recycle();
1069 }
1070
1071 public final void scheduleLowMemory() throws RemoteException {
1072 Parcel data = Parcel.obtain();
1073 data.writeInterfaceToken(IApplicationThread.descriptor);
1074 mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
1075 IBinder.FLAG_ONEWAY);
1076 data.recycle();
1077 }
1078
1079 public final void scheduleActivityConfigurationChanged(
1080 IBinder token) throws RemoteException {
1081 Parcel data = Parcel.obtain();
1082 data.writeInterfaceToken(IApplicationThread.descriptor);
1083 data.writeStrongBinder(token);
1084 mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1085 IBinder.FLAG_ONEWAY);
1086 data.recycle();
1087 }
1088
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001089 public void profilerControl(boolean start, String path,
Romain Guy7eabe552011-07-21 14:56:34 -07001090 ParcelFileDescriptor fd, int profileType) throws RemoteException {
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001091 Parcel data = Parcel.obtain();
1092 data.writeInterfaceToken(IApplicationThread.descriptor);
1093 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001094 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001095 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001096 if (fd != null) {
1097 data.writeInt(1);
1098 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1099 } else {
1100 data.writeInt(0);
1101 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001102 mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
1103 IBinder.FLAG_ONEWAY);
1104 data.recycle();
1105 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -07001106
1107 public void setSchedulingGroup(int group) throws RemoteException {
1108 Parcel data = Parcel.obtain();
1109 data.writeInterfaceToken(IApplicationThread.descriptor);
1110 data.writeInt(group);
1111 mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
1112 IBinder.FLAG_ONEWAY);
1113 data.recycle();
1114 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001115
Dianne Hackborn4416c3d2010-05-04 17:22:49 -07001116 public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
1117 Parcel data = Parcel.obtain();
1118 data.writeInterfaceToken(IApplicationThread.descriptor);
1119 data.writeInt(cmd);
1120 data.writeStringArray(packages);
1121 mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
1122 IBinder.FLAG_ONEWAY);
1123 data.recycle();
1124
1125 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001126
1127 public void scheduleCrash(String msg) throws RemoteException {
1128 Parcel data = Parcel.obtain();
1129 data.writeInterfaceToken(IApplicationThread.descriptor);
1130 data.writeString(msg);
1131 mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
1132 IBinder.FLAG_ONEWAY);
1133 data.recycle();
1134
1135 }
Andy McFadden824c5102010-07-09 16:26:57 -07001136
1137 public void dumpHeap(boolean managed, String path,
1138 ParcelFileDescriptor fd) throws RemoteException {
1139 Parcel data = Parcel.obtain();
1140 data.writeInterfaceToken(IApplicationThread.descriptor);
1141 data.writeInt(managed ? 1 : 0);
1142 data.writeString(path);
1143 if (fd != null) {
1144 data.writeInt(1);
1145 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1146 } else {
1147 data.writeInt(0);
1148 }
1149 mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
1150 IBinder.FLAG_ONEWAY);
1151 data.recycle();
1152 }
Dianne Hackborn625ac272010-09-17 18:29:22 -07001153
Dianne Hackborn30d71892010-12-11 10:37:55 -08001154 public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
Dianne Hackborn625ac272010-09-17 18:29:22 -07001155 throws RemoteException {
1156 Parcel data = Parcel.obtain();
1157 data.writeInterfaceToken(IApplicationThread.descriptor);
1158 data.writeFileDescriptor(fd);
1159 data.writeStrongBinder(token);
Dianne Hackborn30d71892010-12-11 10:37:55 -08001160 data.writeString(prefix);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001161 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -07001162 mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001163 data.recycle();
1164 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001165
1166 public void setCoreSettings(Bundle coreSettings) throws RemoteException {
1167 Parcel data = Parcel.obtain();
1168 data.writeInterfaceToken(IApplicationThread.descriptor);
1169 data.writeBundle(coreSettings);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001170 mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1171 }
1172
1173 public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
1174 throws RemoteException {
1175 Parcel data = Parcel.obtain();
1176 data.writeInterfaceToken(IApplicationThread.descriptor);
1177 data.writeString(pkg);
1178 info.writeToParcel(data, 0);
1179 mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null,
1180 IBinder.FLAG_ONEWAY);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001181 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -07001182
1183 public void scheduleTrimMemory(int level) throws RemoteException {
1184 Parcel data = Parcel.obtain();
1185 data.writeInterfaceToken(IApplicationThread.descriptor);
1186 data.writeInt(level);
1187 mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
1188 IBinder.FLAG_ONEWAY);
1189 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001190
Dianne Hackborn3bc8f78d2013-09-19 13:34:35 -07001191 public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin,
1192 boolean dumpInfo, boolean dumpDalvik, String[] args) throws RemoteException {
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001193 Parcel data = Parcel.obtain();
1194 Parcel reply = Parcel.obtain();
1195 data.writeInterfaceToken(IApplicationThread.descriptor);
1196 data.writeFileDescriptor(fd);
Dianne Hackborn3bc8f78d2013-09-19 13:34:35 -07001197 mem.writeToParcel(data, 0);
Dianne Hackbornb437e092011-08-05 17:50:29 -07001198 data.writeInt(checkin ? 1 : 0);
Dianne Hackborn64770d12013-05-23 17:51:19 -07001199 data.writeInt(dumpInfo ? 1 : 0);
1200 data.writeInt(dumpDalvik ? 1 : 0);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001201 data.writeStringArray(args);
1202 mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
1203 reply.readException();
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001204 data.recycle();
1205 reply.recycle();
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001206 }
1207
1208 public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException {
1209 Parcel data = Parcel.obtain();
1210 data.writeInterfaceToken(IApplicationThread.descriptor);
1211 data.writeFileDescriptor(fd);
1212 data.writeStringArray(args);
1213 mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1214 data.recycle();
1215 }
Jeff Brown6754ba22011-12-14 20:20:01 -08001216
1217 public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException {
1218 Parcel data = Parcel.obtain();
1219 data.writeInterfaceToken(IApplicationThread.descriptor);
1220 data.writeFileDescriptor(fd);
1221 data.writeStringArray(args);
1222 mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1223 data.recycle();
1224 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001225
Craig Mautner5eda9b32013-07-02 11:58:16 -07001226 @Override
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001227 public void unstableProviderDied(IBinder provider) throws RemoteException {
1228 Parcel data = Parcel.obtain();
1229 data.writeInterfaceToken(IApplicationThread.descriptor);
1230 data.writeStrongBinder(provider);
1231 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1232 data.recycle();
1233 }
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001234
Craig Mautner5eda9b32013-07-02 11:58:16 -07001235 @Override
Adam Skorydfc7fd72013-08-05 19:23:41 -07001236 public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken,
Adam Skory7140a252013-09-11 12:04:58 +01001237 int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001238 Parcel data = Parcel.obtain();
1239 data.writeInterfaceToken(IApplicationThread.descriptor);
1240 data.writeStrongBinder(activityToken);
1241 data.writeStrongBinder(requestToken);
1242 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07001243 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, null,
1244 IBinder.FLAG_ONEWAY);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001245 data.recycle();
1246 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07001247
1248 @Override
1249 public void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
1250 throws RemoteException {
1251 Parcel data = Parcel.obtain();
1252 data.writeInterfaceToken(IApplicationThread.descriptor);
1253 data.writeStrongBinder(token);
1254 data.writeInt(timeout ? 1 : 0);
1255 mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1256 data.recycle();
1257 }
Dianne Hackborna413dc02013-07-12 12:02:55 -07001258
1259 @Override
1260 public void setProcessState(int state) throws RemoteException {
1261 Parcel data = Parcel.obtain();
1262 data.writeInterfaceToken(IApplicationThread.descriptor);
1263 data.writeInt(state);
1264 mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1265 data.recycle();
1266 }
Jeff Sharkeydd97f422013-10-08 17:01:30 -07001267
1268 @Override
1269 public void scheduleInstallProvider(ProviderInfo provider) throws RemoteException {
1270 Parcel data = Parcel.obtain();
1271 data.writeInterfaceToken(IApplicationThread.descriptor);
1272 provider.writeToParcel(data, 0);
1273 mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1274 data.recycle();
1275 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001276}