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