Android examples for android.system:Os
Return owning UID of given path, otherwise -1
import android.annotation.NonNull; import android.provider.DocumentsContract; import android.system.ErrnoException; import android.system.Os; public class Main{ /**//www .j a va2s . co m * Return owning UID of given path, otherwise -1. */ public static int getUid(String path) { try { return Os.stat(path).st_uid; } catch (ErrnoException e) { return -1; } } }