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