public static ExternalAppId determineExternalIntentSource(String packageName,Intent intent){
  String appId=IntentUtils.safeGetStringExtra(intent,Browser.EXTRA_APPLICATION_ID);
  ExternalAppId externalId=ExternalAppId.OTHER;
  if (appId == null) {
    String url=getUrlFromIntent(intent);
    if (url != null && url.startsWith(TWITTER_LINK_PREFIX)) {
      externalId=ExternalAppId.TWITTER;
    }
 else     if (url != null && url.startsWith(FACEBOOK_LINK_PREFIX)) {
      externalId=ExternalAppId.FACEBOOK;
    }
 else     if (url != null && url.startsWith(NEWS_LINK_PREFIX)) {
      externalId=ExternalAppId.NEWS;
    }
  }
 else {
    if (appId.equals(PACKAGE_PLUS)) {
      externalId=ExternalAppId.PLUS;
    }
 else     if (appId.equals(PACKAGE_GMAIL)) {
      externalId=ExternalAppId.GMAIL;
    }
 else     if (appId.equals(PACKAGE_HANGOUTS)) {
      externalId=ExternalAppId.HANGOUTS;
    }
 else     if (appId.equals(PACKAGE_MESSENGER)) {
      externalId=ExternalAppId.MESSENGER;
    }
 else     if (appId.equals(PACKAGE_LINE)) {
      externalId=ExternalAppId.LINE;
    }
 else     if (appId.equals(PACKAGE_WHATSAPP)) {
      externalId=ExternalAppId.WHATSAPP;
    }
 else     if (appId.equals(PACKAGE_GSA)) {
      externalId=ExternalAppId.GSA;
    }
 else     if (appId.equals(packageName)) {
      externalId=ExternalAppId.CHROME;
    }
  }
  return externalId;
}

public static ExternalAppId determineExternalIntentSource ( String packageName , Intent intent ) { String appId = IntentUtils . safeGetStringExtra ( intent , Browser . EXTRA_APPLICATION_ID ) ; ExternalAppId externalId = ExternalAppId . OTHER ; if ( appId == null ) { String url = getUrlFromIntent ( intent ) ; if ( url != null && url . startsWith ( TWITTER_LINK_PREFIX ) ) { externalId = ExternalAppId . TWITTER ; } else if ( url != null && url . startsWith ( FACEBOOK_LINK_PREFIX ) ) { externalId = ExternalAppId . FACEBOOK ; } else if ( url != null && url . startsWith ( NEWS_LINK_PREFIX ) ) { externalId = ExternalAppId . NEWS ; } } else { if ( appId . equals ( PACKAGE_PLUS ) ) { externalId = ExternalAppId . PLUS ; } else if ( appId . equals ( PACKAGE_GMAIL ) ) { externalId = ExternalAppId . GMAIL ; } else if ( appId . equals ( PACKAGE_HANGOUTS ) ) { externalId = ExternalAppId . HANGOUTS ; } else if ( appId . equals ( PACKAGE_MESSENGER ) ) { externalId = ExternalAppId . MESSENGER ; } else if ( appId . equals ( PACKAGE_LINE ) ) { externalId = ExternalAppId . LINE ; } else if ( appId . equals ( PACKAGE_WHATSAPP ) ) { externalId = ExternalAppId . WHATSAPP ; } else if ( appId . equals ( PACKAGE_GSA ) ) { externalId = ExternalAppId . GSA ; } else if ( appId . equals ( packageName ) ) { externalId = ExternalAppId . CHROME ; } } return externalId ; }
determines what app was used to fire this intent .
