public static String shell(int uid,String context){
  String shell="su";
  if ((context != null) && isSELinuxEnforcing()) {
    String display=version(false);
    String internal=version(true);
    if ((display != null) && (internal != null) && (display.endsWith("SUPERSU"))&& (Integer.valueOf(internal) >= 190)) {
      shell=String.format(Locale.ENGLISH,"%s --context %s",shell,context);
    }
  }
  if (uid > 0) {
    shell=String.format(Locale.ENGLISH,"%s %d",shell,uid);
  }
  return shell;
}

public static String shell ( int uid , String context ) { String shell = "su" ; if ( ( context != null ) && isSELinuxEnforcing ( ) ) { String display = version ( false ) ; String internal = version ( true ) ; if ( ( display != null ) && ( internal != null ) && ( display . endsWith ( "SUPERSU" ) ) && ( Integer . valueOf ( internal ) >= 190 ) ) { shell = String . format ( Locale . ENGLISH , "%s --context %s" , shell , context ) ; } } if ( uid > 0 ) { shell = String . format ( Locale . ENGLISH , "%s %d" , shell , uid ) ; } return shell ; }
constructs a shell command to start a su shell using the supplied uid and selinux context . this is can be an expensive operation , consider caching the result .
