blob: e75d7b4ce46d649c75d53c029794d3f5efc153e7 [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 Hackborne2515ee2011-04-27 18:52:56 -0400196 scheduleReceiver(intent, info, compatInfo, resultCode, resultData,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800197 resultExtras, sync);
198 return true;
199 }
200
201 case SCHEDULE_CREATE_SERVICE_TRANSACTION: {
202 data.enforceInterface(IApplicationThread.descriptor);
203 IBinder token = data.readStrongBinder();
204 ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400205 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
206 scheduleCreateService(token, info, compatInfo);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800207 return true;
208 }
209
210 case SCHEDULE_BIND_SERVICE_TRANSACTION: {
211 data.enforceInterface(IApplicationThread.descriptor);
212 IBinder token = data.readStrongBinder();
213 Intent intent = Intent.CREATOR.createFromParcel(data);
214 boolean rebind = data.readInt() != 0;
215 scheduleBindService(token, intent, rebind);
216 return true;
217 }
218
219 case SCHEDULE_UNBIND_SERVICE_TRANSACTION: {
220 data.enforceInterface(IApplicationThread.descriptor);
221 IBinder token = data.readStrongBinder();
222 Intent intent = Intent.CREATOR.createFromParcel(data);
223 scheduleUnbindService(token, intent);
224 return true;
225 }
226
227 case SCHEDULE_SERVICE_ARGS_TRANSACTION:
228 {
229 data.enforceInterface(IApplicationThread.descriptor);
230 IBinder token = data.readStrongBinder();
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700231 boolean taskRemoved = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800232 int startId = data.readInt();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700233 int fl = data.readInt();
234 Intent args;
235 if (data.readInt() != 0) {
236 args = Intent.CREATOR.createFromParcel(data);
237 } else {
238 args = null;
239 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700240 scheduleServiceArgs(token, taskRemoved, startId, fl, args);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800241 return true;
242 }
243
244 case SCHEDULE_STOP_SERVICE_TRANSACTION:
245 {
246 data.enforceInterface(IApplicationThread.descriptor);
247 IBinder token = data.readStrongBinder();
248 scheduleStopService(token);
249 return true;
250 }
251
252 case BIND_APPLICATION_TRANSACTION:
253 {
254 data.enforceInterface(IApplicationThread.descriptor);
255 String packageName = data.readString();
256 ApplicationInfo info =
257 ApplicationInfo.CREATOR.createFromParcel(data);
258 List<ProviderInfo> providers =
259 data.createTypedArrayList(ProviderInfo.CREATOR);
260 ComponentName testName = (data.readInt() != 0)
261 ? new ComponentName(data) : null;
262 String profileName = data.readString();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700263 ParcelFileDescriptor profileFd = data.readInt() != 0
264 ? data.readFileDescriptor() : null;
265 boolean autoStopProfiler = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800266 Bundle testArgs = data.readBundle();
267 IBinder binder = data.readStrongBinder();
268 IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
269 int testMode = data.readInt();
Christopher Tate181fafa2009-05-14 11:12:14 -0700270 boolean restrictedBackupMode = (data.readInt() != 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700271 boolean persistent = (data.readInt() != 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800272 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400273 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800274 HashMap<String, IBinder> services = data.readHashMap(null);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800275 Bundle coreSettings = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800276 bindApplication(packageName, info,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700277 providers, testName, profileName, profileFd, autoStopProfiler,
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700278 testArgs, testWatcher, testMode, restrictedBackupMode, persistent,
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400279 config, compatInfo, services, coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800280 return true;
281 }
282
283 case SCHEDULE_EXIT_TRANSACTION:
284 {
285 data.enforceInterface(IApplicationThread.descriptor);
286 scheduleExit();
287 return true;
288 }
289
Christopher Tate5e1ab332009-09-01 20:32:49 -0700290 case SCHEDULE_SUICIDE_TRANSACTION:
291 {
292 data.enforceInterface(IApplicationThread.descriptor);
293 scheduleSuicide();
294 return true;
295 }
296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 case REQUEST_THUMBNAIL_TRANSACTION:
298 {
299 data.enforceInterface(IApplicationThread.descriptor);
300 IBinder b = data.readStrongBinder();
301 requestThumbnail(b);
302 return true;
303 }
Robert Greenwalt434203a2010-10-11 16:00:27 -0700304
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800305 case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
306 {
307 data.enforceInterface(IApplicationThread.descriptor);
308 Configuration config = Configuration.CREATOR.createFromParcel(data);
309 scheduleConfigurationChanged(config);
310 return true;
311 }
312
313 case UPDATE_TIME_ZONE_TRANSACTION: {
314 data.enforceInterface(IApplicationThread.descriptor);
315 updateTimeZone();
316 return true;
317 }
318
Robert Greenwalt03595d02010-11-02 14:08:23 -0700319 case CLEAR_DNS_CACHE_TRANSACTION: {
320 data.enforceInterface(IApplicationThread.descriptor);
321 clearDnsCache();
322 return true;
323 }
324
Robert Greenwalt434203a2010-10-11 16:00:27 -0700325 case SET_HTTP_PROXY_TRANSACTION: {
326 data.enforceInterface(IApplicationThread.descriptor);
327 final String proxy = data.readString();
328 final String port = data.readString();
329 final String exclList = data.readString();
330 setHttpProxy(proxy, port, exclList);
331 return true;
332 }
333
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800334 case PROCESS_IN_BACKGROUND_TRANSACTION: {
335 data.enforceInterface(IApplicationThread.descriptor);
336 processInBackground();
337 return true;
338 }
Robert Greenwalt434203a2010-10-11 16:00:27 -0700339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 case DUMP_SERVICE_TRANSACTION: {
341 data.enforceInterface(IApplicationThread.descriptor);
342 ParcelFileDescriptor fd = data.readFileDescriptor();
343 final IBinder service = data.readStrongBinder();
344 final String[] args = data.readStringArray();
345 if (fd != null) {
346 dumpService(fd.getFileDescriptor(), service, args);
347 try {
348 fd.close();
349 } catch (IOException e) {
350 }
351 }
352 return true;
353 }
354
Marco Nelissen18cb2872011-11-15 11:19:53 -0800355 case DUMP_PROVIDER_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 dumpProvider(fd.getFileDescriptor(), service, args);
362 try {
363 fd.close();
364 } catch (IOException e) {
365 }
366 }
367 return true;
368 }
369
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
371 data.enforceInterface(IApplicationThread.descriptor);
372 IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
373 data.readStrongBinder());
374 Intent intent = Intent.CREATOR.createFromParcel(data);
375 int resultCode = data.readInt();
376 String dataStr = data.readString();
377 Bundle extras = data.readBundle();
378 boolean ordered = data.readInt() != 0;
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700379 boolean sticky = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 scheduleRegisteredReceiver(receiver, intent,
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700381 resultCode, dataStr, extras, ordered, sticky);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 return true;
383 }
384
385 case SCHEDULE_LOW_MEMORY_TRANSACTION:
386 {
387 scheduleLowMemory();
388 return true;
389 }
390
391 case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
392 {
393 data.enforceInterface(IApplicationThread.descriptor);
394 IBinder b = data.readStrongBinder();
395 scheduleActivityConfigurationChanged(b);
396 return true;
397 }
398
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800399 case PROFILER_CONTROL_TRANSACTION:
400 {
401 data.enforceInterface(IApplicationThread.descriptor);
402 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -0700403 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800404 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -0700405 ParcelFileDescriptor fd = data.readInt() != 0
406 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -0700407 profilerControl(start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800408 return true;
409 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -0700410
411 case SET_SCHEDULING_GROUP_TRANSACTION:
412 {
413 data.enforceInterface(IApplicationThread.descriptor);
414 int group = data.readInt();
415 setSchedulingGroup(group);
416 return true;
417 }
Christopher Tate181fafa2009-05-14 11:12:14 -0700418
419 case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
420 {
421 data.enforceInterface(IApplicationThread.descriptor);
422 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400423 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Christopher Tate181fafa2009-05-14 11:12:14 -0700424 int backupMode = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400425 scheduleCreateBackupAgent(appInfo, compatInfo, backupMode);
Christopher Tate181fafa2009-05-14 11:12:14 -0700426 return true;
427 }
Christopher Tate1885b372009-06-04 15:00:33 -0700428
429 case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
430 {
431 data.enforceInterface(IApplicationThread.descriptor);
432 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400433 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
434 scheduleDestroyBackupAgent(appInfo, compatInfo);
Christopher Tate1885b372009-06-04 15:00:33 -0700435 return true;
436 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -0700437
438 case GET_MEMORY_INFO_TRANSACTION:
439 {
440 data.enforceInterface(IApplicationThread.descriptor);
441 Debug.MemoryInfo mi = new Debug.MemoryInfo();
442 getMemoryInfo(mi);
443 reply.writeNoException();
444 mi.writeToParcel(reply, 0);
445 return true;
446 }
Dianne Hackborn4416c3d2010-05-04 17:22:49 -0700447
448 case DISPATCH_PACKAGE_BROADCAST_TRANSACTION:
449 {
450 data.enforceInterface(IApplicationThread.descriptor);
451 int cmd = data.readInt();
452 String[] packages = data.readStringArray();
453 dispatchPackageBroadcast(cmd, packages);
454 return true;
455 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -0700456
457 case SCHEDULE_CRASH_TRANSACTION:
458 {
459 data.enforceInterface(IApplicationThread.descriptor);
460 String msg = data.readString();
461 scheduleCrash(msg);
462 return true;
463 }
Andy McFadden824c5102010-07-09 16:26:57 -0700464
465 case DUMP_HEAP_TRANSACTION:
466 {
467 data.enforceInterface(IApplicationThread.descriptor);
468 boolean managed = data.readInt() != 0;
469 String path = data.readString();
470 ParcelFileDescriptor fd = data.readInt() != 0
471 ? data.readFileDescriptor() : null;
472 dumpHeap(managed, path, fd);
473 return true;
474 }
Dianne Hackborn625ac272010-09-17 18:29:22 -0700475
476 case DUMP_ACTIVITY_TRANSACTION: {
477 data.enforceInterface(IApplicationThread.descriptor);
478 ParcelFileDescriptor fd = data.readFileDescriptor();
479 final IBinder activity = data.readStrongBinder();
Dianne Hackborn30d71892010-12-11 10:37:55 -0800480 final String prefix = data.readString();
Dianne Hackborn625ac272010-09-17 18:29:22 -0700481 final String[] args = data.readStringArray();
482 if (fd != null) {
Dianne Hackborn30d71892010-12-11 10:37:55 -0800483 dumpActivity(fd.getFileDescriptor(), activity, prefix, args);
Dianne Hackborn625ac272010-09-17 18:29:22 -0700484 try {
485 fd.close();
486 } catch (IOException e) {
487 }
488 }
489 return true;
490 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800491
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400492 case SET_CORE_SETTINGS_TRANSACTION: {
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800493 data.enforceInterface(IApplicationThread.descriptor);
494 Bundle settings = data.readBundle();
495 setCoreSettings(settings);
496 return true;
497 }
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400498
499 case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: {
500 data.enforceInterface(IApplicationThread.descriptor);
501 String pkg = data.readString();
502 CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data);
503 updatePackageCompatibilityInfo(pkg, compat);
504 return true;
505 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -0700506
507 case SCHEDULE_TRIM_MEMORY_TRANSACTION: {
508 data.enforceInterface(IApplicationThread.descriptor);
509 int level = data.readInt();
510 scheduleTrimMemory(level);
511 return true;
512 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700513
514 case DUMP_MEM_INFO_TRANSACTION:
515 {
516 data.enforceInterface(IApplicationThread.descriptor);
517 ParcelFileDescriptor fd = data.readFileDescriptor();
Dianne Hackbornb437e092011-08-05 17:50:29 -0700518 boolean checkin = data.readInt() != 0;
519 boolean all = data.readInt() != 0;
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700520 String[] args = data.readStringArray();
521 Debug.MemoryInfo mi = null;
522 if (fd != null) {
523 try {
Dianne Hackbornb437e092011-08-05 17:50:29 -0700524 mi = dumpMemInfo(fd.getFileDescriptor(), checkin, all, args);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700525 } finally {
526 try {
527 fd.close();
528 } catch (IOException e) {
529 // swallowed, not propagated back to the caller
530 }
531 }
532 }
533 reply.writeNoException();
534 mi.writeToParcel(reply, 0);
535 return true;
536 }
537
538 case DUMP_GFX_INFO_TRANSACTION:
539 {
540 data.enforceInterface(IApplicationThread.descriptor);
541 ParcelFileDescriptor fd = data.readFileDescriptor();
542 String[] args = data.readStringArray();
543 if (fd != null) {
544 try {
545 dumpGfxInfo(fd.getFileDescriptor(), args);
546 } finally {
547 try {
548 fd.close();
549 } catch (IOException e) {
550 // swallowed, not propagated back to the caller
551 }
552 }
553 }
554 reply.writeNoException();
555 return true;
556 }
Jeff Brown6754ba22011-12-14 20:20:01 -0800557
558 case DUMP_DB_INFO_TRANSACTION:
559 {
560 data.enforceInterface(IApplicationThread.descriptor);
561 ParcelFileDescriptor fd = data.readFileDescriptor();
562 String[] args = data.readStringArray();
563 if (fd != null) {
564 try {
565 dumpDbInfo(fd.getFileDescriptor(), args);
566 } finally {
567 try {
568 fd.close();
569 } catch (IOException e) {
570 // swallowed, not propagated back to the caller
571 }
572 }
573 }
574 reply.writeNoException();
575 return true;
576 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800577 }
578
579 return super.onTransact(code, data, reply, flags);
580 }
581
582 public IBinder asBinder()
583 {
584 return this;
585 }
586}
587
588class ApplicationThreadProxy implements IApplicationThread {
589 private final IBinder mRemote;
590
591 public ApplicationThreadProxy(IBinder remote) {
592 mRemote = remote;
593 }
594
595 public final IBinder asBinder() {
596 return mRemote;
597 }
598
599 public final void schedulePauseActivity(IBinder token, boolean finished,
600 boolean userLeaving, int configChanges) throws RemoteException {
601 Parcel data = Parcel.obtain();
602 data.writeInterfaceToken(IApplicationThread.descriptor);
603 data.writeStrongBinder(token);
604 data.writeInt(finished ? 1 : 0);
605 data.writeInt(userLeaving ? 1 :0);
606 data.writeInt(configChanges);
607 mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
608 IBinder.FLAG_ONEWAY);
609 data.recycle();
610 }
611
612 public final void scheduleStopActivity(IBinder token, boolean showWindow,
613 int configChanges) throws RemoteException {
614 Parcel data = Parcel.obtain();
615 data.writeInterfaceToken(IApplicationThread.descriptor);
616 data.writeStrongBinder(token);
617 data.writeInt(showWindow ? 1 : 0);
618 data.writeInt(configChanges);
619 mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
620 IBinder.FLAG_ONEWAY);
621 data.recycle();
622 }
623
624 public final void scheduleWindowVisibility(IBinder token,
625 boolean showWindow) throws RemoteException {
626 Parcel data = Parcel.obtain();
627 data.writeInterfaceToken(IApplicationThread.descriptor);
628 data.writeStrongBinder(token);
629 data.writeInt(showWindow ? 1 : 0);
630 mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
631 IBinder.FLAG_ONEWAY);
632 data.recycle();
633 }
634
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800635 public final void scheduleSleeping(IBinder token,
636 boolean sleeping) throws RemoteException {
637 Parcel data = Parcel.obtain();
638 data.writeInterfaceToken(IApplicationThread.descriptor);
639 data.writeStrongBinder(token);
640 data.writeInt(sleeping ? 1 : 0);
641 mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
642 IBinder.FLAG_ONEWAY);
643 data.recycle();
644 }
645
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 public final void scheduleResumeActivity(IBinder token, boolean isForward)
647 throws RemoteException {
648 Parcel data = Parcel.obtain();
649 data.writeInterfaceToken(IApplicationThread.descriptor);
650 data.writeStrongBinder(token);
651 data.writeInt(isForward ? 1 : 0);
652 mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
653 IBinder.FLAG_ONEWAY);
654 data.recycle();
655 }
656
657 public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
658 throws RemoteException {
659 Parcel data = Parcel.obtain();
660 data.writeInterfaceToken(IApplicationThread.descriptor);
661 data.writeStrongBinder(token);
662 data.writeTypedList(results);
663 mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
664 IBinder.FLAG_ONEWAY);
665 data.recycle();
666 }
667
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700668 public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700669 ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo,
670 Bundle state, List<ResultInfo> pendingResults,
671 List<Intent> pendingNewIntents, boolean notResumed, boolean isForward,
672 String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 throws RemoteException {
674 Parcel data = Parcel.obtain();
675 data.writeInterfaceToken(IApplicationThread.descriptor);
676 intent.writeToParcel(data, 0);
677 data.writeStrongBinder(token);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700678 data.writeInt(ident);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800679 info.writeToParcel(data, 0);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700680 curConfig.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400681 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 data.writeBundle(state);
683 data.writeTypedList(pendingResults);
684 data.writeTypedList(pendingNewIntents);
685 data.writeInt(notResumed ? 1 : 0);
686 data.writeInt(isForward ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700687 data.writeString(profileName);
688 if (profileFd != null) {
689 data.writeInt(1);
690 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
691 } else {
692 data.writeInt(0);
693 }
694 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800695 mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
696 IBinder.FLAG_ONEWAY);
697 data.recycle();
698 }
699
700 public final void scheduleRelaunchActivity(IBinder token,
701 List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800702 int configChanges, boolean notResumed, Configuration config)
703 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 Parcel data = Parcel.obtain();
705 data.writeInterfaceToken(IApplicationThread.descriptor);
706 data.writeStrongBinder(token);
707 data.writeTypedList(pendingResults);
708 data.writeTypedList(pendingNewIntents);
709 data.writeInt(configChanges);
710 data.writeInt(notResumed ? 1 : 0);
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800711 if (config != null) {
712 data.writeInt(1);
713 config.writeToParcel(data, 0);
714 } else {
715 data.writeInt(0);
716 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
718 IBinder.FLAG_ONEWAY);
719 data.recycle();
720 }
721
722 public void scheduleNewIntent(List<Intent> intents, IBinder token)
723 throws RemoteException {
724 Parcel data = Parcel.obtain();
725 data.writeInterfaceToken(IApplicationThread.descriptor);
726 data.writeTypedList(intents);
727 data.writeStrongBinder(token);
728 mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
729 IBinder.FLAG_ONEWAY);
730 data.recycle();
731 }
732
733 public final void scheduleDestroyActivity(IBinder token, boolean finishing,
734 int configChanges) throws RemoteException {
735 Parcel data = Parcel.obtain();
736 data.writeInterfaceToken(IApplicationThread.descriptor);
737 data.writeStrongBinder(token);
738 data.writeInt(finishing ? 1 : 0);
739 data.writeInt(configChanges);
740 mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
741 IBinder.FLAG_ONEWAY);
742 data.recycle();
743 }
744
745 public final void scheduleReceiver(Intent intent, ActivityInfo info,
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400746 CompatibilityInfo compatInfo, int resultCode, String resultData,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800747 Bundle map, boolean sync) throws RemoteException {
748 Parcel data = Parcel.obtain();
749 data.writeInterfaceToken(IApplicationThread.descriptor);
750 intent.writeToParcel(data, 0);
751 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400752 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800753 data.writeInt(resultCode);
754 data.writeString(resultData);
755 data.writeBundle(map);
756 data.writeInt(sync ? 1 : 0);
757 mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
758 IBinder.FLAG_ONEWAY);
759 data.recycle();
760 }
761
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400762 public final void scheduleCreateBackupAgent(ApplicationInfo app,
763 CompatibilityInfo compatInfo, int backupMode) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700764 Parcel data = Parcel.obtain();
765 data.writeInterfaceToken(IApplicationThread.descriptor);
766 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400767 compatInfo.writeToParcel(data, 0);
Christopher Tate181fafa2009-05-14 11:12:14 -0700768 data.writeInt(backupMode);
Christopher Tated884f432009-07-23 14:40:13 -0700769 mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
770 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700771 data.recycle();
772 }
773
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400774 public final void scheduleDestroyBackupAgent(ApplicationInfo app,
775 CompatibilityInfo compatInfo) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700776 Parcel data = Parcel.obtain();
777 data.writeInterfaceToken(IApplicationThread.descriptor);
778 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400779 compatInfo.writeToParcel(data, 0);
Christopher Tated884f432009-07-23 14:40:13 -0700780 mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
781 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700782 data.recycle();
783 }
784
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400785 public final void scheduleCreateService(IBinder token, ServiceInfo info,
786 CompatibilityInfo compatInfo) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 Parcel data = Parcel.obtain();
788 data.writeInterfaceToken(IApplicationThread.descriptor);
789 data.writeStrongBinder(token);
790 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400791 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800792 mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
793 IBinder.FLAG_ONEWAY);
794 data.recycle();
795 }
796
797 public final void scheduleBindService(IBinder token, Intent intent, boolean rebind)
798 throws RemoteException {
799 Parcel data = Parcel.obtain();
800 data.writeInterfaceToken(IApplicationThread.descriptor);
801 data.writeStrongBinder(token);
802 intent.writeToParcel(data, 0);
803 data.writeInt(rebind ? 1 : 0);
804 mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
805 IBinder.FLAG_ONEWAY);
806 data.recycle();
807 }
808
809 public final void scheduleUnbindService(IBinder token, Intent intent)
810 throws RemoteException {
811 Parcel data = Parcel.obtain();
812 data.writeInterfaceToken(IApplicationThread.descriptor);
813 data.writeStrongBinder(token);
814 intent.writeToParcel(data, 0);
815 mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
816 IBinder.FLAG_ONEWAY);
817 data.recycle();
818 }
819
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700820 public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700821 int flags, Intent args) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800822 Parcel data = Parcel.obtain();
823 data.writeInterfaceToken(IApplicationThread.descriptor);
824 data.writeStrongBinder(token);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700825 data.writeInt(taskRemoved ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800826 data.writeInt(startId);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700827 data.writeInt(flags);
828 if (args != null) {
829 data.writeInt(1);
830 args.writeToParcel(data, 0);
831 } else {
832 data.writeInt(0);
833 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800834 mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
835 IBinder.FLAG_ONEWAY);
836 data.recycle();
837 }
838
839 public final void scheduleStopService(IBinder token)
840 throws RemoteException {
841 Parcel data = Parcel.obtain();
842 data.writeInterfaceToken(IApplicationThread.descriptor);
843 data.writeStrongBinder(token);
844 mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
845 IBinder.FLAG_ONEWAY);
846 data.recycle();
847 }
848
849 public final void bindApplication(String packageName, ApplicationInfo info,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700850 List<ProviderInfo> providers, ComponentName testName, String profileName,
851 ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs,
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700852 IInstrumentationWatcher testWatcher, int debugMode, boolean restrictedBackupMode,
853 boolean persistent, Configuration config, CompatibilityInfo compatInfo,
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800854 Map<String, IBinder> services, Bundle coreSettings) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800855 Parcel data = Parcel.obtain();
856 data.writeInterfaceToken(IApplicationThread.descriptor);
857 data.writeString(packageName);
858 info.writeToParcel(data, 0);
859 data.writeTypedList(providers);
860 if (testName == null) {
861 data.writeInt(0);
862 } else {
863 data.writeInt(1);
864 testName.writeToParcel(data, 0);
865 }
866 data.writeString(profileName);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700867 if (profileFd != null) {
868 data.writeInt(1);
869 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
870 } else {
871 data.writeInt(0);
872 }
873 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800874 data.writeBundle(testArgs);
875 data.writeStrongInterface(testWatcher);
876 data.writeInt(debugMode);
Christopher Tate181fafa2009-05-14 11:12:14 -0700877 data.writeInt(restrictedBackupMode ? 1 : 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700878 data.writeInt(persistent ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800879 config.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400880 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800881 data.writeMap(services);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800882 data.writeBundle(coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800883 mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
884 IBinder.FLAG_ONEWAY);
885 data.recycle();
886 }
887
888 public final void scheduleExit() throws RemoteException {
889 Parcel data = Parcel.obtain();
890 data.writeInterfaceToken(IApplicationThread.descriptor);
891 mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
892 IBinder.FLAG_ONEWAY);
893 data.recycle();
894 }
Christopher Tate5e1ab332009-09-01 20:32:49 -0700895
896 public final void scheduleSuicide() throws RemoteException {
897 Parcel data = Parcel.obtain();
898 data.writeInterfaceToken(IApplicationThread.descriptor);
899 mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
900 IBinder.FLAG_ONEWAY);
901 data.recycle();
902 }
903
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800904 public final void requestThumbnail(IBinder token)
905 throws RemoteException {
906 Parcel data = Parcel.obtain();
907 data.writeInterfaceToken(IApplicationThread.descriptor);
908 data.writeStrongBinder(token);
909 mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null,
910 IBinder.FLAG_ONEWAY);
911 data.recycle();
912 }
913
914 public final void scheduleConfigurationChanged(Configuration config)
915 throws RemoteException {
916 Parcel data = Parcel.obtain();
917 data.writeInterfaceToken(IApplicationThread.descriptor);
918 config.writeToParcel(data, 0);
919 mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
920 IBinder.FLAG_ONEWAY);
921 data.recycle();
922 }
923
924 public void updateTimeZone() throws RemoteException {
925 Parcel data = Parcel.obtain();
926 data.writeInterfaceToken(IApplicationThread.descriptor);
927 mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
928 IBinder.FLAG_ONEWAY);
929 data.recycle();
930 }
931
Robert Greenwalt03595d02010-11-02 14:08:23 -0700932 public void clearDnsCache() throws RemoteException {
933 Parcel data = Parcel.obtain();
934 data.writeInterfaceToken(IApplicationThread.descriptor);
935 mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
936 IBinder.FLAG_ONEWAY);
937 data.recycle();
938 }
939
Robert Greenwalt434203a2010-10-11 16:00:27 -0700940 public void setHttpProxy(String proxy, String port, String exclList) throws RemoteException {
941 Parcel data = Parcel.obtain();
942 data.writeInterfaceToken(IApplicationThread.descriptor);
943 data.writeString(proxy);
944 data.writeString(port);
945 data.writeString(exclList);
946 mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
947 data.recycle();
948 }
949
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 public void processInBackground() throws RemoteException {
951 Parcel data = Parcel.obtain();
952 data.writeInterfaceToken(IApplicationThread.descriptor);
953 mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
954 IBinder.FLAG_ONEWAY);
955 data.recycle();
956 }
957
958 public void dumpService(FileDescriptor fd, IBinder token, String[] args)
959 throws RemoteException {
960 Parcel data = Parcel.obtain();
961 data.writeInterfaceToken(IApplicationThread.descriptor);
962 data.writeFileDescriptor(fd);
963 data.writeStrongBinder(token);
964 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -0700965 mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800966 data.recycle();
967 }
968
Marco Nelissen18cb2872011-11-15 11:19:53 -0800969 public void dumpProvider(FileDescriptor fd, IBinder token, String[] args)
970 throws RemoteException {
971 Parcel data = Parcel.obtain();
972 data.writeInterfaceToken(IApplicationThread.descriptor);
973 data.writeFileDescriptor(fd);
974 data.writeStrongBinder(token);
975 data.writeStringArray(args);
976 mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
977 data.recycle();
978 }
979
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800980 public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700981 int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800982 throws RemoteException {
983 Parcel data = Parcel.obtain();
984 data.writeInterfaceToken(IApplicationThread.descriptor);
985 data.writeStrongBinder(receiver.asBinder());
986 intent.writeToParcel(data, 0);
987 data.writeInt(resultCode);
988 data.writeString(dataStr);
989 data.writeBundle(extras);
990 data.writeInt(ordered ? 1 : 0);
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700991 data.writeInt(sticky ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
993 IBinder.FLAG_ONEWAY);
994 data.recycle();
995 }
996
997 public final void scheduleLowMemory() throws RemoteException {
998 Parcel data = Parcel.obtain();
999 data.writeInterfaceToken(IApplicationThread.descriptor);
1000 mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
1001 IBinder.FLAG_ONEWAY);
1002 data.recycle();
1003 }
1004
1005 public final void scheduleActivityConfigurationChanged(
1006 IBinder token) throws RemoteException {
1007 Parcel data = Parcel.obtain();
1008 data.writeInterfaceToken(IApplicationThread.descriptor);
1009 data.writeStrongBinder(token);
1010 mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1011 IBinder.FLAG_ONEWAY);
1012 data.recycle();
1013 }
1014
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001015 public void profilerControl(boolean start, String path,
Romain Guy7eabe552011-07-21 14:56:34 -07001016 ParcelFileDescriptor fd, int profileType) throws RemoteException {
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001017 Parcel data = Parcel.obtain();
1018 data.writeInterfaceToken(IApplicationThread.descriptor);
1019 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001020 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001021 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001022 if (fd != null) {
1023 data.writeInt(1);
1024 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1025 } else {
1026 data.writeInt(0);
1027 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001028 mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
1029 IBinder.FLAG_ONEWAY);
1030 data.recycle();
1031 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -07001032
1033 public void setSchedulingGroup(int group) throws RemoteException {
1034 Parcel data = Parcel.obtain();
1035 data.writeInterfaceToken(IApplicationThread.descriptor);
1036 data.writeInt(group);
1037 mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
1038 IBinder.FLAG_ONEWAY);
1039 data.recycle();
1040 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001041
1042 public void getMemoryInfo(Debug.MemoryInfo outInfo) throws RemoteException {
1043 Parcel data = Parcel.obtain();
1044 Parcel reply = Parcel.obtain();
1045 data.writeInterfaceToken(IApplicationThread.descriptor);
1046 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
1047 reply.readException();
1048 outInfo.readFromParcel(reply);
1049 data.recycle();
1050 reply.recycle();
1051 }
Dianne Hackborn4416c3d2010-05-04 17:22:49 -07001052
1053 public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
1054 Parcel data = Parcel.obtain();
1055 data.writeInterfaceToken(IApplicationThread.descriptor);
1056 data.writeInt(cmd);
1057 data.writeStringArray(packages);
1058 mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
1059 IBinder.FLAG_ONEWAY);
1060 data.recycle();
1061
1062 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001063
1064 public void scheduleCrash(String msg) throws RemoteException {
1065 Parcel data = Parcel.obtain();
1066 data.writeInterfaceToken(IApplicationThread.descriptor);
1067 data.writeString(msg);
1068 mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
1069 IBinder.FLAG_ONEWAY);
1070 data.recycle();
1071
1072 }
Andy McFadden824c5102010-07-09 16:26:57 -07001073
1074 public void dumpHeap(boolean managed, String path,
1075 ParcelFileDescriptor fd) throws RemoteException {
1076 Parcel data = Parcel.obtain();
1077 data.writeInterfaceToken(IApplicationThread.descriptor);
1078 data.writeInt(managed ? 1 : 0);
1079 data.writeString(path);
1080 if (fd != null) {
1081 data.writeInt(1);
1082 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1083 } else {
1084 data.writeInt(0);
1085 }
1086 mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
1087 IBinder.FLAG_ONEWAY);
1088 data.recycle();
1089 }
Dianne Hackborn625ac272010-09-17 18:29:22 -07001090
Dianne Hackborn30d71892010-12-11 10:37:55 -08001091 public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
Dianne Hackborn625ac272010-09-17 18:29:22 -07001092 throws RemoteException {
1093 Parcel data = Parcel.obtain();
1094 data.writeInterfaceToken(IApplicationThread.descriptor);
1095 data.writeFileDescriptor(fd);
1096 data.writeStrongBinder(token);
Dianne Hackborn30d71892010-12-11 10:37:55 -08001097 data.writeString(prefix);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001098 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -07001099 mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001100 data.recycle();
1101 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001102
1103 public void setCoreSettings(Bundle coreSettings) throws RemoteException {
1104 Parcel data = Parcel.obtain();
1105 data.writeInterfaceToken(IApplicationThread.descriptor);
1106 data.writeBundle(coreSettings);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001107 mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1108 }
1109
1110 public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
1111 throws RemoteException {
1112 Parcel data = Parcel.obtain();
1113 data.writeInterfaceToken(IApplicationThread.descriptor);
1114 data.writeString(pkg);
1115 info.writeToParcel(data, 0);
1116 mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null,
1117 IBinder.FLAG_ONEWAY);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001118 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -07001119
1120 public void scheduleTrimMemory(int level) throws RemoteException {
1121 Parcel data = Parcel.obtain();
1122 data.writeInterfaceToken(IApplicationThread.descriptor);
1123 data.writeInt(level);
1124 mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
1125 IBinder.FLAG_ONEWAY);
1126 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001127
Dianne Hackbornb437e092011-08-05 17:50:29 -07001128 public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, boolean checkin, boolean all,
1129 String[] args) throws RemoteException {
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001130 Parcel data = Parcel.obtain();
1131 Parcel reply = Parcel.obtain();
1132 data.writeInterfaceToken(IApplicationThread.descriptor);
1133 data.writeFileDescriptor(fd);
Dianne Hackbornb437e092011-08-05 17:50:29 -07001134 data.writeInt(checkin ? 1 : 0);
1135 data.writeInt(all ? 1 : 0);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001136 data.writeStringArray(args);
1137 mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
1138 reply.readException();
1139 Debug.MemoryInfo info = new Debug.MemoryInfo();
1140 info.readFromParcel(reply);
1141 data.recycle();
1142 reply.recycle();
1143 return info;
1144 }
1145
1146 public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException {
1147 Parcel data = Parcel.obtain();
1148 data.writeInterfaceToken(IApplicationThread.descriptor);
1149 data.writeFileDescriptor(fd);
1150 data.writeStringArray(args);
1151 mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1152 data.recycle();
1153 }
Jeff Brown6754ba22011-12-14 20:20:01 -08001154
1155 public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException {
1156 Parcel data = Parcel.obtain();
1157 data.writeInterfaceToken(IApplicationThread.descriptor);
1158 data.writeFileDescriptor(fd);
1159 data.writeStringArray(args);
1160 mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1161 data.recycle();
1162 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001163}