Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add honor launcher package name. #361

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,18 @@ private static boolean isLauncherVersionSupported(Context context, String curren
* @param resolveInfos list of all Home activities in the system
*/
private static void validateInfoList(ResolveInfo defaultActivity, List<ResolveInfo> resolveInfos) {
if (resolveInfos == null || resolveInfos.isEmpty()) {
return;
}
if (!hasPackageName(defaultActivity)) {
return;
}
int indexToSwapWith = 0;
for (int i = 0, resolveInfosSize = resolveInfos.size(); i < resolveInfosSize; i++) {
ResolveInfo resolveInfo = resolveInfos.get(i);
if (!hasPackageName(resolveInfo)) {
continue;
}
String currentActivityName = resolveInfo.activityInfo.packageName;
if (currentActivityName.equals(defaultActivity.activityInfo.packageName)) {
indexToSwapWith = i;
Expand All @@ -273,6 +282,13 @@ private static void validateInfoList(ResolveInfo defaultActivity, List<ResolveIn
Collections.swap(resolveInfos, 0, indexToSwapWith);
}

private static boolean hasPackageName(ResolveInfo resolveInfo) {
if (resolveInfo == null || resolveInfo.activityInfo == null) {
return false;
}
return resolveInfo.activityInfo.packageName != null;
}

// Avoid anybody to instantiate this class
private ShortcutBadger() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public void executeBadge(Context context, ComponentName componentName, int badge
@Override
public List<String> getSupportLaunchers() {
return Arrays.asList(
"com.huawei.android.launcher"
"com.huawei.android.launcher",
"com.hihonor.android.launcher"
);
}
}