### Question:
ManageDataLauncherActivity extends Activity { @Nullable static ShortcutInfo getSiteSettingsShortcutOrNull(Context context, PackageManager packageManager) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return null; Intent siteSettingsIntent = new Intent(context, ManageDataLauncherActivity.class); siteSettingsIntent.setAction(ACTION_MANAGE_TRUSTED_WEB_ACTIVITY_DATA); List<ResolveInfo> activities = packageManager.queryIntentActivities(siteSettingsIntent, PackageManager.MATCH_DEFAULT_ONLY); if(activities.size() == 0) return null; int shortcutIconId = context.getResources().getIdentifier( OVERRIDE_IC_SITE_SETTINGS_ID, "drawable", context.getPackageName()); return new ShortcutInfo.Builder(context, SITE_SETTINGS_SHORTCUT_ID) .setShortLabel("Site Settings") .setLongLabel("Manage website notifications, permissions, etc.") .setIcon(Icon.createWithResource(context, shortcutIconId != 0 ? shortcutIconId : R.drawable.ic_site_settings)) .setIntent(siteSettingsIntent) .build(); }  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; }### Answer:
@Test @Config(sdk = Build.VERSION_CODES.N_MR1) public void returnsSiteSettingsShortcut() { installTrustedWebActivityProviderWithManageDataAction(TWA_PROVIDER_PACKAGE); assertNotNull(ManageDataLauncherActivity .getSiteSettingsShortcutOrNull(mContext, mPackageManager)); }
@Test @Config(sdk = Build.VERSION_CODES.N) public void returnsNullSiteSettingsShortcutWithLowSDK() { installTrustedWebActivityProviderWithManageDataAction(TWA_PROVIDER_PACKAGE); assertNull(ManageDataLauncherActivity .getSiteSettingsShortcutOrNull(mContext, mPackageManager)); }
@Test @Config(sdk = Build.VERSION_CODES.N_MR1) public void returnsNullSiteSettingsShortcutWhenMissingManageDataLauncherActivity() { assertNull(ManageDataLauncherActivity .getSiteSettingsShortcutOrNull(mContext, mPackageManager)); }