@Test public void browserWithCategorySupportsSiteSettings() { installTrustedWebActivityProviderWithSiteSettingsCategory(TWA_PROVIDER_PACKAGE); TwaProviderPicker.Action action = TwaProviderPicker.pickProvider(mPackageManager); assertTrue(ManageDataLauncherActivity .packageSupportsSiteSettings(action.provider, mPackageManager)); }
public static boolean packageSupportsSiteSettings(String packageName, PackageManager packageManager) { if (packageName == null) return false; if (ChromeLegacyUtils.supportsSiteSettings(packageManager, packageName)) { return true; } else { Intent customTabsIntent = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION); customTabsIntent.addCategory(CATEGORY_LAUNCH_SITE_SETTINGS); customTabsIntent.setPackage(packageName); List<ResolveInfo> services = packageManager.queryIntentServices(customTabsIntent, PackageManager.GET_RESOLVED_FILTER); return services.size() > 0; } }
ManageDataLauncherActivity extends Activity { public static boolean packageSupportsSiteSettings(String packageName, PackageManager packageManager) { if (packageName == null) return false; if (ChromeLegacyUtils.supportsSiteSettings(packageManager, packageName)) { return true; } else { Intent customTabsIntent = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION); customTabsIntent.addCategory(CATEGORY_LAUNCH_SITE_SETTINGS); customTabsIntent.setPackage(packageName); List<ResolveInfo> services = packageManager.queryIntentServices(customTabsIntent, PackageManager.GET_RESOLVED_FILTER); return services.size() > 0; } } }
ManageDataLauncherActivity extends Activity { public static boolean packageSupportsSiteSettings(String packageName, PackageManager packageManager) { if (packageName == null) return false; if (ChromeLegacyUtils.supportsSiteSettings(packageManager, packageName)) { return true; } else { Intent customTabsIntent = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION); customTabsIntent.addCategory(CATEGORY_LAUNCH_SITE_SETTINGS); customTabsIntent.setPackage(packageName); List<ResolveInfo> services = packageManager.queryIntentServices(customTabsIntent, PackageManager.GET_RESOLVED_FILTER); return services.size() > 0; } }  }
ManageDataLauncherActivity extends Activity { public static boolean packageSupportsSiteSettings(String packageName, PackageManager packageManager) { if (packageName == null) return false; if (ChromeLegacyUtils.supportsSiteSettings(packageManager, packageName)) { return true; } else { Intent customTabsIntent = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION); customTabsIntent.addCategory(CATEGORY_LAUNCH_SITE_SETTINGS); customTabsIntent.setPackage(packageName); List<ResolveInfo> services = packageManager.queryIntentServices(customTabsIntent, PackageManager.GET_RESOLVED_FILTER); return services.size() > 0; } }  static boolean packageSupportsSiteSettings(String packageName,
            PackageManager packageManager); static void addSiteSettingsShortcut(Context context, String packageName); }
ManageDataLauncherActivity extends Activity { public static boolean packageSupportsSiteSettings(String packageName, PackageManager packageManager) { if (packageName == null) return false; if (ChromeLegacyUtils.supportsSiteSettings(packageManager, packageName)) { return true; } else { Intent customTabsIntent = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION); customTabsIntent.addCategory(CATEGORY_LAUNCH_SITE_SETTINGS); customTabsIntent.setPackage(packageName); List<ResolveInfo> services = packageManager.queryIntentServices(customTabsIntent, PackageManager.GET_RESOLVED_FILTER); return services.size() > 0; } }  static boolean packageSupportsSiteSettings(String packageName,
            PackageManager packageManager); static void addSiteSettingsShortcut(Context context, String packageName); static final String ACTION_MANAGE_TRUSTED_WEB_ACTIVITY_DATA; static final String SITE_SETTINGS_SHORTCUT_ID; static final String CATEGORY_LAUNCH_SITE_SETTINGS; static final String OVERRIDE_IC_SITE_SETTINGS_ID; }