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 | 58f42a5 | 2011-10-10 13:46:34 -0700 | [diff] [blame] | 135 | Configuration curConfig = Configuration.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 136 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 137 | Bundle state = data.readBundle(); |
| 138 | List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); |
| 139 | List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); |
| 140 | boolean notResumed = data.readInt() != 0; |
| 141 | boolean isForward = data.readInt() != 0; |
Dianne Hackborn | 62f20ec | 2011-08-15 17:40:28 -0700 | [diff] [blame] | 142 | String profileName = data.readString(); |
| 143 | ParcelFileDescriptor profileFd = data.readInt() != 0 |
| 144 | ? data.readFileDescriptor() : null; |
| 145 | boolean autoStopProfiler = data.readInt() != 0; |
Dianne Hackborn | 58f42a5 | 2011-10-10 13:46:34 -0700 | [diff] [blame] | 146 | scheduleLaunchActivity(intent, b, ident, info, curConfig, compatInfo, state, ri, pi, |
Dianne Hackborn | 62f20ec | 2011-08-15 17:40:28 -0700 | [diff] [blame] | 147 | notResumed, isForward, profileName, profileFd, autoStopProfiler); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 148 | return true; |
| 149 | } |
| 150 | |
| 151 | case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION: |
| 152 | { |
| 153 | data.enforceInterface(IApplicationThread.descriptor); |
| 154 | IBinder b = data.readStrongBinder(); |
| 155 | List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); |
| 156 | List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); |
| 157 | int configChanges = data.readInt(); |
| 158 | boolean notResumed = data.readInt() != 0; |
Dianne Hackborn | 871ecdc | 2009-12-11 15:24:33 -0800 | [diff] [blame] | 159 | Configuration config = null; |
| 160 | if (data.readInt() != 0) { |
| 161 | config = Configuration.CREATOR.createFromParcel(data); |
| 162 | } |
| 163 | scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 164 | return true; |
| 165 | } |
| 166 | |
| 167 | case SCHEDULE_NEW_INTENT_TRANSACTION: |
| 168 | { |
| 169 | data.enforceInterface(IApplicationThread.descriptor); |
| 170 | List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); |
| 171 | IBinder b = data.readStrongBinder(); |
| 172 | scheduleNewIntent(pi, b); |
| 173 | return true; |
| 174 | } |
| 175 | |
| 176 | case SCHEDULE_FINISH_ACTIVITY_TRANSACTION: |
| 177 | { |
| 178 | data.enforceInterface(IApplicationThread.descriptor); |
| 179 | IBinder b = data.readStrongBinder(); |
| 180 | boolean finishing = data.readInt() != 0; |
| 181 | int configChanges = data.readInt(); |
| 182 | scheduleDestroyActivity(b, finishing, configChanges); |
| 183 | return true; |
| 184 | } |
| 185 | |
| 186 | case SCHEDULE_RECEIVER_TRANSACTION: |
| 187 | { |
| 188 | data.enforceInterface(IApplicationThread.descriptor); |
| 189 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 190 | ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 191 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 192 | int resultCode = data.readInt(); |
| 193 | String resultData = data.readString(); |
| 194 | Bundle resultExtras = data.readBundle(); |
| 195 | boolean sync = data.readInt() != 0; |
Dianne Hackborn | 20e8098 | 2012-08-31 19:00:44 -0700 | [diff] [blame] | 196 | int sendingUser = data.readInt(); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 197 | scheduleReceiver(intent, info, compatInfo, resultCode, resultData, |
Dianne Hackborn | 20e8098 | 2012-08-31 19:00:44 -0700 | [diff] [blame] | 198 | resultExtras, sync, sendingUser); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 199 | return true; |
| 200 | } |
| 201 | |
| 202 | case SCHEDULE_CREATE_SERVICE_TRANSACTION: { |
| 203 | data.enforceInterface(IApplicationThread.descriptor); |
| 204 | IBinder token = data.readStrongBinder(); |
| 205 | ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 206 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
| 207 | scheduleCreateService(token, info, compatInfo); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 208 | return true; |
| 209 | } |
| 210 | |
| 211 | case SCHEDULE_BIND_SERVICE_TRANSACTION: { |
| 212 | data.enforceInterface(IApplicationThread.descriptor); |
| 213 | IBinder token = data.readStrongBinder(); |
| 214 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 215 | boolean rebind = data.readInt() != 0; |
| 216 | scheduleBindService(token, intent, rebind); |
| 217 | return true; |
| 218 | } |
| 219 | |
| 220 | case SCHEDULE_UNBIND_SERVICE_TRANSACTION: { |
| 221 | data.enforceInterface(IApplicationThread.descriptor); |
| 222 | IBinder token = data.readStrongBinder(); |
| 223 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 224 | scheduleUnbindService(token, intent); |
| 225 | return true; |
| 226 | } |
| 227 | |
| 228 | case SCHEDULE_SERVICE_ARGS_TRANSACTION: |
| 229 | { |
| 230 | data.enforceInterface(IApplicationThread.descriptor); |
| 231 | IBinder token = data.readStrongBinder(); |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 232 | boolean taskRemoved = data.readInt() != 0; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 233 | int startId = data.readInt(); |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 234 | int fl = data.readInt(); |
| 235 | Intent args; |
| 236 | if (data.readInt() != 0) { |
| 237 | args = Intent.CREATOR.createFromParcel(data); |
| 238 | } else { |
| 239 | args = null; |
| 240 | } |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 241 | scheduleServiceArgs(token, taskRemoved, startId, fl, args); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 242 | return true; |
| 243 | } |
| 244 | |
| 245 | case SCHEDULE_STOP_SERVICE_TRANSACTION: |
| 246 | { |
| 247 | data.enforceInterface(IApplicationThread.descriptor); |
| 248 | IBinder token = data.readStrongBinder(); |
| 249 | scheduleStopService(token); |
| 250 | return true; |
| 251 | } |
| 252 | |
| 253 | case BIND_APPLICATION_TRANSACTION: |
| 254 | { |
| 255 | data.enforceInterface(IApplicationThread.descriptor); |
| 256 | String packageName = data.readString(); |
| 257 | ApplicationInfo info = |
| 258 | ApplicationInfo.CREATOR.createFromParcel(data); |
| 259 | List<ProviderInfo> providers = |
| 260 | data.createTypedArrayList(ProviderInfo.CREATOR); |
| 261 | ComponentName testName = (data.readInt() != 0) |
| 262 | ? new ComponentName(data) : null; |
| 263 | String profileName = data.readString(); |
Dianne Hackborn | 62f20ec | 2011-08-15 17:40:28 -0700 | [diff] [blame] | 264 | ParcelFileDescriptor profileFd = data.readInt() != 0 |
| 265 | ? data.readFileDescriptor() : null; |
| 266 | boolean autoStopProfiler = data.readInt() != 0; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 267 | Bundle testArgs = data.readBundle(); |
| 268 | IBinder binder = data.readStrongBinder(); |
| 269 | IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder); |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 270 | binder = data.readStrongBinder(); |
| 271 | IUiAutomationConnection uiAutomationConnection = |
| 272 | IUiAutomationConnection.Stub.asInterface(binder); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 273 | int testMode = data.readInt(); |
Siva Velusamy | 92a8b22 | 2012-03-09 16:24:04 -0800 | [diff] [blame] | 274 | boolean openGlTrace = data.readInt() != 0; |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 275 | boolean restrictedBackupMode = (data.readInt() != 0); |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 276 | boolean persistent = (data.readInt() != 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 277 | Configuration config = Configuration.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 278 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 279 | HashMap<String, IBinder> services = data.readHashMap(null); |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 280 | Bundle coreSettings = data.readBundle(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 281 | bindApplication(packageName, info, |
Dianne Hackborn | 62f20ec | 2011-08-15 17:40:28 -0700 | [diff] [blame] | 282 | providers, testName, profileName, profileFd, autoStopProfiler, |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 283 | testArgs, testWatcher, uiAutomationConnection, testMode, |
| 284 | openGlTrace, restrictedBackupMode, persistent, config, compatInfo, |
| 285 | services, coreSettings); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 286 | return true; |
| 287 | } |
Siva Velusamy | 92a8b22 | 2012-03-09 16:24:04 -0800 | [diff] [blame] | 288 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 289 | case SCHEDULE_EXIT_TRANSACTION: |
| 290 | { |
| 291 | data.enforceInterface(IApplicationThread.descriptor); |
| 292 | scheduleExit(); |
| 293 | return true; |
| 294 | } |
| 295 | |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 296 | case SCHEDULE_SUICIDE_TRANSACTION: |
| 297 | { |
| 298 | data.enforceInterface(IApplicationThread.descriptor); |
| 299 | scheduleSuicide(); |
| 300 | return true; |
| 301 | } |
| 302 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 303 | case REQUEST_THUMBNAIL_TRANSACTION: |
| 304 | { |
| 305 | data.enforceInterface(IApplicationThread.descriptor); |
| 306 | IBinder b = data.readStrongBinder(); |
| 307 | requestThumbnail(b); |
| 308 | return true; |
| 309 | } |
Robert Greenwalt | 434203a | 2010-10-11 16:00:27 -0700 | [diff] [blame] | 310 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 311 | case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION: |
| 312 | { |
| 313 | data.enforceInterface(IApplicationThread.descriptor); |
| 314 | Configuration config = Configuration.CREATOR.createFromParcel(data); |
| 315 | scheduleConfigurationChanged(config); |
| 316 | return true; |
| 317 | } |
| 318 | |
| 319 | case UPDATE_TIME_ZONE_TRANSACTION: { |
| 320 | data.enforceInterface(IApplicationThread.descriptor); |
| 321 | updateTimeZone(); |
| 322 | return true; |
| 323 | } |
| 324 | |
Robert Greenwalt | 03595d0 | 2010-11-02 14:08:23 -0700 | [diff] [blame] | 325 | case CLEAR_DNS_CACHE_TRANSACTION: { |
| 326 | data.enforceInterface(IApplicationThread.descriptor); |
| 327 | clearDnsCache(); |
| 328 | return true; |
| 329 | } |
| 330 | |
Robert Greenwalt | 434203a | 2010-10-11 16:00:27 -0700 | [diff] [blame] | 331 | case SET_HTTP_PROXY_TRANSACTION: { |
| 332 | data.enforceInterface(IApplicationThread.descriptor); |
| 333 | final String proxy = data.readString(); |
| 334 | final String port = data.readString(); |
| 335 | final String exclList = data.readString(); |
| 336 | setHttpProxy(proxy, port, exclList); |
| 337 | return true; |
| 338 | } |
| 339 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 340 | case PROCESS_IN_BACKGROUND_TRANSACTION: { |
| 341 | data.enforceInterface(IApplicationThread.descriptor); |
| 342 | processInBackground(); |
| 343 | return true; |
| 344 | } |
Robert Greenwalt | 434203a | 2010-10-11 16:00:27 -0700 | [diff] [blame] | 345 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 346 | case DUMP_SERVICE_TRANSACTION: { |
| 347 | data.enforceInterface(IApplicationThread.descriptor); |
| 348 | ParcelFileDescriptor fd = data.readFileDescriptor(); |
| 349 | final IBinder service = data.readStrongBinder(); |
| 350 | final String[] args = data.readStringArray(); |
| 351 | if (fd != null) { |
| 352 | dumpService(fd.getFileDescriptor(), service, args); |
| 353 | try { |
| 354 | fd.close(); |
| 355 | } catch (IOException e) { |
| 356 | } |
| 357 | } |
| 358 | return true; |
| 359 | } |
| 360 | |
Marco Nelissen | 18cb287 | 2011-11-15 11:19:53 -0800 | [diff] [blame] | 361 | case DUMP_PROVIDER_TRANSACTION: { |
| 362 | data.enforceInterface(IApplicationThread.descriptor); |
| 363 | ParcelFileDescriptor fd = data.readFileDescriptor(); |
| 364 | final IBinder service = data.readStrongBinder(); |
| 365 | final String[] args = data.readStringArray(); |
| 366 | if (fd != null) { |
| 367 | dumpProvider(fd.getFileDescriptor(), service, args); |
| 368 | try { |
| 369 | fd.close(); |
| 370 | } catch (IOException e) { |
| 371 | } |
| 372 | } |
| 373 | return true; |
| 374 | } |
| 375 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 376 | case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: { |
| 377 | data.enforceInterface(IApplicationThread.descriptor); |
| 378 | IIntentReceiver receiver = IIntentReceiver.Stub.asInterface( |
| 379 | data.readStrongBinder()); |
| 380 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 381 | int resultCode = data.readInt(); |
| 382 | String dataStr = data.readString(); |
| 383 | Bundle extras = data.readBundle(); |
| 384 | boolean ordered = data.readInt() != 0; |
Dianne Hackborn | 68d881c | 2009-10-05 13:58:17 -0700 | [diff] [blame] | 385 | boolean sticky = data.readInt() != 0; |
Dianne Hackborn | 20e8098 | 2012-08-31 19:00:44 -0700 | [diff] [blame] | 386 | int sendingUser = data.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 387 | scheduleRegisteredReceiver(receiver, intent, |
Dianne Hackborn | 20e8098 | 2012-08-31 19:00:44 -0700 | [diff] [blame] | 388 | resultCode, dataStr, extras, ordered, sticky, sendingUser); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 389 | return true; |
| 390 | } |
| 391 | |
| 392 | case SCHEDULE_LOW_MEMORY_TRANSACTION: |
| 393 | { |
Vairavan Srinivasan | e94a3e7 | 2012-02-01 23:17:14 -0800 | [diff] [blame] | 394 | data.enforceInterface(IApplicationThread.descriptor); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 395 | scheduleLowMemory(); |
| 396 | return true; |
| 397 | } |
| 398 | |
| 399 | case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION: |
| 400 | { |
| 401 | data.enforceInterface(IApplicationThread.descriptor); |
| 402 | IBinder b = data.readStrongBinder(); |
| 403 | scheduleActivityConfigurationChanged(b); |
| 404 | return true; |
| 405 | } |
| 406 | |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 407 | case PROFILER_CONTROL_TRANSACTION: |
| 408 | { |
| 409 | data.enforceInterface(IApplicationThread.descriptor); |
| 410 | boolean start = data.readInt() != 0; |
Romain Guy | 9a8c5ce | 2011-07-21 18:04:29 -0700 | [diff] [blame] | 411 | int profileType = data.readInt(); |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 412 | String path = data.readString(); |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 413 | ParcelFileDescriptor fd = data.readInt() != 0 |
| 414 | ? data.readFileDescriptor() : null; |
Romain Guy | 7eabe55 | 2011-07-21 14:56:34 -0700 | [diff] [blame] | 415 | profilerControl(start, path, fd, profileType); |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 416 | return true; |
| 417 | } |
Dianne Hackborn | 06de2ea | 2009-05-21 12:56:43 -0700 | [diff] [blame] | 418 | |
| 419 | case SET_SCHEDULING_GROUP_TRANSACTION: |
| 420 | { |
| 421 | data.enforceInterface(IApplicationThread.descriptor); |
| 422 | int group = data.readInt(); |
| 423 | setSchedulingGroup(group); |
| 424 | return true; |
| 425 | } |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 426 | |
| 427 | case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION: |
| 428 | { |
| 429 | data.enforceInterface(IApplicationThread.descriptor); |
| 430 | ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 431 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 432 | int backupMode = data.readInt(); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 433 | scheduleCreateBackupAgent(appInfo, compatInfo, backupMode); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 434 | return true; |
| 435 | } |
Christopher Tate | 1885b37 | 2009-06-04 15:00:33 -0700 | [diff] [blame] | 436 | |
| 437 | case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION: |
| 438 | { |
| 439 | data.enforceInterface(IApplicationThread.descriptor); |
| 440 | ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 441 | CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); |
| 442 | scheduleDestroyBackupAgent(appInfo, compatInfo); |
Christopher Tate | 1885b37 | 2009-06-04 15:00:33 -0700 | [diff] [blame] | 443 | return true; |
| 444 | } |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 445 | |
| 446 | case GET_MEMORY_INFO_TRANSACTION: |
| 447 | { |
| 448 | data.enforceInterface(IApplicationThread.descriptor); |
| 449 | Debug.MemoryInfo mi = new Debug.MemoryInfo(); |
| 450 | getMemoryInfo(mi); |
| 451 | reply.writeNoException(); |
| 452 | mi.writeToParcel(reply, 0); |
| 453 | return true; |
| 454 | } |
Dianne Hackborn | 4416c3d | 2010-05-04 17:22:49 -0700 | [diff] [blame] | 455 | |
| 456 | case DISPATCH_PACKAGE_BROADCAST_TRANSACTION: |
| 457 | { |
| 458 | data.enforceInterface(IApplicationThread.descriptor); |
| 459 | int cmd = data.readInt(); |
| 460 | String[] packages = data.readStringArray(); |
| 461 | dispatchPackageBroadcast(cmd, packages); |
| 462 | return true; |
| 463 | } |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 464 | |
| 465 | case SCHEDULE_CRASH_TRANSACTION: |
| 466 | { |
| 467 | data.enforceInterface(IApplicationThread.descriptor); |
| 468 | String msg = data.readString(); |
| 469 | scheduleCrash(msg); |
| 470 | return true; |
| 471 | } |
Andy McFadden | 824c510 | 2010-07-09 16:26:57 -0700 | [diff] [blame] | 472 | |
| 473 | case DUMP_HEAP_TRANSACTION: |
| 474 | { |
| 475 | data.enforceInterface(IApplicationThread.descriptor); |
| 476 | boolean managed = data.readInt() != 0; |
| 477 | String path = data.readString(); |
| 478 | ParcelFileDescriptor fd = data.readInt() != 0 |
| 479 | ? data.readFileDescriptor() : null; |
| 480 | dumpHeap(managed, path, fd); |
| 481 | return true; |
| 482 | } |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 483 | |
| 484 | case DUMP_ACTIVITY_TRANSACTION: { |
| 485 | data.enforceInterface(IApplicationThread.descriptor); |
| 486 | ParcelFileDescriptor fd = data.readFileDescriptor(); |
| 487 | final IBinder activity = data.readStrongBinder(); |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 488 | final String prefix = data.readString(); |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 489 | final String[] args = data.readStringArray(); |
| 490 | if (fd != null) { |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 491 | dumpActivity(fd.getFileDescriptor(), activity, prefix, args); |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 492 | try { |
| 493 | fd.close(); |
| 494 | } catch (IOException e) { |
| 495 | } |
| 496 | } |
| 497 | return true; |
| 498 | } |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 499 | |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 500 | case SET_CORE_SETTINGS_TRANSACTION: { |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 501 | data.enforceInterface(IApplicationThread.descriptor); |
| 502 | Bundle settings = data.readBundle(); |
| 503 | setCoreSettings(settings); |
| 504 | return true; |
| 505 | } |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 506 | |
| 507 | case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: { |
| 508 | data.enforceInterface(IApplicationThread.descriptor); |
| 509 | String pkg = data.readString(); |
| 510 | CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data); |
| 511 | updatePackageCompatibilityInfo(pkg, compat); |
| 512 | return true; |
| 513 | } |
Dianne Hackborn | ce86ba8 | 2011-07-13 19:33:41 -0700 | [diff] [blame] | 514 | |
| 515 | case SCHEDULE_TRIM_MEMORY_TRANSACTION: { |
| 516 | data.enforceInterface(IApplicationThread.descriptor); |
| 517 | int level = data.readInt(); |
| 518 | scheduleTrimMemory(level); |
| 519 | return true; |
| 520 | } |
Dianne Hackborn | 0e3328f | 2011-07-17 13:31:17 -0700 | [diff] [blame] | 521 | |
| 522 | case DUMP_MEM_INFO_TRANSACTION: |
| 523 | { |
| 524 | data.enforceInterface(IApplicationThread.descriptor); |
| 525 | ParcelFileDescriptor fd = data.readFileDescriptor(); |
Dianne Hackborn | b437e09 | 2011-08-05 17:50:29 -0700 | [diff] [blame] | 526 | boolean checkin = data.readInt() != 0; |
| 527 | boolean all = data.readInt() != 0; |
Dianne Hackborn | 0e3328f | 2011-07-17 13:31:17 -0700 | [diff] [blame] | 528 | String[] args = data.readStringArray(); |
| 529 | Debug.MemoryInfo mi = null; |
| 530 | if (fd != null) { |
| 531 | try { |
Dianne Hackborn | b437e09 | 2011-08-05 17:50:29 -0700 | [diff] [blame] | 532 | mi = dumpMemInfo(fd.getFileDescriptor(), checkin, all, args); |
Dianne Hackborn | 0e3328f | 2011-07-17 13:31:17 -0700 | [diff] [blame] | 533 | } finally { |
| 534 | try { |
| 535 | fd.close(); |
| 536 | } catch (IOException e) { |
| 537 | // swallowed, not propagated back to the caller |
| 538 | } |
| 539 | } |
| 540 | } |
| 541 | reply.writeNoException(); |
| 542 | mi.writeToParcel(reply, 0); |
| 543 | return true; |
| 544 | } |
| 545 | |
| 546 | case DUMP_GFX_INFO_TRANSACTION: |
| 547 | { |
| 548 | data.enforceInterface(IApplicationThread.descriptor); |
| 549 | ParcelFileDescriptor fd = data.readFileDescriptor(); |
| 550 | String[] args = data.readStringArray(); |
| 551 | if (fd != null) { |
| 552 | try { |
| 553 | dumpGfxInfo(fd.getFileDescriptor(), args); |
| 554 | } finally { |
| 555 | try { |
| 556 | fd.close(); |
| 557 | } catch (IOException e) { |
| 558 | // swallowed, not propagated back to the caller |
| 559 | } |
| 560 | } |
| 561 | } |
| 562 | reply.writeNoException(); |
| 563 | return true; |
| 564 | } |
Jeff Brown | 6754ba2 | 2011-12-14 20:20:01 -0800 | [diff] [blame] | 565 | |
| 566 | case DUMP_DB_INFO_TRANSACTION: |
| 567 | { |
| 568 | data.enforceInterface(IApplicationThread.descriptor); |
| 569 | ParcelFileDescriptor fd = data.readFileDescriptor(); |
| 570 | String[] args = data.readStringArray(); |
| 571 | if (fd != null) { |
| 572 | try { |
| 573 | dumpDbInfo(fd.getFileDescriptor(), args); |
| 574 | } finally { |
| 575 | try { |
| 576 | fd.close(); |
| 577 | } catch (IOException e) { |
| 578 | // swallowed, not propagated back to the caller |
| 579 | } |
| 580 | } |
| 581 | } |
| 582 | reply.writeNoException(); |
| 583 | return true; |
| 584 | } |
Dianne Hackborn | 6ae8d18 | 2012-05-23 13:12:42 -0700 | [diff] [blame] | 585 | |
| 586 | case UNSTABLE_PROVIDER_DIED_TRANSACTION: |
| 587 | { |
| 588 | data.enforceInterface(IApplicationThread.descriptor); |
| 589 | IBinder provider = data.readStrongBinder(); |
| 590 | unstableProviderDied(provider); |
| 591 | reply.writeNoException(); |
| 592 | return true; |
| 593 | } |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 594 | |
| 595 | case REQUEST_ACTIVITY_EXTRAS_TRANSACTION: |
| 596 | { |
| 597 | data.enforceInterface(IApplicationThread.descriptor); |
| 598 | IBinder activityToken = data.readStrongBinder(); |
| 599 | IBinder requestToken = data.readStrongBinder(); |
| 600 | int requestType = data.readInt(); |
| 601 | requestActivityExtras(activityToken, requestToken, requestType); |
| 602 | reply.writeNoException(); |
| 603 | return true; |
| 604 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 605 | } |
| 606 | |
| 607 | return super.onTransact(code, data, reply, flags); |
| 608 | } |
| 609 | |
| 610 | public IBinder asBinder() |
| 611 | { |
| 612 | return this; |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | class ApplicationThreadProxy implements IApplicationThread { |
| 617 | private final IBinder mRemote; |
| 618 | |
| 619 | public ApplicationThreadProxy(IBinder remote) { |
| 620 | mRemote = remote; |
| 621 | } |
| 622 | |
| 623 | public final IBinder asBinder() { |
| 624 | return mRemote; |
| 625 | } |
| 626 | |
| 627 | public final void schedulePauseActivity(IBinder token, boolean finished, |
| 628 | boolean userLeaving, int configChanges) throws RemoteException { |
| 629 | Parcel data = Parcel.obtain(); |
| 630 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 631 | data.writeStrongBinder(token); |
| 632 | data.writeInt(finished ? 1 : 0); |
| 633 | data.writeInt(userLeaving ? 1 :0); |
| 634 | data.writeInt(configChanges); |
| 635 | mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null, |
| 636 | IBinder.FLAG_ONEWAY); |
| 637 | data.recycle(); |
| 638 | } |
| 639 | |
| 640 | public final void scheduleStopActivity(IBinder token, boolean showWindow, |
| 641 | int configChanges) throws RemoteException { |
| 642 | Parcel data = Parcel.obtain(); |
| 643 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 644 | data.writeStrongBinder(token); |
| 645 | data.writeInt(showWindow ? 1 : 0); |
| 646 | data.writeInt(configChanges); |
| 647 | mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null, |
| 648 | IBinder.FLAG_ONEWAY); |
| 649 | data.recycle(); |
| 650 | } |
| 651 | |
| 652 | public final void scheduleWindowVisibility(IBinder token, |
| 653 | boolean showWindow) throws RemoteException { |
| 654 | Parcel data = Parcel.obtain(); |
| 655 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 656 | data.writeStrongBinder(token); |
| 657 | data.writeInt(showWindow ? 1 : 0); |
| 658 | mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null, |
| 659 | IBinder.FLAG_ONEWAY); |
| 660 | data.recycle(); |
| 661 | } |
| 662 | |
Dianne Hackborn | 4eba96b | 2011-01-21 13:34:36 -0800 | [diff] [blame] | 663 | public final void scheduleSleeping(IBinder token, |
| 664 | boolean sleeping) throws RemoteException { |
| 665 | Parcel data = Parcel.obtain(); |
| 666 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 667 | data.writeStrongBinder(token); |
| 668 | data.writeInt(sleeping ? 1 : 0); |
| 669 | mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null, |
| 670 | IBinder.FLAG_ONEWAY); |
| 671 | data.recycle(); |
| 672 | } |
| 673 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 674 | public final void scheduleResumeActivity(IBinder token, boolean isForward) |
| 675 | throws RemoteException { |
| 676 | Parcel data = Parcel.obtain(); |
| 677 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 678 | data.writeStrongBinder(token); |
| 679 | data.writeInt(isForward ? 1 : 0); |
| 680 | mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null, |
| 681 | IBinder.FLAG_ONEWAY); |
| 682 | data.recycle(); |
| 683 | } |
| 684 | |
| 685 | public final void scheduleSendResult(IBinder token, List<ResultInfo> results) |
| 686 | throws RemoteException { |
| 687 | Parcel data = Parcel.obtain(); |
| 688 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 689 | data.writeStrongBinder(token); |
| 690 | data.writeTypedList(results); |
| 691 | mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null, |
| 692 | IBinder.FLAG_ONEWAY); |
| 693 | data.recycle(); |
| 694 | } |
| 695 | |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 696 | public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident, |
Dianne Hackborn | 58f42a5 | 2011-10-10 13:46:34 -0700 | [diff] [blame] | 697 | ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo, |
| 698 | Bundle state, List<ResultInfo> pendingResults, |
| 699 | List<Intent> pendingNewIntents, boolean notResumed, boolean isForward, |
| 700 | String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 701 | throws RemoteException { |
| 702 | Parcel data = Parcel.obtain(); |
| 703 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 704 | intent.writeToParcel(data, 0); |
| 705 | data.writeStrongBinder(token); |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 706 | data.writeInt(ident); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 707 | info.writeToParcel(data, 0); |
Dianne Hackborn | 58f42a5 | 2011-10-10 13:46:34 -0700 | [diff] [blame] | 708 | curConfig.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 709 | compatInfo.writeToParcel(data, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 710 | data.writeBundle(state); |
| 711 | data.writeTypedList(pendingResults); |
| 712 | data.writeTypedList(pendingNewIntents); |
| 713 | data.writeInt(notResumed ? 1 : 0); |
| 714 | data.writeInt(isForward ? 1 : 0); |
Dianne Hackborn | 62f20ec | 2011-08-15 17:40:28 -0700 | [diff] [blame] | 715 | data.writeString(profileName); |
| 716 | if (profileFd != null) { |
| 717 | data.writeInt(1); |
| 718 | profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 719 | } else { |
| 720 | data.writeInt(0); |
| 721 | } |
| 722 | data.writeInt(autoStopProfiler ? 1 : 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 723 | mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null, |
| 724 | IBinder.FLAG_ONEWAY); |
| 725 | data.recycle(); |
| 726 | } |
| 727 | |
| 728 | public final void scheduleRelaunchActivity(IBinder token, |
| 729 | List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, |
Dianne Hackborn | 871ecdc | 2009-12-11 15:24:33 -0800 | [diff] [blame] | 730 | int configChanges, boolean notResumed, Configuration config) |
| 731 | throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 732 | Parcel data = Parcel.obtain(); |
| 733 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 734 | data.writeStrongBinder(token); |
| 735 | data.writeTypedList(pendingResults); |
| 736 | data.writeTypedList(pendingNewIntents); |
| 737 | data.writeInt(configChanges); |
| 738 | data.writeInt(notResumed ? 1 : 0); |
Dianne Hackborn | 871ecdc | 2009-12-11 15:24:33 -0800 | [diff] [blame] | 739 | if (config != null) { |
| 740 | data.writeInt(1); |
| 741 | config.writeToParcel(data, 0); |
| 742 | } else { |
| 743 | data.writeInt(0); |
| 744 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 745 | mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null, |
| 746 | IBinder.FLAG_ONEWAY); |
| 747 | data.recycle(); |
| 748 | } |
| 749 | |
| 750 | public void scheduleNewIntent(List<Intent> intents, IBinder token) |
| 751 | throws RemoteException { |
| 752 | Parcel data = Parcel.obtain(); |
| 753 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 754 | data.writeTypedList(intents); |
| 755 | data.writeStrongBinder(token); |
| 756 | mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null, |
| 757 | IBinder.FLAG_ONEWAY); |
| 758 | data.recycle(); |
| 759 | } |
| 760 | |
| 761 | public final void scheduleDestroyActivity(IBinder token, boolean finishing, |
| 762 | int configChanges) throws RemoteException { |
| 763 | Parcel data = Parcel.obtain(); |
| 764 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 765 | data.writeStrongBinder(token); |
| 766 | data.writeInt(finishing ? 1 : 0); |
| 767 | data.writeInt(configChanges); |
| 768 | mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null, |
| 769 | IBinder.FLAG_ONEWAY); |
| 770 | data.recycle(); |
| 771 | } |
| 772 | |
| 773 | public final void scheduleReceiver(Intent intent, ActivityInfo info, |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 774 | CompatibilityInfo compatInfo, int resultCode, String resultData, |
Dianne Hackborn | 20e8098 | 2012-08-31 19:00:44 -0700 | [diff] [blame] | 775 | Bundle map, boolean sync, int sendingUser) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 776 | Parcel data = Parcel.obtain(); |
| 777 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 778 | intent.writeToParcel(data, 0); |
| 779 | info.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 780 | compatInfo.writeToParcel(data, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 781 | data.writeInt(resultCode); |
| 782 | data.writeString(resultData); |
| 783 | data.writeBundle(map); |
| 784 | data.writeInt(sync ? 1 : 0); |
Dianne Hackborn | 20e8098 | 2012-08-31 19:00:44 -0700 | [diff] [blame] | 785 | data.writeInt(sendingUser); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 786 | mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null, |
| 787 | IBinder.FLAG_ONEWAY); |
| 788 | data.recycle(); |
| 789 | } |
| 790 | |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 791 | public final void scheduleCreateBackupAgent(ApplicationInfo app, |
| 792 | CompatibilityInfo compatInfo, int backupMode) throws RemoteException { |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 793 | Parcel data = Parcel.obtain(); |
| 794 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 795 | app.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 796 | compatInfo.writeToParcel(data, 0); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 797 | data.writeInt(backupMode); |
Christopher Tate | d884f43 | 2009-07-23 14:40:13 -0700 | [diff] [blame] | 798 | mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null, |
| 799 | IBinder.FLAG_ONEWAY); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 800 | data.recycle(); |
| 801 | } |
| 802 | |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 803 | public final void scheduleDestroyBackupAgent(ApplicationInfo app, |
| 804 | CompatibilityInfo compatInfo) throws RemoteException { |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 805 | Parcel data = Parcel.obtain(); |
| 806 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 807 | app.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 808 | compatInfo.writeToParcel(data, 0); |
Christopher Tate | d884f43 | 2009-07-23 14:40:13 -0700 | [diff] [blame] | 809 | mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null, |
| 810 | IBinder.FLAG_ONEWAY); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 811 | data.recycle(); |
| 812 | } |
| 813 | |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 814 | public final void scheduleCreateService(IBinder token, ServiceInfo info, |
| 815 | CompatibilityInfo compatInfo) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 816 | Parcel data = Parcel.obtain(); |
| 817 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 818 | data.writeStrongBinder(token); |
| 819 | info.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 820 | compatInfo.writeToParcel(data, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 821 | mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null, |
| 822 | IBinder.FLAG_ONEWAY); |
| 823 | data.recycle(); |
| 824 | } |
| 825 | |
| 826 | public final void scheduleBindService(IBinder token, Intent intent, boolean rebind) |
| 827 | throws RemoteException { |
| 828 | Parcel data = Parcel.obtain(); |
| 829 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 830 | data.writeStrongBinder(token); |
| 831 | intent.writeToParcel(data, 0); |
| 832 | data.writeInt(rebind ? 1 : 0); |
| 833 | mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null, |
| 834 | IBinder.FLAG_ONEWAY); |
| 835 | data.recycle(); |
| 836 | } |
| 837 | |
| 838 | public final void scheduleUnbindService(IBinder token, Intent intent) |
| 839 | throws RemoteException { |
| 840 | Parcel data = Parcel.obtain(); |
| 841 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 842 | data.writeStrongBinder(token); |
| 843 | intent.writeToParcel(data, 0); |
| 844 | mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null, |
| 845 | IBinder.FLAG_ONEWAY); |
| 846 | data.recycle(); |
| 847 | } |
| 848 | |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 849 | public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId, |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 850 | int flags, Intent args) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 851 | Parcel data = Parcel.obtain(); |
| 852 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 853 | data.writeStrongBinder(token); |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 854 | data.writeInt(taskRemoved ? 1 : 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 855 | data.writeInt(startId); |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 856 | data.writeInt(flags); |
| 857 | if (args != null) { |
| 858 | data.writeInt(1); |
| 859 | args.writeToParcel(data, 0); |
| 860 | } else { |
| 861 | data.writeInt(0); |
| 862 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 863 | mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null, |
| 864 | IBinder.FLAG_ONEWAY); |
| 865 | data.recycle(); |
| 866 | } |
| 867 | |
| 868 | public final void scheduleStopService(IBinder token) |
| 869 | throws RemoteException { |
| 870 | Parcel data = Parcel.obtain(); |
| 871 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 872 | data.writeStrongBinder(token); |
| 873 | mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null, |
| 874 | IBinder.FLAG_ONEWAY); |
| 875 | data.recycle(); |
| 876 | } |
| 877 | |
| 878 | public final void bindApplication(String packageName, ApplicationInfo info, |
Dianne Hackborn | 62f20ec | 2011-08-15 17:40:28 -0700 | [diff] [blame] | 879 | List<ProviderInfo> providers, ComponentName testName, String profileName, |
| 880 | ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs, |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 881 | IInstrumentationWatcher testWatcher, |
| 882 | IUiAutomationConnection uiAutomationConnection, int debugMode, |
| 883 | boolean openGlTrace, boolean restrictedBackupMode, boolean persistent, |
| 884 | Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services, |
| 885 | Bundle coreSettings) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 886 | Parcel data = Parcel.obtain(); |
| 887 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 888 | data.writeString(packageName); |
| 889 | info.writeToParcel(data, 0); |
| 890 | data.writeTypedList(providers); |
| 891 | if (testName == null) { |
| 892 | data.writeInt(0); |
| 893 | } else { |
| 894 | data.writeInt(1); |
| 895 | testName.writeToParcel(data, 0); |
| 896 | } |
| 897 | data.writeString(profileName); |
Dianne Hackborn | 62f20ec | 2011-08-15 17:40:28 -0700 | [diff] [blame] | 898 | if (profileFd != null) { |
| 899 | data.writeInt(1); |
| 900 | profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 901 | } else { |
| 902 | data.writeInt(0); |
| 903 | } |
| 904 | data.writeInt(autoStopProfiler ? 1 : 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 905 | data.writeBundle(testArgs); |
| 906 | data.writeStrongInterface(testWatcher); |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 907 | data.writeStrongInterface(uiAutomationConnection); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 908 | data.writeInt(debugMode); |
Siva Velusamy | 92a8b22 | 2012-03-09 16:24:04 -0800 | [diff] [blame] | 909 | data.writeInt(openGlTrace ? 1 : 0); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 910 | data.writeInt(restrictedBackupMode ? 1 : 0); |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 911 | data.writeInt(persistent ? 1 : 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 912 | config.writeToParcel(data, 0); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 913 | compatInfo.writeToParcel(data, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 914 | data.writeMap(services); |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 915 | data.writeBundle(coreSettings); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 916 | mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null, |
| 917 | IBinder.FLAG_ONEWAY); |
| 918 | data.recycle(); |
| 919 | } |
| 920 | |
| 921 | public final void scheduleExit() throws RemoteException { |
| 922 | Parcel data = Parcel.obtain(); |
| 923 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 924 | mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null, |
| 925 | IBinder.FLAG_ONEWAY); |
| 926 | data.recycle(); |
| 927 | } |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 928 | |
| 929 | public final void scheduleSuicide() throws RemoteException { |
| 930 | Parcel data = Parcel.obtain(); |
| 931 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 932 | mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null, |
| 933 | IBinder.FLAG_ONEWAY); |
| 934 | data.recycle(); |
| 935 | } |
| 936 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 937 | public final void requestThumbnail(IBinder token) |
| 938 | throws RemoteException { |
| 939 | Parcel data = Parcel.obtain(); |
| 940 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 941 | data.writeStrongBinder(token); |
| 942 | mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null, |
| 943 | IBinder.FLAG_ONEWAY); |
| 944 | data.recycle(); |
| 945 | } |
| 946 | |
| 947 | public final void scheduleConfigurationChanged(Configuration config) |
| 948 | throws RemoteException { |
| 949 | Parcel data = Parcel.obtain(); |
| 950 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 951 | config.writeToParcel(data, 0); |
| 952 | mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null, |
| 953 | IBinder.FLAG_ONEWAY); |
| 954 | data.recycle(); |
| 955 | } |
| 956 | |
| 957 | public void updateTimeZone() throws RemoteException { |
| 958 | Parcel data = Parcel.obtain(); |
| 959 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 960 | mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null, |
| 961 | IBinder.FLAG_ONEWAY); |
| 962 | data.recycle(); |
| 963 | } |
| 964 | |
Robert Greenwalt | 03595d0 | 2010-11-02 14:08:23 -0700 | [diff] [blame] | 965 | public void clearDnsCache() throws RemoteException { |
| 966 | Parcel data = Parcel.obtain(); |
| 967 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 968 | mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null, |
| 969 | IBinder.FLAG_ONEWAY); |
| 970 | data.recycle(); |
| 971 | } |
| 972 | |
Robert Greenwalt | 434203a | 2010-10-11 16:00:27 -0700 | [diff] [blame] | 973 | public void setHttpProxy(String proxy, String port, String exclList) throws RemoteException { |
| 974 | Parcel data = Parcel.obtain(); |
| 975 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 976 | data.writeString(proxy); |
| 977 | data.writeString(port); |
| 978 | data.writeString(exclList); |
| 979 | mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
| 980 | data.recycle(); |
| 981 | } |
| 982 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 983 | public void processInBackground() throws RemoteException { |
| 984 | Parcel data = Parcel.obtain(); |
| 985 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 986 | mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null, |
| 987 | IBinder.FLAG_ONEWAY); |
| 988 | data.recycle(); |
| 989 | } |
| 990 | |
| 991 | public void dumpService(FileDescriptor fd, IBinder token, String[] args) |
| 992 | throws RemoteException { |
| 993 | Parcel data = Parcel.obtain(); |
| 994 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 995 | data.writeFileDescriptor(fd); |
| 996 | data.writeStrongBinder(token); |
| 997 | data.writeStringArray(args); |
Dianne Hackborn | e17aeb3 | 2011-04-07 15:11:57 -0700 | [diff] [blame] | 998 | 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] | 999 | data.recycle(); |
| 1000 | } |
| 1001 | |
Marco Nelissen | 18cb287 | 2011-11-15 11:19:53 -0800 | [diff] [blame] | 1002 | public void dumpProvider(FileDescriptor fd, IBinder token, String[] args) |
| 1003 | throws RemoteException { |
| 1004 | Parcel data = Parcel.obtain(); |
| 1005 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1006 | data.writeFileDescriptor(fd); |
| 1007 | data.writeStrongBinder(token); |
| 1008 | data.writeStringArray(args); |
| 1009 | mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
| 1010 | data.recycle(); |
| 1011 | } |
| 1012 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1013 | public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, |
Dianne Hackborn | 20e8098 | 2012-08-31 19:00:44 -0700 | [diff] [blame] | 1014 | int resultCode, String dataStr, Bundle extras, boolean ordered, |
| 1015 | boolean sticky, int sendingUser) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1016 | Parcel data = Parcel.obtain(); |
| 1017 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1018 | data.writeStrongBinder(receiver.asBinder()); |
| 1019 | intent.writeToParcel(data, 0); |
| 1020 | data.writeInt(resultCode); |
| 1021 | data.writeString(dataStr); |
| 1022 | data.writeBundle(extras); |
| 1023 | data.writeInt(ordered ? 1 : 0); |
Dianne Hackborn | 68d881c | 2009-10-05 13:58:17 -0700 | [diff] [blame] | 1024 | data.writeInt(sticky ? 1 : 0); |
Dianne Hackborn | 20e8098 | 2012-08-31 19:00:44 -0700 | [diff] [blame] | 1025 | data.writeInt(sendingUser); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1026 | mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null, |
| 1027 | IBinder.FLAG_ONEWAY); |
| 1028 | data.recycle(); |
| 1029 | } |
| 1030 | |
| 1031 | public final void scheduleLowMemory() throws RemoteException { |
| 1032 | Parcel data = Parcel.obtain(); |
| 1033 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1034 | mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null, |
| 1035 | IBinder.FLAG_ONEWAY); |
| 1036 | data.recycle(); |
| 1037 | } |
| 1038 | |
| 1039 | public final void scheduleActivityConfigurationChanged( |
| 1040 | IBinder token) throws RemoteException { |
| 1041 | Parcel data = Parcel.obtain(); |
| 1042 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1043 | data.writeStrongBinder(token); |
| 1044 | mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null, |
| 1045 | IBinder.FLAG_ONEWAY); |
| 1046 | data.recycle(); |
| 1047 | } |
| 1048 | |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 1049 | public void profilerControl(boolean start, String path, |
Romain Guy | 7eabe55 | 2011-07-21 14:56:34 -0700 | [diff] [blame] | 1050 | ParcelFileDescriptor fd, int profileType) throws RemoteException { |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 1051 | Parcel data = Parcel.obtain(); |
| 1052 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1053 | data.writeInt(start ? 1 : 0); |
Romain Guy | 9a8c5ce | 2011-07-21 18:04:29 -0700 | [diff] [blame] | 1054 | data.writeInt(profileType); |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 1055 | data.writeString(path); |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 1056 | if (fd != null) { |
| 1057 | data.writeInt(1); |
| 1058 | fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 1059 | } else { |
| 1060 | data.writeInt(0); |
| 1061 | } |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 1062 | mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null, |
| 1063 | IBinder.FLAG_ONEWAY); |
| 1064 | data.recycle(); |
| 1065 | } |
Dianne Hackborn | 06de2ea | 2009-05-21 12:56:43 -0700 | [diff] [blame] | 1066 | |
| 1067 | public void setSchedulingGroup(int group) throws RemoteException { |
| 1068 | Parcel data = Parcel.obtain(); |
| 1069 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1070 | data.writeInt(group); |
| 1071 | mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null, |
| 1072 | IBinder.FLAG_ONEWAY); |
| 1073 | data.recycle(); |
| 1074 | } |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 1075 | |
| 1076 | public void getMemoryInfo(Debug.MemoryInfo outInfo) throws RemoteException { |
| 1077 | Parcel data = Parcel.obtain(); |
| 1078 | Parcel reply = Parcel.obtain(); |
| 1079 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1080 | mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0); |
| 1081 | reply.readException(); |
| 1082 | outInfo.readFromParcel(reply); |
| 1083 | data.recycle(); |
| 1084 | reply.recycle(); |
| 1085 | } |
Dianne Hackborn | 4416c3d | 2010-05-04 17:22:49 -0700 | [diff] [blame] | 1086 | |
| 1087 | public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException { |
| 1088 | Parcel data = Parcel.obtain(); |
| 1089 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1090 | data.writeInt(cmd); |
| 1091 | data.writeStringArray(packages); |
| 1092 | mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null, |
| 1093 | IBinder.FLAG_ONEWAY); |
| 1094 | data.recycle(); |
| 1095 | |
| 1096 | } |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 1097 | |
| 1098 | public void scheduleCrash(String msg) throws RemoteException { |
| 1099 | Parcel data = Parcel.obtain(); |
| 1100 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1101 | data.writeString(msg); |
| 1102 | mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null, |
| 1103 | IBinder.FLAG_ONEWAY); |
| 1104 | data.recycle(); |
| 1105 | |
| 1106 | } |
Andy McFadden | 824c510 | 2010-07-09 16:26:57 -0700 | [diff] [blame] | 1107 | |
| 1108 | public void dumpHeap(boolean managed, String path, |
| 1109 | ParcelFileDescriptor fd) throws RemoteException { |
| 1110 | Parcel data = Parcel.obtain(); |
| 1111 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1112 | data.writeInt(managed ? 1 : 0); |
| 1113 | data.writeString(path); |
| 1114 | if (fd != null) { |
| 1115 | data.writeInt(1); |
| 1116 | fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 1117 | } else { |
| 1118 | data.writeInt(0); |
| 1119 | } |
| 1120 | mRemote.transact(DUMP_HEAP_TRANSACTION, data, null, |
| 1121 | IBinder.FLAG_ONEWAY); |
| 1122 | data.recycle(); |
| 1123 | } |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 1124 | |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 1125 | public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args) |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 1126 | throws RemoteException { |
| 1127 | Parcel data = Parcel.obtain(); |
| 1128 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1129 | data.writeFileDescriptor(fd); |
| 1130 | data.writeStrongBinder(token); |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 1131 | data.writeString(prefix); |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 1132 | data.writeStringArray(args); |
Dianne Hackborn | e17aeb3 | 2011-04-07 15:11:57 -0700 | [diff] [blame] | 1133 | mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
Dianne Hackborn | 625ac27 | 2010-09-17 18:29:22 -0700 | [diff] [blame] | 1134 | data.recycle(); |
| 1135 | } |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 1136 | |
| 1137 | public void setCoreSettings(Bundle coreSettings) throws RemoteException { |
| 1138 | Parcel data = Parcel.obtain(); |
| 1139 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1140 | data.writeBundle(coreSettings); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 1141 | mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
| 1142 | } |
| 1143 | |
| 1144 | public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) |
| 1145 | throws RemoteException { |
| 1146 | Parcel data = Parcel.obtain(); |
| 1147 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1148 | data.writeString(pkg); |
| 1149 | info.writeToParcel(data, 0); |
| 1150 | mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null, |
| 1151 | IBinder.FLAG_ONEWAY); |
Svetoslav Ganov | 54d068e | 2011-03-02 12:58:40 -0800 | [diff] [blame] | 1152 | } |
Dianne Hackborn | ce86ba8 | 2011-07-13 19:33:41 -0700 | [diff] [blame] | 1153 | |
| 1154 | public void scheduleTrimMemory(int level) throws RemoteException { |
| 1155 | Parcel data = Parcel.obtain(); |
| 1156 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1157 | data.writeInt(level); |
| 1158 | mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null, |
| 1159 | IBinder.FLAG_ONEWAY); |
| 1160 | } |
Dianne Hackborn | 0e3328f | 2011-07-17 13:31:17 -0700 | [diff] [blame] | 1161 | |
Dianne Hackborn | b437e09 | 2011-08-05 17:50:29 -0700 | [diff] [blame] | 1162 | public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, boolean checkin, boolean all, |
| 1163 | String[] args) throws RemoteException { |
Dianne Hackborn | 0e3328f | 2011-07-17 13:31:17 -0700 | [diff] [blame] | 1164 | Parcel data = Parcel.obtain(); |
| 1165 | Parcel reply = Parcel.obtain(); |
| 1166 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1167 | data.writeFileDescriptor(fd); |
Dianne Hackborn | b437e09 | 2011-08-05 17:50:29 -0700 | [diff] [blame] | 1168 | data.writeInt(checkin ? 1 : 0); |
| 1169 | data.writeInt(all ? 1 : 0); |
Dianne Hackborn | 0e3328f | 2011-07-17 13:31:17 -0700 | [diff] [blame] | 1170 | data.writeStringArray(args); |
| 1171 | mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0); |
| 1172 | reply.readException(); |
| 1173 | Debug.MemoryInfo info = new Debug.MemoryInfo(); |
| 1174 | info.readFromParcel(reply); |
| 1175 | data.recycle(); |
| 1176 | reply.recycle(); |
| 1177 | return info; |
| 1178 | } |
| 1179 | |
| 1180 | public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException { |
| 1181 | Parcel data = Parcel.obtain(); |
| 1182 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1183 | data.writeFileDescriptor(fd); |
| 1184 | data.writeStringArray(args); |
| 1185 | mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
| 1186 | data.recycle(); |
| 1187 | } |
Jeff Brown | 6754ba2 | 2011-12-14 20:20:01 -0800 | [diff] [blame] | 1188 | |
| 1189 | public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException { |
| 1190 | Parcel data = Parcel.obtain(); |
| 1191 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1192 | data.writeFileDescriptor(fd); |
| 1193 | data.writeStringArray(args); |
| 1194 | mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
| 1195 | data.recycle(); |
| 1196 | } |
Dianne Hackborn | 6ae8d18 | 2012-05-23 13:12:42 -0700 | [diff] [blame] | 1197 | |
| 1198 | public void unstableProviderDied(IBinder provider) throws RemoteException { |
| 1199 | Parcel data = Parcel.obtain(); |
| 1200 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1201 | data.writeStrongBinder(provider); |
| 1202 | mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
| 1203 | data.recycle(); |
| 1204 | } |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 1205 | |
| 1206 | public void requestActivityExtras(IBinder activityToken, IBinder requestToken, int requestType) |
| 1207 | throws RemoteException { |
| 1208 | Parcel data = Parcel.obtain(); |
| 1209 | data.writeInterfaceToken(IApplicationThread.descriptor); |
| 1210 | data.writeStrongBinder(activityToken); |
| 1211 | data.writeStrongBinder(requestToken); |
| 1212 | data.writeInt(requestType); |
| 1213 | mRemote.transact(REQUEST_ACTIVITY_EXTRAS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); |
| 1214 | data.recycle(); |
| 1215 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1216 | } |