blob: 6f18e84d6855733ba720edbc4229326b6c0b0b99 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
20import android.content.Intent;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070021import android.content.IIntentReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.pm.ActivityInfo;
23import android.content.pm.ApplicationInfo;
24import android.content.pm.ProviderInfo;
25import android.content.pm.ServiceInfo;
Dianne Hackborne2515ee2011-04-27 18:52:56 -040026import android.content.res.CompatibilityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.content.res.Configuration;
28import android.os.Binder;
29import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070030import android.os.Debug;
Dianne Hackborn9c8dd552009-06-23 19:22:52 -070031import android.os.Parcelable;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.os.RemoteException;
33import android.os.IBinder;
34import android.os.Parcel;
35import android.os.ParcelFileDescriptor;
36
37import java.io.FileDescriptor;
38import java.io.IOException;
39import java.util.HashMap;
40import java.util.List;
41import java.util.Map;
42
43/** {@hide} */
44public abstract class ApplicationThreadNative extends Binder
45 implements IApplicationThread {
46 /**
47 * Cast a Binder object into an application thread interface, generating
48 * a proxy if needed.
49 */
50 static public IApplicationThread asInterface(IBinder obj) {
51 if (obj == null) {
52 return null;
53 }
54 IApplicationThread in =
55 (IApplicationThread)obj.queryLocalInterface(descriptor);
56 if (in != null) {
57 return in;
58 }
59
60 return new ApplicationThreadProxy(obj);
61 }
62
63 public ApplicationThreadNative() {
64 attachInterface(this, descriptor);
65 }
66
67 @Override
68 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
69 throws RemoteException {
70 switch (code) {
71 case SCHEDULE_PAUSE_ACTIVITY_TRANSACTION:
72 {
73 data.enforceInterface(IApplicationThread.descriptor);
74 IBinder b = data.readStrongBinder();
75 boolean finished = data.readInt() != 0;
76 boolean userLeaving = data.readInt() != 0;
77 int configChanges = data.readInt();
78 schedulePauseActivity(b, finished, userLeaving, configChanges);
79 return true;
80 }
81
82 case SCHEDULE_STOP_ACTIVITY_TRANSACTION:
83 {
84 data.enforceInterface(IApplicationThread.descriptor);
85 IBinder b = data.readStrongBinder();
86 boolean show = data.readInt() != 0;
87 int configChanges = data.readInt();
88 scheduleStopActivity(b, show, configChanges);
89 return true;
90 }
91
92 case SCHEDULE_WINDOW_VISIBILITY_TRANSACTION:
93 {
94 data.enforceInterface(IApplicationThread.descriptor);
95 IBinder b = data.readStrongBinder();
96 boolean show = data.readInt() != 0;
97 scheduleWindowVisibility(b, show);
98 return true;
99 }
100
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800101 case SCHEDULE_SLEEPING_TRANSACTION:
102 {
103 data.enforceInterface(IApplicationThread.descriptor);
104 IBinder b = data.readStrongBinder();
105 boolean sleeping = data.readInt() != 0;
106 scheduleSleeping(b, sleeping);
107 return true;
108 }
109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 case SCHEDULE_RESUME_ACTIVITY_TRANSACTION:
111 {
112 data.enforceInterface(IApplicationThread.descriptor);
113 IBinder b = data.readStrongBinder();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700114 int procState = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 boolean isForward = data.readInt() != 0;
Dianne Hackborna413dc02013-07-12 12:02:55 -0700116 scheduleResumeActivity(b, procState, isForward);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 return true;
118 }
119
120 case SCHEDULE_SEND_RESULT_TRANSACTION:
121 {
122 data.enforceInterface(IApplicationThread.descriptor);
123 IBinder b = data.readStrongBinder();
124 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
125 scheduleSendResult(b, ri);
126 return true;
127 }
128
129 case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION:
130 {
131 data.enforceInterface(IApplicationThread.descriptor);
132 Intent intent = Intent.CREATOR.createFromParcel(data);
133 IBinder b = data.readStrongBinder();
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700134 int ident = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700136 Configuration curConfig = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400137 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700138 int procState = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 Bundle state = data.readBundle();
140 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
141 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
142 boolean notResumed = data.readInt() != 0;
143 boolean isForward = data.readInt() != 0;
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700144 String profileName = data.readString();
145 ParcelFileDescriptor profileFd = data.readInt() != 0
146 ? data.readFileDescriptor() : null;
147 boolean autoStopProfiler = data.readInt() != 0;
Dianne Hackborna413dc02013-07-12 12:02:55 -0700148 scheduleLaunchActivity(intent, b, ident, info, curConfig, compatInfo, procState, state,
149 ri, pi, notResumed, isForward, profileName, profileFd, autoStopProfiler);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800150 return true;
151 }
152
153 case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION:
154 {
155 data.enforceInterface(IApplicationThread.descriptor);
156 IBinder b = data.readStrongBinder();
157 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
158 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
159 int configChanges = data.readInt();
160 boolean notResumed = data.readInt() != 0;
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800161 Configuration config = null;
162 if (data.readInt() != 0) {
163 config = Configuration.CREATOR.createFromParcel(data);
164 }
165 scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800166 return true;
167 }
168
169 case SCHEDULE_NEW_INTENT_TRANSACTION:
170 {
171 data.enforceInterface(IApplicationThread.descriptor);
172 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
173 IBinder b = data.readStrongBinder();
174 scheduleNewIntent(pi, b);
175 return true;
176 }
177
178 case SCHEDULE_FINISH_ACTIVITY_TRANSACTION:
179 {
180 data.enforceInterface(IApplicationThread.descriptor);
181 IBinder b = data.readStrongBinder();
182 boolean finishing = data.readInt() != 0;
183 int configChanges = data.readInt();
184 scheduleDestroyActivity(b, finishing, configChanges);
185 return true;
186 }
187
188 case SCHEDULE_RECEIVER_TRANSACTION:
189 {
190 data.enforceInterface(IApplicationThread.descriptor);
191 Intent intent = Intent.CREATOR.createFromParcel(data);
192 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400193 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 int resultCode = data.readInt();
195 String resultData = data.readString();
196 Bundle resultExtras = data.readBundle();
197 boolean sync = data.readInt() != 0;
Dianne Hackborn20e80982012-08-31 19:00:44 -0700198 int sendingUser = data.readInt();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700199 int processState = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400200 scheduleReceiver(intent, info, compatInfo, resultCode, resultData,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700201 resultExtras, sync, sendingUser, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800202 return true;
203 }
204
205 case SCHEDULE_CREATE_SERVICE_TRANSACTION: {
206 data.enforceInterface(IApplicationThread.descriptor);
207 IBinder token = data.readStrongBinder();
208 ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400209 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700210 int processState = data.readInt();
211 scheduleCreateService(token, info, compatInfo, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800212 return true;
213 }
214
215 case SCHEDULE_BIND_SERVICE_TRANSACTION: {
216 data.enforceInterface(IApplicationThread.descriptor);
217 IBinder token = data.readStrongBinder();
218 Intent intent = Intent.CREATOR.createFromParcel(data);
219 boolean rebind = data.readInt() != 0;
Dianne Hackborna413dc02013-07-12 12:02:55 -0700220 int processState = data.readInt();
221 scheduleBindService(token, intent, rebind, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800222 return true;
223 }
224
225 case SCHEDULE_UNBIND_SERVICE_TRANSACTION: {
226 data.enforceInterface(IApplicationThread.descriptor);
227 IBinder token = data.readStrongBinder();
228 Intent intent = Intent.CREATOR.createFromParcel(data);
229 scheduleUnbindService(token, intent);
230 return true;
231 }
232
233 case SCHEDULE_SERVICE_ARGS_TRANSACTION:
234 {
235 data.enforceInterface(IApplicationThread.descriptor);
236 IBinder token = data.readStrongBinder();
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700237 boolean taskRemoved = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800238 int startId = data.readInt();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700239 int fl = data.readInt();
240 Intent args;
241 if (data.readInt() != 0) {
242 args = Intent.CREATOR.createFromParcel(data);
243 } else {
244 args = null;
245 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700246 scheduleServiceArgs(token, taskRemoved, startId, fl, args);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800247 return true;
248 }
249
250 case SCHEDULE_STOP_SERVICE_TRANSACTION:
251 {
252 data.enforceInterface(IApplicationThread.descriptor);
253 IBinder token = data.readStrongBinder();
254 scheduleStopService(token);
255 return true;
256 }
257
258 case BIND_APPLICATION_TRANSACTION:
259 {
260 data.enforceInterface(IApplicationThread.descriptor);
261 String packageName = data.readString();
262 ApplicationInfo info =
263 ApplicationInfo.CREATOR.createFromParcel(data);
264 List<ProviderInfo> providers =
265 data.createTypedArrayList(ProviderInfo.CREATOR);
266 ComponentName testName = (data.readInt() != 0)
267 ? new ComponentName(data) : null;
268 String profileName = data.readString();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700269 ParcelFileDescriptor profileFd = data.readInt() != 0
270 ? data.readFileDescriptor() : null;
271 boolean autoStopProfiler = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800272 Bundle testArgs = data.readBundle();
273 IBinder binder = data.readStrongBinder();
274 IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800275 binder = data.readStrongBinder();
276 IUiAutomationConnection uiAutomationConnection =
277 IUiAutomationConnection.Stub.asInterface(binder);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800278 int testMode = data.readInt();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800279 boolean openGlTrace = data.readInt() != 0;
Christopher Tate181fafa2009-05-14 11:12:14 -0700280 boolean restrictedBackupMode = (data.readInt() != 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700281 boolean persistent = (data.readInt() != 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800282 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400283 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800284 HashMap<String, IBinder> services = data.readHashMap(null);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800285 Bundle coreSettings = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800286 bindApplication(packageName, info,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700287 providers, testName, profileName, profileFd, autoStopProfiler,
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800288 testArgs, testWatcher, uiAutomationConnection, testMode,
289 openGlTrace, restrictedBackupMode, persistent, config, compatInfo,
290 services, coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800291 return true;
292 }
Siva Velusamy92a8b222012-03-09 16:24:04 -0800293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800294 case SCHEDULE_EXIT_TRANSACTION:
295 {
296 data.enforceInterface(IApplicationThread.descriptor);
297 scheduleExit();
298 return true;
299 }
300
Christopher Tate5e1ab332009-09-01 20:32:49 -0700301 case SCHEDULE_SUICIDE_TRANSACTION:
302 {
303 data.enforceInterface(IApplicationThread.descriptor);
304 scheduleSuicide();
305 return true;
306 }
307
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308 case REQUEST_THUMBNAIL_TRANSACTION:
309 {
310 data.enforceInterface(IApplicationThread.descriptor);
311 IBinder b = data.readStrongBinder();
312 requestThumbnail(b);
313 return true;
314 }
Robert Greenwalt434203a2010-10-11 16:00:27 -0700315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
317 {
318 data.enforceInterface(IApplicationThread.descriptor);
319 Configuration config = Configuration.CREATOR.createFromParcel(data);
320 scheduleConfigurationChanged(config);
321 return true;
322 }
323
324 case UPDATE_TIME_ZONE_TRANSACTION: {
325 data.enforceInterface(IApplicationThread.descriptor);
326 updateTimeZone();
327 return true;
328 }
329
Robert Greenwalt03595d02010-11-02 14:08:23 -0700330 case CLEAR_DNS_CACHE_TRANSACTION: {
331 data.enforceInterface(IApplicationThread.descriptor);
332 clearDnsCache();
333 return true;
334 }
335
Robert Greenwalt434203a2010-10-11 16:00:27 -0700336 case SET_HTTP_PROXY_TRANSACTION: {
337 data.enforceInterface(IApplicationThread.descriptor);
338 final String proxy = data.readString();
339 final String port = data.readString();
340 final String exclList = data.readString();
341 setHttpProxy(proxy, port, exclList);
342 return true;
343 }
344
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 case PROCESS_IN_BACKGROUND_TRANSACTION: {
346 data.enforceInterface(IApplicationThread.descriptor);
347 processInBackground();
348 return true;
349 }
Robert Greenwalt434203a2010-10-11 16:00:27 -0700350
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 case DUMP_SERVICE_TRANSACTION: {
352 data.enforceInterface(IApplicationThread.descriptor);
353 ParcelFileDescriptor fd = data.readFileDescriptor();
354 final IBinder service = data.readStrongBinder();
355 final String[] args = data.readStringArray();
356 if (fd != null) {
357 dumpService(fd.getFileDescriptor(), service, args);
358 try {
359 fd.close();
360 } catch (IOException e) {
361 }
362 }
363 return true;
364 }
365
Marco Nelissen18cb2872011-11-15 11:19:53 -0800366 case DUMP_PROVIDER_TRANSACTION: {
367 data.enforceInterface(IApplicationThread.descriptor);
368 ParcelFileDescriptor fd = data.readFileDescriptor();
369 final IBinder service = data.readStrongBinder();
370 final String[] args = data.readStringArray();
371 if (fd != null) {
372 dumpProvider(fd.getFileDescriptor(), service, args);
373 try {
374 fd.close();
375 } catch (IOException e) {
376 }
377 }
378 return true;
379 }
380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
382 data.enforceInterface(IApplicationThread.descriptor);
383 IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
384 data.readStrongBinder());
385 Intent intent = Intent.CREATOR.createFromParcel(data);
386 int resultCode = data.readInt();
387 String dataStr = data.readString();
388 Bundle extras = data.readBundle();
389 boolean ordered = data.readInt() != 0;
Dianne Hackborn68d881c2009-10-05 13:58:17 -0700390 boolean sticky = data.readInt() != 0;
Dianne Hackborn20e80982012-08-31 19:00:44 -0700391 int sendingUser = data.readInt();
Dianne Hackborna413dc02013-07-12 12:02:55 -0700392 int processState = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 scheduleRegisteredReceiver(receiver, intent,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700394 resultCode, dataStr, extras, ordered, sticky, sendingUser, processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800395 return true;
396 }
397
398 case SCHEDULE_LOW_MEMORY_TRANSACTION:
399 {
Vairavan Srinivasane94a3e72012-02-01 23:17:14 -0800400 data.enforceInterface(IApplicationThread.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800401 scheduleLowMemory();
402 return true;
403 }
404
405 case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
406 {
407 data.enforceInterface(IApplicationThread.descriptor);
408 IBinder b = data.readStrongBinder();
409 scheduleActivityConfigurationChanged(b);
410 return true;
411 }
412
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800413 case PROFILER_CONTROL_TRANSACTION:
414 {
415 data.enforceInterface(IApplicationThread.descriptor);
416 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -0700417 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800418 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -0700419 ParcelFileDescriptor fd = data.readInt() != 0
420 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -0700421 profilerControl(start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800422 return true;
423 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -0700424
425 case SET_SCHEDULING_GROUP_TRANSACTION:
426 {
427 data.enforceInterface(IApplicationThread.descriptor);
428 int group = data.readInt();
429 setSchedulingGroup(group);
430 return true;
431 }
Christopher Tate181fafa2009-05-14 11:12:14 -0700432
433 case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
434 {
435 data.enforceInterface(IApplicationThread.descriptor);
436 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400437 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
Christopher Tate181fafa2009-05-14 11:12:14 -0700438 int backupMode = data.readInt();
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400439 scheduleCreateBackupAgent(appInfo, compatInfo, backupMode);
Christopher Tate181fafa2009-05-14 11:12:14 -0700440 return true;
441 }
Christopher Tate1885b372009-06-04 15:00:33 -0700442
443 case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
444 {
445 data.enforceInterface(IApplicationThread.descriptor);
446 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400447 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
448 scheduleDestroyBackupAgent(appInfo, compatInfo);
Christopher Tate1885b372009-06-04 15:00:33 -0700449 return true;
450 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -0700451
452 case GET_MEMORY_INFO_TRANSACTION:
453 {
454 data.enforceInterface(IApplicationThread.descriptor);
455 Debug.MemoryInfo mi = new Debug.MemoryInfo();
456 getMemoryInfo(mi);
457 reply.writeNoException();
458 mi.writeToParcel(reply, 0);
459 return true;
460 }
Dianne Hackborn4416c3d2010-05-04 17:22:49 -0700461
462 case DISPATCH_PACKAGE_BROADCAST_TRANSACTION:
463 {
464 data.enforceInterface(IApplicationThread.descriptor);
465 int cmd = data.readInt();
466 String[] packages = data.readStringArray();
467 dispatchPackageBroadcast(cmd, packages);
468 return true;
469 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -0700470
471 case SCHEDULE_CRASH_TRANSACTION:
472 {
473 data.enforceInterface(IApplicationThread.descriptor);
474 String msg = data.readString();
475 scheduleCrash(msg);
476 return true;
477 }
Andy McFadden824c5102010-07-09 16:26:57 -0700478
479 case DUMP_HEAP_TRANSACTION:
480 {
481 data.enforceInterface(IApplicationThread.descriptor);
482 boolean managed = data.readInt() != 0;
483 String path = data.readString();
484 ParcelFileDescriptor fd = data.readInt() != 0
485 ? data.readFileDescriptor() : null;
486 dumpHeap(managed, path, fd);
487 return true;
488 }
Dianne Hackborn625ac272010-09-17 18:29:22 -0700489
490 case DUMP_ACTIVITY_TRANSACTION: {
491 data.enforceInterface(IApplicationThread.descriptor);
492 ParcelFileDescriptor fd = data.readFileDescriptor();
493 final IBinder activity = data.readStrongBinder();
Dianne Hackborn30d71892010-12-11 10:37:55 -0800494 final String prefix = data.readString();
Dianne Hackborn625ac272010-09-17 18:29:22 -0700495 final String[] args = data.readStringArray();
496 if (fd != null) {
Dianne Hackborn30d71892010-12-11 10:37:55 -0800497 dumpActivity(fd.getFileDescriptor(), activity, prefix, args);
Dianne Hackborn625ac272010-09-17 18:29:22 -0700498 try {
499 fd.close();
500 } catch (IOException e) {
501 }
502 }
503 return true;
504 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800505
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400506 case SET_CORE_SETTINGS_TRANSACTION: {
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800507 data.enforceInterface(IApplicationThread.descriptor);
508 Bundle settings = data.readBundle();
509 setCoreSettings(settings);
510 return true;
511 }
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400512
513 case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: {
514 data.enforceInterface(IApplicationThread.descriptor);
515 String pkg = data.readString();
516 CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data);
517 updatePackageCompatibilityInfo(pkg, compat);
518 return true;
519 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -0700520
521 case SCHEDULE_TRIM_MEMORY_TRANSACTION: {
522 data.enforceInterface(IApplicationThread.descriptor);
523 int level = data.readInt();
524 scheduleTrimMemory(level);
525 return true;
526 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700527
528 case DUMP_MEM_INFO_TRANSACTION:
529 {
530 data.enforceInterface(IApplicationThread.descriptor);
531 ParcelFileDescriptor fd = data.readFileDescriptor();
Dianne Hackbornb437e092011-08-05 17:50:29 -0700532 boolean checkin = data.readInt() != 0;
Dianne Hackborn64770d12013-05-23 17:51:19 -0700533 boolean dumpInfo = data.readInt() != 0;
534 boolean dumpDalvik = data.readInt() != 0;
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700535 String[] args = data.readStringArray();
536 Debug.MemoryInfo mi = null;
537 if (fd != null) {
538 try {
Dianne Hackborn64770d12013-05-23 17:51:19 -0700539 mi = dumpMemInfo(fd.getFileDescriptor(), checkin, dumpInfo, dumpDalvik, args);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -0700540 } finally {
541 try {
542 fd.close();
543 } catch (IOException e) {
544 // swallowed, not propagated back to the caller
545 }
546 }
547 }
548 reply.writeNoException();
549 mi.writeToParcel(reply, 0);
550 return true;
551 }
552
553 case DUMP_GFX_INFO_TRANSACTION:
554 {
555 data.enforceInterface(IApplicationThread.descriptor);
556 ParcelFileDescriptor fd = data.readFileDescriptor();
557 String[] args = data.readStringArray();
558 if (fd != null) {
559 try {
560 dumpGfxInfo(fd.getFileDescriptor(), args);
561 } finally {
562 try {
563 fd.close();
564 } catch (IOException e) {
565 // swallowed, not propagated back to the caller
566 }
567 }
568 }
569 reply.writeNoException();
570 return true;
571 }
Jeff Brown6754ba22011-12-14 20:20:01 -0800572
573 case DUMP_DB_INFO_TRANSACTION:
574 {
575 data.enforceInterface(IApplicationThread.descriptor);
576 ParcelFileDescriptor fd = data.readFileDescriptor();
577 String[] args = data.readStringArray();
578 if (fd != null) {
579 try {
580 dumpDbInfo(fd.getFileDescriptor(), args);
581 } finally {
582 try {
583 fd.close();
584 } catch (IOException e) {
585 // swallowed, not propagated back to the caller
586 }
587 }
588 }
589 reply.writeNoException();
590 return true;
591 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700592
593 case UNSTABLE_PROVIDER_DIED_TRANSACTION:
594 {
595 data.enforceInterface(IApplicationThread.descriptor);
596 IBinder provider = data.readStrongBinder();
597 unstableProviderDied(provider);
598 reply.writeNoException();
599 return true;
600 }
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -0800601
602 case REQUEST_ACTIVITY_EXTRAS_TRANSACTION:
603 {
604 data.enforceInterface(IApplicationThread.descriptor);
605 IBinder activityToken = data.readStrongBinder();
606 IBinder requestToken = data.readStrongBinder();
607 int requestType = data.readInt();
608 requestActivityExtras(activityToken, requestToken, requestType);
609 reply.writeNoException();
610 return true;
611 }
Craig Mautner5eda9b32013-07-02 11:58:16 -0700612
613 case SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION:
614 {
615 data.enforceInterface(IApplicationThread.descriptor);
616 IBinder token = data.readStrongBinder();
617 boolean timeout = data.readInt() == 1;
618 scheduleTranslucentConversionComplete(token, timeout);
619 reply.writeNoException();
620 return true;
621 }
Dianne Hackborna413dc02013-07-12 12:02:55 -0700622
623 case SET_PROCESS_STATE_TRANSACTION:
624 {
625 data.enforceInterface(IApplicationThread.descriptor);
626 int state = data.readInt();
627 setProcessState(state);
628 reply.writeNoException();
629 return true;
630 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800631 }
632
633 return super.onTransact(code, data, reply, flags);
634 }
635
636 public IBinder asBinder()
637 {
638 return this;
639 }
640}
641
642class ApplicationThreadProxy implements IApplicationThread {
643 private final IBinder mRemote;
644
645 public ApplicationThreadProxy(IBinder remote) {
646 mRemote = remote;
647 }
648
649 public final IBinder asBinder() {
650 return mRemote;
651 }
652
653 public final void schedulePauseActivity(IBinder token, boolean finished,
654 boolean userLeaving, int configChanges) throws RemoteException {
655 Parcel data = Parcel.obtain();
656 data.writeInterfaceToken(IApplicationThread.descriptor);
657 data.writeStrongBinder(token);
658 data.writeInt(finished ? 1 : 0);
659 data.writeInt(userLeaving ? 1 :0);
660 data.writeInt(configChanges);
661 mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
662 IBinder.FLAG_ONEWAY);
663 data.recycle();
664 }
665
666 public final void scheduleStopActivity(IBinder token, boolean showWindow,
667 int configChanges) throws RemoteException {
668 Parcel data = Parcel.obtain();
669 data.writeInterfaceToken(IApplicationThread.descriptor);
670 data.writeStrongBinder(token);
671 data.writeInt(showWindow ? 1 : 0);
672 data.writeInt(configChanges);
673 mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
674 IBinder.FLAG_ONEWAY);
675 data.recycle();
676 }
677
678 public final void scheduleWindowVisibility(IBinder token,
679 boolean showWindow) throws RemoteException {
680 Parcel data = Parcel.obtain();
681 data.writeInterfaceToken(IApplicationThread.descriptor);
682 data.writeStrongBinder(token);
683 data.writeInt(showWindow ? 1 : 0);
684 mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
685 IBinder.FLAG_ONEWAY);
686 data.recycle();
687 }
688
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800689 public final void scheduleSleeping(IBinder token,
690 boolean sleeping) throws RemoteException {
691 Parcel data = Parcel.obtain();
692 data.writeInterfaceToken(IApplicationThread.descriptor);
693 data.writeStrongBinder(token);
694 data.writeInt(sleeping ? 1 : 0);
695 mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
696 IBinder.FLAG_ONEWAY);
697 data.recycle();
698 }
699
Dianne Hackborna413dc02013-07-12 12:02:55 -0700700 public final void scheduleResumeActivity(IBinder token, int procState, boolean isForward)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 throws RemoteException {
702 Parcel data = Parcel.obtain();
703 data.writeInterfaceToken(IApplicationThread.descriptor);
704 data.writeStrongBinder(token);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700705 data.writeInt(procState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800706 data.writeInt(isForward ? 1 : 0);
707 mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
708 IBinder.FLAG_ONEWAY);
709 data.recycle();
710 }
711
712 public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
713 throws RemoteException {
714 Parcel data = Parcel.obtain();
715 data.writeInterfaceToken(IApplicationThread.descriptor);
716 data.writeStrongBinder(token);
717 data.writeTypedList(results);
718 mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
719 IBinder.FLAG_ONEWAY);
720 data.recycle();
721 }
722
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700723 public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700724 ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700725 int procState, Bundle state, List<ResultInfo> pendingResults,
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700726 List<Intent> pendingNewIntents, boolean notResumed, boolean isForward,
727 String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 throws RemoteException {
729 Parcel data = Parcel.obtain();
730 data.writeInterfaceToken(IApplicationThread.descriptor);
731 intent.writeToParcel(data, 0);
732 data.writeStrongBinder(token);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700733 data.writeInt(ident);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800734 info.writeToParcel(data, 0);
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700735 curConfig.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400736 compatInfo.writeToParcel(data, 0);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700737 data.writeInt(procState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800738 data.writeBundle(state);
739 data.writeTypedList(pendingResults);
740 data.writeTypedList(pendingNewIntents);
741 data.writeInt(notResumed ? 1 : 0);
742 data.writeInt(isForward ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700743 data.writeString(profileName);
744 if (profileFd != null) {
745 data.writeInt(1);
746 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
747 } else {
748 data.writeInt(0);
749 }
750 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800751 mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
752 IBinder.FLAG_ONEWAY);
753 data.recycle();
754 }
755
756 public final void scheduleRelaunchActivity(IBinder token,
757 List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800758 int configChanges, boolean notResumed, Configuration config)
759 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800760 Parcel data = Parcel.obtain();
761 data.writeInterfaceToken(IApplicationThread.descriptor);
762 data.writeStrongBinder(token);
763 data.writeTypedList(pendingResults);
764 data.writeTypedList(pendingNewIntents);
765 data.writeInt(configChanges);
766 data.writeInt(notResumed ? 1 : 0);
Dianne Hackborn871ecdc2009-12-11 15:24:33 -0800767 if (config != null) {
768 data.writeInt(1);
769 config.writeToParcel(data, 0);
770 } else {
771 data.writeInt(0);
772 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
774 IBinder.FLAG_ONEWAY);
775 data.recycle();
776 }
777
778 public void scheduleNewIntent(List<Intent> intents, IBinder token)
779 throws RemoteException {
780 Parcel data = Parcel.obtain();
781 data.writeInterfaceToken(IApplicationThread.descriptor);
782 data.writeTypedList(intents);
783 data.writeStrongBinder(token);
784 mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
785 IBinder.FLAG_ONEWAY);
786 data.recycle();
787 }
788
789 public final void scheduleDestroyActivity(IBinder token, boolean finishing,
790 int configChanges) throws RemoteException {
791 Parcel data = Parcel.obtain();
792 data.writeInterfaceToken(IApplicationThread.descriptor);
793 data.writeStrongBinder(token);
794 data.writeInt(finishing ? 1 : 0);
795 data.writeInt(configChanges);
796 mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
797 IBinder.FLAG_ONEWAY);
798 data.recycle();
799 }
800
801 public final void scheduleReceiver(Intent intent, ActivityInfo info,
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400802 CompatibilityInfo compatInfo, int resultCode, String resultData,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700803 Bundle map, boolean sync, int sendingUser, int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800804 Parcel data = Parcel.obtain();
805 data.writeInterfaceToken(IApplicationThread.descriptor);
806 intent.writeToParcel(data, 0);
807 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400808 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800809 data.writeInt(resultCode);
810 data.writeString(resultData);
811 data.writeBundle(map);
812 data.writeInt(sync ? 1 : 0);
Dianne Hackborn20e80982012-08-31 19:00:44 -0700813 data.writeInt(sendingUser);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700814 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800815 mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
816 IBinder.FLAG_ONEWAY);
817 data.recycle();
818 }
819
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400820 public final void scheduleCreateBackupAgent(ApplicationInfo app,
821 CompatibilityInfo compatInfo, int backupMode) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700822 Parcel data = Parcel.obtain();
823 data.writeInterfaceToken(IApplicationThread.descriptor);
824 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400825 compatInfo.writeToParcel(data, 0);
Christopher Tate181fafa2009-05-14 11:12:14 -0700826 data.writeInt(backupMode);
Christopher Tated884f432009-07-23 14:40:13 -0700827 mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
828 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700829 data.recycle();
830 }
831
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400832 public final void scheduleDestroyBackupAgent(ApplicationInfo app,
833 CompatibilityInfo compatInfo) throws RemoteException {
Christopher Tate181fafa2009-05-14 11:12:14 -0700834 Parcel data = Parcel.obtain();
835 data.writeInterfaceToken(IApplicationThread.descriptor);
836 app.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400837 compatInfo.writeToParcel(data, 0);
Christopher Tated884f432009-07-23 14:40:13 -0700838 mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
839 IBinder.FLAG_ONEWAY);
Christopher Tate181fafa2009-05-14 11:12:14 -0700840 data.recycle();
841 }
842
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400843 public final void scheduleCreateService(IBinder token, ServiceInfo info,
Dianne Hackborna413dc02013-07-12 12:02:55 -0700844 CompatibilityInfo compatInfo, int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800845 Parcel data = Parcel.obtain();
846 data.writeInterfaceToken(IApplicationThread.descriptor);
847 data.writeStrongBinder(token);
848 info.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400849 compatInfo.writeToParcel(data, 0);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700850 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800851 mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
852 IBinder.FLAG_ONEWAY);
853 data.recycle();
854 }
855
Dianne Hackborna413dc02013-07-12 12:02:55 -0700856 public final void scheduleBindService(IBinder token, Intent intent, boolean rebind,
857 int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800858 Parcel data = Parcel.obtain();
859 data.writeInterfaceToken(IApplicationThread.descriptor);
860 data.writeStrongBinder(token);
861 intent.writeToParcel(data, 0);
862 data.writeInt(rebind ? 1 : 0);
Dianne Hackborna413dc02013-07-12 12:02:55 -0700863 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800864 mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
865 IBinder.FLAG_ONEWAY);
866 data.recycle();
867 }
868
869 public final void scheduleUnbindService(IBinder token, Intent intent)
870 throws RemoteException {
871 Parcel data = Parcel.obtain();
872 data.writeInterfaceToken(IApplicationThread.descriptor);
873 data.writeStrongBinder(token);
874 intent.writeToParcel(data, 0);
875 mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
876 IBinder.FLAG_ONEWAY);
877 data.recycle();
878 }
879
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700880 public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700881 int flags, Intent args) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800882 Parcel data = Parcel.obtain();
883 data.writeInterfaceToken(IApplicationThread.descriptor);
884 data.writeStrongBinder(token);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -0700885 data.writeInt(taskRemoved ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886 data.writeInt(startId);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700887 data.writeInt(flags);
888 if (args != null) {
889 data.writeInt(1);
890 args.writeToParcel(data, 0);
891 } else {
892 data.writeInt(0);
893 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800894 mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
895 IBinder.FLAG_ONEWAY);
896 data.recycle();
897 }
898
899 public final void scheduleStopService(IBinder token)
900 throws RemoteException {
901 Parcel data = Parcel.obtain();
902 data.writeInterfaceToken(IApplicationThread.descriptor);
903 data.writeStrongBinder(token);
904 mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
905 IBinder.FLAG_ONEWAY);
906 data.recycle();
907 }
908
909 public final void bindApplication(String packageName, ApplicationInfo info,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700910 List<ProviderInfo> providers, ComponentName testName, String profileName,
911 ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs,
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800912 IInstrumentationWatcher testWatcher,
913 IUiAutomationConnection uiAutomationConnection, int debugMode,
914 boolean openGlTrace, boolean restrictedBackupMode, boolean persistent,
915 Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services,
916 Bundle coreSettings) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 Parcel data = Parcel.obtain();
918 data.writeInterfaceToken(IApplicationThread.descriptor);
919 data.writeString(packageName);
920 info.writeToParcel(data, 0);
921 data.writeTypedList(providers);
922 if (testName == null) {
923 data.writeInt(0);
924 } else {
925 data.writeInt(1);
926 testName.writeToParcel(data, 0);
927 }
928 data.writeString(profileName);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700929 if (profileFd != null) {
930 data.writeInt(1);
931 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
932 } else {
933 data.writeInt(0);
934 }
935 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 data.writeBundle(testArgs);
937 data.writeStrongInterface(testWatcher);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800938 data.writeStrongInterface(uiAutomationConnection);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 data.writeInt(debugMode);
Siva Velusamy92a8b222012-03-09 16:24:04 -0800940 data.writeInt(openGlTrace ? 1 : 0);
Christopher Tate181fafa2009-05-14 11:12:14 -0700941 data.writeInt(restrictedBackupMode ? 1 : 0);
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700942 data.writeInt(persistent ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 config.writeToParcel(data, 0);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400944 compatInfo.writeToParcel(data, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 data.writeMap(services);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800946 data.writeBundle(coreSettings);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
948 IBinder.FLAG_ONEWAY);
949 data.recycle();
950 }
951
952 public final void scheduleExit() throws RemoteException {
953 Parcel data = Parcel.obtain();
954 data.writeInterfaceToken(IApplicationThread.descriptor);
955 mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
956 IBinder.FLAG_ONEWAY);
957 data.recycle();
958 }
Christopher Tate5e1ab332009-09-01 20:32:49 -0700959
960 public final void scheduleSuicide() throws RemoteException {
961 Parcel data = Parcel.obtain();
962 data.writeInterfaceToken(IApplicationThread.descriptor);
963 mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
964 IBinder.FLAG_ONEWAY);
965 data.recycle();
966 }
967
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800968 public final void requestThumbnail(IBinder token)
969 throws RemoteException {
970 Parcel data = Parcel.obtain();
971 data.writeInterfaceToken(IApplicationThread.descriptor);
972 data.writeStrongBinder(token);
973 mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null,
974 IBinder.FLAG_ONEWAY);
975 data.recycle();
976 }
977
978 public final void scheduleConfigurationChanged(Configuration config)
979 throws RemoteException {
980 Parcel data = Parcel.obtain();
981 data.writeInterfaceToken(IApplicationThread.descriptor);
982 config.writeToParcel(data, 0);
983 mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
984 IBinder.FLAG_ONEWAY);
985 data.recycle();
986 }
987
988 public void updateTimeZone() throws RemoteException {
989 Parcel data = Parcel.obtain();
990 data.writeInterfaceToken(IApplicationThread.descriptor);
991 mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
992 IBinder.FLAG_ONEWAY);
993 data.recycle();
994 }
995
Robert Greenwalt03595d02010-11-02 14:08:23 -0700996 public void clearDnsCache() throws RemoteException {
997 Parcel data = Parcel.obtain();
998 data.writeInterfaceToken(IApplicationThread.descriptor);
999 mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
1000 IBinder.FLAG_ONEWAY);
1001 data.recycle();
1002 }
1003
Robert Greenwalt434203a2010-10-11 16:00:27 -07001004 public void setHttpProxy(String proxy, String port, String exclList) throws RemoteException {
1005 Parcel data = Parcel.obtain();
1006 data.writeInterfaceToken(IApplicationThread.descriptor);
1007 data.writeString(proxy);
1008 data.writeString(port);
1009 data.writeString(exclList);
1010 mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1011 data.recycle();
1012 }
1013
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001014 public void processInBackground() throws RemoteException {
1015 Parcel data = Parcel.obtain();
1016 data.writeInterfaceToken(IApplicationThread.descriptor);
1017 mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
1018 IBinder.FLAG_ONEWAY);
1019 data.recycle();
1020 }
1021
1022 public void dumpService(FileDescriptor fd, IBinder token, String[] args)
1023 throws RemoteException {
1024 Parcel data = Parcel.obtain();
1025 data.writeInterfaceToken(IApplicationThread.descriptor);
1026 data.writeFileDescriptor(fd);
1027 data.writeStrongBinder(token);
1028 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -07001029 mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001030 data.recycle();
1031 }
1032
Marco Nelissen18cb2872011-11-15 11:19:53 -08001033 public void dumpProvider(FileDescriptor fd, IBinder token, String[] args)
1034 throws RemoteException {
1035 Parcel data = Parcel.obtain();
1036 data.writeInterfaceToken(IApplicationThread.descriptor);
1037 data.writeFileDescriptor(fd);
1038 data.writeStrongBinder(token);
1039 data.writeStringArray(args);
1040 mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1041 data.recycle();
1042 }
1043
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001044 public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
Dianne Hackborn20e80982012-08-31 19:00:44 -07001045 int resultCode, String dataStr, Bundle extras, boolean ordered,
Dianne Hackborna413dc02013-07-12 12:02:55 -07001046 boolean sticky, int sendingUser, int processState) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001047 Parcel data = Parcel.obtain();
1048 data.writeInterfaceToken(IApplicationThread.descriptor);
1049 data.writeStrongBinder(receiver.asBinder());
1050 intent.writeToParcel(data, 0);
1051 data.writeInt(resultCode);
1052 data.writeString(dataStr);
1053 data.writeBundle(extras);
1054 data.writeInt(ordered ? 1 : 0);
Dianne Hackborn68d881c2009-10-05 13:58:17 -07001055 data.writeInt(sticky ? 1 : 0);
Dianne Hackborn20e80982012-08-31 19:00:44 -07001056 data.writeInt(sendingUser);
Dianne Hackborna413dc02013-07-12 12:02:55 -07001057 data.writeInt(processState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001058 mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
1059 IBinder.FLAG_ONEWAY);
1060 data.recycle();
1061 }
1062
1063 public final void scheduleLowMemory() throws RemoteException {
1064 Parcel data = Parcel.obtain();
1065 data.writeInterfaceToken(IApplicationThread.descriptor);
1066 mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
1067 IBinder.FLAG_ONEWAY);
1068 data.recycle();
1069 }
1070
1071 public final void scheduleActivityConfigurationChanged(
1072 IBinder token) throws RemoteException {
1073 Parcel data = Parcel.obtain();
1074 data.writeInterfaceToken(IApplicationThread.descriptor);
1075 data.writeStrongBinder(token);
1076 mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1077 IBinder.FLAG_ONEWAY);
1078 data.recycle();
1079 }
1080
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001081 public void profilerControl(boolean start, String path,
Romain Guy7eabe552011-07-21 14:56:34 -07001082 ParcelFileDescriptor fd, int profileType) throws RemoteException {
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001083 Parcel data = Parcel.obtain();
1084 data.writeInterfaceToken(IApplicationThread.descriptor);
1085 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001086 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001087 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001088 if (fd != null) {
1089 data.writeInt(1);
1090 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1091 } else {
1092 data.writeInt(0);
1093 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001094 mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
1095 IBinder.FLAG_ONEWAY);
1096 data.recycle();
1097 }
Dianne Hackborn06de2ea2009-05-21 12:56:43 -07001098
1099 public void setSchedulingGroup(int group) throws RemoteException {
1100 Parcel data = Parcel.obtain();
1101 data.writeInterfaceToken(IApplicationThread.descriptor);
1102 data.writeInt(group);
1103 mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
1104 IBinder.FLAG_ONEWAY);
1105 data.recycle();
1106 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001107
1108 public void getMemoryInfo(Debug.MemoryInfo outInfo) throws RemoteException {
1109 Parcel data = Parcel.obtain();
1110 Parcel reply = Parcel.obtain();
1111 data.writeInterfaceToken(IApplicationThread.descriptor);
1112 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
1113 reply.readException();
1114 outInfo.readFromParcel(reply);
1115 data.recycle();
1116 reply.recycle();
1117 }
Dianne Hackborn4416c3d2010-05-04 17:22:49 -07001118
1119 public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
1120 Parcel data = Parcel.obtain();
1121 data.writeInterfaceToken(IApplicationThread.descriptor);
1122 data.writeInt(cmd);
1123 data.writeStringArray(packages);
1124 mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
1125 IBinder.FLAG_ONEWAY);
1126 data.recycle();
1127
1128 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001129
1130 public void scheduleCrash(String msg) throws RemoteException {
1131 Parcel data = Parcel.obtain();
1132 data.writeInterfaceToken(IApplicationThread.descriptor);
1133 data.writeString(msg);
1134 mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
1135 IBinder.FLAG_ONEWAY);
1136 data.recycle();
1137
1138 }
Andy McFadden824c5102010-07-09 16:26:57 -07001139
1140 public void dumpHeap(boolean managed, String path,
1141 ParcelFileDescriptor fd) throws RemoteException {
1142 Parcel data = Parcel.obtain();
1143 data.writeInterfaceToken(IApplicationThread.descriptor);
1144 data.writeInt(managed ? 1 : 0);
1145 data.writeString(path);
1146 if (fd != null) {
1147 data.writeInt(1);
1148 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1149 } else {
1150 data.writeInt(0);
1151 }
1152 mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
1153 IBinder.FLAG_ONEWAY);
1154 data.recycle();
1155 }
Dianne Hackborn625ac272010-09-17 18:29:22 -07001156
Dianne Hackborn30d71892010-12-11 10:37:55 -08001157 public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
Dianne Hackborn625ac272010-09-17 18:29:22 -07001158 throws RemoteException {
1159 Parcel data = Parcel.obtain();
1160 data.writeInterfaceToken(IApplicationThread.descriptor);
1161 data.writeFileDescriptor(fd);
1162 data.writeStrongBinder(token);
Dianne Hackborn30d71892010-12-11 10:37:55 -08001163 data.writeString(prefix);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001164 data.writeStringArray(args);
Dianne Hackborne17aeb32011-04-07 15:11:57 -07001165 mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
Dianne Hackborn625ac272010-09-17 18:29:22 -07001166 data.recycle();
1167 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001168
1169 public void setCoreSettings(Bundle coreSettings) throws RemoteException {
1170 Parcel data = Parcel.obtain();
1171 data.writeInterfaceToken(IApplicationThread.descriptor);
1172 data.writeBundle(coreSettings);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001173 mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1174 }
1175
1176 public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
1177 throws RemoteException {
1178 Parcel data = Parcel.obtain();
1179 data.writeInterfaceToken(IApplicationThread.descriptor);
1180 data.writeString(pkg);
1181 info.writeToParcel(data, 0);
1182 mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null,
1183 IBinder.FLAG_ONEWAY);
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08001184 }
Dianne Hackbornce86ba82011-07-13 19:33:41 -07001185
1186 public void scheduleTrimMemory(int level) throws RemoteException {
1187 Parcel data = Parcel.obtain();
1188 data.writeInterfaceToken(IApplicationThread.descriptor);
1189 data.writeInt(level);
1190 mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
1191 IBinder.FLAG_ONEWAY);
1192 }
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001193
Dianne Hackborn64770d12013-05-23 17:51:19 -07001194 public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, boolean checkin, boolean dumpInfo,
1195 boolean dumpDalvik, String[] args) throws RemoteException {
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001196 Parcel data = Parcel.obtain();
1197 Parcel reply = Parcel.obtain();
1198 data.writeInterfaceToken(IApplicationThread.descriptor);
1199 data.writeFileDescriptor(fd);
Dianne Hackbornb437e092011-08-05 17:50:29 -07001200 data.writeInt(checkin ? 1 : 0);
Dianne Hackborn64770d12013-05-23 17:51:19 -07001201 data.writeInt(dumpInfo ? 1 : 0);
1202 data.writeInt(dumpDalvik ? 1 : 0);
Dianne Hackborn0e3328f2011-07-17 13:31:17 -07001203 data.writeStringArray(args);
1204 mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
1205 reply.readException();
1206 Debug.MemoryInfo info = new Debug.MemoryInfo();
1207 info.readFromParcel(reply);
1208 data.recycle();
1209 reply.recycle();
1210 return info;
1211 }
1212
1213 public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException {
1214 Parcel data = Parcel.obtain();
1215 data.writeInterfaceToken(IApplicationThread.descriptor);
1216 data.writeFileDescriptor(fd);
1217 data.writeStringArray(args);
1218 mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1219 data.recycle();
1220 }
Jeff Brown6754ba22011-12-14 20:20:01 -08001221
1222 public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException {
1223 Parcel data = Parcel.obtain();
1224 data.writeInterfaceToken(IApplicationThread.descriptor);
1225 data.writeFileDescriptor(fd);
1226 data.writeStringArray(args);
1227 mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1228 data.recycle();
1229 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001230
Craig Mautner5eda9b32013-07-02 11:58:16 -07001231 @Override
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001232 public void unstableProviderDied(IBinder provider) throws RemoteException {
1233 Parcel data = Parcel.obtain();
1234 data.writeInterfaceToken(IApplicationThread.descriptor);
1235 data.writeStrongBinder(provider);
1236 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1237 data.recycle();
1238 }
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001239
Craig Mautner5eda9b32013-07-02 11:58:16 -07001240 @Override
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001241 public void requestActivityExtras(IBinder activityToken, IBinder requestToken, int requestType)
1242 throws RemoteException {
1243 Parcel data = Parcel.obtain();
1244 data.writeInterfaceToken(IApplicationThread.descriptor);
1245 data.writeStrongBinder(activityToken);
1246 data.writeStrongBinder(requestToken);
1247 data.writeInt(requestType);
1248 mRemote.transact(REQUEST_ACTIVITY_EXTRAS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1249 data.recycle();
1250 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07001251
1252 @Override
1253 public void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
1254 throws RemoteException {
1255 Parcel data = Parcel.obtain();
1256 data.writeInterfaceToken(IApplicationThread.descriptor);
1257 data.writeStrongBinder(token);
1258 data.writeInt(timeout ? 1 : 0);
1259 mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1260 data.recycle();
1261 }
Dianne Hackborna413dc02013-07-12 12:02:55 -07001262
1263 @Override
1264 public void setProcessState(int state) throws RemoteException {
1265 Parcel data = Parcel.obtain();
1266 data.writeInterfaceToken(IApplicationThread.descriptor);
1267 data.writeInt(state);
1268 mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1269 data.recycle();
1270 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271}