diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-12-17 23:22:42 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-12-18 11:00:14 -0800 |
commit | b740f59c7d572d54402e3a74fb2a23c0f1b1af48 (patch) | |
tree | 0c816a3a9749baf305948f1adea44895a0f204e3 /src/com/android/launcher3/InstallShortcutReceiver.java | |
parent | d896ee43cd9195a2a2742324733b036ee72875bb (diff) | |
download | android_packages_apps_Trebuchet-b740f59c7d572d54402e3a74fb2a23c0f1b1af48.tar.gz android_packages_apps_Trebuchet-b740f59c7d572d54402e3a74fb2a23c0f1b1af48.tar.bz2 android_packages_apps_Trebuchet-b740f59c7d572d54402e3a74fb2a23c0f1b1af48.zip |
Fixing some invalid checks and cleaning some redundant conditions
Change-Id: I770ce2cc2eccbee105958634e81bbc9bc2e4cc48
Diffstat (limited to 'src/com/android/launcher3/InstallShortcutReceiver.java')
-rw-r--r-- | src/com/android/launcher3/InstallShortcutReceiver.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java index 7f15160bf..175bad1fd 100644 --- a/src/com/android/launcher3/InstallShortcutReceiver.java +++ b/src/com/android/launcher3/InstallShortcutReceiver.java @@ -211,14 +211,14 @@ public class InstallShortcutReceiver extends BroadcastReceiver { ArrayList<ItemInfo> addShortcuts = new ArrayList<ItemInfo>(); while (iter.hasNext()) { final PendingInstallShortcutInfo pendingInfo = iter.next(); - final Intent intent = pendingInfo.launchIntent; // If the intent specifies a package, make sure the package exists String packageName = pendingInfo.getTargetPackage(); if (!TextUtils.isEmpty(packageName)) { UserHandleCompat myUserHandle = UserHandleCompat.myUserHandle(); if (!LauncherModel.isValidPackage(context, packageName, myUserHandle)) { - if (DBG) Log.d(TAG, "Ignoring shortcut for absent package:" + intent); + if (DBG) Log.d(TAG, "Ignoring shortcut for absent package: " + + pendingInfo.launchIntent); continue; } } @@ -363,7 +363,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { return packageName; } - public boolean isLuncherActivity() { + public boolean isLauncherActivity() { return activityInfo != null; } } @@ -406,9 +406,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { } return new PendingInstallShortcutInfo(data, context); - } catch (JSONException e) { - Log.d(TAG, "Exception reading shortcut to add: " + e); - } catch (URISyntaxException e) { + } catch (JSONException | URISyntaxException e) { Log.d(TAG, "Exception reading shortcut to add: " + e); } return null; @@ -421,7 +419,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { */ private static PendingInstallShortcutInfo convertToLauncherActivityIfPossible( PendingInstallShortcutInfo original) { - if (original.isLuncherActivity()) { + if (original.isLauncherActivity()) { // Already an activity target return original; } |