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