blob: b1c58f234c392817e4c6cc90f6fa0c922cc16b2c [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();
114 boolean isForward = data.readInt() != 0;
115 scheduleResumeActivity(b, isForward);
116 return true;
117 }
118
119 case SCHEDULE_SEND_RESULT_TRANSACTION:
120 {
121 data.enforceInterface(IApplicationThread.descriptor);
122 IBinder b = data.readStrongBinder();
123 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
124 scheduleSendResult(b, ri);
125 return true;
126 }
127
128 case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION:
129 {
130 data.enforceInterface(IApplicationThread.descriptor);
131 Intent intent = Intent.CREATOR.createFromParcel(data);
132 IBinder b = data.readStrongBinder();
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700133 int ident = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700135 Configuration curConfig = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400136 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137 Bundle state = data.readBundle();
138 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
139 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
140 boolean notResumed = data.readInt() != 0;
141 boolean isForward = data.readInt() != 0;
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700142 String profileName = data.readString();
143 ParcelFileDescriptor profileFd = data.readInt() != 0
144 ? data.readFileDescriptor() : null;
145 boolean autoStopProfiler = data.readInt() != 0;
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700146 scheduleLaunchActivity(intent, b, ident, info, curConfig, compatInfo, state, ri, pi,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700147 notResumed, isForward, profileName, profileFd, autoStopProfiler);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800148 return true;
149 }
150
151 case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION:
152 {
153 data.enforceInterface(IApplicationThread.descriptor);
154 IBinder b = data.readStrongBinder();
155 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
156 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
157 int configChanges = data.readInt();
158 boolean notResumed = data.readInt() != 0;
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800159 Configuration config = null;
160 if (data.readInt() != 0) {
161 config = Configuration.CREATOR.createFromParcel(data);
162 }
163 scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 return true;
165 }
166
167 case SCHEDULE_NEW_INTENT_TRANSACTION:
168 {
169 data.enforceInterface(IApplicationThread.descriptor);
170 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
171 IBinder b = data.readStrongBinder();
172 scheduleNewIntent(pi, b);
173 return true;
174 }
175
176 case SCHEDULE_FINISH_ACTIVITY_TRANSACTION:
177 {
178 data.enforceInterface(IApplicationThread.descriptor);
179 IBinder b = data.readStrongBinder();
180 boolean finishing = data.readInt() != 0;
181 int configChanges = data.readInt();
182 scheduleDestroyActivity(b, finishing, configChanges);
183 return true;
184 }
185
186 case SCHEDULE_RECEIVER_TRANSACTION:
187 {
188 data.enforceInterface(IApplicationThread.descriptor);
189 Intent intent = Intent.CREATOR.createFromParcel(data);
190 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400191 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800192 int resultCode = data.readInt();
193 String resultData = data.readString();
194 Bundle resultExtras = data.readBundle();
195 boolean sync = data.readInt() != 0;
Dianne Hackborn20e80982012-08-31 19:00:44 -0700196 int sendingUser = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400197 scheduleReceiver(intent, info, compatInfo, resultCode, resultData,
Dianne Hackborn20e80982012-08-31 19:00:44 -0700198 resultExtras, sync, sendingUser);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800199 return true;
200 }
201
202 case SCHEDULE_CREATE_SERVICE_TRANSACTION: {
203 data.enforceInterface(IApplicationThread.descriptor);
204 IBinder token = data.readStrongBinder();
205 ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400206 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
207 scheduleCreateService(token, info, compatInfo);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208 return true;
209 }
210
211 case SCHEDULE_BIND_SERVICE_TRANSACTION: {
212 data.enforceInterface(IApplicationThread.descriptor);
213 IBinder token = data.readStrongBinder();
214 Intent intent = Intent.CREATOR.createFromParcel(data);
215 boolean rebind = data.readInt() != 0;
216 scheduleBindService(token, intent, rebind);
217 return true;
218 }
219
220 case SCHEDULE_UNBIND_SERVICE_TRANSACTION: {
221 data.enforceInterface(IApplicationThread.descriptor);
222 IBinder token = data.readStrongBinder();
223 Intent intent = Intent.CREATOR.createFromParcel(data);
224 scheduleUnbindService(token, intent);
225 return true;
226 }
227
228 case SCHEDULE_SERVICE_ARGS_TRANSACTION:
229 {
230 data.enforceInterface(IApplicationThread.descriptor);
231 IBinder token = data.readStrongBinder();
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700232 boolean taskRemoved = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800233 int startId = data.readInt();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700234 int fl = data.readInt();
235 Intent args;
236 if (data.readInt() != 0) {
237 args = Intent.CREATOR.createFromParcel(data);
238 } else {
239 args = null;
240 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700241 scheduleServiceArgs(token, taskRemoved, startId, fl, args);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242 return true;
243 }
244
245 case SCHEDULE_STOP_SERVICE_TRANSACTION:
246 {
247 data.enforceInterface(IApplicationThread.descriptor);
248 IBinder token = data.readStrongBinder();
249 scheduleStopService(token);
250 return true;
251 }
252
253 case BIND_APPLICATION_TRANSACTION:
254 {
255 data.enforceInterface(IApplicationThread.descriptor);
256 String packageName = data.readString();
257 ApplicationInfo info =
258 ApplicationInfo.CREATOR.createFromParcel(data);
259 List<ProviderInfo> providers =
260 data.createTypedArrayList(ProviderInfo.CREATOR);
261 ComponentName testName = (data.readInt() != 0)
262 ? new ComponentName(data) : null;
263 String profileName = data.readString();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700264 ParcelFileDescriptor profileFd = data.readInt() != 0
265 ? data.readFileDescriptor() : null;
266 boolean autoStopProfiler = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800267 Bundle testArgs = data.readBundle();
268 IBinder binder = data.readStrongBinder();
269 IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800270 binder = data.readStrongBinder();
271 IUiAutomationConnection uiAutomationConnection =
272 IUiAutomationConnection.Stub.asInterface(binder);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800273 int testMode = data.readInt();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800274 boolean openGlTrace = data.readInt() != 0;
Christopher Tate181fafa2009-05-14 11:12:14 -0700275 boolean restrictedBackupMode = (data.readInt() != 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700276 boolean persistent = (data.readInt() != 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800277 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400278 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800279 HashMap<String, IBinder> services = data.readHashMap(null);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800280 Bundle coreSettings = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800281 bindApplication(packageName, info,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700282 providers, testName, profileName, profileFd, autoStopProfiler,
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800283 testArgs, testWatcher, uiAutomationConnection, testMode,
284 openGlTrace, restrictedBackupMode, persistent, config, compatInfo,
285 services, coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800286 return true;
287 }
Siva Velusamy92a8b222012-03-09 16:24:04 -0800288
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289 case SCHEDULE_EXIT_TRANSACTION:
290 {
291 data.enforceInterface(IApplicationThread.descriptor);
292 scheduleExit();
293 return true;
294 }
295
Christopher Tate5e1ab332009-09-01 20:32:49 -0700296 case SCHEDULE_SUICIDE_TRANSACTION:
297 {
298 data.enforceInterface(IApplicationThread.descriptor);
299 scheduleSuicide();
300 return true;
301 }
302
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800303 case REQUEST_THUMBNAIL_TRANSACTION:
304 {
305 data.enforceInterface(IApplicationThread.descriptor);
306 IBinder b = data.readStrongBinder();
307 requestThumbnail(b);
308 return true;
309 }
Robert Greenwalt434203a2010-10-11 16:00:27 -0700310
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311 case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
312 {
313 data.enforceInterface(IApplicationThread.descriptor);
314 Configuration config = Configuration.CREATOR.createFromParcel(data);
315 scheduleConfigurationChanged(config);
316 return true;
317 }
318
319 case UPDATE_TIME_ZONE_TRANSACTION: {
320 data.enforceInterface(IApplicationThread.descriptor);
321 updateTimeZone();
322 return true;
323 }
324
Robert Greenwalt03595d02010-11-02 14:08:23 -0700325 case CLEAR_DNS_CACHE_TRANSACTION: {
326 data.enforceInterface(IApplicationThread.descriptor);
327 clearDnsCache();
328 return true;
329 }
330
Robert Greenwalt434203a2010-10-11 16:00:27 -0700331 case SET_HTTP_PROXY_TRANSACTION: {
332 data.enforceInterface(IApplicationThread.descriptor);
333 final String proxy = data.readString();
334 final String port = data.readString();
335 final String exclList = data.readString();
336 setHttpProxy(proxy, port, exclList);
337 return true;
338 }
339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 case PROCESS_IN_BACKGROUND_TRANSACTION: {
341 data.enforceInterface(IApplicationThread.descriptor);
342 processInBackground();
343 return true;
344 }
Robert Greenwalt434203a2010-10-11 16:00:27 -0700345
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800346 case DUMP_SERVICE_TRANSACTION: {
347 data.enforceInterface(IApplicationThread.descriptor);
348 ParcelFileDescriptor fd = data.readFileDescriptor();
349 final IBinder service = data.readStrongBinder();
350 final String[] args = data.readStringArray();
351 if (fd != null) {
352 dumpService(fd.getFileDescriptor(), service, args);
353 try {
354 fd.close();
355 } catch (IOException e) {
356 }
357 }
358 return true;
359 }
360
Marco Nelissen18cb2872011-11-15 11:19:53 -0800361 case DUMP_PROVIDER_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 dumpProvider(fd.getFileDescriptor(), service, args);
368 try {
369 fd.close();
370 } catch (IOException e) {
371 }
372 }
373 return true;
374 }
375
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800376 case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
377 data.enforceInterface(IApplicationThread.descriptor);
378 IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
379 data.readStrongBinder());
380 Intent intent = Intent.CREATOR.createFromParcel(data);
381 int resultCode = data.readInt();
382 String dataStr = data.readString();
383 Bundle extras = data.readBundle();
384 boolean ordered = data.readInt() != 0;
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700385 boolean sticky = data.readInt() != 0;
Dianne Hackborn20e80982012-08-31 19:00:44 -0700386 int sendingUser = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 scheduleRegisteredReceiver(receiver, intent,
Dianne Hackborn20e80982012-08-31 19:00:44 -0700388 resultCode, dataStr, extras, ordered, sticky, sendingUser);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 return true;
390 }
391
392 case SCHEDULE_LOW_MEMORY_TRANSACTION:
393 {
Vairavan Srinivasane94a3e72012-02-01 23:17:14 -0800394 data.enforceInterface(IApplicationThread.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800395 scheduleLowMemory();
396 return true;
397 }
398
399 case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
400 {
401 data.enforceInterface(IApplicationThread.descriptor);
402 IBinder b = data.readStrongBinder();
403 scheduleActivityConfigurationChanged(b);
404 return true;
405 }
406
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800407 case PROFILER_CONTROL_TRANSACTION:
408 {
409 data.enforceInterface(IApplicationThread.descriptor);
410 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -0700411 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800412 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -0700413 ParcelFileDescriptor fd = data.readInt() != 0
414 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -0700415 profilerControl(start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800416 return true;
417 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -0700418
419 case SET_SCHEDULING_GROUP_TRANSACTION:
420 {
421 data.enforceInterface(IApplicationThread.descriptor);
422 int group = data.readInt();
423 setSchedulingGroup(group);
424 return true;
425 }
Christopher Tate181fafa2009-05-14 11:12:14 -0700426
427 case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
428 {
429 data.enforceInterface(IApplicationThread.descriptor);
430 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400431 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Christopher Tate181fafa2009-05-14 11:12:14 -0700432 int backupMode = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400433 scheduleCreateBackupAgent(appInfo, compatInfo, backupMode);
Christopher Tate181fafa2009-05-14 11:12:14 -0700434 return true;
435 }
Christopher Tate1885b372009-06-04 15:00:33 -0700436
437 case SCHEDULE_DESTROY_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);
442 scheduleDestroyBackupAgent(appInfo, compatInfo);
Christopher Tate1885b372009-06-04 15:00:33 -0700443 return true;
444 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -0700445
446 case GET_MEMORY_INFO_TRANSACTION:
447 {
448 data.enforceInterface(IApplicationThread.descriptor);
449 Debug.MemoryInfo mi = new Debug.MemoryInfo();
450 getMemoryInfo(mi);
451 reply.writeNoException();
452 mi.writeToParcel(reply, 0);
453 return true;
454 }
Dianne Hackborn4416c3d2010-05-04 17:22:49 -0700455
456 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
479 ? data.readFileDescriptor() : null;
480 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 Hackbornb437e092011-08-05 17:50:29 -0700526 boolean checkin = data.readInt() != 0;
527 boolean all = data.readInt() != 0;
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700528 String[] args = data.readStringArray();
529 Debug.MemoryInfo mi = null;
530 if (fd != null) {
531 try {
Dianne Hackbornb437e092011-08-05 17:50:29 -0700532 mi = dumpMemInfo(fd.getFileDescriptor(), checkin, all, args);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700533 } finally {
534 try {
535 fd.close();
536 } catch (IOException e) {
537 // swallowed, not propagated back to the caller
538 }
539 }
540 }
541 reply.writeNoException();
542 mi.writeToParcel(reply, 0);
543 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
595 case REQUEST_ACTIVITY_EXTRAS_TRANSACTION:
596 {
597 data.enforceInterface(IApplicationThread.descriptor);
598 IBinder activityToken = data.readStrongBinder();
599 IBinder requestToken = data.readStrongBinder();
600 int requestType = data.readInt();
601 requestActivityExtras(activityToken, requestToken, requestType);
602 reply.writeNoException();
603 return true;
604 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 }
606
607 return super.onTransact(code, data, reply, flags);
608 }
609
610 public IBinder asBinder()
611 {
612 return this;
613 }
614}
615
616class ApplicationThreadProxy implements IApplicationThread {
617 private final IBinder mRemote;
618
619 public ApplicationThreadProxy(IBinder remote) {
620 mRemote = remote;
621 }
622
623 public final IBinder asBinder() {
624 return mRemote;
625 }
626
627 public final void schedulePauseActivity(IBinder token, boolean finished,
628 boolean userLeaving, int configChanges) throws RemoteException {
629 Parcel data = Parcel.obtain();
630 data.writeInterfaceToken(IApplicationThread.descriptor);
631 data.writeStrongBinder(token);
632 data.writeInt(finished ? 1 : 0);
633 data.writeInt(userLeaving ? 1 :0);
634 data.writeInt(configChanges);
635 mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
636 IBinder.FLAG_ONEWAY);
637 data.recycle();
638 }
639
640 public final void scheduleStopActivity(IBinder token, boolean showWindow,
641 int configChanges) throws RemoteException {
642 Parcel data = Parcel.obtain();
643 data.writeInterfaceToken(IApplicationThread.descriptor);
644 data.writeStrongBinder(token);
645 data.writeInt(showWindow ? 1 : 0);
646 data.writeInt(configChanges);
647 mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
648 IBinder.FLAG_ONEWAY);
649 data.recycle();
650 }
651
652 public final void scheduleWindowVisibility(IBinder token,
653 boolean showWindow) throws RemoteException {
654 Parcel data = Parcel.obtain();
655 data.writeInterfaceToken(IApplicationThread.descriptor);
656 data.writeStrongBinder(token);
657 data.writeInt(showWindow ? 1 : 0);
658 mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
659 IBinder.FLAG_ONEWAY);
660 data.recycle();
661 }
662
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800663 public final void scheduleSleeping(IBinder token,
664 boolean sleeping) throws RemoteException {
665 Parcel data = Parcel.obtain();
666 data.writeInterfaceToken(IApplicationThread.descriptor);
667 data.writeStrongBinder(token);
668 data.writeInt(sleeping ? 1 : 0);
669 mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
670 IBinder.FLAG_ONEWAY);
671 data.recycle();
672 }
673
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800674 public final void scheduleResumeActivity(IBinder token, boolean isForward)
675 throws RemoteException {
676 Parcel data = Parcel.obtain();
677 data.writeInterfaceToken(IApplicationThread.descriptor);
678 data.writeStrongBinder(token);
679 data.writeInt(isForward ? 1 : 0);
680 mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
681 IBinder.FLAG_ONEWAY);
682 data.recycle();
683 }
684
685 public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
686 throws RemoteException {
687 Parcel data = Parcel.obtain();
688 data.writeInterfaceToken(IApplicationThread.descriptor);
689 data.writeStrongBinder(token);
690 data.writeTypedList(results);
691 mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
692 IBinder.FLAG_ONEWAY);
693 data.recycle();
694 }
695
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700696 public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700697 ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo,
698 Bundle state, List<ResultInfo> pendingResults,
699 List<Intent> pendingNewIntents, boolean notResumed, boolean isForward,
700 String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 throws RemoteException {
702 Parcel data = Parcel.obtain();
703 data.writeInterfaceToken(IApplicationThread.descriptor);
704 intent.writeToParcel(data, 0);
705 data.writeStrongBinder(token);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700706 data.writeInt(ident);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 info.writeToParcel(data, 0);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700708 curConfig.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400709 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 data.writeBundle(state);
711 data.writeTypedList(pendingResults);
712 data.writeTypedList(pendingNewIntents);
713 data.writeInt(notResumed ? 1 : 0);
714 data.writeInt(isForward ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700715 data.writeString(profileName);
716 if (profileFd != null) {
717 data.writeInt(1);
718 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
719 } else {
720 data.writeInt(0);
721 }
722 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800723 mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
724 IBinder.FLAG_ONEWAY);
725 data.recycle();
726 }
727
728 public final void scheduleRelaunchActivity(IBinder token,
729 List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800730 int configChanges, boolean notResumed, Configuration config)
731 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800732 Parcel data = Parcel.obtain();
733 data.writeInterfaceToken(IApplicationThread.descriptor);
734 data.writeStrongBinder(token);
735 data.writeTypedList(pendingResults);
736 data.writeTypedList(pendingNewIntents);
737 data.writeInt(configChanges);
738 data.writeInt(notResumed ? 1 : 0);
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800739 if (config != null) {
740 data.writeInt(1);
741 config.writeToParcel(data, 0);
742 } else {
743 data.writeInt(0);
744 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
746 IBinder.FLAG_ONEWAY);
747 data.recycle();
748 }
749
750 public void scheduleNewIntent(List<Intent> intents, IBinder token)
751 throws RemoteException {
752 Parcel data = Parcel.obtain();
753 data.writeInterfaceToken(IApplicationThread.descriptor);
754 data.writeTypedList(intents);
755 data.writeStrongBinder(token);
756 mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
757 IBinder.FLAG_ONEWAY);
758 data.recycle();
759 }
760
761 public final void scheduleDestroyActivity(IBinder token, boolean finishing,
762 int configChanges) throws RemoteException {
763 Parcel data = Parcel.obtain();
764 data.writeInterfaceToken(IApplicationThread.descriptor);
765 data.writeStrongBinder(token);
766 data.writeInt(finishing ? 1 : 0);
767 data.writeInt(configChanges);
768 mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
769 IBinder.FLAG_ONEWAY);
770 data.recycle();
771 }
772
773 public final void scheduleReceiver(Intent intent, ActivityInfo info,
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400774 CompatibilityInfo compatInfo, int resultCode, String resultData,
Dianne Hackborn20e80982012-08-31 19:00:44 -0700775 Bundle map, boolean sync, int sendingUser) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776 Parcel data = Parcel.obtain();
777 data.writeInterfaceToken(IApplicationThread.descriptor);
778 intent.writeToParcel(data, 0);
779 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400780 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800781 data.writeInt(resultCode);
782 data.writeString(resultData);
783 data.writeBundle(map);
784 data.writeInt(sync ? 1 : 0);
Dianne Hackborn20e80982012-08-31 19:00:44 -0700785 data.writeInt(sendingUser);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
787 IBinder.FLAG_ONEWAY);
788 data.recycle();
789 }
790
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400791 public final void scheduleCreateBackupAgent(ApplicationInfo app,
792 CompatibilityInfo compatInfo, int backupMode) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700793 Parcel data = Parcel.obtain();
794 data.writeInterfaceToken(IApplicationThread.descriptor);
795 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400796 compatInfo.writeToParcel(data, 0);
Christopher Tate181fafa2009-05-14 11:12:14 -0700797 data.writeInt(backupMode);
Christopher Tated884f432009-07-23 14:40:13 -0700798 mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
799 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700800 data.recycle();
801 }
802
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400803 public final void scheduleDestroyBackupAgent(ApplicationInfo app,
804 CompatibilityInfo compatInfo) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700805 Parcel data = Parcel.obtain();
806 data.writeInterfaceToken(IApplicationThread.descriptor);
807 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400808 compatInfo.writeToParcel(data, 0);
Christopher Tated884f432009-07-23 14:40:13 -0700809 mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
810 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700811 data.recycle();
812 }
813
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400814 public final void scheduleCreateService(IBinder token, ServiceInfo info,
815 CompatibilityInfo compatInfo) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 Parcel data = Parcel.obtain();
817 data.writeInterfaceToken(IApplicationThread.descriptor);
818 data.writeStrongBinder(token);
819 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400820 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800821 mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
822 IBinder.FLAG_ONEWAY);
823 data.recycle();
824 }
825
826 public final void scheduleBindService(IBinder token, Intent intent, boolean rebind)
827 throws RemoteException {
828 Parcel data = Parcel.obtain();
829 data.writeInterfaceToken(IApplicationThread.descriptor);
830 data.writeStrongBinder(token);
831 intent.writeToParcel(data, 0);
832 data.writeInt(rebind ? 1 : 0);
833 mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
834 IBinder.FLAG_ONEWAY);
835 data.recycle();
836 }
837
838 public final void scheduleUnbindService(IBinder token, Intent intent)
839 throws RemoteException {
840 Parcel data = Parcel.obtain();
841 data.writeInterfaceToken(IApplicationThread.descriptor);
842 data.writeStrongBinder(token);
843 intent.writeToParcel(data, 0);
844 mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
845 IBinder.FLAG_ONEWAY);
846 data.recycle();
847 }
848
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700849 public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700850 int flags, Intent args) 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);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700854 data.writeInt(taskRemoved ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800855 data.writeInt(startId);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700856 data.writeInt(flags);
857 if (args != null) {
858 data.writeInt(1);
859 args.writeToParcel(data, 0);
860 } else {
861 data.writeInt(0);
862 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800863 mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
864 IBinder.FLAG_ONEWAY);
865 data.recycle();
866 }
867
868 public final void scheduleStopService(IBinder token)
869 throws RemoteException {
870 Parcel data = Parcel.obtain();
871 data.writeInterfaceToken(IApplicationThread.descriptor);
872 data.writeStrongBinder(token);
873 mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
874 IBinder.FLAG_ONEWAY);
875 data.recycle();
876 }
877
878 public final void bindApplication(String packageName, ApplicationInfo info,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700879 List<ProviderInfo> providers, ComponentName testName, String profileName,
880 ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs,
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800881 IInstrumentationWatcher testWatcher,
882 IUiAutomationConnection uiAutomationConnection, int debugMode,
883 boolean openGlTrace, boolean restrictedBackupMode, boolean persistent,
884 Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services,
885 Bundle coreSettings) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886 Parcel data = Parcel.obtain();
887 data.writeInterfaceToken(IApplicationThread.descriptor);
888 data.writeString(packageName);
889 info.writeToParcel(data, 0);
890 data.writeTypedList(providers);
891 if (testName == null) {
892 data.writeInt(0);
893 } else {
894 data.writeInt(1);
895 testName.writeToParcel(data, 0);
896 }
897 data.writeString(profileName);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700898 if (profileFd != null) {
899 data.writeInt(1);
900 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
901 } else {
902 data.writeInt(0);
903 }
904 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 data.writeBundle(testArgs);
906 data.writeStrongInterface(testWatcher);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800907 data.writeStrongInterface(uiAutomationConnection);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 data.writeInt(debugMode);
Siva Velusamy92a8b222012-03-09 16:24:04 -0800909 data.writeInt(openGlTrace ? 1 : 0);
Christopher Tate181fafa2009-05-14 11:12:14 -0700910 data.writeInt(restrictedBackupMode ? 1 : 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700911 data.writeInt(persistent ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800912 config.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400913 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800914 data.writeMap(services);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800915 data.writeBundle(coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800916 mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
917 IBinder.FLAG_ONEWAY);
918 data.recycle();
919 }
920
921 public final void scheduleExit() throws RemoteException {
922 Parcel data = Parcel.obtain();
923 data.writeInterfaceToken(IApplicationThread.descriptor);
924 mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
925 IBinder.FLAG_ONEWAY);
926 data.recycle();
927 }
Christopher Tate5e1ab332009-09-01 20:32:49 -0700928
929 public final void scheduleSuicide() throws RemoteException {
930 Parcel data = Parcel.obtain();
931 data.writeInterfaceToken(IApplicationThread.descriptor);
932 mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
933 IBinder.FLAG_ONEWAY);
934 data.recycle();
935 }
936
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800937 public final void requestThumbnail(IBinder token)
938 throws RemoteException {
939 Parcel data = Parcel.obtain();
940 data.writeInterfaceToken(IApplicationThread.descriptor);
941 data.writeStrongBinder(token);
942 mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null,
943 IBinder.FLAG_ONEWAY);
944 data.recycle();
945 }
946
947 public final void scheduleConfigurationChanged(Configuration config)
948 throws RemoteException {
949 Parcel data = Parcel.obtain();
950 data.writeInterfaceToken(IApplicationThread.descriptor);
951 config.writeToParcel(data, 0);
952 mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
953 IBinder.FLAG_ONEWAY);
954 data.recycle();
955 }
956
957 public void updateTimeZone() throws RemoteException {
958 Parcel data = Parcel.obtain();
959 data.writeInterfaceToken(IApplicationThread.descriptor);
960 mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
961 IBinder.FLAG_ONEWAY);
962 data.recycle();
963 }
964
Robert Greenwalt03595d02010-11-02 14:08:23 -0700965 public void clearDnsCache() throws RemoteException {
966 Parcel data = Parcel.obtain();
967 data.writeInterfaceToken(IApplicationThread.descriptor);
968 mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
969 IBinder.FLAG_ONEWAY);
970 data.recycle();
971 }
972
Robert Greenwalt434203a2010-10-11 16:00:27 -0700973 public void setHttpProxy(String proxy, String port, String exclList) throws RemoteException {
974 Parcel data = Parcel.obtain();
975 data.writeInterfaceToken(IApplicationThread.descriptor);
976 data.writeString(proxy);
977 data.writeString(port);
978 data.writeString(exclList);
979 mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
980 data.recycle();
981 }
982
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800983 public void processInBackground() throws RemoteException {
984 Parcel data = Parcel.obtain();
985 data.writeInterfaceToken(IApplicationThread.descriptor);
986 mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
987 IBinder.FLAG_ONEWAY);
988 data.recycle();
989 }
990
991 public void dumpService(FileDescriptor fd, IBinder token, String[] args)
992 throws RemoteException {
993 Parcel data = Parcel.obtain();
994 data.writeInterfaceToken(IApplicationThread.descriptor);
995 data.writeFileDescriptor(fd);
996 data.writeStrongBinder(token);
997 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -0700998 mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 data.recycle();
1000 }
1001
Marco Nelissen18cb2872011-11-15 11:19:53 -08001002 public void dumpProvider(FileDescriptor fd, IBinder token, String[] args)
1003 throws RemoteException {
1004 Parcel data = Parcel.obtain();
1005 data.writeInterfaceToken(IApplicationThread.descriptor);
1006 data.writeFileDescriptor(fd);
1007 data.writeStrongBinder(token);
1008 data.writeStringArray(args);
1009 mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1010 data.recycle();
1011 }
1012
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001013 public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
Dianne Hackborn20e80982012-08-31 19:00:44 -07001014 int resultCode, String dataStr, Bundle extras, boolean ordered,
1015 boolean sticky, int sendingUser) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001016 Parcel data = Parcel.obtain();
1017 data.writeInterfaceToken(IApplicationThread.descriptor);
1018 data.writeStrongBinder(receiver.asBinder());
1019 intent.writeToParcel(data, 0);
1020 data.writeInt(resultCode);
1021 data.writeString(dataStr);
1022 data.writeBundle(extras);
1023 data.writeInt(ordered ? 1 : 0);
Dianne Hackborn68d881c2009-10-05 13:58:17 -07001024 data.writeInt(sticky ? 1 : 0);
Dianne Hackborn20e80982012-08-31 19:00:44 -07001025 data.writeInt(sendingUser);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001026 mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
1027 IBinder.FLAG_ONEWAY);
1028 data.recycle();
1029 }
1030
1031 public final void scheduleLowMemory() throws RemoteException {
1032 Parcel data = Parcel.obtain();
1033 data.writeInterfaceToken(IApplicationThread.descriptor);
1034 mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
1035 IBinder.FLAG_ONEWAY);
1036 data.recycle();
1037 }
1038
1039 public final void scheduleActivityConfigurationChanged(
1040 IBinder token) throws RemoteException {
1041 Parcel data = Parcel.obtain();
1042 data.writeInterfaceToken(IApplicationThread.descriptor);
1043 data.writeStrongBinder(token);
1044 mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1045 IBinder.FLAG_ONEWAY);
1046 data.recycle();
1047 }
1048
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001049 public void profilerControl(boolean start, String path,
Romain Guy7eabe552011-07-21 14:56:34 -07001050 ParcelFileDescriptor fd, int profileType) throws RemoteException {
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001051 Parcel data = Parcel.obtain();
1052 data.writeInterfaceToken(IApplicationThread.descriptor);
1053 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001054 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001055 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001056 if (fd != null) {
1057 data.writeInt(1);
1058 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1059 } else {
1060 data.writeInt(0);
1061 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001062 mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
1063 IBinder.FLAG_ONEWAY);
1064 data.recycle();
1065 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -07001066
1067 public void setSchedulingGroup(int group) throws RemoteException {
1068 Parcel data = Parcel.obtain();
1069 data.writeInterfaceToken(IApplicationThread.descriptor);
1070 data.writeInt(group);
1071 mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
1072 IBinder.FLAG_ONEWAY);
1073 data.recycle();
1074 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001075
1076 public void getMemoryInfo(Debug.MemoryInfo outInfo) throws RemoteException {
1077 Parcel data = Parcel.obtain();
1078 Parcel reply = Parcel.obtain();
1079 data.writeInterfaceToken(IApplicationThread.descriptor);
1080 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
1081 reply.readException();
1082 outInfo.readFromParcel(reply);
1083 data.recycle();
1084 reply.recycle();
1085 }
Dianne Hackborn4416c3d2010-05-04 17:22:49 -07001086
1087 public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
1088 Parcel data = Parcel.obtain();
1089 data.writeInterfaceToken(IApplicationThread.descriptor);
1090 data.writeInt(cmd);
1091 data.writeStringArray(packages);
1092 mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
1093 IBinder.FLAG_ONEWAY);
1094 data.recycle();
1095
1096 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001097
1098 public void scheduleCrash(String msg) throws RemoteException {
1099 Parcel data = Parcel.obtain();
1100 data.writeInterfaceToken(IApplicationThread.descriptor);
1101 data.writeString(msg);
1102 mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
1103 IBinder.FLAG_ONEWAY);
1104 data.recycle();
1105
1106 }
Andy McFadden824c5102010-07-09 16:26:57 -07001107
1108 public void dumpHeap(boolean managed, String path,
1109 ParcelFileDescriptor fd) throws RemoteException {
1110 Parcel data = Parcel.obtain();
1111 data.writeInterfaceToken(IApplicationThread.descriptor);
1112 data.writeInt(managed ? 1 : 0);
1113 data.writeString(path);
1114 if (fd != null) {
1115 data.writeInt(1);
1116 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1117 } else {
1118 data.writeInt(0);
1119 }
1120 mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
1121 IBinder.FLAG_ONEWAY);
1122 data.recycle();
1123 }
Dianne Hackborn625ac272010-09-17 18:29:22 -07001124
Dianne Hackborn30d71892010-12-11 10:37:55 -08001125 public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
Dianne Hackborn625ac272010-09-17 18:29:22 -07001126 throws RemoteException {
1127 Parcel data = Parcel.obtain();
1128 data.writeInterfaceToken(IApplicationThread.descriptor);
1129 data.writeFileDescriptor(fd);
1130 data.writeStrongBinder(token);
Dianne Hackborn30d71892010-12-11 10:37:55 -08001131 data.writeString(prefix);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001132 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -07001133 mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001134 data.recycle();
1135 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001136
1137 public void setCoreSettings(Bundle coreSettings) throws RemoteException {
1138 Parcel data = Parcel.obtain();
1139 data.writeInterfaceToken(IApplicationThread.descriptor);
1140 data.writeBundle(coreSettings);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001141 mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1142 }
1143
1144 public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
1145 throws RemoteException {
1146 Parcel data = Parcel.obtain();
1147 data.writeInterfaceToken(IApplicationThread.descriptor);
1148 data.writeString(pkg);
1149 info.writeToParcel(data, 0);
1150 mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null,
1151 IBinder.FLAG_ONEWAY);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001152 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -07001153
1154 public void scheduleTrimMemory(int level) throws RemoteException {
1155 Parcel data = Parcel.obtain();
1156 data.writeInterfaceToken(IApplicationThread.descriptor);
1157 data.writeInt(level);
1158 mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
1159 IBinder.FLAG_ONEWAY);
1160 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001161
Dianne Hackbornb437e092011-08-05 17:50:29 -07001162 public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, boolean checkin, boolean all,
1163 String[] args) throws RemoteException {
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001164 Parcel data = Parcel.obtain();
1165 Parcel reply = Parcel.obtain();
1166 data.writeInterfaceToken(IApplicationThread.descriptor);
1167 data.writeFileDescriptor(fd);
Dianne Hackbornb437e092011-08-05 17:50:29 -07001168 data.writeInt(checkin ? 1 : 0);
1169 data.writeInt(all ? 1 : 0);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001170 data.writeStringArray(args);
1171 mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
1172 reply.readException();
1173 Debug.MemoryInfo info = new Debug.MemoryInfo();
1174 info.readFromParcel(reply);
1175 data.recycle();
1176 reply.recycle();
1177 return info;
1178 }
1179
1180 public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException {
1181 Parcel data = Parcel.obtain();
1182 data.writeInterfaceToken(IApplicationThread.descriptor);
1183 data.writeFileDescriptor(fd);
1184 data.writeStringArray(args);
1185 mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1186 data.recycle();
1187 }
Jeff Brown6754ba22011-12-14 20:20:01 -08001188
1189 public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException {
1190 Parcel data = Parcel.obtain();
1191 data.writeInterfaceToken(IApplicationThread.descriptor);
1192 data.writeFileDescriptor(fd);
1193 data.writeStringArray(args);
1194 mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1195 data.recycle();
1196 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001197
1198 public void unstableProviderDied(IBinder provider) throws RemoteException {
1199 Parcel data = Parcel.obtain();
1200 data.writeInterfaceToken(IApplicationThread.descriptor);
1201 data.writeStrongBinder(provider);
1202 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1203 data.recycle();
1204 }
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001205
1206 public void requestActivityExtras(IBinder activityToken, IBinder requestToken, int requestType)
1207 throws RemoteException {
1208 Parcel data = Parcel.obtain();
1209 data.writeInterfaceToken(IApplicationThread.descriptor);
1210 data.writeStrongBinder(activityToken);
1211 data.writeStrongBinder(requestToken);
1212 data.writeInt(requestType);
1213 mRemote.transact(REQUEST_ACTIVITY_EXTRAS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1214 data.recycle();
1215 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216}