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; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 | import android.content.Intent; |
| 21 | import android.content.IntentFilter; |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 22 | import android.content.IIntentSender; |
| 23 | import android.content.IIntentReceiver; |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 24 | import android.content.IntentSender; |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 25 | import android.content.pm.ApplicationInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | import android.content.pm.ConfigurationInfo; |
| 27 | import android.content.pm.IPackageDataObserver; |
| 28 | import android.content.res.Configuration; |
| 29 | import android.graphics.Bitmap; |
| 30 | import android.net.Uri; |
| 31 | import android.os.Binder; |
| 32 | import android.os.Bundle; |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 33 | import android.os.Debug; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 34 | import android.os.Parcelable; |
| 35 | import android.os.ParcelFileDescriptor; |
| 36 | import android.os.RemoteException; |
| 37 | import android.os.IBinder; |
| 38 | import android.os.Parcel; |
| 39 | import android.os.ServiceManager; |
Brad Fitzpatrick | cb9ceb1 | 2010-07-29 14:29:02 -0700 | [diff] [blame] | 40 | import android.os.StrictMode; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | import android.text.TextUtils; |
| 42 | import android.util.Config; |
| 43 | import android.util.Log; |
| 44 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | import java.util.ArrayList; |
| 46 | import java.util.List; |
| 47 | |
| 48 | /** {@hide} */ |
| 49 | public abstract class ActivityManagerNative extends Binder implements IActivityManager |
| 50 | { |
| 51 | /** |
| 52 | * Cast a Binder object into an activity manager interface, generating |
| 53 | * a proxy if needed. |
| 54 | */ |
| 55 | static public IActivityManager asInterface(IBinder obj) |
| 56 | { |
| 57 | if (obj == null) { |
| 58 | return null; |
| 59 | } |
| 60 | IActivityManager in = |
| 61 | (IActivityManager)obj.queryLocalInterface(descriptor); |
| 62 | if (in != null) { |
| 63 | return in; |
| 64 | } |
| 65 | |
| 66 | return new ActivityManagerProxy(obj); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Retrieve the system's default/global activity manager. |
| 71 | */ |
| 72 | static public IActivityManager getDefault() |
| 73 | { |
| 74 | if (gDefault != null) { |
| 75 | //if (Config.LOGV) Log.v( |
| 76 | // "ActivityManager", "returning cur default = " + gDefault); |
| 77 | return gDefault; |
| 78 | } |
| 79 | IBinder b = ServiceManager.getService("activity"); |
| 80 | if (Config.LOGV) Log.v( |
| 81 | "ActivityManager", "default service binder = " + b); |
| 82 | gDefault = asInterface(b); |
| 83 | if (Config.LOGV) Log.v( |
| 84 | "ActivityManager", "default service = " + gDefault); |
| 85 | return gDefault; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Convenience for checking whether the system is ready. For internal use only. |
| 90 | */ |
| 91 | static public boolean isSystemReady() { |
| 92 | if (!sSystemReady) { |
| 93 | sSystemReady = getDefault().testIsSystemReady(); |
| 94 | } |
| 95 | return sSystemReady; |
| 96 | } |
| 97 | static boolean sSystemReady = false; |
| 98 | |
| 99 | /** |
| 100 | * Convenience for sending a sticky broadcast. For internal use only. |
| 101 | * If you don't care about permission, use null. |
| 102 | */ |
| 103 | static public void broadcastStickyIntent(Intent intent, String permission) |
| 104 | { |
| 105 | try { |
| 106 | getDefault().broadcastIntent( |
| 107 | null, intent, null, null, Activity.RESULT_OK, null, null, |
| 108 | null /*permission*/, false, true); |
| 109 | } catch (RemoteException ex) { |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | static public void noteWakeupAlarm(PendingIntent ps) { |
| 114 | try { |
| 115 | getDefault().noteWakeupAlarm(ps.getTarget()); |
| 116 | } catch (RemoteException ex) { |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | public ActivityManagerNative() |
| 121 | { |
| 122 | attachInterface(this, descriptor); |
| 123 | } |
| 124 | |
| 125 | public boolean onTransact(int code, Parcel data, Parcel reply, int flags) |
| 126 | throws RemoteException { |
| 127 | switch (code) { |
| 128 | case START_ACTIVITY_TRANSACTION: |
| 129 | { |
| 130 | data.enforceInterface(IActivityManager.descriptor); |
| 131 | IBinder b = data.readStrongBinder(); |
| 132 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 133 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 134 | String resolvedType = data.readString(); |
| 135 | Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR); |
| 136 | int grantedMode = data.readInt(); |
| 137 | IBinder resultTo = data.readStrongBinder(); |
| 138 | String resultWho = data.readString(); |
| 139 | int requestCode = data.readInt(); |
| 140 | boolean onlyIfNeeded = data.readInt() != 0; |
| 141 | boolean debug = data.readInt() != 0; |
| 142 | int result = startActivity(app, intent, resolvedType, |
| 143 | grantedUriPermissions, grantedMode, resultTo, resultWho, |
| 144 | requestCode, onlyIfNeeded, debug); |
| 145 | reply.writeNoException(); |
| 146 | reply.writeInt(result); |
| 147 | return true; |
| 148 | } |
Dianne Hackborn | bcbcaa7 | 2009-09-10 10:54:46 -0700 | [diff] [blame] | 149 | |
Dianne Hackborn | 8f7f35e | 2010-02-25 18:48:12 -0800 | [diff] [blame] | 150 | case START_ACTIVITY_AND_WAIT_TRANSACTION: |
| 151 | { |
| 152 | data.enforceInterface(IActivityManager.descriptor); |
| 153 | IBinder b = data.readStrongBinder(); |
| 154 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 155 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 156 | String resolvedType = data.readString(); |
| 157 | Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR); |
| 158 | int grantedMode = data.readInt(); |
| 159 | IBinder resultTo = data.readStrongBinder(); |
| 160 | String resultWho = data.readString(); |
| 161 | int requestCode = data.readInt(); |
| 162 | boolean onlyIfNeeded = data.readInt() != 0; |
| 163 | boolean debug = data.readInt() != 0; |
| 164 | WaitResult result = startActivityAndWait(app, intent, resolvedType, |
| 165 | grantedUriPermissions, grantedMode, resultTo, resultWho, |
| 166 | requestCode, onlyIfNeeded, debug); |
| 167 | reply.writeNoException(); |
| 168 | result.writeToParcel(reply, 0); |
| 169 | return true; |
| 170 | } |
| 171 | |
Dianne Hackborn | 2ccda4d | 2010-03-22 21:49:15 -0700 | [diff] [blame] | 172 | case START_ACTIVITY_WITH_CONFIG_TRANSACTION: |
| 173 | { |
| 174 | data.enforceInterface(IActivityManager.descriptor); |
| 175 | IBinder b = data.readStrongBinder(); |
| 176 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 177 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 178 | String resolvedType = data.readString(); |
| 179 | Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR); |
| 180 | int grantedMode = data.readInt(); |
| 181 | IBinder resultTo = data.readStrongBinder(); |
| 182 | String resultWho = data.readString(); |
| 183 | int requestCode = data.readInt(); |
| 184 | boolean onlyIfNeeded = data.readInt() != 0; |
| 185 | boolean debug = data.readInt() != 0; |
| 186 | Configuration config = Configuration.CREATOR.createFromParcel(data); |
| 187 | int result = startActivityWithConfig(app, intent, resolvedType, |
| 188 | grantedUriPermissions, grantedMode, resultTo, resultWho, |
| 189 | requestCode, onlyIfNeeded, debug, config); |
| 190 | reply.writeNoException(); |
| 191 | reply.writeInt(result); |
| 192 | return true; |
| 193 | } |
| 194 | |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 195 | case START_ACTIVITY_INTENT_SENDER_TRANSACTION: |
Dianne Hackborn | bcbcaa7 | 2009-09-10 10:54:46 -0700 | [diff] [blame] | 196 | { |
| 197 | data.enforceInterface(IActivityManager.descriptor); |
| 198 | IBinder b = data.readStrongBinder(); |
| 199 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 200 | IntentSender intent = IntentSender.CREATOR.createFromParcel(data); |
Dianne Hackborn | bcbcaa7 | 2009-09-10 10:54:46 -0700 | [diff] [blame] | 201 | Intent fillInIntent = null; |
| 202 | if (data.readInt() != 0) { |
| 203 | fillInIntent = Intent.CREATOR.createFromParcel(data); |
| 204 | } |
| 205 | String resolvedType = data.readString(); |
| 206 | IBinder resultTo = data.readStrongBinder(); |
| 207 | String resultWho = data.readString(); |
| 208 | int requestCode = data.readInt(); |
| 209 | int flagsMask = data.readInt(); |
| 210 | int flagsValues = data.readInt(); |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 211 | int result = startActivityIntentSender(app, intent, |
Dianne Hackborn | bcbcaa7 | 2009-09-10 10:54:46 -0700 | [diff] [blame] | 212 | fillInIntent, resolvedType, resultTo, resultWho, |
| 213 | requestCode, flagsMask, flagsValues); |
| 214 | reply.writeNoException(); |
| 215 | reply.writeInt(result); |
| 216 | return true; |
| 217 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 218 | |
| 219 | case START_NEXT_MATCHING_ACTIVITY_TRANSACTION: |
| 220 | { |
| 221 | data.enforceInterface(IActivityManager.descriptor); |
| 222 | IBinder callingActivity = data.readStrongBinder(); |
| 223 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 224 | boolean result = startNextMatchingActivity(callingActivity, intent); |
| 225 | reply.writeNoException(); |
| 226 | reply.writeInt(result ? 1 : 0); |
| 227 | return true; |
| 228 | } |
| 229 | |
| 230 | case FINISH_ACTIVITY_TRANSACTION: { |
| 231 | data.enforceInterface(IActivityManager.descriptor); |
| 232 | IBinder token = data.readStrongBinder(); |
| 233 | Intent resultData = null; |
| 234 | int resultCode = data.readInt(); |
| 235 | if (data.readInt() != 0) { |
| 236 | resultData = Intent.CREATOR.createFromParcel(data); |
| 237 | } |
| 238 | boolean res = finishActivity(token, resultCode, resultData); |
| 239 | reply.writeNoException(); |
| 240 | reply.writeInt(res ? 1 : 0); |
| 241 | return true; |
| 242 | } |
| 243 | |
| 244 | case FINISH_SUB_ACTIVITY_TRANSACTION: { |
| 245 | data.enforceInterface(IActivityManager.descriptor); |
| 246 | IBinder token = data.readStrongBinder(); |
| 247 | String resultWho = data.readString(); |
| 248 | int requestCode = data.readInt(); |
| 249 | finishSubActivity(token, resultWho, requestCode); |
| 250 | reply.writeNoException(); |
| 251 | return true; |
| 252 | } |
| 253 | |
Dianne Hackborn | 061d58a | 2010-03-12 15:07:06 -0800 | [diff] [blame] | 254 | case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: { |
| 255 | data.enforceInterface(IActivityManager.descriptor); |
| 256 | IBinder token = data.readStrongBinder(); |
| 257 | boolean res = willActivityBeVisible(token); |
| 258 | reply.writeNoException(); |
| 259 | reply.writeInt(res ? 1 : 0); |
| 260 | return true; |
| 261 | } |
| 262 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 263 | case REGISTER_RECEIVER_TRANSACTION: |
| 264 | { |
| 265 | data.enforceInterface(IActivityManager.descriptor); |
| 266 | IBinder b = data.readStrongBinder(); |
| 267 | IApplicationThread app = |
| 268 | b != null ? ApplicationThreadNative.asInterface(b) : null; |
| 269 | b = data.readStrongBinder(); |
| 270 | IIntentReceiver rec |
| 271 | = b != null ? IIntentReceiver.Stub.asInterface(b) : null; |
| 272 | IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data); |
| 273 | String perm = data.readString(); |
| 274 | Intent intent = registerReceiver(app, rec, filter, perm); |
| 275 | reply.writeNoException(); |
| 276 | if (intent != null) { |
| 277 | reply.writeInt(1); |
| 278 | intent.writeToParcel(reply, 0); |
| 279 | } else { |
| 280 | reply.writeInt(0); |
| 281 | } |
| 282 | return true; |
| 283 | } |
| 284 | |
| 285 | case UNREGISTER_RECEIVER_TRANSACTION: |
| 286 | { |
| 287 | data.enforceInterface(IActivityManager.descriptor); |
| 288 | IBinder b = data.readStrongBinder(); |
| 289 | if (b == null) { |
| 290 | return true; |
| 291 | } |
| 292 | IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b); |
| 293 | unregisterReceiver(rec); |
| 294 | reply.writeNoException(); |
| 295 | return true; |
| 296 | } |
| 297 | |
| 298 | case BROADCAST_INTENT_TRANSACTION: |
| 299 | { |
| 300 | data.enforceInterface(IActivityManager.descriptor); |
| 301 | IBinder b = data.readStrongBinder(); |
| 302 | IApplicationThread app = |
| 303 | b != null ? ApplicationThreadNative.asInterface(b) : null; |
| 304 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 305 | String resolvedType = data.readString(); |
| 306 | b = data.readStrongBinder(); |
| 307 | IIntentReceiver resultTo = |
| 308 | b != null ? IIntentReceiver.Stub.asInterface(b) : null; |
| 309 | int resultCode = data.readInt(); |
| 310 | String resultData = data.readString(); |
| 311 | Bundle resultExtras = data.readBundle(); |
| 312 | String perm = data.readString(); |
| 313 | boolean serialized = data.readInt() != 0; |
| 314 | boolean sticky = data.readInt() != 0; |
| 315 | int res = broadcastIntent(app, intent, resolvedType, resultTo, |
| 316 | resultCode, resultData, resultExtras, perm, |
| 317 | serialized, sticky); |
| 318 | reply.writeNoException(); |
| 319 | reply.writeInt(res); |
| 320 | return true; |
| 321 | } |
| 322 | |
| 323 | case UNBROADCAST_INTENT_TRANSACTION: |
| 324 | { |
| 325 | data.enforceInterface(IActivityManager.descriptor); |
| 326 | IBinder b = data.readStrongBinder(); |
| 327 | IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null; |
| 328 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 329 | unbroadcastIntent(app, intent); |
| 330 | reply.writeNoException(); |
| 331 | return true; |
| 332 | } |
| 333 | |
| 334 | case FINISH_RECEIVER_TRANSACTION: { |
| 335 | data.enforceInterface(IActivityManager.descriptor); |
| 336 | IBinder who = data.readStrongBinder(); |
| 337 | int resultCode = data.readInt(); |
| 338 | String resultData = data.readString(); |
| 339 | Bundle resultExtras = data.readBundle(); |
| 340 | boolean resultAbort = data.readInt() != 0; |
| 341 | if (who != null) { |
| 342 | finishReceiver(who, resultCode, resultData, resultExtras, resultAbort); |
| 343 | } |
| 344 | reply.writeNoException(); |
| 345 | return true; |
| 346 | } |
| 347 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 348 | case ATTACH_APPLICATION_TRANSACTION: { |
| 349 | data.enforceInterface(IActivityManager.descriptor); |
| 350 | IApplicationThread app = ApplicationThreadNative.asInterface( |
| 351 | data.readStrongBinder()); |
| 352 | if (app != null) { |
| 353 | attachApplication(app); |
| 354 | } |
| 355 | reply.writeNoException(); |
| 356 | return true; |
| 357 | } |
| 358 | |
| 359 | case ACTIVITY_IDLE_TRANSACTION: { |
| 360 | data.enforceInterface(IActivityManager.descriptor); |
| 361 | IBinder token = data.readStrongBinder(); |
Dianne Hackborn | e88846e | 2009-09-30 21:34:25 -0700 | [diff] [blame] | 362 | Configuration config = null; |
| 363 | if (data.readInt() != 0) { |
| 364 | config = Configuration.CREATOR.createFromParcel(data); |
| 365 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 366 | if (token != null) { |
Dianne Hackborn | e88846e | 2009-09-30 21:34:25 -0700 | [diff] [blame] | 367 | activityIdle(token, config); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 368 | } |
| 369 | reply.writeNoException(); |
| 370 | return true; |
| 371 | } |
| 372 | |
| 373 | case ACTIVITY_PAUSED_TRANSACTION: { |
| 374 | data.enforceInterface(IActivityManager.descriptor); |
| 375 | IBinder token = data.readStrongBinder(); |
| 376 | Bundle map = data.readBundle(); |
| 377 | activityPaused(token, map); |
| 378 | reply.writeNoException(); |
| 379 | return true; |
| 380 | } |
| 381 | |
| 382 | case ACTIVITY_STOPPED_TRANSACTION: { |
| 383 | data.enforceInterface(IActivityManager.descriptor); |
| 384 | IBinder token = data.readStrongBinder(); |
| 385 | Bitmap thumbnail = data.readInt() != 0 |
| 386 | ? Bitmap.CREATOR.createFromParcel(data) : null; |
| 387 | CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); |
| 388 | activityStopped(token, thumbnail, description); |
| 389 | reply.writeNoException(); |
| 390 | return true; |
| 391 | } |
| 392 | |
| 393 | case ACTIVITY_DESTROYED_TRANSACTION: { |
| 394 | data.enforceInterface(IActivityManager.descriptor); |
| 395 | IBinder token = data.readStrongBinder(); |
| 396 | activityDestroyed(token); |
| 397 | reply.writeNoException(); |
| 398 | return true; |
| 399 | } |
| 400 | |
| 401 | case GET_CALLING_PACKAGE_TRANSACTION: { |
| 402 | data.enforceInterface(IActivityManager.descriptor); |
| 403 | IBinder token = data.readStrongBinder(); |
| 404 | String res = token != null ? getCallingPackage(token) : null; |
| 405 | reply.writeNoException(); |
| 406 | reply.writeString(res); |
| 407 | return true; |
| 408 | } |
| 409 | |
| 410 | case GET_CALLING_ACTIVITY_TRANSACTION: { |
| 411 | data.enforceInterface(IActivityManager.descriptor); |
| 412 | IBinder token = data.readStrongBinder(); |
| 413 | ComponentName cn = getCallingActivity(token); |
| 414 | reply.writeNoException(); |
| 415 | ComponentName.writeToParcel(cn, reply); |
| 416 | return true; |
| 417 | } |
| 418 | |
| 419 | case GET_TASKS_TRANSACTION: { |
| 420 | data.enforceInterface(IActivityManager.descriptor); |
| 421 | int maxNum = data.readInt(); |
| 422 | int fl = data.readInt(); |
| 423 | IBinder receiverBinder = data.readStrongBinder(); |
| 424 | IThumbnailReceiver receiver = receiverBinder != null |
| 425 | ? IThumbnailReceiver.Stub.asInterface(receiverBinder) |
| 426 | : null; |
| 427 | List list = getTasks(maxNum, fl, receiver); |
| 428 | reply.writeNoException(); |
| 429 | int N = list != null ? list.size() : -1; |
| 430 | reply.writeInt(N); |
| 431 | int i; |
| 432 | for (i=0; i<N; i++) { |
| 433 | ActivityManager.RunningTaskInfo info = |
| 434 | (ActivityManager.RunningTaskInfo)list.get(i); |
| 435 | info.writeToParcel(reply, 0); |
| 436 | } |
| 437 | return true; |
| 438 | } |
| 439 | |
| 440 | case GET_RECENT_TASKS_TRANSACTION: { |
| 441 | data.enforceInterface(IActivityManager.descriptor); |
| 442 | int maxNum = data.readInt(); |
| 443 | int fl = data.readInt(); |
| 444 | List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum, |
| 445 | fl); |
| 446 | reply.writeNoException(); |
| 447 | reply.writeTypedList(list); |
| 448 | return true; |
| 449 | } |
| 450 | |
| 451 | case GET_SERVICES_TRANSACTION: { |
| 452 | data.enforceInterface(IActivityManager.descriptor); |
| 453 | int maxNum = data.readInt(); |
| 454 | int fl = data.readInt(); |
| 455 | List list = getServices(maxNum, fl); |
| 456 | reply.writeNoException(); |
| 457 | int N = list != null ? list.size() : -1; |
| 458 | reply.writeInt(N); |
| 459 | int i; |
| 460 | for (i=0; i<N; i++) { |
| 461 | ActivityManager.RunningServiceInfo info = |
| 462 | (ActivityManager.RunningServiceInfo)list.get(i); |
| 463 | info.writeToParcel(reply, 0); |
| 464 | } |
| 465 | return true; |
| 466 | } |
| 467 | |
| 468 | case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: { |
| 469 | data.enforceInterface(IActivityManager.descriptor); |
| 470 | List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState(); |
| 471 | reply.writeNoException(); |
| 472 | reply.writeTypedList(list); |
| 473 | return true; |
| 474 | } |
| 475 | |
| 476 | case GET_RUNNING_APP_PROCESSES_TRANSACTION: { |
| 477 | data.enforceInterface(IActivityManager.descriptor); |
| 478 | List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses(); |
| 479 | reply.writeNoException(); |
| 480 | reply.writeTypedList(list); |
| 481 | return true; |
| 482 | } |
| 483 | |
Suchi Amalapurapu | f7f5dda | 2010-03-23 10:34:28 -0700 | [diff] [blame] | 484 | case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: { |
| 485 | data.enforceInterface(IActivityManager.descriptor); |
| 486 | List<ApplicationInfo> list = getRunningExternalApplications(); |
| 487 | reply.writeNoException(); |
| 488 | reply.writeTypedList(list); |
| 489 | return true; |
| 490 | } |
| 491 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 492 | case MOVE_TASK_TO_FRONT_TRANSACTION: { |
| 493 | data.enforceInterface(IActivityManager.descriptor); |
| 494 | int task = data.readInt(); |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 495 | int fl = data.readInt(); |
| 496 | moveTaskToFront(task, fl); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 497 | reply.writeNoException(); |
| 498 | return true; |
| 499 | } |
| 500 | |
| 501 | case MOVE_TASK_TO_BACK_TRANSACTION: { |
| 502 | data.enforceInterface(IActivityManager.descriptor); |
| 503 | int task = data.readInt(); |
| 504 | moveTaskToBack(task); |
| 505 | reply.writeNoException(); |
| 506 | return true; |
| 507 | } |
| 508 | |
| 509 | case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: { |
| 510 | data.enforceInterface(IActivityManager.descriptor); |
| 511 | IBinder token = data.readStrongBinder(); |
| 512 | boolean nonRoot = data.readInt() != 0; |
| 513 | boolean res = moveActivityTaskToBack(token, nonRoot); |
| 514 | reply.writeNoException(); |
| 515 | reply.writeInt(res ? 1 : 0); |
| 516 | return true; |
| 517 | } |
| 518 | |
| 519 | case MOVE_TASK_BACKWARDS_TRANSACTION: { |
| 520 | data.enforceInterface(IActivityManager.descriptor); |
| 521 | int task = data.readInt(); |
| 522 | moveTaskBackwards(task); |
| 523 | reply.writeNoException(); |
| 524 | return true; |
| 525 | } |
| 526 | |
| 527 | case GET_TASK_FOR_ACTIVITY_TRANSACTION: { |
| 528 | data.enforceInterface(IActivityManager.descriptor); |
| 529 | IBinder token = data.readStrongBinder(); |
| 530 | boolean onlyRoot = data.readInt() != 0; |
| 531 | int res = token != null |
| 532 | ? getTaskForActivity(token, onlyRoot) : -1; |
| 533 | reply.writeNoException(); |
| 534 | reply.writeInt(res); |
| 535 | return true; |
| 536 | } |
| 537 | |
| 538 | case FINISH_OTHER_INSTANCES_TRANSACTION: { |
| 539 | data.enforceInterface(IActivityManager.descriptor); |
| 540 | IBinder token = data.readStrongBinder(); |
| 541 | ComponentName className = ComponentName.readFromParcel(data); |
| 542 | finishOtherInstances(token, className); |
| 543 | reply.writeNoException(); |
| 544 | return true; |
| 545 | } |
| 546 | |
| 547 | case REPORT_THUMBNAIL_TRANSACTION: { |
| 548 | data.enforceInterface(IActivityManager.descriptor); |
| 549 | IBinder token = data.readStrongBinder(); |
| 550 | Bitmap thumbnail = data.readInt() != 0 |
| 551 | ? Bitmap.CREATOR.createFromParcel(data) : null; |
| 552 | CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); |
| 553 | reportThumbnail(token, thumbnail, description); |
| 554 | reply.writeNoException(); |
| 555 | return true; |
| 556 | } |
| 557 | |
| 558 | case GET_CONTENT_PROVIDER_TRANSACTION: { |
| 559 | data.enforceInterface(IActivityManager.descriptor); |
| 560 | IBinder b = data.readStrongBinder(); |
| 561 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 562 | String name = data.readString(); |
| 563 | ContentProviderHolder cph = getContentProvider(app, name); |
| 564 | reply.writeNoException(); |
| 565 | if (cph != null) { |
| 566 | reply.writeInt(1); |
| 567 | cph.writeToParcel(reply, 0); |
| 568 | } else { |
| 569 | reply.writeInt(0); |
| 570 | } |
| 571 | return true; |
| 572 | } |
| 573 | |
| 574 | case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: { |
| 575 | data.enforceInterface(IActivityManager.descriptor); |
| 576 | IBinder b = data.readStrongBinder(); |
| 577 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 578 | ArrayList<ContentProviderHolder> providers = |
| 579 | data.createTypedArrayList(ContentProviderHolder.CREATOR); |
| 580 | publishContentProviders(app, providers); |
| 581 | reply.writeNoException(); |
| 582 | return true; |
| 583 | } |
| 584 | |
| 585 | case REMOVE_CONTENT_PROVIDER_TRANSACTION: { |
| 586 | data.enforceInterface(IActivityManager.descriptor); |
| 587 | IBinder b = data.readStrongBinder(); |
| 588 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 589 | String name = data.readString(); |
| 590 | removeContentProvider(app, name); |
| 591 | reply.writeNoException(); |
| 592 | return true; |
| 593 | } |
| 594 | |
Dianne Hackborn | dd9b82c | 2009-09-03 00:18:47 -0700 | [diff] [blame] | 595 | case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: { |
| 596 | data.enforceInterface(IActivityManager.descriptor); |
| 597 | ComponentName comp = ComponentName.CREATOR.createFromParcel(data); |
| 598 | PendingIntent pi = getRunningServiceControlPanel(comp); |
| 599 | reply.writeNoException(); |
| 600 | PendingIntent.writePendingIntentOrNullToParcel(pi, reply); |
| 601 | return true; |
| 602 | } |
| 603 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 604 | case START_SERVICE_TRANSACTION: { |
| 605 | data.enforceInterface(IActivityManager.descriptor); |
| 606 | IBinder b = data.readStrongBinder(); |
| 607 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 608 | Intent service = Intent.CREATOR.createFromParcel(data); |
| 609 | String resolvedType = data.readString(); |
| 610 | ComponentName cn = startService(app, service, resolvedType); |
| 611 | reply.writeNoException(); |
| 612 | ComponentName.writeToParcel(cn, reply); |
| 613 | return true; |
| 614 | } |
| 615 | |
| 616 | case STOP_SERVICE_TRANSACTION: { |
| 617 | data.enforceInterface(IActivityManager.descriptor); |
| 618 | IBinder b = data.readStrongBinder(); |
| 619 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 620 | Intent service = Intent.CREATOR.createFromParcel(data); |
| 621 | String resolvedType = data.readString(); |
| 622 | int res = stopService(app, service, resolvedType); |
| 623 | reply.writeNoException(); |
| 624 | reply.writeInt(res); |
| 625 | return true; |
| 626 | } |
| 627 | |
| 628 | case STOP_SERVICE_TOKEN_TRANSACTION: { |
| 629 | data.enforceInterface(IActivityManager.descriptor); |
| 630 | ComponentName className = ComponentName.readFromParcel(data); |
| 631 | IBinder token = data.readStrongBinder(); |
| 632 | int startId = data.readInt(); |
| 633 | boolean res = stopServiceToken(className, token, startId); |
| 634 | reply.writeNoException(); |
| 635 | reply.writeInt(res ? 1 : 0); |
| 636 | return true; |
| 637 | } |
| 638 | |
| 639 | case SET_SERVICE_FOREGROUND_TRANSACTION: { |
| 640 | data.enforceInterface(IActivityManager.descriptor); |
| 641 | ComponentName className = ComponentName.readFromParcel(data); |
| 642 | IBinder token = data.readStrongBinder(); |
Dianne Hackborn | d8a43f6 | 2009-08-17 23:33:56 -0700 | [diff] [blame] | 643 | int id = data.readInt(); |
| 644 | Notification notification = null; |
| 645 | if (data.readInt() != 0) { |
| 646 | notification = Notification.CREATOR.createFromParcel(data); |
| 647 | } |
| 648 | boolean removeNotification = data.readInt() != 0; |
| 649 | setServiceForeground(className, token, id, notification, removeNotification); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 650 | reply.writeNoException(); |
| 651 | return true; |
| 652 | } |
| 653 | |
| 654 | case BIND_SERVICE_TRANSACTION: { |
| 655 | data.enforceInterface(IActivityManager.descriptor); |
| 656 | IBinder b = data.readStrongBinder(); |
| 657 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 658 | IBinder token = data.readStrongBinder(); |
| 659 | Intent service = Intent.CREATOR.createFromParcel(data); |
| 660 | String resolvedType = data.readString(); |
| 661 | b = data.readStrongBinder(); |
| 662 | int fl = data.readInt(); |
| 663 | IServiceConnection conn = IServiceConnection.Stub.asInterface(b); |
| 664 | int res = bindService(app, token, service, resolvedType, conn, fl); |
| 665 | reply.writeNoException(); |
| 666 | reply.writeInt(res); |
| 667 | return true; |
| 668 | } |
| 669 | |
| 670 | case UNBIND_SERVICE_TRANSACTION: { |
| 671 | data.enforceInterface(IActivityManager.descriptor); |
| 672 | IBinder b = data.readStrongBinder(); |
| 673 | IServiceConnection conn = IServiceConnection.Stub.asInterface(b); |
| 674 | boolean res = unbindService(conn); |
| 675 | reply.writeNoException(); |
| 676 | reply.writeInt(res ? 1 : 0); |
| 677 | return true; |
| 678 | } |
| 679 | |
| 680 | case PUBLISH_SERVICE_TRANSACTION: { |
| 681 | data.enforceInterface(IActivityManager.descriptor); |
| 682 | IBinder token = data.readStrongBinder(); |
| 683 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 684 | IBinder service = data.readStrongBinder(); |
| 685 | publishService(token, intent, service); |
| 686 | reply.writeNoException(); |
| 687 | return true; |
| 688 | } |
| 689 | |
| 690 | case UNBIND_FINISHED_TRANSACTION: { |
| 691 | data.enforceInterface(IActivityManager.descriptor); |
| 692 | IBinder token = data.readStrongBinder(); |
| 693 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 694 | boolean doRebind = data.readInt() != 0; |
| 695 | unbindFinished(token, intent, doRebind); |
| 696 | reply.writeNoException(); |
| 697 | return true; |
| 698 | } |
| 699 | |
| 700 | case SERVICE_DONE_EXECUTING_TRANSACTION: { |
| 701 | data.enforceInterface(IActivityManager.descriptor); |
| 702 | IBinder token = data.readStrongBinder(); |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 703 | int type = data.readInt(); |
| 704 | int startId = data.readInt(); |
| 705 | int res = data.readInt(); |
| 706 | serviceDoneExecuting(token, type, startId, res); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 707 | reply.writeNoException(); |
| 708 | return true; |
| 709 | } |
| 710 | |
| 711 | case START_INSTRUMENTATION_TRANSACTION: { |
| 712 | data.enforceInterface(IActivityManager.descriptor); |
| 713 | ComponentName className = ComponentName.readFromParcel(data); |
| 714 | String profileFile = data.readString(); |
| 715 | int fl = data.readInt(); |
| 716 | Bundle arguments = data.readBundle(); |
| 717 | IBinder b = data.readStrongBinder(); |
| 718 | IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b); |
| 719 | boolean res = startInstrumentation(className, profileFile, fl, arguments, w); |
| 720 | reply.writeNoException(); |
| 721 | reply.writeInt(res ? 1 : 0); |
| 722 | return true; |
| 723 | } |
| 724 | |
| 725 | |
| 726 | case FINISH_INSTRUMENTATION_TRANSACTION: { |
| 727 | data.enforceInterface(IActivityManager.descriptor); |
| 728 | IBinder b = data.readStrongBinder(); |
| 729 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 730 | int resultCode = data.readInt(); |
| 731 | Bundle results = data.readBundle(); |
| 732 | finishInstrumentation(app, resultCode, results); |
| 733 | reply.writeNoException(); |
| 734 | return true; |
| 735 | } |
| 736 | |
| 737 | case GET_CONFIGURATION_TRANSACTION: { |
| 738 | data.enforceInterface(IActivityManager.descriptor); |
| 739 | Configuration config = getConfiguration(); |
| 740 | reply.writeNoException(); |
| 741 | config.writeToParcel(reply, 0); |
| 742 | return true; |
| 743 | } |
| 744 | |
| 745 | case UPDATE_CONFIGURATION_TRANSACTION: { |
| 746 | data.enforceInterface(IActivityManager.descriptor); |
| 747 | Configuration config = Configuration.CREATOR.createFromParcel(data); |
| 748 | updateConfiguration(config); |
| 749 | reply.writeNoException(); |
| 750 | return true; |
| 751 | } |
| 752 | |
| 753 | case SET_REQUESTED_ORIENTATION_TRANSACTION: { |
| 754 | data.enforceInterface(IActivityManager.descriptor); |
| 755 | IBinder token = data.readStrongBinder(); |
| 756 | int requestedOrientation = data.readInt(); |
| 757 | setRequestedOrientation(token, requestedOrientation); |
| 758 | reply.writeNoException(); |
| 759 | return true; |
| 760 | } |
| 761 | |
| 762 | case GET_REQUESTED_ORIENTATION_TRANSACTION: { |
| 763 | data.enforceInterface(IActivityManager.descriptor); |
| 764 | IBinder token = data.readStrongBinder(); |
| 765 | int req = getRequestedOrientation(token); |
| 766 | reply.writeNoException(); |
| 767 | reply.writeInt(req); |
| 768 | return true; |
| 769 | } |
| 770 | |
| 771 | case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: { |
| 772 | data.enforceInterface(IActivityManager.descriptor); |
| 773 | IBinder token = data.readStrongBinder(); |
| 774 | ComponentName cn = getActivityClassForToken(token); |
| 775 | reply.writeNoException(); |
| 776 | ComponentName.writeToParcel(cn, reply); |
| 777 | return true; |
| 778 | } |
| 779 | |
| 780 | case GET_PACKAGE_FOR_TOKEN_TRANSACTION: { |
| 781 | data.enforceInterface(IActivityManager.descriptor); |
| 782 | IBinder token = data.readStrongBinder(); |
| 783 | reply.writeNoException(); |
| 784 | reply.writeString(getPackageForToken(token)); |
| 785 | return true; |
| 786 | } |
| 787 | |
| 788 | case GET_INTENT_SENDER_TRANSACTION: { |
| 789 | data.enforceInterface(IActivityManager.descriptor); |
| 790 | int type = data.readInt(); |
| 791 | String packageName = data.readString(); |
| 792 | IBinder token = data.readStrongBinder(); |
| 793 | String resultWho = data.readString(); |
| 794 | int requestCode = data.readInt(); |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 795 | Intent[] requestIntents; |
| 796 | String[] requestResolvedTypes; |
| 797 | if (data.readInt() != 0) { |
| 798 | requestIntents = data.createTypedArray(Intent.CREATOR); |
| 799 | requestResolvedTypes = data.createStringArray(); |
| 800 | } else { |
| 801 | requestIntents = null; |
| 802 | requestResolvedTypes = null; |
| 803 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 804 | int fl = data.readInt(); |
| 805 | IIntentSender res = getIntentSender(type, packageName, token, |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 806 | resultWho, requestCode, requestIntents, |
| 807 | requestResolvedTypes, fl); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 808 | reply.writeNoException(); |
| 809 | reply.writeStrongBinder(res != null ? res.asBinder() : null); |
| 810 | return true; |
| 811 | } |
| 812 | |
| 813 | case CANCEL_INTENT_SENDER_TRANSACTION: { |
| 814 | data.enforceInterface(IActivityManager.descriptor); |
| 815 | IIntentSender r = IIntentSender.Stub.asInterface( |
| 816 | data.readStrongBinder()); |
| 817 | cancelIntentSender(r); |
| 818 | reply.writeNoException(); |
| 819 | return true; |
| 820 | } |
| 821 | |
| 822 | case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: { |
| 823 | data.enforceInterface(IActivityManager.descriptor); |
| 824 | IIntentSender r = IIntentSender.Stub.asInterface( |
| 825 | data.readStrongBinder()); |
| 826 | String res = getPackageForIntentSender(r); |
| 827 | reply.writeNoException(); |
| 828 | reply.writeString(res); |
| 829 | return true; |
| 830 | } |
| 831 | |
| 832 | case SET_PROCESS_LIMIT_TRANSACTION: { |
| 833 | data.enforceInterface(IActivityManager.descriptor); |
| 834 | int max = data.readInt(); |
| 835 | setProcessLimit(max); |
| 836 | reply.writeNoException(); |
| 837 | return true; |
| 838 | } |
| 839 | |
| 840 | case GET_PROCESS_LIMIT_TRANSACTION: { |
| 841 | data.enforceInterface(IActivityManager.descriptor); |
| 842 | int limit = getProcessLimit(); |
| 843 | reply.writeNoException(); |
| 844 | reply.writeInt(limit); |
| 845 | return true; |
| 846 | } |
| 847 | |
| 848 | case SET_PROCESS_FOREGROUND_TRANSACTION: { |
| 849 | data.enforceInterface(IActivityManager.descriptor); |
| 850 | IBinder token = data.readStrongBinder(); |
| 851 | int pid = data.readInt(); |
| 852 | boolean isForeground = data.readInt() != 0; |
| 853 | setProcessForeground(token, pid, isForeground); |
| 854 | reply.writeNoException(); |
| 855 | return true; |
| 856 | } |
| 857 | |
| 858 | case CHECK_PERMISSION_TRANSACTION: { |
| 859 | data.enforceInterface(IActivityManager.descriptor); |
| 860 | String perm = data.readString(); |
| 861 | int pid = data.readInt(); |
| 862 | int uid = data.readInt(); |
| 863 | int res = checkPermission(perm, pid, uid); |
| 864 | reply.writeNoException(); |
| 865 | reply.writeInt(res); |
| 866 | return true; |
| 867 | } |
| 868 | |
| 869 | case CHECK_URI_PERMISSION_TRANSACTION: { |
| 870 | data.enforceInterface(IActivityManager.descriptor); |
| 871 | Uri uri = Uri.CREATOR.createFromParcel(data); |
| 872 | int pid = data.readInt(); |
| 873 | int uid = data.readInt(); |
| 874 | int mode = data.readInt(); |
| 875 | int res = checkUriPermission(uri, pid, uid, mode); |
| 876 | reply.writeNoException(); |
| 877 | reply.writeInt(res); |
| 878 | return true; |
| 879 | } |
| 880 | |
| 881 | case CLEAR_APP_DATA_TRANSACTION: { |
| 882 | data.enforceInterface(IActivityManager.descriptor); |
| 883 | String packageName = data.readString(); |
| 884 | IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface( |
| 885 | data.readStrongBinder()); |
| 886 | boolean res = clearApplicationUserData(packageName, observer); |
| 887 | reply.writeNoException(); |
| 888 | reply.writeInt(res ? 1 : 0); |
| 889 | return true; |
| 890 | } |
| 891 | |
| 892 | case GRANT_URI_PERMISSION_TRANSACTION: { |
| 893 | data.enforceInterface(IActivityManager.descriptor); |
| 894 | IBinder b = data.readStrongBinder(); |
| 895 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 896 | String targetPkg = data.readString(); |
| 897 | Uri uri = Uri.CREATOR.createFromParcel(data); |
| 898 | int mode = data.readInt(); |
| 899 | grantUriPermission(app, targetPkg, uri, mode); |
| 900 | reply.writeNoException(); |
| 901 | return true; |
| 902 | } |
| 903 | |
| 904 | case REVOKE_URI_PERMISSION_TRANSACTION: { |
| 905 | data.enforceInterface(IActivityManager.descriptor); |
| 906 | IBinder b = data.readStrongBinder(); |
| 907 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 908 | Uri uri = Uri.CREATOR.createFromParcel(data); |
| 909 | int mode = data.readInt(); |
| 910 | revokeUriPermission(app, uri, mode); |
| 911 | reply.writeNoException(); |
| 912 | return true; |
| 913 | } |
| 914 | |
| 915 | case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: { |
| 916 | data.enforceInterface(IActivityManager.descriptor); |
| 917 | IBinder b = data.readStrongBinder(); |
| 918 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 919 | boolean waiting = data.readInt() != 0; |
| 920 | showWaitingForDebugger(app, waiting); |
| 921 | reply.writeNoException(); |
| 922 | return true; |
| 923 | } |
| 924 | |
| 925 | case GET_MEMORY_INFO_TRANSACTION: { |
| 926 | data.enforceInterface(IActivityManager.descriptor); |
| 927 | ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); |
| 928 | getMemoryInfo(mi); |
| 929 | reply.writeNoException(); |
| 930 | mi.writeToParcel(reply, 0); |
| 931 | return true; |
| 932 | } |
| 933 | |
| 934 | case UNHANDLED_BACK_TRANSACTION: { |
| 935 | data.enforceInterface(IActivityManager.descriptor); |
| 936 | unhandledBack(); |
| 937 | reply.writeNoException(); |
| 938 | return true; |
| 939 | } |
| 940 | |
| 941 | case OPEN_CONTENT_URI_TRANSACTION: { |
| 942 | data.enforceInterface(IActivityManager.descriptor); |
| 943 | Uri uri = Uri.parse(data.readString()); |
| 944 | ParcelFileDescriptor pfd = openContentUri(uri); |
| 945 | reply.writeNoException(); |
| 946 | if (pfd != null) { |
| 947 | reply.writeInt(1); |
| 948 | pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 949 | } else { |
| 950 | reply.writeInt(0); |
| 951 | } |
| 952 | return true; |
| 953 | } |
| 954 | |
| 955 | case GOING_TO_SLEEP_TRANSACTION: { |
| 956 | data.enforceInterface(IActivityManager.descriptor); |
| 957 | goingToSleep(); |
| 958 | reply.writeNoException(); |
| 959 | return true; |
| 960 | } |
| 961 | |
| 962 | case WAKING_UP_TRANSACTION: { |
| 963 | data.enforceInterface(IActivityManager.descriptor); |
| 964 | wakingUp(); |
| 965 | reply.writeNoException(); |
| 966 | return true; |
| 967 | } |
| 968 | |
| 969 | case SET_DEBUG_APP_TRANSACTION: { |
| 970 | data.enforceInterface(IActivityManager.descriptor); |
| 971 | String pn = data.readString(); |
| 972 | boolean wfd = data.readInt() != 0; |
| 973 | boolean per = data.readInt() != 0; |
| 974 | setDebugApp(pn, wfd, per); |
| 975 | reply.writeNoException(); |
| 976 | return true; |
| 977 | } |
| 978 | |
| 979 | case SET_ALWAYS_FINISH_TRANSACTION: { |
| 980 | data.enforceInterface(IActivityManager.descriptor); |
| 981 | boolean enabled = data.readInt() != 0; |
| 982 | setAlwaysFinish(enabled); |
| 983 | reply.writeNoException(); |
| 984 | return true; |
| 985 | } |
| 986 | |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 987 | case SET_ACTIVITY_CONTROLLER_TRANSACTION: { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 988 | data.enforceInterface(IActivityManager.descriptor); |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 989 | IActivityController watcher = IActivityController.Stub.asInterface( |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 990 | data.readStrongBinder()); |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 991 | setActivityController(watcher); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 992 | return true; |
| 993 | } |
| 994 | |
| 995 | case ENTER_SAFE_MODE_TRANSACTION: { |
| 996 | data.enforceInterface(IActivityManager.descriptor); |
| 997 | enterSafeMode(); |
| 998 | reply.writeNoException(); |
| 999 | return true; |
| 1000 | } |
| 1001 | |
| 1002 | case NOTE_WAKEUP_ALARM_TRANSACTION: { |
| 1003 | data.enforceInterface(IActivityManager.descriptor); |
| 1004 | IIntentSender is = IIntentSender.Stub.asInterface( |
| 1005 | data.readStrongBinder()); |
| 1006 | noteWakeupAlarm(is); |
| 1007 | reply.writeNoException(); |
| 1008 | return true; |
| 1009 | } |
| 1010 | |
Suchi Amalapurapu | e99bb5f | 2010-03-19 14:36:49 -0700 | [diff] [blame] | 1011 | case KILL_PIDS_TRANSACTION: { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1012 | data.enforceInterface(IActivityManager.descriptor); |
| 1013 | int[] pids = data.createIntArray(); |
Suchi Amalapurapu | e99bb5f | 2010-03-19 14:36:49 -0700 | [diff] [blame] | 1014 | String reason = data.readString(); |
| 1015 | boolean res = killPids(pids, reason); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1016 | reply.writeNoException(); |
| 1017 | reply.writeInt(res ? 1 : 0); |
| 1018 | return true; |
| 1019 | } |
| 1020 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1021 | case START_RUNNING_TRANSACTION: { |
| 1022 | data.enforceInterface(IActivityManager.descriptor); |
| 1023 | String pkg = data.readString(); |
| 1024 | String cls = data.readString(); |
| 1025 | String action = data.readString(); |
| 1026 | String indata = data.readString(); |
| 1027 | startRunning(pkg, cls, action, indata); |
| 1028 | reply.writeNoException(); |
| 1029 | return true; |
| 1030 | } |
| 1031 | |
Dan Egnor | 60d8762 | 2009-12-16 16:32:58 -0800 | [diff] [blame] | 1032 | case HANDLE_APPLICATION_CRASH_TRANSACTION: { |
| 1033 | data.enforceInterface(IActivityManager.descriptor); |
| 1034 | IBinder app = data.readStrongBinder(); |
| 1035 | ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); |
| 1036 | handleApplicationCrash(app, ci); |
| 1037 | reply.writeNoException(); |
| 1038 | return true; |
| 1039 | } |
| 1040 | |
| 1041 | case HANDLE_APPLICATION_WTF_TRANSACTION: { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1042 | data.enforceInterface(IActivityManager.descriptor); |
| 1043 | IBinder app = data.readStrongBinder(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1044 | String tag = data.readString(); |
Dan Egnor | b7f0367 | 2009-12-09 16:22:32 -0800 | [diff] [blame] | 1045 | ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); |
Dan Egnor | 60d8762 | 2009-12-16 16:32:58 -0800 | [diff] [blame] | 1046 | boolean res = handleApplicationWtf(app, tag, ci); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1047 | reply.writeNoException(); |
Dan Egnor | 60d8762 | 2009-12-16 16:32:58 -0800 | [diff] [blame] | 1048 | reply.writeInt(res ? 1 : 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1049 | return true; |
| 1050 | } |
Dan Egnor | b7f0367 | 2009-12-09 16:22:32 -0800 | [diff] [blame] | 1051 | |
Brad Fitzpatrick | 438d059 | 2010-06-10 12:19:19 -0700 | [diff] [blame] | 1052 | case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: { |
| 1053 | data.enforceInterface(IActivityManager.descriptor); |
| 1054 | IBinder app = data.readStrongBinder(); |
Brad Fitzpatrick | 46d4238 | 2010-06-11 13:57:58 -0700 | [diff] [blame] | 1055 | int violationMask = data.readInt(); |
Brad Fitzpatrick | cb9ceb1 | 2010-07-29 14:29:02 -0700 | [diff] [blame] | 1056 | StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data); |
| 1057 | handleApplicationStrictModeViolation(app, violationMask, info); |
Brad Fitzpatrick | 438d059 | 2010-06-10 12:19:19 -0700 | [diff] [blame] | 1058 | reply.writeNoException(); |
| 1059 | return true; |
| 1060 | } |
| 1061 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1062 | case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: { |
| 1063 | data.enforceInterface(IActivityManager.descriptor); |
| 1064 | int sig = data.readInt(); |
| 1065 | signalPersistentProcesses(sig); |
| 1066 | reply.writeNoException(); |
| 1067 | return true; |
| 1068 | } |
| 1069 | |
Dianne Hackborn | 03abb81 | 2010-01-04 18:43:19 -0800 | [diff] [blame] | 1070 | case KILL_BACKGROUND_PROCESSES_TRANSACTION: { |
| 1071 | data.enforceInterface(IActivityManager.descriptor); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1072 | String packageName = data.readString(); |
Dianne Hackborn | 03abb81 | 2010-01-04 18:43:19 -0800 | [diff] [blame] | 1073 | killBackgroundProcesses(packageName); |
| 1074 | reply.writeNoException(); |
| 1075 | return true; |
| 1076 | } |
| 1077 | |
| 1078 | case FORCE_STOP_PACKAGE_TRANSACTION: { |
| 1079 | data.enforceInterface(IActivityManager.descriptor); |
| 1080 | String packageName = data.readString(); |
| 1081 | forceStopPackage(packageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1082 | reply.writeNoException(); |
| 1083 | return true; |
| 1084 | } |
| 1085 | |
| 1086 | case GET_DEVICE_CONFIGURATION_TRANSACTION: { |
| 1087 | data.enforceInterface(IActivityManager.descriptor); |
| 1088 | ConfigurationInfo config = getDeviceConfigurationInfo(); |
| 1089 | reply.writeNoException(); |
| 1090 | config.writeToParcel(reply, 0); |
| 1091 | return true; |
| 1092 | } |
| 1093 | |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 1094 | case PROFILE_CONTROL_TRANSACTION: { |
| 1095 | data.enforceInterface(IActivityManager.descriptor); |
| 1096 | String process = data.readString(); |
| 1097 | boolean start = data.readInt() != 0; |
| 1098 | String path = data.readString(); |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 1099 | ParcelFileDescriptor fd = data.readInt() != 0 |
| 1100 | ? data.readFileDescriptor() : null; |
| 1101 | boolean res = profileControl(process, start, path, fd); |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 1102 | reply.writeNoException(); |
| 1103 | reply.writeInt(res ? 1 : 0); |
| 1104 | return true; |
| 1105 | } |
| 1106 | |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 1107 | case SHUTDOWN_TRANSACTION: { |
| 1108 | data.enforceInterface(IActivityManager.descriptor); |
| 1109 | boolean res = shutdown(data.readInt()); |
| 1110 | reply.writeNoException(); |
| 1111 | reply.writeInt(res ? 1 : 0); |
| 1112 | return true; |
| 1113 | } |
| 1114 | |
Dianne Hackborn | 95fc68f | 2009-05-19 18:37:45 -0700 | [diff] [blame] | 1115 | case STOP_APP_SWITCHES_TRANSACTION: { |
| 1116 | data.enforceInterface(IActivityManager.descriptor); |
| 1117 | stopAppSwitches(); |
| 1118 | reply.writeNoException(); |
| 1119 | return true; |
| 1120 | } |
| 1121 | |
| 1122 | case RESUME_APP_SWITCHES_TRANSACTION: { |
| 1123 | data.enforceInterface(IActivityManager.descriptor); |
| 1124 | resumeAppSwitches(); |
| 1125 | reply.writeNoException(); |
| 1126 | return true; |
| 1127 | } |
| 1128 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1129 | case PEEK_SERVICE_TRANSACTION: { |
| 1130 | data.enforceInterface(IActivityManager.descriptor); |
| 1131 | Intent service = Intent.CREATOR.createFromParcel(data); |
| 1132 | String resolvedType = data.readString(); |
| 1133 | IBinder binder = peekService(service, resolvedType); |
| 1134 | reply.writeNoException(); |
| 1135 | reply.writeStrongBinder(binder); |
| 1136 | return true; |
| 1137 | } |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 1138 | |
| 1139 | case START_BACKUP_AGENT_TRANSACTION: { |
| 1140 | data.enforceInterface(IActivityManager.descriptor); |
| 1141 | ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); |
| 1142 | int backupRestoreMode = data.readInt(); |
| 1143 | boolean success = bindBackupAgent(info, backupRestoreMode); |
| 1144 | reply.writeNoException(); |
| 1145 | reply.writeInt(success ? 1 : 0); |
| 1146 | return true; |
| 1147 | } |
| 1148 | |
| 1149 | case BACKUP_AGENT_CREATED_TRANSACTION: { |
| 1150 | data.enforceInterface(IActivityManager.descriptor); |
| 1151 | String packageName = data.readString(); |
| 1152 | IBinder agent = data.readStrongBinder(); |
| 1153 | backupAgentCreated(packageName, agent); |
| 1154 | reply.writeNoException(); |
| 1155 | return true; |
| 1156 | } |
| 1157 | |
| 1158 | case UNBIND_BACKUP_AGENT_TRANSACTION: { |
| 1159 | data.enforceInterface(IActivityManager.descriptor); |
| 1160 | ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); |
| 1161 | unbindBackupAgent(info); |
| 1162 | reply.writeNoException(); |
| 1163 | return true; |
| 1164 | } |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 1165 | |
| 1166 | case REGISTER_ACTIVITY_WATCHER_TRANSACTION: { |
| 1167 | data.enforceInterface(IActivityManager.descriptor); |
| 1168 | IActivityWatcher watcher = IActivityWatcher.Stub.asInterface( |
| 1169 | data.readStrongBinder()); |
| 1170 | registerActivityWatcher(watcher); |
| 1171 | return true; |
| 1172 | } |
| 1173 | |
| 1174 | case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: { |
| 1175 | data.enforceInterface(IActivityManager.descriptor); |
| 1176 | IActivityWatcher watcher = IActivityWatcher.Stub.asInterface( |
| 1177 | data.readStrongBinder()); |
| 1178 | unregisterActivityWatcher(watcher); |
| 1179 | return true; |
| 1180 | } |
Dianne Hackborn | 2d91af0 | 2009-07-16 13:34:33 -0700 | [diff] [blame] | 1181 | |
| 1182 | case START_ACTIVITY_IN_PACKAGE_TRANSACTION: |
| 1183 | { |
| 1184 | data.enforceInterface(IActivityManager.descriptor); |
| 1185 | int uid = data.readInt(); |
| 1186 | Intent intent = Intent.CREATOR.createFromParcel(data); |
| 1187 | String resolvedType = data.readString(); |
| 1188 | IBinder resultTo = data.readStrongBinder(); |
| 1189 | String resultWho = data.readString(); |
| 1190 | int requestCode = data.readInt(); |
| 1191 | boolean onlyIfNeeded = data.readInt() != 0; |
| 1192 | int result = startActivityInPackage(uid, intent, resolvedType, |
| 1193 | resultTo, resultWho, requestCode, onlyIfNeeded); |
| 1194 | reply.writeNoException(); |
| 1195 | reply.writeInt(result); |
| 1196 | return true; |
| 1197 | } |
Dianne Hackborn | a6ddc8a | 2009-07-28 17:49:55 -0700 | [diff] [blame] | 1198 | |
Suchi Amalapurapu | 261e66a | 2009-07-27 15:21:34 -0700 | [diff] [blame] | 1199 | case KILL_APPLICATION_WITH_UID_TRANSACTION: { |
| 1200 | data.enforceInterface(IActivityManager.descriptor); |
| 1201 | String pkg = data.readString(); |
| 1202 | int uid = data.readInt(); |
| 1203 | killApplicationWithUid(pkg, uid); |
| 1204 | reply.writeNoException(); |
| 1205 | return true; |
| 1206 | } |
Dianne Hackborn | a6ddc8a | 2009-07-28 17:49:55 -0700 | [diff] [blame] | 1207 | |
| 1208 | case CLOSE_SYSTEM_DIALOGS_TRANSACTION: { |
| 1209 | data.enforceInterface(IActivityManager.descriptor); |
| 1210 | String reason = data.readString(); |
| 1211 | closeSystemDialogs(reason); |
| 1212 | reply.writeNoException(); |
| 1213 | return true; |
| 1214 | } |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 1215 | |
| 1216 | case GET_PROCESS_MEMORY_INFO_TRANSACTION: { |
| 1217 | data.enforceInterface(IActivityManager.descriptor); |
Dianne Hackborn | 4f21c4c | 2009-09-17 10:24:05 -0700 | [diff] [blame] | 1218 | int[] pids = data.createIntArray(); |
| 1219 | Debug.MemoryInfo[] res = getProcessMemoryInfo(pids); |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 1220 | reply.writeNoException(); |
Dianne Hackborn | 4f21c4c | 2009-09-17 10:24:05 -0700 | [diff] [blame] | 1221 | reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 1222 | return true; |
| 1223 | } |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 1224 | |
| 1225 | case KILL_APPLICATION_PROCESS_TRANSACTION: { |
| 1226 | data.enforceInterface(IActivityManager.descriptor); |
| 1227 | String processName = data.readString(); |
| 1228 | int uid = data.readInt(); |
| 1229 | killApplicationProcess(processName, uid); |
| 1230 | reply.writeNoException(); |
| 1231 | return true; |
| 1232 | } |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 1233 | |
| 1234 | case OVERRIDE_PENDING_TRANSITION_TRANSACTION: { |
| 1235 | data.enforceInterface(IActivityManager.descriptor); |
| 1236 | IBinder token = data.readStrongBinder(); |
| 1237 | String packageName = data.readString(); |
| 1238 | int enterAnim = data.readInt(); |
| 1239 | int exitAnim = data.readInt(); |
| 1240 | overridePendingTransition(token, packageName, enterAnim, exitAnim); |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 1241 | reply.writeNoException(); |
| 1242 | return true; |
| 1243 | } |
| 1244 | |
| 1245 | case IS_USER_A_MONKEY_TRANSACTION: { |
| 1246 | data.enforceInterface(IActivityManager.descriptor); |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 1247 | boolean areThey = isUserAMonkey(); |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 1248 | reply.writeNoException(); |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 1249 | reply.writeInt(areThey ? 1 : 0); |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 1250 | return true; |
| 1251 | } |
Dianne Hackborn | 860755f | 2010-06-03 18:47:52 -0700 | [diff] [blame] | 1252 | |
| 1253 | case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: { |
| 1254 | data.enforceInterface(IActivityManager.descriptor); |
| 1255 | finishHeavyWeightApp(); |
| 1256 | reply.writeNoException(); |
| 1257 | return true; |
| 1258 | } |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 1259 | |
| 1260 | case IS_IMMERSIVE_TRANSACTION: { |
| 1261 | data.enforceInterface(IActivityManager.descriptor); |
| 1262 | IBinder token = data.readStrongBinder(); |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 1263 | boolean isit = isImmersive(token); |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 1264 | reply.writeNoException(); |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 1265 | reply.writeInt(isit ? 1 : 0); |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 1266 | return true; |
| 1267 | } |
| 1268 | |
| 1269 | case SET_IMMERSIVE_TRANSACTION: { |
| 1270 | data.enforceInterface(IActivityManager.descriptor); |
| 1271 | IBinder token = data.readStrongBinder(); |
| 1272 | boolean imm = data.readInt() == 1; |
| 1273 | setImmersive(token, imm); |
| 1274 | reply.writeNoException(); |
| 1275 | return true; |
| 1276 | } |
| 1277 | |
| 1278 | case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: { |
| 1279 | data.enforceInterface(IActivityManager.descriptor); |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 1280 | boolean isit = isTopActivityImmersive(); |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 1281 | reply.writeNoException(); |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 1282 | reply.writeInt(isit ? 1 : 0); |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 1283 | return true; |
| 1284 | } |
| 1285 | |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 1286 | case CRASH_APPLICATION_TRANSACTION: { |
| 1287 | data.enforceInterface(IActivityManager.descriptor); |
| 1288 | int uid = data.readInt(); |
| 1289 | int initialPid = data.readInt(); |
| 1290 | String packageName = data.readString(); |
| 1291 | String message = data.readString(); |
| 1292 | crashApplication(uid, initialPid, packageName, message); |
| 1293 | reply.writeNoException(); |
| 1294 | return true; |
| 1295 | } |
Dianne Hackborn | cca1f0e | 2010-09-26 18:34:53 -0700 | [diff] [blame] | 1296 | |
| 1297 | case GET_PROVIDER_MIME_TYPE_TRANSACTION: { |
| 1298 | data.enforceInterface(IActivityManager.descriptor); |
| 1299 | Uri uri = Uri.CREATOR.createFromParcel(data); |
| 1300 | String type = getProviderMimeType(uri); |
| 1301 | reply.writeNoException(); |
| 1302 | reply.writeString(type); |
| 1303 | return true; |
| 1304 | } |
| 1305 | |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 1306 | case NEW_URI_PERMISSION_OWNER_TRANSACTION: { |
| 1307 | data.enforceInterface(IActivityManager.descriptor); |
| 1308 | String name = data.readString(); |
| 1309 | IBinder perm = newUriPermissionOwner(name); |
| 1310 | reply.writeNoException(); |
| 1311 | reply.writeStrongBinder(perm); |
| 1312 | return true; |
| 1313 | } |
| 1314 | |
| 1315 | case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: { |
| 1316 | data.enforceInterface(IActivityManager.descriptor); |
| 1317 | IBinder owner = data.readStrongBinder(); |
| 1318 | int fromUid = data.readInt(); |
| 1319 | String targetPkg = data.readString(); |
| 1320 | Uri uri = Uri.CREATOR.createFromParcel(data); |
| 1321 | int mode = data.readInt(); |
| 1322 | grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode); |
| 1323 | reply.writeNoException(); |
| 1324 | return true; |
| 1325 | } |
| 1326 | |
| 1327 | case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: { |
| 1328 | data.enforceInterface(IActivityManager.descriptor); |
| 1329 | IBinder owner = data.readStrongBinder(); |
| 1330 | Uri uri = null; |
| 1331 | if (data.readInt() != 0) { |
| 1332 | Uri.CREATOR.createFromParcel(data); |
| 1333 | } |
| 1334 | int mode = data.readInt(); |
| 1335 | revokeUriPermissionFromOwner(owner, uri, mode); |
| 1336 | reply.writeNoException(); |
| 1337 | return true; |
| 1338 | } |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 1339 | |
Dianne Hackborn | 90f4aaf | 2010-09-27 14:58:44 -0700 | [diff] [blame] | 1340 | case CHECK_GRANT_URI_PERMISSION_TRANSACTION: { |
| 1341 | data.enforceInterface(IActivityManager.descriptor); |
| 1342 | int callingUid = data.readInt(); |
| 1343 | String targetPkg = data.readString(); |
| 1344 | Uri uri = Uri.CREATOR.createFromParcel(data); |
| 1345 | int modeFlags = data.readInt(); |
| 1346 | int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags); |
| 1347 | reply.writeNoException(); |
| 1348 | reply.writeInt(res); |
| 1349 | return true; |
| 1350 | } |
| 1351 | |
Andy McFadden | 824c510 | 2010-07-09 16:26:57 -0700 | [diff] [blame] | 1352 | case DUMP_HEAP_TRANSACTION: { |
| 1353 | data.enforceInterface(IActivityManager.descriptor); |
| 1354 | String process = data.readString(); |
| 1355 | boolean managed = data.readInt() != 0; |
| 1356 | String path = data.readString(); |
| 1357 | ParcelFileDescriptor fd = data.readInt() != 0 |
| 1358 | ? data.readFileDescriptor() : null; |
| 1359 | boolean res = dumpHeap(process, managed, path, fd); |
| 1360 | reply.writeNoException(); |
| 1361 | reply.writeInt(res ? 1 : 0); |
| 1362 | return true; |
| 1363 | } |
| 1364 | |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 1365 | case START_ACTIVITIES_IN_PACKAGE_TRANSACTION: |
| 1366 | { |
| 1367 | data.enforceInterface(IActivityManager.descriptor); |
| 1368 | int uid = data.readInt(); |
| 1369 | Intent[] intents = data.createTypedArray(Intent.CREATOR); |
| 1370 | String[] resolvedTypes = data.createStringArray(); |
| 1371 | IBinder resultTo = data.readStrongBinder(); |
| 1372 | int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo); |
| 1373 | reply.writeNoException(); |
| 1374 | reply.writeInt(result); |
| 1375 | return true; |
| 1376 | } |
| 1377 | |
| 1378 | case START_ACTIVITIES_TRANSACTION: |
| 1379 | { |
| 1380 | data.enforceInterface(IActivityManager.descriptor); |
| 1381 | IBinder b = data.readStrongBinder(); |
| 1382 | IApplicationThread app = ApplicationThreadNative.asInterface(b); |
| 1383 | Intent[] intents = data.createTypedArray(Intent.CREATOR); |
| 1384 | String[] resolvedTypes = data.createStringArray(); |
| 1385 | IBinder resultTo = data.readStrongBinder(); |
| 1386 | int result = startActivities(app, intents, resolvedTypes, resultTo); |
| 1387 | reply.writeNoException(); |
| 1388 | reply.writeInt(result); |
| 1389 | return true; |
| 1390 | } |
| 1391 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1392 | } |
| 1393 | |
| 1394 | return super.onTransact(code, data, reply, flags); |
| 1395 | } |
| 1396 | |
| 1397 | public IBinder asBinder() |
| 1398 | { |
| 1399 | return this; |
| 1400 | } |
| 1401 | |
| 1402 | private static IActivityManager gDefault; |
| 1403 | } |
| 1404 | |
| 1405 | class ActivityManagerProxy implements IActivityManager |
| 1406 | { |
| 1407 | public ActivityManagerProxy(IBinder remote) |
| 1408 | { |
| 1409 | mRemote = remote; |
| 1410 | } |
| 1411 | |
| 1412 | public IBinder asBinder() |
| 1413 | { |
| 1414 | return mRemote; |
| 1415 | } |
| 1416 | |
| 1417 | public int startActivity(IApplicationThread caller, Intent intent, |
| 1418 | String resolvedType, Uri[] grantedUriPermissions, int grantedMode, |
| 1419 | IBinder resultTo, String resultWho, |
| 1420 | int requestCode, boolean onlyIfNeeded, |
| 1421 | boolean debug) throws RemoteException { |
| 1422 | Parcel data = Parcel.obtain(); |
| 1423 | Parcel reply = Parcel.obtain(); |
| 1424 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1425 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1426 | intent.writeToParcel(data, 0); |
| 1427 | data.writeString(resolvedType); |
| 1428 | data.writeTypedArray(grantedUriPermissions, 0); |
| 1429 | data.writeInt(grantedMode); |
| 1430 | data.writeStrongBinder(resultTo); |
| 1431 | data.writeString(resultWho); |
| 1432 | data.writeInt(requestCode); |
| 1433 | data.writeInt(onlyIfNeeded ? 1 : 0); |
| 1434 | data.writeInt(debug ? 1 : 0); |
| 1435 | mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1436 | reply.readException(); |
| 1437 | int result = reply.readInt(); |
| 1438 | reply.recycle(); |
| 1439 | data.recycle(); |
| 1440 | return result; |
| 1441 | } |
Dianne Hackborn | 8f7f35e | 2010-02-25 18:48:12 -0800 | [diff] [blame] | 1442 | public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent, |
| 1443 | String resolvedType, Uri[] grantedUriPermissions, int grantedMode, |
| 1444 | IBinder resultTo, String resultWho, |
| 1445 | int requestCode, boolean onlyIfNeeded, |
| 1446 | boolean debug) throws RemoteException { |
| 1447 | Parcel data = Parcel.obtain(); |
| 1448 | Parcel reply = Parcel.obtain(); |
| 1449 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1450 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1451 | intent.writeToParcel(data, 0); |
| 1452 | data.writeString(resolvedType); |
| 1453 | data.writeTypedArray(grantedUriPermissions, 0); |
| 1454 | data.writeInt(grantedMode); |
| 1455 | data.writeStrongBinder(resultTo); |
| 1456 | data.writeString(resultWho); |
| 1457 | data.writeInt(requestCode); |
| 1458 | data.writeInt(onlyIfNeeded ? 1 : 0); |
| 1459 | data.writeInt(debug ? 1 : 0); |
| 1460 | mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0); |
| 1461 | reply.readException(); |
| 1462 | WaitResult result = WaitResult.CREATOR.createFromParcel(reply); |
| 1463 | reply.recycle(); |
| 1464 | data.recycle(); |
| 1465 | return result; |
| 1466 | } |
Dianne Hackborn | 2ccda4d | 2010-03-22 21:49:15 -0700 | [diff] [blame] | 1467 | public int startActivityWithConfig(IApplicationThread caller, Intent intent, |
| 1468 | String resolvedType, Uri[] grantedUriPermissions, int grantedMode, |
| 1469 | IBinder resultTo, String resultWho, |
| 1470 | int requestCode, boolean onlyIfNeeded, |
| 1471 | boolean debug, Configuration config) throws RemoteException { |
| 1472 | Parcel data = Parcel.obtain(); |
| 1473 | Parcel reply = Parcel.obtain(); |
| 1474 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1475 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1476 | intent.writeToParcel(data, 0); |
| 1477 | data.writeString(resolvedType); |
| 1478 | data.writeTypedArray(grantedUriPermissions, 0); |
| 1479 | data.writeInt(grantedMode); |
| 1480 | data.writeStrongBinder(resultTo); |
| 1481 | data.writeString(resultWho); |
| 1482 | data.writeInt(requestCode); |
| 1483 | data.writeInt(onlyIfNeeded ? 1 : 0); |
| 1484 | data.writeInt(debug ? 1 : 0); |
| 1485 | config.writeToParcel(data, 0); |
| 1486 | mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1487 | reply.readException(); |
| 1488 | int result = reply.readInt(); |
| 1489 | reply.recycle(); |
| 1490 | data.recycle(); |
| 1491 | return result; |
| 1492 | } |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 1493 | public int startActivityIntentSender(IApplicationThread caller, |
| 1494 | IntentSender intent, Intent fillInIntent, String resolvedType, |
Dianne Hackborn | bcbcaa7 | 2009-09-10 10:54:46 -0700 | [diff] [blame] | 1495 | IBinder resultTo, String resultWho, int requestCode, |
| 1496 | int flagsMask, int flagsValues) throws RemoteException { |
| 1497 | Parcel data = Parcel.obtain(); |
| 1498 | Parcel reply = Parcel.obtain(); |
| 1499 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1500 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1501 | intent.writeToParcel(data, 0); |
| 1502 | if (fillInIntent != null) { |
| 1503 | data.writeInt(1); |
| 1504 | fillInIntent.writeToParcel(data, 0); |
| 1505 | } else { |
| 1506 | data.writeInt(0); |
| 1507 | } |
| 1508 | data.writeString(resolvedType); |
| 1509 | data.writeStrongBinder(resultTo); |
| 1510 | data.writeString(resultWho); |
| 1511 | data.writeInt(requestCode); |
| 1512 | data.writeInt(flagsMask); |
| 1513 | data.writeInt(flagsValues); |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 1514 | mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0); |
Dianne Hackborn | bcbcaa7 | 2009-09-10 10:54:46 -0700 | [diff] [blame] | 1515 | reply.readException(); |
| 1516 | int result = reply.readInt(); |
| 1517 | reply.recycle(); |
| 1518 | data.recycle(); |
| 1519 | return result; |
| 1520 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1521 | public boolean startNextMatchingActivity(IBinder callingActivity, |
| 1522 | Intent intent) throws RemoteException { |
| 1523 | Parcel data = Parcel.obtain(); |
| 1524 | Parcel reply = Parcel.obtain(); |
| 1525 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1526 | data.writeStrongBinder(callingActivity); |
| 1527 | intent.writeToParcel(data, 0); |
| 1528 | mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1529 | reply.readException(); |
| 1530 | int result = reply.readInt(); |
| 1531 | reply.recycle(); |
| 1532 | data.recycle(); |
| 1533 | return result != 0; |
| 1534 | } |
| 1535 | public boolean finishActivity(IBinder token, int resultCode, Intent resultData) |
| 1536 | throws RemoteException { |
| 1537 | Parcel data = Parcel.obtain(); |
| 1538 | Parcel reply = Parcel.obtain(); |
| 1539 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1540 | data.writeStrongBinder(token); |
| 1541 | data.writeInt(resultCode); |
| 1542 | if (resultData != null) { |
| 1543 | data.writeInt(1); |
| 1544 | resultData.writeToParcel(data, 0); |
| 1545 | } else { |
| 1546 | data.writeInt(0); |
| 1547 | } |
| 1548 | mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1549 | reply.readException(); |
| 1550 | boolean res = reply.readInt() != 0; |
| 1551 | data.recycle(); |
| 1552 | reply.recycle(); |
| 1553 | return res; |
| 1554 | } |
| 1555 | public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException |
| 1556 | { |
| 1557 | Parcel data = Parcel.obtain(); |
| 1558 | Parcel reply = Parcel.obtain(); |
| 1559 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1560 | data.writeStrongBinder(token); |
| 1561 | data.writeString(resultWho); |
| 1562 | data.writeInt(requestCode); |
| 1563 | mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1564 | reply.readException(); |
| 1565 | data.recycle(); |
| 1566 | reply.recycle(); |
| 1567 | } |
Dianne Hackborn | 061d58a | 2010-03-12 15:07:06 -0800 | [diff] [blame] | 1568 | public boolean willActivityBeVisible(IBinder token) throws RemoteException { |
| 1569 | Parcel data = Parcel.obtain(); |
| 1570 | Parcel reply = Parcel.obtain(); |
| 1571 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1572 | data.writeStrongBinder(token); |
| 1573 | mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0); |
| 1574 | reply.readException(); |
| 1575 | boolean res = reply.readInt() != 0; |
| 1576 | data.recycle(); |
| 1577 | reply.recycle(); |
| 1578 | return res; |
| 1579 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1580 | public Intent registerReceiver(IApplicationThread caller, |
| 1581 | IIntentReceiver receiver, |
| 1582 | IntentFilter filter, String perm) throws RemoteException |
| 1583 | { |
| 1584 | Parcel data = Parcel.obtain(); |
| 1585 | Parcel reply = Parcel.obtain(); |
| 1586 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1587 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1588 | data.writeStrongBinder(receiver != null ? receiver.asBinder() : null); |
| 1589 | filter.writeToParcel(data, 0); |
| 1590 | data.writeString(perm); |
| 1591 | mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0); |
| 1592 | reply.readException(); |
| 1593 | Intent intent = null; |
| 1594 | int haveIntent = reply.readInt(); |
| 1595 | if (haveIntent != 0) { |
| 1596 | intent = Intent.CREATOR.createFromParcel(reply); |
| 1597 | } |
| 1598 | reply.recycle(); |
| 1599 | data.recycle(); |
| 1600 | return intent; |
| 1601 | } |
| 1602 | public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException |
| 1603 | { |
| 1604 | Parcel data = Parcel.obtain(); |
| 1605 | Parcel reply = Parcel.obtain(); |
| 1606 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1607 | data.writeStrongBinder(receiver.asBinder()); |
| 1608 | mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0); |
| 1609 | reply.readException(); |
| 1610 | data.recycle(); |
| 1611 | reply.recycle(); |
| 1612 | } |
| 1613 | public int broadcastIntent(IApplicationThread caller, |
| 1614 | Intent intent, String resolvedType, IIntentReceiver resultTo, |
| 1615 | int resultCode, String resultData, Bundle map, |
| 1616 | String requiredPermission, boolean serialized, |
| 1617 | boolean sticky) throws RemoteException |
| 1618 | { |
| 1619 | Parcel data = Parcel.obtain(); |
| 1620 | Parcel reply = Parcel.obtain(); |
| 1621 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1622 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1623 | intent.writeToParcel(data, 0); |
| 1624 | data.writeString(resolvedType); |
| 1625 | data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null); |
| 1626 | data.writeInt(resultCode); |
| 1627 | data.writeString(resultData); |
| 1628 | data.writeBundle(map); |
| 1629 | data.writeString(requiredPermission); |
| 1630 | data.writeInt(serialized ? 1 : 0); |
| 1631 | data.writeInt(sticky ? 1 : 0); |
| 1632 | mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0); |
| 1633 | reply.readException(); |
| 1634 | int res = reply.readInt(); |
| 1635 | reply.recycle(); |
| 1636 | data.recycle(); |
| 1637 | return res; |
| 1638 | } |
| 1639 | public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException |
| 1640 | { |
| 1641 | Parcel data = Parcel.obtain(); |
| 1642 | Parcel reply = Parcel.obtain(); |
| 1643 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1644 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1645 | intent.writeToParcel(data, 0); |
| 1646 | mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0); |
| 1647 | reply.readException(); |
| 1648 | data.recycle(); |
| 1649 | reply.recycle(); |
| 1650 | } |
| 1651 | public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException |
| 1652 | { |
| 1653 | Parcel data = Parcel.obtain(); |
| 1654 | Parcel reply = Parcel.obtain(); |
| 1655 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1656 | data.writeStrongBinder(who); |
| 1657 | data.writeInt(resultCode); |
| 1658 | data.writeString(resultData); |
| 1659 | data.writeBundle(map); |
| 1660 | data.writeInt(abortBroadcast ? 1 : 0); |
| 1661 | mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1662 | reply.readException(); |
| 1663 | data.recycle(); |
| 1664 | reply.recycle(); |
| 1665 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1666 | public void attachApplication(IApplicationThread app) throws RemoteException |
| 1667 | { |
| 1668 | Parcel data = Parcel.obtain(); |
| 1669 | Parcel reply = Parcel.obtain(); |
| 1670 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1671 | data.writeStrongBinder(app.asBinder()); |
| 1672 | mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0); |
| 1673 | reply.readException(); |
| 1674 | data.recycle(); |
| 1675 | reply.recycle(); |
| 1676 | } |
Dianne Hackborn | e88846e | 2009-09-30 21:34:25 -0700 | [diff] [blame] | 1677 | public void activityIdle(IBinder token, Configuration config) throws RemoteException |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1678 | { |
| 1679 | Parcel data = Parcel.obtain(); |
| 1680 | Parcel reply = Parcel.obtain(); |
| 1681 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1682 | data.writeStrongBinder(token); |
Dianne Hackborn | e88846e | 2009-09-30 21:34:25 -0700 | [diff] [blame] | 1683 | if (config != null) { |
| 1684 | data.writeInt(1); |
| 1685 | config.writeToParcel(data, 0); |
| 1686 | } else { |
| 1687 | data.writeInt(0); |
| 1688 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1689 | mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1690 | reply.readException(); |
| 1691 | data.recycle(); |
| 1692 | reply.recycle(); |
| 1693 | } |
| 1694 | public void activityPaused(IBinder token, Bundle state) throws RemoteException |
| 1695 | { |
| 1696 | Parcel data = Parcel.obtain(); |
| 1697 | Parcel reply = Parcel.obtain(); |
| 1698 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1699 | data.writeStrongBinder(token); |
| 1700 | data.writeBundle(state); |
| 1701 | mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0); |
| 1702 | reply.readException(); |
| 1703 | data.recycle(); |
| 1704 | reply.recycle(); |
| 1705 | } |
| 1706 | public void activityStopped(IBinder token, |
| 1707 | Bitmap thumbnail, CharSequence description) throws RemoteException |
| 1708 | { |
| 1709 | Parcel data = Parcel.obtain(); |
| 1710 | Parcel reply = Parcel.obtain(); |
| 1711 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1712 | data.writeStrongBinder(token); |
| 1713 | if (thumbnail != null) { |
| 1714 | data.writeInt(1); |
| 1715 | thumbnail.writeToParcel(data, 0); |
| 1716 | } else { |
| 1717 | data.writeInt(0); |
| 1718 | } |
| 1719 | TextUtils.writeToParcel(description, data, 0); |
| 1720 | mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1721 | reply.readException(); |
| 1722 | data.recycle(); |
| 1723 | reply.recycle(); |
| 1724 | } |
| 1725 | public void activityDestroyed(IBinder token) throws RemoteException |
| 1726 | { |
| 1727 | Parcel data = Parcel.obtain(); |
| 1728 | Parcel reply = Parcel.obtain(); |
| 1729 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1730 | data.writeStrongBinder(token); |
| 1731 | mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1732 | reply.readException(); |
| 1733 | data.recycle(); |
| 1734 | reply.recycle(); |
| 1735 | } |
| 1736 | public String getCallingPackage(IBinder token) throws RemoteException |
| 1737 | { |
| 1738 | Parcel data = Parcel.obtain(); |
| 1739 | Parcel reply = Parcel.obtain(); |
| 1740 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1741 | data.writeStrongBinder(token); |
| 1742 | mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0); |
| 1743 | reply.readException(); |
| 1744 | String res = reply.readString(); |
| 1745 | data.recycle(); |
| 1746 | reply.recycle(); |
| 1747 | return res; |
| 1748 | } |
| 1749 | public ComponentName getCallingActivity(IBinder token) |
| 1750 | throws RemoteException { |
| 1751 | Parcel data = Parcel.obtain(); |
| 1752 | Parcel reply = Parcel.obtain(); |
| 1753 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1754 | data.writeStrongBinder(token); |
| 1755 | mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1756 | reply.readException(); |
| 1757 | ComponentName res = ComponentName.readFromParcel(reply); |
| 1758 | data.recycle(); |
| 1759 | reply.recycle(); |
| 1760 | return res; |
| 1761 | } |
| 1762 | public List getTasks(int maxNum, int flags, |
| 1763 | IThumbnailReceiver receiver) throws RemoteException { |
| 1764 | Parcel data = Parcel.obtain(); |
| 1765 | Parcel reply = Parcel.obtain(); |
| 1766 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1767 | data.writeInt(maxNum); |
| 1768 | data.writeInt(flags); |
| 1769 | data.writeStrongBinder(receiver != null ? receiver.asBinder() : null); |
| 1770 | mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0); |
| 1771 | reply.readException(); |
| 1772 | ArrayList list = null; |
| 1773 | int N = reply.readInt(); |
| 1774 | if (N >= 0) { |
| 1775 | list = new ArrayList(); |
| 1776 | while (N > 0) { |
| 1777 | ActivityManager.RunningTaskInfo info = |
| 1778 | ActivityManager.RunningTaskInfo.CREATOR |
| 1779 | .createFromParcel(reply); |
| 1780 | list.add(info); |
| 1781 | N--; |
| 1782 | } |
| 1783 | } |
| 1784 | data.recycle(); |
| 1785 | reply.recycle(); |
| 1786 | return list; |
| 1787 | } |
| 1788 | public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, |
| 1789 | int flags) throws RemoteException { |
| 1790 | Parcel data = Parcel.obtain(); |
| 1791 | Parcel reply = Parcel.obtain(); |
| 1792 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1793 | data.writeInt(maxNum); |
| 1794 | data.writeInt(flags); |
| 1795 | mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0); |
| 1796 | reply.readException(); |
| 1797 | ArrayList<ActivityManager.RecentTaskInfo> list |
| 1798 | = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR); |
| 1799 | data.recycle(); |
| 1800 | reply.recycle(); |
| 1801 | return list; |
| 1802 | } |
| 1803 | public List getServices(int maxNum, int flags) throws RemoteException { |
| 1804 | Parcel data = Parcel.obtain(); |
| 1805 | Parcel reply = Parcel.obtain(); |
| 1806 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1807 | data.writeInt(maxNum); |
| 1808 | data.writeInt(flags); |
| 1809 | mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0); |
| 1810 | reply.readException(); |
| 1811 | ArrayList list = null; |
| 1812 | int N = reply.readInt(); |
| 1813 | if (N >= 0) { |
| 1814 | list = new ArrayList(); |
| 1815 | while (N > 0) { |
| 1816 | ActivityManager.RunningServiceInfo info = |
| 1817 | ActivityManager.RunningServiceInfo.CREATOR |
| 1818 | .createFromParcel(reply); |
| 1819 | list.add(info); |
| 1820 | N--; |
| 1821 | } |
| 1822 | } |
| 1823 | data.recycle(); |
| 1824 | reply.recycle(); |
| 1825 | return list; |
| 1826 | } |
| 1827 | public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState() |
| 1828 | throws RemoteException { |
| 1829 | Parcel data = Parcel.obtain(); |
| 1830 | Parcel reply = Parcel.obtain(); |
| 1831 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1832 | mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0); |
| 1833 | reply.readException(); |
| 1834 | ArrayList<ActivityManager.ProcessErrorStateInfo> list |
| 1835 | = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR); |
| 1836 | data.recycle(); |
| 1837 | reply.recycle(); |
| 1838 | return list; |
| 1839 | } |
| 1840 | public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses() |
| 1841 | throws RemoteException { |
| 1842 | Parcel data = Parcel.obtain(); |
| 1843 | Parcel reply = Parcel.obtain(); |
| 1844 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1845 | mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0); |
| 1846 | reply.readException(); |
| 1847 | ArrayList<ActivityManager.RunningAppProcessInfo> list |
| 1848 | = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR); |
| 1849 | data.recycle(); |
| 1850 | reply.recycle(); |
| 1851 | return list; |
| 1852 | } |
Suchi Amalapurapu | f7f5dda | 2010-03-23 10:34:28 -0700 | [diff] [blame] | 1853 | public List<ApplicationInfo> getRunningExternalApplications() |
| 1854 | throws RemoteException { |
| 1855 | Parcel data = Parcel.obtain(); |
| 1856 | Parcel reply = Parcel.obtain(); |
| 1857 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1858 | mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0); |
| 1859 | reply.readException(); |
| 1860 | ArrayList<ApplicationInfo> list |
| 1861 | = reply.createTypedArrayList(ApplicationInfo.CREATOR); |
| 1862 | data.recycle(); |
| 1863 | reply.recycle(); |
| 1864 | return list; |
| 1865 | } |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 1866 | public void moveTaskToFront(int task, int flags) throws RemoteException |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1867 | { |
| 1868 | Parcel data = Parcel.obtain(); |
| 1869 | Parcel reply = Parcel.obtain(); |
| 1870 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1871 | data.writeInt(task); |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 1872 | data.writeInt(flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1873 | mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0); |
| 1874 | reply.readException(); |
| 1875 | data.recycle(); |
| 1876 | reply.recycle(); |
| 1877 | } |
| 1878 | public void moveTaskToBack(int task) throws RemoteException |
| 1879 | { |
| 1880 | Parcel data = Parcel.obtain(); |
| 1881 | Parcel reply = Parcel.obtain(); |
| 1882 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1883 | data.writeInt(task); |
| 1884 | mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0); |
| 1885 | reply.readException(); |
| 1886 | data.recycle(); |
| 1887 | reply.recycle(); |
| 1888 | } |
| 1889 | public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) |
| 1890 | throws RemoteException { |
| 1891 | Parcel data = Parcel.obtain(); |
| 1892 | Parcel reply = Parcel.obtain(); |
| 1893 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1894 | data.writeStrongBinder(token); |
| 1895 | data.writeInt(nonRoot ? 1 : 0); |
| 1896 | mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0); |
| 1897 | reply.readException(); |
| 1898 | boolean res = reply.readInt() != 0; |
| 1899 | data.recycle(); |
| 1900 | reply.recycle(); |
| 1901 | return res; |
| 1902 | } |
| 1903 | public void moveTaskBackwards(int task) throws RemoteException |
| 1904 | { |
| 1905 | Parcel data = Parcel.obtain(); |
| 1906 | Parcel reply = Parcel.obtain(); |
| 1907 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1908 | data.writeInt(task); |
| 1909 | mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0); |
| 1910 | reply.readException(); |
| 1911 | data.recycle(); |
| 1912 | reply.recycle(); |
| 1913 | } |
| 1914 | public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException |
| 1915 | { |
| 1916 | Parcel data = Parcel.obtain(); |
| 1917 | Parcel reply = Parcel.obtain(); |
| 1918 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1919 | data.writeStrongBinder(token); |
| 1920 | data.writeInt(onlyRoot ? 1 : 0); |
| 1921 | mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0); |
| 1922 | reply.readException(); |
| 1923 | int res = reply.readInt(); |
| 1924 | data.recycle(); |
| 1925 | reply.recycle(); |
| 1926 | return res; |
| 1927 | } |
| 1928 | public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException |
| 1929 | { |
| 1930 | Parcel data = Parcel.obtain(); |
| 1931 | Parcel reply = Parcel.obtain(); |
| 1932 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1933 | data.writeStrongBinder(token); |
| 1934 | ComponentName.writeToParcel(className, data); |
| 1935 | mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0); |
| 1936 | reply.readException(); |
| 1937 | data.recycle(); |
| 1938 | reply.recycle(); |
| 1939 | } |
| 1940 | public void reportThumbnail(IBinder token, |
| 1941 | Bitmap thumbnail, CharSequence description) throws RemoteException |
| 1942 | { |
| 1943 | Parcel data = Parcel.obtain(); |
| 1944 | Parcel reply = Parcel.obtain(); |
| 1945 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1946 | data.writeStrongBinder(token); |
| 1947 | if (thumbnail != null) { |
| 1948 | data.writeInt(1); |
| 1949 | thumbnail.writeToParcel(data, 0); |
| 1950 | } else { |
| 1951 | data.writeInt(0); |
| 1952 | } |
| 1953 | TextUtils.writeToParcel(description, data, 0); |
| 1954 | mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 1955 | reply.readException(); |
| 1956 | data.recycle(); |
| 1957 | reply.recycle(); |
| 1958 | } |
| 1959 | public ContentProviderHolder getContentProvider(IApplicationThread caller, |
| 1960 | String name) throws RemoteException |
| 1961 | { |
| 1962 | Parcel data = Parcel.obtain(); |
| 1963 | Parcel reply = Parcel.obtain(); |
| 1964 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1965 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1966 | data.writeString(name); |
| 1967 | mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); |
| 1968 | reply.readException(); |
| 1969 | int res = reply.readInt(); |
| 1970 | ContentProviderHolder cph = null; |
| 1971 | if (res != 0) { |
| 1972 | cph = ContentProviderHolder.CREATOR.createFromParcel(reply); |
| 1973 | } |
| 1974 | data.recycle(); |
| 1975 | reply.recycle(); |
| 1976 | return cph; |
| 1977 | } |
| 1978 | public void publishContentProviders(IApplicationThread caller, |
| 1979 | List<ContentProviderHolder> providers) throws RemoteException |
| 1980 | { |
| 1981 | Parcel data = Parcel.obtain(); |
| 1982 | Parcel reply = Parcel.obtain(); |
| 1983 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1984 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1985 | data.writeTypedList(providers); |
| 1986 | mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0); |
| 1987 | reply.readException(); |
| 1988 | data.recycle(); |
| 1989 | reply.recycle(); |
| 1990 | } |
| 1991 | |
| 1992 | public void removeContentProvider(IApplicationThread caller, |
| 1993 | String name) throws RemoteException { |
| 1994 | Parcel data = Parcel.obtain(); |
| 1995 | Parcel reply = Parcel.obtain(); |
| 1996 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 1997 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 1998 | data.writeString(name); |
| 1999 | mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); |
| 2000 | reply.readException(); |
| 2001 | data.recycle(); |
| 2002 | reply.recycle(); |
| 2003 | } |
| 2004 | |
Dianne Hackborn | dd9b82c | 2009-09-03 00:18:47 -0700 | [diff] [blame] | 2005 | public PendingIntent getRunningServiceControlPanel(ComponentName service) |
| 2006 | throws RemoteException |
| 2007 | { |
| 2008 | Parcel data = Parcel.obtain(); |
| 2009 | Parcel reply = Parcel.obtain(); |
| 2010 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2011 | service.writeToParcel(data, 0); |
| 2012 | mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0); |
| 2013 | reply.readException(); |
| 2014 | PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply); |
| 2015 | data.recycle(); |
| 2016 | reply.recycle(); |
| 2017 | return res; |
| 2018 | } |
| 2019 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2020 | public ComponentName startService(IApplicationThread caller, Intent service, |
| 2021 | String resolvedType) throws RemoteException |
| 2022 | { |
| 2023 | Parcel data = Parcel.obtain(); |
| 2024 | Parcel reply = Parcel.obtain(); |
| 2025 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2026 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 2027 | service.writeToParcel(data, 0); |
| 2028 | data.writeString(resolvedType); |
| 2029 | mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0); |
| 2030 | reply.readException(); |
| 2031 | ComponentName res = ComponentName.readFromParcel(reply); |
| 2032 | data.recycle(); |
| 2033 | reply.recycle(); |
| 2034 | return res; |
| 2035 | } |
| 2036 | public int stopService(IApplicationThread caller, Intent service, |
| 2037 | String resolvedType) throws RemoteException |
| 2038 | { |
| 2039 | Parcel data = Parcel.obtain(); |
| 2040 | Parcel reply = Parcel.obtain(); |
| 2041 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2042 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 2043 | service.writeToParcel(data, 0); |
| 2044 | data.writeString(resolvedType); |
| 2045 | mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0); |
| 2046 | reply.readException(); |
| 2047 | int res = reply.readInt(); |
| 2048 | reply.recycle(); |
| 2049 | data.recycle(); |
| 2050 | return res; |
| 2051 | } |
| 2052 | public boolean stopServiceToken(ComponentName className, IBinder token, |
| 2053 | int startId) throws RemoteException { |
| 2054 | Parcel data = Parcel.obtain(); |
| 2055 | Parcel reply = Parcel.obtain(); |
| 2056 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2057 | ComponentName.writeToParcel(className, data); |
| 2058 | data.writeStrongBinder(token); |
| 2059 | data.writeInt(startId); |
| 2060 | mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0); |
| 2061 | reply.readException(); |
| 2062 | boolean res = reply.readInt() != 0; |
| 2063 | data.recycle(); |
| 2064 | reply.recycle(); |
| 2065 | return res; |
| 2066 | } |
| 2067 | public void setServiceForeground(ComponentName className, IBinder token, |
Dianne Hackborn | d8a43f6 | 2009-08-17 23:33:56 -0700 | [diff] [blame] | 2068 | int id, Notification notification, boolean removeNotification) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2069 | Parcel data = Parcel.obtain(); |
| 2070 | Parcel reply = Parcel.obtain(); |
| 2071 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2072 | ComponentName.writeToParcel(className, data); |
| 2073 | data.writeStrongBinder(token); |
Dianne Hackborn | d8a43f6 | 2009-08-17 23:33:56 -0700 | [diff] [blame] | 2074 | data.writeInt(id); |
| 2075 | if (notification != null) { |
| 2076 | data.writeInt(1); |
| 2077 | notification.writeToParcel(data, 0); |
| 2078 | } else { |
| 2079 | data.writeInt(0); |
| 2080 | } |
| 2081 | data.writeInt(removeNotification ? 1 : 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2082 | mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0); |
| 2083 | reply.readException(); |
| 2084 | data.recycle(); |
| 2085 | reply.recycle(); |
| 2086 | } |
| 2087 | public int bindService(IApplicationThread caller, IBinder token, |
| 2088 | Intent service, String resolvedType, IServiceConnection connection, |
| 2089 | int flags) throws RemoteException { |
| 2090 | Parcel data = Parcel.obtain(); |
| 2091 | Parcel reply = Parcel.obtain(); |
| 2092 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2093 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 2094 | data.writeStrongBinder(token); |
| 2095 | service.writeToParcel(data, 0); |
| 2096 | data.writeString(resolvedType); |
| 2097 | data.writeStrongBinder(connection.asBinder()); |
| 2098 | data.writeInt(flags); |
| 2099 | mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0); |
| 2100 | reply.readException(); |
| 2101 | int res = reply.readInt(); |
| 2102 | data.recycle(); |
| 2103 | reply.recycle(); |
| 2104 | return res; |
| 2105 | } |
| 2106 | public boolean unbindService(IServiceConnection connection) throws RemoteException |
| 2107 | { |
| 2108 | Parcel data = Parcel.obtain(); |
| 2109 | Parcel reply = Parcel.obtain(); |
| 2110 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2111 | data.writeStrongBinder(connection.asBinder()); |
| 2112 | mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0); |
| 2113 | reply.readException(); |
| 2114 | boolean res = reply.readInt() != 0; |
| 2115 | data.recycle(); |
| 2116 | reply.recycle(); |
| 2117 | return res; |
| 2118 | } |
| 2119 | |
| 2120 | public void publishService(IBinder token, |
| 2121 | Intent intent, IBinder service) throws RemoteException { |
| 2122 | Parcel data = Parcel.obtain(); |
| 2123 | Parcel reply = Parcel.obtain(); |
| 2124 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2125 | data.writeStrongBinder(token); |
| 2126 | intent.writeToParcel(data, 0); |
| 2127 | data.writeStrongBinder(service); |
| 2128 | mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0); |
| 2129 | reply.readException(); |
| 2130 | data.recycle(); |
| 2131 | reply.recycle(); |
| 2132 | } |
| 2133 | |
| 2134 | public void unbindFinished(IBinder token, Intent intent, boolean doRebind) |
| 2135 | throws RemoteException { |
| 2136 | Parcel data = Parcel.obtain(); |
| 2137 | Parcel reply = Parcel.obtain(); |
| 2138 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2139 | data.writeStrongBinder(token); |
| 2140 | intent.writeToParcel(data, 0); |
| 2141 | data.writeInt(doRebind ? 1 : 0); |
| 2142 | mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0); |
| 2143 | reply.readException(); |
| 2144 | data.recycle(); |
| 2145 | reply.recycle(); |
| 2146 | } |
| 2147 | |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 2148 | public void serviceDoneExecuting(IBinder token, int type, int startId, |
| 2149 | int res) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2150 | Parcel data = Parcel.obtain(); |
| 2151 | Parcel reply = Parcel.obtain(); |
| 2152 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2153 | data.writeStrongBinder(token); |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 2154 | data.writeInt(type); |
| 2155 | data.writeInt(startId); |
| 2156 | data.writeInt(res); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2157 | mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); |
| 2158 | reply.readException(); |
| 2159 | data.recycle(); |
| 2160 | reply.recycle(); |
| 2161 | } |
| 2162 | |
| 2163 | public IBinder peekService(Intent service, String resolvedType) throws RemoteException { |
| 2164 | Parcel data = Parcel.obtain(); |
| 2165 | Parcel reply = Parcel.obtain(); |
| 2166 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2167 | service.writeToParcel(data, 0); |
| 2168 | data.writeString(resolvedType); |
| 2169 | mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0); |
| 2170 | reply.readException(); |
| 2171 | IBinder binder = reply.readStrongBinder(); |
| 2172 | reply.recycle(); |
| 2173 | data.recycle(); |
| 2174 | return binder; |
| 2175 | } |
| 2176 | |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 2177 | public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode) |
| 2178 | throws RemoteException { |
| 2179 | Parcel data = Parcel.obtain(); |
| 2180 | Parcel reply = Parcel.obtain(); |
| 2181 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2182 | app.writeToParcel(data, 0); |
| 2183 | data.writeInt(backupRestoreMode); |
| 2184 | mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0); |
| 2185 | reply.readException(); |
| 2186 | boolean success = reply.readInt() != 0; |
| 2187 | reply.recycle(); |
| 2188 | data.recycle(); |
| 2189 | return success; |
| 2190 | } |
| 2191 | |
| 2192 | public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException { |
| 2193 | Parcel data = Parcel.obtain(); |
| 2194 | Parcel reply = Parcel.obtain(); |
| 2195 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2196 | data.writeString(packageName); |
| 2197 | data.writeStrongBinder(agent); |
| 2198 | mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0); |
| 2199 | reply.recycle(); |
| 2200 | data.recycle(); |
| 2201 | } |
| 2202 | |
| 2203 | public void unbindBackupAgent(ApplicationInfo app) throws RemoteException { |
| 2204 | Parcel data = Parcel.obtain(); |
| 2205 | Parcel reply = Parcel.obtain(); |
| 2206 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2207 | app.writeToParcel(data, 0); |
| 2208 | mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0); |
| 2209 | reply.readException(); |
| 2210 | reply.recycle(); |
| 2211 | data.recycle(); |
| 2212 | } |
| 2213 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2214 | public boolean startInstrumentation(ComponentName className, String profileFile, |
| 2215 | int flags, Bundle arguments, IInstrumentationWatcher watcher) |
| 2216 | throws RemoteException { |
| 2217 | Parcel data = Parcel.obtain(); |
| 2218 | Parcel reply = Parcel.obtain(); |
| 2219 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2220 | ComponentName.writeToParcel(className, data); |
| 2221 | data.writeString(profileFile); |
| 2222 | data.writeInt(flags); |
| 2223 | data.writeBundle(arguments); |
| 2224 | data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); |
| 2225 | mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0); |
| 2226 | reply.readException(); |
| 2227 | boolean res = reply.readInt() != 0; |
| 2228 | reply.recycle(); |
| 2229 | data.recycle(); |
| 2230 | return res; |
| 2231 | } |
| 2232 | |
| 2233 | public void finishInstrumentation(IApplicationThread target, |
| 2234 | int resultCode, Bundle results) throws RemoteException { |
| 2235 | Parcel data = Parcel.obtain(); |
| 2236 | Parcel reply = Parcel.obtain(); |
| 2237 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2238 | data.writeStrongBinder(target != null ? target.asBinder() : null); |
| 2239 | data.writeInt(resultCode); |
| 2240 | data.writeBundle(results); |
| 2241 | mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0); |
| 2242 | reply.readException(); |
| 2243 | data.recycle(); |
| 2244 | reply.recycle(); |
| 2245 | } |
| 2246 | public Configuration getConfiguration() throws RemoteException |
| 2247 | { |
| 2248 | Parcel data = Parcel.obtain(); |
| 2249 | Parcel reply = Parcel.obtain(); |
| 2250 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2251 | mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0); |
| 2252 | reply.readException(); |
| 2253 | Configuration res = Configuration.CREATOR.createFromParcel(reply); |
| 2254 | reply.recycle(); |
| 2255 | data.recycle(); |
| 2256 | return res; |
| 2257 | } |
| 2258 | public void updateConfiguration(Configuration values) throws RemoteException |
| 2259 | { |
| 2260 | Parcel data = Parcel.obtain(); |
| 2261 | Parcel reply = Parcel.obtain(); |
| 2262 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2263 | values.writeToParcel(data, 0); |
| 2264 | mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0); |
| 2265 | reply.readException(); |
| 2266 | data.recycle(); |
| 2267 | reply.recycle(); |
| 2268 | } |
| 2269 | public void setRequestedOrientation(IBinder token, int requestedOrientation) |
| 2270 | throws RemoteException { |
| 2271 | Parcel data = Parcel.obtain(); |
| 2272 | Parcel reply = Parcel.obtain(); |
| 2273 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2274 | data.writeStrongBinder(token); |
| 2275 | data.writeInt(requestedOrientation); |
| 2276 | mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); |
| 2277 | reply.readException(); |
| 2278 | data.recycle(); |
| 2279 | reply.recycle(); |
| 2280 | } |
| 2281 | public int getRequestedOrientation(IBinder token) throws RemoteException { |
| 2282 | Parcel data = Parcel.obtain(); |
| 2283 | Parcel reply = Parcel.obtain(); |
| 2284 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2285 | data.writeStrongBinder(token); |
| 2286 | mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); |
| 2287 | reply.readException(); |
| 2288 | int res = reply.readInt(); |
| 2289 | data.recycle(); |
| 2290 | reply.recycle(); |
| 2291 | return res; |
| 2292 | } |
| 2293 | public ComponentName getActivityClassForToken(IBinder token) |
| 2294 | throws RemoteException { |
| 2295 | Parcel data = Parcel.obtain(); |
| 2296 | Parcel reply = Parcel.obtain(); |
| 2297 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2298 | data.writeStrongBinder(token); |
| 2299 | mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0); |
| 2300 | reply.readException(); |
| 2301 | ComponentName res = ComponentName.readFromParcel(reply); |
| 2302 | data.recycle(); |
| 2303 | reply.recycle(); |
| 2304 | return res; |
| 2305 | } |
| 2306 | public String getPackageForToken(IBinder token) throws RemoteException |
| 2307 | { |
| 2308 | Parcel data = Parcel.obtain(); |
| 2309 | Parcel reply = Parcel.obtain(); |
| 2310 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2311 | data.writeStrongBinder(token); |
| 2312 | mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0); |
| 2313 | reply.readException(); |
| 2314 | String res = reply.readString(); |
| 2315 | data.recycle(); |
| 2316 | reply.recycle(); |
| 2317 | return res; |
| 2318 | } |
| 2319 | public IIntentSender getIntentSender(int type, |
| 2320 | String packageName, IBinder token, String resultWho, |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 2321 | int requestCode, Intent[] intents, String[] resolvedTypes, int flags) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2322 | throws RemoteException { |
| 2323 | Parcel data = Parcel.obtain(); |
| 2324 | Parcel reply = Parcel.obtain(); |
| 2325 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2326 | data.writeInt(type); |
| 2327 | data.writeString(packageName); |
| 2328 | data.writeStrongBinder(token); |
| 2329 | data.writeString(resultWho); |
| 2330 | data.writeInt(requestCode); |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 2331 | if (intents != null) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2332 | data.writeInt(1); |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 2333 | data.writeTypedArray(intents, 0); |
| 2334 | data.writeStringArray(resolvedTypes); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2335 | } else { |
| 2336 | data.writeInt(0); |
| 2337 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2338 | data.writeInt(flags); |
| 2339 | mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0); |
| 2340 | reply.readException(); |
| 2341 | IIntentSender res = IIntentSender.Stub.asInterface( |
| 2342 | reply.readStrongBinder()); |
| 2343 | data.recycle(); |
| 2344 | reply.recycle(); |
| 2345 | return res; |
| 2346 | } |
| 2347 | public void cancelIntentSender(IIntentSender sender) throws RemoteException { |
| 2348 | Parcel data = Parcel.obtain(); |
| 2349 | Parcel reply = Parcel.obtain(); |
| 2350 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2351 | data.writeStrongBinder(sender.asBinder()); |
| 2352 | mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0); |
| 2353 | reply.readException(); |
| 2354 | data.recycle(); |
| 2355 | reply.recycle(); |
| 2356 | } |
| 2357 | public String getPackageForIntentSender(IIntentSender sender) throws RemoteException { |
| 2358 | Parcel data = Parcel.obtain(); |
| 2359 | Parcel reply = Parcel.obtain(); |
| 2360 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2361 | data.writeStrongBinder(sender.asBinder()); |
| 2362 | mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); |
| 2363 | reply.readException(); |
| 2364 | String res = reply.readString(); |
| 2365 | data.recycle(); |
| 2366 | reply.recycle(); |
| 2367 | return res; |
| 2368 | } |
| 2369 | public void setProcessLimit(int max) throws RemoteException |
| 2370 | { |
| 2371 | Parcel data = Parcel.obtain(); |
| 2372 | Parcel reply = Parcel.obtain(); |
| 2373 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2374 | data.writeInt(max); |
| 2375 | mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); |
| 2376 | reply.readException(); |
| 2377 | data.recycle(); |
| 2378 | reply.recycle(); |
| 2379 | } |
| 2380 | public int getProcessLimit() throws RemoteException |
| 2381 | { |
| 2382 | Parcel data = Parcel.obtain(); |
| 2383 | Parcel reply = Parcel.obtain(); |
| 2384 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2385 | mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); |
| 2386 | reply.readException(); |
| 2387 | int res = reply.readInt(); |
| 2388 | data.recycle(); |
| 2389 | reply.recycle(); |
| 2390 | return res; |
| 2391 | } |
| 2392 | public void setProcessForeground(IBinder token, int pid, |
| 2393 | boolean isForeground) throws RemoteException { |
| 2394 | Parcel data = Parcel.obtain(); |
| 2395 | Parcel reply = Parcel.obtain(); |
| 2396 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2397 | data.writeStrongBinder(token); |
| 2398 | data.writeInt(pid); |
| 2399 | data.writeInt(isForeground ? 1 : 0); |
| 2400 | mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0); |
| 2401 | reply.readException(); |
| 2402 | data.recycle(); |
| 2403 | reply.recycle(); |
| 2404 | } |
| 2405 | public int checkPermission(String permission, int pid, int uid) |
| 2406 | throws RemoteException { |
| 2407 | Parcel data = Parcel.obtain(); |
| 2408 | Parcel reply = Parcel.obtain(); |
| 2409 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2410 | data.writeString(permission); |
| 2411 | data.writeInt(pid); |
| 2412 | data.writeInt(uid); |
| 2413 | mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0); |
| 2414 | reply.readException(); |
| 2415 | int res = reply.readInt(); |
| 2416 | data.recycle(); |
| 2417 | reply.recycle(); |
| 2418 | return res; |
| 2419 | } |
| 2420 | public boolean clearApplicationUserData(final String packageName, |
| 2421 | final IPackageDataObserver observer) throws RemoteException { |
| 2422 | Parcel data = Parcel.obtain(); |
| 2423 | Parcel reply = Parcel.obtain(); |
| 2424 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2425 | data.writeString(packageName); |
| 2426 | data.writeStrongBinder(observer.asBinder()); |
| 2427 | mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0); |
| 2428 | reply.readException(); |
| 2429 | boolean res = reply.readInt() != 0; |
| 2430 | data.recycle(); |
| 2431 | reply.recycle(); |
| 2432 | return res; |
| 2433 | } |
| 2434 | public int checkUriPermission(Uri uri, int pid, int uid, int mode) |
| 2435 | throws RemoteException { |
| 2436 | Parcel data = Parcel.obtain(); |
| 2437 | Parcel reply = Parcel.obtain(); |
| 2438 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2439 | uri.writeToParcel(data, 0); |
| 2440 | data.writeInt(pid); |
| 2441 | data.writeInt(uid); |
| 2442 | data.writeInt(mode); |
| 2443 | mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0); |
| 2444 | reply.readException(); |
| 2445 | int res = reply.readInt(); |
| 2446 | data.recycle(); |
| 2447 | reply.recycle(); |
| 2448 | return res; |
| 2449 | } |
| 2450 | public void grantUriPermission(IApplicationThread caller, String targetPkg, |
| 2451 | Uri uri, int mode) throws RemoteException { |
| 2452 | Parcel data = Parcel.obtain(); |
| 2453 | Parcel reply = Parcel.obtain(); |
| 2454 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2455 | data.writeStrongBinder(caller.asBinder()); |
| 2456 | data.writeString(targetPkg); |
| 2457 | uri.writeToParcel(data, 0); |
| 2458 | data.writeInt(mode); |
| 2459 | mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); |
| 2460 | reply.readException(); |
| 2461 | data.recycle(); |
| 2462 | reply.recycle(); |
| 2463 | } |
| 2464 | public void revokeUriPermission(IApplicationThread caller, Uri uri, |
| 2465 | int mode) throws RemoteException { |
| 2466 | Parcel data = Parcel.obtain(); |
| 2467 | Parcel reply = Parcel.obtain(); |
| 2468 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2469 | data.writeStrongBinder(caller.asBinder()); |
| 2470 | uri.writeToParcel(data, 0); |
| 2471 | data.writeInt(mode); |
| 2472 | mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0); |
| 2473 | reply.readException(); |
| 2474 | data.recycle(); |
| 2475 | reply.recycle(); |
| 2476 | } |
| 2477 | public void showWaitingForDebugger(IApplicationThread who, boolean waiting) |
| 2478 | throws RemoteException { |
| 2479 | Parcel data = Parcel.obtain(); |
| 2480 | Parcel reply = Parcel.obtain(); |
| 2481 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2482 | data.writeStrongBinder(who.asBinder()); |
| 2483 | data.writeInt(waiting ? 1 : 0); |
| 2484 | mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0); |
| 2485 | reply.readException(); |
| 2486 | data.recycle(); |
| 2487 | reply.recycle(); |
| 2488 | } |
| 2489 | public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException { |
| 2490 | Parcel data = Parcel.obtain(); |
| 2491 | Parcel reply = Parcel.obtain(); |
| 2492 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2493 | mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0); |
| 2494 | reply.readException(); |
| 2495 | outInfo.readFromParcel(reply); |
| 2496 | data.recycle(); |
| 2497 | reply.recycle(); |
| 2498 | } |
| 2499 | public void unhandledBack() throws RemoteException |
| 2500 | { |
| 2501 | Parcel data = Parcel.obtain(); |
| 2502 | Parcel reply = Parcel.obtain(); |
| 2503 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2504 | mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0); |
| 2505 | reply.readException(); |
| 2506 | data.recycle(); |
| 2507 | reply.recycle(); |
| 2508 | } |
| 2509 | public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException |
| 2510 | { |
| 2511 | Parcel data = Parcel.obtain(); |
| 2512 | Parcel reply = Parcel.obtain(); |
| 2513 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2514 | mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0); |
| 2515 | reply.readException(); |
| 2516 | ParcelFileDescriptor pfd = null; |
| 2517 | if (reply.readInt() != 0) { |
| 2518 | pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply); |
| 2519 | } |
| 2520 | data.recycle(); |
| 2521 | reply.recycle(); |
| 2522 | return pfd; |
| 2523 | } |
| 2524 | public void goingToSleep() throws RemoteException |
| 2525 | { |
| 2526 | Parcel data = Parcel.obtain(); |
| 2527 | Parcel reply = Parcel.obtain(); |
| 2528 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2529 | mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0); |
| 2530 | reply.readException(); |
| 2531 | data.recycle(); |
| 2532 | reply.recycle(); |
| 2533 | } |
| 2534 | public void wakingUp() throws RemoteException |
| 2535 | { |
| 2536 | Parcel data = Parcel.obtain(); |
| 2537 | Parcel reply = Parcel.obtain(); |
| 2538 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2539 | mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0); |
| 2540 | reply.readException(); |
| 2541 | data.recycle(); |
| 2542 | reply.recycle(); |
| 2543 | } |
| 2544 | public void setDebugApp( |
| 2545 | String packageName, boolean waitForDebugger, boolean persistent) |
| 2546 | throws RemoteException |
| 2547 | { |
| 2548 | Parcel data = Parcel.obtain(); |
| 2549 | Parcel reply = Parcel.obtain(); |
| 2550 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2551 | data.writeString(packageName); |
| 2552 | data.writeInt(waitForDebugger ? 1 : 0); |
| 2553 | data.writeInt(persistent ? 1 : 0); |
| 2554 | mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0); |
| 2555 | reply.readException(); |
| 2556 | data.recycle(); |
| 2557 | reply.recycle(); |
| 2558 | } |
| 2559 | public void setAlwaysFinish(boolean enabled) throws RemoteException |
| 2560 | { |
| 2561 | Parcel data = Parcel.obtain(); |
| 2562 | Parcel reply = Parcel.obtain(); |
| 2563 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2564 | data.writeInt(enabled ? 1 : 0); |
| 2565 | mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0); |
| 2566 | reply.readException(); |
| 2567 | data.recycle(); |
| 2568 | reply.recycle(); |
| 2569 | } |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 2570 | public void setActivityController(IActivityController watcher) throws RemoteException |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2571 | { |
| 2572 | Parcel data = Parcel.obtain(); |
| 2573 | Parcel reply = Parcel.obtain(); |
| 2574 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2575 | data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 2576 | mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2577 | reply.readException(); |
| 2578 | data.recycle(); |
| 2579 | reply.recycle(); |
| 2580 | } |
| 2581 | public void enterSafeMode() throws RemoteException { |
| 2582 | Parcel data = Parcel.obtain(); |
| 2583 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2584 | mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0); |
| 2585 | data.recycle(); |
| 2586 | } |
| 2587 | public void noteWakeupAlarm(IIntentSender sender) throws RemoteException { |
| 2588 | Parcel data = Parcel.obtain(); |
| 2589 | data.writeStrongBinder(sender.asBinder()); |
| 2590 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2591 | mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0); |
| 2592 | data.recycle(); |
| 2593 | } |
Suchi Amalapurapu | e99bb5f | 2010-03-19 14:36:49 -0700 | [diff] [blame] | 2594 | public boolean killPids(int[] pids, String reason) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2595 | Parcel data = Parcel.obtain(); |
| 2596 | Parcel reply = Parcel.obtain(); |
| 2597 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2598 | data.writeIntArray(pids); |
Suchi Amalapurapu | e99bb5f | 2010-03-19 14:36:49 -0700 | [diff] [blame] | 2599 | data.writeString(reason); |
| 2600 | mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2601 | boolean res = reply.readInt() != 0; |
| 2602 | data.recycle(); |
| 2603 | reply.recycle(); |
| 2604 | return res; |
| 2605 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2606 | public void startRunning(String pkg, String cls, String action, |
| 2607 | String indata) throws RemoteException { |
| 2608 | Parcel data = Parcel.obtain(); |
| 2609 | Parcel reply = Parcel.obtain(); |
| 2610 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2611 | data.writeString(pkg); |
| 2612 | data.writeString(cls); |
| 2613 | data.writeString(action); |
| 2614 | data.writeString(indata); |
| 2615 | mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0); |
| 2616 | reply.readException(); |
| 2617 | data.recycle(); |
| 2618 | reply.recycle(); |
| 2619 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2620 | public boolean testIsSystemReady() |
| 2621 | { |
| 2622 | /* this base class version is never called */ |
| 2623 | return true; |
| 2624 | } |
Dan Egnor | 60d8762 | 2009-12-16 16:32:58 -0800 | [diff] [blame] | 2625 | public void handleApplicationCrash(IBinder app, |
| 2626 | ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException |
| 2627 | { |
| 2628 | Parcel data = Parcel.obtain(); |
| 2629 | Parcel reply = Parcel.obtain(); |
| 2630 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2631 | data.writeStrongBinder(app); |
| 2632 | crashInfo.writeToParcel(data, 0); |
| 2633 | mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0); |
| 2634 | reply.readException(); |
| 2635 | reply.recycle(); |
| 2636 | data.recycle(); |
| 2637 | } |
Brad Fitzpatrick | 438d059 | 2010-06-10 12:19:19 -0700 | [diff] [blame] | 2638 | |
Dan Egnor | 60d8762 | 2009-12-16 16:32:58 -0800 | [diff] [blame] | 2639 | public boolean handleApplicationWtf(IBinder app, String tag, |
Dan Egnor | b7f0367 | 2009-12-09 16:22:32 -0800 | [diff] [blame] | 2640 | ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2641 | { |
| 2642 | Parcel data = Parcel.obtain(); |
| 2643 | Parcel reply = Parcel.obtain(); |
| 2644 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2645 | data.writeStrongBinder(app); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2646 | data.writeString(tag); |
Dan Egnor | b7f0367 | 2009-12-09 16:22:32 -0800 | [diff] [blame] | 2647 | crashInfo.writeToParcel(data, 0); |
Dan Egnor | 60d8762 | 2009-12-16 16:32:58 -0800 | [diff] [blame] | 2648 | mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2649 | reply.readException(); |
Dan Egnor | 60d8762 | 2009-12-16 16:32:58 -0800 | [diff] [blame] | 2650 | boolean res = reply.readInt() != 0; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2651 | reply.recycle(); |
| 2652 | data.recycle(); |
Dan Egnor | 60d8762 | 2009-12-16 16:32:58 -0800 | [diff] [blame] | 2653 | return res; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2654 | } |
Dan Egnor | b7f0367 | 2009-12-09 16:22:32 -0800 | [diff] [blame] | 2655 | |
Brad Fitzpatrick | 438d059 | 2010-06-10 12:19:19 -0700 | [diff] [blame] | 2656 | public void handleApplicationStrictModeViolation(IBinder app, |
Brad Fitzpatrick | 46d4238 | 2010-06-11 13:57:58 -0700 | [diff] [blame] | 2657 | int violationMask, |
Brad Fitzpatrick | cb9ceb1 | 2010-07-29 14:29:02 -0700 | [diff] [blame] | 2658 | StrictMode.ViolationInfo info) throws RemoteException |
Brad Fitzpatrick | 438d059 | 2010-06-10 12:19:19 -0700 | [diff] [blame] | 2659 | { |
| 2660 | Parcel data = Parcel.obtain(); |
| 2661 | Parcel reply = Parcel.obtain(); |
| 2662 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2663 | data.writeStrongBinder(app); |
Brad Fitzpatrick | 46d4238 | 2010-06-11 13:57:58 -0700 | [diff] [blame] | 2664 | data.writeInt(violationMask); |
Brad Fitzpatrick | cb9ceb1 | 2010-07-29 14:29:02 -0700 | [diff] [blame] | 2665 | info.writeToParcel(data, 0); |
Brad Fitzpatrick | 438d059 | 2010-06-10 12:19:19 -0700 | [diff] [blame] | 2666 | mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0); |
| 2667 | reply.readException(); |
| 2668 | reply.recycle(); |
| 2669 | data.recycle(); |
| 2670 | } |
| 2671 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2672 | public void signalPersistentProcesses(int sig) throws RemoteException { |
| 2673 | Parcel data = Parcel.obtain(); |
| 2674 | Parcel reply = Parcel.obtain(); |
| 2675 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2676 | data.writeInt(sig); |
| 2677 | mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0); |
| 2678 | reply.readException(); |
| 2679 | data.recycle(); |
| 2680 | reply.recycle(); |
| 2681 | } |
| 2682 | |
Dianne Hackborn | 03abb81 | 2010-01-04 18:43:19 -0800 | [diff] [blame] | 2683 | public void killBackgroundProcesses(String packageName) throws RemoteException { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2684 | Parcel data = Parcel.obtain(); |
| 2685 | Parcel reply = Parcel.obtain(); |
| 2686 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2687 | data.writeString(packageName); |
Dianne Hackborn | 03abb81 | 2010-01-04 18:43:19 -0800 | [diff] [blame] | 2688 | mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0); |
| 2689 | reply.readException(); |
| 2690 | data.recycle(); |
| 2691 | reply.recycle(); |
| 2692 | } |
| 2693 | |
| 2694 | public void forceStopPackage(String packageName) throws RemoteException { |
| 2695 | Parcel data = Parcel.obtain(); |
| 2696 | Parcel reply = Parcel.obtain(); |
| 2697 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2698 | data.writeString(packageName); |
| 2699 | mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2700 | reply.readException(); |
| 2701 | data.recycle(); |
| 2702 | reply.recycle(); |
| 2703 | } |
| 2704 | |
| 2705 | public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException |
| 2706 | { |
| 2707 | Parcel data = Parcel.obtain(); |
| 2708 | Parcel reply = Parcel.obtain(); |
| 2709 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2710 | mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0); |
| 2711 | reply.readException(); |
| 2712 | ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply); |
| 2713 | reply.recycle(); |
| 2714 | data.recycle(); |
| 2715 | return res; |
| 2716 | } |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 2717 | |
| 2718 | public boolean profileControl(String process, boolean start, |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 2719 | String path, ParcelFileDescriptor fd) throws RemoteException |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 2720 | { |
| 2721 | Parcel data = Parcel.obtain(); |
| 2722 | Parcel reply = Parcel.obtain(); |
| 2723 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2724 | data.writeString(process); |
| 2725 | data.writeInt(start ? 1 : 0); |
| 2726 | data.writeString(path); |
Dianne Hackborn | 9c8dd55 | 2009-06-23 19:22:52 -0700 | [diff] [blame] | 2727 | if (fd != null) { |
| 2728 | data.writeInt(1); |
| 2729 | fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 2730 | } else { |
| 2731 | data.writeInt(0); |
| 2732 | } |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 2733 | mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0); |
| 2734 | reply.readException(); |
| 2735 | boolean res = reply.readInt() != 0; |
| 2736 | reply.recycle(); |
| 2737 | data.recycle(); |
| 2738 | return res; |
| 2739 | } |
| 2740 | |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 2741 | public boolean shutdown(int timeout) throws RemoteException |
| 2742 | { |
| 2743 | Parcel data = Parcel.obtain(); |
| 2744 | Parcel reply = Parcel.obtain(); |
| 2745 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2746 | data.writeInt(timeout); |
| 2747 | mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0); |
| 2748 | reply.readException(); |
| 2749 | boolean res = reply.readInt() != 0; |
| 2750 | reply.recycle(); |
| 2751 | data.recycle(); |
| 2752 | return res; |
| 2753 | } |
| 2754 | |
Dianne Hackborn | 95fc68f | 2009-05-19 18:37:45 -0700 | [diff] [blame] | 2755 | public void stopAppSwitches() throws RemoteException { |
| 2756 | Parcel data = Parcel.obtain(); |
| 2757 | Parcel reply = Parcel.obtain(); |
| 2758 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2759 | mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0); |
| 2760 | reply.readException(); |
| 2761 | reply.recycle(); |
| 2762 | data.recycle(); |
| 2763 | } |
| 2764 | |
| 2765 | public void resumeAppSwitches() throws RemoteException { |
| 2766 | Parcel data = Parcel.obtain(); |
| 2767 | Parcel reply = Parcel.obtain(); |
| 2768 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2769 | mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0); |
| 2770 | reply.readException(); |
| 2771 | reply.recycle(); |
| 2772 | data.recycle(); |
| 2773 | } |
| 2774 | |
Dianne Hackborn | b06ea70 | 2009-07-13 13:07:51 -0700 | [diff] [blame] | 2775 | public void registerActivityWatcher(IActivityWatcher watcher) |
| 2776 | throws RemoteException { |
| 2777 | Parcel data = Parcel.obtain(); |
| 2778 | Parcel reply = Parcel.obtain(); |
| 2779 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2780 | data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); |
| 2781 | mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0); |
| 2782 | reply.readException(); |
| 2783 | data.recycle(); |
| 2784 | reply.recycle(); |
| 2785 | } |
| 2786 | |
| 2787 | public void unregisterActivityWatcher(IActivityWatcher watcher) |
| 2788 | throws RemoteException { |
| 2789 | Parcel data = Parcel.obtain(); |
| 2790 | Parcel reply = Parcel.obtain(); |
| 2791 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2792 | data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); |
| 2793 | mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0); |
| 2794 | reply.readException(); |
| 2795 | data.recycle(); |
| 2796 | reply.recycle(); |
| 2797 | } |
| 2798 | |
Dianne Hackborn | 2d91af0 | 2009-07-16 13:34:33 -0700 | [diff] [blame] | 2799 | public int startActivityInPackage(int uid, |
| 2800 | Intent intent, String resolvedType, IBinder resultTo, |
| 2801 | String resultWho, int requestCode, boolean onlyIfNeeded) |
| 2802 | throws RemoteException { |
| 2803 | Parcel data = Parcel.obtain(); |
| 2804 | Parcel reply = Parcel.obtain(); |
| 2805 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2806 | data.writeInt(uid); |
| 2807 | intent.writeToParcel(data, 0); |
| 2808 | data.writeString(resolvedType); |
| 2809 | data.writeStrongBinder(resultTo); |
| 2810 | data.writeString(resultWho); |
| 2811 | data.writeInt(requestCode); |
| 2812 | data.writeInt(onlyIfNeeded ? 1 : 0); |
| 2813 | mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0); |
| 2814 | reply.readException(); |
| 2815 | int result = reply.readInt(); |
| 2816 | reply.recycle(); |
| 2817 | data.recycle(); |
| 2818 | return result; |
| 2819 | } |
Dianne Hackborn | a6ddc8a | 2009-07-28 17:49:55 -0700 | [diff] [blame] | 2820 | |
Suchi Amalapurapu | 261e66a | 2009-07-27 15:21:34 -0700 | [diff] [blame] | 2821 | public void killApplicationWithUid(String pkg, int uid) throws RemoteException { |
| 2822 | Parcel data = Parcel.obtain(); |
| 2823 | Parcel reply = Parcel.obtain(); |
| 2824 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2825 | data.writeString(pkg); |
| 2826 | data.writeInt(uid); |
| 2827 | mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0); |
| 2828 | reply.readException(); |
| 2829 | data.recycle(); |
| 2830 | reply.recycle(); |
| 2831 | } |
Dianne Hackborn | a6ddc8a | 2009-07-28 17:49:55 -0700 | [diff] [blame] | 2832 | |
| 2833 | public void closeSystemDialogs(String reason) throws RemoteException { |
| 2834 | Parcel data = Parcel.obtain(); |
| 2835 | Parcel reply = Parcel.obtain(); |
| 2836 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2837 | data.writeString(reason); |
| 2838 | mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0); |
| 2839 | reply.readException(); |
| 2840 | data.recycle(); |
| 2841 | reply.recycle(); |
| 2842 | } |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 2843 | |
Dianne Hackborn | 4f21c4c | 2009-09-17 10:24:05 -0700 | [diff] [blame] | 2844 | public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 2845 | throws RemoteException { |
| 2846 | Parcel data = Parcel.obtain(); |
| 2847 | Parcel reply = Parcel.obtain(); |
| 2848 | data.writeInterfaceToken(IActivityManager.descriptor); |
Dianne Hackborn | 4f21c4c | 2009-09-17 10:24:05 -0700 | [diff] [blame] | 2849 | data.writeIntArray(pids); |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 2850 | mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0); |
| 2851 | reply.readException(); |
Dianne Hackborn | 4f21c4c | 2009-09-17 10:24:05 -0700 | [diff] [blame] | 2852 | Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR); |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 2853 | data.recycle(); |
| 2854 | reply.recycle(); |
Dianne Hackborn | 4f21c4c | 2009-09-17 10:24:05 -0700 | [diff] [blame] | 2855 | return res; |
Dianne Hackborn | 3025ef3 | 2009-08-31 21:31:47 -0700 | [diff] [blame] | 2856 | } |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 2857 | |
| 2858 | public void killApplicationProcess(String processName, int uid) throws RemoteException { |
| 2859 | Parcel data = Parcel.obtain(); |
| 2860 | Parcel reply = Parcel.obtain(); |
| 2861 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2862 | data.writeString(processName); |
| 2863 | data.writeInt(uid); |
| 2864 | mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0); |
| 2865 | reply.readException(); |
| 2866 | data.recycle(); |
| 2867 | reply.recycle(); |
| 2868 | } |
| 2869 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 2870 | public void overridePendingTransition(IBinder token, String packageName, |
| 2871 | int enterAnim, int exitAnim) throws RemoteException { |
| 2872 | Parcel data = Parcel.obtain(); |
| 2873 | Parcel reply = Parcel.obtain(); |
| 2874 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2875 | data.writeStrongBinder(token); |
| 2876 | data.writeString(packageName); |
| 2877 | data.writeInt(enterAnim); |
| 2878 | data.writeInt(exitAnim); |
| 2879 | mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0); |
| 2880 | reply.readException(); |
| 2881 | data.recycle(); |
| 2882 | reply.recycle(); |
| 2883 | } |
| 2884 | |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 2885 | public boolean isUserAMonkey() throws RemoteException { |
| 2886 | Parcel data = Parcel.obtain(); |
| 2887 | Parcel reply = Parcel.obtain(); |
| 2888 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2889 | mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0); |
| 2890 | reply.readException(); |
| 2891 | boolean res = reply.readInt() != 0; |
| 2892 | data.recycle(); |
| 2893 | reply.recycle(); |
| 2894 | return res; |
| 2895 | } |
| 2896 | |
Dianne Hackborn | 860755f | 2010-06-03 18:47:52 -0700 | [diff] [blame] | 2897 | public void finishHeavyWeightApp() throws RemoteException { |
| 2898 | Parcel data = Parcel.obtain(); |
| 2899 | Parcel reply = Parcel.obtain(); |
| 2900 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2901 | mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0); |
| 2902 | reply.readException(); |
| 2903 | data.recycle(); |
| 2904 | reply.recycle(); |
| 2905 | } |
| 2906 | |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 2907 | public void setImmersive(IBinder token, boolean immersive) |
| 2908 | throws RemoteException { |
| 2909 | Parcel data = Parcel.obtain(); |
| 2910 | Parcel reply = Parcel.obtain(); |
| 2911 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2912 | data.writeStrongBinder(token); |
| 2913 | data.writeInt(immersive ? 1 : 0); |
| 2914 | mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0); |
| 2915 | reply.readException(); |
| 2916 | data.recycle(); |
| 2917 | reply.recycle(); |
| 2918 | } |
| 2919 | |
| 2920 | public boolean isImmersive(IBinder token) |
| 2921 | throws RemoteException { |
| 2922 | Parcel data = Parcel.obtain(); |
| 2923 | Parcel reply = Parcel.obtain(); |
| 2924 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2925 | data.writeStrongBinder(token); |
| 2926 | mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0); |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 2927 | reply.readException(); |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 2928 | boolean res = reply.readInt() == 1; |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 2929 | data.recycle(); |
| 2930 | reply.recycle(); |
| 2931 | return res; |
| 2932 | } |
| 2933 | |
| 2934 | public boolean isTopActivityImmersive() |
| 2935 | throws RemoteException { |
| 2936 | Parcel data = Parcel.obtain(); |
| 2937 | Parcel reply = Parcel.obtain(); |
| 2938 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2939 | mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0); |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 2940 | reply.readException(); |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 2941 | boolean res = reply.readInt() == 1; |
Daniel Sandler | 69a4817 | 2010-06-23 16:29:36 -0400 | [diff] [blame] | 2942 | data.recycle(); |
| 2943 | reply.recycle(); |
| 2944 | return res; |
| 2945 | } |
| 2946 | |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 2947 | public void crashApplication(int uid, int initialPid, String packageName, |
| 2948 | String message) throws RemoteException { |
| 2949 | Parcel data = Parcel.obtain(); |
| 2950 | Parcel reply = Parcel.obtain(); |
| 2951 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2952 | data.writeInt(uid); |
| 2953 | data.writeInt(initialPid); |
| 2954 | data.writeString(packageName); |
| 2955 | data.writeString(message); |
| 2956 | mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0); |
| 2957 | reply.readException(); |
| 2958 | data.recycle(); |
| 2959 | reply.recycle(); |
| 2960 | } |
Andy McFadden | 824c510 | 2010-07-09 16:26:57 -0700 | [diff] [blame] | 2961 | |
Dianne Hackborn | cca1f0e | 2010-09-26 18:34:53 -0700 | [diff] [blame] | 2962 | public String getProviderMimeType(Uri uri) |
| 2963 | throws RemoteException { |
| 2964 | Parcel data = Parcel.obtain(); |
| 2965 | Parcel reply = Parcel.obtain(); |
| 2966 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2967 | uri.writeToParcel(data, 0); |
| 2968 | mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0); |
| 2969 | reply.readException(); |
| 2970 | String res = reply.readString(); |
| 2971 | data.recycle(); |
| 2972 | reply.recycle(); |
| 2973 | return res; |
| 2974 | } |
| 2975 | |
Dianne Hackborn | 7e26964 | 2010-08-25 19:50:20 -0700 | [diff] [blame] | 2976 | public IBinder newUriPermissionOwner(String name) |
| 2977 | throws RemoteException { |
| 2978 | Parcel data = Parcel.obtain(); |
| 2979 | Parcel reply = Parcel.obtain(); |
| 2980 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2981 | data.writeString(name); |
| 2982 | mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0); |
| 2983 | reply.readException(); |
| 2984 | IBinder res = reply.readStrongBinder(); |
| 2985 | data.recycle(); |
| 2986 | reply.recycle(); |
| 2987 | return res; |
| 2988 | } |
| 2989 | |
| 2990 | public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg, |
| 2991 | Uri uri, int mode) throws RemoteException { |
| 2992 | Parcel data = Parcel.obtain(); |
| 2993 | Parcel reply = Parcel.obtain(); |
| 2994 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 2995 | data.writeStrongBinder(owner); |
| 2996 | data.writeInt(fromUid); |
| 2997 | data.writeString(targetPkg); |
| 2998 | uri.writeToParcel(data, 0); |
| 2999 | data.writeInt(mode); |
| 3000 | mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); |
| 3001 | reply.readException(); |
| 3002 | data.recycle(); |
| 3003 | reply.recycle(); |
| 3004 | } |
| 3005 | |
| 3006 | public void revokeUriPermissionFromOwner(IBinder owner, Uri uri, |
| 3007 | int mode) throws RemoteException { |
| 3008 | Parcel data = Parcel.obtain(); |
| 3009 | Parcel reply = Parcel.obtain(); |
| 3010 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 3011 | data.writeStrongBinder(owner); |
| 3012 | if (uri != null) { |
| 3013 | data.writeInt(1); |
| 3014 | uri.writeToParcel(data, 0); |
| 3015 | } else { |
| 3016 | data.writeInt(0); |
| 3017 | } |
| 3018 | data.writeInt(mode); |
| 3019 | mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0); |
| 3020 | reply.readException(); |
| 3021 | data.recycle(); |
| 3022 | reply.recycle(); |
| 3023 | } |
Dianne Hackborn | c8f8497 | 2010-08-25 23:14:44 -0700 | [diff] [blame] | 3024 | |
Dianne Hackborn | 90f4aaf | 2010-09-27 14:58:44 -0700 | [diff] [blame] | 3025 | public int checkGrantUriPermission(int callingUid, String targetPkg, |
| 3026 | Uri uri, int modeFlags) throws RemoteException { |
| 3027 | Parcel data = Parcel.obtain(); |
| 3028 | Parcel reply = Parcel.obtain(); |
| 3029 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 3030 | data.writeInt(callingUid); |
| 3031 | data.writeString(targetPkg); |
| 3032 | uri.writeToParcel(data, 0); |
| 3033 | data.writeInt(modeFlags); |
| 3034 | mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); |
| 3035 | reply.readException(); |
| 3036 | int res = reply.readInt(); |
| 3037 | data.recycle(); |
| 3038 | reply.recycle(); |
| 3039 | return res; |
| 3040 | } |
| 3041 | |
Andy McFadden | 824c510 | 2010-07-09 16:26:57 -0700 | [diff] [blame] | 3042 | public boolean dumpHeap(String process, boolean managed, |
| 3043 | String path, ParcelFileDescriptor fd) throws RemoteException { |
| 3044 | Parcel data = Parcel.obtain(); |
| 3045 | Parcel reply = Parcel.obtain(); |
| 3046 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 3047 | data.writeString(process); |
| 3048 | data.writeInt(managed ? 1 : 0); |
| 3049 | data.writeString(path); |
| 3050 | if (fd != null) { |
| 3051 | data.writeInt(1); |
| 3052 | fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); |
| 3053 | } else { |
| 3054 | data.writeInt(0); |
| 3055 | } |
| 3056 | mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0); |
| 3057 | reply.readException(); |
| 3058 | boolean res = reply.readInt() != 0; |
| 3059 | reply.recycle(); |
| 3060 | data.recycle(); |
| 3061 | return res; |
| 3062 | } |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 3063 | |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame^] | 3064 | public int startActivities(IApplicationThread caller, |
| 3065 | Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException { |
| 3066 | Parcel data = Parcel.obtain(); |
| 3067 | Parcel reply = Parcel.obtain(); |
| 3068 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 3069 | data.writeStrongBinder(caller != null ? caller.asBinder() : null); |
| 3070 | data.writeTypedArray(intents, 0); |
| 3071 | data.writeStringArray(resolvedTypes); |
| 3072 | data.writeStrongBinder(resultTo); |
| 3073 | mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0); |
| 3074 | reply.readException(); |
| 3075 | int result = reply.readInt(); |
| 3076 | reply.recycle(); |
| 3077 | data.recycle(); |
| 3078 | return result; |
| 3079 | } |
| 3080 | |
| 3081 | public int startActivitiesInPackage(int uid, |
| 3082 | Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException { |
| 3083 | Parcel data = Parcel.obtain(); |
| 3084 | Parcel reply = Parcel.obtain(); |
| 3085 | data.writeInterfaceToken(IActivityManager.descriptor); |
| 3086 | data.writeInt(uid); |
| 3087 | data.writeTypedArray(intents, 0); |
| 3088 | data.writeStringArray(resolvedTypes); |
| 3089 | data.writeStrongBinder(resultTo); |
| 3090 | mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0); |
| 3091 | reply.readException(); |
| 3092 | int result = reply.readInt(); |
| 3093 | reply.recycle(); |
| 3094 | data.recycle(); |
| 3095 | return result; |
| 3096 | } |
| 3097 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3098 | private IBinder mRemote; |
| 3099 | } |