Loading src/com/android/launcher3/model/data/SearchActionItemInfo.java +7 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.UserHandle; import androidx.annotation.Nullable; import com.android.launcher3.Utilities; import com.android.launcher3.logger.LauncherAtom.ItemInfo; import com.android.launcher3.logger.LauncherAtom.SearchActionItem; Loading @@ -34,6 +35,7 @@ import com.android.launcher3.logger.LauncherAtom.SearchActionItem; public class SearchActionItemInfo extends ItemInfoWithIcon { public static final int FLAG_SHOULD_START = 1 << 1; @Deprecated public static final int FLAG_SHOULD_START_FOR_RESULT = FLAG_SHOULD_START | 1 << 2; public static final int FLAG_BADGE_WITH_PACKAGE = 1 << 3; public static final int FLAG_PRIMARY_ICON_FROM_TITLE = 1 << 4; Loading Loading @@ -89,10 +91,13 @@ public class SearchActionItemInfo extends ItemInfoWithIcon { * Setter for mIntent with assertion for null value mPendingIntent */ public void setIntent(Intent intent) { if (mPendingIntent != null && intent != null) { if (mPendingIntent != null && intent != null && Utilities.IS_DEBUG_DEVICE) { throw new RuntimeException( "SearchActionItemInfo can only have either an Intent or a PendingIntent"); } if (intent != null) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } mIntent = intent; } Loading @@ -104,7 +109,7 @@ public class SearchActionItemInfo extends ItemInfoWithIcon { * Setter of mPendingIntent with assertion for null value mIntent */ public void setPendingIntent(PendingIntent pendingIntent) { if (mIntent != null && pendingIntent != null) { if (mIntent != null && pendingIntent != null && Utilities.IS_DEBUG_DEVICE) { throw new RuntimeException( "SearchActionItemInfo can only have either an Intent or a PendingIntent"); } Loading src/com/android/launcher3/touch/ItemClickHandler.java +1 −8 Original line number Diff line number Diff line Loading @@ -262,19 +262,12 @@ public class ItemClickHandler { */ public static void onClickSearchAction(Launcher launcher, SearchActionItemInfo itemInfo) { if (itemInfo.getIntent() != null) { if (itemInfo.hasFlags(SearchActionItemInfo.FLAG_SHOULD_START_FOR_RESULT)) { launcher.startActivityForResult(itemInfo.getIntent(), 0); } else { launcher.startActivity(itemInfo.getIntent()); } } else if (itemInfo.getPendingIntent() != null) { try { PendingIntent pendingIntent = itemInfo.getPendingIntent(); if (!itemInfo.hasFlags(SearchActionItemInfo.FLAG_SHOULD_START)) { pendingIntent.send(); } else if (itemInfo.hasFlags(SearchActionItemInfo.FLAG_SHOULD_START_FOR_RESULT)) { launcher.startIntentSenderForResult(pendingIntent.getIntentSender(), 0, null, 0, 0, 0); } else { launcher.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0); } Loading Loading
src/com/android/launcher3/model/data/SearchActionItemInfo.java +7 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.UserHandle; import androidx.annotation.Nullable; import com.android.launcher3.Utilities; import com.android.launcher3.logger.LauncherAtom.ItemInfo; import com.android.launcher3.logger.LauncherAtom.SearchActionItem; Loading @@ -34,6 +35,7 @@ import com.android.launcher3.logger.LauncherAtom.SearchActionItem; public class SearchActionItemInfo extends ItemInfoWithIcon { public static final int FLAG_SHOULD_START = 1 << 1; @Deprecated public static final int FLAG_SHOULD_START_FOR_RESULT = FLAG_SHOULD_START | 1 << 2; public static final int FLAG_BADGE_WITH_PACKAGE = 1 << 3; public static final int FLAG_PRIMARY_ICON_FROM_TITLE = 1 << 4; Loading Loading @@ -89,10 +91,13 @@ public class SearchActionItemInfo extends ItemInfoWithIcon { * Setter for mIntent with assertion for null value mPendingIntent */ public void setIntent(Intent intent) { if (mPendingIntent != null && intent != null) { if (mPendingIntent != null && intent != null && Utilities.IS_DEBUG_DEVICE) { throw new RuntimeException( "SearchActionItemInfo can only have either an Intent or a PendingIntent"); } if (intent != null) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } mIntent = intent; } Loading @@ -104,7 +109,7 @@ public class SearchActionItemInfo extends ItemInfoWithIcon { * Setter of mPendingIntent with assertion for null value mIntent */ public void setPendingIntent(PendingIntent pendingIntent) { if (mIntent != null && pendingIntent != null) { if (mIntent != null && pendingIntent != null && Utilities.IS_DEBUG_DEVICE) { throw new RuntimeException( "SearchActionItemInfo can only have either an Intent or a PendingIntent"); } Loading
src/com/android/launcher3/touch/ItemClickHandler.java +1 −8 Original line number Diff line number Diff line Loading @@ -262,19 +262,12 @@ public class ItemClickHandler { */ public static void onClickSearchAction(Launcher launcher, SearchActionItemInfo itemInfo) { if (itemInfo.getIntent() != null) { if (itemInfo.hasFlags(SearchActionItemInfo.FLAG_SHOULD_START_FOR_RESULT)) { launcher.startActivityForResult(itemInfo.getIntent(), 0); } else { launcher.startActivity(itemInfo.getIntent()); } } else if (itemInfo.getPendingIntent() != null) { try { PendingIntent pendingIntent = itemInfo.getPendingIntent(); if (!itemInfo.hasFlags(SearchActionItemInfo.FLAG_SHOULD_START)) { pendingIntent.send(); } else if (itemInfo.hasFlags(SearchActionItemInfo.FLAG_SHOULD_START_FOR_RESULT)) { launcher.startIntentSenderForResult(pendingIntent.getIntentSender(), 0, null, 0, 0, 0); } else { launcher.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0); } Loading