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