public static String shell(int uid, @Nullable String context) {
      // su[ --context <context>][ <uid>]
      String shell = "su";

      if ((context != null) && isSELinuxEnforcing()) {
        String display = version(false);
        String internal = version(true);

        // We only know the format for SuperSU v1.90+ right now
        if ((display != null) &&
            (internal != null) &&
            (display.endsWith("SUPERSU")) &&
            (Integer.valueOf(internal) >= 190)) {
          shell = String.format(Locale.ENGLISH, "%s --context %s", shell, context);
        }
      }

      // Most su binaries support the "su <uid>" format, but in case they don't, lets skip it for
      // the default 0 (root) case
      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.

@param uid
    Uid to use (0 == root)
@param context
    (SELinux) context name to use or null
@return Shell command
imitate/src/main/java/com/engineer/imitate/shell/Shell.java