blob: c4a4feaff611cb4cf9d675bdf8aafeb77c7e00ad [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
355 case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
356 data.enforceInterface(IApplicationThread.descriptor);
357 IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
358 data.readStrongBinder());
359 Intent intent = Intent.CREATOR.createFromParcel(data);
360 int resultCode = data.readInt();
361 String dataStr = data.readString();
362 Bundle extras = data.readBundle();
363 boolean ordered = data.readInt() != 0;
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700364 boolean sticky = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800365 scheduleRegisteredReceiver(receiver, intent,
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700366 resultCode, dataStr, extras, ordered, sticky);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800367 return true;
368 }
369
370 case SCHEDULE_LOW_MEMORY_TRANSACTION:
371 {
372 scheduleLowMemory();
373 return true;
374 }
375
376 case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
377 {
378 data.enforceInterface(IApplicationThread.descriptor);
379 IBinder b = data.readStrongBinder();
380 scheduleActivityConfigurationChanged(b);
381 return true;
382 }
383
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800384 case PROFILER_CONTROL_TRANSACTION:
385 {
386 data.enforceInterface(IApplicationThread.descriptor);
387 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -0700388 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800389 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -0700390 ParcelFileDescriptor fd = data.readInt() != 0
391 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -0700392 profilerControl(start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800393 return true;
394 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -0700395
396 case SET_SCHEDULING_GROUP_TRANSACTION:
397 {
398 data.enforceInterface(IApplicationThread.descriptor);
399 int group = data.readInt();
400 setSchedulingGroup(group);
401 return true;
402 }
Christopher Tate181fafa2009-05-14 11:12:14 -0700403
404 case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
405 {
406 data.enforceInterface(IApplicationThread.descriptor);
407 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400408 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Christopher Tate181fafa2009-05-14 11:12:14 -0700409 int backupMode = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400410 scheduleCreateBackupAgent(appInfo, compatInfo, backupMode);
Christopher Tate181fafa2009-05-14 11:12:14 -0700411 return true;
412 }
Christopher Tate1885b372009-06-04 15:00:33 -0700413
414 case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
415 {
416 data.enforceInterface(IApplicationThread.descriptor);
417 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400418 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
419 scheduleDestroyBackupAgent(appInfo, compatInfo);
Christopher Tate1885b372009-06-04 15:00:33 -0700420 return true;
421 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -0700422
423 case GET_MEMORY_INFO_TRANSACTION:
424 {
425 data.enforceInterface(IApplicationThread.descriptor);
426 Debug.MemoryInfo mi = new Debug.MemoryInfo();
427 getMemoryInfo(mi);
428 reply.writeNoException();
429 mi.writeToParcel(reply, 0);
430 return true;
431 }
Dianne Hackborn4416c3d2010-05-04 17:22:49 -0700432
433 case DISPATCH_PACKAGE_BROADCAST_TRANSACTION:
434 {
435 data.enforceInterface(IApplicationThread.descriptor);
436 int cmd = data.readInt();
437 String[] packages = data.readStringArray();
438 dispatchPackageBroadcast(cmd, packages);
439 return true;
440 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -0700441
442 case SCHEDULE_CRASH_TRANSACTION:
443 {
444 data.enforceInterface(IApplicationThread.descriptor);
445 String msg = data.readString();
446 scheduleCrash(msg);
447 return true;
448 }
Andy McFadden824c5102010-07-09 16:26:57 -0700449
450 case DUMP_HEAP_TRANSACTION:
451 {
452 data.enforceInterface(IApplicationThread.descriptor);
453 boolean managed = data.readInt() != 0;
454 String path = data.readString();
455 ParcelFileDescriptor fd = data.readInt() != 0
456 ? data.readFileDescriptor() : null;
457 dumpHeap(managed, path, fd);
458 return true;
459 }
Dianne Hackborn625ac272010-09-17 18:29:22 -0700460
461 case DUMP_ACTIVITY_TRANSACTION: {
462 data.enforceInterface(IApplicationThread.descriptor);
463 ParcelFileDescriptor fd = data.readFileDescriptor();
464 final IBinder activity = data.readStrongBinder();
Dianne Hackborn30d71892010-12-11 10:37:55 -0800465 final String prefix = data.readString();
Dianne Hackborn625ac272010-09-17 18:29:22 -0700466 final String[] args = data.readStringArray();
467 if (fd != null) {
Dianne Hackborn30d71892010-12-11 10:37:55 -0800468 dumpActivity(fd.getFileDescriptor(), activity, prefix, args);
Dianne Hackborn625ac272010-09-17 18:29:22 -0700469 try {
470 fd.close();
471 } catch (IOException e) {
472 }
473 }
474 return true;
475 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800476
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400477 case SET_CORE_SETTINGS_TRANSACTION: {
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800478 data.enforceInterface(IApplicationThread.descriptor);
479 Bundle settings = data.readBundle();
480 setCoreSettings(settings);
481 return true;
482 }
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400483
484 case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: {
485 data.enforceInterface(IApplicationThread.descriptor);
486 String pkg = data.readString();
487 CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data);
488 updatePackageCompatibilityInfo(pkg, compat);
489 return true;
490 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -0700491
492 case SCHEDULE_TRIM_MEMORY_TRANSACTION: {
493 data.enforceInterface(IApplicationThread.descriptor);
494 int level = data.readInt();
495 scheduleTrimMemory(level);
496 return true;
497 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700498
499 case DUMP_MEM_INFO_TRANSACTION:
500 {
501 data.enforceInterface(IApplicationThread.descriptor);
502 ParcelFileDescriptor fd = data.readFileDescriptor();
Dianne Hackbornb437e092011-08-05 17:50:29 -0700503 boolean checkin = data.readInt() != 0;
504 boolean all = data.readInt() != 0;
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700505 String[] args = data.readStringArray();
506 Debug.MemoryInfo mi = null;
507 if (fd != null) {
508 try {
Dianne Hackbornb437e092011-08-05 17:50:29 -0700509 mi = dumpMemInfo(fd.getFileDescriptor(), checkin, all, args);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700510 } finally {
511 try {
512 fd.close();
513 } catch (IOException e) {
514 // swallowed, not propagated back to the caller
515 }
516 }
517 }
518 reply.writeNoException();
519 mi.writeToParcel(reply, 0);
520 return true;
521 }
522
523 case DUMP_GFX_INFO_TRANSACTION:
524 {
525 data.enforceInterface(IApplicationThread.descriptor);
526 ParcelFileDescriptor fd = data.readFileDescriptor();
527 String[] args = data.readStringArray();
528 if (fd != null) {
529 try {
530 dumpGfxInfo(fd.getFileDescriptor(), args);
531 } finally {
532 try {
533 fd.close();
534 } catch (IOException e) {
535 // swallowed, not propagated back to the caller
536 }
537 }
538 }
539 reply.writeNoException();
540 return true;
541 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800542 }
543
544 return super.onTransact(code, data, reply, flags);
545 }
546
547 public IBinder asBinder()
548 {
549 return this;
550 }
551}
552
553class ApplicationThreadProxy implements IApplicationThread {
554 private final IBinder mRemote;
555
556 public ApplicationThreadProxy(IBinder remote) {
557 mRemote = remote;
558 }
559
560 public final IBinder asBinder() {
561 return mRemote;
562 }
563
564 public final void schedulePauseActivity(IBinder token, boolean finished,
565 boolean userLeaving, int configChanges) throws RemoteException {
566 Parcel data = Parcel.obtain();
567 data.writeInterfaceToken(IApplicationThread.descriptor);
568 data.writeStrongBinder(token);
569 data.writeInt(finished ? 1 : 0);
570 data.writeInt(userLeaving ? 1 :0);
571 data.writeInt(configChanges);
572 mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
573 IBinder.FLAG_ONEWAY);
574 data.recycle();
575 }
576
577 public final void scheduleStopActivity(IBinder token, boolean showWindow,
578 int configChanges) throws RemoteException {
579 Parcel data = Parcel.obtain();
580 data.writeInterfaceToken(IApplicationThread.descriptor);
581 data.writeStrongBinder(token);
582 data.writeInt(showWindow ? 1 : 0);
583 data.writeInt(configChanges);
584 mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
585 IBinder.FLAG_ONEWAY);
586 data.recycle();
587 }
588
589 public final void scheduleWindowVisibility(IBinder token,
590 boolean showWindow) throws RemoteException {
591 Parcel data = Parcel.obtain();
592 data.writeInterfaceToken(IApplicationThread.descriptor);
593 data.writeStrongBinder(token);
594 data.writeInt(showWindow ? 1 : 0);
595 mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
596 IBinder.FLAG_ONEWAY);
597 data.recycle();
598 }
599
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800600 public final void scheduleSleeping(IBinder token,
601 boolean sleeping) throws RemoteException {
602 Parcel data = Parcel.obtain();
603 data.writeInterfaceToken(IApplicationThread.descriptor);
604 data.writeStrongBinder(token);
605 data.writeInt(sleeping ? 1 : 0);
606 mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
607 IBinder.FLAG_ONEWAY);
608 data.recycle();
609 }
610
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 public final void scheduleResumeActivity(IBinder token, boolean isForward)
612 throws RemoteException {
613 Parcel data = Parcel.obtain();
614 data.writeInterfaceToken(IApplicationThread.descriptor);
615 data.writeStrongBinder(token);
616 data.writeInt(isForward ? 1 : 0);
617 mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
618 IBinder.FLAG_ONEWAY);
619 data.recycle();
620 }
621
622 public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
623 throws RemoteException {
624 Parcel data = Parcel.obtain();
625 data.writeInterfaceToken(IApplicationThread.descriptor);
626 data.writeStrongBinder(token);
627 data.writeTypedList(results);
628 mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
629 IBinder.FLAG_ONEWAY);
630 data.recycle();
631 }
632
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700633 public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700634 ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo,
635 Bundle state, List<ResultInfo> pendingResults,
636 List<Intent> pendingNewIntents, boolean notResumed, boolean isForward,
637 String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 throws RemoteException {
639 Parcel data = Parcel.obtain();
640 data.writeInterfaceToken(IApplicationThread.descriptor);
641 intent.writeToParcel(data, 0);
642 data.writeStrongBinder(token);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700643 data.writeInt(ident);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800644 info.writeToParcel(data, 0);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700645 curConfig.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400646 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800647 data.writeBundle(state);
648 data.writeTypedList(pendingResults);
649 data.writeTypedList(pendingNewIntents);
650 data.writeInt(notResumed ? 1 : 0);
651 data.writeInt(isForward ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700652 data.writeString(profileName);
653 if (profileFd != null) {
654 data.writeInt(1);
655 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
656 } else {
657 data.writeInt(0);
658 }
659 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800660 mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
661 IBinder.FLAG_ONEWAY);
662 data.recycle();
663 }
664
665 public final void scheduleRelaunchActivity(IBinder token,
666 List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800667 int configChanges, boolean notResumed, Configuration config)
668 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800669 Parcel data = Parcel.obtain();
670 data.writeInterfaceToken(IApplicationThread.descriptor);
671 data.writeStrongBinder(token);
672 data.writeTypedList(pendingResults);
673 data.writeTypedList(pendingNewIntents);
674 data.writeInt(configChanges);
675 data.writeInt(notResumed ? 1 : 0);
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800676 if (config != null) {
677 data.writeInt(1);
678 config.writeToParcel(data, 0);
679 } else {
680 data.writeInt(0);
681 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
683 IBinder.FLAG_ONEWAY);
684 data.recycle();
685 }
686
687 public void scheduleNewIntent(List<Intent> intents, IBinder token)
688 throws RemoteException {
689 Parcel data = Parcel.obtain();
690 data.writeInterfaceToken(IApplicationThread.descriptor);
691 data.writeTypedList(intents);
692 data.writeStrongBinder(token);
693 mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
694 IBinder.FLAG_ONEWAY);
695 data.recycle();
696 }
697
698 public final void scheduleDestroyActivity(IBinder token, boolean finishing,
699 int configChanges) throws RemoteException {
700 Parcel data = Parcel.obtain();
701 data.writeInterfaceToken(IApplicationThread.descriptor);
702 data.writeStrongBinder(token);
703 data.writeInt(finishing ? 1 : 0);
704 data.writeInt(configChanges);
705 mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
706 IBinder.FLAG_ONEWAY);
707 data.recycle();
708 }
709
710 public final void scheduleReceiver(Intent intent, ActivityInfo info,
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400711 CompatibilityInfo compatInfo, int resultCode, String resultData,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800712 Bundle map, boolean sync) throws RemoteException {
713 Parcel data = Parcel.obtain();
714 data.writeInterfaceToken(IApplicationThread.descriptor);
715 intent.writeToParcel(data, 0);
716 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400717 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 data.writeInt(resultCode);
719 data.writeString(resultData);
720 data.writeBundle(map);
721 data.writeInt(sync ? 1 : 0);
722 mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
723 IBinder.FLAG_ONEWAY);
724 data.recycle();
725 }
726
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400727 public final void scheduleCreateBackupAgent(ApplicationInfo app,
728 CompatibilityInfo compatInfo, int backupMode) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700729 Parcel data = Parcel.obtain();
730 data.writeInterfaceToken(IApplicationThread.descriptor);
731 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400732 compatInfo.writeToParcel(data, 0);
Christopher Tate181fafa2009-05-14 11:12:14 -0700733 data.writeInt(backupMode);
Christopher Tated884f432009-07-23 14:40:13 -0700734 mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
735 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700736 data.recycle();
737 }
738
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400739 public final void scheduleDestroyBackupAgent(ApplicationInfo app,
740 CompatibilityInfo compatInfo) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700741 Parcel data = Parcel.obtain();
742 data.writeInterfaceToken(IApplicationThread.descriptor);
743 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400744 compatInfo.writeToParcel(data, 0);
Christopher Tated884f432009-07-23 14:40:13 -0700745 mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
746 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700747 data.recycle();
748 }
749
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400750 public final void scheduleCreateService(IBinder token, ServiceInfo info,
751 CompatibilityInfo compatInfo) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 Parcel data = Parcel.obtain();
753 data.writeInterfaceToken(IApplicationThread.descriptor);
754 data.writeStrongBinder(token);
755 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400756 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800757 mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
758 IBinder.FLAG_ONEWAY);
759 data.recycle();
760 }
761
762 public final void scheduleBindService(IBinder token, Intent intent, boolean rebind)
763 throws RemoteException {
764 Parcel data = Parcel.obtain();
765 data.writeInterfaceToken(IApplicationThread.descriptor);
766 data.writeStrongBinder(token);
767 intent.writeToParcel(data, 0);
768 data.writeInt(rebind ? 1 : 0);
769 mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
770 IBinder.FLAG_ONEWAY);
771 data.recycle();
772 }
773
774 public final void scheduleUnbindService(IBinder token, Intent intent)
775 throws RemoteException {
776 Parcel data = Parcel.obtain();
777 data.writeInterfaceToken(IApplicationThread.descriptor);
778 data.writeStrongBinder(token);
779 intent.writeToParcel(data, 0);
780 mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
781 IBinder.FLAG_ONEWAY);
782 data.recycle();
783 }
784
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700785 public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700786 int flags, Intent args) 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);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700790 data.writeInt(taskRemoved ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800791 data.writeInt(startId);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700792 data.writeInt(flags);
793 if (args != null) {
794 data.writeInt(1);
795 args.writeToParcel(data, 0);
796 } else {
797 data.writeInt(0);
798 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800799 mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
800 IBinder.FLAG_ONEWAY);
801 data.recycle();
802 }
803
804 public final void scheduleStopService(IBinder token)
805 throws RemoteException {
806 Parcel data = Parcel.obtain();
807 data.writeInterfaceToken(IApplicationThread.descriptor);
808 data.writeStrongBinder(token);
809 mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
810 IBinder.FLAG_ONEWAY);
811 data.recycle();
812 }
813
814 public final void bindApplication(String packageName, ApplicationInfo info,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700815 List<ProviderInfo> providers, ComponentName testName, String profileName,
816 ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs,
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700817 IInstrumentationWatcher testWatcher, int debugMode, boolean restrictedBackupMode,
818 boolean persistent, Configuration config, CompatibilityInfo compatInfo,
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800819 Map<String, IBinder> services, Bundle coreSettings) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800820 Parcel data = Parcel.obtain();
821 data.writeInterfaceToken(IApplicationThread.descriptor);
822 data.writeString(packageName);
823 info.writeToParcel(data, 0);
824 data.writeTypedList(providers);
825 if (testName == null) {
826 data.writeInt(0);
827 } else {
828 data.writeInt(1);
829 testName.writeToParcel(data, 0);
830 }
831 data.writeString(profileName);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700832 if (profileFd != null) {
833 data.writeInt(1);
834 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
835 } else {
836 data.writeInt(0);
837 }
838 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800839 data.writeBundle(testArgs);
840 data.writeStrongInterface(testWatcher);
841 data.writeInt(debugMode);
Christopher Tate181fafa2009-05-14 11:12:14 -0700842 data.writeInt(restrictedBackupMode ? 1 : 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700843 data.writeInt(persistent ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800844 config.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400845 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800846 data.writeMap(services);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800847 data.writeBundle(coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800848 mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
849 IBinder.FLAG_ONEWAY);
850 data.recycle();
851 }
852
853 public final void scheduleExit() throws RemoteException {
854 Parcel data = Parcel.obtain();
855 data.writeInterfaceToken(IApplicationThread.descriptor);
856 mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
857 IBinder.FLAG_ONEWAY);
858 data.recycle();
859 }
Christopher Tate5e1ab332009-09-01 20:32:49 -0700860
861 public final void scheduleSuicide() throws RemoteException {
862 Parcel data = Parcel.obtain();
863 data.writeInterfaceToken(IApplicationThread.descriptor);
864 mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
865 IBinder.FLAG_ONEWAY);
866 data.recycle();
867 }
868
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800869 public final void requestThumbnail(IBinder token)
870 throws RemoteException {
871 Parcel data = Parcel.obtain();
872 data.writeInterfaceToken(IApplicationThread.descriptor);
873 data.writeStrongBinder(token);
874 mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null,
875 IBinder.FLAG_ONEWAY);
876 data.recycle();
877 }
878
879 public final void scheduleConfigurationChanged(Configuration config)
880 throws RemoteException {
881 Parcel data = Parcel.obtain();
882 data.writeInterfaceToken(IApplicationThread.descriptor);
883 config.writeToParcel(data, 0);
884 mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
885 IBinder.FLAG_ONEWAY);
886 data.recycle();
887 }
888
889 public void updateTimeZone() throws RemoteException {
890 Parcel data = Parcel.obtain();
891 data.writeInterfaceToken(IApplicationThread.descriptor);
892 mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
893 IBinder.FLAG_ONEWAY);
894 data.recycle();
895 }
896
Robert Greenwalt03595d02010-11-02 14:08:23 -0700897 public void clearDnsCache() throws RemoteException {
898 Parcel data = Parcel.obtain();
899 data.writeInterfaceToken(IApplicationThread.descriptor);
900 mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
901 IBinder.FLAG_ONEWAY);
902 data.recycle();
903 }
904
Robert Greenwalt434203a2010-10-11 16:00:27 -0700905 public void setHttpProxy(String proxy, String port, String exclList) throws RemoteException {
906 Parcel data = Parcel.obtain();
907 data.writeInterfaceToken(IApplicationThread.descriptor);
908 data.writeString(proxy);
909 data.writeString(port);
910 data.writeString(exclList);
911 mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
912 data.recycle();
913 }
914
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800915 public void processInBackground() throws RemoteException {
916 Parcel data = Parcel.obtain();
917 data.writeInterfaceToken(IApplicationThread.descriptor);
918 mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
919 IBinder.FLAG_ONEWAY);
920 data.recycle();
921 }
922
923 public void dumpService(FileDescriptor fd, IBinder token, String[] args)
924 throws RemoteException {
925 Parcel data = Parcel.obtain();
926 data.writeInterfaceToken(IApplicationThread.descriptor);
927 data.writeFileDescriptor(fd);
928 data.writeStrongBinder(token);
929 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -0700930 mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 data.recycle();
932 }
933
934 public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700935 int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 throws RemoteException {
937 Parcel data = Parcel.obtain();
938 data.writeInterfaceToken(IApplicationThread.descriptor);
939 data.writeStrongBinder(receiver.asBinder());
940 intent.writeToParcel(data, 0);
941 data.writeInt(resultCode);
942 data.writeString(dataStr);
943 data.writeBundle(extras);
944 data.writeInt(ordered ? 1 : 0);
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700945 data.writeInt(sticky ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800946 mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
947 IBinder.FLAG_ONEWAY);
948 data.recycle();
949 }
950
951 public final void scheduleLowMemory() throws RemoteException {
952 Parcel data = Parcel.obtain();
953 data.writeInterfaceToken(IApplicationThread.descriptor);
954 mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
955 IBinder.FLAG_ONEWAY);
956 data.recycle();
957 }
958
959 public final void scheduleActivityConfigurationChanged(
960 IBinder token) throws RemoteException {
961 Parcel data = Parcel.obtain();
962 data.writeInterfaceToken(IApplicationThread.descriptor);
963 data.writeStrongBinder(token);
964 mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
965 IBinder.FLAG_ONEWAY);
966 data.recycle();
967 }
968
Dianne Hackborn9c8dd552009-06-23 19:22:52 -0700969 public void profilerControl(boolean start, String path,
Romain Guy7eabe552011-07-21 14:56:34 -0700970 ParcelFileDescriptor fd, int profileType) throws RemoteException {
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800971 Parcel data = Parcel.obtain();
972 data.writeInterfaceToken(IApplicationThread.descriptor);
973 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -0700974 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800975 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -0700976 if (fd != null) {
977 data.writeInt(1);
978 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
979 } else {
980 data.writeInt(0);
981 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800982 mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
983 IBinder.FLAG_ONEWAY);
984 data.recycle();
985 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -0700986
987 public void setSchedulingGroup(int group) throws RemoteException {
988 Parcel data = Parcel.obtain();
989 data.writeInterfaceToken(IApplicationThread.descriptor);
990 data.writeInt(group);
991 mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
992 IBinder.FLAG_ONEWAY);
993 data.recycle();
994 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -0700995
996 public void getMemoryInfo(Debug.MemoryInfo outInfo) throws RemoteException {
997 Parcel data = Parcel.obtain();
998 Parcel reply = Parcel.obtain();
999 data.writeInterfaceToken(IApplicationThread.descriptor);
1000 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
1001 reply.readException();
1002 outInfo.readFromParcel(reply);
1003 data.recycle();
1004 reply.recycle();
1005 }
Dianne Hackborn4416c3d2010-05-04 17:22:49 -07001006
1007 public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
1008 Parcel data = Parcel.obtain();
1009 data.writeInterfaceToken(IApplicationThread.descriptor);
1010 data.writeInt(cmd);
1011 data.writeStringArray(packages);
1012 mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
1013 IBinder.FLAG_ONEWAY);
1014 data.recycle();
1015
1016 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001017
1018 public void scheduleCrash(String msg) throws RemoteException {
1019 Parcel data = Parcel.obtain();
1020 data.writeInterfaceToken(IApplicationThread.descriptor);
1021 data.writeString(msg);
1022 mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
1023 IBinder.FLAG_ONEWAY);
1024 data.recycle();
1025
1026 }
Andy McFadden824c5102010-07-09 16:26:57 -07001027
1028 public void dumpHeap(boolean managed, String path,
1029 ParcelFileDescriptor fd) throws RemoteException {
1030 Parcel data = Parcel.obtain();
1031 data.writeInterfaceToken(IApplicationThread.descriptor);
1032 data.writeInt(managed ? 1 : 0);
1033 data.writeString(path);
1034 if (fd != null) {
1035 data.writeInt(1);
1036 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1037 } else {
1038 data.writeInt(0);
1039 }
1040 mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
1041 IBinder.FLAG_ONEWAY);
1042 data.recycle();
1043 }
Dianne Hackborn625ac272010-09-17 18:29:22 -07001044
Dianne Hackborn30d71892010-12-11 10:37:55 -08001045 public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
Dianne Hackborn625ac272010-09-17 18:29:22 -07001046 throws RemoteException {
1047 Parcel data = Parcel.obtain();
1048 data.writeInterfaceToken(IApplicationThread.descriptor);
1049 data.writeFileDescriptor(fd);
1050 data.writeStrongBinder(token);
Dianne Hackborn30d71892010-12-11 10:37:55 -08001051 data.writeString(prefix);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001052 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -07001053 mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001054 data.recycle();
1055 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001056
1057 public void setCoreSettings(Bundle coreSettings) throws RemoteException {
1058 Parcel data = Parcel.obtain();
1059 data.writeInterfaceToken(IApplicationThread.descriptor);
1060 data.writeBundle(coreSettings);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001061 mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1062 }
1063
1064 public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
1065 throws RemoteException {
1066 Parcel data = Parcel.obtain();
1067 data.writeInterfaceToken(IApplicationThread.descriptor);
1068 data.writeString(pkg);
1069 info.writeToParcel(data, 0);
1070 mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null,
1071 IBinder.FLAG_ONEWAY);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001072 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -07001073
1074 public void scheduleTrimMemory(int level) throws RemoteException {
1075 Parcel data = Parcel.obtain();
1076 data.writeInterfaceToken(IApplicationThread.descriptor);
1077 data.writeInt(level);
1078 mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
1079 IBinder.FLAG_ONEWAY);
1080 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001081
Dianne Hackbornb437e092011-08-05 17:50:29 -07001082 public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, boolean checkin, boolean all,
1083 String[] args) throws RemoteException {
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001084 Parcel data = Parcel.obtain();
1085 Parcel reply = Parcel.obtain();
1086 data.writeInterfaceToken(IApplicationThread.descriptor);
1087 data.writeFileDescriptor(fd);
Dianne Hackbornb437e092011-08-05 17:50:29 -07001088 data.writeInt(checkin ? 1 : 0);
1089 data.writeInt(all ? 1 : 0);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001090 data.writeStringArray(args);
1091 mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
1092 reply.readException();
1093 Debug.MemoryInfo info = new Debug.MemoryInfo();
1094 info.readFromParcel(reply);
1095 data.recycle();
1096 reply.recycle();
1097 return info;
1098 }
1099
1100 public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException {
1101 Parcel data = Parcel.obtain();
1102 data.writeInterfaceToken(IApplicationThread.descriptor);
1103 data.writeFileDescriptor(fd);
1104 data.writeStringArray(args);
1105 mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1106 data.recycle();
1107 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001108}