|
|
@ -78,8 +78,12 @@ public final class ShortcutBadger {
|
|
|
|
public static boolean applyCount(Context context, int badgeCount) {
|
|
|
|
public static boolean applyCount(Context context, int badgeCount) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
applyCountOrThrow(context, badgeCount);
|
|
|
|
applyCountOrThrow(context, badgeCount);
|
|
|
|
|
|
|
|
eu.faircode.email.EntityLog.log(context, "Applied badge count=" + badgeCount +
|
|
|
|
|
|
|
|
" badger=" + sShortcutBadger.getClass());
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} catch (ShortcutBadgeException e) {
|
|
|
|
} catch (ShortcutBadgeException e) {
|
|
|
|
|
|
|
|
eu.faircode.email.EntityLog.log(context, "badger=" + sShortcutBadger.getClass() + "\n" +
|
|
|
|
|
|
|
|
e + "\n" + Log.getStackTraceString(e));
|
|
|
|
if (Log.isLoggable(LOG_TAG, Log.DEBUG)) {
|
|
|
|
if (Log.isLoggable(LOG_TAG, Log.DEBUG)) {
|
|
|
|
Log.d(LOG_TAG, "Unable to execute badge", e);
|
|
|
|
Log.d(LOG_TAG, "Unable to execute badge", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -210,6 +214,10 @@ public final class ShortcutBadger {
|
|
|
|
ResolveInfo resolveInfoDefault = context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
|
|
|
ResolveInfo resolveInfoDefault = context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
|
|
|
validateInfoList(resolveInfoDefault, resolveInfos);
|
|
|
|
validateInfoList(resolveInfoDefault, resolveInfos);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (ResolveInfo ri : resolveInfos)
|
|
|
|
|
|
|
|
eu.faircode.email.EntityLog.log(context, "Badger pkg=" + ri.activityInfo.packageName +
|
|
|
|
|
|
|
|
(ri.activityInfo.packageName.equals(resolveInfoDefault.activityInfo.packageName) ? "*" : ""));
|
|
|
|
|
|
|
|
|
|
|
|
for (ResolveInfo resolveInfo : resolveInfos) {
|
|
|
|
for (ResolveInfo resolveInfo : resolveInfos) {
|
|
|
|
String currentHomePackage = resolveInfo.activityInfo.packageName;
|
|
|
|
String currentHomePackage = resolveInfo.activityInfo.packageName;
|
|
|
|
|
|
|
|
|
|
|
@ -231,6 +239,9 @@ public final class ShortcutBadger {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eu.faircode.email.EntityLog.log(context, "Selected badger=" +
|
|
|
|
|
|
|
|
(sShortcutBadger == null ? null : sShortcutBadger.getClass()));
|
|
|
|
|
|
|
|
|
|
|
|
if (sShortcutBadger == null) {
|
|
|
|
if (sShortcutBadger == null) {
|
|
|
|
if (Build.MANUFACTURER.equalsIgnoreCase("ZUK"))
|
|
|
|
if (Build.MANUFACTURER.equalsIgnoreCase("ZUK"))
|
|
|
|
sShortcutBadger = new ZukHomeBadger();
|
|
|
|
sShortcutBadger = new ZukHomeBadger();
|
|
|
@ -244,6 +255,8 @@ public final class ShortcutBadger {
|
|
|
|
sShortcutBadger = new DefaultBadger();
|
|
|
|
sShortcutBadger = new DefaultBadger();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eu.faircode.email.EntityLog.log(context, "Using badger=" + sShortcutBadger.getClass());
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|