Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | package com.android.server.pm; |
| 17 | |
| 18 | import android.annotation.NonNull; |
| 19 | import android.annotation.UserIdInt; |
Makoto Onuki | c8c3329 | 2016-09-12 16:36:59 -0700 | [diff] [blame^] | 20 | import android.content.pm.PackageInfo; |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 21 | import android.content.pm.ShortcutInfo; |
| 22 | import android.util.ArrayMap; |
| 23 | import android.util.ArraySet; |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 24 | import android.util.Slog; |
| 25 | |
| 26 | import com.android.internal.annotations.VisibleForTesting; |
| 27 | import com.android.server.pm.ShortcutUser.PackageWithUser; |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 28 | |
Makoto Onuki | 7626992 | 2016-07-15 14:58:54 -0700 | [diff] [blame] | 29 | import org.json.JSONException; |
| 30 | import org.json.JSONObject; |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 31 | import org.xmlpull.v1.XmlPullParser; |
| 32 | import org.xmlpull.v1.XmlPullParserException; |
| 33 | import org.xmlpull.v1.XmlSerializer; |
| 34 | |
| 35 | import java.io.IOException; |
| 36 | import java.io.PrintWriter; |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 37 | import java.util.ArrayList; |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 38 | import java.util.List; |
| 39 | |
| 40 | /** |
| 41 | * Launcher information used by {@link ShortcutService}. |
Makoto Onuki | 22fcc68 | 2016-05-17 14:52:19 -0700 | [diff] [blame] | 42 | * |
| 43 | * All methods should be guarded by {@code #mShortcutUser.mService.mLock}. |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 44 | */ |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 45 | class ShortcutLauncher extends ShortcutPackageItem { |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 46 | private static final String TAG = ShortcutService.TAG; |
| 47 | |
| 48 | static final String TAG_ROOT = "launcher-pins"; |
| 49 | |
| 50 | private static final String TAG_PACKAGE = "package"; |
| 51 | private static final String TAG_PIN = "pin"; |
| 52 | |
Makoto Onuki | d99c6f0 | 2016-03-28 11:02:54 -0700 | [diff] [blame] | 53 | private static final String ATTR_LAUNCHER_USER_ID = "launcher-user"; |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 54 | private static final String ATTR_VALUE = "value"; |
| 55 | private static final String ATTR_PACKAGE_NAME = "package-name"; |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 56 | private static final String ATTR_PACKAGE_USER_ID = "package-user"; |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 57 | |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 58 | private final int mOwnerUserId; |
Makoto Onuki | d99c6f0 | 2016-03-28 11:02:54 -0700 | [diff] [blame] | 59 | |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Package name -> IDs. |
| 62 | */ |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 63 | final private ArrayMap<PackageWithUser, ArraySet<String>> mPinnedShortcuts = new ArrayMap<>(); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 64 | |
Makoto Onuki | 4d36b3a | 2016-04-27 12:00:17 -0700 | [diff] [blame] | 65 | private ShortcutLauncher(@NonNull ShortcutUser shortcutUser, |
| 66 | @UserIdInt int ownerUserId, @NonNull String packageName, |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 67 | @UserIdInt int launcherUserId, ShortcutPackageInfo spi) { |
Makoto Onuki | 4d36b3a | 2016-04-27 12:00:17 -0700 | [diff] [blame] | 68 | super(shortcutUser, launcherUserId, packageName, |
| 69 | spi != null ? spi : ShortcutPackageInfo.newEmpty()); |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 70 | mOwnerUserId = ownerUserId; |
| 71 | } |
| 72 | |
Makoto Onuki | 4d36b3a | 2016-04-27 12:00:17 -0700 | [diff] [blame] | 73 | public ShortcutLauncher(@NonNull ShortcutUser shortcutUser, |
| 74 | @UserIdInt int ownerUserId, @NonNull String packageName, |
Makoto Onuki | d99c6f0 | 2016-03-28 11:02:54 -0700 | [diff] [blame] | 75 | @UserIdInt int launcherUserId) { |
Makoto Onuki | 4d36b3a | 2016-04-27 12:00:17 -0700 | [diff] [blame] | 76 | this(shortcutUser, ownerUserId, packageName, launcherUserId, null); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 79 | @Override |
| 80 | public int getOwnerUserId() { |
| 81 | return mOwnerUserId; |
Makoto Onuki | 0acbb14 | 2016-03-22 17:02:57 -0700 | [diff] [blame] | 82 | } |
| 83 | |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 84 | /** |
| 85 | * Called when the new package can't receive the backup, due to signature or version mismatch. |
| 86 | */ |
| 87 | @Override |
Makoto Onuki | c51b287 | 2016-05-04 15:24:50 -0700 | [diff] [blame] | 88 | protected void onRestoreBlocked() { |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 89 | final ArrayList<PackageWithUser> pinnedPackages = |
| 90 | new ArrayList<>(mPinnedShortcuts.keySet()); |
| 91 | mPinnedShortcuts.clear(); |
| 92 | for (int i = pinnedPackages.size() - 1; i >= 0; i--) { |
| 93 | final PackageWithUser pu = pinnedPackages.get(i); |
Makoto Onuki | c51b287 | 2016-05-04 15:24:50 -0700 | [diff] [blame] | 94 | final ShortcutPackage p = mShortcutUser.getPackageShortcutsIfExists(pu.packageName); |
| 95 | if (p != null) { |
| 96 | p.refreshPinnedFlags(); |
| 97 | } |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 98 | } |
| 99 | } |
| 100 | |
| 101 | @Override |
Makoto Onuki | c51b287 | 2016-05-04 15:24:50 -0700 | [diff] [blame] | 102 | protected void onRestored() { |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 103 | // Nothing to do. |
| 104 | } |
| 105 | |
Makoto Onuki | c51b287 | 2016-05-04 15:24:50 -0700 | [diff] [blame] | 106 | public void pinShortcuts(@UserIdInt int packageUserId, |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 107 | @NonNull String packageName, @NonNull List<String> ids) { |
| 108 | final ShortcutPackage packageShortcuts = |
Makoto Onuki | c51b287 | 2016-05-04 15:24:50 -0700 | [diff] [blame] | 109 | mShortcutUser.getPackageShortcutsIfExists(packageName); |
| 110 | if (packageShortcuts == null) { |
| 111 | return; // No need to instantiate. |
| 112 | } |
Makoto Onuki | d99c6f0 | 2016-03-28 11:02:54 -0700 | [diff] [blame] | 113 | |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 114 | final PackageWithUser pu = PackageWithUser.of(packageUserId, packageName); |
| 115 | |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 116 | final int idSize = ids.size(); |
| 117 | if (idSize == 0) { |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 118 | mPinnedShortcuts.remove(pu); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 119 | } else { |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 120 | final ArraySet<String> prevSet = mPinnedShortcuts.get(pu); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 121 | |
| 122 | // Pin shortcuts. Make sure only pin the ones that were visible to the caller. |
| 123 | // i.e. a non-dynamic, pinned shortcut by *other launchers* shouldn't be pinned here. |
| 124 | |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 125 | final ArraySet<String> newSet = new ArraySet<>(); |
| 126 | |
| 127 | for (int i = 0; i < idSize; i++) { |
| 128 | final String id = ids.get(i); |
| 129 | final ShortcutInfo si = packageShortcuts.findShortcutById(id); |
| 130 | if (si == null) { |
| 131 | continue; |
| 132 | } |
Makoto Onuki | 22fcc68 | 2016-05-17 14:52:19 -0700 | [diff] [blame] | 133 | if (si.isDynamic() || si.isManifestShortcut() |
| 134 | || (prevSet != null && prevSet.contains(id))) { |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 135 | newSet.add(id); |
| 136 | } |
| 137 | } |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 138 | mPinnedShortcuts.put(pu, newSet); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 139 | } |
Makoto Onuki | c51b287 | 2016-05-04 15:24:50 -0700 | [diff] [blame] | 140 | packageShortcuts.refreshPinnedFlags(); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Return the pinned shortcut IDs for the publisher package. |
| 145 | */ |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 146 | public ArraySet<String> getPinnedShortcutIds(@NonNull String packageName, |
| 147 | @UserIdInt int packageUserId) { |
| 148 | return mPinnedShortcuts.get(PackageWithUser.of(packageUserId, packageName)); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 149 | } |
| 150 | |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 151 | boolean cleanUpPackage(String packageName, @UserIdInt int packageUserId) { |
| 152 | return mPinnedShortcuts.remove(PackageWithUser.of(packageUserId, packageName)) != null; |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 153 | } |
| 154 | |
Makoto Onuki | c8c3329 | 2016-09-12 16:36:59 -0700 | [diff] [blame^] | 155 | public void ensureVersionInfo() { |
| 156 | final PackageInfo pi = mShortcutUser.mService.getPackageInfoWithSignatures( |
| 157 | getPackageName(), getPackageUserId()); |
| 158 | if (pi == null) { |
| 159 | Slog.w(TAG, "Package not found: " + getPackageName()); |
| 160 | return; |
| 161 | } |
| 162 | getPackageInfo().updateVersionInfo(pi); |
| 163 | } |
| 164 | |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 165 | /** |
| 166 | * Persist. |
| 167 | */ |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 168 | @Override |
| 169 | public void saveToXml(XmlSerializer out, boolean forBackup) |
| 170 | throws IOException { |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 171 | final int size = mPinnedShortcuts.size(); |
| 172 | if (size == 0) { |
| 173 | return; // Nothing to write. |
| 174 | } |
| 175 | |
| 176 | out.startTag(null, TAG_ROOT); |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 177 | ShortcutService.writeAttr(out, ATTR_PACKAGE_NAME, getPackageName()); |
| 178 | ShortcutService.writeAttr(out, ATTR_LAUNCHER_USER_ID, getPackageUserId()); |
| 179 | getPackageInfo().saveToXml(out); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 180 | |
| 181 | for (int i = 0; i < size; i++) { |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 182 | final PackageWithUser pu = mPinnedShortcuts.keyAt(i); |
| 183 | |
| 184 | if (forBackup && (pu.userId != getOwnerUserId())) { |
| 185 | continue; // Target package on a different user, skip. (i.e. work profile) |
| 186 | } |
| 187 | |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 188 | out.startTag(null, TAG_PACKAGE); |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 189 | ShortcutService.writeAttr(out, ATTR_PACKAGE_NAME, pu.packageName); |
| 190 | ShortcutService.writeAttr(out, ATTR_PACKAGE_USER_ID, pu.userId); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 191 | |
| 192 | final ArraySet<String> ids = mPinnedShortcuts.valueAt(i); |
| 193 | final int idSize = ids.size(); |
| 194 | for (int j = 0; j < idSize; j++) { |
| 195 | ShortcutService.writeTagValue(out, TAG_PIN, ids.valueAt(j)); |
| 196 | } |
| 197 | out.endTag(null, TAG_PACKAGE); |
| 198 | } |
| 199 | |
| 200 | out.endTag(null, TAG_ROOT); |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Load. |
| 205 | */ |
Makoto Onuki | 4d36b3a | 2016-04-27 12:00:17 -0700 | [diff] [blame] | 206 | public static ShortcutLauncher loadFromXml(XmlPullParser parser, ShortcutUser shortcutUser, |
| 207 | int ownerUserId, boolean fromBackup) throws IOException, XmlPullParserException { |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 208 | final String launcherPackageName = ShortcutService.parseStringAttribute(parser, |
| 209 | ATTR_PACKAGE_NAME); |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 210 | |
| 211 | // If restoring, just use the real user ID. |
| 212 | final int launcherUserId = |
| 213 | fromBackup ? ownerUserId |
| 214 | : ShortcutService.parseIntAttribute(parser, ATTR_LAUNCHER_USER_ID, ownerUserId); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 215 | |
Makoto Onuki | c8c3329 | 2016-09-12 16:36:59 -0700 | [diff] [blame^] | 216 | final ShortcutLauncher ret = new ShortcutLauncher(shortcutUser, ownerUserId, |
Makoto Onuki | 4d36b3a | 2016-04-27 12:00:17 -0700 | [diff] [blame] | 217 | launcherPackageName, launcherUserId); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 218 | |
| 219 | ArraySet<String> ids = null; |
| 220 | final int outerDepth = parser.getDepth(); |
| 221 | int type; |
| 222 | while ((type = parser.next()) != XmlPullParser.END_DOCUMENT |
| 223 | && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) { |
| 224 | if (type != XmlPullParser.START_TAG) { |
| 225 | continue; |
| 226 | } |
| 227 | final int depth = parser.getDepth(); |
| 228 | final String tag = parser.getName(); |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 229 | if (depth == outerDepth + 1) { |
| 230 | switch (tag) { |
| 231 | case ShortcutPackageInfo.TAG_ROOT: |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 232 | ret.getPackageInfo().loadFromXml(parser, fromBackup); |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 233 | continue; |
| 234 | case TAG_PACKAGE: { |
| 235 | final String packageName = ShortcutService.parseStringAttribute(parser, |
| 236 | ATTR_PACKAGE_NAME); |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 237 | final int packageUserId = fromBackup ? ownerUserId |
| 238 | : ShortcutService.parseIntAttribute(parser, |
| 239 | ATTR_PACKAGE_USER_ID, ownerUserId); |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 240 | ids = new ArraySet<>(); |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 241 | ret.mPinnedShortcuts.put( |
| 242 | PackageWithUser.of(packageUserId, packageName), ids); |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 243 | continue; |
| 244 | } |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 245 | } |
| 246 | } |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 247 | if (depth == outerDepth + 2) { |
| 248 | switch (tag) { |
| 249 | case TAG_PIN: { |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 250 | if (ids == null) { |
| 251 | Slog.w(TAG, TAG_PIN + " in invalid place"); |
| 252 | } else { |
| 253 | ids.add(ShortcutService.parseStringAttribute(parser, ATTR_VALUE)); |
| 254 | } |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 255 | continue; |
| 256 | } |
| 257 | } |
| 258 | } |
| 259 | ShortcutService.warnForInvalidTag(depth, tag); |
| 260 | } |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 261 | return ret; |
| 262 | } |
| 263 | |
Makoto Onuki | c51b287 | 2016-05-04 15:24:50 -0700 | [diff] [blame] | 264 | public void dump(@NonNull PrintWriter pw, @NonNull String prefix) { |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 265 | pw.println(); |
| 266 | |
| 267 | pw.print(prefix); |
| 268 | pw.print("Launcher: "); |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 269 | pw.print(getPackageName()); |
| 270 | pw.print(" Package user: "); |
| 271 | pw.print(getPackageUserId()); |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 272 | pw.print(" Owner user: "); |
| 273 | pw.print(getOwnerUserId()); |
Makoto Onuki | 9da23fc | 2016-03-29 11:14:42 -0700 | [diff] [blame] | 274 | pw.println(); |
| 275 | |
Makoto Onuki | c51b287 | 2016-05-04 15:24:50 -0700 | [diff] [blame] | 276 | getPackageInfo().dump(pw, prefix + " "); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 277 | pw.println(); |
| 278 | |
| 279 | final int size = mPinnedShortcuts.size(); |
| 280 | for (int i = 0; i < size; i++) { |
| 281 | pw.println(); |
| 282 | |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 283 | final PackageWithUser pu = mPinnedShortcuts.keyAt(i); |
| 284 | |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 285 | pw.print(prefix); |
| 286 | pw.print(" "); |
| 287 | pw.print("Package: "); |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 288 | pw.print(pu.packageName); |
| 289 | pw.print(" User: "); |
| 290 | pw.println(pu.userId); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 291 | |
| 292 | final ArraySet<String> ids = mPinnedShortcuts.valueAt(i); |
| 293 | final int idSize = ids.size(); |
| 294 | |
| 295 | for (int j = 0; j < idSize; j++) { |
| 296 | pw.print(prefix); |
Makoto Onuki | 0acbb14 | 2016-03-22 17:02:57 -0700 | [diff] [blame] | 297 | pw.print(" Pinned: "); |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 298 | pw.print(ids.valueAt(j)); |
| 299 | pw.println(); |
| 300 | } |
| 301 | } |
| 302 | } |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 303 | |
Makoto Onuki | 7626992 | 2016-07-15 14:58:54 -0700 | [diff] [blame] | 304 | @Override |
| 305 | public JSONObject dumpCheckin(boolean clear) throws JSONException { |
| 306 | final JSONObject result = super.dumpCheckin(clear); |
| 307 | |
| 308 | // Nothing really interesting to dump. |
| 309 | |
| 310 | return result; |
| 311 | } |
| 312 | |
Makoto Onuki | 2e210c4 | 2016-03-30 08:30:36 -0700 | [diff] [blame] | 313 | @VisibleForTesting |
| 314 | ArraySet<String> getAllPinnedShortcutsForTest(String packageName, int packageUserId) { |
| 315 | return new ArraySet<>(mPinnedShortcuts.get(PackageWithUser.of(packageUserId, packageName))); |
| 316 | } |
Makoto Onuki | 3145924 | 2016-03-22 11:12:18 -0700 | [diff] [blame] | 317 | } |