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 com.android.server.am; |
| 18 | |
Jorim Jaggi | e2ad37f | 2018-01-22 22:41:22 +0100 | [diff] [blame] | 19 | import static android.app.ActivityManager.START_SUCCESS; |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 20 | |
Wale Ogunwale | e23149f | 2015-03-06 15:39:44 -0800 | [diff] [blame] | 21 | import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; |
| 22 | import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; |
| 23 | |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 24 | import android.annotation.Nullable; |
Dianne Hackborn | a4972e9 | 2012-03-14 10:38:05 -0700 | [diff] [blame] | 25 | import android.app.ActivityManager; |
Jorim Jaggi | 4d8d32c | 2018-01-19 15:57:41 +0100 | [diff] [blame] | 26 | import android.app.ActivityOptions; |
Philip P. Moltmann | e7421e9 | 2020-02-10 16:14:12 +0000 | [diff] [blame] | 27 | import android.app.PendingIntent; |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 28 | import android.content.IIntentReceiver; |
| 29 | import android.content.IIntentSender; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 30 | import android.content.Intent; |
| 31 | import android.os.Binder; |
Dianne Hackborn | a4972e9 | 2012-03-14 10:38:05 -0700 | [diff] [blame] | 32 | import android.os.Bundle; |
Dianne Hackborn | bcbcaa7 | 2009-09-10 10:54:46 -0700 | [diff] [blame] | 33 | import android.os.IBinder; |
Dianne Hackborn | f66adfd | 2017-04-13 11:01:48 -0700 | [diff] [blame] | 34 | import android.os.RemoteCallbackList; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | import android.os.RemoteException; |
Craig Mautner | 5f2bb4c | 2015-03-12 16:10:27 -0700 | [diff] [blame] | 36 | import android.os.TransactionTooLargeException; |
Dianne Hackborn | 50cdf7c3 | 2012-09-23 17:08:57 -0700 | [diff] [blame] | 37 | import android.os.UserHandle; |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 38 | import android.util.ArrayMap; |
Michal Karpinski | ac116df | 2018-12-10 17:51:42 +0000 | [diff] [blame] | 39 | import android.util.ArraySet; |
Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 40 | import android.util.Slog; |
Dianne Hackborn | bc02a39 | 2016-06-02 17:15:08 -0700 | [diff] [blame] | 41 | import android.util.TimeUtils; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 | |
Dianne Hackborn | f66adfd | 2017-04-13 11:01:48 -0700 | [diff] [blame] | 43 | import com.android.internal.os.IResultReceiver; |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 44 | import com.android.internal.util.function.pooled.PooledLambda; |
Wale Ogunwale | 5950709 | 2018-10-29 09:00:30 -0700 | [diff] [blame] | 45 | import com.android.server.wm.SafeActivityOptions; |
Craig Mautner | b916836 | 2015-02-26 20:40:19 -0800 | [diff] [blame] | 46 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 47 | import java.io.PrintWriter; |
| 48 | import java.lang.ref.WeakReference; |
Rubin Xu | f24d606 | 2016-07-20 17:34:50 +0100 | [diff] [blame] | 49 | import java.util.Objects; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 50 | |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 51 | public final class PendingIntentRecord extends IIntentSender.Stub { |
Wale Ogunwale | e23149f | 2015-03-06 15:39:44 -0800 | [diff] [blame] | 52 | private static final String TAG = TAG_WITH_CLASS_NAME ? "PendingIntentRecord" : TAG_AM; |
| 53 | |
Michal Karpinski | ac116df | 2018-12-10 17:51:42 +0000 | [diff] [blame] | 54 | public static final int FLAG_ACTIVITY_SENDER = 1 << 0; |
| 55 | public static final int FLAG_BROADCAST_SENDER = 1 << 1; |
Michal Karpinski | c8aa91b | 2019-01-10 16:45:59 +0000 | [diff] [blame] | 56 | public static final int FLAG_SERVICE_SENDER = 1 << 2; |
Michal Karpinski | ac116df | 2018-12-10 17:51:42 +0000 | [diff] [blame] | 57 | |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 58 | final PendingIntentController controller; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 59 | final Key key; |
| 60 | final int uid; |
Wale Ogunwale | 5950709 | 2018-10-29 09:00:30 -0700 | [diff] [blame] | 61 | public final WeakReference<PendingIntentRecord> ref; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 62 | boolean sent = false; |
| 63 | boolean canceled = false; |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 64 | private ArrayMap<IBinder, Long> whitelistDuration; |
Dianne Hackborn | f66adfd | 2017-04-13 11:01:48 -0700 | [diff] [blame] | 65 | private RemoteCallbackList<IResultReceiver> mCancelCallbacks; |
Michal Karpinski | ac116df | 2018-12-10 17:51:42 +0000 | [diff] [blame] | 66 | private ArraySet<IBinder> mAllowBgActivityStartsForActivitySender = new ArraySet<>(); |
| 67 | private ArraySet<IBinder> mAllowBgActivityStartsForBroadcastSender = new ArraySet<>(); |
Michal Karpinski | c8aa91b | 2019-01-10 16:45:59 +0000 | [diff] [blame] | 68 | private ArraySet<IBinder> mAllowBgActivityStartsForServiceSender = new ArraySet<>(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 70 | String stringName; |
Dianne Hackborn | a1f1a3c | 2014-02-24 18:12:28 -0800 | [diff] [blame] | 71 | String lastTagPrefix; |
| 72 | String lastTag; |
Wale Ogunwale | e23149f | 2015-03-06 15:39:44 -0800 | [diff] [blame] | 73 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 74 | final static class Key { |
| 75 | final int type; |
| 76 | final String packageName; |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 77 | final String featureId; |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 78 | final IBinder activity; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 79 | final String who; |
| 80 | final int requestCode; |
| 81 | final Intent requestIntent; |
| 82 | final String requestResolvedType; |
Jorim Jaggi | 4d8d32c | 2018-01-19 15:57:41 +0100 | [diff] [blame] | 83 | final SafeActivityOptions options; |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame] | 84 | Intent[] allIntents; |
| 85 | String[] allResolvedTypes; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 86 | final int flags; |
| 87 | final int hashCode; |
Amith Yamasani | 4ea6069 | 2012-08-28 14:34:53 -0700 | [diff] [blame] | 88 | final int userId; |
Felipe Leme | a1b79bf | 2016-05-24 13:06:54 -0700 | [diff] [blame] | 89 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 90 | private static final int ODD_PRIME_NUMBER = 37; |
Felipe Leme | a1b79bf | 2016-05-24 13:06:54 -0700 | [diff] [blame] | 91 | |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 92 | Key(int _t, String _p, @Nullable String _featureId, IBinder _a, String _w, |
Jorim Jaggi | 4d8d32c | 2018-01-19 15:57:41 +0100 | [diff] [blame] | 93 | int _r, Intent[] _i, String[] _it, int _f, SafeActivityOptions _o, int _userId) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 94 | type = _t; |
| 95 | packageName = _p; |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 96 | featureId = _featureId; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 97 | activity = _a; |
| 98 | who = _w; |
| 99 | requestCode = _r; |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame] | 100 | requestIntent = _i != null ? _i[_i.length-1] : null; |
| 101 | requestResolvedType = _it != null ? _it[_it.length-1] : null; |
| 102 | allIntents = _i; |
| 103 | allResolvedTypes = _it; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 104 | flags = _f; |
Dianne Hackborn | 7a2195c | 2012-03-19 17:38:00 -0700 | [diff] [blame] | 105 | options = _o; |
Amith Yamasani | 4ea6069 | 2012-08-28 14:34:53 -0700 | [diff] [blame] | 106 | userId = _userId; |
| 107 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 108 | int hash = 23; |
| 109 | hash = (ODD_PRIME_NUMBER*hash) + _f; |
| 110 | hash = (ODD_PRIME_NUMBER*hash) + _r; |
Amith Yamasani | 4ea6069 | 2012-08-28 14:34:53 -0700 | [diff] [blame] | 111 | hash = (ODD_PRIME_NUMBER*hash) + _userId; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 112 | if (_w != null) { |
| 113 | hash = (ODD_PRIME_NUMBER*hash) + _w.hashCode(); |
| 114 | } |
| 115 | if (_a != null) { |
| 116 | hash = (ODD_PRIME_NUMBER*hash) + _a.hashCode(); |
| 117 | } |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame] | 118 | if (requestIntent != null) { |
| 119 | hash = (ODD_PRIME_NUMBER*hash) + requestIntent.filterHashCode(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 120 | } |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame] | 121 | if (requestResolvedType != null) { |
| 122 | hash = (ODD_PRIME_NUMBER*hash) + requestResolvedType.hashCode(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 123 | } |
Rubin Xu | f24d606 | 2016-07-20 17:34:50 +0100 | [diff] [blame] | 124 | hash = (ODD_PRIME_NUMBER*hash) + (_p != null ? _p.hashCode() : 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 125 | hash = (ODD_PRIME_NUMBER*hash) + _t; |
| 126 | hashCode = hash; |
Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 127 | //Slog.i(ActivityManagerService.TAG, this + " hashCode=0x" |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 128 | // + Integer.toHexString(hashCode)); |
| 129 | } |
Felipe Leme | a1b79bf | 2016-05-24 13:06:54 -0700 | [diff] [blame] | 130 | |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 131 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 132 | public boolean equals(Object otherObj) { |
| 133 | if (otherObj == null) { |
| 134 | return false; |
| 135 | } |
| 136 | try { |
| 137 | Key other = (Key)otherObj; |
| 138 | if (type != other.type) { |
| 139 | return false; |
| 140 | } |
Amith Yamasani | 4ea6069 | 2012-08-28 14:34:53 -0700 | [diff] [blame] | 141 | if (userId != other.userId){ |
| 142 | return false; |
| 143 | } |
Rubin Xu | f24d606 | 2016-07-20 17:34:50 +0100 | [diff] [blame] | 144 | if (!Objects.equals(packageName, other.packageName)) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 145 | return false; |
| 146 | } |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 147 | if (!Objects.equals(featureId, other.featureId)) { |
| 148 | return false; |
| 149 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 150 | if (activity != other.activity) { |
| 151 | return false; |
| 152 | } |
Rubin Xu | f24d606 | 2016-07-20 17:34:50 +0100 | [diff] [blame] | 153 | if (!Objects.equals(who, other.who)) { |
| 154 | return false; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 155 | } |
| 156 | if (requestCode != other.requestCode) { |
| 157 | return false; |
| 158 | } |
| 159 | if (requestIntent != other.requestIntent) { |
| 160 | if (requestIntent != null) { |
| 161 | if (!requestIntent.filterEquals(other.requestIntent)) { |
| 162 | return false; |
| 163 | } |
| 164 | } else if (other.requestIntent != null) { |
| 165 | return false; |
| 166 | } |
| 167 | } |
Rubin Xu | f24d606 | 2016-07-20 17:34:50 +0100 | [diff] [blame] | 168 | if (!Objects.equals(requestResolvedType, other.requestResolvedType)) { |
| 169 | return false; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 170 | } |
| 171 | if (flags != other.flags) { |
| 172 | return false; |
| 173 | } |
| 174 | return true; |
| 175 | } catch (ClassCastException e) { |
| 176 | } |
| 177 | return false; |
| 178 | } |
| 179 | |
| 180 | public int hashCode() { |
| 181 | return hashCode; |
| 182 | } |
Craig Mautner | 5f2bb4c | 2015-03-12 16:10:27 -0700 | [diff] [blame] | 183 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 184 | public String toString() { |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 185 | return "Key{" + typeName() |
| 186 | + " pkg=" + packageName + (featureId != null ? "/" + featureId : "") |
Dianne Hackborn | c3b91fd | 2010-02-23 17:25:30 -0800 | [diff] [blame] | 187 | + " intent=" |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 188 | + (requestIntent != null |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 189 | ? requestIntent.toShortString(false, true, false, false) : "<null>") |
Amith Yamasani | 4ea6069 | 2012-08-28 14:34:53 -0700 | [diff] [blame] | 190 | + " flags=0x" + Integer.toHexString(flags) + " u=" + userId + "}"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 191 | } |
Craig Mautner | 5f2bb4c | 2015-03-12 16:10:27 -0700 | [diff] [blame] | 192 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 193 | String typeName() { |
| 194 | switch (type) { |
Dianne Hackborn | a4972e9 | 2012-03-14 10:38:05 -0700 | [diff] [blame] | 195 | case ActivityManager.INTENT_SENDER_ACTIVITY: |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 196 | return "startActivity"; |
Dianne Hackborn | a4972e9 | 2012-03-14 10:38:05 -0700 | [diff] [blame] | 197 | case ActivityManager.INTENT_SENDER_BROADCAST: |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 198 | return "broadcastIntent"; |
Dianne Hackborn | a4972e9 | 2012-03-14 10:38:05 -0700 | [diff] [blame] | 199 | case ActivityManager.INTENT_SENDER_SERVICE: |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 200 | return "startService"; |
Christopher Tate | 08992ac | 2017-03-21 11:37:06 -0700 | [diff] [blame] | 201 | case ActivityManager.INTENT_SENDER_FOREGROUND_SERVICE: |
| 202 | return "startForegroundService"; |
Dianne Hackborn | a4972e9 | 2012-03-14 10:38:05 -0700 | [diff] [blame] | 203 | case ActivityManager.INTENT_SENDER_ACTIVITY_RESULT: |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 204 | return "activityResult"; |
| 205 | } |
| 206 | return Integer.toString(type); |
| 207 | } |
| 208 | } |
Craig Mautner | 5f2bb4c | 2015-03-12 16:10:27 -0700 | [diff] [blame] | 209 | |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 210 | PendingIntentRecord(PendingIntentController _controller, Key _k, int _u) { |
| 211 | controller = _controller; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 212 | key = _k; |
| 213 | uid = _u; |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 214 | ref = new WeakReference<>(this); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 215 | } |
| 216 | |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 217 | void setWhitelistDurationLocked(IBinder whitelistToken, long duration) { |
| 218 | if (duration > 0) { |
| 219 | if (whitelistDuration == null) { |
| 220 | whitelistDuration = new ArrayMap<>(); |
| 221 | } |
| 222 | whitelistDuration.put(whitelistToken, duration); |
| 223 | } else if (whitelistDuration != null) { |
| 224 | whitelistDuration.remove(whitelistToken); |
| 225 | if (whitelistDuration.size() <= 0) { |
| 226 | whitelistDuration = null; |
| 227 | } |
| 228 | |
| 229 | } |
Felipe Leme | a1b79bf | 2016-05-24 13:06:54 -0700 | [diff] [blame] | 230 | this.stringName = null; |
| 231 | } |
| 232 | |
Michal Karpinski | ac116df | 2018-12-10 17:51:42 +0000 | [diff] [blame] | 233 | void setAllowBgActivityStarts(IBinder token, int flags) { |
| 234 | if (token == null) return; |
| 235 | if ((flags & FLAG_ACTIVITY_SENDER) != 0) { |
| 236 | mAllowBgActivityStartsForActivitySender.add(token); |
| 237 | } |
| 238 | if ((flags & FLAG_BROADCAST_SENDER) != 0) { |
| 239 | mAllowBgActivityStartsForBroadcastSender.add(token); |
| 240 | } |
Michal Karpinski | c8aa91b | 2019-01-10 16:45:59 +0000 | [diff] [blame] | 241 | if ((flags & FLAG_SERVICE_SENDER) != 0) { |
| 242 | mAllowBgActivityStartsForServiceSender.add(token); |
| 243 | } |
Michal Karpinski | ac116df | 2018-12-10 17:51:42 +0000 | [diff] [blame] | 244 | } |
| 245 | |
Michal Karpinski | d207589 | 2019-04-17 16:01:10 +0100 | [diff] [blame] | 246 | void clearAllowBgActivityStarts(IBinder token) { |
| 247 | if (token == null) return; |
| 248 | mAllowBgActivityStartsForActivitySender.remove(token); |
| 249 | mAllowBgActivityStartsForBroadcastSender.remove(token); |
| 250 | mAllowBgActivityStartsForServiceSender.remove(token); |
| 251 | } |
| 252 | |
Dianne Hackborn | f66adfd | 2017-04-13 11:01:48 -0700 | [diff] [blame] | 253 | public void registerCancelListenerLocked(IResultReceiver receiver) { |
| 254 | if (mCancelCallbacks == null) { |
| 255 | mCancelCallbacks = new RemoteCallbackList<>(); |
| 256 | } |
| 257 | mCancelCallbacks.register(receiver); |
| 258 | } |
| 259 | |
| 260 | public void unregisterCancelListenerLocked(IResultReceiver receiver) { |
Makoto Onuki | 8a0319a | 2018-04-25 16:31:05 -0700 | [diff] [blame] | 261 | if (mCancelCallbacks == null) { |
| 262 | return; // Already unregistered or detached. |
| 263 | } |
Dianne Hackborn | f66adfd | 2017-04-13 11:01:48 -0700 | [diff] [blame] | 264 | mCancelCallbacks.unregister(receiver); |
| 265 | if (mCancelCallbacks.getRegisteredCallbackCount() <= 0) { |
| 266 | mCancelCallbacks = null; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | public RemoteCallbackList<IResultReceiver> detachCancelListenersLocked() { |
| 271 | RemoteCallbackList<IResultReceiver> listeners = mCancelCallbacks; |
| 272 | mCancelCallbacks = null; |
| 273 | return listeners; |
| 274 | } |
| 275 | |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 276 | public void send(int code, Intent intent, String resolvedType, IBinder whitelistToken, |
Dianne Hackborn | 0c4e6a8 | 2016-05-13 17:37:08 -0700 | [diff] [blame] | 277 | IIntentReceiver finishedReceiver, String requiredPermission, Bundle options) { |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 278 | sendInner(code, intent, resolvedType, whitelistToken, finishedReceiver, |
Andrii Kulian | b1cdb10 | 2017-07-13 15:33:06 -0700 | [diff] [blame] | 279 | requiredPermission, null, null, 0, 0, 0, options); |
Dianne Hackborn | bcbcaa7 | 2009-09-10 10:54:46 -0700 | [diff] [blame] | 280 | } |
Craig Mautner | 5f2bb4c | 2015-03-12 16:10:27 -0700 | [diff] [blame] | 281 | |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 282 | public int sendWithResult(int code, Intent intent, String resolvedType, IBinder whitelistToken, |
| 283 | IIntentReceiver finishedReceiver, String requiredPermission, Bundle options) { |
| 284 | return sendInner(code, intent, resolvedType, whitelistToken, finishedReceiver, |
Andrii Kulian | b1cdb10 | 2017-07-13 15:33:06 -0700 | [diff] [blame] | 285 | requiredPermission, null, null, 0, 0, 0, options); |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 286 | } |
| 287 | |
Wale Ogunwale | 5950709 | 2018-10-29 09:00:30 -0700 | [diff] [blame] | 288 | public int sendInner(int code, Intent intent, String resolvedType, IBinder whitelistToken, |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 289 | IIntentReceiver finishedReceiver, String requiredPermission, IBinder resultTo, |
| 290 | String resultWho, int requestCode, int flagsMask, int flagsValues, Bundle options) { |
Jeff Sharkey | f0ec2e0 | 2016-03-21 12:37:54 -0600 | [diff] [blame] | 291 | if (intent != null) intent.setDefusable(true); |
| 292 | if (options != null) options.setDefusable(true); |
| 293 | |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 294 | Long duration = null; |
| 295 | Intent finalIntent = null; |
| 296 | Intent[] allIntents = null; |
| 297 | String[] allResolvedTypes = null; |
| 298 | SafeActivityOptions mergedOptions = null; |
| 299 | synchronized (controller.mLock) { |
| 300 | if (canceled) { |
| 301 | return ActivityManager.START_CANCELED; |
| 302 | } |
Svetoslav | b0a7839 | 2015-04-10 17:25:35 -0700 | [diff] [blame] | 303 | |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 304 | sent = true; |
| 305 | if ((key.flags & PendingIntent.FLAG_ONE_SHOT) != 0) { |
| 306 | controller.cancelIntentSender(this, true); |
| 307 | } |
Svetoslav | b0a7839 | 2015-04-10 17:25:35 -0700 | [diff] [blame] | 308 | |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 309 | finalIntent = key.requestIntent != null ? new Intent(key.requestIntent) : new Intent(); |
| 310 | |
| 311 | final boolean immutable = (key.flags & PendingIntent.FLAG_IMMUTABLE) != 0; |
| 312 | if (!immutable) { |
| 313 | if (intent != null) { |
| 314 | int changes = finalIntent.fillIn(intent, key.flags); |
| 315 | if ((changes & Intent.FILL_IN_DATA) == 0) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 316 | resolvedType = key.requestResolvedType; |
| 317 | } |
| 318 | } else { |
| 319 | resolvedType = key.requestResolvedType; |
| 320 | } |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 321 | flagsMask &= ~Intent.IMMUTABLE_FLAGS; |
| 322 | flagsValues &= flagsMask; |
| 323 | finalIntent.setFlags((finalIntent.getFlags() & ~flagsMask) | flagsValues); |
| 324 | } else { |
| 325 | resolvedType = key.requestResolvedType; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 326 | } |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 327 | |
Winson Chung | d070775 | 2018-09-27 13:55:58 -0700 | [diff] [blame] | 328 | // Apply any launch flags from the ActivityOptions. This is to ensure that the caller |
| 329 | // can specify a consistent launch mode even if the PendingIntent is immutable |
| 330 | final ActivityOptions opts = ActivityOptions.fromBundle(options); |
| 331 | if (opts != null) { |
| 332 | finalIntent.addFlags(opts.getPendingIntentLaunchFlags()); |
| 333 | } |
| 334 | |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 335 | // Extract options before clearing calling identity |
| 336 | mergedOptions = key.options; |
| 337 | if (mergedOptions == null) { |
Winson Chung | d070775 | 2018-09-27 13:55:58 -0700 | [diff] [blame] | 338 | mergedOptions = new SafeActivityOptions(opts); |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 339 | } else { |
Winson Chung | d070775 | 2018-09-27 13:55:58 -0700 | [diff] [blame] | 340 | mergedOptions.setCallerOptions(opts); |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | if (whitelistDuration != null) { |
| 344 | duration = whitelistDuration.get(whitelistToken); |
| 345 | } |
| 346 | |
| 347 | if (key.type == ActivityManager.INTENT_SENDER_ACTIVITY |
| 348 | && key.allIntents != null && key.allIntents.length > 1) { |
| 349 | // Copy all intents and resolved types while we have the controller lock so we can |
| 350 | // use it later when the lock isn't held. |
| 351 | allIntents = new Intent[key.allIntents.length]; |
| 352 | allResolvedTypes = new String[key.allIntents.length]; |
| 353 | System.arraycopy(key.allIntents, 0, allIntents, 0, key.allIntents.length); |
| 354 | if (key.allResolvedTypes != null) { |
| 355 | System.arraycopy(key.allResolvedTypes, 0, allResolvedTypes, 0, |
| 356 | key.allResolvedTypes.length); |
| 357 | } |
| 358 | allIntents[allIntents.length - 1] = finalIntent; |
| 359 | allResolvedTypes[allResolvedTypes.length - 1] = resolvedType; |
| 360 | } |
| 361 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 362 | } |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 363 | // We don't hold the controller lock beyond this point as we will be calling into AM and WM. |
| 364 | |
| 365 | final int callingUid = Binder.getCallingUid(); |
| 366 | final int callingPid = Binder.getCallingPid(); |
| 367 | final long origId = Binder.clearCallingIdentity(); |
| 368 | |
| 369 | int res = START_SUCCESS; |
| 370 | try { |
| 371 | if (duration != null) { |
| 372 | int procState = controller.mAmInternal.getUidProcessState(callingUid); |
| 373 | if (!ActivityManager.isProcStateBackground(procState)) { |
| 374 | StringBuilder tag = new StringBuilder(64); |
| 375 | tag.append("pendingintent:"); |
| 376 | UserHandle.formatUid(tag, callingUid); |
| 377 | tag.append(":"); |
| 378 | if (finalIntent.getAction() != null) { |
| 379 | tag.append(finalIntent.getAction()); |
| 380 | } else if (finalIntent.getComponent() != null) { |
| 381 | finalIntent.getComponent().appendShortString(tag); |
| 382 | } else if (finalIntent.getData() != null) { |
| 383 | tag.append(finalIntent.getData().toSafeString()); |
| 384 | } |
| 385 | controller.mAmInternal.tempWhitelistForPendingIntent(callingPid, callingUid, |
| 386 | uid, duration, tag.toString()); |
| 387 | } else { |
| 388 | Slog.w(TAG, "Not doing whitelist " + this + ": caller state=" + procState); |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | boolean sendFinish = finishedReceiver != null; |
| 393 | int userId = key.userId; |
| 394 | if (userId == UserHandle.USER_CURRENT) { |
| 395 | userId = controller.mUserController.getCurrentOrTargetUserId(); |
| 396 | } |
Michal Karpinski | cc88d7e | 2019-01-24 15:32:12 +0000 | [diff] [blame] | 397 | // temporarily allow receivers and services to open activities from background if the |
Alan Stokes | 6ac9efd | 2019-05-09 12:50:37 +0000 | [diff] [blame] | 398 | // PendingIntent.send() caller was foreground at the time of sendInner() call |
| 399 | final boolean allowTrampoline = uid != callingUid |
Michal Karpinski | cc88d7e | 2019-01-24 15:32:12 +0000 | [diff] [blame] | 400 | && controller.mAtmInternal.isUidForeground(callingUid); |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 401 | |
Michal Karpinski | 9cbb20b | 2019-02-05 17:31:50 +0000 | [diff] [blame] | 402 | // note: we on purpose don't pass in the information about the PendingIntent's creator, |
| 403 | // like pid or ProcessRecord, to the ActivityTaskManagerInternal calls below, because |
| 404 | // it's not unusual for the creator's process to not be alive at this time |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 405 | switch (key.type) { |
| 406 | case ActivityManager.INTENT_SENDER_ACTIVITY: |
| 407 | try { |
| 408 | // Note when someone has a pending intent, even from different |
| 409 | // users, then there's no need to ensure the calling user matches |
| 410 | // the target user, so validateIncomingUser is always false below. |
| 411 | |
| 412 | if (key.allIntents != null && key.allIntents.length > 1) { |
| 413 | res = controller.mAtmInternal.startActivitiesInPackage( |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 414 | uid, callingPid, callingUid, key.packageName, key.featureId, |
| 415 | allIntents, allResolvedTypes, resultTo, mergedOptions, userId, |
Michal Karpinski | 84d9ebd | 2019-01-17 18:28:59 +0000 | [diff] [blame] | 416 | false /* validateIncomingUser */, |
Michal Karpinski | ac116df | 2018-12-10 17:51:42 +0000 | [diff] [blame] | 417 | this /* originatingPendingIntent */, |
| 418 | mAllowBgActivityStartsForActivitySender.contains(whitelistToken)); |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 419 | } else { |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 420 | res = controller.mAtmInternal.startActivityInPackage(uid, callingPid, |
| 421 | callingUid, key.packageName, key.featureId, finalIntent, |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 422 | resolvedType, resultTo, resultWho, requestCode, 0, |
| 423 | mergedOptions, userId, null, "PendingIntentRecord", |
| 424 | false /* validateIncomingUser */, |
Michal Karpinski | ac116df | 2018-12-10 17:51:42 +0000 | [diff] [blame] | 425 | this /* originatingPendingIntent */, |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 426 | mAllowBgActivityStartsForActivitySender.contains( |
| 427 | whitelistToken)); |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 428 | } |
| 429 | } catch (RuntimeException e) { |
| 430 | Slog.w(TAG, "Unable to send startActivity intent", e); |
| 431 | } |
| 432 | break; |
| 433 | case ActivityManager.INTENT_SENDER_ACTIVITY_RESULT: |
| 434 | controller.mAtmInternal.sendActivityResult(-1, key.activity, key.who, |
| 435 | key.requestCode, code, finalIntent); |
| 436 | break; |
| 437 | case ActivityManager.INTENT_SENDER_BROADCAST: |
| 438 | try { |
| 439 | // If a completion callback has been requested, require |
| 440 | // that the broadcast be delivered synchronously |
| 441 | int sent = controller.mAmInternal.broadcastIntentInPackage(key.packageName, |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 442 | key.featureId, uid, callingUid, callingPid, finalIntent, |
| 443 | resolvedType, finishedReceiver, code, null, null, |
| 444 | requiredPermission, options, (finishedReceiver != null), false, |
| 445 | userId, |
Michal Karpinski | cc88d7e | 2019-01-24 15:32:12 +0000 | [diff] [blame] | 446 | mAllowBgActivityStartsForBroadcastSender.contains(whitelistToken) |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 447 | || allowTrampoline); |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 448 | if (sent == ActivityManager.BROADCAST_SUCCESS) { |
| 449 | sendFinish = false; |
| 450 | } |
| 451 | } catch (RuntimeException e) { |
| 452 | Slog.w(TAG, "Unable to send startActivity intent", e); |
| 453 | } |
| 454 | break; |
| 455 | case ActivityManager.INTENT_SENDER_SERVICE: |
| 456 | case ActivityManager.INTENT_SENDER_FOREGROUND_SERVICE: |
| 457 | try { |
| 458 | controller.mAmInternal.startServiceInPackage(uid, finalIntent, resolvedType, |
| 459 | key.type == ActivityManager.INTENT_SENDER_FOREGROUND_SERVICE, |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 460 | key.packageName, key.featureId, userId, |
Michal Karpinski | cc88d7e | 2019-01-24 15:32:12 +0000 | [diff] [blame] | 461 | mAllowBgActivityStartsForServiceSender.contains(whitelistToken) |
| 462 | || allowTrampoline); |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 463 | } catch (RuntimeException e) { |
| 464 | Slog.w(TAG, "Unable to send startService intent", e); |
| 465 | } catch (TransactionTooLargeException e) { |
| 466 | res = ActivityManager.START_CANCELED; |
| 467 | } |
| 468 | break; |
| 469 | } |
| 470 | |
| 471 | if (sendFinish && res != ActivityManager.START_CANCELED) { |
| 472 | try { |
| 473 | finishedReceiver.performReceive(new Intent(finalIntent), 0, |
| 474 | null, null, false, false, key.userId); |
| 475 | } catch (RemoteException e) { |
| 476 | } |
| 477 | } |
| 478 | } finally { |
| 479 | Binder.restoreCallingIdentity(origId); |
| 480 | } |
| 481 | |
| 482 | return res; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 483 | } |
Craig Mautner | df88d73 | 2014-01-27 09:21:32 -0800 | [diff] [blame] | 484 | |
| 485 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 486 | protected void finalize() throws Throwable { |
Dianne Hackborn | 9e0f5d9 | 2010-02-22 15:05:42 -0800 | [diff] [blame] | 487 | try { |
| 488 | if (!canceled) { |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 489 | controller.mH.sendMessage(PooledLambda.obtainMessage( |
| 490 | PendingIntentRecord::completeFinalize, this)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 491 | } |
Dianne Hackborn | 9e0f5d9 | 2010-02-22 15:05:42 -0800 | [diff] [blame] | 492 | } finally { |
| 493 | super.finalize(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 494 | } |
| 495 | } |
| 496 | |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 497 | private void completeFinalize() { |
| 498 | synchronized(controller.mLock) { |
| 499 | WeakReference<PendingIntentRecord> current = controller.mIntentSenderRecords.get(key); |
Dianne Hackborn | 9e0f5d9 | 2010-02-22 15:05:42 -0800 | [diff] [blame] | 500 | if (current == ref) { |
Wale Ogunwale | ee6eca1 | 2018-09-19 20:37:53 -0700 | [diff] [blame] | 501 | controller.mIntentSenderRecords.remove(key); |
Dianne Hackborn | 9e0f5d9 | 2010-02-22 15:05:42 -0800 | [diff] [blame] | 502 | } |
| 503 | } |
| 504 | } |
Felipe Leme | a1b79bf | 2016-05-24 13:06:54 -0700 | [diff] [blame] | 505 | |
Wale Ogunwale | 5950709 | 2018-10-29 09:00:30 -0700 | [diff] [blame] | 506 | public void dump(PrintWriter pw, String prefix) { |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 507 | pw.print(prefix); pw.print("uid="); pw.print(uid); |
| 508 | pw.print(" packageName="); pw.print(key.packageName); |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 509 | pw.print(" featureId="); pw.print(key.featureId); |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 510 | pw.print(" type="); pw.print(key.typeName()); |
| 511 | pw.print(" flags=0x"); pw.println(Integer.toHexString(key.flags)); |
| 512 | if (key.activity != null || key.who != null) { |
| 513 | pw.print(prefix); pw.print("activity="); pw.print(key.activity); |
| 514 | pw.print(" who="); pw.println(key.who); |
| 515 | } |
| 516 | if (key.requestCode != 0 || key.requestResolvedType != null) { |
| 517 | pw.print(prefix); pw.print("requestCode="); pw.print(key.requestCode); |
| 518 | pw.print(" requestResolvedType="); pw.println(key.requestResolvedType); |
| 519 | } |
Dianne Hackborn | c3b91fd | 2010-02-23 17:25:30 -0800 | [diff] [blame] | 520 | if (key.requestIntent != null) { |
| 521 | pw.print(prefix); pw.print("requestIntent="); |
Hui Yu | 6d5c3b9 | 2019-10-22 15:35:53 -0700 | [diff] [blame] | 522 | pw.println(key.requestIntent.toShortString(false, true, true, false)); |
Dianne Hackborn | c3b91fd | 2010-02-23 17:25:30 -0800 | [diff] [blame] | 523 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 524 | if (sent || canceled) { |
| 525 | pw.print(prefix); pw.print("sent="); pw.print(sent); |
| 526 | pw.print(" canceled="); pw.println(canceled); |
| 527 | } |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 528 | if (whitelistDuration != null) { |
Dianne Hackborn | bc02a39 | 2016-06-02 17:15:08 -0700 | [diff] [blame] | 529 | pw.print(prefix); |
| 530 | pw.print("whitelistDuration="); |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 531 | for (int i = 0; i < whitelistDuration.size(); i++) { |
| 532 | if (i != 0) { |
| 533 | pw.print(", "); |
| 534 | } |
| 535 | pw.print(Integer.toHexString(System.identityHashCode(whitelistDuration.keyAt(i)))); |
| 536 | pw.print(":"); |
| 537 | TimeUtils.formatDuration(whitelistDuration.valueAt(i), pw); |
| 538 | } |
Dianne Hackborn | bc02a39 | 2016-06-02 17:15:08 -0700 | [diff] [blame] | 539 | pw.println(); |
| 540 | } |
Dianne Hackborn | f66adfd | 2017-04-13 11:01:48 -0700 | [diff] [blame] | 541 | if (mCancelCallbacks != null) { |
| 542 | pw.print(prefix); pw.println("mCancelCallbacks:"); |
| 543 | for (int i = 0; i < mCancelCallbacks.getRegisteredCallbackCount(); i++) { |
| 544 | pw.print(prefix); pw.print(" #"); pw.print(i); pw.print(": "); |
| 545 | pw.println(mCancelCallbacks.getRegisteredCallbackItem(i)); |
| 546 | } |
| 547 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 548 | } |
| 549 | |
| 550 | public String toString() { |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 551 | if (stringName != null) { |
| 552 | return stringName; |
| 553 | } |
| 554 | StringBuilder sb = new StringBuilder(128); |
| 555 | sb.append("PendingIntentRecord{"); |
| 556 | sb.append(Integer.toHexString(System.identityHashCode(this))); |
| 557 | sb.append(' '); |
| 558 | sb.append(key.packageName); |
Philip P. Moltmann | ee29509 | 2020-02-10 08:46:26 -0800 | [diff] [blame] | 559 | if (key.featureId != null) { |
| 560 | sb.append('/'); |
| 561 | sb.append(key.featureId); |
| 562 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 563 | sb.append(' '); |
| 564 | sb.append(key.typeName()); |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 565 | if (whitelistDuration != null) { |
Dianne Hackborn | bc02a39 | 2016-06-02 17:15:08 -0700 | [diff] [blame] | 566 | sb.append( " (whitelist: "); |
Dianne Hackborn | 9830552 | 2017-05-05 17:53:53 -0700 | [diff] [blame] | 567 | for (int i = 0; i < whitelistDuration.size(); i++) { |
| 568 | if (i != 0) { |
| 569 | sb.append(","); |
| 570 | } |
| 571 | sb.append(Integer.toHexString(System.identityHashCode(whitelistDuration.keyAt(i)))); |
| 572 | sb.append(":"); |
| 573 | TimeUtils.formatDuration(whitelistDuration.valueAt(i), sb); |
| 574 | } |
Dianne Hackborn | bc02a39 | 2016-06-02 17:15:08 -0700 | [diff] [blame] | 575 | sb.append(")"); |
Felipe Leme | a1b79bf | 2016-05-24 13:06:54 -0700 | [diff] [blame] | 576 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 577 | sb.append('}'); |
| 578 | return stringName = sb.toString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 579 | } |
| 580 | } |