diff options
author | Tony Wickham <twickham@google.com> | 2016-07-01 15:44:13 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2016-07-13 12:02:33 -0700 |
commit | d82a39da1c61b19d2749725f9c70c3baf2dab6bf (patch) | |
tree | 5b3d3a7e97e03617af0c5a1fb773f0050817a180 /src/com/android/launcher3/LauncherModel.java | |
parent | f420438a0b04205d18270923a01a5bd3bc464da8 (diff) | |
download | android_packages_apps_Trebuchet-d82a39da1c61b19d2749725f9c70c3baf2dab6bf.tar.gz android_packages_apps_Trebuchet-d82a39da1c61b19d2749725f9c70c3baf2dab6bf.tar.bz2 android_packages_apps_Trebuchet-d82a39da1c61b19d2749725f9c70c3baf2dab6bf.zip |
Add status to DeepShortcutManager api calls.
This way we can handle SecurityExceptions differently. For instance,
if a SecurityException causes us to fail to get details for pinned
shortcuts, we keep the pinned shortcuts in the database so that they
will be loaded next time launcher has the correct permissions.
Change-Id: I1102fce612ade10ad7f577b44a99c8cf087d5ccd
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 39e28c0b0..a75edb715 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -71,10 +71,10 @@ import com.android.launcher3.util.FlagOp; import com.android.launcher3.util.GridOccupancy; import com.android.launcher3.util.LongArrayMap; import com.android.launcher3.util.ManagedProfileHeuristic; +import com.android.launcher3.util.MultiHashMap; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.StringFilter; -import com.android.launcher3.util.MultiHashMap; import com.android.launcher3.util.Thunk; import com.android.launcher3.util.ViewOnDrawExecutor; @@ -1942,7 +1942,16 @@ public class LauncherModel extends BroadcastReceiver List<ShortcutInfoCompat> fullDetails = mDeepShortcutManager .queryForFullDetails(packageName, Collections.singletonList(shortcutId), user); - if (fullDetails != null && !fullDetails.isEmpty()) { + if (fullDetails == null || fullDetails.isEmpty()) { + // There are no details for the shortcut. If this is due + // to a SecurityException, keep it in the database so + // we can restore the icon when the launcher regains + // permission. Otherwise remove the icon from the db. + if (!mDeepShortcutManager.wasLastCallSuccess()) { + itemsToRemove.add(id); + continue; + } + } else { pinnedShortcut = fullDetails.get(0); shouldPin = true; } |