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