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