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