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