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.ContentResolver; |
| 21 | import android.content.Intent; |
| 22 | import android.content.IntentFilter; |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame^] | 23 | import android.content.pm.ApplicationInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | import android.content.pm.ConfigurationInfo; |
| 25 | import android.content.pm.IPackageDataObserver; |
| 26 | import android.content.res.Configuration; |
| 27 | import android.graphics.Bitmap; |
| 28 | import android.net.Uri; |
| 29 | import android.os.Binder; |
| 30 | import android.os.Bundle; |
| 31 | import android.os.Parcelable; |
| 32 | import android.os.ParcelFileDescriptor; |
| 33 | import android.os.RemoteException; |
| 34 | import android.os.IBinder; |
| 35 | import android.os.Parcel; |
| 36 | import android.os.ServiceManager; |
| 37 | import android.text.TextUtils; |
| 38 | import android.util.Config; |
| 39 | import android.util.Log; |
| 40 | |
| 41 | import java.io.FileNotFoundException; |
| 42 | import java.io.FileDescriptor; |
| 43 | import java.io.IOException; |
| 44 | import java.util.ArrayList; |
| 45 | import java.util.List; |
| 46 | |
| 47 | /** {@hide} */ |
| 48 | public abstract class ActivityManagerNative extends Binder implements IActivityManager |
| 49 | { |
| 50 | /** |
| 51 | * Cast a Binder object into an activity manager interface, generating |
| 52 | * a proxy if needed. |
| 53 | */ |
| 54 | static public IActivityManager asInterface(IBinder obj) |
| 55 | { |
| 56 | if (obj == null) { |
| 57 | return null; |
| 58 | } |
| 59 | IActivityManager in = |
| 60 | (IActivityManager)obj.queryLocalInterface(descriptor); |
| 61 | if (in != null) { |
| 62 | return in; |
| 63 | } |
| 64 | |
| 65 | return new ActivityManagerProxy(obj); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Retrieve the system's default/global activity manager. |
| 70 | */ |
| 71 | static public IActivityManager getDefault() |
| 72 | { |
| 73 | if (gDefault != null) { |
| 74 | //if (Config.LOGV) Log.v( |
| 75 | // "ActivityManager", "returning cur default = " + gDefault); |
| 76 | return gDefault; |
| 77 | } |
| 78 | IBinder b = ServiceManager.getService("activity"); |
| 79 | if (Config.LOGV) Log.v( |
| 80 | "ActivityManager", "default service binder = " + b); |
| 81 | gDefault = asInterface(b); |
| 82 | if (Config.LOGV) Log.v( |
| 83 | "ActivityManager", "default service = " + gDefault); |
| 84 | return gDefault; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Convenience for checking whether the system is ready. For internal use only. |
| 89 | */ |
| 90 | static public boolean isSystemReady() { |
| 91 | if (!sSystemReady) { |
| 92 | sSystemReady = getDefault().testIsSystemReady(); |
| 93 | } |
| 94 | return sSystemReady; |
| 95 | } |
| 96 | static boolean sSystemReady = false; |
| 97 | |
| 98 | /** |
| 99 | * Convenience for sending a sticky broadcast. For internal use only. |
| 100 | * If you don't care about permission, use null. |
| 101 | */ |
| 102 | static public void broadcastStickyIntent(Intent intent, String permission) |
| 103 | { |
| 104 | try { |
| 105 | getDefault().broadcastIntent( |
| 106 | null, intent, null, null, Activity.RESULT_OK, null, null, |
| 107 | null /*permission*/, false, true); |
| 108 | } catch (RemoteException ex) { |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | static public void noteWakeupAlarm(PendingIntent ps) { |
| 113 | try { |
| 114 | getDefault().noteWakeupAlarm(ps.getTarget()); |
| 115 | } catch (RemoteException ex) { |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | public ActivityManagerNative() |
| 120 | { |
| 121 | attachInterface(this, descriptor); |
| 122 | } |
| 123 | |
| 124 | public boolean onTransact(int code, Parcel data, Parcel reply, int flags) |
| 125 | throws RemoteException { |
| 126 | switch (code) { |
| 127 | case START_ACTIVITY_TRANSACTION: |
| 128 | { |
| 129 | data.enforceInterface(IActivityManager.descriptor); |
| 130 | IBinder b = data.readStrongBinder(); |
| 131 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 132 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 133 | String resolvedType = data.readString(); |
| 134 | Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR); |
| 135 | int grantedMode = data.readInt(); |
| 136 | IBinder resultTo = data.readStrongBinder(); |
| 137 | String resultWho = data.readString(); |
| 138 | int requestCode = data.readInt(); |
| 139 | boolean onlyIfNeeded = data.readInt() != 0; |
| 140 | boolean debug = data.readInt() != 0; |
| 141 | int result = startActivity(app, intent, resolvedType, |
| 142 | grantedUriPermissions, grantedMode, resultTo, resultWho, |
| 143 | requestCode, onlyIfNeeded, debug); |
| 144 | reply.writeNoException(); |
| 145 | reply.writeInt(result); |
| 146 | return true; |
| 147 | } |
| 148 | |
| 149 | case START_NEXT_MATCHING_ACTIVITY_TRANSACTION: |
| 150 | { |
| 151 | data.enforceInterface(IActivityManager.descriptor); |
| 152 | IBinder callingActivity = data.readStrongBinder(); |
| 153 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 154 | boolean result = startNextMatchingActivity(callingActivity, intent); |
| 155 | reply.writeNoException(); |
| 156 | reply.writeInt(result ? 1 : 0); |
| 157 | return true; |
| 158 | } |
| 159 | |
| 160 | case FINISH_ACTIVITY_TRANSACTION: { |
| 161 | data.enforceInterface(IActivityManager.descriptor); |
| 162 | IBinder token = data.readStrongBinder(); |
| 163 | Intent resultData = null; |
| 164 | int resultCode = data.readInt(); |
| 165 | if (data.readInt() != 0) { |
| 166 | resultData = Intent.CREATOR.createFromParcel(data); |
| 167 | } |
| 168 | boolean res = finishActivity(token, resultCode, resultData); |
| 169 | reply.writeNoException(); |
| 170 | reply.writeInt(res ? 1 : 0); |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | case FINISH_SUB_ACTIVITY_TRANSACTION: { |
| 175 | data.enforceInterface(IActivityManager.descriptor); |
| 176 | IBinder token = data.readStrongBinder(); |
| 177 | String resultWho = data.readString(); |
| 178 | int requestCode = data.readInt(); |
| 179 | finishSubActivity(token, resultWho, requestCode); |
| 180 | reply.writeNoException(); |
| 181 | return true; |
| 182 | } |
| 183 | |
| 184 | case REGISTER_RECEIVER_TRANSACTION: |
| 185 | { |
| 186 | data.enforceInterface(IActivityManager.descriptor); |
| 187 | IBinder b = data.readStrongBinder(); |
| 188 | IApplicationThread app = |
| 189 | b != null ? ApplicationThreadNative.asInterface(b) : null; |
| 190 | b = data.readStrongBinder(); |
| 191 | IIntentReceiver rec |
| 192 | = b != null ? IIntentReceiver.Stub.asInterface(b) : null; |
| 193 | IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data); |
| 194 | String perm = data.readString(); |
| 195 | Intent intent = registerReceiver(app, rec, filter, perm); |
| 196 | reply.writeNoException(); |
| 197 | if (intent != null) { |
| 198 | reply.writeInt(1); |
| 199 | intent.writeToParcel(reply, 0); |
| 200 | } else { |
| 201 | reply.writeInt(0); |
| 202 | } |
| 203 | return true; |
| 204 | } |
| 205 | |
| 206 | case UNREGISTER_RECEIVER_TRANSACTION: |
| 207 | { |
| 208 | data.enforceInterface(IActivityManager.descriptor); |
| 209 | IBinder b = data.readStrongBinder(); |
| 210 | if (b == null) { |
| 211 | return true; |
| 212 | } |
| 213 | IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b); |
| 214 | unregisterReceiver(rec); |
| 215 | reply.writeNoException(); |
| 216 | return true; |
| 217 | } |
| 218 | |
| 219 | case BROADCAST_INTENT_TRANSACTION: |
| 220 | { |
| 221 | data.enforceInterface(IActivityManager.descriptor); |
| 222 | IBinder b = data.readStrongBinder(); |
| 223 | IApplicationThread app = |
| 224 | b != null ? ApplicationThreadNative.asInterface(b) : null; |
| 225 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 226 | String resolvedType = data.readString(); |
| 227 | b = data.readStrongBinder(); |
| 228 | IIntentReceiver resultTo = |
| 229 | b != null ? IIntentReceiver.Stub.asInterface(b) : null; |
| 230 | int resultCode = data.readInt(); |
| 231 | String resultData = data.readString(); |
| 232 | Bundle resultExtras = data.readBundle(); |
| 233 | String perm = data.readString(); |
| 234 | boolean serialized = data.readInt() != 0; |
| 235 | boolean sticky = data.readInt() != 0; |
| 236 | int res = broadcastIntent(app, intent, resolvedType, resultTo, |
| 237 | resultCode, resultData, resultExtras, perm, |
| 238 | serialized, sticky); |
| 239 | reply.writeNoException(); |
| 240 | reply.writeInt(res); |
| 241 | return true; |
| 242 | } |
| 243 | |
| 244 | case UNBROADCAST_INTENT_TRANSACTION: |
| 245 | { |
| 246 | data.enforceInterface(IActivityManager.descriptor); |
| 247 | IBinder b = data.readStrongBinder(); |
| 248 | IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null; |
| 249 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 250 | unbroadcastIntent(app, intent); |
| 251 | reply.writeNoException(); |
| 252 | return true; |
| 253 | } |
| 254 | |
| 255 | case FINISH_RECEIVER_TRANSACTION: { |
| 256 | data.enforceInterface(IActivityManager.descriptor); |
| 257 | IBinder who = data.readStrongBinder(); |
| 258 | int resultCode = data.readInt(); |
| 259 | String resultData = data.readString(); |
| 260 | Bundle resultExtras = data.readBundle(); |
| 261 | boolean resultAbort = data.readInt() != 0; |
| 262 | if (who != null) { |
| 263 | finishReceiver(who, resultCode, resultData, resultExtras, resultAbort); |
| 264 | } |
| 265 | reply.writeNoException(); |
| 266 | return true; |
| 267 | } |
| 268 | |
| 269 | case SET_PERSISTENT_TRANSACTION: { |
| 270 | data.enforceInterface(IActivityManager.descriptor); |
| 271 | IBinder token = data.readStrongBinder(); |
| 272 | boolean isPersistent = data.readInt() != 0; |
| 273 | if (token != null) { |
| 274 | setPersistent(token, isPersistent); |
| 275 | } |
| 276 | reply.writeNoException(); |
| 277 | return true; |
| 278 | } |
| 279 | |
| 280 | case ATTACH_APPLICATION_TRANSACTION: { |
| 281 | data.enforceInterface(IActivityManager.descriptor); |
| 282 | IApplicationThread app = ApplicationThreadNative.asInterface( |
| 283 | data.readStrongBinder()); |
| 284 | if (app != null) { |
| 285 | attachApplication(app); |
| 286 | } |
| 287 | reply.writeNoException(); |
| 288 | return true; |
| 289 | } |
| 290 | |
| 291 | case ACTIVITY_IDLE_TRANSACTION: { |
| 292 | data.enforceInterface(IActivityManager.descriptor); |
| 293 | IBinder token = data.readStrongBinder(); |
| 294 | if (token != null) { |
| 295 | activityIdle(token); |
| 296 | } |
| 297 | reply.writeNoException(); |
| 298 | return true; |
| 299 | } |
| 300 | |
| 301 | case ACTIVITY_PAUSED_TRANSACTION: { |
| 302 | data.enforceInterface(IActivityManager.descriptor); |
| 303 | IBinder token = data.readStrongBinder(); |
| 304 | Bundle map = data.readBundle(); |
| 305 | activityPaused(token, map); |
| 306 | reply.writeNoException(); |
| 307 | return true; |
| 308 | } |
| 309 | |
| 310 | case ACTIVITY_STOPPED_TRANSACTION: { |
| 311 | data.enforceInterface(IActivityManager.descriptor); |
| 312 | IBinder token = data.readStrongBinder(); |
| 313 | Bitmap thumbnail = data.readInt() != 0 |
| 314 | ? Bitmap.CREATOR.createFromParcel(data) : null; |
| 315 | CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); |
| 316 | activityStopped(token, thumbnail, description); |
| 317 | reply.writeNoException(); |
| 318 | return true; |
| 319 | } |
| 320 | |
| 321 | case ACTIVITY_DESTROYED_TRANSACTION: { |
| 322 | data.enforceInterface(IActivityManager.descriptor); |
| 323 | IBinder token = data.readStrongBinder(); |
| 324 | activityDestroyed(token); |
| 325 | reply.writeNoException(); |
| 326 | return true; |
| 327 | } |
| 328 | |
| 329 | case GET_CALLING_PACKAGE_TRANSACTION: { |
| 330 | data.enforceInterface(IActivityManager.descriptor); |
| 331 | IBinder token = data.readStrongBinder(); |
| 332 | String res = token != null ? getCallingPackage(token) : null; |
| 333 | reply.writeNoException(); |
| 334 | reply.writeString(res); |
| 335 | return true; |
| 336 | } |
| 337 | |
| 338 | case GET_CALLING_ACTIVITY_TRANSACTION: { |
| 339 | data.enforceInterface(IActivityManager.descriptor); |
| 340 | IBinder token = data.readStrongBinder(); |
| 341 | ComponentName cn = getCallingActivity(token); |
| 342 | reply.writeNoException(); |
| 343 | ComponentName.writeToParcel(cn, reply); |
| 344 | return true; |
| 345 | } |
| 346 | |
| 347 | case GET_TASKS_TRANSACTION: { |
| 348 | data.enforceInterface(IActivityManager.descriptor); |
| 349 | int maxNum = data.readInt(); |
| 350 | int fl = data.readInt(); |
| 351 | IBinder receiverBinder = data.readStrongBinder(); |
| 352 | IThumbnailReceiver receiver = receiverBinder != null |
| 353 | ? IThumbnailReceiver.Stub.asInterface(receiverBinder) |
| 354 | : null; |
| 355 | List list = getTasks(maxNum, fl, receiver); |
| 356 | reply.writeNoException(); |
| 357 | int N = list != null ? list.size() : -1; |
| 358 | reply.writeInt(N); |
| 359 | int i; |
| 360 | for (i=0; i<N; i++) { |
| 361 | ActivityManager.RunningTaskInfo info = |
| 362 | (ActivityManager.RunningTaskInfo)list.get(i); |
| 363 | info.writeToParcel(reply, 0); |
| 364 | } |
| 365 | return true; |
| 366 | } |
| 367 | |
| 368 | case GET_RECENT_TASKS_TRANSACTION: { |
| 369 | data.enforceInterface(IActivityManager.descriptor); |
| 370 | int maxNum = data.readInt(); |
| 371 | int fl = data.readInt(); |
| 372 | List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum, |
| 373 | fl); |
| 374 | reply.writeNoException(); |
| 375 | reply.writeTypedList(list); |
| 376 | return true; |
| 377 | } |
| 378 | |
| 379 | case GET_SERVICES_TRANSACTION: { |
| 380 | data.enforceInterface(IActivityManager.descriptor); |
| 381 | int maxNum = data.readInt(); |
| 382 | int fl = data.readInt(); |
| 383 | List list = getServices(maxNum, fl); |
| 384 | reply.writeNoException(); |
| 385 | int N = list != null ? list.size() : -1; |
| 386 | reply.writeInt(N); |
| 387 | int i; |
| 388 | for (i=0; i<N; i++) { |
| 389 | ActivityManager.RunningServiceInfo info = |
| 390 | (ActivityManager.RunningServiceInfo)list.get(i); |
| 391 | info.writeToParcel(reply, 0); |
| 392 | } |
| 393 | return true; |
| 394 | } |
| 395 | |
| 396 | case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: { |
| 397 | data.enforceInterface(IActivityManager.descriptor); |
| 398 | List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState(); |
| 399 | reply.writeNoException(); |
| 400 | reply.writeTypedList(list); |
| 401 | return true; |
| 402 | } |
| 403 | |
| 404 | case GET_RUNNING_APP_PROCESSES_TRANSACTION: { |
| 405 | data.enforceInterface(IActivityManager.descriptor); |
| 406 | List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses(); |
| 407 | reply.writeNoException(); |
| 408 | reply.writeTypedList(list); |
| 409 | return true; |
| 410 | } |
| 411 | |
| 412 | case MOVE_TASK_TO_FRONT_TRANSACTION: { |
| 413 | data.enforceInterface(IActivityManager.descriptor); |
| 414 | int task = data.readInt(); |
| 415 | moveTaskToFront(task); |
| 416 | reply.writeNoException(); |
| 417 | return true; |
| 418 | } |
| 419 | |
| 420 | case MOVE_TASK_TO_BACK_TRANSACTION: { |
| 421 | data.enforceInterface(IActivityManager.descriptor); |
| 422 | int task = data.readInt(); |
| 423 | moveTaskToBack(task); |
| 424 | reply.writeNoException(); |
| 425 | return true; |
| 426 | } |
| 427 | |
| 428 | case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: { |
| 429 | data.enforceInterface(IActivityManager.descriptor); |
| 430 | IBinder token = data.readStrongBinder(); |
| 431 | boolean nonRoot = data.readInt() != 0; |
| 432 | boolean res = moveActivityTaskToBack(token, nonRoot); |
| 433 | reply.writeNoException(); |
| 434 | reply.writeInt(res ? 1 : 0); |
| 435 | return true; |
| 436 | } |
| 437 | |
| 438 | case MOVE_TASK_BACKWARDS_TRANSACTION: { |
| 439 | data.enforceInterface(IActivityManager.descriptor); |
| 440 | int task = data.readInt(); |
| 441 | moveTaskBackwards(task); |
| 442 | reply.writeNoException(); |
| 443 | return true; |
| 444 | } |
| 445 | |
| 446 | case GET_TASK_FOR_ACTIVITY_TRANSACTION: { |
| 447 | data.enforceInterface(IActivityManager.descriptor); |
| 448 | IBinder token = data.readStrongBinder(); |
| 449 | boolean onlyRoot = data.readInt() != 0; |
| 450 | int res = token != null |
| 451 | ? getTaskForActivity(token, onlyRoot) : -1; |
| 452 | reply.writeNoException(); |
| 453 | reply.writeInt(res); |
| 454 | return true; |
| 455 | } |
| 456 | |
| 457 | case FINISH_OTHER_INSTANCES_TRANSACTION: { |
| 458 | data.enforceInterface(IActivityManager.descriptor); |
| 459 | IBinder token = data.readStrongBinder(); |
| 460 | ComponentName className = ComponentName.readFromParcel(data); |
| 461 | finishOtherInstances(token, className); |
| 462 | reply.writeNoException(); |
| 463 | return true; |
| 464 | } |
| 465 | |
| 466 | case REPORT_THUMBNAIL_TRANSACTION: { |
| 467 | data.enforceInterface(IActivityManager.descriptor); |
| 468 | IBinder token = data.readStrongBinder(); |
| 469 | Bitmap thumbnail = data.readInt() != 0 |
| 470 | ? Bitmap.CREATOR.createFromParcel(data) : null; |
| 471 | CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); |
| 472 | reportThumbnail(token, thumbnail, description); |
| 473 | reply.writeNoException(); |
| 474 | return true; |
| 475 | } |
| 476 | |
| 477 | case GET_CONTENT_PROVIDER_TRANSACTION: { |
| 478 | data.enforceInterface(IActivityManager.descriptor); |
| 479 | IBinder b = data.readStrongBinder(); |
| 480 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 481 | String name = data.readString(); |
| 482 | ContentProviderHolder cph = getContentProvider(app, name); |
| 483 | reply.writeNoException(); |
| 484 | if (cph != null) { |
| 485 | reply.writeInt(1); |
| 486 | cph.writeToParcel(reply, 0); |
| 487 | } else { |
| 488 | reply.writeInt(0); |
| 489 | } |
| 490 | return true; |
| 491 | } |
| 492 | |
| 493 | case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: { |
| 494 | data.enforceInterface(IActivityManager.descriptor); |
| 495 | IBinder b = data.readStrongBinder(); |
| 496 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 497 | ArrayList<ContentProviderHolder> providers = |
| 498 | data.createTypedArrayList(ContentProviderHolder.CREATOR); |
| 499 | publishContentProviders(app, providers); |
| 500 | reply.writeNoException(); |
| 501 | return true; |
| 502 | } |
| 503 | |
| 504 | case REMOVE_CONTENT_PROVIDER_TRANSACTION: { |
| 505 | data.enforceInterface(IActivityManager.descriptor); |
| 506 | IBinder b = data.readStrongBinder(); |
| 507 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 508 | String name = data.readString(); |
| 509 | removeContentProvider(app, name); |
| 510 | reply.writeNoException(); |
| 511 | return true; |
| 512 | } |
| 513 | |
| 514 | case START_SERVICE_TRANSACTION: { |
| 515 | data.enforceInterface(IActivityManager.descriptor); |
| 516 | IBinder b = data.readStrongBinder(); |
| 517 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 518 | Intent service = Intent.CREATOR.createFromParcel(data); |
| 519 | String resolvedType = data.readString(); |
| 520 | ComponentName cn = startService(app, service, resolvedType); |
| 521 | reply.writeNoException(); |
| 522 | ComponentName.writeToParcel(cn, reply); |
| 523 | return true; |
| 524 | } |
| 525 | |
| 526 | case STOP_SERVICE_TRANSACTION: { |
| 527 | data.enforceInterface(IActivityManager.descriptor); |
| 528 | IBinder b = data.readStrongBinder(); |
| 529 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 530 | Intent service = Intent.CREATOR.createFromParcel(data); |
| 531 | String resolvedType = data.readString(); |
| 532 | int res = stopService(app, service, resolvedType); |
| 533 | reply.writeNoException(); |
| 534 | reply.writeInt(res); |
| 535 | return true; |
| 536 | } |
| 537 | |
| 538 | case STOP_SERVICE_TOKEN_TRANSACTION: { |
| 539 | data.enforceInterface(IActivityManager.descriptor); |
| 540 | ComponentName className = ComponentName.readFromParcel(data); |
| 541 | IBinder token = data.readStrongBinder(); |
| 542 | int startId = data.readInt(); |
| 543 | boolean res = stopServiceToken(className, token, startId); |
| 544 | reply.writeNoException(); |
| 545 | reply.writeInt(res ? 1 : 0); |
| 546 | return true; |
| 547 | } |
| 548 | |
| 549 | case SET_SERVICE_FOREGROUND_TRANSACTION: { |
| 550 | data.enforceInterface(IActivityManager.descriptor); |
| 551 | ComponentName className = ComponentName.readFromParcel(data); |
| 552 | IBinder token = data.readStrongBinder(); |
| 553 | boolean isForeground = data.readInt() != 0; |
| 554 | setServiceForeground(className, token, isForeground); |
| 555 | reply.writeNoException(); |
| 556 | return true; |
| 557 | } |
| 558 | |
| 559 | case BIND_SERVICE_TRANSACTION: { |
| 560 | data.enforceInterface(IActivityManager.descriptor); |
| 561 | IBinder b = data.readStrongBinder(); |
| 562 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 563 | IBinder token = data.readStrongBinder(); |
| 564 | Intent service = Intent.CREATOR.createFromParcel(data); |
| 565 | String resolvedType = data.readString(); |
| 566 | b = data.readStrongBinder(); |
| 567 | int fl = data.readInt(); |
| 568 | IServiceConnection conn = IServiceConnection.Stub.asInterface(b); |
| 569 | int res = bindService(app, token, service, resolvedType, conn, fl); |
| 570 | reply.writeNoException(); |
| 571 | reply.writeInt(res); |
| 572 | return true; |
| 573 | } |
| 574 | |
| 575 | case UNBIND_SERVICE_TRANSACTION: { |
| 576 | data.enforceInterface(IActivityManager.descriptor); |
| 577 | IBinder b = data.readStrongBinder(); |
| 578 | IServiceConnection conn = IServiceConnection.Stub.asInterface(b); |
| 579 | boolean res = unbindService(conn); |
| 580 | reply.writeNoException(); |
| 581 | reply.writeInt(res ? 1 : 0); |
| 582 | return true; |
| 583 | } |
| 584 | |
| 585 | case PUBLISH_SERVICE_TRANSACTION: { |
| 586 | data.enforceInterface(IActivityManager.descriptor); |
| 587 | IBinder token = data.readStrongBinder(); |
| 588 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 589 | IBinder service = data.readStrongBinder(); |
| 590 | publishService(token, intent, service); |
| 591 | reply.writeNoException(); |
| 592 | return true; |
| 593 | } |
| 594 | |
| 595 | case UNBIND_FINISHED_TRANSACTION: { |
| 596 | data.enforceInterface(IActivityManager.descriptor); |
| 597 | IBinder token = data.readStrongBinder(); |
| 598 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 599 | boolean doRebind = data.readInt() != 0; |
| 600 | unbindFinished(token, intent, doRebind); |
| 601 | reply.writeNoException(); |
| 602 | return true; |
| 603 | } |
| 604 | |
| 605 | case SERVICE_DONE_EXECUTING_TRANSACTION: { |
| 606 | data.enforceInterface(IActivityManager.descriptor); |
| 607 | IBinder token = data.readStrongBinder(); |
| 608 | serviceDoneExecuting(token); |
| 609 | reply.writeNoException(); |
| 610 | return true; |
| 611 | } |
| 612 | |
| 613 | case START_INSTRUMENTATION_TRANSACTION: { |
| 614 | data.enforceInterface(IActivityManager.descriptor); |
| 615 | ComponentName className = ComponentName.readFromParcel(data); |
| 616 | String profileFile = data.readString(); |
| 617 | int fl = data.readInt(); |
| 618 | Bundle arguments = data.readBundle(); |
| 619 | IBinder b = data.readStrongBinder(); |
| 620 | IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b); |
| 621 | boolean res = startInstrumentation(className, profileFile, fl, arguments, w); |
| 622 | reply.writeNoException(); |
| 623 | reply.writeInt(res ? 1 : 0); |
| 624 | return true; |
| 625 | } |
| 626 | |
| 627 | |
| 628 | case FINISH_INSTRUMENTATION_TRANSACTION: { |
| 629 | data.enforceInterface(IActivityManager.descriptor); |
| 630 | IBinder b = data.readStrongBinder(); |
| 631 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 632 | int resultCode = data.readInt(); |
| 633 | Bundle results = data.readBundle(); |
| 634 | finishInstrumentation(app, resultCode, results); |
| 635 | reply.writeNoException(); |
| 636 | return true; |
| 637 | } |
| 638 | |
| 639 | case GET_CONFIGURATION_TRANSACTION: { |
| 640 | data.enforceInterface(IActivityManager.descriptor); |
| 641 | Configuration config = getConfiguration(); |
| 642 | reply.writeNoException(); |
| 643 | config.writeToParcel(reply, 0); |
| 644 | return true; |
| 645 | } |
| 646 | |
| 647 | case UPDATE_CONFIGURATION_TRANSACTION: { |
| 648 | data.enforceInterface(IActivityManager.descriptor); |
| 649 | Configuration config = Configuration.CREATOR.createFromParcel(data); |
| 650 | updateConfiguration(config); |
| 651 | reply.writeNoException(); |
| 652 | return true; |
| 653 | } |
| 654 | |
| 655 | case SET_REQUESTED_ORIENTATION_TRANSACTION: { |
| 656 | data.enforceInterface(IActivityManager.descriptor); |
| 657 | IBinder token = data.readStrongBinder(); |
| 658 | int requestedOrientation = data.readInt(); |
| 659 | setRequestedOrientation(token, requestedOrientation); |
| 660 | reply.writeNoException(); |
| 661 | return true; |
| 662 | } |
| 663 | |
| 664 | case GET_REQUESTED_ORIENTATION_TRANSACTION: { |
| 665 | data.enforceInterface(IActivityManager.descriptor); |
| 666 | IBinder token = data.readStrongBinder(); |
| 667 | int req = getRequestedOrientation(token); |
| 668 | reply.writeNoException(); |
| 669 | reply.writeInt(req); |
| 670 | return true; |
| 671 | } |
| 672 | |
| 673 | case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: { |
| 674 | data.enforceInterface(IActivityManager.descriptor); |
| 675 | IBinder token = data.readStrongBinder(); |
| 676 | ComponentName cn = getActivityClassForToken(token); |
| 677 | reply.writeNoException(); |
| 678 | ComponentName.writeToParcel(cn, reply); |
| 679 | return true; |
| 680 | } |
| 681 | |
| 682 | case GET_PACKAGE_FOR_TOKEN_TRANSACTION: { |
| 683 | data.enforceInterface(IActivityManager.descriptor); |
| 684 | IBinder token = data.readStrongBinder(); |
| 685 | reply.writeNoException(); |
| 686 | reply.writeString(getPackageForToken(token)); |
| 687 | return true; |
| 688 | } |
| 689 | |
| 690 | case GET_INTENT_SENDER_TRANSACTION: { |
| 691 | data.enforceInterface(IActivityManager.descriptor); |
| 692 | int type = data.readInt(); |
| 693 | String packageName = data.readString(); |
| 694 | IBinder token = data.readStrongBinder(); |
| 695 | String resultWho = data.readString(); |
| 696 | int requestCode = data.readInt(); |
| 697 | Intent requestIntent = data.readInt() != 0 |
| 698 | ? Intent.CREATOR.createFromParcel(data) : null; |
| 699 | String requestResolvedType = data.readString(); |
| 700 | int fl = data.readInt(); |
| 701 | IIntentSender res = getIntentSender(type, packageName, token, |
| 702 | resultWho, requestCode, requestIntent, |
| 703 | requestResolvedType, fl); |
| 704 | reply.writeNoException(); |
| 705 | reply.writeStrongBinder(res != null ? res.asBinder() : null); |
| 706 | return true; |
| 707 | } |
| 708 | |
| 709 | case CANCEL_INTENT_SENDER_TRANSACTION: { |
| 710 | data.enforceInterface(IActivityManager.descriptor); |
| 711 | IIntentSender r = IIntentSender.Stub.asInterface( |
| 712 | data.readStrongBinder()); |
| 713 | cancelIntentSender(r); |
| 714 | reply.writeNoException(); |
| 715 | return true; |
| 716 | } |
| 717 | |
| 718 | case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: { |
| 719 | data.enforceInterface(IActivityManager.descriptor); |
| 720 | IIntentSender r = IIntentSender.Stub.asInterface( |
| 721 | data.readStrongBinder()); |
| 722 | String res = getPackageForIntentSender(r); |
| 723 | reply.writeNoException(); |
| 724 | reply.writeString(res); |
| 725 | return true; |
| 726 | } |
| 727 | |
| 728 | case SET_PROCESS_LIMIT_TRANSACTION: { |
| 729 | data.enforceInterface(IActivityManager.descriptor); |
| 730 | int max = data.readInt(); |
| 731 | setProcessLimit(max); |
| 732 | reply.writeNoException(); |
| 733 | return true; |
| 734 | } |
| 735 | |
| 736 | case GET_PROCESS_LIMIT_TRANSACTION: { |
| 737 | data.enforceInterface(IActivityManager.descriptor); |
| 738 | int limit = getProcessLimit(); |
| 739 | reply.writeNoException(); |
| 740 | reply.writeInt(limit); |
| 741 | return true; |
| 742 | } |
| 743 | |
| 744 | case SET_PROCESS_FOREGROUND_TRANSACTION: { |
| 745 | data.enforceInterface(IActivityManager.descriptor); |
| 746 | IBinder token = data.readStrongBinder(); |
| 747 | int pid = data.readInt(); |
| 748 | boolean isForeground = data.readInt() != 0; |
| 749 | setProcessForeground(token, pid, isForeground); |
| 750 | reply.writeNoException(); |
| 751 | return true; |
| 752 | } |
| 753 | |
| 754 | case CHECK_PERMISSION_TRANSACTION: { |
| 755 | data.enforceInterface(IActivityManager.descriptor); |
| 756 | String perm = data.readString(); |
| 757 | int pid = data.readInt(); |
| 758 | int uid = data.readInt(); |
| 759 | int res = checkPermission(perm, pid, uid); |
| 760 | reply.writeNoException(); |
| 761 | reply.writeInt(res); |
| 762 | return true; |
| 763 | } |
| 764 | |
| 765 | case CHECK_URI_PERMISSION_TRANSACTION: { |
| 766 | data.enforceInterface(IActivityManager.descriptor); |
| 767 | Uri uri = Uri.CREATOR.createFromParcel(data); |
| 768 | int pid = data.readInt(); |
| 769 | int uid = data.readInt(); |
| 770 | int mode = data.readInt(); |
| 771 | int res = checkUriPermission(uri, pid, uid, mode); |
| 772 | reply.writeNoException(); |
| 773 | reply.writeInt(res); |
| 774 | return true; |
| 775 | } |
| 776 | |
| 777 | case CLEAR_APP_DATA_TRANSACTION: { |
| 778 | data.enforceInterface(IActivityManager.descriptor); |
| 779 | String packageName = data.readString(); |
| 780 | IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface( |
| 781 | data.readStrongBinder()); |
| 782 | boolean res = clearApplicationUserData(packageName, observer); |
| 783 | reply.writeNoException(); |
| 784 | reply.writeInt(res ? 1 : 0); |
| 785 | return true; |
| 786 | } |
| 787 | |
| 788 | case GRANT_URI_PERMISSION_TRANSACTION: { |
| 789 | data.enforceInterface(IActivityManager.descriptor); |
| 790 | IBinder b = data.readStrongBinder(); |
| 791 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 792 | String targetPkg = data.readString(); |
| 793 | Uri uri = Uri.CREATOR.createFromParcel(data); |
| 794 | int mode = data.readInt(); |
| 795 | grantUriPermission(app, targetPkg, uri, mode); |
| 796 | reply.writeNoException(); |
| 797 | return true; |
| 798 | } |
| 799 | |
| 800 | case REVOKE_URI_PERMISSION_TRANSACTION: { |
| 801 | data.enforceInterface(IActivityManager.descriptor); |
| 802 | IBinder b = data.readStrongBinder(); |
| 803 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 804 | Uri uri = Uri.CREATOR.createFromParcel(data); |
| 805 | int mode = data.readInt(); |
| 806 | revokeUriPermission(app, uri, mode); |
| 807 | reply.writeNoException(); |
| 808 | return true; |
| 809 | } |
| 810 | |
| 811 | case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: { |
| 812 | data.enforceInterface(IActivityManager.descriptor); |
| 813 | IBinder b = data.readStrongBinder(); |
| 814 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 815 | boolean waiting = data.readInt() != 0; |
| 816 | showWaitingForDebugger(app, waiting); |
| 817 | reply.writeNoException(); |
| 818 | return true; |
| 819 | } |
| 820 | |
| 821 | case GET_MEMORY_INFO_TRANSACTION: { |
| 822 | data.enforceInterface(IActivityManager.descriptor); |
| 823 | ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); |
| 824 | getMemoryInfo(mi); |
| 825 | reply.writeNoException(); |
| 826 | mi.writeToParcel(reply, 0); |
| 827 | return true; |
| 828 | } |
| 829 | |
| 830 | case UNHANDLED_BACK_TRANSACTION: { |
| 831 | data.enforceInterface(IActivityManager.descriptor); |
| 832 | unhandledBack(); |
| 833 | reply.writeNoException(); |
| 834 | return true; |
| 835 | } |
| 836 | |
| 837 | case OPEN_CONTENT_URI_TRANSACTION: { |
| 838 | data.enforceInterface(IActivityManager.descriptor); |
| 839 | Uri uri = Uri.parse(data.readString()); |
| 840 | ParcelFileDescriptor pfd = openContentUri(uri); |
| 841 | reply.writeNoException(); |
| 842 | if (pfd != null) { |
| 843 | reply.writeInt(1); |
| 844 | pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 845 | } else { |
| 846 | reply.writeInt(0); |
| 847 | } |
| 848 | return true; |
| 849 | } |
| 850 | |
| 851 | case GOING_TO_SLEEP_TRANSACTION: { |
| 852 | data.enforceInterface(IActivityManager.descriptor); |
| 853 | goingToSleep(); |
| 854 | reply.writeNoException(); |
| 855 | return true; |
| 856 | } |
| 857 | |
| 858 | case WAKING_UP_TRANSACTION: { |
| 859 | data.enforceInterface(IActivityManager.descriptor); |
| 860 | wakingUp(); |
| 861 | reply.writeNoException(); |
| 862 | return true; |
| 863 | } |
| 864 | |
| 865 | case SET_DEBUG_APP_TRANSACTION: { |
| 866 | data.enforceInterface(IActivityManager.descriptor); |
| 867 | String pn = data.readString(); |
| 868 | boolean wfd = data.readInt() != 0; |
| 869 | boolean per = data.readInt() != 0; |
| 870 | setDebugApp(pn, wfd, per); |
| 871 | reply.writeNoException(); |
| 872 | return true; |
| 873 | } |
| 874 | |
| 875 | case SET_ALWAYS_FINISH_TRANSACTION: { |
| 876 | data.enforceInterface(IActivityManager.descriptor); |
| 877 | boolean enabled = data.readInt() != 0; |
| 878 | setAlwaysFinish(enabled); |
| 879 | reply.writeNoException(); |
| 880 | return true; |
| 881 | } |
| 882 | |
| 883 | case SET_ACTIVITY_WATCHER_TRANSACTION: { |
| 884 | data.enforceInterface(IActivityManager.descriptor); |
| 885 | IActivityWatcher watcher = IActivityWatcher.Stub.asInterface( |
| 886 | data.readStrongBinder()); |
| 887 | setActivityWatcher(watcher); |
| 888 | return true; |
| 889 | } |
| 890 | |
| 891 | case ENTER_SAFE_MODE_TRANSACTION: { |
| 892 | data.enforceInterface(IActivityManager.descriptor); |
| 893 | enterSafeMode(); |
| 894 | reply.writeNoException(); |
| 895 | return true; |
| 896 | } |
| 897 | |
| 898 | case NOTE_WAKEUP_ALARM_TRANSACTION: { |
| 899 | data.enforceInterface(IActivityManager.descriptor); |
| 900 | IIntentSender is = IIntentSender.Stub.asInterface( |
| 901 | data.readStrongBinder()); |
| 902 | noteWakeupAlarm(is); |
| 903 | reply.writeNoException(); |
| 904 | return true; |
| 905 | } |
| 906 | |
| 907 | case KILL_PIDS_FOR_MEMORY_TRANSACTION: { |
| 908 | data.enforceInterface(IActivityManager.descriptor); |
| 909 | int[] pids = data.createIntArray(); |
| 910 | boolean res = killPidsForMemory(pids); |
| 911 | reply.writeNoException(); |
| 912 | reply.writeInt(res ? 1 : 0); |
| 913 | return true; |
| 914 | } |
| 915 | |
| 916 | case REPORT_PSS_TRANSACTION: { |
| 917 | data.enforceInterface(IActivityManager.descriptor); |
| 918 | IBinder b = data.readStrongBinder(); |
| 919 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 920 | int pss = data.readInt(); |
| 921 | reportPss(app, pss); |
| 922 | reply.writeNoException(); |
| 923 | return true; |
| 924 | } |
| 925 | |
| 926 | case START_RUNNING_TRANSACTION: { |
| 927 | data.enforceInterface(IActivityManager.descriptor); |
| 928 | String pkg = data.readString(); |
| 929 | String cls = data.readString(); |
| 930 | String action = data.readString(); |
| 931 | String indata = data.readString(); |
| 932 | startRunning(pkg, cls, action, indata); |
| 933 | reply.writeNoException(); |
| 934 | return true; |
| 935 | } |
| 936 | |
| 937 | case SYSTEM_READY_TRANSACTION: { |
| 938 | data.enforceInterface(IActivityManager.descriptor); |
| 939 | systemReady(); |
| 940 | reply.writeNoException(); |
| 941 | return true; |
| 942 | } |
| 943 | |
| 944 | case HANDLE_APPLICATION_ERROR_TRANSACTION: { |
| 945 | data.enforceInterface(IActivityManager.descriptor); |
| 946 | IBinder app = data.readStrongBinder(); |
| 947 | int fl = data.readInt(); |
| 948 | String tag = data.readString(); |
| 949 | String shortMsg = data.readString(); |
| 950 | String longMsg = data.readString(); |
| 951 | byte[] crashData = data.createByteArray(); |
| 952 | int res = handleApplicationError(app, fl, tag, shortMsg, longMsg, |
| 953 | crashData); |
| 954 | reply.writeNoException(); |
| 955 | reply.writeInt(res); |
| 956 | return true; |
| 957 | } |
| 958 | |
| 959 | case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: { |
| 960 | data.enforceInterface(IActivityManager.descriptor); |
| 961 | int sig = data.readInt(); |
| 962 | signalPersistentProcesses(sig); |
| 963 | reply.writeNoException(); |
| 964 | return true; |
| 965 | } |
| 966 | |
| 967 | case RESTART_PACKAGE_TRANSACTION: { |
| 968 | data.enforceInterface(IActivityManager.descriptor); |
| 969 | String packageName = data.readString(); |
| 970 | restartPackage(packageName); |
| 971 | reply.writeNoException(); |
| 972 | return true; |
| 973 | } |
| 974 | |
| 975 | case GET_DEVICE_CONFIGURATION_TRANSACTION: { |
| 976 | data.enforceInterface(IActivityManager.descriptor); |
| 977 | ConfigurationInfo config = getDeviceConfigurationInfo(); |
| 978 | reply.writeNoException(); |
| 979 | config.writeToParcel(reply, 0); |
| 980 | return true; |
| 981 | } |
| 982 | |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 983 | case PROFILE_CONTROL_TRANSACTION: { |
| 984 | data.enforceInterface(IActivityManager.descriptor); |
| 985 | String process = data.readString(); |
| 986 | boolean start = data.readInt() != 0; |
| 987 | String path = data.readString(); |
| 988 | boolean res = profileControl(process, start, path); |
| 989 | reply.writeNoException(); |
| 990 | reply.writeInt(res ? 1 : 0); |
| 991 | return true; |
| 992 | } |
| 993 | |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 994 | case SHUTDOWN_TRANSACTION: { |
| 995 | data.enforceInterface(IActivityManager.descriptor); |
| 996 | boolean res = shutdown(data.readInt()); |
| 997 | reply.writeNoException(); |
| 998 | reply.writeInt(res ? 1 : 0); |
| 999 | return true; |
| 1000 | } |
| 1001 | |
Dianne Hackborn | 95fc68f | 2009-05-19 18:37:45 -0700 | [diff] [blame] | 1002 | case STOP_APP_SWITCHES_TRANSACTION: { |
| 1003 | data.enforceInterface(IActivityManager.descriptor); |
| 1004 | stopAppSwitches(); |
| 1005 | reply.writeNoException(); |
| 1006 | return true; |
| 1007 | } |
| 1008 | |
| 1009 | case RESUME_APP_SWITCHES_TRANSACTION: { |
| 1010 | data.enforceInterface(IActivityManager.descriptor); |
| 1011 | resumeAppSwitches(); |
| 1012 | reply.writeNoException(); |
| 1013 | return true; |
| 1014 | } |
| 1015 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1016 | case PEEK_SERVICE_TRANSACTION: { |
| 1017 | data.enforceInterface(IActivityManager.descriptor); |
| 1018 | Intent service = Intent.CREATOR.createFromParcel(data); |
| 1019 | String resolvedType = data.readString(); |
| 1020 | IBinder binder = peekService(service, resolvedType); |
| 1021 | reply.writeNoException(); |
| 1022 | reply.writeStrongBinder(binder); |
| 1023 | return true; |
| 1024 | } |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame^] | 1025 | |
| 1026 | case START_BACKUP_AGENT_TRANSACTION: { |
| 1027 | data.enforceInterface(IActivityManager.descriptor); |
| 1028 | ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); |
| 1029 | int backupRestoreMode = data.readInt(); |
| 1030 | boolean success = bindBackupAgent(info, backupRestoreMode); |
| 1031 | reply.writeNoException(); |
| 1032 | reply.writeInt(success ? 1 : 0); |
| 1033 | return true; |
| 1034 | } |
| 1035 | |
| 1036 | case BACKUP_AGENT_CREATED_TRANSACTION: { |
| 1037 | data.enforceInterface(IActivityManager.descriptor); |
| 1038 | String packageName = data.readString(); |
| 1039 | IBinder agent = data.readStrongBinder(); |
| 1040 | backupAgentCreated(packageName, agent); |
| 1041 | reply.writeNoException(); |
| 1042 | return true; |
| 1043 | } |
| 1044 | |
| 1045 | case UNBIND_BACKUP_AGENT_TRANSACTION: { |
| 1046 | data.enforceInterface(IActivityManager.descriptor); |
| 1047 | ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); |
| 1048 | unbindBackupAgent(info); |
| 1049 | reply.writeNoException(); |
| 1050 | return true; |
| 1051 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1052 | } |
| 1053 | |
| 1054 | return super.onTransact(code, data, reply, flags); |
| 1055 | } |
| 1056 | |
| 1057 | public IBinder asBinder() |
| 1058 | { |
| 1059 | return this; |
| 1060 | } |
| 1061 | |
| 1062 | private static IActivityManager gDefault; |
| 1063 | } |
| 1064 | |
| 1065 | class ActivityManagerProxy implements IActivityManager |
| 1066 | { |
| 1067 | public ActivityManagerProxy(IBinder remote) |
| 1068 | { |
| 1069 | mRemote = remote; |
| 1070 | } |
| 1071 | |
| 1072 | public IBinder asBinder() |
| 1073 | { |
| 1074 | return mRemote; |
| 1075 | } |
| 1076 | |
| 1077 | public int startActivity(IApplicationThread caller, Intent intent, |
| 1078 | String resolvedType, Uri[] grantedUriPermissions, int grantedMode, |
| 1079 | IBinder resultTo, String resultWho, |
| 1080 | int requestCode, boolean onlyIfNeeded, |
| 1081 | boolean debug) throws RemoteException { |
| 1082 | Parcel data = Parcel.obtain(); |
| 1083 | Parcel reply = Parcel.obtain(); |
| 1084 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1085 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1086 | intent.writeToParcel(data, 0); |
| 1087 | data.writeString(resolvedType); |
| 1088 | data.writeTypedArray(grantedUriPermissions, 0); |
| 1089 | data.writeInt(grantedMode); |
| 1090 | data.writeStrongBinder(resultTo); |
| 1091 | data.writeString(resultWho); |
| 1092 | data.writeInt(requestCode); |
| 1093 | data.writeInt(onlyIfNeeded ? 1 : 0); |
| 1094 | data.writeInt(debug ? 1 : 0); |
| 1095 | mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1096 | reply.readException(); |
| 1097 | int result = reply.readInt(); |
| 1098 | reply.recycle(); |
| 1099 | data.recycle(); |
| 1100 | return result; |
| 1101 | } |
| 1102 | public boolean startNextMatchingActivity(IBinder callingActivity, |
| 1103 | Intent intent) throws RemoteException { |
| 1104 | Parcel data = Parcel.obtain(); |
| 1105 | Parcel reply = Parcel.obtain(); |
| 1106 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1107 | data.writeStrongBinder(callingActivity); |
| 1108 | intent.writeToParcel(data, 0); |
| 1109 | mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1110 | reply.readException(); |
| 1111 | int result = reply.readInt(); |
| 1112 | reply.recycle(); |
| 1113 | data.recycle(); |
| 1114 | return result != 0; |
| 1115 | } |
| 1116 | public boolean finishActivity(IBinder token, int resultCode, Intent resultData) |
| 1117 | throws RemoteException { |
| 1118 | Parcel data = Parcel.obtain(); |
| 1119 | Parcel reply = Parcel.obtain(); |
| 1120 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1121 | data.writeStrongBinder(token); |
| 1122 | data.writeInt(resultCode); |
| 1123 | if (resultData != null) { |
| 1124 | data.writeInt(1); |
| 1125 | resultData.writeToParcel(data, 0); |
| 1126 | } else { |
| 1127 | data.writeInt(0); |
| 1128 | } |
| 1129 | mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1130 | reply.readException(); |
| 1131 | boolean res = reply.readInt() != 0; |
| 1132 | data.recycle(); |
| 1133 | reply.recycle(); |
| 1134 | return res; |
| 1135 | } |
| 1136 | public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException |
| 1137 | { |
| 1138 | Parcel data = Parcel.obtain(); |
| 1139 | Parcel reply = Parcel.obtain(); |
| 1140 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1141 | data.writeStrongBinder(token); |
| 1142 | data.writeString(resultWho); |
| 1143 | data.writeInt(requestCode); |
| 1144 | mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1145 | reply.readException(); |
| 1146 | data.recycle(); |
| 1147 | reply.recycle(); |
| 1148 | } |
| 1149 | public Intent registerReceiver(IApplicationThread caller, |
| 1150 | IIntentReceiver receiver, |
| 1151 | IntentFilter filter, String perm) throws RemoteException |
| 1152 | { |
| 1153 | Parcel data = Parcel.obtain(); |
| 1154 | Parcel reply = Parcel.obtain(); |
| 1155 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1156 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1157 | data.writeStrongBinder(receiver != null ? receiver.asBinder() : null); |
| 1158 | filter.writeToParcel(data, 0); |
| 1159 | data.writeString(perm); |
| 1160 | mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0); |
| 1161 | reply.readException(); |
| 1162 | Intent intent = null; |
| 1163 | int haveIntent = reply.readInt(); |
| 1164 | if (haveIntent != 0) { |
| 1165 | intent = Intent.CREATOR.createFromParcel(reply); |
| 1166 | } |
| 1167 | reply.recycle(); |
| 1168 | data.recycle(); |
| 1169 | return intent; |
| 1170 | } |
| 1171 | public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException |
| 1172 | { |
| 1173 | Parcel data = Parcel.obtain(); |
| 1174 | Parcel reply = Parcel.obtain(); |
| 1175 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1176 | data.writeStrongBinder(receiver.asBinder()); |
| 1177 | mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0); |
| 1178 | reply.readException(); |
| 1179 | data.recycle(); |
| 1180 | reply.recycle(); |
| 1181 | } |
| 1182 | public int broadcastIntent(IApplicationThread caller, |
| 1183 | Intent intent, String resolvedType, IIntentReceiver resultTo, |
| 1184 | int resultCode, String resultData, Bundle map, |
| 1185 | String requiredPermission, boolean serialized, |
| 1186 | boolean sticky) throws RemoteException |
| 1187 | { |
| 1188 | Parcel data = Parcel.obtain(); |
| 1189 | Parcel reply = Parcel.obtain(); |
| 1190 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1191 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1192 | intent.writeToParcel(data, 0); |
| 1193 | data.writeString(resolvedType); |
| 1194 | data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null); |
| 1195 | data.writeInt(resultCode); |
| 1196 | data.writeString(resultData); |
| 1197 | data.writeBundle(map); |
| 1198 | data.writeString(requiredPermission); |
| 1199 | data.writeInt(serialized ? 1 : 0); |
| 1200 | data.writeInt(sticky ? 1 : 0); |
| 1201 | mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0); |
| 1202 | reply.readException(); |
| 1203 | int res = reply.readInt(); |
| 1204 | reply.recycle(); |
| 1205 | data.recycle(); |
| 1206 | return res; |
| 1207 | } |
| 1208 | public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException |
| 1209 | { |
| 1210 | Parcel data = Parcel.obtain(); |
| 1211 | Parcel reply = Parcel.obtain(); |
| 1212 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1213 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1214 | intent.writeToParcel(data, 0); |
| 1215 | mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0); |
| 1216 | reply.readException(); |
| 1217 | data.recycle(); |
| 1218 | reply.recycle(); |
| 1219 | } |
| 1220 | public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException |
| 1221 | { |
| 1222 | Parcel data = Parcel.obtain(); |
| 1223 | Parcel reply = Parcel.obtain(); |
| 1224 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1225 | data.writeStrongBinder(who); |
| 1226 | data.writeInt(resultCode); |
| 1227 | data.writeString(resultData); |
| 1228 | data.writeBundle(map); |
| 1229 | data.writeInt(abortBroadcast ? 1 : 0); |
| 1230 | mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1231 | reply.readException(); |
| 1232 | data.recycle(); |
| 1233 | reply.recycle(); |
| 1234 | } |
| 1235 | public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException |
| 1236 | { |
| 1237 | Parcel data = Parcel.obtain(); |
| 1238 | Parcel reply = Parcel.obtain(); |
| 1239 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1240 | data.writeStrongBinder(token); |
| 1241 | data.writeInt(isPersistent ? 1 : 0); |
| 1242 | mRemote.transact(SET_PERSISTENT_TRANSACTION, data, reply, 0); |
| 1243 | reply.readException(); |
| 1244 | data.recycle(); |
| 1245 | reply.recycle(); |
| 1246 | } |
| 1247 | public void attachApplication(IApplicationThread app) throws RemoteException |
| 1248 | { |
| 1249 | Parcel data = Parcel.obtain(); |
| 1250 | Parcel reply = Parcel.obtain(); |
| 1251 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1252 | data.writeStrongBinder(app.asBinder()); |
| 1253 | mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0); |
| 1254 | reply.readException(); |
| 1255 | data.recycle(); |
| 1256 | reply.recycle(); |
| 1257 | } |
| 1258 | public void activityIdle(IBinder token) throws RemoteException |
| 1259 | { |
| 1260 | Parcel data = Parcel.obtain(); |
| 1261 | Parcel reply = Parcel.obtain(); |
| 1262 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1263 | data.writeStrongBinder(token); |
| 1264 | mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1265 | reply.readException(); |
| 1266 | data.recycle(); |
| 1267 | reply.recycle(); |
| 1268 | } |
| 1269 | public void activityPaused(IBinder token, Bundle state) throws RemoteException |
| 1270 | { |
| 1271 | Parcel data = Parcel.obtain(); |
| 1272 | Parcel reply = Parcel.obtain(); |
| 1273 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1274 | data.writeStrongBinder(token); |
| 1275 | data.writeBundle(state); |
| 1276 | mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0); |
| 1277 | reply.readException(); |
| 1278 | data.recycle(); |
| 1279 | reply.recycle(); |
| 1280 | } |
| 1281 | public void activityStopped(IBinder token, |
| 1282 | Bitmap thumbnail, CharSequence description) throws RemoteException |
| 1283 | { |
| 1284 | Parcel data = Parcel.obtain(); |
| 1285 | Parcel reply = Parcel.obtain(); |
| 1286 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1287 | data.writeStrongBinder(token); |
| 1288 | if (thumbnail != null) { |
| 1289 | data.writeInt(1); |
| 1290 | thumbnail.writeToParcel(data, 0); |
| 1291 | } else { |
| 1292 | data.writeInt(0); |
| 1293 | } |
| 1294 | TextUtils.writeToParcel(description, data, 0); |
| 1295 | mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1296 | reply.readException(); |
| 1297 | data.recycle(); |
| 1298 | reply.recycle(); |
| 1299 | } |
| 1300 | public void activityDestroyed(IBinder token) throws RemoteException |
| 1301 | { |
| 1302 | Parcel data = Parcel.obtain(); |
| 1303 | Parcel reply = Parcel.obtain(); |
| 1304 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1305 | data.writeStrongBinder(token); |
| 1306 | mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1307 | reply.readException(); |
| 1308 | data.recycle(); |
| 1309 | reply.recycle(); |
| 1310 | } |
| 1311 | public String getCallingPackage(IBinder token) throws RemoteException |
| 1312 | { |
| 1313 | Parcel data = Parcel.obtain(); |
| 1314 | Parcel reply = Parcel.obtain(); |
| 1315 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1316 | data.writeStrongBinder(token); |
| 1317 | mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0); |
| 1318 | reply.readException(); |
| 1319 | String res = reply.readString(); |
| 1320 | data.recycle(); |
| 1321 | reply.recycle(); |
| 1322 | return res; |
| 1323 | } |
| 1324 | public ComponentName getCallingActivity(IBinder token) |
| 1325 | throws RemoteException { |
| 1326 | Parcel data = Parcel.obtain(); |
| 1327 | Parcel reply = Parcel.obtain(); |
| 1328 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1329 | data.writeStrongBinder(token); |
| 1330 | mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1331 | reply.readException(); |
| 1332 | ComponentName res = ComponentName.readFromParcel(reply); |
| 1333 | data.recycle(); |
| 1334 | reply.recycle(); |
| 1335 | return res; |
| 1336 | } |
| 1337 | public List getTasks(int maxNum, int flags, |
| 1338 | IThumbnailReceiver receiver) throws RemoteException { |
| 1339 | Parcel data = Parcel.obtain(); |
| 1340 | Parcel reply = Parcel.obtain(); |
| 1341 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1342 | data.writeInt(maxNum); |
| 1343 | data.writeInt(flags); |
| 1344 | data.writeStrongBinder(receiver != null ? receiver.asBinder() : null); |
| 1345 | mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0); |
| 1346 | reply.readException(); |
| 1347 | ArrayList list = null; |
| 1348 | int N = reply.readInt(); |
| 1349 | if (N >= 0) { |
| 1350 | list = new ArrayList(); |
| 1351 | while (N > 0) { |
| 1352 | ActivityManager.RunningTaskInfo info = |
| 1353 | ActivityManager.RunningTaskInfo.CREATOR |
| 1354 | .createFromParcel(reply); |
| 1355 | list.add(info); |
| 1356 | N--; |
| 1357 | } |
| 1358 | } |
| 1359 | data.recycle(); |
| 1360 | reply.recycle(); |
| 1361 | return list; |
| 1362 | } |
| 1363 | public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, |
| 1364 | int flags) throws RemoteException { |
| 1365 | Parcel data = Parcel.obtain(); |
| 1366 | Parcel reply = Parcel.obtain(); |
| 1367 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1368 | data.writeInt(maxNum); |
| 1369 | data.writeInt(flags); |
| 1370 | mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0); |
| 1371 | reply.readException(); |
| 1372 | ArrayList<ActivityManager.RecentTaskInfo> list |
| 1373 | = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR); |
| 1374 | data.recycle(); |
| 1375 | reply.recycle(); |
| 1376 | return list; |
| 1377 | } |
| 1378 | public List getServices(int maxNum, int flags) throws RemoteException { |
| 1379 | Parcel data = Parcel.obtain(); |
| 1380 | Parcel reply = Parcel.obtain(); |
| 1381 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1382 | data.writeInt(maxNum); |
| 1383 | data.writeInt(flags); |
| 1384 | mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0); |
| 1385 | reply.readException(); |
| 1386 | ArrayList list = null; |
| 1387 | int N = reply.readInt(); |
| 1388 | if (N >= 0) { |
| 1389 | list = new ArrayList(); |
| 1390 | while (N > 0) { |
| 1391 | ActivityManager.RunningServiceInfo info = |
| 1392 | ActivityManager.RunningServiceInfo.CREATOR |
| 1393 | .createFromParcel(reply); |
| 1394 | list.add(info); |
| 1395 | N--; |
| 1396 | } |
| 1397 | } |
| 1398 | data.recycle(); |
| 1399 | reply.recycle(); |
| 1400 | return list; |
| 1401 | } |
| 1402 | public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState() |
| 1403 | throws RemoteException { |
| 1404 | Parcel data = Parcel.obtain(); |
| 1405 | Parcel reply = Parcel.obtain(); |
| 1406 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1407 | mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0); |
| 1408 | reply.readException(); |
| 1409 | ArrayList<ActivityManager.ProcessErrorStateInfo> list |
| 1410 | = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR); |
| 1411 | data.recycle(); |
| 1412 | reply.recycle(); |
| 1413 | return list; |
| 1414 | } |
| 1415 | public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses() |
| 1416 | throws RemoteException { |
| 1417 | Parcel data = Parcel.obtain(); |
| 1418 | Parcel reply = Parcel.obtain(); |
| 1419 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1420 | mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0); |
| 1421 | reply.readException(); |
| 1422 | ArrayList<ActivityManager.RunningAppProcessInfo> list |
| 1423 | = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR); |
| 1424 | data.recycle(); |
| 1425 | reply.recycle(); |
| 1426 | return list; |
| 1427 | } |
| 1428 | public void moveTaskToFront(int task) throws RemoteException |
| 1429 | { |
| 1430 | Parcel data = Parcel.obtain(); |
| 1431 | Parcel reply = Parcel.obtain(); |
| 1432 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1433 | data.writeInt(task); |
| 1434 | mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0); |
| 1435 | reply.readException(); |
| 1436 | data.recycle(); |
| 1437 | reply.recycle(); |
| 1438 | } |
| 1439 | public void moveTaskToBack(int task) throws RemoteException |
| 1440 | { |
| 1441 | Parcel data = Parcel.obtain(); |
| 1442 | Parcel reply = Parcel.obtain(); |
| 1443 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1444 | data.writeInt(task); |
| 1445 | mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0); |
| 1446 | reply.readException(); |
| 1447 | data.recycle(); |
| 1448 | reply.recycle(); |
| 1449 | } |
| 1450 | public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) |
| 1451 | throws RemoteException { |
| 1452 | Parcel data = Parcel.obtain(); |
| 1453 | Parcel reply = Parcel.obtain(); |
| 1454 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1455 | data.writeStrongBinder(token); |
| 1456 | data.writeInt(nonRoot ? 1 : 0); |
| 1457 | mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0); |
| 1458 | reply.readException(); |
| 1459 | boolean res = reply.readInt() != 0; |
| 1460 | data.recycle(); |
| 1461 | reply.recycle(); |
| 1462 | return res; |
| 1463 | } |
| 1464 | public void moveTaskBackwards(int task) throws RemoteException |
| 1465 | { |
| 1466 | Parcel data = Parcel.obtain(); |
| 1467 | Parcel reply = Parcel.obtain(); |
| 1468 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1469 | data.writeInt(task); |
| 1470 | mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0); |
| 1471 | reply.readException(); |
| 1472 | data.recycle(); |
| 1473 | reply.recycle(); |
| 1474 | } |
| 1475 | public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException |
| 1476 | { |
| 1477 | Parcel data = Parcel.obtain(); |
| 1478 | Parcel reply = Parcel.obtain(); |
| 1479 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1480 | data.writeStrongBinder(token); |
| 1481 | data.writeInt(onlyRoot ? 1 : 0); |
| 1482 | mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1483 | reply.readException(); |
| 1484 | int res = reply.readInt(); |
| 1485 | data.recycle(); |
| 1486 | reply.recycle(); |
| 1487 | return res; |
| 1488 | } |
| 1489 | public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException |
| 1490 | { |
| 1491 | Parcel data = Parcel.obtain(); |
| 1492 | Parcel reply = Parcel.obtain(); |
| 1493 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1494 | data.writeStrongBinder(token); |
| 1495 | ComponentName.writeToParcel(className, data); |
| 1496 | mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0); |
| 1497 | reply.readException(); |
| 1498 | data.recycle(); |
| 1499 | reply.recycle(); |
| 1500 | } |
| 1501 | public void reportThumbnail(IBinder token, |
| 1502 | Bitmap thumbnail, CharSequence description) throws RemoteException |
| 1503 | { |
| 1504 | Parcel data = Parcel.obtain(); |
| 1505 | Parcel reply = Parcel.obtain(); |
| 1506 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1507 | data.writeStrongBinder(token); |
| 1508 | if (thumbnail != null) { |
| 1509 | data.writeInt(1); |
| 1510 | thumbnail.writeToParcel(data, 0); |
| 1511 | } else { |
| 1512 | data.writeInt(0); |
| 1513 | } |
| 1514 | TextUtils.writeToParcel(description, data, 0); |
| 1515 | mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1516 | reply.readException(); |
| 1517 | data.recycle(); |
| 1518 | reply.recycle(); |
| 1519 | } |
| 1520 | public ContentProviderHolder getContentProvider(IApplicationThread caller, |
| 1521 | String name) throws RemoteException |
| 1522 | { |
| 1523 | Parcel data = Parcel.obtain(); |
| 1524 | Parcel reply = Parcel.obtain(); |
| 1525 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1526 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1527 | data.writeString(name); |
| 1528 | mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); |
| 1529 | reply.readException(); |
| 1530 | int res = reply.readInt(); |
| 1531 | ContentProviderHolder cph = null; |
| 1532 | if (res != 0) { |
| 1533 | cph = ContentProviderHolder.CREATOR.createFromParcel(reply); |
| 1534 | } |
| 1535 | data.recycle(); |
| 1536 | reply.recycle(); |
| 1537 | return cph; |
| 1538 | } |
| 1539 | public void publishContentProviders(IApplicationThread caller, |
| 1540 | List<ContentProviderHolder> providers) throws RemoteException |
| 1541 | { |
| 1542 | Parcel data = Parcel.obtain(); |
| 1543 | Parcel reply = Parcel.obtain(); |
| 1544 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1545 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1546 | data.writeTypedList(providers); |
| 1547 | mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0); |
| 1548 | reply.readException(); |
| 1549 | data.recycle(); |
| 1550 | reply.recycle(); |
| 1551 | } |
| 1552 | |
| 1553 | public void removeContentProvider(IApplicationThread caller, |
| 1554 | String name) throws RemoteException { |
| 1555 | Parcel data = Parcel.obtain(); |
| 1556 | Parcel reply = Parcel.obtain(); |
| 1557 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1558 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1559 | data.writeString(name); |
| 1560 | mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); |
| 1561 | reply.readException(); |
| 1562 | data.recycle(); |
| 1563 | reply.recycle(); |
| 1564 | } |
| 1565 | |
| 1566 | public ComponentName startService(IApplicationThread caller, Intent service, |
| 1567 | String resolvedType) throws RemoteException |
| 1568 | { |
| 1569 | Parcel data = Parcel.obtain(); |
| 1570 | Parcel reply = Parcel.obtain(); |
| 1571 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1572 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1573 | service.writeToParcel(data, 0); |
| 1574 | data.writeString(resolvedType); |
| 1575 | mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0); |
| 1576 | reply.readException(); |
| 1577 | ComponentName res = ComponentName.readFromParcel(reply); |
| 1578 | data.recycle(); |
| 1579 | reply.recycle(); |
| 1580 | return res; |
| 1581 | } |
| 1582 | public int stopService(IApplicationThread caller, Intent service, |
| 1583 | String resolvedType) throws RemoteException |
| 1584 | { |
| 1585 | Parcel data = Parcel.obtain(); |
| 1586 | Parcel reply = Parcel.obtain(); |
| 1587 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1588 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1589 | service.writeToParcel(data, 0); |
| 1590 | data.writeString(resolvedType); |
| 1591 | mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0); |
| 1592 | reply.readException(); |
| 1593 | int res = reply.readInt(); |
| 1594 | reply.recycle(); |
| 1595 | data.recycle(); |
| 1596 | return res; |
| 1597 | } |
| 1598 | public boolean stopServiceToken(ComponentName className, IBinder token, |
| 1599 | int startId) throws RemoteException { |
| 1600 | Parcel data = Parcel.obtain(); |
| 1601 | Parcel reply = Parcel.obtain(); |
| 1602 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1603 | ComponentName.writeToParcel(className, data); |
| 1604 | data.writeStrongBinder(token); |
| 1605 | data.writeInt(startId); |
| 1606 | mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0); |
| 1607 | reply.readException(); |
| 1608 | boolean res = reply.readInt() != 0; |
| 1609 | data.recycle(); |
| 1610 | reply.recycle(); |
| 1611 | return res; |
| 1612 | } |
| 1613 | public void setServiceForeground(ComponentName className, IBinder token, |
| 1614 | boolean isForeground) throws RemoteException { |
| 1615 | Parcel data = Parcel.obtain(); |
| 1616 | Parcel reply = Parcel.obtain(); |
| 1617 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1618 | ComponentName.writeToParcel(className, data); |
| 1619 | data.writeStrongBinder(token); |
| 1620 | data.writeInt(isForeground ? 1 : 0); |
| 1621 | mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0); |
| 1622 | reply.readException(); |
| 1623 | data.recycle(); |
| 1624 | reply.recycle(); |
| 1625 | } |
| 1626 | public int bindService(IApplicationThread caller, IBinder token, |
| 1627 | Intent service, String resolvedType, IServiceConnection connection, |
| 1628 | int flags) throws RemoteException { |
| 1629 | Parcel data = Parcel.obtain(); |
| 1630 | Parcel reply = Parcel.obtain(); |
| 1631 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1632 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1633 | data.writeStrongBinder(token); |
| 1634 | service.writeToParcel(data, 0); |
| 1635 | data.writeString(resolvedType); |
| 1636 | data.writeStrongBinder(connection.asBinder()); |
| 1637 | data.writeInt(flags); |
| 1638 | mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0); |
| 1639 | reply.readException(); |
| 1640 | int res = reply.readInt(); |
| 1641 | data.recycle(); |
| 1642 | reply.recycle(); |
| 1643 | return res; |
| 1644 | } |
| 1645 | public boolean unbindService(IServiceConnection connection) throws RemoteException |
| 1646 | { |
| 1647 | Parcel data = Parcel.obtain(); |
| 1648 | Parcel reply = Parcel.obtain(); |
| 1649 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1650 | data.writeStrongBinder(connection.asBinder()); |
| 1651 | mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0); |
| 1652 | reply.readException(); |
| 1653 | boolean res = reply.readInt() != 0; |
| 1654 | data.recycle(); |
| 1655 | reply.recycle(); |
| 1656 | return res; |
| 1657 | } |
| 1658 | |
| 1659 | public void publishService(IBinder token, |
| 1660 | Intent intent, IBinder service) throws RemoteException { |
| 1661 | Parcel data = Parcel.obtain(); |
| 1662 | Parcel reply = Parcel.obtain(); |
| 1663 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1664 | data.writeStrongBinder(token); |
| 1665 | intent.writeToParcel(data, 0); |
| 1666 | data.writeStrongBinder(service); |
| 1667 | mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0); |
| 1668 | reply.readException(); |
| 1669 | data.recycle(); |
| 1670 | reply.recycle(); |
| 1671 | } |
| 1672 | |
| 1673 | public void unbindFinished(IBinder token, Intent intent, boolean doRebind) |
| 1674 | throws RemoteException { |
| 1675 | Parcel data = Parcel.obtain(); |
| 1676 | Parcel reply = Parcel.obtain(); |
| 1677 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1678 | data.writeStrongBinder(token); |
| 1679 | intent.writeToParcel(data, 0); |
| 1680 | data.writeInt(doRebind ? 1 : 0); |
| 1681 | mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0); |
| 1682 | reply.readException(); |
| 1683 | data.recycle(); |
| 1684 | reply.recycle(); |
| 1685 | } |
| 1686 | |
| 1687 | public void serviceDoneExecuting(IBinder token) throws RemoteException { |
| 1688 | Parcel data = Parcel.obtain(); |
| 1689 | Parcel reply = Parcel.obtain(); |
| 1690 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1691 | data.writeStrongBinder(token); |
| 1692 | mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1693 | reply.readException(); |
| 1694 | data.recycle(); |
| 1695 | reply.recycle(); |
| 1696 | } |
| 1697 | |
| 1698 | public IBinder peekService(Intent service, String resolvedType) throws RemoteException { |
| 1699 | Parcel data = Parcel.obtain(); |
| 1700 | Parcel reply = Parcel.obtain(); |
| 1701 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1702 | service.writeToParcel(data, 0); |
| 1703 | data.writeString(resolvedType); |
| 1704 | mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0); |
| 1705 | reply.readException(); |
| 1706 | IBinder binder = reply.readStrongBinder(); |
| 1707 | reply.recycle(); |
| 1708 | data.recycle(); |
| 1709 | return binder; |
| 1710 | } |
| 1711 | |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame^] | 1712 | public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode) |
| 1713 | throws RemoteException { |
| 1714 | Parcel data = Parcel.obtain(); |
| 1715 | Parcel reply = Parcel.obtain(); |
| 1716 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1717 | app.writeToParcel(data, 0); |
| 1718 | data.writeInt(backupRestoreMode); |
| 1719 | mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0); |
| 1720 | reply.readException(); |
| 1721 | boolean success = reply.readInt() != 0; |
| 1722 | reply.recycle(); |
| 1723 | data.recycle(); |
| 1724 | return success; |
| 1725 | } |
| 1726 | |
| 1727 | public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException { |
| 1728 | Parcel data = Parcel.obtain(); |
| 1729 | Parcel reply = Parcel.obtain(); |
| 1730 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1731 | data.writeString(packageName); |
| 1732 | data.writeStrongBinder(agent); |
| 1733 | mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0); |
| 1734 | reply.recycle(); |
| 1735 | data.recycle(); |
| 1736 | } |
| 1737 | |
| 1738 | public void unbindBackupAgent(ApplicationInfo app) throws RemoteException { |
| 1739 | Parcel data = Parcel.obtain(); |
| 1740 | Parcel reply = Parcel.obtain(); |
| 1741 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1742 | app.writeToParcel(data, 0); |
| 1743 | mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0); |
| 1744 | reply.readException(); |
| 1745 | reply.recycle(); |
| 1746 | data.recycle(); |
| 1747 | } |
| 1748 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1749 | public boolean startInstrumentation(ComponentName className, String profileFile, |
| 1750 | int flags, Bundle arguments, IInstrumentationWatcher watcher) |
| 1751 | throws RemoteException { |
| 1752 | Parcel data = Parcel.obtain(); |
| 1753 | Parcel reply = Parcel.obtain(); |
| 1754 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1755 | ComponentName.writeToParcel(className, data); |
| 1756 | data.writeString(profileFile); |
| 1757 | data.writeInt(flags); |
| 1758 | data.writeBundle(arguments); |
| 1759 | data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); |
| 1760 | mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0); |
| 1761 | reply.readException(); |
| 1762 | boolean res = reply.readInt() != 0; |
| 1763 | reply.recycle(); |
| 1764 | data.recycle(); |
| 1765 | return res; |
| 1766 | } |
| 1767 | |
| 1768 | public void finishInstrumentation(IApplicationThread target, |
| 1769 | int resultCode, Bundle results) throws RemoteException { |
| 1770 | Parcel data = Parcel.obtain(); |
| 1771 | Parcel reply = Parcel.obtain(); |
| 1772 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1773 | data.writeStrongBinder(target != null ? target.asBinder() : null); |
| 1774 | data.writeInt(resultCode); |
| 1775 | data.writeBundle(results); |
| 1776 | mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0); |
| 1777 | reply.readException(); |
| 1778 | data.recycle(); |
| 1779 | reply.recycle(); |
| 1780 | } |
| 1781 | public Configuration getConfiguration() throws RemoteException |
| 1782 | { |
| 1783 | Parcel data = Parcel.obtain(); |
| 1784 | Parcel reply = Parcel.obtain(); |
| 1785 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1786 | mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0); |
| 1787 | reply.readException(); |
| 1788 | Configuration res = Configuration.CREATOR.createFromParcel(reply); |
| 1789 | reply.recycle(); |
| 1790 | data.recycle(); |
| 1791 | return res; |
| 1792 | } |
| 1793 | public void updateConfiguration(Configuration values) throws RemoteException |
| 1794 | { |
| 1795 | Parcel data = Parcel.obtain(); |
| 1796 | Parcel reply = Parcel.obtain(); |
| 1797 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1798 | values.writeToParcel(data, 0); |
| 1799 | mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0); |
| 1800 | reply.readException(); |
| 1801 | data.recycle(); |
| 1802 | reply.recycle(); |
| 1803 | } |
| 1804 | public void setRequestedOrientation(IBinder token, int requestedOrientation) |
| 1805 | throws RemoteException { |
| 1806 | Parcel data = Parcel.obtain(); |
| 1807 | Parcel reply = Parcel.obtain(); |
| 1808 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1809 | data.writeStrongBinder(token); |
| 1810 | data.writeInt(requestedOrientation); |
| 1811 | mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); |
| 1812 | reply.readException(); |
| 1813 | data.recycle(); |
| 1814 | reply.recycle(); |
| 1815 | } |
| 1816 | public int getRequestedOrientation(IBinder token) throws RemoteException { |
| 1817 | Parcel data = Parcel.obtain(); |
| 1818 | Parcel reply = Parcel.obtain(); |
| 1819 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1820 | data.writeStrongBinder(token); |
| 1821 | mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); |
| 1822 | reply.readException(); |
| 1823 | int res = reply.readInt(); |
| 1824 | data.recycle(); |
| 1825 | reply.recycle(); |
| 1826 | return res; |
| 1827 | } |
| 1828 | public ComponentName getActivityClassForToken(IBinder token) |
| 1829 | throws RemoteException { |
| 1830 | Parcel data = Parcel.obtain(); |
| 1831 | Parcel reply = Parcel.obtain(); |
| 1832 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1833 | data.writeStrongBinder(token); |
| 1834 | mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0); |
| 1835 | reply.readException(); |
| 1836 | ComponentName res = ComponentName.readFromParcel(reply); |
| 1837 | data.recycle(); |
| 1838 | reply.recycle(); |
| 1839 | return res; |
| 1840 | } |
| 1841 | public String getPackageForToken(IBinder token) throws RemoteException |
| 1842 | { |
| 1843 | Parcel data = Parcel.obtain(); |
| 1844 | Parcel reply = Parcel.obtain(); |
| 1845 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1846 | data.writeStrongBinder(token); |
| 1847 | mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0); |
| 1848 | reply.readException(); |
| 1849 | String res = reply.readString(); |
| 1850 | data.recycle(); |
| 1851 | reply.recycle(); |
| 1852 | return res; |
| 1853 | } |
| 1854 | public IIntentSender getIntentSender(int type, |
| 1855 | String packageName, IBinder token, String resultWho, |
| 1856 | int requestCode, Intent intent, String resolvedType, int flags) |
| 1857 | throws RemoteException { |
| 1858 | Parcel data = Parcel.obtain(); |
| 1859 | Parcel reply = Parcel.obtain(); |
| 1860 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1861 | data.writeInt(type); |
| 1862 | data.writeString(packageName); |
| 1863 | data.writeStrongBinder(token); |
| 1864 | data.writeString(resultWho); |
| 1865 | data.writeInt(requestCode); |
| 1866 | if (intent != null) { |
| 1867 | data.writeInt(1); |
| 1868 | intent.writeToParcel(data, 0); |
| 1869 | } else { |
| 1870 | data.writeInt(0); |
| 1871 | } |
| 1872 | data.writeString(resolvedType); |
| 1873 | data.writeInt(flags); |
| 1874 | mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0); |
| 1875 | reply.readException(); |
| 1876 | IIntentSender res = IIntentSender.Stub.asInterface( |
| 1877 | reply.readStrongBinder()); |
| 1878 | data.recycle(); |
| 1879 | reply.recycle(); |
| 1880 | return res; |
| 1881 | } |
| 1882 | public void cancelIntentSender(IIntentSender sender) throws RemoteException { |
| 1883 | Parcel data = Parcel.obtain(); |
| 1884 | Parcel reply = Parcel.obtain(); |
| 1885 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1886 | data.writeStrongBinder(sender.asBinder()); |
| 1887 | mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0); |
| 1888 | reply.readException(); |
| 1889 | data.recycle(); |
| 1890 | reply.recycle(); |
| 1891 | } |
| 1892 | public String getPackageForIntentSender(IIntentSender sender) throws RemoteException { |
| 1893 | Parcel data = Parcel.obtain(); |
| 1894 | Parcel reply = Parcel.obtain(); |
| 1895 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1896 | data.writeStrongBinder(sender.asBinder()); |
| 1897 | mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); |
| 1898 | reply.readException(); |
| 1899 | String res = reply.readString(); |
| 1900 | data.recycle(); |
| 1901 | reply.recycle(); |
| 1902 | return res; |
| 1903 | } |
| 1904 | public void setProcessLimit(int max) throws RemoteException |
| 1905 | { |
| 1906 | Parcel data = Parcel.obtain(); |
| 1907 | Parcel reply = Parcel.obtain(); |
| 1908 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1909 | data.writeInt(max); |
| 1910 | mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); |
| 1911 | reply.readException(); |
| 1912 | data.recycle(); |
| 1913 | reply.recycle(); |
| 1914 | } |
| 1915 | public int getProcessLimit() throws RemoteException |
| 1916 | { |
| 1917 | Parcel data = Parcel.obtain(); |
| 1918 | Parcel reply = Parcel.obtain(); |
| 1919 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1920 | mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); |
| 1921 | reply.readException(); |
| 1922 | int res = reply.readInt(); |
| 1923 | data.recycle(); |
| 1924 | reply.recycle(); |
| 1925 | return res; |
| 1926 | } |
| 1927 | public void setProcessForeground(IBinder token, int pid, |
| 1928 | boolean isForeground) throws RemoteException { |
| 1929 | Parcel data = Parcel.obtain(); |
| 1930 | Parcel reply = Parcel.obtain(); |
| 1931 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1932 | data.writeStrongBinder(token); |
| 1933 | data.writeInt(pid); |
| 1934 | data.writeInt(isForeground ? 1 : 0); |
| 1935 | mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0); |
| 1936 | reply.readException(); |
| 1937 | data.recycle(); |
| 1938 | reply.recycle(); |
| 1939 | } |
| 1940 | public int checkPermission(String permission, int pid, int uid) |
| 1941 | throws RemoteException { |
| 1942 | Parcel data = Parcel.obtain(); |
| 1943 | Parcel reply = Parcel.obtain(); |
| 1944 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1945 | data.writeString(permission); |
| 1946 | data.writeInt(pid); |
| 1947 | data.writeInt(uid); |
| 1948 | mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0); |
| 1949 | reply.readException(); |
| 1950 | int res = reply.readInt(); |
| 1951 | data.recycle(); |
| 1952 | reply.recycle(); |
| 1953 | return res; |
| 1954 | } |
| 1955 | public boolean clearApplicationUserData(final String packageName, |
| 1956 | final IPackageDataObserver observer) throws RemoteException { |
| 1957 | Parcel data = Parcel.obtain(); |
| 1958 | Parcel reply = Parcel.obtain(); |
| 1959 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1960 | data.writeString(packageName); |
| 1961 | data.writeStrongBinder(observer.asBinder()); |
| 1962 | mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0); |
| 1963 | reply.readException(); |
| 1964 | boolean res = reply.readInt() != 0; |
| 1965 | data.recycle(); |
| 1966 | reply.recycle(); |
| 1967 | return res; |
| 1968 | } |
| 1969 | public int checkUriPermission(Uri uri, int pid, int uid, int mode) |
| 1970 | throws RemoteException { |
| 1971 | Parcel data = Parcel.obtain(); |
| 1972 | Parcel reply = Parcel.obtain(); |
| 1973 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1974 | uri.writeToParcel(data, 0); |
| 1975 | data.writeInt(pid); |
| 1976 | data.writeInt(uid); |
| 1977 | data.writeInt(mode); |
| 1978 | mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0); |
| 1979 | reply.readException(); |
| 1980 | int res = reply.readInt(); |
| 1981 | data.recycle(); |
| 1982 | reply.recycle(); |
| 1983 | return res; |
| 1984 | } |
| 1985 | public void grantUriPermission(IApplicationThread caller, String targetPkg, |
| 1986 | Uri uri, int mode) throws RemoteException { |
| 1987 | Parcel data = Parcel.obtain(); |
| 1988 | Parcel reply = Parcel.obtain(); |
| 1989 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1990 | data.writeStrongBinder(caller.asBinder()); |
| 1991 | data.writeString(targetPkg); |
| 1992 | uri.writeToParcel(data, 0); |
| 1993 | data.writeInt(mode); |
| 1994 | mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); |
| 1995 | reply.readException(); |
| 1996 | data.recycle(); |
| 1997 | reply.recycle(); |
| 1998 | } |
| 1999 | public void revokeUriPermission(IApplicationThread caller, Uri uri, |
| 2000 | int mode) throws RemoteException { |
| 2001 | Parcel data = Parcel.obtain(); |
| 2002 | Parcel reply = Parcel.obtain(); |
| 2003 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2004 | data.writeStrongBinder(caller.asBinder()); |
| 2005 | uri.writeToParcel(data, 0); |
| 2006 | data.writeInt(mode); |
| 2007 | mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0); |
| 2008 | reply.readException(); |
| 2009 | data.recycle(); |
| 2010 | reply.recycle(); |
| 2011 | } |
| 2012 | public void showWaitingForDebugger(IApplicationThread who, boolean waiting) |
| 2013 | throws RemoteException { |
| 2014 | Parcel data = Parcel.obtain(); |
| 2015 | Parcel reply = Parcel.obtain(); |
| 2016 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2017 | data.writeStrongBinder(who.asBinder()); |
| 2018 | data.writeInt(waiting ? 1 : 0); |
| 2019 | mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0); |
| 2020 | reply.readException(); |
| 2021 | data.recycle(); |
| 2022 | reply.recycle(); |
| 2023 | } |
| 2024 | public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException { |
| 2025 | Parcel data = Parcel.obtain(); |
| 2026 | Parcel reply = Parcel.obtain(); |
| 2027 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2028 | mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0); |
| 2029 | reply.readException(); |
| 2030 | outInfo.readFromParcel(reply); |
| 2031 | data.recycle(); |
| 2032 | reply.recycle(); |
| 2033 | } |
| 2034 | public void unhandledBack() throws RemoteException |
| 2035 | { |
| 2036 | Parcel data = Parcel.obtain(); |
| 2037 | Parcel reply = Parcel.obtain(); |
| 2038 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2039 | mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0); |
| 2040 | reply.readException(); |
| 2041 | data.recycle(); |
| 2042 | reply.recycle(); |
| 2043 | } |
| 2044 | public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException |
| 2045 | { |
| 2046 | Parcel data = Parcel.obtain(); |
| 2047 | Parcel reply = Parcel.obtain(); |
| 2048 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2049 | mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0); |
| 2050 | reply.readException(); |
| 2051 | ParcelFileDescriptor pfd = null; |
| 2052 | if (reply.readInt() != 0) { |
| 2053 | pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply); |
| 2054 | } |
| 2055 | data.recycle(); |
| 2056 | reply.recycle(); |
| 2057 | return pfd; |
| 2058 | } |
| 2059 | public void goingToSleep() throws RemoteException |
| 2060 | { |
| 2061 | Parcel data = Parcel.obtain(); |
| 2062 | Parcel reply = Parcel.obtain(); |
| 2063 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2064 | mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0); |
| 2065 | reply.readException(); |
| 2066 | data.recycle(); |
| 2067 | reply.recycle(); |
| 2068 | } |
| 2069 | public void wakingUp() throws RemoteException |
| 2070 | { |
| 2071 | Parcel data = Parcel.obtain(); |
| 2072 | Parcel reply = Parcel.obtain(); |
| 2073 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2074 | mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0); |
| 2075 | reply.readException(); |
| 2076 | data.recycle(); |
| 2077 | reply.recycle(); |
| 2078 | } |
| 2079 | public void setDebugApp( |
| 2080 | String packageName, boolean waitForDebugger, boolean persistent) |
| 2081 | throws RemoteException |
| 2082 | { |
| 2083 | Parcel data = Parcel.obtain(); |
| 2084 | Parcel reply = Parcel.obtain(); |
| 2085 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2086 | data.writeString(packageName); |
| 2087 | data.writeInt(waitForDebugger ? 1 : 0); |
| 2088 | data.writeInt(persistent ? 1 : 0); |
| 2089 | mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0); |
| 2090 | reply.readException(); |
| 2091 | data.recycle(); |
| 2092 | reply.recycle(); |
| 2093 | } |
| 2094 | public void setAlwaysFinish(boolean enabled) throws RemoteException |
| 2095 | { |
| 2096 | Parcel data = Parcel.obtain(); |
| 2097 | Parcel reply = Parcel.obtain(); |
| 2098 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2099 | data.writeInt(enabled ? 1 : 0); |
| 2100 | mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0); |
| 2101 | reply.readException(); |
| 2102 | data.recycle(); |
| 2103 | reply.recycle(); |
| 2104 | } |
| 2105 | public void setActivityWatcher(IActivityWatcher watcher) throws RemoteException |
| 2106 | { |
| 2107 | Parcel data = Parcel.obtain(); |
| 2108 | Parcel reply = Parcel.obtain(); |
| 2109 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2110 | data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); |
| 2111 | mRemote.transact(SET_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0); |
| 2112 | reply.readException(); |
| 2113 | data.recycle(); |
| 2114 | reply.recycle(); |
| 2115 | } |
| 2116 | public void enterSafeMode() throws RemoteException { |
| 2117 | Parcel data = Parcel.obtain(); |
| 2118 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2119 | mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0); |
| 2120 | data.recycle(); |
| 2121 | } |
| 2122 | public void noteWakeupAlarm(IIntentSender sender) throws RemoteException { |
| 2123 | Parcel data = Parcel.obtain(); |
| 2124 | data.writeStrongBinder(sender.asBinder()); |
| 2125 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2126 | mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0); |
| 2127 | data.recycle(); |
| 2128 | } |
| 2129 | public boolean killPidsForMemory(int[] pids) throws RemoteException { |
| 2130 | Parcel data = Parcel.obtain(); |
| 2131 | Parcel reply = Parcel.obtain(); |
| 2132 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2133 | data.writeIntArray(pids); |
| 2134 | mRemote.transact(KILL_PIDS_FOR_MEMORY_TRANSACTION, data, reply, 0); |
| 2135 | boolean res = reply.readInt() != 0; |
| 2136 | data.recycle(); |
| 2137 | reply.recycle(); |
| 2138 | return res; |
| 2139 | } |
| 2140 | public void reportPss(IApplicationThread caller, int pss) throws RemoteException { |
| 2141 | Parcel data = Parcel.obtain(); |
| 2142 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2143 | data.writeStrongBinder(caller.asBinder()); |
| 2144 | data.writeInt(pss); |
| 2145 | mRemote.transact(REPORT_PSS_TRANSACTION, data, null, 0); |
| 2146 | data.recycle(); |
| 2147 | } |
| 2148 | public void startRunning(String pkg, String cls, String action, |
| 2149 | String indata) throws RemoteException { |
| 2150 | Parcel data = Parcel.obtain(); |
| 2151 | Parcel reply = Parcel.obtain(); |
| 2152 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2153 | data.writeString(pkg); |
| 2154 | data.writeString(cls); |
| 2155 | data.writeString(action); |
| 2156 | data.writeString(indata); |
| 2157 | mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0); |
| 2158 | reply.readException(); |
| 2159 | data.recycle(); |
| 2160 | reply.recycle(); |
| 2161 | } |
| 2162 | public void systemReady() throws RemoteException |
| 2163 | { |
| 2164 | Parcel data = Parcel.obtain(); |
| 2165 | Parcel reply = Parcel.obtain(); |
| 2166 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2167 | mRemote.transact(SYSTEM_READY_TRANSACTION, data, reply, 0); |
| 2168 | reply.readException(); |
| 2169 | data.recycle(); |
| 2170 | reply.recycle(); |
| 2171 | } |
| 2172 | public boolean testIsSystemReady() |
| 2173 | { |
| 2174 | /* this base class version is never called */ |
| 2175 | return true; |
| 2176 | } |
| 2177 | public int handleApplicationError(IBinder app, int flags, |
| 2178 | String tag, String shortMsg, String longMsg, |
| 2179 | byte[] crashData) throws RemoteException |
| 2180 | { |
| 2181 | Parcel data = Parcel.obtain(); |
| 2182 | Parcel reply = Parcel.obtain(); |
| 2183 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2184 | data.writeStrongBinder(app); |
| 2185 | data.writeInt(flags); |
| 2186 | data.writeString(tag); |
| 2187 | data.writeString(shortMsg); |
| 2188 | data.writeString(longMsg); |
| 2189 | data.writeByteArray(crashData); |
| 2190 | mRemote.transact(HANDLE_APPLICATION_ERROR_TRANSACTION, data, reply, 0); |
| 2191 | reply.readException(); |
| 2192 | int res = reply.readInt(); |
| 2193 | reply.recycle(); |
| 2194 | data.recycle(); |
| 2195 | return res; |
| 2196 | } |
| 2197 | |
| 2198 | public void signalPersistentProcesses(int sig) throws RemoteException { |
| 2199 | Parcel data = Parcel.obtain(); |
| 2200 | Parcel reply = Parcel.obtain(); |
| 2201 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2202 | data.writeInt(sig); |
| 2203 | mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0); |
| 2204 | reply.readException(); |
| 2205 | data.recycle(); |
| 2206 | reply.recycle(); |
| 2207 | } |
| 2208 | |
| 2209 | public void restartPackage(String packageName) throws RemoteException { |
| 2210 | Parcel data = Parcel.obtain(); |
| 2211 | Parcel reply = Parcel.obtain(); |
| 2212 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2213 | data.writeString(packageName); |
| 2214 | mRemote.transact(RESTART_PACKAGE_TRANSACTION, data, reply, 0); |
| 2215 | reply.readException(); |
| 2216 | data.recycle(); |
| 2217 | reply.recycle(); |
| 2218 | } |
| 2219 | |
| 2220 | public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException |
| 2221 | { |
| 2222 | Parcel data = Parcel.obtain(); |
| 2223 | Parcel reply = Parcel.obtain(); |
| 2224 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2225 | mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0); |
| 2226 | reply.readException(); |
| 2227 | ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply); |
| 2228 | reply.recycle(); |
| 2229 | data.recycle(); |
| 2230 | return res; |
| 2231 | } |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 2232 | |
| 2233 | public boolean profileControl(String process, boolean start, |
| 2234 | String path) throws RemoteException |
| 2235 | { |
| 2236 | Parcel data = Parcel.obtain(); |
| 2237 | Parcel reply = Parcel.obtain(); |
| 2238 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2239 | data.writeString(process); |
| 2240 | data.writeInt(start ? 1 : 0); |
| 2241 | data.writeString(path); |
| 2242 | mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0); |
| 2243 | reply.readException(); |
| 2244 | boolean res = reply.readInt() != 0; |
| 2245 | reply.recycle(); |
| 2246 | data.recycle(); |
| 2247 | return res; |
| 2248 | } |
| 2249 | |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 2250 | public boolean shutdown(int timeout) throws RemoteException |
| 2251 | { |
| 2252 | Parcel data = Parcel.obtain(); |
| 2253 | Parcel reply = Parcel.obtain(); |
| 2254 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2255 | data.writeInt(timeout); |
| 2256 | mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0); |
| 2257 | reply.readException(); |
| 2258 | boolean res = reply.readInt() != 0; |
| 2259 | reply.recycle(); |
| 2260 | data.recycle(); |
| 2261 | return res; |
| 2262 | } |
| 2263 | |
Dianne Hackborn | 95fc68f | 2009-05-19 18:37:45 -0700 | [diff] [blame] | 2264 | public void stopAppSwitches() throws RemoteException { |
| 2265 | Parcel data = Parcel.obtain(); |
| 2266 | Parcel reply = Parcel.obtain(); |
| 2267 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2268 | mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0); |
| 2269 | reply.readException(); |
| 2270 | reply.recycle(); |
| 2271 | data.recycle(); |
| 2272 | } |
| 2273 | |
| 2274 | public void resumeAppSwitches() throws RemoteException { |
| 2275 | Parcel data = Parcel.obtain(); |
| 2276 | Parcel reply = Parcel.obtain(); |
| 2277 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2278 | mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0); |
| 2279 | reply.readException(); |
| 2280 | reply.recycle(); |
| 2281 | data.recycle(); |
| 2282 | } |
| 2283 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2284 | private IBinder mRemote; |
| 2285 | } |