|
|
@@ -995,6 +995,27 @@ public class SysAppUtil {
|
|
|
//是否有快捷方式的权限
|
|
|
public static boolean hasShortcut(Context context, String appName) {
|
|
|
LogUtil.println("hasShortcut appName = " + appName);
|
|
|
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
|
|
|
+ ShortcutManager shortcutManager = (ShortcutManager) context.getSystemService(Context.SHORTCUT_SERVICE);
|
|
|
+ List<ShortcutInfo> list = shortcutManager.getPinnedShortcuts();
|
|
|
+ if(!ListUtil.isEmpty(list)) {
|
|
|
+ for (ShortcutInfo shortcutInfo : list) {
|
|
|
+ if(shortcutInfo.getLongLabel() != null && TextUtils.equals(shortcutInfo.getLongLabel().toString(), appName)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1){
|
|
|
+ ShortcutManager systemService = context.getSystemService(ShortcutManager.class);
|
|
|
+ List<ShortcutInfo> list = systemService.getDynamicShortcuts();
|
|
|
+ if(!ListUtil.isEmpty(list)) {
|
|
|
+ for (ShortcutInfo shortcutInfo : list) {
|
|
|
+ if(shortcutInfo.getLongLabel() != null && TextUtils.equals(shortcutInfo.getLongLabel().toString(), appName)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
long start = System.currentTimeMillis();
|
|
|
String authority = getAuthorityFromPermission(context);
|
|
|
if (authority == null) {
|