FileDocCategorySizeDatePackage
SELinuxTest.javaAPI DocAndroid 5.1 API1302Thu Mar 12 22:22:12 GMT 2015android.os

SELinuxTest

public class SELinuxTest extends android.test.AndroidTestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtestcheckSELinuxAccess()

        if(SELinux.isSELinuxEnabled() == false)
            return;

        String mycon = SELinux.getContext();
        boolean ret;
        ret = SELinux.checkSELinuxAccess(mycon, mycon, "process", "fork");
        assertEquals(ret,"true");
        ret = SELinux.checkSELinuxAccess(mycon, mycon, "memprotect", "mmap_zero");
        assertEquals(ret,"true");
    
public voidtestgetCon()

        if(SELinux.isSELinuxEnabled() == false)
            return;

        String mycon = SELinux.getContext();
        assertEquals(mycon, "u:r:untrusted_app:s0:c33");
    
public voidtestgetFileCon()

        if(SELinux.isSELinuxEnabled() == false)
            return;

        String ctx = SELinux.getFileContext("/system/bin/toolbox");
        assertEquals(ctx, "u:object_r:system_file:s0");
    
public voidtestgetPidCon()

        if(SELinux.isSELinuxEnabled() == false)
            return;

        String mycon = SELinux.getPidContext(Process.myPid());
        assertEquals(mycon, "u:r:untrusted_app:s0:c33");