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