The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.app; |
| 18 | |
| 19 | import android.content.ComponentName; |
| 20 | import android.content.Intent; |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 21 | import android.content.IIntentReceiver; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 | import android.content.pm.ActivityInfo; |
| 23 | import android.content.pm.ApplicationInfo; |
| 24 | import android.content.pm.ProviderInfo; |
| 25 | import android.content.pm.ServiceInfo; |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 26 | import android.content.res.CompatibilityInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | import android.content.res.Configuration; |
| 28 | import android.os.Binder; |
| 29 | import android.os.Bundle; |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 30 | import android.os.Debug; |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 31 | import android.os.Parcelable; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | import android.os.RemoteException; |
| 33 | import android.os.IBinder; |
| 34 | import android.os.Parcel; |
| 35 | import android.os.ParcelFileDescriptor; |
| 36 | |
| 37 | import java.io.FileDescriptor; |
| 38 | import java.io.IOException; |
| 39 | import java.util.HashMap; |
| 40 | import java.util.List; |
| 41 | import java.util.Map; |
| 42 | |
| 43 | /** {@hide} */ |
| 44 | public 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 Hackborn | 4eba96b | 2011-01-21 13:34:36 -0800 | [diff] [blame] | 101 | 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 110 | 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 Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 133 | int ident = data.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 134 | ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 135 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 136 | Bundle state = data.readBundle(); |
| 137 | List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); |
| 138 | List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); |
| 139 | boolean notResumed = data.readInt() != 0; |
| 140 | boolean isForward = data.readInt() != 0; |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 141 | scheduleLaunchActivity(intent, b, ident, info, compatInfo, state, ri, pi, |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 142 | notResumed, isForward); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 143 | return true; |
| 144 | } |
| 145 | |
| 146 | case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION: |
| 147 | { |
| 148 | data.enforceInterface(IApplicationThread.descriptor); |
| 149 | IBinder b = data.readStrongBinder(); |
| 150 | List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); |
| 151 | List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); |
| 152 | int configChanges = data.readInt(); |
| 153 | boolean notResumed = data.readInt() != 0; |
Dianne Hackborn | 871ecdc | 2009-12-11 15:24:33 -0800 | [diff] [blame] | 154 | Configuration config = null; |
| 155 | if (data.readInt() != 0) { |
| 156 | config = Configuration.CREATOR.createFromParcel(data); |
| 157 | } |
| 158 | scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 159 | return true; |
| 160 | } |
| 161 | |
| 162 | case SCHEDULE_NEW_INTENT_TRANSACTION: |
| 163 | { |
| 164 | data.enforceInterface(IApplicationThread.descriptor); |
| 165 | List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); |
| 166 | IBinder b = data.readStrongBinder(); |
| 167 | scheduleNewIntent(pi, b); |
| 168 | return true; |
| 169 | } |
| 170 | |
| 171 | case SCHEDULE_FINISH_ACTIVITY_TRANSACTION: |
| 172 | { |
| 173 | data.enforceInterface(IApplicationThread.descriptor); |
| 174 | IBinder b = data.readStrongBinder(); |
| 175 | boolean finishing = data.readInt() != 0; |
| 176 | int configChanges = data.readInt(); |
| 177 | scheduleDestroyActivity(b, finishing, configChanges); |
| 178 | return true; |
| 179 | } |
| 180 | |
| 181 | case SCHEDULE_RECEIVER_TRANSACTION: |
| 182 | { |
| 183 | data.enforceInterface(IApplicationThread.descriptor); |
| 184 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 185 | ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 186 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 187 | int resultCode = data.readInt(); |
| 188 | String resultData = data.readString(); |
| 189 | Bundle resultExtras = data.readBundle(); |
| 190 | boolean sync = data.readInt() != 0; |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 191 | scheduleReceiver(intent, info, compatInfo, resultCode, resultData, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 192 | resultExtras, sync); |
| 193 | return true; |
| 194 | } |
| 195 | |
| 196 | case SCHEDULE_CREATE_SERVICE_TRANSACTION: { |
| 197 | data.enforceInterface(IApplicationThread.descriptor); |
| 198 | IBinder token = data.readStrongBinder(); |
| 199 | ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 200 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
| 201 | scheduleCreateService(token, info, compatInfo); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 202 | return true; |
| 203 | } |
| 204 | |
| 205 | case SCHEDULE_BIND_SERVICE_TRANSACTION: { |
| 206 | data.enforceInterface(IApplicationThread.descriptor); |
| 207 | IBinder token = data.readStrongBinder(); |
| 208 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 209 | boolean rebind = data.readInt() != 0; |
| 210 | scheduleBindService(token, intent, rebind); |
| 211 | return true; |
| 212 | } |
| 213 | |
| 214 | case SCHEDULE_UNBIND_SERVICE_TRANSACTION: { |
| 215 | data.enforceInterface(IApplicationThread.descriptor); |
| 216 | IBinder token = data.readStrongBinder(); |
| 217 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 218 | scheduleUnbindService(token, intent); |
| 219 | return true; |
| 220 | } |
| 221 | |
| 222 | case SCHEDULE_SERVICE_ARGS_TRANSACTION: |
| 223 | { |
| 224 | data.enforceInterface(IApplicationThread.descriptor); |
| 225 | IBinder token = data.readStrongBinder(); |
| 226 | int startId = data.readInt(); |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 227 | int fl = data.readInt(); |
| 228 | Intent args; |
| 229 | if (data.readInt() != 0) { |
| 230 | args = Intent.CREATOR.createFromParcel(data); |
| 231 | } else { |
| 232 | args = null; |
| 233 | } |
| 234 | scheduleServiceArgs(token, startId, fl, args); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 235 | return true; |
| 236 | } |
| 237 | |
| 238 | case SCHEDULE_STOP_SERVICE_TRANSACTION: |
| 239 | { |
| 240 | data.enforceInterface(IApplicationThread.descriptor); |
| 241 | IBinder token = data.readStrongBinder(); |
| 242 | scheduleStopService(token); |
| 243 | return true; |
| 244 | } |
| 245 | |
| 246 | case BIND_APPLICATION_TRANSACTION: |
| 247 | { |
| 248 | data.enforceInterface(IApplicationThread.descriptor); |
| 249 | String packageName = data.readString(); |
| 250 | ApplicationInfo info = |
| 251 | ApplicationInfo.CREATOR.createFromParcel(data); |
| 252 | List<ProviderInfo> providers = |
| 253 | data.createTypedArrayList(ProviderInfo.CREATOR); |
| 254 | ComponentName testName = (data.readInt() != 0) |
| 255 | ? new ComponentName(data) : null; |
| 256 | String profileName = data.readString(); |
| 257 | Bundle testArgs = data.readBundle(); |
| 258 | IBinder binder = data.readStrongBinder(); |
| 259 | IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder); |
| 260 | int testMode = data.readInt(); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 261 | boolean restrictedBackupMode = (data.readInt() != 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 262 | Configuration config = Configuration.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 263 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 264 | HashMap<String, IBinder> services = data.readHashMap(null); |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 265 | Bundle coreSettings = data.readBundle(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 266 | bindApplication(packageName, info, |
| 267 | providers, testName, profileName, |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 268 | testArgs, testWatcher, testMode, restrictedBackupMode, |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 269 | config, compatInfo, services, coreSettings); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 270 | return true; |
| 271 | } |
| 272 | |
| 273 | case SCHEDULE_EXIT_TRANSACTION: |
| 274 | { |
| 275 | data.enforceInterface(IApplicationThread.descriptor); |
| 276 | scheduleExit(); |
| 277 | return true; |
| 278 | } |
| 279 | |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 280 | case SCHEDULE_SUICIDE_TRANSACTION: |
| 281 | { |
| 282 | data.enforceInterface(IApplicationThread.descriptor); |
| 283 | scheduleSuicide(); |
| 284 | return true; |
| 285 | } |
| 286 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 287 | case REQUEST_THUMBNAIL_TRANSACTION: |
| 288 | { |
| 289 | data.enforceInterface(IApplicationThread.descriptor); |
| 290 | IBinder b = data.readStrongBinder(); |
| 291 | requestThumbnail(b); |
| 292 | return true; |
| 293 | } |
Robert Greenwalt | 434203a | 2010-10-11 16:00:27 -0700 | [diff] [blame] | 294 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 295 | case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION: |
| 296 | { |
| 297 | data.enforceInterface(IApplicationThread.descriptor); |
| 298 | Configuration config = Configuration.CREATOR.createFromParcel(data); |
| 299 | scheduleConfigurationChanged(config); |
| 300 | return true; |
| 301 | } |
| 302 | |
| 303 | case UPDATE_TIME_ZONE_TRANSACTION: { |
| 304 | data.enforceInterface(IApplicationThread.descriptor); |
| 305 | updateTimeZone(); |
| 306 | return true; |
| 307 | } |
| 308 | |
Robert Greenwalt | 03595d0 | 2010-11-02 14:08:23 -0700 | [diff] [blame] | 309 | case CLEAR_DNS_CACHE_TRANSACTION: { |
| 310 | data.enforceInterface(IApplicationThread.descriptor); |
| 311 | clearDnsCache(); |
| 312 | return true; |
| 313 | } |
| 314 | |
Robert Greenwalt | 434203a | 2010-10-11 16:00:27 -0700 | [diff] [blame] | 315 | case SET_HTTP_PROXY_TRANSACTION: { |
| 316 | data.enforceInterface(IApplicationThread.descriptor); |
| 317 | final String proxy = data.readString(); |
| 318 | final String port = data.readString(); |
| 319 | final String exclList = data.readString(); |
| 320 | setHttpProxy(proxy, port, exclList); |
| 321 | return true; |
| 322 | } |
| 323 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 324 | case PROCESS_IN_BACKGROUND_TRANSACTION: { |
| 325 | data.enforceInterface(IApplicationThread.descriptor); |
| 326 | processInBackground(); |
| 327 | return true; |
| 328 | } |
Robert Greenwalt | 434203a | 2010-10-11 16:00:27 -0700 | [diff] [blame] | 329 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 330 | case DUMP_SERVICE_TRANSACTION: { |
| 331 | data.enforceInterface(IApplicationThread.descriptor); |
| 332 | ParcelFileDescriptor fd = data.readFileDescriptor(); |
| 333 | final IBinder service = data.readStrongBinder(); |
| 334 | final String[] args = data.readStringArray(); |
| 335 | if (fd != null) { |
| 336 | dumpService(fd.getFileDescriptor(), service, args); |
| 337 | try { |
| 338 | fd.close(); |
| 339 | } catch (IOException e) { |
| 340 | } |
| 341 | } |
| 342 | return true; |
| 343 | } |
| 344 | |
| 345 | case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: { |
| 346 | data.enforceInterface(IApplicationThread.descriptor); |
| 347 | IIntentReceiver receiver = IIntentReceiver.Stub.asInterface( |
| 348 | data.readStrongBinder()); |
| 349 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 350 | int resultCode = data.readInt(); |
| 351 | String dataStr = data.readString(); |
| 352 | Bundle extras = data.readBundle(); |
| 353 | boolean ordered = data.readInt() != 0; |
Dianne Hackborn | 68d881c | 2009-10-05 13:58:17 -0700 | [diff] [blame] | 354 | boolean sticky = data.readInt() != 0; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 355 | scheduleRegisteredReceiver(receiver, intent, |
Dianne Hackborn | 68d881c | 2009-10-05 13:58:17 -0700 | [diff] [blame] | 356 | resultCode, dataStr, extras, ordered, sticky); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 357 | return true; |
| 358 | } |
| 359 | |
| 360 | case SCHEDULE_LOW_MEMORY_TRANSACTION: |
| 361 | { |
| 362 | scheduleLowMemory(); |
| 363 | return true; |
| 364 | } |
| 365 | |
| 366 | case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION: |
| 367 | { |
| 368 | data.enforceInterface(IApplicationThread.descriptor); |
| 369 | IBinder b = data.readStrongBinder(); |
| 370 | scheduleActivityConfigurationChanged(b); |
| 371 | return true; |
| 372 | } |
| 373 | |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 374 | case PROFILER_CONTROL_TRANSACTION: |
| 375 | { |
| 376 | data.enforceInterface(IApplicationThread.descriptor); |
| 377 | boolean start = data.readInt() != 0; |
| 378 | String path = data.readString(); |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 379 | ParcelFileDescriptor fd = data.readInt() != 0 |
| 380 | ? data.readFileDescriptor() : null; |
| 381 | profilerControl(start, path, fd); |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 382 | return true; |
| 383 | } |
Dianne Hackborn | 06de2ea | 2009-05-21 12:56:43 -0700 | [diff] [blame] | 384 | |
| 385 | case SET_SCHEDULING_GROUP_TRANSACTION: |
| 386 | { |
| 387 | data.enforceInterface(IApplicationThread.descriptor); |
| 388 | int group = data.readInt(); |
| 389 | setSchedulingGroup(group); |
| 390 | return true; |
| 391 | } |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 392 | |
| 393 | case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION: |
| 394 | { |
| 395 | data.enforceInterface(IApplicationThread.descriptor); |
| 396 | ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 397 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 398 | int backupMode = data.readInt(); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 399 | scheduleCreateBackupAgent(appInfo, compatInfo, backupMode); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 400 | return true; |
| 401 | } |
Christopher Tate | 1885b37 | 2009-06-04 15:00:33 -0700 | [diff] [blame] | 402 | |
| 403 | case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION: |
| 404 | { |
| 405 | data.enforceInterface(IApplicationThread.descriptor); |
| 406 | ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 407 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
| 408 | scheduleDestroyBackupAgent(appInfo, compatInfo); |
Christopher Tate | 1885b37 | 2009-06-04 15:00:33 -0700 | [diff] [blame] | 409 | return true; |
| 410 | } |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 411 | |
| 412 | case GET_MEMORY_INFO_TRANSACTION: |
| 413 | { |
| 414 | data.enforceInterface(IApplicationThread.descriptor); |
| 415 | Debug.MemoryInfo mi = new Debug.MemoryInfo(); |
| 416 | getMemoryInfo(mi); |
| 417 | reply.writeNoException(); |
| 418 | mi.writeToParcel(reply, 0); |
| 419 | return true; |
| 420 | } |
Dianne Hackborn | 4416c3d | 2010-05-04 17:22:49 -0700 | [diff] [blame] | 421 | |
| 422 | case DISPATCH_PACKAGE_BROADCAST_TRANSACTION: |
| 423 | { |
| 424 | data.enforceInterface(IApplicationThread.descriptor); |
| 425 | int cmd = data.readInt(); |
| 426 | String[] packages = data.readStringArray(); |
| 427 | dispatchPackageBroadcast(cmd, packages); |
| 428 | return true; |
| 429 | } |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 430 | |
| 431 | case SCHEDULE_CRASH_TRANSACTION: |
| 432 | { |
| 433 | data.enforceInterface(IApplicationThread.descriptor); |
| 434 | String msg = data.readString(); |
| 435 | scheduleCrash(msg); |
| 436 | return true; |
| 437 | } |
Andy McFadden | 824c510 | 2010-07-09 16:26:57 -0700 | [diff] [blame] | 438 | |
| 439 | case DUMP_HEAP_TRANSACTION: |
| 440 | { |
| 441 | data.enforceInterface(IApplicationThread.descriptor); |
| 442 | boolean managed = data.readInt() != 0; |
| 443 | String path = data.readString(); |
| 444 | ParcelFileDescriptor fd = data.readInt() != 0 |
| 445 | ? data.readFileDescriptor() : null; |
| 446 | dumpHeap(managed, path, fd); |
| 447 | return true; |
| 448 | } |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 449 | |
| 450 | case DUMP_ACTIVITY_TRANSACTION: { |
| 451 | data.enforceInterface(IApplicationThread.descriptor); |
| 452 | ParcelFileDescriptor fd = data.readFileDescriptor(); |
| 453 | final IBinder activity = data.readStrongBinder(); |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 454 | final String prefix = data.readString(); |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 455 | final String[] args = data.readStringArray(); |
| 456 | if (fd != null) { |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 457 | dumpActivity(fd.getFileDescriptor(), activity, prefix, args); |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 458 | try { |
| 459 | fd.close(); |
| 460 | } catch (IOException e) { |
| 461 | } |
| 462 | } |
| 463 | return true; |
| 464 | } |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 465 | |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 466 | case SET_CORE_SETTINGS_TRANSACTION: { |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 467 | data.enforceInterface(IApplicationThread.descriptor); |
| 468 | Bundle settings = data.readBundle(); |
| 469 | setCoreSettings(settings); |
| 470 | return true; |
| 471 | } |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 472 | |
| 473 | case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: { |
| 474 | data.enforceInterface(IApplicationThread.descriptor); |
| 475 | String pkg = data.readString(); |
| 476 | CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data); |
| 477 | updatePackageCompatibilityInfo(pkg, compat); |
| 478 | return true; |
| 479 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | return super.onTransact(code, data, reply, flags); |
| 483 | } |
| 484 | |
| 485 | public IBinder asBinder() |
| 486 | { |
| 487 | return this; |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | class ApplicationThreadProxy implements IApplicationThread { |
| 492 | private final IBinder mRemote; |
| 493 | |
| 494 | public ApplicationThreadProxy(IBinder remote) { |
| 495 | mRemote = remote; |
| 496 | } |
| 497 | |
| 498 | public final IBinder asBinder() { |
| 499 | return mRemote; |
| 500 | } |
| 501 | |
| 502 | public final void schedulePauseActivity(IBinder token, boolean finished, |
| 503 | boolean userLeaving, int configChanges) throws RemoteException { |
| 504 | Parcel data = Parcel.obtain(); |
| 505 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 506 | data.writeStrongBinder(token); |
| 507 | data.writeInt(finished ? 1 : 0); |
| 508 | data.writeInt(userLeaving ? 1 :0); |
| 509 | data.writeInt(configChanges); |
| 510 | mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null, |
| 511 | IBinder.FLAG_ONEWAY); |
| 512 | data.recycle(); |
| 513 | } |
| 514 | |
| 515 | public final void scheduleStopActivity(IBinder token, boolean showWindow, |
| 516 | int configChanges) throws RemoteException { |
| 517 | Parcel data = Parcel.obtain(); |
| 518 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 519 | data.writeStrongBinder(token); |
| 520 | data.writeInt(showWindow ? 1 : 0); |
| 521 | data.writeInt(configChanges); |
| 522 | mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null, |
| 523 | IBinder.FLAG_ONEWAY); |
| 524 | data.recycle(); |
| 525 | } |
| 526 | |
| 527 | public final void scheduleWindowVisibility(IBinder token, |
| 528 | boolean showWindow) throws RemoteException { |
| 529 | Parcel data = Parcel.obtain(); |
| 530 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 531 | data.writeStrongBinder(token); |
| 532 | data.writeInt(showWindow ? 1 : 0); |
| 533 | mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null, |
| 534 | IBinder.FLAG_ONEWAY); |
| 535 | data.recycle(); |
| 536 | } |
| 537 | |
Dianne Hackborn | 4eba96b | 2011-01-21 13:34:36 -0800 | [diff] [blame] | 538 | public final void scheduleSleeping(IBinder token, |
| 539 | boolean sleeping) throws RemoteException { |
| 540 | Parcel data = Parcel.obtain(); |
| 541 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 542 | data.writeStrongBinder(token); |
| 543 | data.writeInt(sleeping ? 1 : 0); |
| 544 | mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null, |
| 545 | IBinder.FLAG_ONEWAY); |
| 546 | data.recycle(); |
| 547 | } |
| 548 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 549 | public final void scheduleResumeActivity(IBinder token, boolean isForward) |
| 550 | throws RemoteException { |
| 551 | Parcel data = Parcel.obtain(); |
| 552 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 553 | data.writeStrongBinder(token); |
| 554 | data.writeInt(isForward ? 1 : 0); |
| 555 | mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null, |
| 556 | IBinder.FLAG_ONEWAY); |
| 557 | data.recycle(); |
| 558 | } |
| 559 | |
| 560 | public final void scheduleSendResult(IBinder token, List<ResultInfo> results) |
| 561 | throws RemoteException { |
| 562 | Parcel data = Parcel.obtain(); |
| 563 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 564 | data.writeStrongBinder(token); |
| 565 | data.writeTypedList(results); |
| 566 | mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null, |
| 567 | IBinder.FLAG_ONEWAY); |
| 568 | data.recycle(); |
| 569 | } |
| 570 | |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 571 | public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident, |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 572 | ActivityInfo info, CompatibilityInfo compatInfo, Bundle state, |
| 573 | List<ResultInfo> pendingResults, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 574 | List<Intent> pendingNewIntents, boolean notResumed, boolean isForward) |
| 575 | throws RemoteException { |
| 576 | Parcel data = Parcel.obtain(); |
| 577 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 578 | intent.writeToParcel(data, 0); |
| 579 | data.writeStrongBinder(token); |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 580 | data.writeInt(ident); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 581 | info.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 582 | compatInfo.writeToParcel(data, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 583 | data.writeBundle(state); |
| 584 | data.writeTypedList(pendingResults); |
| 585 | data.writeTypedList(pendingNewIntents); |
| 586 | data.writeInt(notResumed ? 1 : 0); |
| 587 | data.writeInt(isForward ? 1 : 0); |
| 588 | mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null, |
| 589 | IBinder.FLAG_ONEWAY); |
| 590 | data.recycle(); |
| 591 | } |
| 592 | |
| 593 | public final void scheduleRelaunchActivity(IBinder token, |
| 594 | List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, |
Dianne Hackborn | 871ecdc | 2009-12-11 15:24:33 -0800 | [diff] [blame] | 595 | int configChanges, boolean notResumed, Configuration config) |
| 596 | throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 597 | Parcel data = Parcel.obtain(); |
| 598 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 599 | data.writeStrongBinder(token); |
| 600 | data.writeTypedList(pendingResults); |
| 601 | data.writeTypedList(pendingNewIntents); |
| 602 | data.writeInt(configChanges); |
| 603 | data.writeInt(notResumed ? 1 : 0); |
Dianne Hackborn | 871ecdc | 2009-12-11 15:24:33 -0800 | [diff] [blame] | 604 | if (config != null) { |
| 605 | data.writeInt(1); |
| 606 | config.writeToParcel(data, 0); |
| 607 | } else { |
| 608 | data.writeInt(0); |
| 609 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 610 | mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null, |
| 611 | IBinder.FLAG_ONEWAY); |
| 612 | data.recycle(); |
| 613 | } |
| 614 | |
| 615 | public void scheduleNewIntent(List<Intent> intents, IBinder token) |
| 616 | throws RemoteException { |
| 617 | Parcel data = Parcel.obtain(); |
| 618 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 619 | data.writeTypedList(intents); |
| 620 | data.writeStrongBinder(token); |
| 621 | mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null, |
| 622 | IBinder.FLAG_ONEWAY); |
| 623 | data.recycle(); |
| 624 | } |
| 625 | |
| 626 | public final void scheduleDestroyActivity(IBinder token, boolean finishing, |
| 627 | int configChanges) throws RemoteException { |
| 628 | Parcel data = Parcel.obtain(); |
| 629 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 630 | data.writeStrongBinder(token); |
| 631 | data.writeInt(finishing ? 1 : 0); |
| 632 | data.writeInt(configChanges); |
| 633 | mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null, |
| 634 | IBinder.FLAG_ONEWAY); |
| 635 | data.recycle(); |
| 636 | } |
| 637 | |
| 638 | public final void scheduleReceiver(Intent intent, ActivityInfo info, |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 639 | CompatibilityInfo compatInfo, int resultCode, String resultData, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 640 | Bundle map, boolean sync) throws RemoteException { |
| 641 | Parcel data = Parcel.obtain(); |
| 642 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 643 | intent.writeToParcel(data, 0); |
| 644 | info.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 645 | compatInfo.writeToParcel(data, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 646 | data.writeInt(resultCode); |
| 647 | data.writeString(resultData); |
| 648 | data.writeBundle(map); |
| 649 | data.writeInt(sync ? 1 : 0); |
| 650 | mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null, |
| 651 | IBinder.FLAG_ONEWAY); |
| 652 | data.recycle(); |
| 653 | } |
| 654 | |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 655 | public final void scheduleCreateBackupAgent(ApplicationInfo app, |
| 656 | CompatibilityInfo compatInfo, int backupMode) throws RemoteException { |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 657 | Parcel data = Parcel.obtain(); |
| 658 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 659 | app.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 660 | compatInfo.writeToParcel(data, 0); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 661 | data.writeInt(backupMode); |
Christopher Tate | d884f43 | 2009-07-23 14:40:13 -0700 | [diff] [blame] | 662 | mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null, |
| 663 | IBinder.FLAG_ONEWAY); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 664 | data.recycle(); |
| 665 | } |
| 666 | |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 667 | public final void scheduleDestroyBackupAgent(ApplicationInfo app, |
| 668 | CompatibilityInfo compatInfo) throws RemoteException { |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 669 | Parcel data = Parcel.obtain(); |
| 670 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 671 | app.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 672 | compatInfo.writeToParcel(data, 0); |
Christopher Tate | d884f43 | 2009-07-23 14:40:13 -0700 | [diff] [blame] | 673 | mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null, |
| 674 | IBinder.FLAG_ONEWAY); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 675 | data.recycle(); |
| 676 | } |
| 677 | |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 678 | public final void scheduleCreateService(IBinder token, ServiceInfo info, |
| 679 | CompatibilityInfo compatInfo) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 680 | Parcel data = Parcel.obtain(); |
| 681 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 682 | data.writeStrongBinder(token); |
| 683 | info.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 684 | compatInfo.writeToParcel(data, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 685 | mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null, |
| 686 | IBinder.FLAG_ONEWAY); |
| 687 | data.recycle(); |
| 688 | } |
| 689 | |
| 690 | public final void scheduleBindService(IBinder token, Intent intent, boolean rebind) |
| 691 | throws RemoteException { |
| 692 | Parcel data = Parcel.obtain(); |
| 693 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 694 | data.writeStrongBinder(token); |
| 695 | intent.writeToParcel(data, 0); |
| 696 | data.writeInt(rebind ? 1 : 0); |
| 697 | mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null, |
| 698 | IBinder.FLAG_ONEWAY); |
| 699 | data.recycle(); |
| 700 | } |
| 701 | |
| 702 | public final void scheduleUnbindService(IBinder token, Intent intent) |
| 703 | throws RemoteException { |
| 704 | Parcel data = Parcel.obtain(); |
| 705 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 706 | data.writeStrongBinder(token); |
| 707 | intent.writeToParcel(data, 0); |
| 708 | mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null, |
| 709 | IBinder.FLAG_ONEWAY); |
| 710 | data.recycle(); |
| 711 | } |
| 712 | |
| 713 | public final void scheduleServiceArgs(IBinder token, int startId, |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 714 | int flags, Intent args) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 715 | Parcel data = Parcel.obtain(); |
| 716 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 717 | data.writeStrongBinder(token); |
| 718 | data.writeInt(startId); |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 719 | data.writeInt(flags); |
| 720 | if (args != null) { |
| 721 | data.writeInt(1); |
| 722 | args.writeToParcel(data, 0); |
| 723 | } else { |
| 724 | data.writeInt(0); |
| 725 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 726 | mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null, |
| 727 | IBinder.FLAG_ONEWAY); |
| 728 | data.recycle(); |
| 729 | } |
| 730 | |
| 731 | public final void scheduleStopService(IBinder token) |
| 732 | throws RemoteException { |
| 733 | Parcel data = Parcel.obtain(); |
| 734 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 735 | data.writeStrongBinder(token); |
| 736 | mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null, |
| 737 | IBinder.FLAG_ONEWAY); |
| 738 | data.recycle(); |
| 739 | } |
| 740 | |
| 741 | public final void bindApplication(String packageName, ApplicationInfo info, |
| 742 | List<ProviderInfo> providers, ComponentName testName, |
| 743 | String profileName, Bundle testArgs, IInstrumentationWatcher testWatcher, int debugMode, |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 744 | boolean restrictedBackupMode, Configuration config, CompatibilityInfo compatInfo, |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 745 | Map<String, IBinder> services, Bundle coreSettings) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 746 | Parcel data = Parcel.obtain(); |
| 747 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 748 | data.writeString(packageName); |
| 749 | info.writeToParcel(data, 0); |
| 750 | data.writeTypedList(providers); |
| 751 | if (testName == null) { |
| 752 | data.writeInt(0); |
| 753 | } else { |
| 754 | data.writeInt(1); |
| 755 | testName.writeToParcel(data, 0); |
| 756 | } |
| 757 | data.writeString(profileName); |
| 758 | data.writeBundle(testArgs); |
| 759 | data.writeStrongInterface(testWatcher); |
| 760 | data.writeInt(debugMode); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 761 | data.writeInt(restrictedBackupMode ? 1 : 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 762 | config.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 763 | compatInfo.writeToParcel(data, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 764 | data.writeMap(services); |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 765 | data.writeBundle(coreSettings); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 766 | mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null, |
| 767 | IBinder.FLAG_ONEWAY); |
| 768 | data.recycle(); |
| 769 | } |
| 770 | |
| 771 | public final void scheduleExit() throws RemoteException { |
| 772 | Parcel data = Parcel.obtain(); |
| 773 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 774 | mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null, |
| 775 | IBinder.FLAG_ONEWAY); |
| 776 | data.recycle(); |
| 777 | } |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 778 | |
| 779 | public final void scheduleSuicide() throws RemoteException { |
| 780 | Parcel data = Parcel.obtain(); |
| 781 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 782 | mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null, |
| 783 | IBinder.FLAG_ONEWAY); |
| 784 | data.recycle(); |
| 785 | } |
| 786 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 787 | public final void requestThumbnail(IBinder token) |
| 788 | throws RemoteException { |
| 789 | Parcel data = Parcel.obtain(); |
| 790 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 791 | data.writeStrongBinder(token); |
| 792 | mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null, |
| 793 | IBinder.FLAG_ONEWAY); |
| 794 | data.recycle(); |
| 795 | } |
| 796 | |
| 797 | public final void scheduleConfigurationChanged(Configuration config) |
| 798 | throws RemoteException { |
| 799 | Parcel data = Parcel.obtain(); |
| 800 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 801 | config.writeToParcel(data, 0); |
| 802 | mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null, |
| 803 | IBinder.FLAG_ONEWAY); |
| 804 | data.recycle(); |
| 805 | } |
| 806 | |
| 807 | public void updateTimeZone() throws RemoteException { |
| 808 | Parcel data = Parcel.obtain(); |
| 809 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 810 | mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null, |
| 811 | IBinder.FLAG_ONEWAY); |
| 812 | data.recycle(); |
| 813 | } |
| 814 | |
Robert Greenwalt | 03595d0 | 2010-11-02 14:08:23 -0700 | [diff] [blame] | 815 | public void clearDnsCache() throws RemoteException { |
| 816 | Parcel data = Parcel.obtain(); |
| 817 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 818 | mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null, |
| 819 | IBinder.FLAG_ONEWAY); |
| 820 | data.recycle(); |
| 821 | } |
| 822 | |
Robert Greenwalt | 434203a | 2010-10-11 16:00:27 -0700 | [diff] [blame] | 823 | public void setHttpProxy(String proxy, String port, String exclList) throws RemoteException { |
| 824 | Parcel data = Parcel.obtain(); |
| 825 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 826 | data.writeString(proxy); |
| 827 | data.writeString(port); |
| 828 | data.writeString(exclList); |
| 829 | mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
| 830 | data.recycle(); |
| 831 | } |
| 832 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 833 | public void processInBackground() throws RemoteException { |
| 834 | Parcel data = Parcel.obtain(); |
| 835 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 836 | mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null, |
| 837 | IBinder.FLAG_ONEWAY); |
| 838 | data.recycle(); |
| 839 | } |
| 840 | |
| 841 | public void dumpService(FileDescriptor fd, IBinder token, String[] args) |
| 842 | throws RemoteException { |
| 843 | Parcel data = Parcel.obtain(); |
| 844 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 845 | data.writeFileDescriptor(fd); |
| 846 | data.writeStrongBinder(token); |
| 847 | data.writeStringArray(args); |
| 848 | mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, 0); |
| 849 | data.recycle(); |
| 850 | } |
| 851 | |
| 852 | public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, |
Dianne Hackborn | 68d881c | 2009-10-05 13:58:17 -0700 | [diff] [blame] | 853 | int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 854 | throws RemoteException { |
| 855 | Parcel data = Parcel.obtain(); |
| 856 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 857 | data.writeStrongBinder(receiver.asBinder()); |
| 858 | intent.writeToParcel(data, 0); |
| 859 | data.writeInt(resultCode); |
| 860 | data.writeString(dataStr); |
| 861 | data.writeBundle(extras); |
| 862 | data.writeInt(ordered ? 1 : 0); |
Dianne Hackborn | 68d881c | 2009-10-05 13:58:17 -0700 | [diff] [blame] | 863 | data.writeInt(sticky ? 1 : 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 864 | mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null, |
| 865 | IBinder.FLAG_ONEWAY); |
| 866 | data.recycle(); |
| 867 | } |
| 868 | |
| 869 | public final void scheduleLowMemory() throws RemoteException { |
| 870 | Parcel data = Parcel.obtain(); |
| 871 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 872 | mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null, |
| 873 | IBinder.FLAG_ONEWAY); |
| 874 | data.recycle(); |
| 875 | } |
| 876 | |
| 877 | public final void scheduleActivityConfigurationChanged( |
| 878 | IBinder token) throws RemoteException { |
| 879 | Parcel data = Parcel.obtain(); |
| 880 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 881 | data.writeStrongBinder(token); |
| 882 | mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null, |
| 883 | IBinder.FLAG_ONEWAY); |
| 884 | data.recycle(); |
| 885 | } |
| 886 | |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 887 | public void profilerControl(boolean start, String path, |
| 888 | ParcelFileDescriptor fd) throws RemoteException { |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 889 | Parcel data = Parcel.obtain(); |
| 890 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 891 | data.writeInt(start ? 1 : 0); |
| 892 | data.writeString(path); |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 893 | if (fd != null) { |
| 894 | data.writeInt(1); |
| 895 | fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 896 | } else { |
| 897 | data.writeInt(0); |
| 898 | } |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 899 | mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null, |
| 900 | IBinder.FLAG_ONEWAY); |
| 901 | data.recycle(); |
| 902 | } |
Dianne Hackborn | 06de2ea | 2009-05-21 12:56:43 -0700 | [diff] [blame] | 903 | |
| 904 | public void setSchedulingGroup(int group) throws RemoteException { |
| 905 | Parcel data = Parcel.obtain(); |
| 906 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 907 | data.writeInt(group); |
| 908 | mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null, |
| 909 | IBinder.FLAG_ONEWAY); |
| 910 | data.recycle(); |
| 911 | } |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 912 | |
| 913 | public void getMemoryInfo(Debug.MemoryInfo outInfo) throws RemoteException { |
| 914 | Parcel data = Parcel.obtain(); |
| 915 | Parcel reply = Parcel.obtain(); |
| 916 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 917 | mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0); |
| 918 | reply.readException(); |
| 919 | outInfo.readFromParcel(reply); |
| 920 | data.recycle(); |
| 921 | reply.recycle(); |
| 922 | } |
Dianne Hackborn | 4416c3d | 2010-05-04 17:22:49 -0700 | [diff] [blame] | 923 | |
| 924 | public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException { |
| 925 | Parcel data = Parcel.obtain(); |
| 926 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 927 | data.writeInt(cmd); |
| 928 | data.writeStringArray(packages); |
| 929 | mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null, |
| 930 | IBinder.FLAG_ONEWAY); |
| 931 | data.recycle(); |
| 932 | |
| 933 | } |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 934 | |
| 935 | public void scheduleCrash(String msg) throws RemoteException { |
| 936 | Parcel data = Parcel.obtain(); |
| 937 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 938 | data.writeString(msg); |
| 939 | mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null, |
| 940 | IBinder.FLAG_ONEWAY); |
| 941 | data.recycle(); |
| 942 | |
| 943 | } |
Andy McFadden | 824c510 | 2010-07-09 16:26:57 -0700 | [diff] [blame] | 944 | |
| 945 | public void dumpHeap(boolean managed, String path, |
| 946 | ParcelFileDescriptor fd) throws RemoteException { |
| 947 | Parcel data = Parcel.obtain(); |
| 948 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 949 | data.writeInt(managed ? 1 : 0); |
| 950 | data.writeString(path); |
| 951 | if (fd != null) { |
| 952 | data.writeInt(1); |
| 953 | fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 954 | } else { |
| 955 | data.writeInt(0); |
| 956 | } |
| 957 | mRemote.transact(DUMP_HEAP_TRANSACTION, data, null, |
| 958 | IBinder.FLAG_ONEWAY); |
| 959 | data.recycle(); |
| 960 | } |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 961 | |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 962 | public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args) |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 963 | throws RemoteException { |
| 964 | Parcel data = Parcel.obtain(); |
| 965 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 966 | data.writeFileDescriptor(fd); |
| 967 | data.writeStrongBinder(token); |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 968 | data.writeString(prefix); |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 969 | data.writeStringArray(args); |
| 970 | mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, 0); |
| 971 | data.recycle(); |
| 972 | } |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 973 | |
| 974 | public void setCoreSettings(Bundle coreSettings) throws RemoteException { |
| 975 | Parcel data = Parcel.obtain(); |
| 976 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 977 | data.writeBundle(coreSettings); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 978 | mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
| 979 | } |
| 980 | |
| 981 | public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) |
| 982 | throws RemoteException { |
| 983 | Parcel data = Parcel.obtain(); |
| 984 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 985 | data.writeString(pkg); |
| 986 | info.writeToParcel(data, 0); |
| 987 | mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null, |
| 988 | IBinder.FLAG_ONEWAY); |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 989 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 990 | } |